summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrLi2020-10-13 00:44:22 +0800
committerBrLi2020-10-13 00:44:22 +0800
commit6c53b9ca4a0e50f702f503fb81b4ec7a86528a14 (patch)
tree25d5d3d77b91f296700d5a3e2bf00b16a70821c6
parentde1cf3daf1be717a5cf99a1c85d6cab9bd67bf92 (diff)
downloadaur-6c53b9ca4a0e50f702f503fb81b4ec7a86528a14.tar.gz
revamp PKGBUILD with distro provided electron
-rw-r--r--.SRCINFO21
-rw-r--r--PKGBUILD113
-rw-r--r--fixed-package-json.patch30
-rw-r--r--fixed-package.json84
-rw-r--r--pencil-mime.xml11
-rw-r--r--pencil.desktop15
6 files changed, 121 insertions, 153 deletions
diff --git a/.SRCINFO b/.SRCINFO
index b0ef9ba443a..a27d476b53f 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,27 +1,18 @@
pkgbase = pencil
pkgdesc = Sketching and GUI prototyping/wireframing tool
pkgver = 3.1.0
- pkgrel = 3
- url = http://github.com/evolus/pencil
+ pkgrel = 4
+ url = https://github.com/evolus/pencil
arch = any
license = GPL2
- depends = nodejs
- depends = npm
- depends = libxss
- depends = nss
- depends = libxtst
- depends = gtk2
- depends = alsa-lib
+ makedepends = yarn
+ depends = electron
conflicts = evolus-pencil-bin
conflicts = pencil-v2
source = https://github.com/evolus/pencil/archive/v3.1.0.tar.gz
- source = pencil.desktop
- source = pencil-mime.xml
- source = fixed-package.json
+ source = fixed-package-json.patch
sha256sums = e14eddd0aad28919cfdf8d47b726f9c75a3a0d2042605e8da96309c23a995f44
- sha256sums = 6d467da74509e74e06325e7464a6a177164ae8977470423da6cae43265dedd4d
- sha256sums = 87aac9f5005ccd57aa6b1bf190052fcc4915eff1d7bddb2723863739545e42fc
- sha256sums = 6f0902d9d2294865b8993c94ce4f01dd01318c7da428dad5a45b7753c46ad757
+ sha256sums = ab36a7476d4a04dc684441f67faa3f7f84168a725b4e977d467e0b4321eb0d50
pkgname = pencil
diff --git a/PKGBUILD b/PKGBUILD
index f7a18efe975..0a4c29d79b7 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,46 +1,103 @@
# Maintainer: Pavan Rikhi <pavan.rikhi@gmail.com>
+# Maintainer: BrLi <brli at chakralinux dot org>
+
pkgname=pencil
pkgver=3.1.0
-pkgrel=3
+pkgrel=4
pkgdesc="Sketching and GUI prototyping/wireframing tool"
arch=('any')
license=('GPL2')
-url="http://github.com/evolus/pencil"
+url="https://github.com/evolus/pencil"
+depends=(electron)
+makedepends=(yarn)
source=("https://github.com/evolus/pencil/archive/v$pkgver.tar.gz"
- "pencil.desktop"
- "pencil-mime.xml"
- "fixed-package.json")
+ 'fixed-package-json.patch')
sha256sums=('e14eddd0aad28919cfdf8d47b726f9c75a3a0d2042605e8da96309c23a995f44'
- '6d467da74509e74e06325e7464a6a177164ae8977470423da6cae43265dedd4d'
- '87aac9f5005ccd57aa6b1bf190052fcc4915eff1d7bddb2723863739545e42fc'
- '6f0902d9d2294865b8993c94ce4f01dd01318c7da428dad5a45b7753c46ad757')
+ 'ab36a7476d4a04dc684441f67faa3f7f84168a725b4e977d467e0b4321eb0d50')
conflicts=('evolus-pencil-bin' 'pencil-v2')
-depends=('nodejs' 'npm' 'libxss' 'nss' 'libxtst' 'gtk2' 'alsa-lib')
-package() {
- cd "$srcdir/$pkgname-$pkgver"
+prepare() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ # We don't build electron and friends, and don't depends on postinstall script
+ patch -Np1 -i "${srcdir}/fixed-package-json.patch"
+ sed '/^\s*\"electron.*$/d;/postinstall/d' -i app/package.json
+}
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ yarn install --pure-lockfile \
+ --no-bin-links \
+ --cache-folder "${srcdir}/cache" \
+ --link-folder "${srcdir}/link" \
+ --ignore-scripts
- if [ -d "$HOME" ]; then
- TMP_HOME="$HOME"
- else
- TMP_HOME="$(pwd)/tmp-home"
- mkdir -p "$TMP_HOME/.config"
- fi
+ cd "${srcdir}/${pkgname}-${pkgver}/app"
+ yarn install --pure-lockfile \
+ --no-bin-links \
+ --cache-folder "${srcdir}/cache" \
+ --link-folder "${srcdir}/link" \
+ --ignore-scripts
+
+
+ # Aggressively remove binary and useless files in node_modules
+ find . -iname "CHANGELOG*" -exec rm -rfv {} +
+ find . -iname "README*" -exec rm -rfv {} +
+ find . -iname "*.md" -exec rm -rfv {} +
+ find . -iname "*test*" -exec rm -rfv {} +
+ find . -iname "license*" -exec rm -rfv {} +
+ find . -iname ".*" -exec rm -rfv {} + || true
+ find . -name "yarn.lock" -exec rm -rfv {} +
+}
+
+package() {
+ local _destdir=usr/lib/"${pkgname}"
+ install -dm755 "${pkgdir}/${_destdir}"
- # Temporary fix of package.json for v3.1.0 builds.
- cp -f "$srcdir/fixed-package.json" package.json
+ install -Dm755 /dev/stdin "${pkgdir}/usr/bin/${pkgname}" <<END
+#!/bin/sh
+exec electron /${_destdir} "\$@"
+END
- HOME="$TMP_HOME" npm ci --unsafe-perm
- HOME="$TMP_HOME" node_modules/.bin/build --linux dir
+ cd "${srcdir}/${pkgname}-${pkgver}"
- install -d "$pkgdir/usr/share/$pkgname/" "$pkgdir/usr/bin" \
- "$pkgdir/usr/share/applications" "$pkgdir/usr/share/mime/packages"
+ cp -r --no-preserve=ownership --preserve=mode app/* "${pkgdir}/${_destdir}/"
- cp -r dist/linux-unpacked/* "$pkgdir/usr/share/$pkgname/"
- cp app/css/images/logo-shadow.png "$pkgdir/usr/share/$pkgname/icon.png"
+ # install icons of vary sizes to hi-color theme
+ for px in 16 24 32 48 64 96 128 256; do
+ install -Dm644 "build/icons/${px}x${px}.png" \
+ "${pkgdir}/usr/share/icons/hicolor/${px}x${px}/apps/${pkgname}.png"
+ done
- install -m644 "$srcdir/pencil.desktop" "$pkgdir/usr/share/applications/"
- cp "$srcdir/pencil-mime.xml" "$pkgdir/usr/share/mime/packages/"
+ install -Dm644 /dev/stdin "$pkgdir/usr/share/applications/pencil.desktop" <<END
+[Desktop Entry]
+Encoding=UTF-8
+Name=Pencil
+Comment=Sketching and GUI prototyping tool
+Comment[cs]=Nástroj na kreslení a prototypování GUI
+Comment[el]=Εργαλείο σχεδιασμού και κατασκευής πρωτοτύπων γραφικού περιβάλλοντος διεπαφής χρήστη
+Comment[es]=Herramienta de esbozado y prototipado de interfaces gráficas de usuario
+Comment[vi_VN]=Công cụ phát thảo giao diện Pencil
+Exec=/usr/bin/pencil %u
+Terminal=false
+Type=Application
+StartupNotify=true
+Icon=pencil
+Categories=Graphics;2DGraphics;Development;
+MimeType=application/x-evolus-pencil;
+END
- ln -s "/usr/share/$pkgname/pencil" "$pkgdir/usr/bin/"
+ install -Dm644 /dev/stdin "${pkgdir}/usr/share/mime/application/pencil.xml" <<END
+<?xml version="1.0" encoding="UTF-8"?>
+<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
+ <mime-type type="application/x-evolus-pencil">
+ <comment>Evolus Pencil Document</comment>
+ <icon name="image-x-generic"/>
+ <glob pattern="*.ep"/>
+ <glob pattern="*.epz"/>
+ <glob pattern="*.epgz"/>
+ <sub-class-of type="text/xml"/>
+ </mime-type>
+</mime-info>
+END
}
diff --git a/fixed-package-json.patch b/fixed-package-json.patch
new file mode 100644
index 00000000000..6d9227a96cf
--- /dev/null
+++ b/fixed-package-json.patch
@@ -0,0 +1,30 @@
+--- a/package.json 2019-10-18 19:38:10.000000000 +0800
++++ b/package.json 2020-10-12 11:52:41.353799990 +0800
+@@ -1,9 +1,6 @@
+ {
+ "name": "Pencil",
+ "devDependencies": {
+- "electron": "6.0.1",
+- "electron-builder": "20.28.4",
+- "electron-rebuild": "^1.8.5",
+ "rimraf": "^2.5.4"
+ },
+ "build": {
+@@ -55,9 +52,6 @@
+ "perMachine": true,
+ "allowToChangeInstallationDirectory": true
+ },
+- "electronDownload": {
+- "cache": ".electron-cache"
+- },
+ "fileAssociations": {
+ "ext": [
+ "ep",
+@@ -68,7 +62,6 @@
+ }
+ },
+ "scripts": {
+- "postinstall": "install-app-deps",
+ "install-app-deps": "node ./node_modules/electron-builder/out/install-app-deps.js",
+ "start": "./node_modules/.bin/electron ./app",
+ "start:dev": "./node_modules/.bin/electron ./app --enable-dev --enable-transparent-visuals --disable-gpu",
diff --git a/fixed-package.json b/fixed-package.json
deleted file mode 100644
index 8fa5f5ecfca..00000000000
--- a/fixed-package.json
+++ /dev/null
@@ -1,84 +0,0 @@
-{
- "name": "Pencil",
- "author": {
- "name": "Evolus"
- },
- "description": "An open-source GUI prototyping tool that is available for ALL platforms.",
- "devDependencies": {
- "electron": "6.0.1",
- "electron-builder": "20.28.4",
- "electron-rebuild": "^1.8.5",
- "rimraf": "^2.5.4"
- },
- "build": {
- "appId": "vn.evolus.pencil",
- "productName": "Pencil",
- "copyright": "Copyright © 2008-2016 Evolus. All rights reserved.",
- "mac": {
- "category": "public.app-category.graphics-design"
- },
- "dmg": {
- "contents": [
- {
- "x": 356,
- "y": 140,
- "type": "link",
- "path": "/Applications"
- },
- {
- "x": 130,
- "y": 145,
- "type": "file"
- }
- ]
- },
- "linux": {
- "synopsis": "An open-source GUI prototyping tool that is available for ALL platforms.",
- "maintainer": "Nguyen Tien Dzung <ngtdungnt@gmail.com>",
- "vendor": "Evolus",
- "target": [
- "deb",
- "rpm",
- "tar.gz"
- ],
- "depends": [],
- "category": "Graphics",
- "packageCategory": "graphics"
- },
- "win": {
- "icon": "build/icon.ico",
- "target": "nsis"
- },
- "nsis": {
- "oneClick": false,
- "perMachine": true,
- "allowToChangeInstallationDirectory": true
- },
- "electronDownload": {
- "cache": ".electron-cache"
- },
- "fileAssociations": {
- "ext": [
- "ep",
- "epz",
- "epgz"
- ],
- "name": "Pencil Document"
- }
- },
- "scripts": {
- "postinstall": "install-app-deps",
- "install-app-deps": "node ./node_modules/electron-builder/out/install-app-deps.js",
- "start": "./node_modules/.bin/electron ./app",
- "start:dev": "./node_modules/.bin/electron ./app --enable-dev --enable-transparent-visuals --disable-gpu",
- "start:mac": "./node_modules/.bin/electron ./app --enable-dev",
- "clean": "rimraf dist",
- "pack": "build",
- "dist": "build",
- "release": "build",
- "dist:linux": "./node_modules/.bin/build --linux --ia32 --x64",
- "dist:win32": "./node_modules/.bin/build --windows --ia32 --x64",
- "dist:osx": "./node_modules/.bin/build --macos"
- },
- "private": true
-}
diff --git a/pencil-mime.xml b/pencil-mime.xml
deleted file mode 100644
index 7475a79057e..00000000000
--- a/pencil-mime.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
- <mime-type type="application/x-evolus-pencil">
- <comment>Evolus Pencil Document</comment>
- <icon name="image-x-generic"/>
- <glob pattern="*.ep"/>
- <glob pattern="*.epz"/>
- <glob pattern="*.epgz"/>
- <sub-class-of type="text/xml"/>
- </mime-type>
-</mime-info>
diff --git a/pencil.desktop b/pencil.desktop
deleted file mode 100644
index 790293a7939..00000000000
--- a/pencil.desktop
+++ /dev/null
@@ -1,15 +0,0 @@
-[Desktop Entry]
-Encoding=UTF-8
-Name=Pencil
-Comment=Sketching and GUI prototyping tool
-Comment[cs]=Nástroj na kreslení a prototypování GUI
-Comment[el]=Εργαλείο σχεδιασμού και κατασκευής πρωτοτύπων γραφικού περιβάλλοντος διεπαφής χρήστη
-Comment[es]=Herramienta de esbozado y prototipado de interfaces gráficas de usuario
-Comment[vi_VN]=Công cụ phát thảo giao diện Pencil
-Exec=/usr/bin/pencil %f
-Terminal=false
-Type=Application
-StartupNotify=true
-Icon=/usr/share/pencil/icon.png
-Categories=Graphics;2DGraphics;Development;
-MimeType=application/x-evolus-pencil;