2021-06-15 10:26:26 +02:00
|
|
|
#!/bin/bash
|
2011-06-14 14:13:12 +02:00
|
|
|
# Slackware build script for ledger
|
|
|
|
# Written by Lionel Young (redtricycle at gmail dot com)
|
|
|
|
# updated and adapted to my own taste by Gwenhael Le Moine <gwenhael.le.moine-AT-gmail.com>
|
|
|
|
|
2022-03-03 13:42:30 +01:00
|
|
|
set -e
|
|
|
|
|
2011-06-14 14:13:12 +02:00
|
|
|
CWD=$(pwd)
|
|
|
|
|
|
|
|
PRGNAM=$(basename $CWD)
|
2021-09-23 15:52:55 +02:00
|
|
|
GITHUB_REPO=ledger/ledger
|
2022-01-22 10:52:07 +01:00
|
|
|
VERSION=${VERSION:-latest}
|
2011-06-14 14:13:12 +02:00
|
|
|
ARCH=${ARCH:-$(uname -m)}
|
2021-09-23 15:52:55 +02:00
|
|
|
BUILD=${BUILD:-3}
|
2020-06-25 11:23:11 +02:00
|
|
|
TAG=${TAG:-gwh}
|
2011-06-14 14:13:12 +02:00
|
|
|
|
2022-01-22 19:52:02 +01:00
|
|
|
REPOSITORY=/home/installs/SlackBuilds/_repositories/$PRGNAM
|
2011-06-14 14:13:12 +02:00
|
|
|
TMP=${TMP:-/tmp/$TAG}
|
2021-09-23 15:52:55 +02:00
|
|
|
PKG=$TMP/pkg-$PRGNAM
|
2011-06-14 14:13:12 +02:00
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
2021-10-15 09:23:59 +02:00
|
|
|
PYTHON=" --python "
|
2018-04-20 08:06:17 +02:00
|
|
|
|
2011-06-14 14:13:12 +02:00
|
|
|
if [ "$ARCH" = "i486" ]; then
|
2016-09-18 22:28:40 +02:00
|
|
|
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
|
|
|
|
LIBDIRSUFFIX=""
|
2011-06-14 14:13:12 +02:00
|
|
|
elif [ "$ARCH" = "s390" ]; then
|
2016-09-18 22:28:40 +02:00
|
|
|
SLKCFLAGS="-O2"
|
|
|
|
LIBDIRSUFFIX=""
|
2011-06-14 14:13:12 +02:00
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
2016-09-18 22:28:40 +02:00
|
|
|
SLKCFLAGS="-O2 -fPIC"
|
|
|
|
LIBDIRSUFFIX="64"
|
2011-06-14 14:13:12 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG/usr
|
|
|
|
cd $TMP
|
2011-08-04 17:27:04 +02:00
|
|
|
rm -rf $PRGNAM
|
|
|
|
|
2021-09-23 15:52:55 +02:00
|
|
|
[ ! -e $REPOSITORY ] && git clone https://github.com/${GITHUB_REPO}.git $REPOSITORY
|
2016-09-18 22:28:40 +02:00
|
|
|
( cd $REPOSITORY && git pull && git submodule update --init )
|
2011-08-04 17:27:04 +02:00
|
|
|
cp -R $REPOSITORY $PRGNAM
|
2011-06-14 14:13:12 +02:00
|
|
|
|
2011-08-04 17:27:04 +02:00
|
|
|
cd $PRGNAM || exit 1
|
2011-06-14 14:13:12 +02:00
|
|
|
chown -R root:root .
|
|
|
|
find . \
|
2016-09-18 22:28:40 +02:00
|
|
|
\( -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 {} \;
|
2011-06-14 14:13:12 +02:00
|
|
|
|
2024-05-27 07:53:51 +02:00
|
|
|
[ "x$VERSION" == "xlatest" ] && VERSION=$(git tag --sort=-version:refname | head -n1)
|
2022-01-22 10:52:07 +01:00
|
|
|
[ "x$VERSION" == "x" ] && VERSION=trunk
|
2023-03-23 09:54:21 +01:00
|
|
|
[ "x$VERSION" == "xtrunk" ] && VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)" || git checkout $VERSION
|
2011-08-04 17:27:04 +02:00
|
|
|
|
2023-03-06 10:42:16 +01:00
|
|
|
cmake . \
|
|
|
|
-DUSE_DOXYGEN=ON \
|
|
|
|
-DBoost_NO_BOOST_CMAKE=ON \
|
|
|
|
-DUSE_PYTHON=ON \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
|
|
-DCMAKE_INSTALL_MANDIR=/usr/man
|
2024-03-20 10:52:39 +01:00
|
|
|
make -j$(nproc) || exit 1
|
2023-03-06 10:42:16 +01:00
|
|
|
make install DESTDIR=$PKG || exit 1
|
2011-06-14 14:13:12 +02:00
|
|
|
|
2022-03-03 13:42:30 +01:00
|
|
|
[ -e $PKG/usr/share/man ] && mv $PKG/usr/share/man $PKG/usr/
|
|
|
|
[ -e $PKG/usr/share/doc ] && rm -fr $PKG/usr/share/doc
|
|
|
|
[ -e $PKG/usr/man ] && find $PKG/usr/man/ -type f -name \*.\? -exec gzip -9 {} \;
|
2011-06-14 14:13:12 +02:00
|
|
|
|
2021-09-23 15:52:55 +02:00
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM/scripts
|
2011-06-14 14:13:12 +02:00
|
|
|
cp -a \
|
2015-06-30 11:10:20 +02:00
|
|
|
*.md contrib/ doc/ python/ \
|
2021-09-23 15:52:55 +02:00
|
|
|
$PKG/usr/doc/$PRGNAM
|
2011-09-08 14:13:33 +02:00
|
|
|
( cd $PKG/usr/bin
|
2016-09-18 22:28:40 +02:00
|
|
|
for i in report; do
|
2021-09-23 15:52:55 +02:00
|
|
|
ln -s ../doc/$PRGNAM/contrib/$i ledger-$i
|
2016-09-18 22:28:40 +02:00
|
|
|
done
|
2011-09-08 14:13:33 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
find $PKG | xargs file | grep -e "executable" -e "shared object" \
|
2016-09-18 22:28:40 +02:00
|
|
|
| grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
|
2011-06-14 14:13:12 +02:00
|
|
|
|
2022-03-03 13:42:30 +01:00
|
|
|
[ -e $PKG/usr/info/dir ] && rm -f $PKG/usr/info/dir
|
|
|
|
[ -e $PKG/usr/info ] && find $PKG/usr/info/ -type f -exec gzip -9 {} \;
|
2011-06-14 14:13:12 +02:00
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat <<EOF > $PKG/install/slack-desc
|
2016-09-18 22:28:40 +02:00
|
|
|
|-----handy-ruler------------------------------------------------------|
|
2011-06-14 14:13:12 +02:00
|
|
|
ledger: ledger (a command-line accounting program)
|
2015-05-05 20:45:52 +02:00
|
|
|
ledger:
|
2011-06-14 14:13:12 +02:00
|
|
|
ledger: Ledger is an accounting program which is invoked from the command-line
|
|
|
|
ledger: using a textual ledger file. See the documentation ( use "info ledger"
|
2016-09-18 22:28:40 +02:00
|
|
|
ledger: or read ledger.pdf from the website) for full documentation on how to
|
2011-06-14 14:13:12 +02:00
|
|
|
ledger: create a ledger file and using Ledger to generate reports.
|
2015-05-05 20:45:52 +02:00
|
|
|
ledger:
|
2011-06-14 14:13:12 +02:00
|
|
|
ledger: Homepage: http://wiki.github.com/jwiegley/ledger
|
2015-05-05 20:45:52 +02:00
|
|
|
ledger:
|
|
|
|
ledger:
|
|
|
|
ledger:
|
2011-06-14 14:13:12 +02:00
|
|
|
EOF
|
|
|
|
|
2021-09-23 15:52:55 +02:00
|
|
|
cd $PKG
|
2018-04-20 23:02:35 +02:00
|
|
|
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
|
2023-08-16 12:23:26 +02:00
|
|
|
/sbin/makepkg --linkadd y --chown n --prepend $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz}
|