summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaleb Maclennan2020-04-28 15:55:08 +0300
committerCaleb Maclennan2020-04-28 16:06:46 +0300
commitbbd6ee71bf0f54ec895e84479a5a13bbe6d20ae6 (patch)
tree7c0755f6911ea3846d25ede75a494f9bb5c273bc
parenta806675ebbd74695374d44b44d59e712717e59ba (diff)
downloadaur-bbd6ee71bf0f54ec895e84479a5a13bbe6d20ae6.tar.gz
upgpkg: marktext-git 0.16.0.r6.g90fdd28-1
Adopt, overhaul Electron packaging based on stable package
-rw-r--r--.SRCINFO27
-rw-r--r--PKGBUILD95
-rw-r--r--marktext-arg-handling.patch26
-rw-r--r--marktext.sh5
4 files changed, 108 insertions, 45 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 8f829b940f8d..53e3e7d37e3c 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,21 +1,28 @@
pkgbase = marktext-git
- pkgdesc = Next generation markdown editor
- pkgver = r1380.65f1bef3
+ pkgdesc = A simple and elegant open-source markdown editor that focused on speed and usability
+ pkgver = 0.16.0.r6.g90fdd28
pkgrel = 1
- url = https://marktext.app/
+ url = https://marktext.app
arch = x86_64
license = MIT
- makedepends = python
- makedepends = nodejs>=12
- makedepends = npm
+ makedepends = jq
+ makedepends = nodejs-lts-erbium
+ makedepends = node-gyp
+ makedepends = moreutils
makedepends = yarn
+ makedepends = yq
depends = electron
- provides = marktext
+ depends = libxkbfile
+ depends = libsecret
+ depends = ripgrep
+ provides = marktext-0.16.0.r6.g90fdd28
conflicts = marktext
- source = git+https://github.com/marktext/marktext
+ source = marktext-git::git+https://github.com/marktext/marktext.git
source = marktext.sh
- sha512sums = SKIP
- sha512sums = 8927cea6815420206982263d80fa54bbcfcc37623008b6a2f25d16782cfdff70ef44c3dbc142e2c45b474df52f216e7d58cf556a525df0683bc447481ab7b27d
+ source = marktext-arg-handling.patch
+ sha256sums = SKIP
+ sha256sums = c5af6eabe525af458df2ccfac6098092746dd0ae23225c131100bb6e37170f86
+ sha256sums = c754a1cad52d10a38eeddb9293ce0a4540296c6adbb47eb5311eaaeded150a01
pkgname = marktext-git
diff --git a/PKGBUILD b/PKGBUILD
index b67f1d12ebaa..59ae944ba1e0 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,52 +1,81 @@
+# Maintainer: Caleb Maclennan <caleb@alerque.com>
+# Maintainer: Gabriel Saillard (GitSquared) <gabriel@saillard.dev>
# Contributor: David Birks <david@tellus.space>
# Contributor: Simon Doppler (dopsi) <dop.simon@gmail.com>
# Contributor: dpeukert
-_gitname=marktext
+# Contributor: lonaowna
+
pkgname=marktext-git
-pkgver=r1380.65f1bef3
+_pkgname=${pkgname%-git}
+pkgver=0.16.0.r6.g90fdd28
pkgrel=1
-pkgdesc='Next generation markdown editor'
+pkgdesc='A simple and elegant open-source markdown editor that focused on speed and usability'
arch=('x86_64')
-url='https://marktext.app/'
+url='https://marktext.app'
license=('MIT')
-depends=('electron')
-makedepends=('python' 'nodejs>=12' 'npm' 'yarn')
-conflicts=('marktext')
-provides=('marktext')
-source=("git+https://github.com/${_gitname}/${_gitname}"
- 'marktext.sh')
-sha512sums=('SKIP'
- '8927cea6815420206982263d80fa54bbcfcc37623008b6a2f25d16782cfdff70ef44c3dbc142e2c45b474df52f216e7d58cf556a525df0683bc447481ab7b27d')
+depends=('electron'
+ 'libxkbfile'
+ 'libsecret'
+ 'ripgrep')
+makedepends=('jq'
+ 'nodejs-lts-erbium'
+ 'node-gyp'
+ 'moreutils'
+ 'yarn'
+ 'yq')
+conflicts=("$_pkgname")
+provides=("$_pkgname-$pkgver")
+source=("$pkgname::git+https://github.com/$_pkgname/${pkgname/-/.}"
+ "$_pkgname.sh"
+ "$_pkgname-arg-handling.patch")
+sha256sums=('SKIP'
+ 'c5af6eabe525af458df2ccfac6098092746dd0ae23225c131100bb6e37170f86'
+ 'c754a1cad52d10a38eeddb9293ce0a4540296c6adbb47eb5311eaaeded150a01')
+
+_electronDist=$(dirname $(realpath $(which electron)))
+_electronVersion=$(electron --version | sed -e 's/^v//')
pkgver() {
- cd "${srcdir}/${_gitname}"
- printf 'r%s.%s' "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+ cd "$pkgname"
+ git describe --tags --abbrev=7 --match="v*" HEAD |
+ sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
prepare() {
- cd "${srcdir}/${_gitname}"
- yarn install
+ cd "$pkgname"
+ jq 'del(.devDependencies["electron"], .scripts["preinstall", "postinstall"])' \
+ package.json | sponge package.json
+ yq -y ". + {\"electronDist\": \"$_electronDist\", \"electronVersion\": \"$_electronVersion\"}" \
+ electron-builder.yml | sponge electron-builder.yml
+ mkdir -p "$srcdir/node_modules"
+ yarn --cache-folder "$srcdir/node_modules" install --frozen-lockfile
+ yarn --cache-folder "$srcdir/node_modules" add -D -E --no-lockfile --ignore-scripts electron@$_electronVersion
+ patch -p1 < "$srcdir/$_pkgname-arg-handling.patch"
}
build() {
- cd "${srcdir}/${_gitname}"
- yarn run build:bin
+ cd "$pkgname"
+ yarn --cache-folder "$srcdir/node_modules" run electron-rebuild
+ node .electron-vue/build.js
+ yarn --cache-folder "$srcdir/node_modules" run \
+ electron-builder --linux --x64 --dir dist
}
package() {
- cd "${srcdir}/${_gitname}"
-
- # Install app.asar and launcher script
- install -D build/linux-unpacked/resources/app.asar "${pkgdir}/usr/share/marktext/app.asar"
- cp -r build/linux-unpacked/resources/app.asar.unpacked "${pkgdir}/usr/share/marktext/app.asar.unpacked"
- install -D "${srcdir}/marktext.sh" "${pkgdir}/usr/bin/marktext"
-
- # Install desktop file and icon
- install -D resources/linux/marktext.desktop "${pkgdir}/usr/share/applications/marktext.desktop"
- install -D resources/icons/icon.png "${pkgdir}/usr/share/pixmaps/marktext.png"
-
- # Install license file
- install -D LICENSE "${pkgdir}/usr/share/licenses/marktext/LICENSE"
- install -D build/linux-unpacked/LICENSE.electron.txt "${pkgdir}/usr/share/licenses/marktext/LICENSE.electron.txt"
- install -D build/linux-unpacked/LICENSES.chromium.html "${pkgdir}/usr/share/licenses/marktext/LICENSES.chromium.html"
+ cd "$pkgname"
+ install -Dm755 "../$_pkgname.sh" "$pkgdir/usr/bin/$_pkgname"
+ local _dist=build/linux-unpacked/resources
+ install -Dm644 -t "$pkgdir/usr/lib/$_pkgname/" "$_dist/app.asar"
+ cp -a "$_dist"/{app.asar.unpacked,hunspell_dictionaries} "$pkgdir/usr/lib/$_pkgname/"
+ local _rg_path="$pkgdir/usr/lib/marktext/app.asar.unpacked/node_modules/vscode-ripgrep/bin/"
+ mkdir -p $_rg_path
+ ln -sf /usr/bin/rg "$_rg_path"
+ install -Dm755 -t "${pkgdir}/usr/share/applications/" resources/linux/marktext.desktop
+ install -Dm755 -t "${pkgdir}/usr/share/metainfo/" resources/linux/marktext.appdata.xml
+ install -Dm644 resources/icons/icon.png "${pkgdir}/usr/share/pixmaps/marktext.png"
+ install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname/" LICENSE
+ install -Dm644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md CONTRIBUTING.md
+ cp -a docs "$pkgdir/usr/share/doc/$pkgname/"
+ pushd "resources/icons"
+ find -name maktext.png -exec install -Dm644 {} "$pkgdir/usr/share/icons/hicolor/{}" \;
}
diff --git a/marktext-arg-handling.patch b/marktext-arg-handling.patch
new file mode 100644
index 000000000000..c77ff73a8d55
--- /dev/null
+++ b/marktext-arg-handling.patch
@@ -0,0 +1,26 @@
+From 067973c193f78729d4c3eb55d2132ce9c49f8a97 Mon Sep 17 00:00:00 2001
+From: Caleb Maclennan <caleb@alerque.com>
+Date: Thu, 23 Apr 2020 22:52:39 +0300
+Subject: [PATCH] patch-args
+
+Signed-off-by: Caleb Maclennan <caleb@alerque.com>
+---
+ src/main/cli/index.js | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/main/cli/index.js b/src/main/cli/index.js
+index d306c409..1f07087e 100644
+--- a/src/main/cli/index.js
++++ b/src/main/cli/index.js
+@@ -10,7 +10,7 @@ const write = s => process.stdout.write(s)
+ const writeLine = s => write(s + '\n')
+
+ const cli = () => {
+- let argv = process.argv.slice(1)
++ let argv = process.argv.slice(2)
+ if (process.env.NODE_ENV === 'development') {
+ // Don't pass electron development arguments to Mark Text and change user data path.
+ argv = ['--user-data-dir', path.join(getPath('appData'), 'marktext-dev')]
+--
+2.26.2
+
diff --git a/marktext.sh b/marktext.sh
index 02d1f6c36a45..8bfc08fdf0ed 100644
--- a/marktext.sh
+++ b/marktext.sh
@@ -1,2 +1,3 @@
-#!/bin/sh
-electron /usr/share/marktext/app.asar $@
+#!/usr/bin/env sh
+
+exec electron /usr/lib/marktext/app.asar "$@"