slackbuilds_ponce/academic/AstroImageJ/AstroImageJ.SlackBuild

114 lines
3.8 KiB
Text
Raw Normal View History

#!/bin/bash
# Slackware build script for astroimagej
# Copyright 2023 Christopher Duston (christopher.duston@protonmail.com)
# 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.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=AstroImageJ
VERSION=${VERSION:-v5.3.2.00}
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
#### These lines are to ensure the build can happen on multilib systems.
if [ "$ARCH" = "i586" ] || [ "$ARCH" = "i686" ]; then
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
LIBDIRSUFFIX="64"
else
LIBDIRSUFFIX=""
fi
####
set -e
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}
rm -rf $PKG
mkdir -p $TMP $PKG
rm -rf $TMP/$PRGNAM-$VERSION
cd $TMP || exit 1
tar xvf $CWD/${PRGNAM}-${VERSION}-linux-x86_64Bit.tar.gz || exit 1
cd ${PRGNAM}
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
# Putting these here so they are correctly removed by removepkg.
mkdir -p $PKG/usr/lib64 $PKG/usr/bin
cp -r $TMP/$PRGNAM $PKG/usr/lib64
cp $CWD/astroimagej $PKG/usr/bin
# Documentation
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
cp -a LICENSE MANIFEST.MF README.txt $PKG/usr/doc/$PRGNAM-$VERSION
find $PKG/usr/doc/$PRGNAM-$VERSION -type f -exec chmod 644 {} \;
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
# Create the ./install directory and copy the slack-desc into it
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
# Strip objects from a bunch of files sbopkglint complains about:
strip $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/jre/lib/*.so
strip $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/jre/lib/jexec
strip $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/jre/lib/server/*.so
strip $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/jre/lib/jspawnhelper
strip $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/jre/lib/simengine
strip $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/jre/lib/criu
strip $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/jre/lib/pauseengine
strip $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/jre/lib/criuengine
strip $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/jre/bin/*
# Make these files executable, for the same reason...
chmod a+x $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/jre/lib/*.so
chmod a+x $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/jre/lib/jexec
chmod a+x $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/jre/lib/server/*.so
chmod a+x $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/jre/lib/jspawnhelper
chmod a+x $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/jre/lib/simengine
chmod a+x $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/jre/lib/criu
chmod a+x $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/jre/lib/pauseengine
chmod a+x $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/jre/lib/criuengine
chmod a+x $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/jre/bin/*
chmod a+x $PKG/usr/bin/astroimagej
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz