2010-05-16 04:14:10 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Slackware build script for FreeCAD
|
2011-09-06 22:36:47 +02:00
|
|
|
|
2012-01-13 13:00:40 +01:00
|
|
|
# Copyright 2010-2012 Niels Horn, Rio de Janeiro, RJ, Brazil
|
2011-09-06 22:36:47 +02:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use of this script, with or without modification, is
|
|
|
|
# permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# 1. Redistributions of this script must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
|
|
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
|
|
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
|
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
|
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
|
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
2013-11-27 15:51:33 +01:00
|
|
|
# revision date: 2013/11/27
|
2010-05-16 04:14:10 +02:00
|
|
|
|
|
|
|
PRGNAM=FreeCAD
|
2013-11-19 22:27:02 +01:00
|
|
|
VERSION=${VERSION:-0.13.1830}
|
2013-11-27 15:51:33 +01:00
|
|
|
BUILD=${BUILD:-2}
|
2010-05-16 04:14:10 +02:00
|
|
|
TAG=${TAG:-_SBo}
|
|
|
|
|
2011-09-06 22:36:47 +02:00
|
|
|
SRCNAM=freecad
|
2010-05-16 04:14:10 +02:00
|
|
|
|
2010-05-23 09:57:57 +02:00
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
2010-06-04 07:05:05 +02:00
|
|
|
i?86) ARCH=i486 ;;
|
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
2010-05-23 09:57:57 +02:00
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2010-05-16 04:14:10 +02:00
|
|
|
CWD=$(pwd)
|
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
|
|
|
if [ "$ARCH" = "i486" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
|
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
elif [ "$ARCH" = "i686" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
|
|
SLKCFLAGS="-O2 -fPIC"
|
|
|
|
LIBDIRSUFFIX="64"
|
2010-05-23 09:57:57 +02:00
|
|
|
else
|
|
|
|
SLKCFLAGS="-O2"
|
|
|
|
LIBDIRSUFFIX=""
|
2010-05-16 04:14:10 +02:00
|
|
|
fi
|
|
|
|
|
2011-09-06 22:36:47 +02:00
|
|
|
set -e
|
2010-05-16 04:14:10 +02:00
|
|
|
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
2013-11-19 22:27:02 +01:00
|
|
|
rm -rf $SRCNAM-$VERSION
|
|
|
|
tar xvf $CWD/$SRCNAM-$VERSION.tar.?z*
|
|
|
|
cd $SRCNAM-$VERSION
|
2010-05-16 04:14:10 +02:00
|
|
|
chown -R root:root .
|
2013-11-19 22:27:02 +01:00
|
|
|
find -L . \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
|
|
|
|
-o -perm 511 \) -exec chmod 755 {} \; -o \
|
|
|
|
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
|
|
|
|
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
|
|
|
|
|
|
|
|
# no downloads allowed during the build
|
2013-11-27 15:51:33 +01:00
|
|
|
patch -p1 < $CWD/files/no_coin3d_docs.patch
|
2013-11-19 22:27:02 +01:00
|
|
|
|
|
|
|
# thanks to archlinux for these fixes
|
|
|
|
# compatibility issues with OCC-6.6
|
|
|
|
for i in $( grep -Rl "BRepTools::OuterShell" * )
|
|
|
|
do
|
|
|
|
sed -e "s|BRepTools|BRepClass3d|g" -i "$i"
|
|
|
|
done
|
|
|
|
|
|
|
|
# these patch contain some code taken from upstream
|
2013-11-22 08:34:22 +01:00
|
|
|
# thanks to cbuehler
|
2013-11-27 15:51:33 +01:00
|
|
|
patch -p1 -i $CWD/files/freecad-0.13.diff
|
2013-11-19 22:27:02 +01:00
|
|
|
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
cmake \
|
|
|
|
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
|
|
|
|
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS -Wno-cpp" \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=/opt/$PRGNAM \
|
|
|
|
-DRESOURCEDIR=/opt/$PRGNAM/share/data \
|
|
|
|
-DLIB_SUFFIX=${LIBDIRSUFFIX} \
|
|
|
|
-DMAN_INSTALL_DIR=/usr/man \
|
|
|
|
-DDOCDIR=/usr/doc/$PRGNAM-$VERSION \
|
|
|
|
-DOCC_INCLUDE_DIR=/usr/include/OpenCASCADE \
|
|
|
|
-DOCC_LIBRARY=/usr/lib${LIBDIRSUFFIX} \
|
|
|
|
-DFREECAD_USE_EXTERNAL_PIVY:BOOL=ON \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release ..
|
|
|
|
|
|
|
|
make V=1
|
|
|
|
make install DESTDIR=$PKG
|
|
|
|
cd ..
|
|
|
|
|
2013-11-27 15:51:33 +01:00
|
|
|
# build the qt plugin
|
|
|
|
( cd src/Tools/plugins/widget
|
|
|
|
qmake plugin.pro
|
|
|
|
make
|
|
|
|
install -m 0755 -D libFreeCAD_widgets.so \
|
|
|
|
$PKG/usr/lib$LIBDIRSUFFIX/qt4/plugins/designer/libFreeCAD_widgets.so )
|
|
|
|
|
|
|
|
# create links in /usr/bin
|
|
|
|
mkdir -p $PKG/usr/bin
|
|
|
|
ln -s /opt/FreeCAD/bin/FreeCADCmd $PKG/usr/bin/FreeCADCmd
|
|
|
|
ln -s /opt/FreeCAD/bin/FreeCAD $PKG/usr/bin/FreeCAD
|
|
|
|
|
2013-11-19 22:27:02 +01:00
|
|
|
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
|
2010-05-16 04:14:10 +02:00
|
|
|
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
|
|
|
|
2013-11-27 15:51:33 +01:00
|
|
|
# Copy icon, desktop file and mime info
|
|
|
|
mkdir -p $PKG/usr/share/applications $PKG/usr/share/pixmaps $PKG/usr/share/mime/packages
|
2013-11-19 22:27:02 +01:00
|
|
|
cp $PKG/opt/$PRGNAM/data/freecad.xpm $PKG/usr/share/pixmaps/
|
2013-11-27 15:51:33 +01:00
|
|
|
cat $CWD/files/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
|
|
|
|
cat $CWD/files/$PRGNAM.xml > $PKG/usr/share/mime/packages/$PRGNAM.xml
|
2010-05-16 04:14:10 +02:00
|
|
|
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
cp -a \
|
|
|
|
README.Linux ChangeLog.txt \
|
|
|
|
$PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
|
|
|
|
|
|
|
cd $PKG
|
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|