94 lines
2.7 KiB
Bash
Executable file
94 lines
2.7 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
# variables
|
|
TAG=cyco
|
|
TMP=/tmp/$TAG
|
|
CWD=$(pwd)
|
|
OUTPUT=/tmp
|
|
|
|
PRGNAM=$(basename $CWD)
|
|
PKG=$TMP/pkg-$PRGNAM
|
|
|
|
ARCH=$(uname -m)
|
|
BUILD=1
|
|
|
|
REPOSITORY=/home/installs/SlackBuilds/repositories/$PRGNAM
|
|
|
|
# nettoyage préalable
|
|
rm -fr $PKG $TMP/$PRGNAM
|
|
|
|
mkdir -p $PKG
|
|
|
|
# mise en place
|
|
[ ! -e $REPOSITORY ] && git clone https://github.com/leozide/leocad.git $REPOSITORY
|
|
( cd $REPOSITORY && git pull )
|
|
VERSION="$( cd $REPOSITORY && git log -1 --format=%h_%ad --date=format:%Y.%m.%d )"
|
|
|
|
cp -R $REPOSITORY $TMP/$PRGNAM
|
|
cd $TMP/$PRGNAM/
|
|
|
|
qmake-qt5 DISABLE_UPDATE_CHECK=1 DOCS_DIR=/usr/doc/$PRGNAM MAN_DIR=/usr/man/man1 leocad.pro
|
|
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
|
|
|
|
LIBRARY_URL=$(curl -s https://api.github.com/repos/leozide/leocad/releases | grep -o "http.*Library-Linux.*zip" | head -n1)
|
|
LIBRARY_FILE=$(echo $LIBRARY_URL | grep -o "Library-Linux-[0-9]*.zip")
|
|
LIBRARY_VERSION=$(echo $LIBRARY_FILE | grep -o "[0-9]*")
|
|
[ ! -e $CWD/$LIBRARY_FILE ] && wget -c -O $CWD/$LIBRARY_FILE $LIBRARY_URL
|
|
|
|
# Data from zip-file + set permissions
|
|
mkdir -p $PKG/usr/share/leocad
|
|
unzip $CWD/$LIBRARY_FILE -d $PKG/usr/share/leocad
|
|
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
|
|
makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo ${VERSION}_${LIBRARY_VERSION} | sed 's/-//g')-$ARCH-$BUILD$TAG.txz
|