ayaports/user/zotero/APKBUILD

381 lines
14 KiB
Text
Raw Normal View History

# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
2023-04-23 21:16:07 +00:00
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=zotero
2024-03-07 00:24:18 +00:00
pkgver=7.0.0_beta65
2024-02-03 19:54:15 +00:00
pkgrel=0
_fxver=102.15.1
2024-02-20 17:18:24 +00:00
_gittag=$pkgver
# Date of release, YY-MM-DD for metainfo file (see package())
2024-02-03 19:54:15 +00:00
_releasedate=2024-02-03
2023-04-23 21:16:07 +00:00
pkgdesc="A free, easy-to-use tool to help you collect, organize, cite, and share your research sources."
2024-03-05 05:45:28 +00:00
arch="x86_64 aarch64"
2023-04-23 21:16:07 +00:00
url="https://github.com/zotero/zotero"
license="GPL-3.0-only AND LGPL-2.1-only AND LGPL-3.0-only AND MPL-2.0"
options="!check" # No test suite
2023-04-23 21:16:07 +00:00
depends="
ffmpeg-libavcodec
2023-04-23 21:16:07 +00:00
"
makedepends="
alsa-lib-dev
automake
bash
bsd-compat-headers
cargo
cbindgen
clang
clang-libclang
curl
dbus-glib-dev
gettext
2023-04-23 21:16:07 +00:00
grep
gtk+3.0-dev
hunspell-dev
icu-dev>=69.1
libevent-dev
libffi-dev
libjpeg-turbo-dev
libnotify-dev
libogg-dev
libtheora-dev
libtool
libvorbis-dev
libvpx-dev
libwebp-dev
libxcomposite-dev
libxt-dev
lld
llvm-dev
m4
mesa-dev
nasm
nodejs
npm
nspr-dev
nss-dev
2023-04-23 21:16:07 +00:00
perl
pipewire-dev
pulseaudio-dev
py3-psutil
py3-zstandard
2023-04-23 21:16:07 +00:00
python3
sed
unzip
wasi-sdk
wireless-tools-dev
zip
2023-04-23 21:16:07 +00:00
"
source="
https://ftp.mozilla.org/pub/firefox/releases/${_fxver}esr/source/firefox-${_fxver}esr.source.tar.xz
allow-custom-rust-vendor.patch
audio-lfs64.patch
avoid-redefinition.patch
disable-moz-stackwalk.patch
esr-metainfo.patch
firefox-102.12.0-ffmpeg_6-1.patch
ffmpeg6-fixup.patch
fix-neon-aom.patch
fix-fortify-system-wrappers.patch
fix-rust-target.patch
fix-webrtc-glibcisms.patch
gcc13.patch
mallinfo.patch
python-deps.patch
rust-lto-thin.patch
sandbox-fork.patch
sandbox-largefile.patch
sandbox-sched_setscheduler.patch
zstandard.patch
icu74.patch
lfs64.patch
hunspell-dont-build-unused-function.patch
utils-libc-lfs64.patch
2024-02-20 17:18:24 +00:00
update-from-packed-simd-2-to-simd1.patch
stab.h
firefox.desktop
mozilla-location.keys
vendor-prefs.js
2023-04-23 21:16:07 +00:00
zotero.desktop
https://lab.ilot.io/mirrors/zotero-client/-/releases/$_gittag/downloads/tarball/zotero-client-$_gittag.tar.gz
2024-03-05 05:45:28 +00:00
zotero_build-modifications.patch
zotero_drop-phantomjs.patch
2023-04-23 21:16:07 +00:00
"
builddir="$srcdir"/firefox-$_fxver
_zoterodir="$srcdir"/zotero-client-$_gittag
2024-02-03 19:54:15 +00:00
_mozappdir=/usr/lib/zotero
# help our shared-object scanner to find the libs
ldpath="$_mozappdir"
sonameprefix="$pkgname:"
# we need this because cargo verifies checksums of all files in vendor
# crates when it builds and gives us no way to override or update the
# file sanely... so just clear out the file list
_clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' third_party/rust/$1/.cargo-checksum.json
}
export SHELL=/bin/sh
export BUILD_OFFICIAL=1
export MOZILLA_OFFICIAL=1
export USE_SHORT_LIBNAME=1
export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system
export MOZ_APP_PROFILE="mozilla/firefox"
export MOZ_APP_REMOTINGNAME=firefox-esr
export MOZBUILD_STATE_PATH="$srcdir"/mozbuild
# disable desktop notifications
export MOZ_NOSPAM=1
# Find our triplet JSON
export RUST_TARGET="$CTARGET"
# Build with Clang, takes less RAM
export CC="clang"
export CXX="clang++"
# let firefox do this itself.
unset CARGO_PROFILE_RELEASE_OPT_LEVEL
unset CARGO_PROFILE_RELEASE_LTO
export CFLAGS="${CFLAGS/-fstack-clash-protection/} -g0 -O2"
export CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/} -g0 -O2 -Wno-deprecated-builtins -Wno-deprecated-declarations"
export LDFLAGS="$LDFLAGS -Wl,--undefined-version"
2023-04-23 21:16:07 +00:00
prepare() {
2024-03-05 05:45:28 +00:00
mv "$_zoterodir" "$builddir"/zotero
2023-04-23 21:16:07 +00:00
default_prepare
cp "$srcdir"/stab.h toolkit/crashreporter/google-breakpad/src/
base64 -d "$srcdir"/mozilla-location.keys > "$builddir"/mozilla-api-key
_clear_vendor_checksums audio_thread_priority
_clear_vendor_checksums target-lexicon-0.9.0
_clear_vendor_checksums bindgen
_clear_vendor_checksums mp4parse
_clear_vendor_checksums getrandom
2024-02-20 17:18:24 +00:00
_clear_vendor_checksums packed_simd
_clear_vendor_checksums encoding_rs
# webrtc does not build on these
case "$CARCH" in
ppc64le)
local webrtc_config="ac_add_options --disable-webrtc"
;;
esac
case "$CARCH" in
armv7)
# broken here
local rust_simd="ac_add_options --disable-rust-simd"
;;
*)
local rust_simd="ac_add_options --enable-rust-simd"
;;
esac
2023-04-23 21:16:07 +00:00
case "$CARCH" in
aarch64|arm*|x86*)
# disable-elf-hack: exists only on aarch64, arm*, x86, x86_64
local arch_config="ac_add_options --disable-elf-hack"
;;
esac
# sandbox only supported here
case "$CARCH" in
x86*|armv7|aarch64)
local sandbox="ac_add_options --enable-sandbox"
;;
*)
local sandbox="ac_add_options --disable-sandbox"
;;
esac
cat > base-mozconfig <<-EOF
# disable unwanted things
ac_add_options --disable-bootstrap
ac_add_options --disable-cargo-incremental
ac_add_options --disable-crashreporter
ac_add_options --disable-debug
ac_add_options --disable-debug-symbols
ac_add_options --disable-install-strip
ac_add_options --disable-jemalloc
ac_add_options --disable-strip
ac_add_options --disable-tests
ac_add_options --disable-updater
# features
ac_add_options --enable-alsa
ac_add_options --enable-dbus
ac_add_options --enable-default-toolkit=cairo-gtk3-wayland
ac_add_options --enable-ffmpeg
ac_add_options --enable-hardening
ac_add_options --enable-linker=lld
ac_add_options --enable-necko-wifi
ac_add_options --enable-official-branding
ac_add_options --enable-optimize="$CFLAGS"
ac_add_options --enable-pulseaudio
ac_add_options --enable-release
ac_add_options --enable-update-channel=release
# system libs
ac_add_options --enable-system-pixman
ac_add_options --with-system-ffi
ac_add_options --with-system-icu
ac_add_options --with-system-jpeg
ac_add_options --with-system-libevent
ac_add_options --with-system-libvpx
ac_add_options --with-system-nspr
ac_add_options --with-system-nss
ac_add_options --with-system-png
ac_add_options --with-system-webp
ac_add_options --with-system-zlib
# misc
ac_add_options --allow-addon-sideload
ac_add_options --prefix=/usr
ac_add_options --with-app-name=firefox-esr
ac_add_options --with-distribution-id=org.alpinelinux
ac_add_options --with-libclang-path=/usr/lib
ac_add_options --with-unsigned-addon-scopes=app,system
ac_add_options --with-wasi-sysroot=/usr/share/wasi-sysroot
ac_add_options --host=$CHOST
ac_add_options --target=$CTARGET
# objdir
mk_add_options MOZ_OBJDIR="$builddir/obj"
mk_add_options RUSTFLAGS="$RUSTFLAGS"
# keys
# these are for alpine linux use only
ac_add_options --with-mozilla-api-keyfile="$builddir/mozilla-api-key"
$arch_config
$rust_simd
$sandbox
$webrtc_config
EOF
# zotero prepare
(
2024-03-05 05:45:28 +00:00
cd "$builddir"/zotero
# zotero build expects to be in a git repo
git init
git commit --allow-empty -m 'Initial'
)
2023-04-23 21:16:07 +00:00
}
build() {
cat > .mozconfig base-mozconfig
export MOZ_BUILD_DATE=$(date ${SOURCE_DATE_EPOCH:+ -d@${SOURCE_DATE_EPOCH}} "+%Y%m%d%H%M%S")
2023-04-23 21:16:07 +00:00
# for lto
ulimit -n 4096
# can't be set here and fail
unset RUSTFLAGS
local thinlto_jobs=${JOBS:-1}
case "$CARCH" in
# on this platforms, lld seems to not utilise >1 threads for thinlto for some reason.
# at the same time, having more than 8 also crashes lld for firefox buildsystems (why?).
aarch64)
if [ $thinlto_jobs -gt 8 ]; then
thinlto_jobs=8
fi
;;
esac
case "$CARCH" in
x86)
# the i586 baseline cannot compile firefox
export CFLAGS="$CFLAGS -march=pentium4"
export CXXFLAGS="$CXXFLAGS -march=pentium4"
;;
esac
export LDFLAGS="$LDFLAGS -Wl,--thinlto-jobs=$thinlto_jobs"
case "$CARCH" in
# lto for 64-bit systems only
aarch64|x86_64|ppc64le)
cat > .mozconfig base-mozconfig <<-EOF
ac_add_options --enable-lto=cross
EOF
esac
2024-02-03 19:54:15 +00:00
# set rpath so linker finds the libs
export LDFLAGS="$LDFLAGS -Wl,-rpath,$_mozappdir"
./mach build
# install to where zotero expects it
2024-03-05 05:45:28 +00:00
DESTDIR="$builddir"/zotero/app/xulrunner/firefox ./mach install
mv "$builddir"/zotero/app/xulrunner/firefox/usr/lib/firefox-esr/* "$builddir"/zotero/app/xulrunner/firefox/.
rm -R "$builddir"/zotero/app/xulrunner/firefox/usr
# zotero build
(
2024-03-05 05:45:28 +00:00
cd "$builddir"/zotero
npm i --legacy-peer-deps
NODE_OPTIONS=--openssl-legacy-provider npm run build
SKIP_32=1 app/scripts/dir_build -p l
)
2023-04-23 21:16:07 +00:00
}
package() {
install -dDm755 "$pkgdir"/usr/bin
install -dDm755 "$pkgdir"/usr/lib/zotero
2024-03-05 05:45:28 +00:00
cp -r "$builddir"/zotero/app/staging/Zotero_linux/* "$pkgdir/usr/lib/zotero"
2023-04-23 21:16:07 +00:00
ln -s /usr/lib/zotero/zotero "$pkgdir/usr/bin/zotero"
install -Dm644 "$srcdir/zotero.desktop" "$pkgdir/usr/share/applications/zotero.desktop"
# Copy zotero icons to a standard location
2024-02-03 19:54:15 +00:00
install -Dm644 "$pkgdir/usr/lib/zotero/icons/icon32.png" "$pkgdir/usr/share/icons/hicolor/32x32/apps/zotero.png"
install -Dm644 "$pkgdir/usr/lib/zotero/icons/icon64.png" "$pkgdir/usr/share/icons/hicolor/64x64/apps/zotero.png"
install -Dm644 "$pkgdir/usr/lib/zotero/icons/icon128.png" "$pkgdir/usr/share/icons/hicolor/128x128/apps/zotero.png"
2023-04-23 21:16:07 +00:00
# Close shell when launching
sed -i -r 's:^("\$CALLDIR/zotero-bin" -app "\$CALLDIR/application.ini" "\$@"):exec \1:' "$pkgdir/usr/lib/zotero/zotero"
}
2023-04-23 21:16:07 +00:00
sha512sums="
bdb66b4fb5622af3e60580a3bcd464d98ef13cb38d6ac6c9e5fc046e567a003cf080125d7748950c91c442fde5e8024c50c4180d2f551aa3528160a3c05ae187 firefox-102.15.1esr.source.tar.xz
4e584621145cf8add069c6dac18e805b3274a1ee402d84e924df2341f7d3c5be261a93ef51283bacbd606f47fbdc628c4323ecc31efc5b403b8d224b18dc278f allow-custom-rust-vendor.patch
3e0501ae7a650346c667dfdc0ae0ca286084f22e89ab2ac671cc0d7315673dc5b6dcb9f9882f6f39d26e9a31e57f7a0fd53d6b805e520224e22b8976850e2eb8 audio-lfs64.patch
b1cb2db3122634f66d2bae7066e76f2dcd455c464e021db4de3b0a08314df95cb667846081682db549dd2af8a00831cabe44a2420c66cdfb5e3b5fa7e6bd21d3 avoid-redefinition.patch
454ea3263cabce099accbdc47aaf83be26a19f8b5a4568c01a7ef0384601cf8315efd86cd917f9c8bf419c2c845db89a905f3ff9a8eb0c8e41042e93aa96a85c disable-moz-stackwalk.patch
f7b3b45ba04d05d17439d009bf0c9f27881e126f424e2257552338a0c1e3771ee1289c044babcb0920f62af62873a268c0cf524e1d35711e6dc8b808ca5e9f26 esr-metainfo.patch
a13dee87adf659423f5b3fa0358cfbde135fa614c85dd170d1a48d32ee080e27aef062d3a8e3c45059c41463fda579f8900988166ccb51568793ee7ef9080d04 firefox-102.12.0-ffmpeg_6-1.patch
c2e17f269070d782154f843b95bf68be25d8c4356825dd436b1877aab63ac023051899371da5c21f6151970b2562376c2dadd2d6a038446e5fa621e2495668e1 ffmpeg6-fixup.patch
d3a54897089eda9fdfe4b25ade1cb2c01c4b31fa9bf0e0ddbb0bbe674072ec5d36a6e52f791a8cbc8d3908e912ac2d7edec69b34d87ecca0acca876d45974c8d fix-neon-aom.patch
2f4f15974d52de4bb273b62a332d13620945d284bbc6fe6bd0a1f58ff7388443bc1d3bf9c82cc31a8527aad92b0cd3a1bc41d0af5e1800e0dcbd7033e58ffd71 fix-fortify-system-wrappers.patch
cd68b89e29e5f6379fbd5679db27b9a5ef70ea65e51c0d0a8137e1f1fd210e35a8cfb047798e9549bc7275606d7ec5c8d8af1335d29da4699db7acd8bc7ff556 fix-rust-target.patch
305c874fdea3096e9c4c6aa6520ac64bb1c347c4b59db8360096646593fe684c3b5377874d91cecd33d56d1410b4714fbdea2b514923723ecbeff79d51265d9b fix-webrtc-glibcisms.patch
49aa1dfbe11ed5370e839afb190da7f55ae4887b35645865efe25d398d890563722caedd5696d648ad71448621fbc8bab8def1a3d079e301d6414f0f20e96758 gcc13.patch
a4a3e062661bda64d502d426c480ac9645345860118de9df9ffe6e0597738c70c11e5cdef2d4fd12c5e2ee30a09310159230524655a419a4f7e4eeeb0f3c06b0 mallinfo.patch
f3d419880cc7f043b6eb547894d486457d407640be2bd8b402eb3a534ccea39568f6d506fc44a3b29c94eb0dc6fc2bec6600d161786fd233d26b1dc8970f5ab4 python-deps.patch
9f433c8051d05efb8b119e0b67b97951837aca6a8c5671646714a24023be11a9d63fa7c4e56a6c7f3911c9d8406b06cd95926de1a82925d02197dfd55daf5642 rust-lto-thin.patch
2518f2fc75b5db30058e0735f47d60fdf1e7adfaeee4b33fb2afb1bd9a616ce943fd88f4404d0802d4083703f4acf1d5ad42377218d025bc768807fbaf7e1609 sandbox-fork.patch
b7d0a6126bdf6c0569f80aabf5b37ed2c7a35712eb8a0404a2d85381552f5555d4f97d213ea26cec6a45dc2785f22439376ed5f8e78b4fd664ef0223307b333e sandbox-largefile.patch
94433c5ffdbe579c456d95c5f053f61fcbab2f652fa90bc69dcc27d9a1507a8e5c677adeadae9a7a75cc9a55184c1040737f4dfd10b279c088ef016561e6f135 sandbox-sched_setscheduler.patch
12fbe50d94624931a581314b8e6e228a1f8a4550704a6ee4f8904184ac4727efd90982e87a8fdd318e15515f9430dfc6cf7455b301e903003027b3f0afa79795 zstandard.patch
afabea91b328c5a68eaa20f9099ac7b2d0e7f2423e816b05ed168bdd326a5684fa02de08bf05c6033e9b888f02775d1b0443a00329b7a632ee399122a391c13a icu74.patch
5fa9382c692e4bd6a2634308f24a6526fd12a60a2563d2090056d43a60505df3ec9881bbf54562e69394467529b3b0dc45955afca46ed329af03cea074fff070 lfs64.patch
6aa925477109ed3be8f061fe1ea91caf95c7a7f5cca05c3e31322d08c3c2c044fb12bb1dbea09cd224b22e40e987571e415c6457aa5cab6a0b67f248f11b3df2 hunspell-dont-build-unused-function.patch
2625dcf433abbfa4c6835830b04c7b8cab72fba3a987515a6ba8e4f181332e804d98ccfbcc07e62c673be50db04c80d0f51c415173bb18cf4d18dc1364e165d0 utils-libc-lfs64.patch
2024-02-20 17:18:24 +00:00
9de4804848ada9b9af45426699c98370e3fadf99bcb1c3c0b31c97661c9d107449048186abf454c1903bb042c5507243de9707253c1ea8e0b9fc69841c2b5a57 update-from-packed-simd-2-to-simd1.patch
0b3f1e4b9fdc868e4738b5c81fd6c6128ce8885b260affcb9a65ff9d164d7232626ce1291aaea70132b3e3124f5e13fef4d39326b8e7173e362a823722a85127 stab.h
d354f48a29bfc16719f3b230b1395063239d4420f9e47522de4662392d9697b15f931ca3bf6055d100fa33d61a9a1a13477687d5eac99e50ae7dbef9882a5808 firefox.desktop
382510375b1a2fa79be0ab79e3391a021ae2c022429ffbaa7e7a69166f99bb56d01e59a1b10688592a29238f21c9d6977672bd77f9fae439b66bdfe0c55ddb15 mozilla-location.keys
fc45bc3ffb9404e5338ea26a9f04807b40f6f516324972cddd48bedb91b8bd7c6b8d4e03a0209020f5e67b703bc4ff89389985791b9bd544a0fc3951e2dc338e vendor-prefs.js
2023-04-23 21:16:07 +00:00
e1a0a4ff5cc1b53f13776ca11927d671426b0691e78e74a4adf2166d57bb2ae8ac409cc11a37ce5e2f680fdf05d5bc3849c33a9717aca1bb62d03ae5231a67fb zotero.desktop
2024-03-07 00:24:18 +00:00
da5c886def40e5252371563556196cf489a38568f55b009fbce65893436a36f81c2a56b69ecb4cc8cceef588c64a2b886ef4be7824b39a5c75910b230f3b4f19 zotero-client-7.0.0_beta65.tar.gz
2024-03-05 05:45:28 +00:00
f196d9d82e50a5123342634b4d49a0776ca3668fcccd8b48bb28fac94107e11a039204f13030b405309cfafe53615a7a9f5c278d2b278140cbc0fb1cecf4cebc zotero_build-modifications.patch
cfe583f2da7508a4e07734a42519d7c28265928fe14c14b2f650ca6e56c35cb79272b03ed3bfb81e06c4e01458b55e04d10df5cbdd549da0d97206b2c10c3530 zotero_drop-phantomjs.patch
2023-04-23 21:16:07 +00:00
"