summaryrefslogtreecommitdiffstats
path: root/system/acefile/acefile.SlackBuild
blob: ddca4156db59d085fbcdd945fb2edf81d8639c3a (plain)
#!/bin/bash

# Slackware build script for acefile

# Written by B. Watson (urchlay@slackware.uk)

# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.

# Note: the only ACE archives I could actually find in the wild to
# test this with are the Windows and MS-DOS ACE self-extracting exes,
# found here:

# https://web.archive.org/web/20170619234433/http://www.winace.com/files/wace269i.exe
# linked to from https://web.archive.org/web/20170619234433fw_/http://www.winace.com/news.html
# https://web.archive.org/web/2005if_/http://www.winace.com:80/files/ace26.exe

# $ file wace269i.exe 
# wace269i.exe: PE32 executable (GUI) Intel 80386, for MS Windows, Petite compressed, ACE self-extracting archive
# $ file ace26.exe
# ace26.exe: MS-DOS executable, LE executable for MS-DOS, PMODE/W DOS extender, UPX compressed, ACE self-extracting archive

# acefile-unace extracts both of the exes just fine.

# Also, I used dosbox to run the ms-dos ace.exe and created an .ace
# archive with 2 small images in it, and it worked fine, too. Although
# only if the files were small (probably a limitation of the shareware
# ms-dos ace). With large files, acefile-unace and regular unace
# both show CRC errors... but sometimes regular unace will segfault
# instead.

# ...it seems to work just fine. As the README says, it's a bit slow to
# extract, but AFAICT the results are correct.

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=acefile
VERSION=${VERSION:-0.6.12}
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 [ ! -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}

# No CFLAGS or LIBDIRSUFFIX needed here. It uses -O3 for the native code,
# and I don't see a way to change it.

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L .  -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
        \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+

python3 setup.py install --root=$PKG
strip $PKG/usr/lib*/python*/site-packages/*.so

# man page by SlackBuild author.
mkdir -p $PKG/usr/man/man1
gzip -9c < $CWD/acefile-unace.1 > $PKG/usr/man/man1/acefile-unace.1.gz

PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
cp -a *.md $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE