summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaleb Maclennan2022-02-04 21:13:45 +0300
committerCaleb Maclennan2022-02-04 22:03:49 +0300
commitdd7159c87448362936730070fc6ab69ff9687a4b (patch)
tree93d1fe2c1842cb12ff6a9333811786ebe8f95c2a
parenta5f16450620620ac4b13e734f5855a087c973860 (diff)
downloadaur-zettlr.tar.gz
Overhaul with an eye to migrating to [community]
-rw-r--r--.SRCINFO27
-rw-r--r--0001-Do-not-download-pandoc.patch34
-rw-r--r--PKGBUILD212
-rwxr-xr-xzettlr.sh3
-rw-r--r--zettlr.xml18
5 files changed, 90 insertions, 204 deletions
diff --git a/.SRCINFO b/.SRCINFO
index def9e234b8a7..c26b898980cc 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,26 +1,25 @@
pkgbase = zettlr
- pkgdesc = A markdown editor for writing academic texts and taking notes
+ pkgdesc = A Markdown Editor for the 21st century
pkgver = 2.1.3
- pkgrel = 1
+ pkgrel = 2
url = https://www.zettlr.com
arch = x86_64
license = GPL
- license = custom
+ makedepends = gendesk
makedepends = git
- makedepends = yarn
makedepends = nodejs-lts-gallium
+ makedepends = yarn
depends = electron
- optdepends = pandoc: For exporting to various format
+ depends = otf-crimson-text
+ depends = pandoc
+ depends = ttf-inconsolata
+ depends = ttf-liberation
optdepends = texlive-bin: For Latex support
- optdepends = ttf-lato: Display output in a more comfortable way
- options = !strip
- source = zettlr-2.1.3.tar.gz::https://github.com/Zettlr/Zettlr/archive/v2.1.3.tar.gz
- source = 0001-Do-not-download-pandoc.patch
- source = locales-2.1.3-1.zip::https://github.com/citation-style-language/locales/archive/c38205618f1a23eb80e8c5f33c8086648ca3874b.zip
- source = chicago-author-date-2.1.3-1.csl::https://github.com/citation-style-language/styles/raw/ccb71844fdafb2b7a48cccb364f4b4c03d3cdce6/chicago-author-date.csl
+ source = https://github.com/Zettlr/Zettlr/archive/v2.1.3/Zettlr-2.1.3.tar.gz
+ source = zettlr.sh
+ source = zettlr.xml
sha256sums = ec77affb8a0db08bf480c9ec0b5caef771251e3b5e1f2ba9219bb7ce466c66fe
- sha256sums = a0fe981dade0ce52be190d8e8a2fd7f6c05c32c7d44d96c63f6f494460d483ef
- sha256sums = 275fc80a391b4002b52182deb12997a1408118b7753977ea69ef5256c6f3ff47
- sha256sums = 1455e57b314fd13ba155f4ab93f061e3e6393c13cd0f16380adb9d73614f7930
+ sha256sums = c96a7d8e8b538896721e1657aaa7a1fc79836c50f90888f77ccea23e90230326
+ sha256sums = c3ecbb490a1d4fa5bc42f7166cc375e5629a452d25bb1d4facb5541938681292
pkgname = zettlr
diff --git a/0001-Do-not-download-pandoc.patch b/0001-Do-not-download-pandoc.patch
deleted file mode 100644
index 471d14b34396..000000000000
--- a/0001-Do-not-download-pandoc.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 134b69946ba94932aed157a724202fab10eeb585 Mon Sep 17 00:00:00 2001
-From: BrLi <brli@chakralinux.org>
-Date: Tue, 26 Oct 2021 17:01:05 +0800
-Subject: [PATCH] Do not download pandoc
-
-- The downloading of extra binary from internet during building is not desired
-- To ease possible error, we deal the file installation and faking from
- PKGBUILD instead of upstream build system.
----
- forge.config.js | 7 ++-----
- 1 file changed, 2 insertions(+), 5 deletions(-)
-
-diff --git a/forge.config.js b/forge.config.js
-index 232aca3d..a57a5826 100644
---- a/forge.config.js
-+++ b/forge.config.js
-@@ -82,12 +82,9 @@ module.exports = {
- try {
- await fs.lstat(path.join(__dirname, `./resources/pandoc-${platform}-${arch}`))
- } catch (err) {
-- await downloadPandoc(platform, arch)
-+ console.log('\nSkip pandoc executable download on Arch')
- }
--
-- await fs.copyFile(path.join(__dirname, `./resources/pandoc-${platform}-${arch}`), path.join(__dirname, './resources/pandoc'))
--
-- forgeConfig.packagerConfig.extraResource.push(path.join(__dirname, './resources/pandoc'))
-+ console.log('\nDo not copy pandoc executable, is taking cared of via PKGBUILD')
- } else {
- // If someone is building this on an unsupported platform, drop a warning.
- console.log(`\nBuilding for an unsupported platform/arch-combination ${targetPlatform}/${targetArch} - not bundling Pandoc.`)
---
-2.33.1
-
diff --git a/PKGBUILD b/PKGBUILD
index c44c6f5c191f..8964573b81df 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,170 +1,70 @@
-# Maintainer: BrLi <brli at chakralinux dot org>
# Maintainer: Caleb Maclennan <caleb@alerque.com>
-
-# Decide whether to include pandoc binary into zettlr package
-# Default to false, the application will use Arch's pandoc
-_bundle_pandoc=false
+# Contributor: BrLi <brli at chakralinux dot org>
pkgname=zettlr
+_pkgname=${pkgname^}
pkgver=2.1.3
-pkgrel=1
-pkgdesc="A markdown editor for writing academic texts and taking notes"
-arch=('x86_64')
-url='https://www.zettlr.com'
-license=('GPL' 'custom') # Noted that the icon and name are copyrighted
-depends=(electron)
-makedepends=(git yarn nodejs-lts-gallium) # check .github/workflows/build.yml for NODE_VERSION
-optdepends=('pandoc: For exporting to various format'
- 'texlive-bin: For Latex support'
- 'ttf-lato: Display output in a more comfortable way')
-_csl_locale_commit=c38205618f1a23eb80e8c5f33c8086648ca3874b # Dec 23, 2021
-_csl_style_commit=ccb71844fdafb2b7a48cccb364f4b4c03d3cdce6 # Sep 19, 2021
-_pandoc_binary_ver=2.17 # check scripts/get-pandoc.sh for update
-options=(!strip)
-source=("${pkgname}-${pkgver}.tar.gz::https://github.com/Zettlr/Zettlr/archive/v${pkgver}.tar.gz"
- '0001-Do-not-download-pandoc.patch'
- # citation style
- "locales-${pkgver}-${pkgrel}.zip::https://github.com/citation-style-language/locales/archive/${_csl_locale_commit}.zip"
- "chicago-author-date-${pkgver}-${pkgrel}.csl::https://github.com/citation-style-language/styles/raw/${_csl_style_commit}/chicago-author-date.csl")
+pkgrel=2
+pkgdesc='A Markdown Editor for the 21st century'
+arch=(x86_64)
+url=https://www.zettlr.com
+_url="https://github.com/$_pkgname/$_pkgname"
+license=(GPL)
+depends=(electron
+ otf-crimson-text
+ pandoc
+ ttf-inconsolata
+ ttf-liberation)
+makedepends=(gendesk
+ git
+ nodejs-lts-gallium # check .github/workflows/build.yml for NODE_VERSION
+ yarn)
+optdepends=('texlive-bin: For Latex support')
+_archive="$_pkgname-$pkgver"
+source=("$_url/archive/v$pkgver/$_archive.tar.gz"
+ "$pkgname.sh"
+ "$pkgname.xml")
sha256sums=('ec77affb8a0db08bf480c9ec0b5caef771251e3b5e1f2ba9219bb7ce466c66fe'
- 'a0fe981dade0ce52be190d8e8a2fd7f6c05c32c7d44d96c63f6f494460d483ef'
- '275fc80a391b4002b52182deb12997a1408118b7753977ea69ef5256c6f3ff47'
- '1455e57b314fd13ba155f4ab93f061e3e6393c13cd0f16380adb9d73614f7930')
-if ${_bundle_pandoc} ; then
- # pandoc binary source
- source+=("https://github.com/jgm/pandoc/releases/download/${_pandoc_binary_ver}/pandoc-${_pandoc_binary_ver}-linux-amd64.tar.gz")
- sha256sums+=('3fe3d42179af289d4f5452b9317d2bc9cd139a4f33a37f68d70e128f1d415aa4')
-fi
-
-prepare() {
- cd "Zettlr-${pkgver}"
+ 'c96a7d8e8b538896721e1657aaa7a1fc79836c50f90888f77ccea23e90230326'
+ 'c3ecbb490a1d4fa5bc42f7166cc375e5629a452d25bb1d4facb5541938681292')
- # Use pacman mechanism to download pandoc binary instead of using upstream script
- patch -Np1 -i $srcdir/0001-Do-not-download-pandoc.patch
+_yarnargs="--cache-folder '$srcdir/cache' --link-folder '$srcdir/link'"
- # csl:refresh from package.json
- find "${srcdir}/locales-$_csl_locale_commit" -name "*.xml" \
- -exec cp {} static/csl-locales/ \;
- cp "${srcdir}/locales-$_csl_locale_commit/locales.json" static/csl-locales/
- cp "${srcdir}/chicago-author-date-${pkgver}-$pkgrel.csl" static/csl-styles/chicago-author-date.csl
-
-if ${_bundle_pandoc} ; then
- # Put pandoc binary in place
- cp "${srcdir}/pandoc-${_pandoc_binary_ver}/bin/pandoc" resources/pandoc-linux-x64
- ln -sf pandoc-linux-x64 resources/pandoc
-else
- # Using Arch's pandoc, need to fake a link, otherwise npm/yarn complains
- ln -sf /usr/bin/pandoc resources/pandoc-linux-x64
- ln -sf /usr/bin/pandoc resources/pandoc
-fi
+prepare() {
+ local _electronVersion=$(electron --version | sed -e 's/^v//')
+ gendesk -q -f -n \
+ --pkgname "$pkgname" \
+ --pkgdesc "$pkgdesc" \
+ --name="$_pkgname" \
+ --categories=Office \
+ --custom StartupWMClass="$_pkgname"
+ cd "$_archive"
+ echo -ne '#!/usr/bin/env bash\n\nexit 0' > scripts/get-pandoc.sh
+ sed -i -e '/"electron"/d' package.json
+ yarn $_yarnargs install --frozen-lockfile --ignore-scripts
+ yarn $_yarnargs add --dev --no-lockfile electron@$_electronVersion
+ yarn $_yarnargs install --pure-lockfile # postinstall script installs electron-builder deps
+ ln -sf /usr/bin/pandoc resources/pandoc-linux-x64
}
build() {
- cd "Zettlr-${pkgver}"
- local NODE_ENV=''
- yarn install --cache-folder "${srcdir}/cache" \
- --link-folder "${srcdir}/link"
- yarn reveal:build
-
- node node_modules/.bin/electron-forge package
-
- # Remove fonts
- cd "${srcdir}/Zettlr-${pkgver}/.webpack"
- find . -type d -name "fonts" -exec rm -rf {} +
-
- # Remove references to $srcdir
- find renderer -type f -name 'index.js.map' -exec sed -i "s,${srcdir}/Zettlr,/usr/lib/${pkgname},g" {} +
-
- # Remove resources for other OSs and leftovers
- cd "${srcdir}/Zettlr-${pkgver}/resources"
- rm -rfv NSIS
- rm -rfv icons/dmg
- rm -rfv icons/*icns
- rm -rfv icons/*.ico
- rm -rfv screenshots
- rm -r .gitignore
-
- # Remove fonts
- cd "${srcdir}/Zettlr-${pkgver}/static"
- rm -rf fonts
+ cd "$_archive"
+ local NODE_ENV=''
+ yarn $_yarnargs reveal:build
+ yarn $_yarnargs package:linux-x64
}
-# check() {
-# cd "${srcdir}/Zettlr-${pkgver}"
-# # Require electron module to test
-# yarn add --cache-folder "${srcdir}/cache" --link-folder "${srcdir}/link" electron
-# # The "test" function in package.json
-# node node_modules/mocha/bin/mocha
-# # The "test-gui" function in package.json, not useful in our case
-# node scripts/test-gui.js
-# # Clean up
-# yarn remove electron
-# rm yarn.lock
-# rm node_modules/.bin -rf
-# }
-
package() {
- local _destdir=usr/lib/"${pkgname}"
- install -dm755 "${pkgdir}/${_destdir}"
-
- cd "${srcdir}/Zettlr-${pkgver}"
-
- # Copy the generated electron project
- cp -r --no-preserve=ownership --preserve=mode ./.webpack "${pkgdir}/${_destdir}/"
- cp -r --no-preserve=ownership --preserve=mode ./resources "${pkgdir}/${_destdir}/"
- cp -r --no-preserve=ownership --preserve=mode ./static "${pkgdir}/${_destdir}/"
- cp -r --no-preserve=ownership --preserve=mode ./package.json "${pkgdir}/${_destdir}/"
-
- # Install start script to /usr/bin
- install -Dm755 /dev/stdin "${pkgdir}/usr/bin/Zettlr" <<END
-#!/bin/sh
-exec electron /${_destdir} "\$@"
-END
-
- # install icons of various sizes to hi-color theme
- for px in 16 24 32 48 64 96 128 256 512 1024; do
- install -Dm644 "${srcdir}/Zettlr-${pkgver}/resources/icons/png/${px}x${px}.png" \
- "${pkgdir}/usr/share/icons/hicolor/${px}x${px}/apps/Zettlr.png"
- done
-
- # Generate desktop entry file
- # Based on descriptions in package.json and forge.config.js
- install -Dm644 /dev/stdin "${pkgdir}/usr/share/applications/Zettlr.desktop" <<END
-[Desktop Entry]
-Name=Zettlr
-Comment=A powerful Markdown Editor with integrated tree view
-Exec=Zettlr %U
-Terminal=false
-Type=Application
-Icon=Zettlr
-StartupWMClass=Zettlr
-MimeType=text/markdown;
-Categories=Office;
-END
-
- # Generate mimetype configuration file to associate with zettlr
- # Based on electron-builder.yml
- install -Dm644 /dev/stdin "${pkgdir}/usr/share/mime/packages/Zettlr.xml" <<END
-<?xml version="1.0" encoding="utf-8"?>
-<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
- <mime-type type="text/markdown">
- <glob pattern="*.md"/>
- <comment>Markdown document</comment>
- <icon name="x-office-document" />
- </mime-type>
- <mime-type type="text/markdown">
- <glob pattern="*.markdown"/>
- <comment>Markdown document</comment>
- <icon name="x-office-document" />
- </mime-type>
- <mime-type type="text/markdown">
- <glob pattern="*.rmd"/>
- <comment>RMarkdown document</comment>
- <icon name="x-office-document" />
- </mime-type>
-</mime-info>
-END
-
- # license
- install -Dm644 -t "${pkgdir}/usr/share/licenses/${pkgname}/" "${srcdir}/Zettlr-${pkgver}/LICENSE"
+ install -Dm0755 "${source[1]}" "$pkgdir/usr/bin/$pkgname"
+ install -Dm0644 -t "$pkgdir/usr/share/applications/" "$pkgname.desktop"
+ cd "$_archive"
+ local _destdir="usr/lib/$pkgname"
+ install -Dm0644 -t "$pkgdir/$_destdir/resources/" \
+ "out/$_pkgname-linux-x64/resources/"{app.asar,icon.code.icns}
+ ln -sf /usr/bin/pandoc "$pkgdir/$_destdir/resources/pandoc"
+ for px in 16 24 32 48 64 96 128 256 512 1024; do
+ install -Dm0644 "resources/icons/png/${px}x${px}.png" \
+ "$pkgdir/usr/share/icons/hicolor/${px}x${px}/apps/$pkgname.png"
+ done
+ install -Dm0644 -t "$pkgdir/usr/share/mime/packages/" "../${source[2]}"
}
diff --git a/zettlr.sh b/zettlr.sh
new file mode 100755
index 000000000000..0bc8899fe7f4
--- /dev/null
+++ b/zettlr.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env sh
+
+exec electron /usr/lib/zettlr/resources/app.asar "$@"
diff --git a/zettlr.xml b/zettlr.xml
new file mode 100644
index 000000000000..ad99615d8655
--- /dev/null
+++ b/zettlr.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
+ <mime-type type="text/markdown">
+ <glob pattern="*.md"/>
+ <comment>Markdown document</comment>
+ <icon name="x-office-document" />
+ </mime-type>
+ <mime-type type="text/markdown">
+ <glob pattern="*.markdown"/>
+ <comment>Markdown document</comment>
+ <icon name="x-office-document" />
+ </mime-type>
+ <mime-type type="text/markdown">
+ <glob pattern="*.rmd"/>
+ <comment>RMarkdown document</comment>
+ <icon name="x-office-document" />
+ </mime-type>
+</mime-info>