2010-05-11 20:00:02 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Slackware build script for QtOctave
|
|
|
|
|
|
|
|
# Written by Mauro Giachero (mauro dot giachero at gmail dot com)
|
2010-05-11 22:21:36 +02:00
|
|
|
# Modified by Robby Workman <rworkman@slackbuilds.org>
|
2010-05-11 20:00:02 +02:00
|
|
|
|
|
|
|
PRGNAM=qtoctave
|
2010-05-11 22:21:36 +02:00
|
|
|
VERSION=${VERSION:-0.8.1}
|
2010-05-11 20:00:02 +02:00
|
|
|
BUILD=${BUILD:-1}
|
|
|
|
TAG=${TAG:-_SBo}
|
|
|
|
|
2010-05-24 02:48:39 +02:00
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
2010-06-04 06:59:19 +02:00
|
|
|
i?86) ARCH=i486 ;;
|
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
2010-05-24 02:48:39 +02:00
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2010-05-11 20:00:02 +02:00
|
|
|
CWD=$(pwd)
|
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
|
|
|
if [ "$ARCH" = "i486" ]; then
|
2010-05-24 02:48:39 +02:00
|
|
|
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
|
2010-05-13 00:20:20 +02:00
|
|
|
LIBDIRSUFFIX=""
|
2010-05-11 20:00:02 +02:00
|
|
|
elif [ "$ARCH" = "i686" ]; then
|
2010-05-24 02:48:39 +02:00
|
|
|
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
2010-05-13 00:20:20 +02:00
|
|
|
LIBDIRSUFFIX=""
|
2010-05-11 22:21:36 +02:00
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
2010-05-24 02:48:39 +02:00
|
|
|
SLKCFLAGS="-O2 -fPIC"
|
2010-05-13 00:20:20 +02:00
|
|
|
LIBDIRSUFFIX="64"
|
2010-05-24 02:48:39 +02:00
|
|
|
else
|
|
|
|
SLKCFLAGS="-O2"
|
|
|
|
LIBDIRSUFFIX=""
|
2010-05-11 20:00:02 +02:00
|
|
|
fi
|
|
|
|
|
2010-05-24 02:48:39 +02:00
|
|
|
|
2013-11-22 08:34:22 +01:00
|
|
|
set -e
|
2010-05-11 20:00:02 +02:00
|
|
|
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
|
|
|
rm -rf $PRGNAM-$VERSION
|
|
|
|
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
|
2010-05-11 22:21:36 +02:00
|
|
|
cd $PRGNAM-$VERSION/$PRGNAM
|
2010-05-11 20:00:02 +02:00
|
|
|
chown -R root:root .
|
2013-11-22 08:37:19 +01:00
|
|
|
find -L . \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
2010-05-11 20:00:02 +02:00
|
|
|
-exec chmod 755 {} \; -o \
|
|
|
|
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
|
|
|
-exec chmod 644 {} \;
|
|
|
|
|
2010-05-24 02:48:39 +02:00
|
|
|
# Fix building with gcc4.4
|
|
|
|
patch -p2 < $CWD/qtoctave-0.8.1-gcc4.4.patch
|
|
|
|
|
2010-05-11 22:21:36 +02:00
|
|
|
cmake \
|
|
|
|
-DCMAKE_C_FLAGS_RELEASE:STRING="$SLKCFLAGS" \
|
|
|
|
-DCMAKE_CXX_FLAGS_RELEASE:STRING="$SLKCFLAGS" \
|
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH=/usr \
|
2010-05-13 00:20:20 +02:00
|
|
|
-DLIB_SUFFIX:STRING=${LIBDIRSUFFIX} .
|
|
|
|
|
2010-05-11 22:21:36 +02:00
|
|
|
make
|
2010-05-11 20:00:02 +02:00
|
|
|
|
2010-05-11 22:21:36 +02:00
|
|
|
# The install target doesn't have a DESTDIR or INSTALL_ROOT or equivalent,
|
|
|
|
# and setting the CMAKE_INSTALL_PREFIX to $PKG/usr results in a lot of
|
|
|
|
# '/tmp/SBo/package-qtoctave' strings embedded in the qtoctave binary.
|
|
|
|
# This *could* have security implications (for example, if that binary first
|
|
|
|
# looks in the temp directory for things). It's low risk, and would require
|
|
|
|
# someone on the system to have knowledge of how the package was built, so
|
|
|
|
# I'm being a bit "chicken little" here, but correct is always better, so I'm
|
|
|
|
# going to do this the hard way... --rworkman
|
|
|
|
#
|
|
|
|
# Be sure to check the src/cmake_install.cmake file in version updates to
|
|
|
|
# make sure we don't miss something
|
|
|
|
mkdir -p $PKG/usr/share/qtoctave $PKG/usr/bin \
|
|
|
|
$PKG/usr/share/applications $PKG/usr/share/icons/hicolor/64x64/apps
|
|
|
|
cp -a src/config_files/config.rc src/images src/lang src/menus \
|
|
|
|
src/config_files/octave.xml src/octave_doc src/qtoctave_doc \
|
|
|
|
src/scripts $PKG/usr/share/qtoctave
|
|
|
|
# QtOctave better fits in "Science & Math" (with Octave) than
|
|
|
|
# under "Edutainment" subcategories
|
|
|
|
# cp -a src/config_files/qtoctave.desktop $PKG/usr/share/applications/
|
|
|
|
cat src/config_files/qtoctave.desktop |sed "s/Education/Development/g" \
|
|
|
|
>$PKG/usr/share/applications/qtoctave.desktop
|
|
|
|
ln -s /usr/share/qtoctave/images/qtoctave.png $PKG/usr/share/icons/hicolor/64x64/apps/
|
|
|
|
cp -a src/qtoctave $PKG/usr/bin
|
|
|
|
find $PKG/usr/share -type f -exec chmod 0644 {} \;
|
|
|
|
find $PKG/usr/share -type d -exec chmod 0755 {} \;
|
2010-05-11 20:00:02 +02:00
|
|
|
|
2010-05-19 08:30:47 +02:00
|
|
|
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
|
|
|
|
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
2010-05-11 20:00:02 +02:00
|
|
|
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
2010-05-11 22:21:36 +02:00
|
|
|
cp -a leeme.txt news.txt LICENSE_GPL.txt readme.txt \
|
2010-05-11 20:00:02 +02:00
|
|
|
$PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
2010-05-11 22:21:36 +02:00
|
|
|
( cd $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
ln -s /usr/share/$PRGNAM/qtoctave-doc .
|
|
|
|
ln -s /usr/share/$PRGNAM/octave-doc .
|
|
|
|
)
|
2010-05-11 20:00:02 +02:00
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
2010-05-11 22:21:36 +02:00
|
|
|
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
2010-05-11 20:00:02 +02:00
|
|
|
|
|
|
|
cd $PKG
|
2010-05-13 00:20:20 +02:00
|
|
|
/sbin/makepkg -l y -c n -p $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|