diff --git a/dist/deb/build.sh b/dist/deb/build.sh new file mode 100755 index 0000000..b7ec501 --- /dev/null +++ b/dist/deb/build.sh @@ -0,0 +1,69 @@ +#!/bin/sh + +APPNAME='fontlink' +DATA_DIR='../..' + +BUILD_DIR=build +mkdir -p $BUILD_DIR + +cp -r $DATA_DIR/bin $BUILD_DIR + +INSTALL_DIR=$BUILD_DIR/usr/share + +mkdir -p $INSTALL_DIR +rsync -a --exclude=**__pycache__* $DATA_DIR/${APPNAME} $INSTALL_DIR + + +# Compile mo +grep -v '^#' $DATA_DIR/po/LINGUAS | while read -r lang; + do + modir=$INSTALL_DIR/locale/$lang/LC_MESSAGES; + mkdir -p $modir; + msgfmt $DATA_DIR/po/$lang.po -o $modir/${APPNAME}.mo; + done + +# Icons +rsync -a --exclude=*x*/*/*.svg $DATA_DIR/data/icons $INSTALL_DIR + +# Desktop file +DESKTOP_DIR=$INSTALL_DIR/applications +mkdir -p $DESKTOP_DIR +cp $DATA_DIR/data/${APPNAME}.desktop $DESKTOP_DIR + +# Docs +DOC_DIR=$INSTALL_DIR/doc/${APPNAME} +mkdir -p $DOC_DIR +cp $DATA_DIR/LICENSE $DOC_DIR/copyright + +cp changelog $DOC_DIR/changelog.Debian +gzip -9 $DOC_DIR/changelog.Debian + + +# DEBIAN +DEB_DIR=$BUILD_DIR/DEBIAN +mkdir -p $DEB_DIR + +cp postinst prerm $DEB_DIR +cp control.in $DEB_DIR/control + +set -- `cd ${DATA_DIR}/${APPNAME}; python3 -B -c \ + 'from app_info import *; print(VERSION, WEBSITE)'` +version=$1 +website=$2 +size=`find ${BUILD_DIR} -type f -not -path "${DEB_DIR}/*" -print0 | + xargs -r0 du --apparent-size -chk | tail -n -1 | awk '{print $1}'` + +sed \ + -e "s/@VERSION@/${version}/" \ + -e "s/@SIZE@/${size}/" \ + -e "s,@URL@,${website}," \ + -i $DEB_DIR/control + + +chmod -R u+rwX,go+rX,go-w $BUILD_DIR +chmod +x $DEB_DIR/postinst $DEB_DIR/prerm $BUILD_DIR/bin/${APPNAME} + + +fakeroot dpkg-deb --build $BUILD_DIR . + +rm -rf $BUILD_DIR diff --git a/dist/deb/control.in b/dist/deb/control.in new file mode 100644 index 0000000..0740467 --- /dev/null +++ b/dist/deb/control.in @@ -0,0 +1,20 @@ +Package: fontlink +Version: @VERSION@-1 +Architecture: all +Maintainer: Daniel Plachotich +Installed-Size: @SIZE@ +Depends: python3, python3-gi, gir1.2-appindicator3-0.1 +Section: utils +Priority: optional +Homepage: @URL@ +Description: Small utility to install fonts temporarily + FontLink is a small GTK+ utility to install fonts temporarily on Unix-like + systems. + . + It allows you to quickly install certain fonts only when you really + need them without copying fonts or creating symlinks to special + directories by hand. + . + FontLink has a very simple interface with which you can group fonts into + sets (for example, one set per project) and quickly enable or disable + certain fonts as well as entire sets in a single click. diff --git a/dist/deb/postinst b/dist/deb/postinst new file mode 100644 index 0000000..c99745c --- /dev/null +++ b/dist/deb/postinst @@ -0,0 +1,5 @@ +#!/bin/sh + +set -e + +python3 -m compileall -q /usr/share/fontlink diff --git a/dist/deb/prerm b/dist/deb/prerm new file mode 100644 index 0000000..8efe599 --- /dev/null +++ b/dist/deb/prerm @@ -0,0 +1,5 @@ +#!/bin/sh + +set -e + +find usr/share/fontlink -name __pycache__ -type d -exec rm -rf {} +