Skip to content

Instantly share code, notes, and snippets.

@berndhahnebach
Forked from vejmarie/FreeCAD.sh
Created August 22, 2016 16:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save berndhahnebach/09e6aca9491adf7c8a2410d652d88ce5 to your computer and use it in GitHub Desktop.
Save berndhahnebach/09e6aca9491adf7c8a2410d652d88ce5 to your computer and use it in GitHub Desktop.
Vagrant Provisioning to build up FreeCAD on Debian Jessie64 with OCCT7 and Salome 7.7.1 support
#!/bin/bash
# Vagrant provisioning script to build up FreeCAD based on OCCT 7 and Salome 7.7.1 on Linux Debian/Jessie64
# (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
sudo apt-get install -y dictionaries-common
sudo apt-get install -y 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
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 libmed1
sudo apt-get install -y libmedc1
sudo apt-get install -y libmed-dev
sudo apt-get install -y libmedc-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
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
else
cat <<EOF >& /tmp/lightdm.conf
[SeatDefaults]
user-session=xfce
autologin-session=xfce
autologin-user=vagrant
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
fi
# 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_Group_Rendering:BOOL=OFF -DVTK_Group_StandAlone:BOOL=ON -DVTK_RENDERING_BACKEND=None
make -j 2
sudo make install
# 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=OFF
make -j 2
sudo make install
# Building Netgen
cd ../..
git clone https://github.com/vejmarie/Netgen
cd Netgen/netgen-5.3.1
./configure --with-tcl=/usr/lib/tcl8.5 --with-tk=/usr/lib/tk8.5 --enable-occ --with-occ=/usr/local --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
#building FreeCAD
git clone https://github.com/FreeCAD/FreeCAD.git
cd FreeCAD
git checkout master
cp cMake/FindOpenCascade.cmake cMake/FindOPENCASCADE.cmake
cd ..
mkdir build
cd build
cmake ../FreeCAD -DFREECAD_USE_EXTERNAL_PIVY=1 -DBUILD_FEM=1 -DBUILD_FEM_NETGEN=1 -DCMAKE_CXX_FLAGS="-DNETGEN_V5"
make -j 2
# -*- 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"
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment