upgpkg: joplin 1.5.12-1

upstream release
Added improvements by Matteo
main
Alfredo Palhares 2020-12-29 15:50:00 +00:00
parent 1d5387113e
commit 45a396d317
3 changed files with 112 additions and 54 deletions

View File

@ -1,6 +1,6 @@
pkgbase = joplin pkgbase = joplin
pkgver = 1.4.19 pkgver = 1.5.12
pkgrel = 14 pkgrel = 1
url = https://joplinapp.org/ url = https://joplinapp.org/
install = joplin.install install = joplin.install
arch = x86_64 arch = x86_64
@ -11,7 +11,6 @@ pkgbase = joplin
makedepends = npm makedepends = npm
makedepends = python makedepends = python
makedepends = rsync makedepends = rsync
makedepends = electron
depends = electron depends = electron
depends = gtk3 depends = gtk3
depends = libexif depends = libexif
@ -27,16 +26,18 @@ pkgbase = joplin
source = joplin.desktop source = joplin.desktop
source = joplin-desktop.sh source = joplin-desktop.sh
source = joplin.sh source = joplin.sh
source = joplin-1.4.19.tar.gz::https://github.com/laurent22/joplin/archive/v1.4.19.tar.gz source = joplin-1.5.12.tar.gz::https://github.com/laurent22/joplin/archive/v1.5.12.tar.gz
sha256sums = c7c5d8b0ff9edb810ed901ea21352c9830bfa286f3c18b1292deca5b2f8febd2 sha256sums = c7c5d8b0ff9edb810ed901ea21352c9830bfa286f3c18b1292deca5b2f8febd2
sha256sums = a450284fe66d89aa463d129ce8fff3a0a1a783a64209e4227ee47449d5737be8 sha256sums = a450284fe66d89aa463d129ce8fff3a0a1a783a64209e4227ee47449d5737be8
sha256sums = 5b6f8847ec0c3848375755213c3009c273f478b4b80ed2c5f0af8f67ee0e94fb sha256sums = dc1236767ee055ea1d61f10e5266a23e70f3e611b405fe713ed24ca18ee9eeb5
sha256sums = 55aad4fe50e2da980983a69bc7c0870626064db971550d522e266feb17d38916 sha256sums = 5f50ce122986ce56bf5e7c020fe2ca6e1b9539af7fb57809e256260092042ab2
pkgname = joplin pkgname = joplin
pkgdesc = A note taking and to-do application with synchronization capabilities - CLI App pkgdesc = A note taking and to-do application with synchronization capabilities - CLI App
depends = coreutils
depends = libsecret
depends = nodejs depends = nodejs
depends = rsync depends = python
pkgname = joplin-desktop pkgname = joplin-desktop
pkgdesc = A note taking and to-do application with synchronization capabilities - Desktop pkgdesc = A note taking and to-do application with synchronization capabilities - Desktop

147
PKGBUILD
View File

@ -1,95 +1,137 @@
# Maintainer: Alfredo Palhares <alfredo at palhares dot me> # Maintainer: Alfredo Palhares <alfredo at palhares dot me>
# Contributor: Mark Wagie <mark dot wagie at tutanota dot com> # Contributor: Mark Wagie <mark dot wagie at tutanota dot com>
# Contributor: Matteo Parolari
# Please contribute to: # Please contribute to:
# https://github.com/alfredopalhares/arch-pkgbuilds # https://github.com/alfredopalhares/arch-pkgbuilds
pkgbase="joplin" pkgbase="joplin"
pkgname=('joplin' 'joplin-desktop') pkgname=('joplin' 'joplin-desktop')
pkgver=1.4.19 pkgver=1.5.12
groups=('joplin') groups=('joplin')
pkgrel=14 pkgrel=1
install="joplin.install" install="joplin.install"
depends=('electron' 'gtk3' 'libexif' 'libgsf' 'libjpeg-turbo' 'libwebp' 'libxss' 'nodejs' depends=('electron' 'gtk3' 'libexif' 'libgsf' 'libjpeg-turbo' 'libwebp' 'libxss' 'nodejs'
'nss' 'orc' 'rsync' ) 'nss' 'orc' 'rsync' )
optdepends=('libappindicator-gtk3: for tray icon') optdepends=('libappindicator-gtk3: for tray icon')
arch=('x86_64' 'i686') arch=('x86_64' 'i686')
makedepends=('git' 'npm' 'python' 'rsync' 'electron') makedepends=('git' 'npm' 'python' 'rsync')
url="https://joplinapp.org/" url="https://joplinapp.org/"
license=('MIT') license=('MIT')
source=("joplin.desktop" "joplin-desktop.sh" "joplin.sh" source=("joplin.desktop" "joplin-desktop.sh" "joplin.sh"
"joplin-${pkgver}.tar.gz::https://github.com/laurent22/joplin/archive/v${pkgver}.tar.gz") "joplin-${pkgver}.tar.gz::https://github.com/laurent22/joplin/archive/v${pkgver}.tar.gz")
sha256sums=('c7c5d8b0ff9edb810ed901ea21352c9830bfa286f3c18b1292deca5b2f8febd2' sha256sums=('c7c5d8b0ff9edb810ed901ea21352c9830bfa286f3c18b1292deca5b2f8febd2'
'a450284fe66d89aa463d129ce8fff3a0a1a783a64209e4227ee47449d5737be8' 'a450284fe66d89aa463d129ce8fff3a0a1a783a64209e4227ee47449d5737be8'
'5b6f8847ec0c3848375755213c3009c273f478b4b80ed2c5f0af8f67ee0e94fb' 'dc1236767ee055ea1d61f10e5266a23e70f3e611b405fe713ed24ca18ee9eeb5'
'55aad4fe50e2da980983a69bc7c0870626064db971550d522e266feb17d38916') '5f50ce122986ce56bf5e7c020fe2ca6e1b9539af7fb57809e256260092042ab2')
# local npm cache directory
_npm_cache="npm-cache"
_get_cache() {
if [[ "${_npm_cache}" =~ ^/ ]]; then
printf "%s" "${_npm_cache}"
else
printf "%s" "${srcdir}/${_npm_cache}"
fi
}
prepare() {
local cache=$(_get_cache)
msg2 "npm cache directory: $cache"
# TODO why disabling husky?
msg2 "Disabling husky (git hooks)"
sed -i '/"husky": ".*"/d' "${srcdir}/joplin-${pkgver}/package.json"
msg2 "Tweaking lerna.json"
local tmp_json="$(mktemp --tmpdir="$srcdir")"
local lerna_json="${srcdir}/joplin-${pkgver}/lerna.json"
jq ".packages = [
\"packages/app-cli\", \"packages/app-desktop\",
\"packages/fork-htmlparser2\", \"packages/fork-sax\",
\"packages/lib\", \"packages/renderer\", \"packages/tools\",
\"packages/turndown\", \"packages/turndown-plugin-gfm\"
] |
. += {\"npmClient\": \"npm\", \"npmClientArgs\": [\"--cache $cache\"]}" \
"$lerna_json" > "$tmp_json"
cat "$tmp_json" > "$lerna_json"
rm "$tmp_json"
}
build() { build() {
local cache=$(_get_cache)
msg2 "npm cache directory: $cache"
cd "${srcdir}/joplin-${pkgver}" cd "${srcdir}/joplin-${pkgver}"
msg2 "Disabling husky (git hooks)"
sed -i '/"husky": ".*"/d' package.json
# Force Lang # Force Lang
# INFO: https://github.com/alfredopalhares/joplin-pkgbuild/issues/25 # INFO: https://github.com/alfredopalhares/joplin-pkgbuild/issues/25
export LANG=en_US.utf8 export LANG=en_US.utf8
msg2 "Installing dependencies..." msg2 "Installing dependencies through Lerna"
npm install npm install --cache "$cache"
msg2 "Running Lerna Bootstrap..."
./node_modules/.bin/lerna bootstrap
} }
#FIXME: These checks fail on some machines, even with the exit 0
# Something related with the number of allowed processes I guess
check() { check() {
cd "${srcdir}/joplin-${pkgver}" cd "${srcdir}/joplin-${pkgver}"
msg2 "Not Running any tests for now" msg2 "Not Running any tests for now"
#npm run test || exit 0 #npm run test || exit 0
} }
#TODO: A slimdown is needed
package_joplin() { package_joplin() {
pkgdesc="A note taking and to-do application with synchronization capabilities - CLI App" pkgdesc="A note taking and to-do application with synchronization capabilities - CLI App"
depends=('nodejs' 'rsync') depends=('coreutils' 'libsecret' 'nodejs' 'python')
msg2 "Building CLI..." local cache=$(_get_cache)
mkdir -p "${pkgdir}/usr/share/joplin-cli/app-cli" msg2 "npm cache directory: $cache"
msg2 "Building CLI"
cd "${srcdir}/joplin-${pkgver}/packages/app-cli" cd "${srcdir}/joplin-${pkgver}/packages/app-cli"
npm run build npm run build
cd build
cp -R "." "${pkgdir}/usr/share/joplin-cli/app-cli/"
msg2 "Copying Base Node Modules packages..." msg2 "Packaging CLI"
cd "${srcdir}/joplin-${pkgver}/packages/app-cli" cd "${srcdir}/joplin-${pkgver}/packages/app-cli/build"
cp -R "node_modules/" \ local pack="$(npm pack | tail -n 1)"
"${pkgdir}/usr/share/joplin-cli/app-cli"
msg2 "Copy CLI Joplin Dependencies..." msg2 "Installing CLI ($pack)"
cd "${srcdir}/joplin-${pkgver}/packages/" npm install --global --production --user root --cache "$cache" \
cp -R "fork-htmlparser2" "${pkgdir}/usr/share/joplin-cli/" --prefix "${pkgdir}/tmp" "$pack"
cp -R "fork-sax" "${pkgdir}/usr/share/joplin-cli/"
cp -R "lib/" "${pkgdir}/usr/share/joplin-cli/"
cp -R "renderer/" "${pkgdir}/usr/share/joplin-cli/"
cp -R "tools/" "${pkgdir}/usr/share/joplin-cli/"
#TODO: Check if existing symblinks are valid msg2 "Rearranging directory tree"
msg2 "Fixing @Joplin Symlinks..." mkdir -p "${pkgdir}/usr/share/"
cd "${pkgdir}/usr/share/joplin-cli/" mv "${pkgdir}/tmp/lib/node_modules/joplin/" "${pkgdir}/usr/share/"
for dir in $(find . -type d -name "@joplin"); do rm -r "${pkgdir}/tmp"
cd "${pkgdir}/usr/share/joplin-cli/${dir}"
rm -r *
ln -s "../../../fork-htmlparser2" "fork-htmlparser2"
ln -s "../../../fork-sax" "fork-sax"
ln -s "../../../lib" "lib"
ln -s "../../../renderer" "renderer"
ln -s "../../../tools" "tools"
done
msg2 "Installing LICENSE..." msg2 "Fixing Directories Permissions"
cd "${srcdir}/joplin-${pkgver}/" # Non-deterministic race in npm gives 777 permissions to random directories.
install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}" # See https://github.com/npm/cli/issues/1103 for details.
find "${pkgdir}/usr" -type d -exec chmod 755 {} +
msg2 "Remove References to \$pkgdir"
find "$pkgdir" -name package.json -print0 | xargs -0 sed -i "/_where/d"
msg2 "Remove References to \$srcdir"
local tmppackage="$(mktemp --tmpdir="$srcdir")"
local pkgjson="$pkgdir/usr/share/joplin/package.json" # TODO joplin name
jq '.|=with_entries(select(.key|test("_.+")|not))' "$pkgjson" > "$tmppackage"
mv "$tmppackage" "$pkgjson"
chmod 644 "$pkgjson"
msg2 "Fixing Permissions set by npm"
# npm gives ownership of ALL FILES to build user
# https://bugs.archlinux.org/task/63396
chown -R root:root "${pkgdir}"
msg2 "Installing LICENSE"
install -Dm644 "${srcdir}/joplin-${pkgver}/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}/"
msg2 "Installing Startup Script" msg2 "Installing Startup Script"
cd "${srcdir}" cd "${srcdir}"
install -Dm755 joplin.sh "${pkgdir}/usr/bin/joplin-cli" install -Dm755 joplin.sh "${pkgdir}/usr/bin/joplin"
} }
@ -100,15 +142,20 @@ package_joplin-desktop() {
optdepends=('libappindicator-gtk3: for tray icon') optdepends=('libappindicator-gtk3: for tray icon')
conflicts=('joplin-desktop-electron') conflicts=('joplin-desktop-electron')
# ./generateSha512.js fails if AppImage is not built
mkdir -p "${srcdir}/joplin-${pkgver}/packages/app-desktop/dist/"
touch "${srcdir}/joplin-${pkgver}/packages/app-desktop/dist/AppImage"
msg2 "Building Desktop with packaged Electron..." msg2 "Building Desktop with packaged Electron..."
mkdir -p "${pkgdir}/usr/share/joplin-desktop" mkdir -p "${pkgdir}/usr/share/joplin-desktop"
cd "${srcdir}/joplin-${pkgver}/packages/app-desktop" cd "${srcdir}/joplin-${pkgver}/packages/app-desktop"
electron_dir="/usr/lib/electron" electron_dir="/usr/lib/electron"
electron_version=$(cat /usr/lib/electron/version) electron_version=$(cat /usr/lib/electron/version)
msg2 "Using Electron Version ${electron_version}"
USE_HARD_LINKS=false npm run dist -- --publish=never --linux --x64 \ USE_HARD_LINKS=false npm run dist -- --publish=never --linux --x64 \
--dir="dist/" -c.electronDist=$electron_dir -c.electronVersion=$electron_version --dir="dist/" -c.electronDist=$electron_dir -c.electronVersion=$electron_version
# TODO: Cleanup app.asar file
cd dist/linux-unpacked/ cd dist/linux-unpacked/
cp -R "." "${pkgdir}/usr/share/joplin-desktop" cp -R "." "${pkgdir}/usr/share/joplin-desktop"
@ -120,5 +167,15 @@ package_joplin-desktop() {
cd "${srcdir}" cd "${srcdir}"
install -Dm755 ${srcdir}/joplin-desktop.sh "${pkgdir}/usr/bin/joplin-desktop" install -Dm755 ${srcdir}/joplin-desktop.sh "${pkgdir}/usr/bin/joplin-desktop"
install -Dm644 ${srcdir}/joplin.desktop -t "${pkgdir}/usr/share/applications" install -Dm644 ${srcdir}/joplin.desktop -t "${pkgdir}/usr/share/applications"
msg2 "Installing icons"
local -r src_icon_dir="${srcdir}/joplin-${pkgver}/packages/app-desktop/build/icons"
local -i size
for size in 16 22 24 32 36 48 64 72 96 128 192 256 512; do
[[ -f "${src_icon_dir}/${size}x${size}.png" ]] &&
install -Dm644 \
"${src_icon_dir}/${size}x${size}.png" \
"${pkgdir}/usr/share/icons/hicolor/${size}x${size}/apps/joplin.png"
done
} }

View File

@ -1,9 +1,9 @@
#!/bin/bash #!/bin/bash
readonly joplin_dir="/usr/share/joplin-cli/app-cli" readonly joplin_dir="/usr/share/joplin/"
if [[ ! -d $joplin_dir ]]; then if [[ ! -d $joplin_dir ]]; then
echo "Cannot find /usr/share/joplin-cli/app-cli" echo "Cannot find ${joplin_dir}"
exit 1 exit 1
fi fi