2016-08-24 15:42:17 +02:00
|
|
|
#!/bin/sh
|
|
|
|
set -x
|
|
|
|
|
|
|
|
CWD=$(pwd)
|
|
|
|
|
|
|
|
PRGNAM=$(basename $CWD)
|
|
|
|
VERSION=${VERSION:-$(date +%F | tr - .)}
|
|
|
|
|
|
|
|
BUILD=1
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
REPOSITORY=/home/installs/SlackBuilds/repositories/$PRGNAM
|
|
|
|
|
|
|
|
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
|
2018-02-05 10:32:12 +01:00
|
|
|
[ ! -e $REPOSITORY ] && git clone https://github.com/gwenhael-le-moine/x49gp.git $REPOSITORY
|
2016-09-18 22:28:40 +02:00
|
|
|
( cd $REPOSITORY && git pull )
|
2021-04-08 13:42:40 +02:00
|
|
|
VERSION="git_$( cd $REPOSITORY && git log -1 --format=%h_%ad --date=format:%Y.%m.%d )"
|
2016-09-18 22:28:40 +02:00
|
|
|
cp -R $REPOSITORY $TMP/$PRGNAM
|
2016-08-24 15:42:17 +02:00
|
|
|
|
|
|
|
# Preparation
|
2016-09-18 22:28:40 +02:00
|
|
|
cd $TMP/$PRGNAM
|
2016-08-24 15:42:17 +02:00
|
|
|
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 {} \;
|
|
|
|
|
|
|
|
# Building
|
|
|
|
make
|
|
|
|
make sdcard
|
|
|
|
|
2016-08-24 15:49:14 +02:00
|
|
|
# Installing
|
2016-08-24 15:42:17 +02:00
|
|
|
mkdir -p $PKG$PREFIX/share/$PRGNAM
|
|
|
|
cp 4950_215.bin config.tmpl hp50g.png $PKG$PREFIX/share/$PRGNAM
|
|
|
|
|
|
|
|
mkdir -p $PKG$PREFIX/doc/$PRGNAM
|
2016-08-24 15:56:28 +02:00
|
|
|
cp README* config.tmpl flash-50g s3c2410-sram sdcard sram $PKG$PREFIX/doc/$PRGNAM
|
2016-08-24 15:42:17 +02:00
|
|
|
|
|
|
|
mv $PKG$PREFIX/doc/$PRGNAM/config.tmpl $PKG$PREFIX/doc/$PRGNAM/config
|
|
|
|
sed -i "s|image=hp50g.png|image=$PREFIX/share/$PRGNAM/hp50g.png|" $PKG$PREFIX/doc/$PRGNAM/config
|
|
|
|
|
|
|
|
mkdir -p $PKG$PREFIX/bin/
|
|
|
|
cp x49gp $PKG$PREFIX/bin/x49gp-bin
|
|
|
|
cp $CWD/bootstrap-config.sh $PKG$PREFIX/bin/x49gp-bootstrap-config
|
|
|
|
cat <<EOF > $PKG$PREFIX/bin/x49gp
|
|
|
|
#!/bin/sh
|
|
|
|
|
2016-08-24 15:49:14 +02:00
|
|
|
if [ ! -e ~/.x49gp/config ]; then
|
|
|
|
echo "Please run x49gp-bootstrap-config first"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2016-08-24 15:42:17 +02:00
|
|
|
x49gp-bin ~/.x49gp/config
|
|
|
|
EOF
|
|
|
|
chmod +x $PKG$PREFIX/bin/x49gp $PKG$PREFIX/bin/x49gp-bootstrap-config
|
|
|
|
|
|
|
|
# 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
|
|
|
|
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:
|
2016-08-24 15:49:14 +02:00
|
|
|
$PRGNAM: Post-installation setup:
|
2016-08-24 15:42:17 +02:00
|
|
|
$PRGNAM: $ x49gp-bootstrap-config
|
|
|
|
$PRGNAM:
|
|
|
|
$PRGNAM: https://sourceforge.net/projects/x49gp/
|
2018-02-05 10:32:12 +01:00
|
|
|
$PRGNAM: https://github.com/gwenhael-le-moine/x49gp
|
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
|