diff options
Diffstat (limited to 'academic/megax/megax.SlackBuild')
-rw-r--r-- | academic/megax/megax.SlackBuild | 60 |
1 files changed, 37 insertions, 23 deletions
diff --git a/academic/megax/megax.SlackBuild b/academic/megax/megax.SlackBuild index 544a941f5c..4f20e38180 100644 --- a/academic/megax/megax.SlackBuild +++ b/academic/megax/megax.SlackBuild @@ -1,10 +1,10 @@ -#!/bin/sh +#!/bin/bash -# Slackware build script for megax (formerly 'megacc') +# Slackware build script for megax (formerly 'megacc', called now simply 'mega') # This takes the place of "megacc" in 2018, as it includes also the GUI # of the program (megax) in addition to megacc. -# Copyright 2017-2018 Petar Petrov slackalaxy@gmail.com +# Copyright 2017-2020 Petar Petrov slackalaxy@gmail.com # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -24,36 +24,47 @@ # 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=megax -VERSION=${VERSION:-10.0.5_1} -DEBVER=10.0.5-1 +VERSION=${VERSION:-11.0.11_1} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} + +SRCNAM=mega +DEBVER=$(echo $VERSION | tr _ -) if [ -z "$ARCH" ]; then case "$( uname -m )" in - i?86) ARCH=i386 ;; - arm*) ARCH=arm ;; + i?86) ARCH=i586 ;; *) ARCH=$( uname -m ) ;; esac fi -CWD=$(pwd) -TMP=${TMP:-/tmp/SBo} -PKG=$TMP/package-$PRGNAM -OUTPUT=${OUTPUT:-/tmp} - -if [ "$ARCH" = "i386" ] || [ "$ARCH" = "i486" ] || [ "$ARCH" = "i586" ] || [ "$ARCH" = "i686" ]; then - LIBDIRSUFFIX="" - DEBARCH="i386" -elif [ "$ARCH" = "x86_64" ]; then +if [ "$ARCH" = "x86_64" ]; then LIBDIRSUFFIX="64" DEBARCH="amd64" +elif [[ $ARCH =~ i?86 ]]; then + LIBDIRSUFFIX="" + DEBARCH="i386" else - printf "\n\n$ARCH is not supported... \n" + printf "\n\n$ARCH is not supported... \n" >/dev/stderr exit 1 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} + set -e rm -rf $PKG @@ -62,7 +73,7 @@ cd $TMP rm -rf $PRGNAM-$VERSION mkdir $PRGNAM-$VERSION cd $PRGNAM-$VERSION -ar p $CWD/${PRGNAM}_${DEBVER}_${DEBARCH}.deb data.tar.xz | tar xJv +ar p $CWD/${SRCNAM}_${DEBVER}_${DEBARCH}.deb data.tar.xz | tar xJv chown -R root:root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ @@ -71,20 +82,23 @@ find -L . \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; # Fix path in runmega.sh for x86_64 -sed -i "s|/usr/lib/megax|/usr/lib${LIBDIRSUFFIX}/megax|g" usr/lib/$PRGNAM/runmega.sh +sed -i "s|/usr/lib/megax|/usr/lib${LIBDIRSUFFIX}/$PRGNAM|g" usr/lib/mega/runmega.sh # Place things in /usr/lib and just create symlinks later. # This is what Debian's and RedHat's packages do. mkdir -p $PKG/usr/lib${LIBDIRSUFFIX} -cp -a usr/lib/$PRGNAM $PKG/usr/lib${LIBDIRSUFFIX} +cp -a usr/lib/mega $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM # Copy man pages to their proper place. cp -a usr/local/share/man $PKG/usr +sed -i "s:lib:lib${LIBDIRSUFFIX}:" $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM/runmega.sh +sed -i "s:mega:$PRGNAM:" $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM/runmega.sh + mkdir -p $PKG/usr/bin cd $PKG/usr/bin -ln -s ../lib${LIBDIRSUFFIX}/$PRGNAM/megacc -ln -s ../lib${LIBDIRSUFFIX}/$PRGNAM/runmega.sh megax + ln -s ../lib${LIBDIRSUFFIX}/$PRGNAM/megacc + ln -s ../lib${LIBDIRSUFFIX}/$PRGNAM/runmega.sh runmega cd - find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ @@ -107,4 +121,4 @@ 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} +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE |