104 lines
3.3 KiB
Bash
104 lines
3.3 KiB
Bash
# Maintainer: Shun Li <riverscn@gmail.com>
|
|
# Extracted from omacom/omarchy-pkgs PR #240, revision dcef132b2df11bb762e233ea8c6af3110f079b67.
|
|
|
|
pkgname=obsidian
|
|
pkgver=1.14.4
|
|
pkgrel=1
|
|
pkgdesc='Knowledge base on top of a local folder of plain-text Markdown files'
|
|
arch=('aarch64')
|
|
url='https://obsidian.md/'
|
|
license=('custom')
|
|
depends=(
|
|
'alsa-lib'
|
|
'at-spi2-core'
|
|
'cairo'
|
|
'dbus'
|
|
'expat'
|
|
'fontconfig'
|
|
'gcc-libs'
|
|
'glib2'
|
|
'glibc'
|
|
'gtk3'
|
|
'hicolor-icon-theme'
|
|
'libcups'
|
|
'libnotify'
|
|
'libsecret'
|
|
'libx11'
|
|
'libxcb'
|
|
'libxcomposite'
|
|
'libxdamage'
|
|
'libxext'
|
|
'libxfixes'
|
|
'libxkbcommon'
|
|
'libxrandr'
|
|
'mesa'
|
|
'nspr'
|
|
'nss'
|
|
'pango'
|
|
'systemd-libs'
|
|
'xdg-utils'
|
|
)
|
|
provides=('obsidian')
|
|
conflicts=('obsidian-appimage' 'obsidian-bin')
|
|
options=('!debug' '!strip')
|
|
checkdepends=('python')
|
|
source=('obsidian.desktop' 'upstream.py' 'test-upstream.py')
|
|
source_aarch64=(
|
|
"obsidian-${pkgver}-arm64.tar.gz::https://github.com/obsidianmd/obsidian-releases/releases/download/v${pkgver}/obsidian-${pkgver}-arm64.tar.gz"
|
|
)
|
|
sha256sums=('42ecb332c900a01b2a6db0a70b4cc8c0553e863aee72894b23ed20a6289b131c'
|
|
'd2933bdc97d9ba55986d710114512e0eb105e1cc549cef4aa7416cb333e0a9b8'
|
|
'7213e4e691c53e184b0f037478ac6758fe44adad7a984fc1daef7fd17c31d5d8')
|
|
sha256sums_aarch64=('fc212804515713ed85fe5ef5bc4b009872bcc01847c4be4fcc14971deee2a42d')
|
|
|
|
check() {
|
|
python test-upstream.py
|
|
}
|
|
|
|
package() {
|
|
local source_dir="$srcdir/obsidian-${pkgver}-arm64"
|
|
local install_dir="$pkgdir/opt/obsidian"
|
|
|
|
install -d "$install_dir"
|
|
cp -a --no-preserve=ownership "$source_dir/." "$install_dir/"
|
|
|
|
# The official ARM64 archive currently carries two x86_64-only addons.
|
|
# Remove only an unusable x86_64 payload; retain it automatically if the
|
|
# vendor starts shipping an AArch64 build in a later release.
|
|
local addon machine
|
|
for addon in \
|
|
resources/app.asar.unpacked/node_modules/btime/binding.node \
|
|
resources/app.asar.unpacked/node_modules/get-fonts/binding.node; do
|
|
[[ -f "$install_dir/$addon" ]] || continue
|
|
machine=$(readelf -h "$install_dir/$addon" |
|
|
sed -n 's/^[[:space:]]*Machine:[[:space:]]*//p')
|
|
case "$machine" in
|
|
AArch64) ;;
|
|
'Advanced Micro Devices X86-64') rm -f "$install_dir/$addon" ;;
|
|
*) error "Unexpected Obsidian addon architecture: $addon ($machine)"; return 1 ;;
|
|
esac
|
|
done
|
|
|
|
find "$install_dir" -type d -exec chmod 755 {} +
|
|
find "$install_dir" -type f -exec chmod 644 {} +
|
|
chmod 755 \
|
|
"$install_dir/chrome_crashpad_handler" \
|
|
"$install_dir/obsidian" \
|
|
"$install_dir/obsidian-cli"
|
|
# Chromium sandboxes through unprivileged user namespaces, which Arch-family
|
|
# kernels allow; a setuid-root helper is not needed.
|
|
chmod 755 "$install_dir/chrome-sandbox"
|
|
|
|
install -d "$pkgdir/usr/bin"
|
|
ln -s /opt/obsidian/obsidian "$pkgdir/usr/bin/obsidian"
|
|
ln -s /opt/obsidian/obsidian-cli "$pkgdir/usr/bin/obsidian-cli"
|
|
install -Dm644 "$srcdir/obsidian.desktop" \
|
|
"$pkgdir/usr/share/applications/obsidian.desktop"
|
|
install -Dm644 "$install_dir/resources/icon.png" \
|
|
"$pkgdir/usr/share/icons/hicolor/512x512/apps/obsidian.png"
|
|
install -Dm644 "$install_dir/LICENSE.electron.txt" \
|
|
"$pkgdir/usr/share/licenses/$pkgname/LICENSE.electron.txt"
|
|
install -Dm644 "$install_dir/LICENSES.chromium.html" \
|
|
"$pkgdir/usr/share/licenses/$pkgname/LICENSES.chromium.html"
|
|
}
|