Skip to content

Instantly share code, notes, and snippets.

@rjmcguire
Created March 3, 2017 15:06
Show Gist options
  • Save rjmcguire/b436b632ff656ad16f18f0475d407963 to your computer and use it in GitHub Desktop.
Save rjmcguire/b436b632ff656ad16f18f0475d407963 to your computer and use it in GitHub Desktop.
terminix-build
# Maintainer: Rory McGuire <rjmcguire at gmail dot com>
# Contributor: Gerald Nunn <gerald dot b dot nunn at gmail dot com>
# Contributor: Davi da Silva Böger <dsboger at gmail dot com>
pkgname='terminix-build'
pkgdesc="A tiling terminal emulator based on GTK+ 3 (binary distribution)"
pkgver='1.5.0'
pkgrel=1
epoch=1
conflicts=('terminix')
arch=('x86_64')
url="http://github.com/gnunn1/terminix"
makedepends=('git' 'gcc' 'make' 'dmd' 'desktop-file-utils' 'dub')
# before namcap: depends=('glib2' 'dconf' 'gsettings-desktop-schemas' 'vte3' 'hicolor-icon-theme' 'libx11')
depends=('dconf' 'libx11' 'hicolor-icon-theme')
optdepends=(
'python2-nautilus: for "Open Terminix Here" support in nautilus'
'xdg-utils: update desktop file cache during install'
'gtk-update-icon-cache: update gtk icon cache during install'
)
source=("git+https://github.com/gnunn1/terminix.git#tag=$pkgver")
sha256sums=('SKIP')
license=('MPL')
# install='install.sh'
options=('strip')
build() {
echo 'build'
cd $srcdir/terminix/
dub build --build=release --config=default
# Create/Update LINGUAS file
find po -name "*\.po" -printf "%f\\n" | sed "s/\.po//g" | sort > po/LINGUAS
# Compile po files
for f in po/*.po; do
echo "Processing $f"
LOCALE=$(basename "$f" .po)
msgfmt $f -o "${LOCALE}.mo"
done
# Generate desktop file
msgfmt --desktop --template=data/pkg/desktop/com.gexperts.Terminix.desktop.in -d po -o data/pkg/desktop/com.gexperts.Terminix.desktop
desktop-file-validate data/pkg/desktop/com.gexperts.Terminix.desktop
}
package() {
srcdir="${srcdir}/terminix"
cd $srcdir
sharedir=$pkgdir/usr/share
# Copy and compile schema
mkdir -p $sharedir/glib-2.0/schemas
install -m 644 $srcdir/data/gsettings/com.gexperts.Terminix.gschema.xml $sharedir/glib-2.0/schemas/
mkdir -p $sharedir/terminix/resources $sharedir/terminix/schemes $sharedir/terminix/scripts
# Copy and compile icons
pushd $srcdir/data/resources
glib-compile-resources terminix.gresource.xml
install -m 644 terminix.gresource $sharedir/terminix/resources/
popd
# Copy shell integration script
install -m 755 data/scripts/* $sharedir/terminix/scripts/
# Copy color schemes
install -m 644 data/schemes/* $sharedir/terminix/schemes/
for f in po/*.po; do
LOCALE=$(basename "$f" .po)
install -d $sharedir/locale/${LOCALE}/LC_MESSAGES
install -m 644 "${LOCALE}.mo" $sharedir/locale/${LOCALE}/LC_MESSAGES/terminix.mo
done
# Generate appdata file, requires xgettext 0.19.7
msgfmt --xml --template=data/appdata/com.gexperts.Terminix.appdata.xml.in -d po -o data/appdata/com.gexperts.Terminix.appdata.xml
# Copying Nautilus extension
install -d $sharedir/nautilus-python/extensions/
install -m 644 data/nautilus/open-terminix.py $sharedir/nautilus-python/extensions/
# Copy D-Bus service descriptor
install -d $sharedir/dbus-1/services
install -m 644 data/dbus/com.gexperts.Terminix.service $sharedir/dbus-1/services/
# Copy man page
install -d $sharedir/man/man1
install -m 644 data/man/terminix $sharedir/man/man1/terminix.1
gzip $sharedir/man/man1/terminix.1
if type po4a-translate >/dev/null 2>&1; then
for f in data/man/po/*.man.po
do
LOCALE=$(basename "$f" .man.po)
install -d $sharedir/man/${LOCALE}/man1
po4a-translate -f man -m data/man/terminix -p data/man/po/${LOCALE}.man.po -l $sharedir/man/${LOCALE}/man1/terminix.1
gzip $sharedir/man/${LOCALE}/man1/terminix.1
done
fi
# Copy Icons
pushd data/icons/hicolor
find -type f | while read f; do
install -d "$sharedir/icons/hicolor/$(dirname "$f")"
install -m 644 "$f" "$sharedir/icons/hicolor/${f}"
done
popd
# Copy executable, desktop and appdata file
mkdir -p $pkgdir/usr/bin
install -m 755 terminix $pkgdir/usr/bin/
mkdir -p $sharedir/applications $sharedir/metainfo/
install -m 644 data/pkg/desktop/com.gexperts.Terminix.desktop $sharedir/applications/
install -m 644 data/appdata/com.gexperts.Terminix.appdata.xml $sharedir/metainfo/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment