2011-09-03 09:21:51 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Slackware build script for seaview
|
|
|
|
|
2014-03-03 07:50:17 +08:00
|
|
|
# Copyright 2011-2014 Petar Petrov, petar.petrov@student.oulu.fi
|
2011-12-22 13:48:59 +08: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.
|
|
|
|
|
|
|
|
# Thanks to Niels Horn for correcting the CFLAGS.
|
2011-09-03 09:21:51 +08:00
|
|
|
|
2012-06-30 23:59:43 +08:00
|
|
|
PRGNAM=seaview
|
2014-07-20 19:56:45 +08:00
|
|
|
VERSION=${VERSION:-4.5.2}
|
2011-09-03 09:21:51 +08:00
|
|
|
BUILD=${BUILD:-1}
|
2011-12-22 13:48:59 +08:00
|
|
|
TAG=${TAG:-_SBo}
|
2011-09-03 09:21:51 +08:00
|
|
|
|
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
|
|
|
i?86) ARCH=i486 ;;
|
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
CWD=$(pwd)
|
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
2012-06-30 23:59:43 +08:00
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
2011-09-03 09:21:51 +08:00
|
|
|
|
|
|
|
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"
|
|
|
|
else
|
|
|
|
SLKCFLAGS="-O2"
|
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
|
|
|
rm -rf $PRGNAM
|
2011-12-22 13:48:59 +08:00
|
|
|
tar xvf $CWD/${PRGNAM}_${VERSION}.tar.gz
|
2011-09-03 09:21:51 +08:00
|
|
|
cd $PRGNAM
|
|
|
|
chown -R root:root .
|
2013-11-22 15:37:19 +08:00
|
|
|
find -L . \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
2011-09-03 09:21:51 +08: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 {} \;
|
|
|
|
|
2011-12-22 13:48:59 +08:00
|
|
|
# Use our CFLAGS
|
2011-09-03 09:21:51 +08:00
|
|
|
sed -i "/^CFLAGS/s/=/+=/" Makefile
|
2012-08-11 12:39:37 +08:00
|
|
|
|
|
|
|
# Point to fltk13 during compilation and make the produced executable
|
|
|
|
# aware of the libraries' custom location
|
2012-06-30 23:59:43 +08:00
|
|
|
sed -i "14 c FLTK = /usr/include/fltk13" Makefile
|
|
|
|
sed -i "s:#IFLTK:IFLTK:" Makefile
|
|
|
|
sed -i "18 c LFLTK = -L/usr/lib${LIBDIRSUFFIX}/fltk13" Makefile
|
2013-07-05 06:11:35 +08:00
|
|
|
sed -i "29 a LDFLAGS= -Wl,-ldl,--rpath,/usr/lib${LIBDIRSUFFIX}/fltk13" Makefile
|
2011-09-03 09:21:51 +08:00
|
|
|
|
2011-12-22 13:48:59 +08:00
|
|
|
# Point to the correct documentation path and phyml executable name
|
|
|
|
sed -i "s:#HELPFILE:HELPFILE:" Makefile
|
|
|
|
sed -i "s:/share/doc/seaview:/doc/$PRGNAM-$VERSION/:" Makefile
|
|
|
|
sed -i "s:#PHYMLNAME:PHYMLNAME:" Makefile
|
|
|
|
|
2011-09-03 09:21:51 +08:00
|
|
|
CFLAGS="$SLKCFLAGS" \
|
|
|
|
CXXFLAGS="$SLKCFLAGS" \
|
|
|
|
make
|
|
|
|
|
2011-12-22 13:48:59 +08:00
|
|
|
install -D -m755 seaview $PKG/usr/bin/$PRGNAM
|
|
|
|
install -D -m644 seaview.1 $PKG/usr/man/man1/$PRGNAM.1
|
2011-09-03 09:21:51 +08:00
|
|
|
|
|
|
|
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
|
|
|
|
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
|
|
|
|
|
|
|
find $PKG/usr/man -type f -exec gzip -9 {} \;
|
|
|
|
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
|
|
|
|
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
cp -a seaview.html $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
|
|
cat $CWD/References > $PKG/usr/doc/$PRGNAM-$VERSION/References
|
|
|
|
|
|
|
|
mkdir -p $PKG/usr/share/{applications,pixmaps}
|
|
|
|
cp $CWD/$PRGNAM.desktop $PKG/usr/share/applications
|
|
|
|
cp seaview.xpm $PKG/usr/share/pixmaps
|
|
|
|
|
|
|
|
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}
|