slackbuilds/xap/leocad/SlackBuild

99 lines
2.9 KiB
Text
Raw Normal View History

2021-06-15 10:26:26 +02:00
#!/bin/bash
2020-05-24 20:41:47 +02:00
# variables
2020-06-25 11:23:11 +02:00
TAG=gwh
2020-05-24 20:41:47 +02:00
TMP=/tmp/$TAG
CWD=$(pwd)
OUTPUT=/tmp
PRGNAM=$(basename $CWD)
PKG=$TMP/pkg-$PRGNAM
ARCH=$(uname -m)
BUILD=1
GITHUB_REPO=leozide/leocad
2022-01-22 10:52:07 +01:00
VERSION=${VERSION:-latest}
2020-05-24 20:41:47 +02:00
REPOSITORY=/var/cache/SlackBuilds.gwh/$PRGNAM
2020-05-24 20:41:47 +02:00
rm -fr $PKG $TMP/$PRGNAM
mkdir -p $PKG
# mise en place
[ ! -e $REPOSITORY ] && git clone https://github.com/${GITHUB_REPO}.git $REPOSITORY
2021-06-15 10:59:49 +02:00
cd $REPOSITORY
git pull --all
2020-05-24 20:41:47 +02:00
cp -R $REPOSITORY $TMP/$PRGNAM
cd $TMP/$PRGNAM/
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
2020-05-24 20:41:47 +02:00
2020-06-08 11:36:50 +02:00
qmake-qt5 DISABLE_UPDATE_CHECK=1 DOCS_DIR=/usr/doc/$PRGNAM MAN_DIR=/usr/man/man1 leocad.pro
2020-05-24 20:41:47 +02:00
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
make
make INSTALL_ROOT="$PKG" install
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
mkdir -p $PKG/usr/man/man1
cp -a docs/leocad.1 $PKG/usr/man/man1
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
2024-02-13 08:22:19 +01:00
LIBRARY_URL=$(curl -s https://api.github.com/repos/${GITHUB_REPO}/releases | grep -o "http.*Library-.*zip" | sort | tail -n1)
2021-06-10 11:09:11 +02:00
LIBRARY_FILE=$(echo $LIBRARY_URL | grep -o "Library-[0-9.]*.zip")
LIBRARY_VERSION=$(echo $LIBRARY_FILE | grep -o "[0-9.]*")
[ ! -e $REPOSITORY/$LIBRARY_FILE ] && wget -c -O $REPOSITORY/$LIBRARY_FILE $LIBRARY_URL
2020-06-08 11:36:50 +02:00
2020-05-24 20:41:47 +02:00
# Data from zip-file + set permissions
mkdir -p $PKG/usr/share/leocad
unzip $REPOSITORY/$LIBRARY_FILE -d $PKG/usr/share/leocad/
2020-05-24 20:41:47 +02:00
chown -R root:root $PKG
# correction
cd $PKG
chown -R root:root *
# embaumement
mkdir -p $PKG/install
cat <<EOF > $PKG/install/doinst.sh
if [ -x /usr/bin/update-desktop-database ]; then
/usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
fi
if [ -x /usr/bin/update-mime-database ]; then
/usr/bin/update-mime-database usr/share/mime >/dev/null 2>&1
fi
if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
if [ -x /usr/bin/gtk-update-icon-cache ]; then
/usr/bin/gtk-update-icon-cache -f usr/share/icons/hicolor >/dev/null 2>&1
fi
fi
EOF
cat <<EOF > $PKG/install/slack-desc
|-----handy-ruler------------------------------------------------------|
$PRGNAM: $PRGNAM (CAD program for toy bricks)
$PRGNAM:
$PRGNAM: $PRGNAM is a CAD program that uses bricks similar to those
$PRGNAM: found in many toys (but they don't represent any particular brand).
$PRGNAM: Currently it uses a library of more than 7000 different pieces.
$PRGNAM:
$PRGNAM: https://www.$PRGNAM.org/
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
EOF
# empaquetage
cd $PKG
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-$(echo ${VERSION}_${LIBRARY_VERSION} | sed 's/-//g')-$ARCH-$BUILD$TAG.txz