summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorCaleb Maclennan2020-03-07 00:54:33 +0300
committerCaleb Maclennan2020-03-07 11:51:42 +0300
commit9c9fff904eea1ebaca27e9927a178c32fcbb2e1c (patch)
tree241c0b895ea46e2cf484e24724eef30b60c8ec25 /PKGBUILD
parent477451292e5da6be0cb0fb13d97a88900846fb3b (diff)
downloadaur-9c9fff904eea1ebaca27e9927a178c32fcbb2e1c.tar.gz
Use source archive with checksum, overhaul packaging
* Use git archive instead of git clone for less download weight and the ability to checksum the result. * Use node-prune to cleanup cruft before packaging. This catches a lot more files than the previous manual attempt. * Use gendesk to automatically create standardized desktop file from PKGBUILD. * Overhaul variable quoting and handling of CWD. Shell quoting verified with `shellharden`. * Normalize description using upstream project's branding. * Add 512px icons and set desktop logo.
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD96
1 files changed, 40 insertions, 56 deletions
diff --git a/PKGBUILD b/PKGBUILD
index e994f111cac0..5a8d6d028554 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,88 +1,72 @@
# Maintainer: BrLi <brli at chakralinux dot org>
+# Contributor: Caleb Maclennan <caleb@alerque.com>
pkgname=zettlr
+_name=Zettlr
pkgver=1.6.0
-pkgrel=1
-pkgdesc="A markdown editor for writing academic texts and taking notes"
+pkgrel=2
+pkgdesc='A Markdown Editor for the 21st century'
arch=('x86_64')
-url="https://www.zettlr.com"
+url='https://www.zettlr.com'
license=('GPL')
-depends=(electron ttf-webhostinghub-glyphs otf-crimson-text)
-makedepends=(yarn git)
+depends=('electron'
+ 'otf-crimson-text'
+ 'ttf-webhostinghub-glyphs')
+makedepends=('gendesk'
+ 'node-prune'
+ 'yarn')
optdepends=('pandoc: For exporting to various format'
'texlive-bin: For Latex support'
'ttf-lato: Display output in a more comfortable way')
-source=($pkgname::git+https://github.com/Zettlr/Zettlr.git#tag=v$pkgver)
-sha1sums=('SKIP')
+source=("$pkgname-$pkgver::https://github.com/$_name/$_name/archive/v$pkgver.tar.gz"
+ "$pkgname")
+sha256sums=('765c9d74a7d9a6a35df88cb6ca23db7e88409e32d0c9cbf4b234cc47d8d69b39'
+ '5e89480043eedfbc85696d078663e6dae834e23b215e2ea41ad6e1af9427e0ab')
+_mimetype=text/markdown
+_categories=Office
prepare() {
- cd $srcdir/$pkgname
-
+ gendesk -f -n --custom StartupWMClass="$_name"
+ cd "$_name-$pkgver"
+
# We don't build electron, and doesn't depends on postinstall script
- sed '/"electron"/d;/postinstall/d' -i package.json
+ sed -i -e '/"electron"/d;/postinstall/d' package.json
# Add some close-to-complete translations
- cd $srcdir/$pkgname/scripts
- sed "s/'fr-FR'/'fr-FR','ja-JP','zh-CN','es-ES','ru-RU'/" -i refresh-language.js
+ sed -i -e "s/'fr-FR'/'fr-FR','ja-JP','zh-CN','es-ES','ru-RU'/" scripts/refresh-language.js
}
build() {
- cd $srcdir/$pkgname
- NODE_ENV= yarn install --pure-lockfile --no-bin-links --cache-folder $srcdir/cache --link-folder $srcdir/link
+ cd "$_name-$pkgver"
+ NODE_ENV= yarn install --pure-lockfile --no-bin-links --cache-folder "$srcdir/cache" --link-folder "$srcdir/link"
yarn less
yarn handlebars
yarn lang:refresh
NODE_ENV=production node node_modules/webpack/bin/webpack.js
yarn reveal:build
- cd $srcdir/$pkgname/source
- yarn install --pure-lockfile --cache-folder $srcdir/cache
-
- # Aggressively remove binary and addins in node_modules
- find . -type d -name "fonts" -exec rm -rfv {} +
- find . -name "\.bin" -exec rm -rfv {} +
- find . -name "\.gitignore" -exec rm -rfv {} +
- find . -name "\.eslintrc*" -exec rm -rfv {} +
- find . -name "\.npmignore" -exec rm -rfv {} +
- find . -name "\.yarn*" -exec rm -rfv {} +
- find . -name "\.travis.yml" -exec rm -rfv {} +
- find . -name "\.tonic_example.js" -exec rm -rfv {} +
- find . -name "\.prettierrc.js" -exec rm -rfv {} +
- find . -name "\.coveralls.yml" -exec rm -rfv {} +
- find . -name "\.jscs.json" -exec rm -rfv {} +
- find . -name "\.babelrc.js" -exec rm -rfv {} +
- find . -name "\.vscode" -exec rm -rfv {} +
- find . -name "yarn.lock" -exec rm -rfv {} +
+ pushd source
+ yarn install --pure-lockfile --cache-folder "$srcdir/cache"
+ node-prune node_modules
+ find . -type d -name fonts -exec rm -rfv {} +
}
package() {
- local _destdir=usr/lib/$pkgname
- install -dm755 "$pkgdir/$_destdir"
+ cd "$_name-$pkgver"
- cd $srcdir/$pkgname/source
- sed "s,$srcdir/$pkgname/source,$_destdir,g" -i renderer/assets/vue/vue-sidebar.js
- cp -r --no-preserve=ownership --preserve=mode * "$pkgdir/$_destdir/"
+ local _destdir="usr/lib/$pkgname"
- install -Dm755 /dev/stdin $pkgdir/usr/bin/$pkgname <<END
-#!/bin/sh
-exec electron /$_destdir "\$@"
-END
+ install -Dm755 -t "$pkgdir/usr/bin" "$srcdir/$pkgname"
+ sed -i -e "s,$srcdir/$_name-$pkgver/source,$_destdir,g" source/renderer/assets/vue/vue-sidebar.js
+
+ install -dm755 "$pkgdir/$_destdir"
+ cp -r --no-preserve=ownership --preserve=mode source/* "$pkgdir/$_destdir"
- for px in 16 24 32 48 64 96 128 256; do
- install -Dm644 $srcdir/$pkgname/resources/icons/png/"$px"x"$px".png \
- $pkgdir/usr/share/icons/hicolor/"$px"x"$px"/apps/$pkgname.png
+ for px in 16 24 32 48 64 96 128 256 512; do
+ install -Dm644 "resources/icons/png/${px}x$px.png" \
+ "$pkgdir/usr/share/icons/hicolor/${px}x$px/apps/$pkgname.png"
done
- install -Dm644 /dev/stdin $pkgdir/usr/share/applications/$pkgname.desktop <<END
-[Desktop Entry]
-Name=Zettlr
-Comment=A powerful Markdown Editor with integrated tree view
-Exec=$pkgname %U
-Terminal=false
-Type=Application
-Icon=$pkgname
-StartupWMClass=Zettlr
-MimeType=text/markdown;
-Categories=Office;
-END
+ install -Dm644 -t "$pkgdir/usr/share/applications/" "$srcdir/$pkgname.desktop"
+ install -Dm644 "source/renderer/assets/img/zettlr-official-logo.png" "$pkgdir/usr/share/pixmaps/$pkgname.png"
}