Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Package]: Zotero 7 #22503

Open
8 tasks done
jace opened this issue Dec 10, 2024 · 4 comments
Open
8 tasks done

[Package]: Zotero 7 #22503

jace opened this issue Dec 10, 2024 · 4 comments
Labels
help wanted Help is wanted in order to solve the issue package request A new package was requested

Comments

@jace
Copy link

jace commented Dec 10, 2024

Why is it worth to add this package?

Zotero is a Firefox-based research sources manager. It does not have an official build for aarch64, but Alpine 3.21 has added a build, and I've confirmed it works well under Termux with proot. It'll be nice to have a native Termux package now that Alpine has shown us that it's possible.

Home page URL

https://www.zotero.org/

Source code URL

https://github.com/zotero/zotero

Packaging policy acknowledgement

  • The project is actively developed.

  • The project has existing packages and is "well known".

  • Licensed under an open source license.

  • Not available through a language package manager: pip, npm, cpan, cargo, etc.

  • Not taking up too much disk space (< 100MiB per architecture, exceptions can be made)

  • Not duplicating the functionality of existing packages.

  • Not serving hacking, malware, phishing, spamming, spying, ddos functionality.

  • I certify that I have read Termux Packaging Policy and understand that my request will be denied if it is found lacking.

Additional information

Nix flake and Alpine Linux package are discussed here: zotero/zotero#3515

@jace jace added the package request A new package was requested label Dec 10, 2024
@jace
Copy link
Author

jace commented Dec 10, 2024

Alpine's Zotero build script and patches here: https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/community/zotero

@TomJo2000
Copy link
Member

Zotero seems to heavily utilize a system called Fluent, which as far as I'm aware we do not have any other package that uses that.

Alpine's Zotero build script and patches here: https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/community/zotero

That's a hell of a lot of patches.
And I suspect we're not gonna get it packaged without a substantial amount of patches either.
This might unfortunately be one of the rare cases where a package request is completely valid and meets all criteria, but the challenge of packaging the project and the ongoing maintenance it will require make it infeasible.

I'll leave this PR open and add the help wanted tag to it,
but this looks like a very complex project to package.

@TomJo2000 TomJo2000 added the help wanted Help is wanted in order to solve the issue label Dec 10, 2024
@ayakael
Copy link

ayakael commented Jan 5, 2025

Hi! I am the maintainer who ported Zotero to Alpine. Most of the patches are to get Firefox built. Only the patches prefixed zotero_ apply to the actual Zotero codebase. Thus, if y'all already have a build script for Firefox, it is a matter of having a build script that builds the Firefox version Zotero expects, and build Zotero with it. The part of the APKBUILD that relates specifically to zotero is:

Prepare:

	# zotero prepare
	mv "$_zoterodir" "$builddir"/zotero
	(
		cd "$builddir"/zotero

		# checks that we're using expected fx version
		local _exp_fxver=$(grep GECKO_VERSION_LINUX "$builddir"/zotero/app/config.sh | sed 's|.*=||' | tr -d '"' | sed 's|esr||')
		if [ "$_fxver" != "$_exp_fxver" ]; then
			msg "Expected firefox version $_exp_fxver, got $_fxver"
		fi

		# zotero build expects to be in a git repo
		git init
		git config user.name info
		git config user.email [email protected]
		git commit --allow-empty -m 'Initial'

		npm i --legacy-peer-deps
	)

Build:

# install to where zotero expects it
	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
	(
		cd "$builddir"/zotero
		NODE_OPTIONS=--openssl-legacy-provider npm run build

		SKIP_32=1 app/scripts/dir_build -p l
		# move to seperate folder as check will rebuild with test files added
		mv "$builddir"/zotero/app/staging  "$builddir"/zotero/app/package
	)

	rm -R "$builddir"/zotero/app/xulrunner/firefox # clean-up unused firefox install

Package

package() {
	install -dDm755 "$pkgdir"/usr/bin
	install -dDm755 "$pkgdir"/usr/lib/zotero
	cp -r "$builddir"/zotero/app/package/Zotero_linux/* "$pkgdir/usr/lib/zotero"
	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
	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"

	# Close shell when launching
	sed -i -r 's:^("\$CALLDIR/zotero-bin" -app "\$CALLDIR/application.ini" "\$@"):exec \1:' "$pkgdir/usr/lib/zotero/zotero"
}

Hope this information can be of use for anyone who wants to port this to Termux.

@b9Joker108
Copy link

I would definitely use this in Termux, as I am pre-pre-processing a corpora for RAG in ObsidianMD in a Debian proot chroot and Zotero housing meta-data, along with PostgreSQL, is part of the pre-pre-processing project, cleaning and wrangling the metadata and file names into order. My skills are not yet up to patching, packaging and maintaining this myself, but I am formally putting my paws up to say I would be happy to assist in any way in order to help and learn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Help is wanted in order to solve the issue package request A new package was requested
Projects
None yet
Development

No branches or pull requests

4 participants