DebianScript

From FreeCAD Documentation
Jump to: navigation, search
Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎italiano

Copy and paste this into a file named "compile.sh". Then type

chmod u+x compile.sh && ./compile.sh

You will have to fix problems as they come up, but it's better than nothing. You have to get the opencascade libraries before running this script, since it requires registration. Or, download them while you run the script. Dont forget to define $PATH_TO_OCC

 
#setup build environment for freecad on debian testing
#btw this is probably incomplete. please fix any obvious errors!
sudo apt-get update

sudo apt-get install libcoin40c2 libcoin40-dev libqt4 libqt4-dev \
libboost* python2.5 python2.5-dev libxerces27 \
libgts-dev libgts-0.7-5 libxerces27-dev zlib1g zlib1g-dev checkinstall

#dont want these packages with qt4 installed: 
sudo apt-get remove libsoqt20 libsoqt-dev

#compile libSoQt
wget http://ftp.coin3d.org/coin/src/all/SoQt-1.4.1.tar.gz
tar -zxvf SoQt*
cd SoQt*
sudo cp cfg/soqt.m4 /usr/share/aclocal

#this doesnt work
#sed -i 's/SIM_AC_QT_PROG(MOC, moc)/SIM_AC_QT_PROG(MOC, moc-qt4)/' configure.ac

#we get the wrong (qt3) moc by default, so pull a switcheroo
sudo ln -s /usr/bin/moc-qt4 /usr/local/bin/moc
./configure --with-qt=/usr/lib/qt4 && make
sudo rm /usr/local/bin/moc
checkinstall -D -y
#sudo apt-get remove libsoqt20
sudo dpkg -i soqt*deb

#get opencascade libraries. 182MB + you have to jump through some hoops 
cd /usr/local
sudo mkdir OpenCASCADE
sudo chown $USER OpenCASCADE
cd OpenCASCADE
tar -zxf $PATH_TO_OCC/OpenCASCADE_Linux.tgz
#$ dpkg -l sun*
#ii  sun-java5-jre 1.5.0-12-1 Sun Java(TM) Runtime Environment
sudo java -jar Linux/setup.jar
#pointy clicky drool
#i changed the destination directory to /usr/local/OpenCASCADE
#pick complete installation 
#it only took about 15 minutes
#you might want to change the file permissions
sudo chown $USER /usr/local/OpenCASCADE/ -R

#i'm not sure if you actually have to compile opencascade or not
cp /usr/local/OpenCASCADE/ros/configure \
/usr/local/OpenCASCADE/ros/configure.bak
sed -i \
's/CXXFLAGS="$CXXFLAGS "/CXXFLAGS="$CXXFLAGS -ffriend-injection -fpermissive"/'\
/usr/local/OpenCASCADE/ros/configure

cd /usr/local/OpenCASCADE/ros/
./configure --with-tcl=/usr/lib/tcl8.4 --with-tk=/usr/lib/tk8.4
cd adm/make
#the include path can get messed up, but this didnt happen for me for tcl
#uncomment if you dont see $string1/tcl8.4
#find . -name 'Makefile' -exec sed -i \
#'s|CSF_TclLibs_INCLUDES = -I/usr/include|CSF_TclLibs_INCLUDES = -I/usr/include/tcl8.4|' {} \;
find adm/make -name 'Makefile' -exec sed -i \
's|CSF_TclTkLibs_INCLUDES = -I/usr/include|CSF_TclTkLibs_INCLUDES = -I/usr/include/tk8.4|' {} \;
#make sure you have at least 7GB available, maybe more
time make
#real    568m35.068s
#checkinstall didnt work so well - dpkg error "empty version" ?
time sudo make install
#real     20m10.055s

#finally, get the freecad source code and compile it
cd /usr/local
sudo mkdir freecad
sudo chown $USER freecad
svn co https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk freecad
cd freecad
./autogen.sh
./configure --with-occ-include=/usr/local/OpenCASCADE/ros/inc/ \
--with-occ-lib=/usr/local/lib/
time make
checkinstall -Dy
sudo dpkg -i freecad*deb