2021-07-04 01:48:15 +08:00
|
|
|
#!/bin/bash
|
2010-05-12 02:00:40 +08:00
|
|
|
|
|
|
|
# Slackware build script for OpenSceneGraph
|
|
|
|
|
2010-05-12 23:40:15 +08:00
|
|
|
# Written by Aleksandar Samardzic <asamardzic@gmail.com>
|
2011-05-04 05:49:15 +08:00
|
|
|
# Maintained by Jordan Evans <jordanevans19@gmail.com>
|
2023-06-02 10:33:27 +08:00
|
|
|
# Maintained 2018-2023 by Christoph Willing <chris.willing@linux.com>
|
2010-05-12 02:00:40 +08:00
|
|
|
|
2021-07-04 17:41:06 +08:00
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
|
2010-05-12 02:00:40 +08:00
|
|
|
PRGNAM=OpenSceneGraph
|
2021-05-13 18:01:02 +08:00
|
|
|
VERSION=${VERSION:-3.6.5}
|
2021-11-01 03:21:41 +08:00
|
|
|
BUILD=${BUILD:-2}
|
2010-05-12 02:00:40 +08:00
|
|
|
TAG=${TAG:-_SBo}
|
2021-07-04 18:23:38 +08:00
|
|
|
PKGTYPE=${PKGTYPE:-tgz}
|
2010-05-12 23:40:15 +08:00
|
|
|
|
2010-06-04 13:05:55 +08:00
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
2017-04-07 19:05:12 +08:00
|
|
|
i?86) ARCH=i586 ;;
|
2010-06-04 13:05:55 +08:00
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2021-07-04 18:23:38 +08:00
|
|
|
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
|
|
|
|
# the name of the created package would be, and then exit. This information
|
|
|
|
# could be useful to other scripts.
|
|
|
|
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
|
|
|
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2010-05-12 02:00:40 +08:00
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
2017-04-07 19:05:12 +08:00
|
|
|
if [ "$ARCH" = "i586" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
2010-05-12 23:40:15 +08:00
|
|
|
LIBDIRSUFFIX=""
|
2010-05-12 02:00:40 +08:00
|
|
|
elif [ "$ARCH" = "i686" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
2010-05-12 23:40:15 +08:00
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
|
|
SLKCFLAGS="-O2 -fPIC"
|
|
|
|
LIBDIRSUFFIX="64"
|
2010-06-04 13:05:55 +08:00
|
|
|
else
|
|
|
|
SLKCFLAGS="-O2"
|
|
|
|
LIBDIRSUFFIX=""
|
2010-05-12 02:00:40 +08:00
|
|
|
fi
|
|
|
|
|
2010-05-12 23:40:15 +08:00
|
|
|
set -e
|
|
|
|
|
2010-05-12 02:00:40 +08:00
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
2018-05-30 13:31:37 +08:00
|
|
|
rm -rf $PRGNAM-$PRGNAM-$VERSION
|
|
|
|
tar xf $CWD/$PRGNAM-$PRGNAM-$VERSION.tar.gz
|
2018-05-25 12:36:08 +08:00
|
|
|
cd $PRGNAM-$PRGNAM-$VERSION
|
2010-05-12 02:00:40 +08:00
|
|
|
chown -R root:root .
|
2013-11-22 15:37:19 +08:00
|
|
|
find -L . \
|
2016-03-21 02:10:25 +08:00
|
|
|
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
|
2022-02-15 14:06:28 +08:00
|
|
|
-o -perm 511 \) -exec chmod 755 {} \+ -o \
|
2016-03-21 02:10:25 +08:00
|
|
|
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
|
2022-02-15 14:06:28 +08:00
|
|
|
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
|
|
|
|
|
2023-06-02 10:33:27 +08:00
|
|
|
# If installed, ignore asio & OpenCASCADE
|
|
|
|
# whose current versions at SBo cause build failure
|
|
|
|
patch -p0 < $CWD/no-asio-occ.diff
|
2016-03-21 02:10:25 +08:00
|
|
|
|
|
|
|
mkdir -p build
|
|
|
|
cd build
|
2018-05-25 12:36:08 +08:00
|
|
|
cmake .. \
|
2016-03-21 02:10:25 +08:00
|
|
|
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
|
2018-05-25 12:36:08 +08:00
|
|
|
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS -std=c++11" \
|
2016-03-21 02:10:25 +08:00
|
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
2021-11-01 03:21:41 +08:00
|
|
|
-DLIB_POSTFIX=$LIBDIRSUFFIX \
|
2018-05-25 12:36:08 +08:00
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-DBUILD_OSG_EXAMPLES=ON \
|
|
|
|
|
2016-03-21 02:10:25 +08:00
|
|
|
make
|
|
|
|
make install DESTDIR=$PKG
|
2021-11-01 03:21:41 +08:00
|
|
|
|
|
|
|
# No binaries in /usr/share. Move examples to /usr/bin
|
|
|
|
mv $PKG/usr/share/OpenSceneGraph/bin/* $PKG/usr/bin/
|
|
|
|
rm -rf $PKG/usr/share
|
2016-03-21 02:10:25 +08:00
|
|
|
cd ..
|
2010-05-12 02:00:40 +08:00
|
|
|
|
2017-04-07 19:05:12 +08:00
|
|
|
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
|
2010-05-19 13:56:27 +08:00
|
|
|
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
2010-05-12 02:00:40 +08:00
|
|
|
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
2018-05-25 12:36:08 +08:00
|
|
|
cp -a AUTHORS.txt ChangeLog LICENSE.txt NEWS.txt README* $PKG/usr/doc/$PRGNAM-$VERSION
|
2010-05-12 02:00:40 +08:00
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
|
|
|
|
cd $PKG
|
2021-07-04 18:23:38 +08:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|