zotero: 7.0.30 -> 8.0.2, build from source (#483099)
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
diff --git a/app/scripts/dir_build b/app/scripts/dir_build
|
||||
index 493288ad47..ccabb3722b 100755
|
||||
--- a/app/scripts/dir_build
|
||||
+++ b/app/scripts/dir_build
|
||||
@@ -86,7 +86,7 @@ fi
|
||||
|
||||
CHANNEL="source"
|
||||
|
||||
-hash=$(git -C "$ROOT_DIR" rev-parse --short HEAD)
|
||||
+hash="0000000000000000000000000000000000000000"
|
||||
|
||||
build_dir=$(mktemp -d)
|
||||
cleanup() { rm -rf "$build_dir"; }
|
||||
diff --git a/js-build/note-editor.js b/js-build/note-editor.js
|
||||
index 1435730342..6eebb10c50 100644
|
||||
--- a/js-build/note-editor.js
|
||||
+++ b/js-build/note-editor.js
|
||||
@@ -12,8 +12,7 @@ async function getZoteroNoteEditor(signatures) {
|
||||
|
||||
const modulePath = path.join(__dirname, '..', 'note-editor');
|
||||
|
||||
- const { stdout } = await exec('git rev-parse HEAD', { cwd: modulePath });
|
||||
- const hash = stdout.trim();
|
||||
+ const hash = '';
|
||||
|
||||
if (!('note-editor' in signatures) || signatures['note-editor'].hash !== hash) {
|
||||
const targetDir = path.join(__dirname, '..', 'build', 'resource', 'note-editor');
|
||||
diff --git a/js-build/pdf-worker.js b/js-build/pdf-worker.js
|
||||
index b820304f3a..6bbd0708c9 100644
|
||||
--- a/js-build/pdf-worker.js
|
||||
+++ b/js-build/pdf-worker.js
|
||||
@@ -12,8 +12,7 @@ async function getPDFWorker(signatures) {
|
||||
|
||||
const modulePath = path.join(__dirname, '..', 'pdf-worker');
|
||||
|
||||
- const { stdout } = await exec('git rev-parse HEAD', { cwd: modulePath });
|
||||
- const hash = stdout.trim();
|
||||
+ const hash = '';
|
||||
|
||||
if (!('pdf-worker' in signatures) || signatures['pdf-worker'].hash !== hash) {
|
||||
const targetDir = path.join(__dirname, '..', 'build', 'chrome', 'content', 'zotero', 'xpcom', 'pdfWorker');
|
||||
diff --git a/js-build/reader.js b/js-build/reader.js
|
||||
index 67a02a3ad2..2127f680df 100644
|
||||
--- a/js-build/reader.js
|
||||
+++ b/js-build/reader.js
|
||||
@@ -12,8 +12,7 @@ async function getReader(signatures) {
|
||||
|
||||
const modulePath = path.join(__dirname, '..', 'reader');
|
||||
|
||||
- const { stdout } = await exec('git rev-parse HEAD', { cwd: modulePath });
|
||||
- const hash = stdout.trim();
|
||||
+ const hash = '';
|
||||
|
||||
if (!('reader' in signatures) || signatures['reader'].hash !== hash) {
|
||||
const targetDir = path.join(__dirname, '..', 'build', 'resource', 'reader');
|
||||
@@ -0,0 +1,135 @@
|
||||
diff --git a/app/scripts/fetch_xulrunner b/app/scripts/fetch_xulrunner
|
||||
index 30c3a9073d..aa953744f8 100755
|
||||
--- a/app/scripts/fetch_xulrunner
|
||||
+++ b/app/scripts/fetch_xulrunner
|
||||
@@ -148,15 +148,6 @@ function modify_omni {
|
||||
# Continue using app.update.auto in prefs.js on Windows
|
||||
replace_line 'PER_INSTALLATION_PREFS_PLATFORMS = \["win"\]' 'PER_INSTALLATION_PREFS_PLATFORMS = []' modules/UpdateUtils.sys.mjs
|
||||
|
||||
- # Prompt if major update is available instead of installing automatically on restart
|
||||
- replace_line 'if \(!updateAuto\) \{' 'if (update.type == "major") {
|
||||
- LOG("UpdateService:_selectAndInstallUpdate - prompting because it is a major update");
|
||||
- AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_SHOWPROMPT_PREF);
|
||||
- Services.obs.notifyObservers(update, "update-available", "show-prompt");
|
||||
- return;
|
||||
- }
|
||||
- if (!updateAuto) {' modules/UpdateService.sys.mjs
|
||||
-
|
||||
# Avoid console warning about resource://gre/modules/FxAccountsCommon.js
|
||||
replace_line 'const logins = this._data.logins;' 'const logins = this._data.logins; if (this._data.logins.length != -1) return;' modules/LoginStore.sys.mjs
|
||||
|
||||
@@ -506,70 +497,9 @@ cd xulrunner
|
||||
|
||||
if [ $BUILD_MAC == 1 ]; then
|
||||
GECKO_VERSION="$GECKO_VERSION_MAC"
|
||||
- DOWNLOAD_URL="https://ftp.mozilla.org/pub/firefox/releases/$GECKO_VERSION"
|
||||
- rm -rf Firefox.app
|
||||
-
|
||||
- if [ -e "Firefox $GECKO_VERSION.app.zip" ]; then
|
||||
- echo "Using Firefox $GECKO_VERSION.app.zip"
|
||||
- unzip "Firefox $GECKO_VERSION.app.zip"
|
||||
- else
|
||||
- curl -o Firefox.dmg "$DOWNLOAD_URL/mac/en-US/Firefox%20$GECKO_VERSION.dmg"
|
||||
- set +e
|
||||
- hdiutil detach -quiet /Volumes/Firefox 2>/dev/null
|
||||
- set -e
|
||||
- hdiutil attach -quiet Firefox.dmg
|
||||
- cp -a /Volumes/Firefox/Firefox.app .
|
||||
- # Store local copy of unmodified app
|
||||
- zip -r "Firefox $GECKO_VERSION.app.zip" Firefox.app
|
||||
- hdiutil detach -quiet /Volumes/Firefox
|
||||
- fi
|
||||
-
|
||||
- # Download custom components (e.g., XUL), as an xz-compressed tarball of the MacOS folder with
|
||||
- # custom files in it
|
||||
- echo
|
||||
- rm -rf MacOS
|
||||
- if [ -n "$custom_components_hash_mac" ]; then
|
||||
- if [ -e "Firefox $GECKO_VERSION MacOS.zip" ]; then
|
||||
- echo "Using Firefox $GECKO_VERSION MacOS.zip"
|
||||
- unzip "Firefox $GECKO_VERSION MacOS.zip"
|
||||
- else
|
||||
- echo "Downloading custom Firefox components"
|
||||
- echo
|
||||
- curl -o MacOS.tar.xz "${custom_components_url}mac/$custom_components_hash_mac.tar.xz"
|
||||
-
|
||||
- # Verify hash
|
||||
- if [[ "`uname`" = "Darwin" ]]; then
|
||||
- shasum="shasum -a 256"
|
||||
- else
|
||||
- shasum=sha256sum
|
||||
- fi
|
||||
- echo
|
||||
- echo "$custom_components_hash_mac MacOS.tar.xz" | $shasum -c -
|
||||
- echo
|
||||
-
|
||||
- tar xvf MacOS.tar.xz
|
||||
- fi
|
||||
- echo
|
||||
- fi
|
||||
-
|
||||
pushd Firefox.app/Contents/Resources
|
||||
modify_omni mac
|
||||
popd
|
||||
-
|
||||
- # Replace "FirefoxCP" with "ZoteroCP" for subprocesses ("Isolated Web Content", "Socket Process", "Web Content", etc.)
|
||||
- info_plist=Firefox.app/Contents/MacOS/plugin-container.app/Contents/Resources/English.lproj/InfoPlist.strings
|
||||
- from=$(get_utf16_chars "FirefoxCP")
|
||||
- to=$(get_utf16_chars "ZoteroCP")
|
||||
- perl -pi -e "s/$from/$to/" $info_plist
|
||||
- # Check for UTF-16 "ZoteroCP"
|
||||
- if ! grep -a -q "Z.o.t.e.r.o.C.P." $info_plist; then
|
||||
- echo '"ZoteroCP" not found in InfoPlist.strings after replacement'
|
||||
- exit 1
|
||||
- fi
|
||||
-
|
||||
- rm -f Firefox.dmg
|
||||
-
|
||||
- echo $("$SCRIPT_DIR/xulrunner_hash" -p m) > hash-mac
|
||||
fi
|
||||
|
||||
if [ $BUILD_WIN == 1 ]; then
|
||||
@@ -709,9 +639,6 @@ if [ $BUILD_WIN == 1 ]; then
|
||||
fi
|
||||
|
||||
if [ $BUILD_LINUX == 1 ]; then
|
||||
- GECKO_VERSION="$GECKO_VERSION_LINUX"
|
||||
- DOWNLOAD_URL="https://ftp.mozilla.org/pub/firefox/releases/$GECKO_VERSION"
|
||||
-
|
||||
if [[ -n $arch ]]; then
|
||||
arch_list=("$arch")
|
||||
else
|
||||
@@ -719,33 +646,11 @@ if [ $BUILD_LINUX == 1 ]; then
|
||||
fi
|
||||
for arch in "${arch_list[@]}"; do
|
||||
xdir="firefox-linux-$arch"
|
||||
- rm -rf $xdir
|
||||
-
|
||||
- archived_file="firefox-$GECKO_VERSION-$arch.tar.xz"
|
||||
- if [ -e "$archived_file" ]; then
|
||||
- echo "Using $archived_file"
|
||||
- cp "$archived_file" "firefox-$GECKO_VERSION.tar.xz"
|
||||
- else
|
||||
- if [ $arch = "arm64" ]; then
|
||||
- moz_arch=aarch64
|
||||
- else
|
||||
- moz_arch=$arch
|
||||
- fi
|
||||
- curl -O "$DOWNLOAD_URL/linux-$moz_arch/en-US/firefox-$GECKO_VERSION.tar.xz"
|
||||
- # Store local copy of unmodified app
|
||||
- cp "firefox-$GECKO_VERSION.tar.xz" "$archived_file"
|
||||
- fi
|
||||
-
|
||||
- tar xvf firefox-$GECKO_VERSION.tar.xz
|
||||
- mv firefox $xdir
|
||||
|
||||
pushd $xdir
|
||||
modify_omni $arch
|
||||
popd
|
||||
|
||||
- rm "firefox-$GECKO_VERSION.tar.xz"
|
||||
-
|
||||
- echo "$( $SCRIPT_DIR/xulrunner_hash -p l -a "$arch" )" > "hash-linux-${arch}"
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
diff --git a/app/build.sh b/app/build.sh
|
||||
index de092bde16..2e58b687e7 100755
|
||||
--- a/app/build.sh
|
||||
+++ b/app/build.sh
|
||||
@@ -644,11 +644,6 @@ if [ $BUILD_MAC == 1 ]; then
|
||||
cp "$MAC_RUNTIME_PATH/../MacOS/XUL" "$CONTENTSDIR/MacOS/"
|
||||
fi
|
||||
|
||||
- # Use our own updater, because Mozilla's requires updates signed by Mozilla
|
||||
- cd "$CONTENTSDIR/MacOS"
|
||||
- check_lfs_file "$CALLDIR/mac/updater.tar.xz"
|
||||
- tar xf "$CALLDIR/mac/updater.tar.xz"
|
||||
-
|
||||
# Modify Info.plist
|
||||
perl -pi -e "s/\{\{VERSION\}\}/$VERSION/" "$CONTENTSDIR/Info.plist"
|
||||
perl -pi -e "s/\{\{VERSION_NUMERIC\}\}/$VERSION_NUMERIC/" "$CONTENTSDIR/Info.plist"
|
||||
@@ -1027,11 +1022,6 @@ if [ $BUILD_LINUX == 1 ]; then
|
||||
# Copy Ubuntu launcher files
|
||||
cp "$CALLDIR/linux/zotero.desktop" "$APPDIR"
|
||||
cp "$CALLDIR/linux/set_launcher_icon" "$APPDIR"
|
||||
-
|
||||
- # Use our own updater, because Mozilla's requires updates signed by Mozilla
|
||||
- check_lfs_file "$CALLDIR/linux/updater.tar.xz"
|
||||
- tar xf "$CALLDIR/linux/updater.tar.xz" --to-stdout updater-$arch > "$APPDIR/updater"
|
||||
- chmod 755 "$APPDIR/updater"
|
||||
|
||||
# Copy app files
|
||||
rsync -a "$base_dir/" "$APPDIR/"
|
||||
@@ -1041,6 +1031,7 @@ if [ $BUILD_LINUX == 1 ]; then
|
||||
cp -RH "$CALLDIR/modules/zotero-libreoffice-integration/install" "$APPDIR/integration/libreoffice"
|
||||
|
||||
# Copy icons
|
||||
+ mkdir -p "$APPDIR/icons/"
|
||||
cp "$CALLDIR/linux/icons/icon32.png" "$APPDIR/icons/"
|
||||
cp "$CALLDIR/linux/icons/icon64.png" "$APPDIR/icons/"
|
||||
cp "$CALLDIR/linux/icons/icon128.png" "$APPDIR/icons/"
|
||||
@@ -1,33 +0,0 @@
|
||||
{
|
||||
pname,
|
||||
version,
|
||||
meta,
|
||||
stdenv,
|
||||
fetchurl,
|
||||
undmg,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
inherit pname version meta;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://download.zotero.org/client/release/${finalAttrs.version}/Zotero-${finalAttrs.version}.dmg";
|
||||
hash = "sha256-lDf/jULLQyzxNVGRUKuF2df+FTbJK08z+fFQbVgwjsY=";
|
||||
};
|
||||
sourceRoot = ".";
|
||||
|
||||
nativeBuildInputs = [ undmg ];
|
||||
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
dontFixup = true; # breaks notarization
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/Applications
|
||||
cp -r Zotero.app $out/Applications
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
})
|
||||
@@ -0,0 +1,42 @@
|
||||
diff --git a/js-build/note-editor.js b/js-build/note-editor.js
|
||||
index 1435730342..bfd552f863 100644
|
||||
--- a/js-build/note-editor.js
|
||||
+++ b/js-build/note-editor.js
|
||||
@@ -36,9 +36,6 @@ async function getZoteroNoteEditor(signatures) {
|
||||
await fs.remove(path.join(targetDir, 'zotero'));
|
||||
}
|
||||
catch (e) {
|
||||
- console.error(e);
|
||||
- await exec('npm ci', { cwd: modulePath });
|
||||
- await exec('npm run build', { cwd: modulePath });
|
||||
await fs.copy(path.join(modulePath, 'build', 'zotero'), targetDir);
|
||||
}
|
||||
signatures['note-editor'] = { hash };
|
||||
diff --git a/js-build/pdf-worker.js b/js-build/pdf-worker.js
|
||||
index b820304f3a..aafb6b1ef5 100644
|
||||
--- a/js-build/pdf-worker.js
|
||||
+++ b/js-build/pdf-worker.js
|
||||
@@ -33,9 +33,6 @@ async function getPDFWorker(signatures) {
|
||||
);
|
||||
}
|
||||
catch (e) {
|
||||
- console.error(e);
|
||||
- await exec('npm ci', { cwd: modulePath });
|
||||
- await exec('npm run build', { cwd: modulePath });
|
||||
await fs.copy(path.join(modulePath, 'build', 'worker.js'), path.join(targetDir, 'worker.js'));
|
||||
}
|
||||
signatures['pdf-worker'] = { hash };
|
||||
diff --git a/js-build/reader.js b/js-build/reader.js
|
||||
index 67a02a3ad2..5de2f3ada8 100644
|
||||
--- a/js-build/reader.js
|
||||
+++ b/js-build/reader.js
|
||||
@@ -36,9 +36,6 @@ async function getReader(signatures) {
|
||||
await fs.remove(path.join(targetDir, 'zotero'));
|
||||
}
|
||||
catch (e) {
|
||||
- console.error(e);
|
||||
- await exec('npm ci', { cwd: modulePath });
|
||||
- await exec('npm run build', { cwd: modulePath });
|
||||
await fs.copy(path.join(modulePath, 'build', 'zotero'), targetDir);
|
||||
}
|
||||
signatures['reader'] = { hash };
|
||||
@@ -1,139 +0,0 @@
|
||||
{
|
||||
pname,
|
||||
version,
|
||||
meta,
|
||||
lib,
|
||||
stdenv,
|
||||
fetchurl,
|
||||
wrapGAppsHook3,
|
||||
makeDesktopItem,
|
||||
atk,
|
||||
cairo,
|
||||
dbus-glib,
|
||||
gdk-pixbuf,
|
||||
glib,
|
||||
gtk3,
|
||||
libGL,
|
||||
libva,
|
||||
libxtst,
|
||||
libxrandr,
|
||||
libxi,
|
||||
libxfixes,
|
||||
libxext,
|
||||
libxdamage,
|
||||
libxcursor,
|
||||
libxcomposite,
|
||||
libx11,
|
||||
libxcb,
|
||||
libgbm,
|
||||
pango,
|
||||
pciutils,
|
||||
alsaSupport ? true,
|
||||
alsa-lib,
|
||||
jackSupport ? true,
|
||||
libjack2,
|
||||
pulseSupport ? true,
|
||||
libpulseaudio,
|
||||
sndioSupport ? true,
|
||||
sndio,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
inherit pname version meta;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://download.zotero.org/client/release/${finalAttrs.version}/Zotero-${finalAttrs.version}_linux-x86_64.tar.bz2";
|
||||
hash = "sha256-uV0R0L8EoZt59hMKXFlJ+EhONArPpRbb/tIV+wZKLgY=";
|
||||
};
|
||||
|
||||
dontPatchELF = true;
|
||||
nativeBuildInputs = [ wrapGAppsHook3 ];
|
||||
|
||||
libPath =
|
||||
lib.makeLibraryPath (
|
||||
[
|
||||
atk
|
||||
cairo
|
||||
dbus-glib
|
||||
gdk-pixbuf
|
||||
glib
|
||||
gtk3
|
||||
libGL
|
||||
libva
|
||||
libx11
|
||||
libxcomposite
|
||||
libxcursor
|
||||
libxdamage
|
||||
libxext
|
||||
libxfixes
|
||||
libxi
|
||||
libxrandr
|
||||
libxtst
|
||||
libxcb
|
||||
libgbm
|
||||
pango
|
||||
pciutils
|
||||
]
|
||||
++ lib.optional alsaSupport alsa-lib
|
||||
++ lib.optional jackSupport libjack2
|
||||
++ lib.optional pulseSupport libpulseaudio
|
||||
++ lib.optional sndioSupport sndio
|
||||
)
|
||||
+ ":"
|
||||
+ lib.makeSearchPathOutput "lib" "lib" [ stdenv.cc.cc ];
|
||||
|
||||
desktopItem = makeDesktopItem {
|
||||
name = "zotero";
|
||||
exec = "zotero -url %U";
|
||||
icon = "zotero";
|
||||
comment = finalAttrs.meta.description;
|
||||
desktopName = "Zotero";
|
||||
genericName = "Reference Management";
|
||||
categories = [
|
||||
"Office"
|
||||
"Database"
|
||||
];
|
||||
startupNotify = true;
|
||||
mimeTypes = [
|
||||
"x-scheme-handler/zotero"
|
||||
"text/plain"
|
||||
];
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
# Copy package contents to the output directory
|
||||
mkdir -p "$prefix/usr/lib/zotero-bin-${finalAttrs.version}"
|
||||
cp -r * "$prefix/usr/lib/zotero-bin-${finalAttrs.version}"
|
||||
mkdir -p "$out/bin"
|
||||
ln -s "$prefix/usr/lib/zotero-bin-${finalAttrs.version}/zotero" "$out/bin/"
|
||||
|
||||
# Install desktop file and icons
|
||||
mkdir -p $out/share/applications
|
||||
cp ${finalAttrs.desktopItem}/share/applications/* $out/share/applications/
|
||||
for size in 32 64 128; do
|
||||
install -Dm444 icons/icon''${size}.png \
|
||||
$out/share/icons/hicolor/''${size}x''${size}/apps/zotero.png
|
||||
done
|
||||
install -Dm444 icons/symbolic.svg \
|
||||
$out/share/icons/hicolor/symbolic/apps/zotero-symbolic.svg
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
for executable in \
|
||||
zotero-bin plugin-container updater vaapitest \
|
||||
minidump-analyzer glxtest
|
||||
do
|
||||
if [ -e "$out/usr/lib/zotero-bin-${finalAttrs.version}/$executable" ]; then
|
||||
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
||||
"$out/usr/lib/zotero-bin-${finalAttrs.version}/$executable"
|
||||
fi
|
||||
done
|
||||
find . -executable -type f -exec \
|
||||
patchelf --set-rpath "$libPath" \
|
||||
"$out/usr/lib/zotero-bin-${finalAttrs.version}/{}" \;
|
||||
'';
|
||||
})
|
||||
@@ -1,30 +1,327 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
callPackage,
|
||||
fetchFromGitHub,
|
||||
buildNpmPackage,
|
||||
nodejs_22,
|
||||
perl,
|
||||
python3,
|
||||
zip,
|
||||
unzip,
|
||||
xz,
|
||||
gawk,
|
||||
rsync,
|
||||
firefox-esr-140-unwrapped,
|
||||
makeDesktopItem,
|
||||
copyDesktopItems,
|
||||
libGL,
|
||||
pciutils,
|
||||
wrapGAppsHook3,
|
||||
nix-update-script,
|
||||
xvfb-run,
|
||||
doCheck ? false,
|
||||
}:
|
||||
|
||||
let
|
||||
# note-editor needs nodejs 22. Any newer version fails to build zotero's fork of @benrbray/prosemirror-math during npm install.
|
||||
nodejs = nodejs_22;
|
||||
|
||||
pname = "zotero";
|
||||
version = "7.0.30";
|
||||
version = "8.0.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "zotero";
|
||||
repo = "zotero";
|
||||
tag = version;
|
||||
hash = "sha256-zGcTZjrbFYbE4qJH5g3betnSLCdxYU2nZBOU55HunYU=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
pdf-js = buildNpmPackage {
|
||||
pname = "zotero-pdf-js";
|
||||
inherit version nodejs;
|
||||
src = "${src}/pdf-worker/pdf.js";
|
||||
npmDepsHash = "sha256-KeYAY6EWBZVd3QucDEDtI6lwtTahCEFBFf2Ebib9HKg=";
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
npm exec gulp lib-legacy
|
||||
npm exec gulp generic-legacy
|
||||
npm exec gulp minified-legacy
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out
|
||||
cp -r . $out
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
|
||||
epub-js = buildNpmPackage {
|
||||
pname = "zotero-epub-js";
|
||||
inherit version nodejs;
|
||||
src = "${src}/reader/epubjs/epub.js";
|
||||
npmDepsHash = "sha256-6XY6uczPOpMpRHDQbkQRHKBDDRQ/MXIVepGBx1V+h5Q=";
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
npm run compile
|
||||
npm run build
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out
|
||||
cp -r . $out
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
|
||||
pdf-reader = buildNpmPackage {
|
||||
pname = "zotero-pdf-reader";
|
||||
inherit version nodejs;
|
||||
src = "${src}/reader";
|
||||
npmDepsHash = "sha256-p8O2gIF0S7QO0AR9TPPQsWUtRnKnf58zSl3JZN0lnuc=";
|
||||
patches = [ ./pdf-reader-locales.patch ];
|
||||
postPatch = ''
|
||||
rm -rf pdfjs/pdf.js
|
||||
cp -r ${pdf-js} pdfjs/pdf.js
|
||||
chmod -R u+w pdfjs/pdf.js
|
||||
|
||||
rm -rf epubjs/epub.js
|
||||
cp -r ${epub-js} epubjs/epub.js
|
||||
chmod -R u+w epubjs/epub.js
|
||||
|
||||
mkdir -p locales/en-US/
|
||||
cp -r ${src}/chrome/locale/en-US/zotero/* locales/en-US/
|
||||
'';
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out
|
||||
cp -r . $out
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
|
||||
pdf-worker = buildNpmPackage {
|
||||
pname = "zotero-pdf-worker";
|
||||
inherit version nodejs;
|
||||
src = "${src}/pdf-worker";
|
||||
npmDepsHash = "sha256-TGuN1fZOClzm6xD2rmn5BAemN4mbyOVaLbSRyMeDIm8=";
|
||||
nativeBuildInputs = [
|
||||
rsync
|
||||
];
|
||||
postPatch = ''
|
||||
rm -rf pdf.js
|
||||
cp -r ${pdf-js} pdf.js
|
||||
'';
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out
|
||||
cp -r . $out
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
|
||||
note-editor = buildNpmPackage {
|
||||
pname = "zotero-note-editor";
|
||||
inherit version nodejs;
|
||||
src = "${src}/note-editor";
|
||||
npmDepsHash = "sha256-3KSSm8oCNOIDN/ZHhDbx7+cF20qtjtZwpnCOOWe3WQc=";
|
||||
makeCacheWritable = true;
|
||||
patches = [ ./pdf-reader-locales.patch ];
|
||||
postPatch = ''
|
||||
mkdir -p locales/en-US/
|
||||
cp -r ${src}/chrome/locale/en-US/zotero/* locales/en-US/
|
||||
'';
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out
|
||||
cp -r . $out
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
buildNpmPackage (finalAttrs: {
|
||||
inherit
|
||||
pname
|
||||
version
|
||||
src
|
||||
nodejs
|
||||
;
|
||||
|
||||
npmDepsHash = "sha256-dtbA1V38u26gqWoN+kW/tnccl6HFX7p8fPAneq+mw6U=";
|
||||
|
||||
nativeBuildInputs = [
|
||||
perl
|
||||
python3
|
||||
zip
|
||||
unzip
|
||||
xz
|
||||
gawk
|
||||
rsync
|
||||
copyDesktopItems
|
||||
wrapGAppsHook3
|
||||
];
|
||||
|
||||
patches = [
|
||||
./avoid-git.patch
|
||||
./js-build-fixes.patch
|
||||
./avoid-xulrunner-fetch.patch
|
||||
./build-fixes.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
rm -rf reader
|
||||
cp -r ${pdf-reader} reader
|
||||
chmod -R u+w reader
|
||||
|
||||
rm -rf pdf-worker
|
||||
cp -r ${pdf-worker} pdf-worker
|
||||
chmod -R u+w pdf-worker
|
||||
|
||||
rm -rf note-editor
|
||||
cp -r ${note-editor} note-editor
|
||||
chmod -R u+w note-editor
|
||||
|
||||
patchShebangs --build app/ test/
|
||||
|
||||
# Skip some flaky/failing tests
|
||||
rm test/tests/retractionsTest.js
|
||||
for test in \
|
||||
"should throw error on broken symlink" \
|
||||
"should use BrowserDownload for 403 when enforcing file type" \
|
||||
"should use BrowserDownload for a JS redirect page" \
|
||||
"should keep attachments pane status after changing selection" \
|
||||
"should render preview robustly after making dense calls to render and discard" \
|
||||
"should discard attachment pane preview after becoming invisible" \
|
||||
; do
|
||||
sed -i "s|it(\"$test|it.skip(\"$test|" test/tests/*.js
|
||||
done
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
npm run build
|
||||
|
||||
# Place firefox files at the right place.
|
||||
# The correct firefox version can be found in zotero/app/config.sh at `GECKO_VERSION_LINUX`.
|
||||
mkdir -p app/xulrunner/
|
||||
''
|
||||
+ lib.optionalString stdenv.targetPlatform.isDarwin ''
|
||||
cp -r "${firefox-esr-140-unwrapped}/Applications/Firefox ESR.app" app/xulrunner/Firefox.app
|
||||
''
|
||||
+ lib.optionalString (!stdenv.targetPlatform.isDarwin) ''
|
||||
cp -r "${firefox-esr-140-unwrapped}/lib/firefox" "app/xulrunner/firefox-${stdenv.targetPlatform.parsed.kernel.name}-${
|
||||
lib.replaceString "aarch64" "arm64" stdenv.targetPlatform.parsed.cpu.name
|
||||
}"
|
||||
''
|
||||
+ ''
|
||||
chmod -R u+w app/xulrunner/
|
||||
|
||||
./app/scripts/dir_build
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
inherit doCheck;
|
||||
# Build with test support if `doCheck` is enabled.
|
||||
env.ZOTERO_TEST = doCheck;
|
||||
|
||||
nativeCheckInputs = [
|
||||
xvfb-run
|
||||
];
|
||||
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
|
||||
CI=true xvfb-run test/runtests.sh
|
||||
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
desktopItems = [
|
||||
(makeDesktopItem {
|
||||
name = "zotero";
|
||||
exec = "zotero -url %U";
|
||||
icon = "zotero";
|
||||
comment = finalAttrs.meta.description;
|
||||
desktopName = "Zotero";
|
||||
genericName = "Reference Management";
|
||||
categories = [
|
||||
"Office"
|
||||
"Database"
|
||||
];
|
||||
startupNotify = true;
|
||||
mimeTypes = [
|
||||
"x-scheme-handler/zotero"
|
||||
"text/plain"
|
||||
];
|
||||
})
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
''
|
||||
+ lib.optionalString stdenv.targetPlatform.isDarwin ''
|
||||
# Copy package contents
|
||||
mkdir -p $out/Applications
|
||||
cp -r app/staging/Zotero.app $out/Applications/
|
||||
''
|
||||
+ lib.optionalString (!stdenv.targetPlatform.isDarwin) ''
|
||||
# Copy package contents
|
||||
mkdir -p $out/lib/
|
||||
cp -r app/staging/*/. $out/lib/
|
||||
|
||||
# Add binary to bin/
|
||||
mkdir -p $out/bin/
|
||||
ln -s ../lib/zotero $out/bin/zotero
|
||||
|
||||
# Install icons
|
||||
for size in 32 64 128; do
|
||||
install -Dm444 "app/linux/icons/icon''${size}.png" "$out/share/icons/hicolor/''${size}x''${size}/apps/zotero.png"
|
||||
done
|
||||
install -Dm444 "app/linux/icons/symbolic.svg" "$out/share/icons/hicolor/scalable/apps/zotero-symbolic.svg"
|
||||
''
|
||||
+ ''
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
preFixup = lib.optionalString (!stdenv.targetPlatform.isDarwin) ''
|
||||
gappsWrapperArgs+=(--suffix LD_LIBRARY_PATH : ${
|
||||
lib.makeLibraryPath [
|
||||
libGL
|
||||
pciutils
|
||||
]
|
||||
})
|
||||
'';
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
|
||||
meta = {
|
||||
homepage = "https://www.zotero.org";
|
||||
description = "Collect, organize, cite, and share your research sources";
|
||||
mainProgram = "zotero";
|
||||
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
|
||||
license = lib.licenses.agpl3Only;
|
||||
platforms = [
|
||||
"x86_64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||
maintainers = with lib.maintainers; [
|
||||
atila
|
||||
justanotherariel
|
||||
mynacol
|
||||
];
|
||||
};
|
||||
in
|
||||
if stdenv.hostPlatform.isDarwin then
|
||||
callPackage ./darwin.nix { inherit pname version meta; }
|
||||
else
|
||||
callPackage ./linux.nix { inherit pname version meta; }
|
||||
})
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
diff --git a/webpack.zotero-locale-plugin.js b/webpack.zotero-locale-plugin.js
|
||||
index fb6eb28..e5e040f 100644
|
||||
--- a/webpack.zotero-locale-plugin.js
|
||||
+++ b/webpack.zotero-locale-plugin.js
|
||||
@@ -52,7 +52,7 @@ class ZoteroLocalePlugin {
|
||||
}
|
||||
|
||||
// If the commit hash has changed
|
||||
- if (lastCommitHash !== this.commitHash) {
|
||||
+ if (false) {
|
||||
console.log(`Detected commit hash change (was: ${lastCommitHash}, now: ${this.commitHash}). Clearing and downloading locale files...`);
|
||||
|
||||
// Remove and recreate the output directory
|
||||
Reference in New Issue
Block a user