2020-01-27 18:51:36 +01:00
|
|
|
# Maintainer: Alfredo Palhares <alfredo at palhares dot me>
|
|
|
|
# Contributor: Mark Wagie <mark dot wagie at tutanota dot com>
|
2020-12-29 16:50:00 +01:00
|
|
|
# Contributor: Matteo Parolari
|
2018-04-18 18:26:44 +02:00
|
|
|
|
|
|
|
# Please contribute to:
|
2020-07-13 15:53:00 +02:00
|
|
|
# https://github.com/alfredopalhares/arch-pkgbuilds
|
2018-04-18 18:26:44 +02:00
|
|
|
|
2020-12-08 01:58:34 +01:00
|
|
|
pkgbase="joplin"
|
2020-12-27 17:42:24 +01:00
|
|
|
pkgname=('joplin' 'joplin-desktop')
|
2021-02-02 14:49:04 +01:00
|
|
|
pkgver=1.7.10
|
2020-12-08 17:55:24 +01:00
|
|
|
groups=('joplin')
|
2020-12-29 16:50:00 +01:00
|
|
|
pkgrel=1
|
2020-12-08 18:07:05 +01:00
|
|
|
install="joplin.install"
|
2020-12-20 19:00:38 +01:00
|
|
|
depends=('electron' 'gtk3' 'libexif' 'libgsf' 'libjpeg-turbo' 'libwebp' 'libxss' 'nodejs'
|
|
|
|
'nss' 'orc' 'rsync' )
|
|
|
|
optdepends=('libappindicator-gtk3: for tray icon')
|
2020-01-27 18:51:36 +01:00
|
|
|
arch=('x86_64' 'i686')
|
2021-01-18 16:00:10 +01:00
|
|
|
makedepends=('git' 'npm' 'python' 'rsync' 'jq' 'electron')
|
2020-01-05 14:55:22 +01:00
|
|
|
url="https://joplinapp.org/"
|
2020-01-27 18:51:36 +01:00
|
|
|
license=('MIT')
|
2020-12-08 02:03:41 +01:00
|
|
|
source=("joplin.desktop" "joplin-desktop.sh" "joplin.sh"
|
2020-12-08 01:58:34 +01:00
|
|
|
"joplin-${pkgver}.tar.gz::https://github.com/laurent22/joplin/archive/v${pkgver}.tar.gz")
|
|
|
|
sha256sums=('c7c5d8b0ff9edb810ed901ea21352c9830bfa286f3c18b1292deca5b2f8febd2'
|
|
|
|
'a450284fe66d89aa463d129ce8fff3a0a1a783a64209e4227ee47449d5737be8'
|
2020-12-29 16:50:00 +01:00
|
|
|
'dc1236767ee055ea1d61f10e5266a23e70f3e611b405fe713ed24ca18ee9eeb5'
|
2021-02-02 14:49:04 +01:00
|
|
|
'3e3e48dc1026de2e74a894bed2d0ba343bf3ed4268bc39666cd7ad6958ee1d29')
|
2020-12-29 16:50:00 +01:00
|
|
|
|
|
|
|
# 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"
|
|
|
|
|
|
|
|
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"
|
2020-12-29 18:18:05 +01:00
|
|
|
# TODO: Add check for lerna.json file
|
2020-12-29 16:50:00 +01:00
|
|
|
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"
|
|
|
|
}
|
|
|
|
|
2020-12-08 01:58:34 +01:00
|
|
|
|
2018-04-18 18:26:44 +02:00
|
|
|
build() {
|
2020-12-29 16:50:00 +01:00
|
|
|
local cache=$(_get_cache)
|
|
|
|
msg2 "npm cache directory: $cache"
|
2020-12-08 01:58:34 +01:00
|
|
|
cd "${srcdir}/joplin-${pkgver}"
|
2020-01-07 17:23:47 +01:00
|
|
|
|
|
|
|
# Force Lang
|
|
|
|
# INFO: https://github.com/alfredopalhares/joplin-pkgbuild/issues/25
|
|
|
|
export LANG=en_US.utf8
|
|
|
|
|
2020-12-29 16:50:00 +01:00
|
|
|
msg2 "Installing dependencies through Lerna"
|
|
|
|
npm install --cache "$cache"
|
|
|
|
|
2020-12-08 17:40:12 +01:00
|
|
|
}
|
2018-04-18 18:26:44 +02:00
|
|
|
|
2020-12-29 16:50:00 +01:00
|
|
|
#FIXME: These checks fail on some machines, even with the exit 0
|
|
|
|
# Something related with the number of allowed processes I guess
|
2020-12-08 17:40:12 +01:00
|
|
|
check() {
|
|
|
|
cd "${srcdir}/joplin-${pkgver}"
|
2020-12-27 17:42:24 +01:00
|
|
|
msg2 "Not Running any tests for now"
|
|
|
|
#npm run test || exit 0
|
2020-12-20 19:00:38 +01:00
|
|
|
}
|
|
|
|
|
2020-12-27 17:42:24 +01:00
|
|
|
package_joplin() {
|
2020-12-08 01:58:34 +01:00
|
|
|
pkgdesc="A note taking and to-do application with synchronization capabilities - CLI App"
|
2020-12-29 16:50:00 +01:00
|
|
|
depends=('coreutils' 'libsecret' 'nodejs' 'python')
|
|
|
|
|
|
|
|
local cache=$(_get_cache)
|
|
|
|
msg2 "npm cache directory: $cache"
|
2019-10-29 15:45:05 +01:00
|
|
|
|
2020-12-29 16:50:00 +01:00
|
|
|
msg2 "Building CLI"
|
2020-12-08 01:58:34 +01:00
|
|
|
cd "${srcdir}/joplin-${pkgver}/packages/app-cli"
|
|
|
|
npm run build
|
2018-04-18 18:26:44 +02:00
|
|
|
|
2020-12-29 16:50:00 +01:00
|
|
|
msg2 "Packaging CLI"
|
|
|
|
cd "${srcdir}/joplin-${pkgver}/packages/app-cli/build"
|
|
|
|
local pack="$(npm pack | tail -n 1)"
|
2020-12-08 01:58:34 +01:00
|
|
|
|
2020-12-29 16:50:00 +01:00
|
|
|
msg2 "Installing CLI ($pack)"
|
|
|
|
npm install --global --production --user root --cache "$cache" \
|
|
|
|
--prefix "${pkgdir}/tmp" "$pack"
|
|
|
|
|
|
|
|
msg2 "Rearranging directory tree"
|
|
|
|
mkdir -p "${pkgdir}/usr/share/"
|
|
|
|
mv "${pkgdir}/tmp/lib/node_modules/joplin/" "${pkgdir}/usr/share/"
|
|
|
|
rm -r "${pkgdir}/tmp"
|
|
|
|
|
|
|
|
msg2 "Fixing Directories Permissions"
|
|
|
|
# Non-deterministic race in npm gives 777 permissions to random directories.
|
|
|
|
# See https://github.com/npm/cli/issues/1103 for details.
|
|
|
|
find "${pkgdir}/usr" -type d -exec chmod 755 {} +
|
|
|
|
|
2020-12-29 18:18:05 +01:00
|
|
|
msg2 "Removing References to \$pkgdir"
|
2020-12-29 16:50:00 +01:00
|
|
|
find "$pkgdir" -name package.json -print0 | xargs -0 sed -i "/_where/d"
|
|
|
|
|
2020-12-29 18:18:05 +01:00
|
|
|
msg2 "Removing References to \$srcdir"
|
2020-12-29 16:50:00 +01:00
|
|
|
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}/"
|
2018-04-18 18:26:44 +02:00
|
|
|
|
2020-12-08 01:58:34 +01:00
|
|
|
msg2 "Installing Startup Script"
|
|
|
|
cd "${srcdir}"
|
2020-12-29 16:50:00 +01:00
|
|
|
install -Dm755 joplin.sh "${pkgdir}/usr/bin/joplin"
|
2020-12-08 01:58:34 +01:00
|
|
|
}
|
|
|
|
|
2020-12-20 00:35:38 +01:00
|
|
|
|
2020-12-20 00:15:20 +01:00
|
|
|
package_joplin-desktop() {
|
2020-12-08 01:58:34 +01:00
|
|
|
pkgdesc="A note taking and to-do application with synchronization capabilities - Desktop"
|
2020-12-08 13:17:44 +01:00
|
|
|
depends=('electron' 'gtk3' 'libexif' 'libgsf' 'libjpeg-turbo' 'libwebp' 'libxss' 'nodejs'
|
2020-12-08 01:58:34 +01:00
|
|
|
'nss' 'orc')
|
|
|
|
optdepends=('libappindicator-gtk3: for tray icon')
|
2020-12-27 17:42:24 +01:00
|
|
|
conflicts=('joplin-desktop-electron')
|
2020-12-08 01:58:34 +01:00
|
|
|
|
2020-12-29 16:50:00 +01:00
|
|
|
# ./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"
|
|
|
|
|
2020-12-08 13:17:44 +01:00
|
|
|
msg2 "Building Desktop with packaged Electron..."
|
2020-12-08 01:58:34 +01:00
|
|
|
mkdir -p "${pkgdir}/usr/share/joplin-desktop"
|
|
|
|
cd "${srcdir}/joplin-${pkgver}/packages/app-desktop"
|
2020-12-08 13:17:44 +01:00
|
|
|
electron_dir="/usr/lib/electron"
|
|
|
|
electron_version=$(cat /usr/lib/electron/version)
|
2020-12-29 16:50:00 +01:00
|
|
|
msg2 "Using Electron Version ${electron_version}"
|
2020-12-08 17:40:12 +01:00
|
|
|
USE_HARD_LINKS=false npm run dist -- --publish=never --linux --x64 \
|
|
|
|
--dir="dist/" -c.electronDist=$electron_dir -c.electronVersion=$electron_version
|
2020-12-08 13:17:44 +01:00
|
|
|
|
2020-12-29 16:50:00 +01:00
|
|
|
# TODO: Cleanup app.asar file
|
2020-12-08 01:58:34 +01:00
|
|
|
cd dist/linux-unpacked/
|
|
|
|
cp -R "." "${pkgdir}/usr/share/joplin-desktop"
|
|
|
|
|
|
|
|
msg2 "Installing LICENSE..."
|
|
|
|
cd "${srcdir}/joplin-${pkgver}/"
|
|
|
|
install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
|
|
|
|
|
2020-12-20 00:15:20 +01:00
|
|
|
msg2 "Installing startup script and desktop file..."
|
2020-12-08 01:58:34 +01:00
|
|
|
cd "${srcdir}"
|
|
|
|
install -Dm755 ${srcdir}/joplin-desktop.sh "${pkgdir}/usr/bin/joplin-desktop"
|
|
|
|
install -Dm644 ${srcdir}/joplin.desktop -t "${pkgdir}/usr/share/applications"
|
2020-12-29 16:50:00 +01:00
|
|
|
|
|
|
|
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
|
2018-04-18 18:26:44 +02:00
|
|
|
}
|
2020-12-08 17:40:12 +01:00
|
|
|
|