mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-26 22:06:35 +01:00
35f44917c7
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
152 lines
5.1 KiB
Bash
152 lines
5.1 KiB
Bash
#!/bin/bash
|
|
|
|
# Slackware build script for stellarium
|
|
# Copyright 2008 Alan Alberghini <414N@slacky.it>
|
|
#
|
|
# Based on slackbuild by Michael Bueker <m.bueker@berlin.de>
|
|
#
|
|
# 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.
|
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
PRGNAM=stellarium
|
|
VERSION=${VERSION:-23.4}
|
|
BUILD=${BUILD:-1}
|
|
TAG=${TAG:-_SBo}
|
|
PKGTYPE=${PKGTYPE:-tgz}
|
|
|
|
if [ -z "$ARCH" ]; then
|
|
case "$( uname -m )" in
|
|
i?86) ARCH=i586 ;;
|
|
arm*) ARCH=arm ;;
|
|
*) ARCH=$( uname -m ) ;;
|
|
esac
|
|
fi
|
|
|
|
# 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
|
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
PKG=$TMP/package-$PRGNAM
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
if [ "$ARCH" = "i586" ]; then
|
|
SLKCFLAGS="-O2 -march=i586 -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-$VERSION
|
|
tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
|
|
cd $PRGNAM-$VERSION
|
|
chown -R root:root .
|
|
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 {} \;
|
|
|
|
# CPM dependency retrieval lifting: prepare a cache dir in the format
|
|
# expected by CPM with pre-downloaded sources.
|
|
|
|
# CPM normally puts downloaded deps under this dir
|
|
CPM_CACHE_DIR=$TMP/$PRGNAM-$VERSION/build/_deps
|
|
|
|
CPM_SHOWMYSKY_VERSION=v0.3.1
|
|
CPM_QXSLX_VERSION=1.4.6
|
|
CPM_INDI_VERSION=1.8.5
|
|
CPM_GLM_VERSION=0.9.9.8
|
|
CPM_NLOPT_VERSION=v2.7.1
|
|
|
|
# We need to match dependencies names used in cmake files with the
|
|
# actual dependency tarball names
|
|
declare -A CPM_SOURCE CPM_DEST
|
|
CPM_SOURCE["SHOWMYSKY"]="$CWD/CalcMySky-$CPM_SHOWMYSKY_VERSION.tar.gz"
|
|
CPM_SOURCE["QXLSX"]="$CWD/QXlsx-v$CPM_QXSLX_VERSION.tar.gz"
|
|
CPM_SOURCE["INDI"]="$CWD/indi-$CPM_INDI_VERSION.zip"
|
|
CPM_SOURCE["GLM"]="$CWD/glm-$CPM_GLM_VERSION.7z"
|
|
CPM_SOURCE["NLOPT"]="$CWD/nlopt-$CPM_NLOPT_VERSION.tar.gz"
|
|
CPM_DEST["SHOWMYSKY"]="$CPM_CACHE_DIR/showmysky-qt5-subbuild/showmysky-qt5-populate-prefix/src/$CPM_SHOWMYSKY_VERSION.tar.gz"
|
|
CPM_DEST["QXLSX"]="$CPM_CACHE_DIR/qxlsxqt5-subbuild/qxlsxqt5-populate-prefix/src/v$CPM_QXSLX_VERSION.tar.gz"
|
|
CPM_DEST["INDI"]="$CPM_CACHE_DIR/indiclient-subbuild/indiclient-populate-prefix/src/v$CPM_INDI_VERSION.zip"
|
|
CPM_DEST["GLM"]="$CPM_CACHE_DIR/glm-subbuild/glm-populate-prefix/src/glm-$CPM_GLM_VERSION.7z"
|
|
CPM_DEST["NLOPT"]="$CPM_CACHE_DIR/nlopt-subbuild/nlopt-populate-prefix/src/$CPM_NLOPT_VERSION.tar.gz"
|
|
|
|
for dep in "${!CPM_SOURCE[@]}"
|
|
do
|
|
mkdir -p "$(dirname "${CPM_DEST[$dep]}")"
|
|
ln -s "${CPM_SOURCE[$dep]}" "${CPM_DEST[$dep]}"
|
|
done
|
|
|
|
# End of CPM deps management
|
|
|
|
mkdir -p build
|
|
cd build
|
|
cmake \
|
|
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
|
|
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
|
|
-DCMAKE_INSTALL_LIBDIR=/usr/lib${LIBDIRSUFFIX} \
|
|
-DCMAKE_INSTALL_MANDIR=/usr/man \
|
|
-DCMAKE_BUILD_TYPE=Release ..
|
|
make
|
|
make install DESTDIR=$PKG
|
|
cd -
|
|
|
|
# Don't ship .la files:
|
|
rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
|
|
|
|
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
|
|
|
|
# upstream doesn't honor the CMAKE_INSTALL_MANDIR. Move files manually, for now
|
|
mv $PKG/usr/share/man $PKG/usr/
|
|
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 \
|
|
CREDITS.md COPYING ChangeLog README.md \
|
|
$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
|