slackbuilds/d/hptools/SlackBuild

72 lines
1.8 KiB
Bash
Executable file

#!/bin/bash
set -x -e
CWD=$(pwd)
PRGNAM=$(basename $CWD)
ARCH=$(uname -m)
BUILD=1
VERSION=${VERSION:-3.0.8}
PATCH_VERSION=${PATCH_VERSION:-0.3.2.1}
TAG=gwh
OUTPUT=/tmp
TMP=/tmp/$TAG
PKG=$TMP/pkg-$PRGNAM
PREFIX=/usr
REPOSITORY=${REPOSITORY:-/var/cache/SlackBuilds.gwh/$PRGNAM}
mkdir -p $REPOSITORY
# cleaning
rm -fr $PKG $TMP
# download
[ ! -e $REPOSITORY/hptools-src-${VERSION}.tar.gz ] && wget -c https://www.hpcalc.org/hp48/pc/programming/hptools-src-${VERSION}.tar.gz -O $REPOSITORY/hptools-src-${VERSION}.tar.gz
[ ! -e $REPOSITORY/hptools-patch-${PATCH_VERSION}.zip ] && wget -c https://www.hpcalc.org/hp48/pc/programming/hptools-patch-${PATCH_VERSION}.zip -O $REPOSITORY/hptools-patch-${PATCH_VERSION}.zip
# installation
mkdir -p $PKG $TMP
cd $TMP
tar xvf $REPOSITORY/hptools-src-${VERSION}.tar.gz
cd Hptools
unzip $REPOSITORY/hptools-patch-${PATCH_VERSION}.zip
gunzip hptools.patch.gz
patch -p2 < ./hptools.patch
bash -x ./fixperms.sh
./autogen.sh
./configure \
--prefix=$PREFIX
make
sed -i "s|dir = $PREFIX|dir = $PKG$PREFIX|g" x86_64-unknown-linux-gnu/Makefile
mkdir -p $PKG$PREFIX/bin
make install DESTDIR=$PKG
mkdir -p $PKG$PREFIX/doc/$PRGNAM
cp -R doc/* $PKG$PREFIX/doc/$PRGNAM
chmod 644 $PKG$PREFIX/doc/$PRGNAM/*
# packaging
cd $PKG
mkdir install
cat <<EOF > install/slack-desc
$PRGNAM: $PRGNAM (System RPL and assembly language development kit)
$PRGNAM:
$PRGNAM: free System RPL and assembly language (HP syntax and MASD [Meta Kernel] syntax) development kit.
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: https://www.hpcalc.org/details/4263
$PRGNAM: https://www.hpcalc.org/details/8971
EOF
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
/sbin/makepkg --linkadd y --chown n --prepend $OUTPUT/$PRGNAM-${VERSION}_$PATCH_VERSION-$ARCH-$BUILD$TAG.txz