2021-06-15 10:26:26 +02:00
|
|
|
#!/bin/bash
|
2016-08-24 15:42:17 +02:00
|
|
|
set -x
|
|
|
|
|
|
|
|
CWD=$(pwd)
|
|
|
|
|
|
|
|
PRGNAM=$(basename $CWD)
|
2021-12-02 16:27:35 +01:00
|
|
|
GITHUB_REPO=gwenhael-le-moine/x49gp #claudiobsd/x49gp
|
2021-09-23 15:52:55 +02:00
|
|
|
VERSION=${VERSION:-$(curl -s https://api.github.com/repos/${GITHUB_REPO}/releases/latest | jq -r .tag_name | sed 's|^null$|trunk|')} # or VERSION=trunk
|
2021-11-03 15:04:14 +01:00
|
|
|
NEWRPL_VERSION=1487
|
2016-08-24 15:42:17 +02:00
|
|
|
|
2021-12-02 16:40:21 +01:00
|
|
|
BUILD=6
|
2016-08-24 15:42:17 +02:00
|
|
|
|
|
|
|
ARCH=$(uname -m)
|
|
|
|
LIBSUFFIX=$(echo $ARCH | grep -o "\(64\)")
|
|
|
|
|
2020-06-25 11:23:11 +02:00
|
|
|
TAG=gwh
|
2016-08-24 15:42:17 +02:00
|
|
|
OUTPUT=/tmp
|
|
|
|
TMP=/tmp/$TAG
|
|
|
|
PKG=$TMP/pkg-$PRGNAM
|
|
|
|
|
2021-11-03 15:04:14 +01:00
|
|
|
REPOSITORIES=/home/installs/SlackBuilds/repositories
|
|
|
|
REPOSITORY=$REPOSITORIES/$PRGNAM
|
2016-08-24 15:42:17 +02:00
|
|
|
|
|
|
|
PREFIX=/usr
|
|
|
|
|
|
|
|
mkdir -p $TMP
|
|
|
|
|
|
|
|
# Cleaning
|
2016-09-18 22:28:40 +02:00
|
|
|
rm -fr $TMP/$PRGNAM $PKG
|
2016-08-24 15:42:17 +02:00
|
|
|
|
|
|
|
# Fetching sources
|
2021-09-23 15:52:55 +02:00
|
|
|
[ ! -e $REPOSITORY ] && git clone https://github.com/${GITHUB_REPO}.git $REPOSITORY
|
2021-06-15 10:59:49 +02:00
|
|
|
cd $REPOSITORY
|
|
|
|
git pull --all
|
2021-06-15 15:15:18 +02:00
|
|
|
|
2016-09-18 22:28:40 +02:00
|
|
|
cp -R $REPOSITORY $TMP/$PRGNAM
|
2021-06-15 15:15:18 +02:00
|
|
|
cd $TMP/$PRGNAM
|
|
|
|
[ "x$VERSION" == "xtrunk" ] && VERSION="git_$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)" || git checkout $VERSION
|
2016-08-24 15:42:17 +02:00
|
|
|
|
|
|
|
# Preparation
|
|
|
|
chown -R root:root .
|
|
|
|
find . \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
|
|
|
-exec chmod 755 {} \; -o \
|
|
|
|
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
|
|
|
-exec chmod 644 {} \;
|
|
|
|
|
2021-10-31 15:18:16 +01:00
|
|
|
make INSTALL_PREFIX=/usr INSTALL_MAN_DIR=/usr/man/man1
|
|
|
|
make sdcard INSTALL_PREFIX=/usr INSTALL_MAN_DIR=/usr/man/man1
|
2016-08-24 15:42:17 +02:00
|
|
|
|
2016-08-24 15:49:14 +02:00
|
|
|
# Installing
|
2021-10-31 15:18:16 +01:00
|
|
|
mkdir -p $PKG
|
|
|
|
make install DESTDIR=$PKG INSTALL_PREFIX=/usr INSTALL_MAN_DIR=/usr/man/man1
|
2016-08-24 15:42:17 +02:00
|
|
|
|
2021-10-31 15:18:16 +01:00
|
|
|
mkdir -p $PKG$PREFIX/doc/$PRGNAM/
|
|
|
|
cp README* sdcard $PKG$PREFIX/doc/$PRGNAM/
|
2016-08-24 15:42:17 +02:00
|
|
|
|
2021-12-02 16:27:35 +01:00
|
|
|
cat <<EOF > $PKG$PREFIX/doc/$PRGNAM/post-install.sh
|
|
|
|
#!/bin/bash
|
2016-08-24 15:49:14 +02:00
|
|
|
|
2021-12-02 16:27:35 +01:00
|
|
|
mkdir -p $PREFIX/share/$PRGNAM
|
|
|
|
[ ! -e $PREFIX/doc/$PRGNAM/hp-arm-models-bootloader.zip ] && wget -c -O $PREFIX/doc/$PRGNAM/hp-arm-models-bootloader.zip https://www.hpcalc.org/hp49/pc/rom/hp-arm-models-bootloader.zip
|
2021-12-02 16:40:21 +01:00
|
|
|
unzip -d $PREFIX/share/$PRGNAM/firmware/ $PREFIX/doc/$PRGNAM/hp-arm-models-bootloader.zip
|
|
|
|
rm $PREFIX/doc/$PRGNAM/hp-arm-models-bootloader.zip
|
2016-08-24 15:42:17 +02:00
|
|
|
|
2021-12-02 16:27:35 +01:00
|
|
|
[ ! -e $PREFIX/doc/$PRGNAM/hp4950v215.zip ] && wget -c -O $PREFIX/doc/$PRGNAM/hp4950v215.zip https://www.hpcalc.org/hp49/pc/rom/hp4950v215.zip
|
|
|
|
unzip -d $PREFIX/share/$PRGNAM/ $PREFIX/doc/$PRGNAM/hp4950v215.zip
|
2021-12-02 16:40:21 +01:00
|
|
|
rm $PREFIX/doc/$PRGNAM/hp4950v215.zip
|
2021-12-02 16:27:35 +01:00
|
|
|
|
|
|
|
mkdir -p $PREFIX/share/$PRGNAM/newrpl/
|
|
|
|
wget -c -O $PREFIX/share/$PRGNAM/newrpl/newrplfw.bin https://www.hpgcc3.org/downloads/newrplfw.bin
|
|
|
|
echo "newrplfw.bin" > $PREFIX/share/$PRGNAM/newrpl/update.scp
|
|
|
|
EOF
|
2021-11-03 15:04:14 +01:00
|
|
|
|
2016-08-24 15:42:17 +02:00
|
|
|
# Cleaning
|
|
|
|
cd $PKG
|
|
|
|
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
|
|
|
|
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
|
|
|
|
|
|
|
|
find $PKG$PREFIX/man -type f -name "*.?" -exec gzip -9 {} \;
|
|
|
|
|
|
|
|
chown -R root:root .
|
|
|
|
find . \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
|
|
|
-exec chmod 755 {} \; -o \
|
|
|
|
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
|
|
|
-exec chmod 644 {} \;
|
|
|
|
|
|
|
|
# Packaging
|
|
|
|
mkdir install
|
2021-10-31 15:18:16 +01:00
|
|
|
cat <<EOF > install/doinst.sh
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
cat /usr/doc/x49gp/README.md | grep "First launch setup" --before-context=2 --after-context=28
|
|
|
|
|
2021-12-02 16:27:35 +01:00
|
|
|
echo "Run $PREFIX/doc/$PRGNAM/post-install.sh"
|
2021-10-31 15:18:16 +01:00
|
|
|
EOF
|
2021-12-02 16:27:35 +01:00
|
|
|
|
2016-08-24 15:42:17 +02:00
|
|
|
cat <<EOF > install/slack-desc
|
|
|
|
$PRGNAM: $PRGNAM (HP49/50 emulator)
|
|
|
|
$PRGNAM:
|
2016-08-24 15:49:14 +02:00
|
|
|
$PRGNAM: Emulator of the newer Hewlett Packard Handheld Calculator Models with ARM CPU
|
|
|
|
$PRGNAM: (HP49g+ HP50).
|
2016-08-24 15:42:17 +02:00
|
|
|
$PRGNAM:
|
|
|
|
$PRGNAM:
|
2021-11-04 13:11:01 +01:00
|
|
|
$PRGNAM:
|
|
|
|
$PRGNAM:
|
2016-08-24 15:42:17 +02:00
|
|
|
$PRGNAM:
|
|
|
|
$PRGNAM: https://sourceforge.net/projects/x49gp/
|
2021-09-23 15:52:55 +02:00
|
|
|
$PRGNAM: https://github.com/${GITHUB_REPO}
|
2016-08-24 15:42:17 +02:00
|
|
|
EOF
|
|
|
|
|
2018-04-20 23:02:35 +02:00
|
|
|
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
|
2020-07-12 09:22:26 +02:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | tr -d '-')-$ARCH-$BUILD$TAG.txz
|