Add basic vagrant compilation capability
Add FREECAD_USER_DATA environment variable required to support snap on ubuntu which is using Apparmor to limit application access to filesystem. Add automatic snap build on Xenial (ubuntu 16.04) within Vagrant build Info Build results are into /home/vagrant/Results (deb + snap
This commit is contained in:
committed by
wmayer
parent
39ab11c701
commit
04f5a8b0de
@@ -1909,7 +1909,12 @@ void Application::ExtractUserPath()
|
||||
if (pwd == NULL)
|
||||
throw Base::Exception("Getting HOME path from system failed!");
|
||||
mConfig["UserHomePath"] = pwd->pw_dir;
|
||||
std::string appData = pwd->pw_dir;
|
||||
char *path="/tmp";
|
||||
if ( FCUserData=getenv("FREECAD_USER_DATA") )
|
||||
path=FCUserData;
|
||||
else
|
||||
path= pwd->pw_dir;
|
||||
std::string appData(path);
|
||||
Base::FileInfo fi(appData.c_str());
|
||||
if (!fi.exists()) {
|
||||
// This should never ever happen
|
||||
|
||||
261
vagrant/FreeCAD.sh
Normal file
261
vagrant/FreeCAD.sh
Normal file
@@ -0,0 +1,261 @@
|
||||
#!/bin/bash
|
||||
# Vagrant provisioning script to build up FreeCAD based on OCCT 7 and Salome 7.7.1 on Linux Ubuntu
|
||||
# (c) 2016 Jean-Marie Verdun / vejmarie (vejmarie@ruggedpod.qyshare.com)
|
||||
# Released under GPL v2.0
|
||||
# Provided without any warranty
|
||||
# Warning: compilation time is long quite long
|
||||
# Must add the autlogin script
|
||||
# Must add a lightdm start / reboot ?
|
||||
FREECAD_GIT_BRANCH="https://github.com/vejmarie/FreeCAD"
|
||||
|
||||
function create_deb {
|
||||
rm -rf /tmp/$1-$2
|
||||
mkdir /tmp/$1-$2
|
||||
mkdir /tmp/$1-$2/DEBIAN
|
||||
echo "Package:$1" >> /tmp/$1-$2/DEBIAN/control
|
||||
echo "Version:$2" >> /tmp/$1-$2/DEBIAN/control
|
||||
echo "Section:base" >> /tmp/$1-$2/DEBIAN/control
|
||||
echo "Priority:optional" >> /tmp/$1-$2/DEBIAN/control
|
||||
echo "Architecture:amd64" >> /tmp/$1-$2/DEBIAN/control
|
||||
echo "Depends:"$3 >> /tmp/$1-$2/DEBIAN/control
|
||||
echo "Maintainer:vejmarie@ruggedpod.qyshare.com" >> /tmp/$1-$2/DEBIAN/control
|
||||
echo "Homepage:http://ruggedpod.qyshare.com" >> /tmp/$1-$2/DEBIAN/control
|
||||
echo "Description:TEST PACKAGE" >> /tmp/$1-$2/DEBIAN/control
|
||||
file_list=`ls -ltd $(find /opt/local/FreeCAD-0.17) | awk '{ print $9}'`
|
||||
for file in $file_list
|
||||
do
|
||||
is_done=`cat /tmp/stage | grep $file`
|
||||
if [ "$is_done" == "" ]
|
||||
then
|
||||
# The file must be integrated into the new deb
|
||||
cp --parents $file /tmp/$1-$2
|
||||
echo $file >> /tmp/stage
|
||||
fi
|
||||
done
|
||||
current_dir=`pwd`
|
||||
cd /tmp
|
||||
dpkg-deb --build $1-$2
|
||||
mv $1-$2.deb $1-$2_trusty-amd64.deb
|
||||
cd $current_dir
|
||||
}
|
||||
|
||||
# If we are running ubuntu we must know if we are under Xenial (latest release) or Trusty which
|
||||
# doesn't support the same package name
|
||||
|
||||
is_ubuntu=`lsb_release -a | grep -i Distributor | awk '{ print $3}'`
|
||||
if [ "$is_ubuntu" == "Ubuntu" ]
|
||||
then
|
||||
ubuntu_version=`lsb_release -a | grep -i codename | awk '{ print $2 }'`
|
||||
if [ "$ubuntu_version" == "xenial" ]
|
||||
then
|
||||
package_list=" doxygen \
|
||||
libboost1.58-dev \
|
||||
libboost-filesystem1.58-dev \
|
||||
libboost-program-options1.58-dev \
|
||||
libboost-python1.58-dev \
|
||||
libboost-regex1.58-dev \
|
||||
libboost-signals1.58-dev \
|
||||
libboost-system1.58-dev \
|
||||
libboost-thread1.58-dev \
|
||||
libcoin80v5 \
|
||||
libcoin80-dev \
|
||||
libeigen3-dev \
|
||||
libpyside-dev \
|
||||
libqtcore4 \
|
||||
libshiboken-dev \
|
||||
libxerces-c-dev \
|
||||
libxmu-dev \
|
||||
libxmu-headers \
|
||||
libxmu6 \
|
||||
libxmuu-dev \
|
||||
libxmuu1 \
|
||||
pyside-tools \
|
||||
python-dev \
|
||||
python-pyside \
|
||||
python-matplotlib \
|
||||
qt4-dev-tools \
|
||||
qt4-qmake \
|
||||
libqtwebkit-dev \
|
||||
shiboken \
|
||||
swig"
|
||||
else
|
||||
ubuntu_version="unknown"
|
||||
package_list=" doxygen \
|
||||
libboost1.55-dev \
|
||||
libboost-filesystem1.55-dev \
|
||||
libboost-program-options1.55-dev \
|
||||
libboost-python1.55-dev \
|
||||
libboost-regex1.55-dev \
|
||||
libboost-signals1.55-dev \
|
||||
libboost-system1.55-dev \
|
||||
libboost-thread1.55-dev \
|
||||
libcoin80 \
|
||||
libcoin80-dev \
|
||||
libeigen3-dev \
|
||||
libpyside-dev \
|
||||
libqtcore4 \
|
||||
libshiboken-dev \
|
||||
libxerces-c-dev \
|
||||
libxmu-dev \
|
||||
libxmu-headers \
|
||||
libxmu6 \
|
||||
libxmuu-dev \
|
||||
libxmuu1 \
|
||||
pyside-tools \
|
||||
python-dev \
|
||||
python-pyside \
|
||||
python-matplotlib \
|
||||
qt4-dev-tools \
|
||||
qt4-qmake \
|
||||
shiboken \
|
||||
swig"
|
||||
fi
|
||||
fi
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y dictionaries-common
|
||||
sudo apt-get install -y $package_list
|
||||
sudo apt-get install -y python-pivy
|
||||
sudo apt-get install -y git
|
||||
sudo apt-get install -y cmake
|
||||
sudo apt-get install -y g++
|
||||
sudo apt-get install -y libfreetype6-dev
|
||||
sudo apt-get install -y tcl8.5-dev tk8.5-dev
|
||||
sudo apt-get install -y libtogl-dev
|
||||
sudo apt-get install -y libhdf5-dev
|
||||
sudo apt-get install -y xfce4 xfce4-goodies
|
||||
sudo apt-get install -y xubuntu-default-settings
|
||||
sudo apt-get install -y lightdm
|
||||
sudo apt-get install -y automake
|
||||
sudo apt-get install -y libcanberra-gtk-module
|
||||
sudo apt-get install -y libcanberra-gtk3-module overlay-scrollbar-gtk2 unity-gtk-module-common libatk-bridge2.0-0 unity-gtk2-module libatk-adaptor
|
||||
myversion=`lsb_release -a | grep -i Distributor | awk '{ print $3}'`
|
||||
if [ "$myversion" != "Ubuntu" ]
|
||||
then
|
||||
sudo cat /etc/lightdm/lightdm.conf | sed 's/\#autologin-user=/autologin-user=vagrant/' > /tmp/lightdm.conf
|
||||
sudo cp /tmp/lightdm.conf /etc/lightdm/lightdm.conf
|
||||
sudo /etc/init.d/lightdm start
|
||||
sudo apt-get install libmed
|
||||
sudo apt-get install libmedc
|
||||
sudo apt-get install -y libmed-dev
|
||||
sudo apt-get install -y libmedc-dev
|
||||
else
|
||||
cat <<EOF >& /tmp/lightdm.conf
|
||||
[SeatDefaults]
|
||||
user-session=xfce
|
||||
autologin-session=xfce
|
||||
autologin-user=ubuntu
|
||||
autologin-user-timeout=0
|
||||
greeter-session=xfce
|
||||
pam-service=lightdm-autologin
|
||||
EOF
|
||||
sudo cp /tmp/lightdm.conf /etc/lightdm/
|
||||
sudo rm /etc/lightdm/lightdm-gtk-greeter.conf
|
||||
sudo /etc/init.d/lightdm start &
|
||||
|
||||
# Building MED
|
||||
|
||||
git clone https://github.com/vejmarie/libMED.git
|
||||
cd libMED
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/local/FreeCAD-0.17 ..
|
||||
make -j 2
|
||||
sudo make install
|
||||
cd ../..
|
||||
fi
|
||||
|
||||
# I must create the package
|
||||
|
||||
create_deb MED 3.10 ""
|
||||
|
||||
# Building VTK
|
||||
|
||||
wget http://www.vtk.org/files/release/7.0/VTK-7.0.0.tar.gz
|
||||
gunzip VTK-7.0.0.tar.gz
|
||||
tar xf VTK-7.0.0.tar
|
||||
rm VTK-7.0.0.tar
|
||||
cd VTK-7.0.0
|
||||
mkdir build
|
||||
cd build
|
||||
# cmake .. -DVTK_RENDERING_BACKEND=OpenGL
|
||||
cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/opt/local/FreeCAD-0.17 -DVTK_Group_Rendering:BOOL=OFF -DVTK_Group_StandAlone:BOOL=ON -DVTK_RENDERING_BACKEND=None
|
||||
make -j 2
|
||||
sudo make install
|
||||
|
||||
create_deb VTK 7.0 ""
|
||||
|
||||
# Building OCCT
|
||||
|
||||
cd ../..
|
||||
wget "http://git.dev.opencascade.org/gitweb/?p=occt.git;a=snapshot;h=b00770133187b83761e651df50051b2fa3433858;sf=tgz"
|
||||
mv "index.html?p=occt.git;a=snapshot;h=b00770133187b83761e651df50051b2fa3433858;sf=tgz" occt.tgz
|
||||
gunzip occt.tgz
|
||||
tar xf occt.tar
|
||||
rm occt.tar
|
||||
cd occt-b007701
|
||||
grep -v vtkRenderingFreeTypeOpenGL src/TKIVtk/EXTERNLIB >& /tmp/EXTERNLIB
|
||||
\cp /tmp/EXTERNLIB src/TKIVtk/EXTERNLIB
|
||||
grep -v vtkRenderingFreeTypeOpenGL src/TKIVtkDraw/EXTERNLIB >& /tmp/EXTERNLIB
|
||||
\cp /tmp/EXTERNLIB src/TKIVtkDraw/EXTERNLIB
|
||||
mkdir build
|
||||
cd build
|
||||
# cmake .. -DUSE_VTK:BOOL=ON
|
||||
cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/opt/local/FreeCAD-0.17 -DUSE_VTK:BOOL=OFF
|
||||
sudo make -j 2
|
||||
sudo make install
|
||||
|
||||
create_deb OCCT 7.0 "vtk (>= 7.0), med (>= 3.10)"
|
||||
|
||||
# Building Netgen
|
||||
|
||||
cd ../..
|
||||
git clone https://github.com/vejmarie/Netgen
|
||||
cd Netgen/netgen-5.3.1
|
||||
./configure --prefix=/opt/local/FreeCAD-0.17 --with-tcl=/usr/lib/tcl8.5 --with-tk=/usr/lib/tk8.5 --enable-occ --with-occ=/opt/local/FreeCAD-0.17 --enable-shared --enable-nglib CXXFLAGS="-DNGLIB_EXPORTS -std=gnu++11"
|
||||
make -j 2
|
||||
sudo make install
|
||||
cd ../..
|
||||
sudo cp -rf Netgen/netgen-5.3.1 /usr/share/netgen
|
||||
|
||||
create_deb Netgen 5.3.1 "occt (>= 7.0)"
|
||||
|
||||
#building FreeCAD
|
||||
|
||||
git clone $FREECAD_GIT_BRANCH
|
||||
cd FreeCAD
|
||||
git checkout occt7
|
||||
cat cMake/FindOpenCasCade.cmake | sed 's/\/usr\/local\/share\/cmake\//\/opt\/local\/FreeCAD-0.17\/lib\/cmake/' > /tmp/FindOpenCasCade.cmake
|
||||
cp /tmp/FindOpenCasCade.cmake cMake/FindOpenCasCade.cmake
|
||||
cp cMake/FindOpenCasCade.cmake cMake/FindOPENCASCADE.cmake
|
||||
cd ..
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ../FreeCAD -DCMAKE_INSTALL_PREFIX:PATH=/opt/local/FreeCAD-0.17 -DBUILD_FEM=1 -DBUILD_FEM_NETGEN=1 -DCMAKE_CXX_FLAGS="-DNETGEN_V5"
|
||||
make -j 2
|
||||
make install
|
||||
create_deb FreeCAD 0.17 "netgen (>= 5.3.1), occt (>= 7.0), med (>= 3.10)"
|
||||
source_dir=`pwd`
|
||||
cd /tmp
|
||||
mkdir deb
|
||||
mv *.deb deb
|
||||
cd deb
|
||||
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
|
||||
|
||||
if [ "$ubuntu_version" == "xenial" ]
|
||||
then
|
||||
#Let's build the snap
|
||||
mkdir snap
|
||||
cd snap
|
||||
cp -Rf $source_dir/FreeCAD/vagrant/Xenial .
|
||||
cd Xenial
|
||||
apt-get install -y snapcraft
|
||||
./generate_yaml.sh
|
||||
snapcraft
|
||||
mv freecad_0.17_amd64.snap /tmp
|
||||
fi
|
||||
mkdir $source_dir/Results
|
||||
mv /tmp/*.deb $source_dir/Results
|
||||
if [ -f "/tmp/freecad_0.17_amd64.snap" ]
|
||||
then
|
||||
mv /tmp/freecad_0.17_amd64.snap $source_dir/Results
|
||||
fi
|
||||
2
vagrant/README
Normal file
2
vagrant/README
Normal file
@@ -0,0 +1,2 @@
|
||||
To build FreeCAD on trusty/xenial using vagrant please copy either Vagrantfile.trusty/Vagrantfile.xenial to Vagrantfile then kick from this directory vagrant up. Go have a drink compilation can be very long
|
||||
Build results are kept into the vm, use vagrant ssh to connect to it and go into Results directory where you will get your deb and snap files
|
||||
76
vagrant/Vagrantfile.trusty
Normal file
76
vagrant/Vagrantfile.trusty
Normal file
@@ -0,0 +1,76 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
||||
# configures the configuration version (we support older styles for
|
||||
# backwards compatibility). Please don't change it unless you know what
|
||||
# you're doing.
|
||||
Vagrant.configure(2) do |config|
|
||||
# The most common configuration options are documented and commented below.
|
||||
# For a complete reference, please see the online documentation at
|
||||
# https://docs.vagrantup.com.
|
||||
|
||||
# Every Vagrant development environment requires a box. You can search for
|
||||
# boxes at https://atlas.hashicorp.com/search.
|
||||
# config.vm.box = "debian/jessie64"
|
||||
# config.vm.box = "ubuntu/xenial64"
|
||||
config.vm.box = "ubuntu/trusty64"
|
||||
|
||||
# Disable automatic box update checking. If you disable this, then
|
||||
# boxes will only be checked for updates when the user runs
|
||||
# `vagrant box outdated`. This is not recommended.
|
||||
# config.vm.box_check_update = false
|
||||
|
||||
# Create a forwarded port mapping which allows access to a specific port
|
||||
# within the machine from a port on the host machine. In the example below,
|
||||
# accessing "localhost:8080" will access port 80 on the guest machine.
|
||||
# config.vm.network "forwarded_port", guest: 80, host: 8080
|
||||
|
||||
# Create a private network, which allows host-only access to the machine
|
||||
# using a specific IP.
|
||||
# config.vm.network "private_network", ip: "192.168.33.10"
|
||||
|
||||
# Create a public network, which generally matched to bridged network.
|
||||
# Bridged networks make the machine appear as another physical device on
|
||||
# your network.
|
||||
# config.vm.network "public_network"
|
||||
|
||||
# Share an additional folder to the guest VM. The first argument is
|
||||
# the path on the host to the actual folder. The second argument is
|
||||
# the path on the guest to mount the folder. And the optional third
|
||||
# argument is a set of non-required options.
|
||||
# config.vm.synced_folder "./source"
|
||||
|
||||
# Provider-specific configuration so you can fine-tune various
|
||||
# backing providers for Vagrant. These expose provider-specific options.
|
||||
# Example for VirtualBox:
|
||||
#
|
||||
config.vm.provider "virtualbox" do |vb|
|
||||
# # Display the VirtualBox GUI when booting the machine
|
||||
vb.gui = true
|
||||
# # Customize the amount of memory on the VM:
|
||||
vb.memory = "4096"
|
||||
vb.cpus = 2
|
||||
end
|
||||
|
||||
config.vm.provision :shell, path: "FreeCAD.sh"
|
||||
|
||||
#
|
||||
# View the documentation for the provider you are using for more
|
||||
# information on available options.
|
||||
|
||||
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
|
||||
# such as FTP and Heroku are also available. See the documentation at
|
||||
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
|
||||
# config.push.define "atlas" do |push|
|
||||
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
|
||||
# end
|
||||
|
||||
# Enable provisioning with a shell script. Additional provisioners such as
|
||||
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
|
||||
# documentation for more information about their specific syntax and use.
|
||||
# config.vm.provision "shell", inline: <<-SHELL
|
||||
# sudo apt-get update
|
||||
# sudo apt-get install -y apache2
|
||||
# SHELL
|
||||
end
|
||||
76
vagrant/Vagrantfile.xenial
Normal file
76
vagrant/Vagrantfile.xenial
Normal file
@@ -0,0 +1,76 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
||||
# configures the configuration version (we support older styles for
|
||||
# backwards compatibility). Please don't change it unless you know what
|
||||
# you're doing.
|
||||
Vagrant.configure(2) do |config|
|
||||
# The most common configuration options are documented and commented below.
|
||||
# For a complete reference, please see the online documentation at
|
||||
# https://docs.vagrantup.com.
|
||||
|
||||
# Every Vagrant development environment requires a box. You can search for
|
||||
# boxes at https://atlas.hashicorp.com/search.
|
||||
# config.vm.box = "debian/jessie64"
|
||||
config.vm.box = "ubuntu/xenial64"
|
||||
# config.vm.box = "ubuntu/trusty64"
|
||||
|
||||
# Disable automatic box update checking. If you disable this, then
|
||||
# boxes will only be checked for updates when the user runs
|
||||
# `vagrant box outdated`. This is not recommended.
|
||||
# config.vm.box_check_update = false
|
||||
|
||||
# Create a forwarded port mapping which allows access to a specific port
|
||||
# within the machine from a port on the host machine. In the example below,
|
||||
# accessing "localhost:8080" will access port 80 on the guest machine.
|
||||
# config.vm.network "forwarded_port", guest: 80, host: 8080
|
||||
|
||||
# Create a private network, which allows host-only access to the machine
|
||||
# using a specific IP.
|
||||
# config.vm.network "private_network", ip: "192.168.33.10"
|
||||
|
||||
# Create a public network, which generally matched to bridged network.
|
||||
# Bridged networks make the machine appear as another physical device on
|
||||
# your network.
|
||||
# config.vm.network "public_network"
|
||||
|
||||
# Share an additional folder to the guest VM. The first argument is
|
||||
# the path on the host to the actual folder. The second argument is
|
||||
# the path on the guest to mount the folder. And the optional third
|
||||
# argument is a set of non-required options.
|
||||
# config.vm.synced_folder "./source"
|
||||
|
||||
# Provider-specific configuration so you can fine-tune various
|
||||
# backing providers for Vagrant. These expose provider-specific options.
|
||||
# Example for VirtualBox:
|
||||
#
|
||||
config.vm.provider "virtualbox" do |vb|
|
||||
# # Display the VirtualBox GUI when booting the machine
|
||||
vb.gui = true
|
||||
# # Customize the amount of memory on the VM:
|
||||
vb.memory = "4096"
|
||||
vb.cpus = 1
|
||||
end
|
||||
|
||||
config.vm.provision :shell, path: "FreeCAD.sh"
|
||||
|
||||
#
|
||||
# View the documentation for the provider you are using for more
|
||||
# information on available options.
|
||||
|
||||
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
|
||||
# such as FTP and Heroku are also available. See the documentation at
|
||||
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
|
||||
# config.push.define "atlas" do |push|
|
||||
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
|
||||
# end
|
||||
|
||||
# Enable provisioning with a shell script. Additional provisioners such as
|
||||
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
|
||||
# documentation for more information about their specific syntax and use.
|
||||
# config.vm.provision "shell", inline: <<-SHELL
|
||||
# sudo apt-get update
|
||||
# sudo apt-get install -y apache2
|
||||
# SHELL
|
||||
end
|
||||
BIN
vagrant/Xenial/bin/freecad.png
Normal file
BIN
vagrant/Xenial/bin/freecad.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.0 KiB |
15
vagrant/Xenial/bin/launcher
Executable file
15
vagrant/Xenial/bin/launcher
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
export LIBGL_DRIVERS_PATH=$SNAP/usr/lib/x86_64-linux-gnu/dri
|
||||
export GTK_PATH=$SNAP/usr/lib/x86_64-linux-gnu/gtk-2.0/modules
|
||||
export LD_LIBRARY_PATH=$SNAP/usr/lib/x86_64-linux-gnu/gtk-2.0/modules:$LD_LIBRARY_PATH
|
||||
export GTK_DATA_PREFIX=$SNAP_USER_DATA
|
||||
export GTK_EXE_PREFIX=$SNAP/usr
|
||||
export GDK_PIXBUF_MODULE_FILE=$SNAP/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache
|
||||
export PYTHONHOME="$SNAP/usr"
|
||||
export PYTHONPATH="$SNAP/usr"
|
||||
export XDG_DATA_DIR="$SNAP/usr/share/glib-2.0/schemas"
|
||||
export GSETTINGS_SCHEMA_DIR="$SNAP/usr/share/glib-2.0/schemas"
|
||||
export I18NPATH=$SNAP/usr/share/i18n/locales
|
||||
export LOCPATH=$SNAP/usr/lib/locale/
|
||||
exec "$SNAP/opt/local/FreeCAD-0.17/bin/FreeCAD" -u $SNAP_USER_DATA/user.cfg -s $SNAP_USER_DATA/system.cfg "$@"
|
||||
|
||||
67
vagrant/Xenial/bin/license.txt
Normal file
67
vagrant/Xenial/bin/license.txt
Normal file
File diff suppressed because one or more lines are too long
105
vagrant/Xenial/generate_yaml.sh
Executable file
105
vagrant/Xenial/generate_yaml.sh
Executable file
@@ -0,0 +1,105 @@
|
||||
#!/bin/bash
|
||||
# snapcraft yaml automatic generation tool for FreeCAD 0.17
|
||||
# (c) 2017 vejmarie
|
||||
# Distributed under LGPL v2.0
|
||||
# Please report bugs at vejmarie@ruggedpod.qyshare.com
|
||||
|
||||
rm snapcraft.yaml
|
||||
lib_list=`ls /opt/local/FreeCAD-0.17/lib/*.so`
|
||||
mod_list=`ls -ltd $(find /opt/local/FreeCAD-0.17/Mod) | awk '{ print $9}'`
|
||||
bin_list=`ls -ltd $(find /opt/local/FreeCAD-0.17/bin) | awk '{ print $9}'`
|
||||
data_list=`ls -ltd $(find /opt/local/FreeCAD-0.17/data) | awk '{ print $9}'`
|
||||
python_list=`ls -ltd $(find /usr/lib/python2.7) | awk '{ print $9}'`
|
||||
pyside_list=`ls -ltd $(find /usr/share/PySide/typesystems) | awk '{ print $9}'`
|
||||
python_binary=`ls /usr/bin/python /usr/bin/py*2.7`
|
||||
syslib=`ls -ltd $(find /usr/lib/x86_64-linux-gnu/dri) | awk '{ print $9}'`
|
||||
syslib2=`ls -ltd $(find /usr/lib/x86_64-linux-gnu/gtk-2.0) | awk '{ print $9}'`
|
||||
syslib3=`ls -ltd $(find /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0) | awk '{ print $9}'`
|
||||
syslib4=`ls -ltd $(find /usr/lib/locale) | awk '{ print $9}'`
|
||||
syslib5=`ls -ltd $(find /usr/share/X11/locale) | awk '{ print $9}'`
|
||||
syslib6=`ls -ltd $(find /usr/lib/x86_64-linux-gnu/*gtk*) | awk '{ print $9}'`
|
||||
syslib7=`ls -ltd $(find /usr/share/glib-2.0) | awk '{ print $9}'`
|
||||
syslib8=`ls -ltd $(find /usr/share/i18n/locales) | awk '{ print $9}'`
|
||||
echo "
|
||||
name: freecad
|
||||
version: 0.17
|
||||
summary: development version
|
||||
description: development version This version is far from being bug free but integrates the latest FreeCAD technologies
|
||||
parts:
|
||||
example-part:
|
||||
plugin: copy
|
||||
files:
|
||||
bin/launcher : bin/launcher" >> snapcraft.yaml
|
||||
# bin/FreeCAD : opt/local/FreeCAD-0.17/bin/FreeCAD" >> snapcraft.yaml
|
||||
for i in $bin_list
|
||||
do
|
||||
if [ ! -d "$i" ]
|
||||
then
|
||||
second_name=`echo $i | sed 's/\///'`
|
||||
echo " $i : $second_name" >> snapcraft.yaml
|
||||
fi
|
||||
done
|
||||
for i in $lib_list
|
||||
do
|
||||
second_name=`echo $i | sed 's/\///'`
|
||||
echo " $i : $second_name" >> snapcraft.yaml
|
||||
done
|
||||
for i in $mod_list
|
||||
do
|
||||
if [ ! -d "$i" ]
|
||||
then
|
||||
second_name=`echo $i | sed 's/\///'`
|
||||
echo " $i : $second_name" >> snapcraft.yaml
|
||||
fi
|
||||
done
|
||||
for i in $data_list
|
||||
do
|
||||
if [ ! -d "$i" ]
|
||||
then
|
||||
second_name=`echo $i | sed 's/\///'`
|
||||
echo " $i : $second_name" >> snapcraft.yaml
|
||||
fi
|
||||
done
|
||||
for i in $python_list $pyside_list
|
||||
do
|
||||
if [ ! -d "$i" ]
|
||||
then
|
||||
second_name=`echo $i | sed 's/\///'`
|
||||
echo " $i : $second_name" >> snapcraft.yaml
|
||||
fi
|
||||
done
|
||||
for i in $python_binary
|
||||
do
|
||||
if [ ! -d "$i" ]
|
||||
then
|
||||
second_name=`echo $i | sed 's/\///'`
|
||||
echo " $i : $second_name" >> snapcraft.yaml
|
||||
fi
|
||||
done
|
||||
for i in $syslib $syslib2 $syslib3 $syslib4 $syslib5 $syslib6 $syslib7 $syslib8
|
||||
do
|
||||
if [ ! -d "$i" ]
|
||||
then
|
||||
second_name=`echo $i | sed 's/\///'`
|
||||
echo " $i : $second_name" >> snapcraft.yaml
|
||||
fi
|
||||
done
|
||||
# python:
|
||||
# plugin: python2
|
||||
echo "
|
||||
snap:
|
||||
- bin/launcher
|
||||
- opt/local/FreeCAD-0.17/bin/FreeCAD
|
||||
- opt
|
||||
- usr" >> snapcraft.yaml
|
||||
for i in $lib_list
|
||||
do
|
||||
second_name=`echo $i | sed 's/\///'`
|
||||
echo " - $second_name" >> snapcraft.yaml
|
||||
done
|
||||
echo "
|
||||
apps:
|
||||
FreeCAD:
|
||||
command: bin/launcher
|
||||
plugs: [ locale-control,x11,opengl,network-bind,home,unity7 ]
|
||||
" >> snapcraft.yaml
|
||||
33
vagrant/Xenial/launcher
Executable file
33
vagrant/Xenial/launcher
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
export I18NPATH=$SNAP/usr/share/i18n
|
||||
export LOCPATH=$SNAP_USER_DATA
|
||||
|
||||
LANG=en_US
|
||||
ENC=UTF-8
|
||||
LOC="$LANG.$ENC"
|
||||
|
||||
# generate a locale so we get properly working charsets and graphics
|
||||
if [ ! -e $SNAP_USER_DATA/$LOC ]; then
|
||||
$SNAP/usr/bin/localedef --prefix=$SNAP_USER_DATA -f $ENC -i $LANG $SNAP_USER_DATA/$LOC
|
||||
fi
|
||||
|
||||
export LC_ALL=$LOC
|
||||
export LANG=$LOC
|
||||
export LANGUAGE=${LANG%_*}
|
||||
env >& $SNAP_USER_DATA/env
|
||||
|
||||
export LIBGL_DRIVERS_PATH=$SNAP/usr/lib/x86_64-linux-gnu/dri
|
||||
export GTK_PATH=$SNAP/usr/lib/x86_64-linux-gnu/gtk-2.0/modules
|
||||
export LD_LIBRARY_PATH=$SNAP/usr/lib/x86_64-linux-gnu/gtk-2.0/modules:$LD_LIBRARY_PATH
|
||||
export GTK_DATA_PREFIX=$SNAP_USER_DATA
|
||||
export GTK_EXE_PREFIX=$SNAP/usr
|
||||
export GDK_PIXBUF_MODULE_FILE=$SNAP/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache
|
||||
export PYTHONHOME="$SNAP/usr"
|
||||
export PYTHONPATH="$SNAP/usr"
|
||||
export XDG_DATA_DIR="$SNAP/usr/share/glib-2.0/schemas"
|
||||
export GSETTINGS_SCHEMA_DIR="$SNAP/usr/share/glib-2.0/schemas"
|
||||
export LANG=en_US.UTF-8
|
||||
export FREECAD_USER_DATA="$SNAP_USER_DATA"
|
||||
export XDG_CONFIG_HOME="$SNAP_USER_DATA"
|
||||
exec "$SNAP/opt/local/FreeCAD-0.17/bin/FreeCAD" -u $SNAP_USER_DATA/user.cfg -s $SNAP_USER_DATA/system.cfg "$@"
|
||||
|
||||
88
vagrant/Xenial/reset
Executable file
88
vagrant/Xenial/reset
Executable file
@@ -0,0 +1,88 @@
|
||||
#!/bin/sh
|
||||
# snapcraft reset script
|
||||
# distributed under LGPL v2
|
||||
|
||||
if [ ! -e /var/lib/dpkg/status ]; then
|
||||
echo "This script only works on Ubuntu Classic"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$(id -u)" != 0 ]; then
|
||||
echo "This script needs to be run as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "This script will permanently destroy and reset all state in snapd"
|
||||
echo "You will loose all of your installed snaps"
|
||||
echo
|
||||
echo "Type: DESTROY to remove all of your snap state"
|
||||
echo
|
||||
read consent
|
||||
|
||||
if [ "$consent" != "DESTROY" ]; then
|
||||
echo "No consent, aborting"
|
||||
exit 0
|
||||
fi
|
||||
echo
|
||||
echo "ABOUT TO DESTROY ALL OF STATE OF SNAPD"
|
||||
echo
|
||||
echo "Interrupt the script in 10 seconds to abort"
|
||||
sleep 10 || exit
|
||||
echo
|
||||
echo "DESTROYING ALL STATE OF SNAPD"
|
||||
|
||||
if systemctl is-active --quiet snapd.service snapd.socket; then
|
||||
snapd_was_active=yes
|
||||
echo
|
||||
echo "Stoping snapd..."
|
||||
echo
|
||||
(
|
||||
set -x
|
||||
systemctl stop snapd.socket snapd.service
|
||||
)
|
||||
else
|
||||
echo "Skipping stopping snapd as systemctl reports it's inactive."
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Unmounting all snaps..."
|
||||
echo
|
||||
(
|
||||
set -x
|
||||
umount /var/lib/snapd/snaps/*.snap
|
||||
)
|
||||
|
||||
echo
|
||||
echo "Removing all support files and state..."
|
||||
echo
|
||||
(
|
||||
set -x
|
||||
rm -rvf /var/lib/snapd/*
|
||||
)
|
||||
|
||||
echo
|
||||
echo "Removing generated systemd units..."
|
||||
echo
|
||||
(
|
||||
set -x
|
||||
rm -vf /etc/systemd/system/snap-*.mount
|
||||
rm -vf /etc/systemd/system/snap-*.service
|
||||
rm -vf /etc/systemd/system/multi-user.target.wants/snap-*.mount
|
||||
)
|
||||
|
||||
echo
|
||||
echo "Removing generated executable wrappers..."
|
||||
echo
|
||||
(
|
||||
set -x
|
||||
rm -vrf /snap/*
|
||||
)
|
||||
|
||||
if [ "$snapd_was_active" = "yes" ]; then
|
||||
echo
|
||||
echo "Starting snapd"
|
||||
(
|
||||
set -x
|
||||
systemctl start snapd.socket
|
||||
)
|
||||
fi
|
||||
106
vagrant/generate_yaml.sh
Executable file
106
vagrant/generate_yaml.sh
Executable file
@@ -0,0 +1,106 @@
|
||||
#!/bin/bash
|
||||
# snapcraft yaml automatic generation tool for FreeCAD 0.17
|
||||
# (c) 2017 vejmarie
|
||||
# Distributed under LGPL v2.0
|
||||
# Please report bugs at vejmarie@ruggedpod.qyshare.com
|
||||
|
||||
rm snapcraft.yaml
|
||||
lib_list=`ls /opt/local/FreeCAD-0.17/lib/*.so`
|
||||
mod_list=`ls -ltd $(find /opt/local/FreeCAD-0.17/Mod) | awk '{ print $9}'`
|
||||
bin_list=`ls -ltd $(find /opt/local/FreeCAD-0.17/bin) | awk '{ print $9}'`
|
||||
data_list=`ls -ltd $(find /opt/local/FreeCAD-0.17/data) | awk '{ print $9}'`
|
||||
python_list=`ls -ltd $(find /usr/lib/python2.7) | awk '{ print $9}'`
|
||||
pyside_list=`ls -ltd $(find /usr/share/PySide/typesystems) | awk '{ print $9}'`
|
||||
python_binary=`ls /usr/bin/python /usr/bin/py*2.7`
|
||||
syslib=`ls -ltd $(find /usr/lib/x86_64-linux-gnu/dri) | awk '{ print $9}'`
|
||||
syslib2=`ls -ltd $(find /usr/lib/x86_64-linux-gnu/gtk-2.0) | awk '{ print $9}'`
|
||||
syslib3=`ls -ltd $(find /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0) | awk '{ print $9}'`
|
||||
syslib4=`ls -ltd $(find /usr/lib/locale) | awk '{ print $9}'`
|
||||
syslib5=`ls -ltd $(find /usr/share/X11/locale) | awk '{ print $9}'`
|
||||
syslib6=`ls -ltd $(find /usr/lib/x86_64-linux-gnu/*gtk*) | awk '{ print $9}'`
|
||||
syslib7=`ls -ltd $(find /usr/share/glib-2.0) | awk '{ print $9}'`
|
||||
syslib8=`ls -ltd $(find /usr/share/i18n/) | awk '{ print $9}'`
|
||||
syslib9=`ls /usr/bin/locale*`
|
||||
echo "
|
||||
name: freecad
|
||||
version: 0.17
|
||||
summary: development version
|
||||
description: development version This version is far from being bug free but integrates the latest FreeCAD technologies
|
||||
parts:
|
||||
example-part:
|
||||
plugin: copy
|
||||
files:
|
||||
bin/launcher : bin/launcher" >> snapcraft.yaml
|
||||
# bin/FreeCAD : opt/local/FreeCAD-0.17/bin/FreeCAD" >> snapcraft.yaml
|
||||
for i in $bin_list
|
||||
do
|
||||
if [ ! -d "$i" ]
|
||||
then
|
||||
second_name=`echo $i | sed 's/\///'`
|
||||
echo " $i : $second_name" >> snapcraft.yaml
|
||||
fi
|
||||
done
|
||||
for i in $lib_list
|
||||
do
|
||||
second_name=`echo $i | sed 's/\///'`
|
||||
echo " $i : $second_name" >> snapcraft.yaml
|
||||
done
|
||||
for i in $mod_list
|
||||
do
|
||||
if [ ! -d "$i" ]
|
||||
then
|
||||
second_name=`echo $i | sed 's/\///'`
|
||||
echo " $i : $second_name" >> snapcraft.yaml
|
||||
fi
|
||||
done
|
||||
for i in $data_list
|
||||
do
|
||||
if [ ! -d "$i" ]
|
||||
then
|
||||
second_name=`echo $i | sed 's/\///'`
|
||||
echo " $i : $second_name" >> snapcraft.yaml
|
||||
fi
|
||||
done
|
||||
for i in $python_list $pyside_list
|
||||
do
|
||||
if [ ! -d "$i" ]
|
||||
then
|
||||
second_name=`echo $i | sed 's/\///'`
|
||||
echo " $i : $second_name" >> snapcraft.yaml
|
||||
fi
|
||||
done
|
||||
for i in $python_binary
|
||||
do
|
||||
if [ ! -d "$i" ]
|
||||
then
|
||||
second_name=`echo $i | sed 's/\///'`
|
||||
echo " $i : $second_name" >> snapcraft.yaml
|
||||
fi
|
||||
done
|
||||
for i in $syslib $syslib2 $syslib3 $syslib4 $syslib5 $syslib6 $syslib7 $syslib8 $syslib9
|
||||
do
|
||||
if [ ! -d "$i" ]
|
||||
then
|
||||
second_name=`echo $i | sed 's/\///'`
|
||||
echo " $i : $second_name" >> snapcraft.yaml
|
||||
fi
|
||||
done
|
||||
# python:
|
||||
# plugin: python2
|
||||
echo "
|
||||
snap:
|
||||
- bin/launcher
|
||||
- opt/local/FreeCAD-0.17/bin/FreeCAD
|
||||
- opt
|
||||
- usr" >> snapcraft.yaml
|
||||
for i in $lib_list
|
||||
do
|
||||
second_name=`echo $i | sed 's/\///'`
|
||||
echo " - $second_name" >> snapcraft.yaml
|
||||
done
|
||||
echo "
|
||||
apps:
|
||||
FreeCAD:
|
||||
command: bin/launcher
|
||||
plugs: [ locale-control,x11,opengl,network-bind,home,unity7 ]
|
||||
" >> snapcraft.yaml
|
||||
Reference in New Issue
Block a user