Merge pull request #31699 from timor/zotero-5

zotero: 4.0.29 -> 5.0.25
This commit is contained in:
Orivej Desh 2017-11-16 12:44:36 +00:00 committed by GitHub
commit 9939032e35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 72 deletions

View File

@ -1,82 +1,66 @@
{ stdenv, fetchurl, lib, bash, firefox, perl, unzipNLS, xorg }: { stdenv, fetchurl, buildFHSUserEnv, makeDesktopItem, runCommand, bash, wrapGAppsHook, gsettings_desktop_schemas, gtk3, gnome3 }:
let let
version = "5.0.25";
meta = with stdenv.lib; {
homepage = https://www.zotero.org;
description = "Collect, organize, cite, and share your research sources";
license = licenses.agpl3;
platforms = platforms.linux;
};
xpi = fetchurl { zoteroSrc = stdenv.mkDerivation rec {
url = "https://download.zotero.org/extension/zotero-${version}.xpi";
sha256 = "1dyf578yfj3xr9kkhmsvbkvraw2arghmh67ksi5c8qlxczx5i1xy";
};
version = "4.0.29";
in
stdenv.mkDerivation {
name = "zotero-${version}";
inherit version; inherit version;
name = "zotero-${version}-pkg";
src = fetchurl { src = fetchurl {
url = "https://github.com/zotero/zotero-standalone-build/archive/4.0.29.2.tar.gz"; url = "https://download.zotero.org/client/release/${version}/Zotero-${version}_linux-x86_64.tar.bz2";
sha256 = "0pfip6s5dawp7wp8r5czvzlnxvvdwjja64g71h9dxyxrh49v2mxa"; sha256 = "1y3q5582xp4inpz137x0r9iscs1g0cjlqcfjpzl3klsq3yas688k";
}; };
nativeBuildInputs = [ perl unzipNLS ]; buildInputs= [ wrapGAppsHook gsettings_desktop_schemas gtk3 gnome3.adwaita-icon-theme gnome3.dconf ];
phases = [ "unpackPhase" "installPhase" "fixupPhase"];
inherit bash firefox;
phases = "unpackPhase installPhase fixupPhase";
installPhase = '' installPhase = ''
mkdir -p "$out/libexec/zotero" mkdir -p $out/data
unzip "${xpi}" -d "$out/libexec/zotero" cp -r * $out/data
mkdir $out/bin
BUILDID=`date +%Y%m%d` ln -s $out/data/zotero $out/bin/zotero
GECKO_VERSION="${lib.removeSuffix "esr" firefox.passthru.version}"
UPDATE_CHANNEL="default"
# Copy branding
cp -R assets/branding "$out/libexec/zotero/chrome/branding"
# Adjust chrome.manifest
echo "" >> "$out/libexec/zotero/chrome.manifest"
cat assets/chrome.manifest >> "$out/libexec/zotero/chrome.manifest"
# Copy updater.ini
cp assets/updater.ini "$out/libexec/zotero"
# Adjust connector pref
perl -pi -e 's/pref\("extensions\.zotero\.httpServer\.enabled", false\);/pref("extensions.zotero.httpServer.enabled", true);/g' "$out/libexec/zotero/defaults/preferences/zotero.js"
perl -pi -e 's/pref\("extensions\.zotero\.connector\.enabled", false\);/pref("extensions.zotero.connector.enabled", true);/g' "$out/libexec/zotero/defaults/preferences/zotero.js"
# Copy icons
cp -r assets/icons "$out/libexec/zotero/chrome/icons"
# Copy application.ini and modify
cp assets/application.ini "$out/libexec/zotero/application.ini"
perl -pi -e "s/\{\{VERSION}}/$version/" "$out/libexec/zotero/application.ini"
perl -pi -e "s/\{\{BUILDID}}/$BUILDID/" "$out/libexec/zotero/application.ini"
perl -pi -e "s/^MaxVersion.*\$/MaxVersion=$GECKO_VERSION/" "$out/libexec/zotero/application.ini"
# Copy prefs.js and modify
cp assets/prefs.js "$out/libexec/zotero/defaults/preferences"
perl -pi -e 's/pref\("app\.update\.channel", "[^"]*"\);/pref\("app\.update\.channel", "'"$UPDATE_CHANNEL"'");/' "$out/libexec/zotero/defaults/preferences/prefs.js"
perl -pi -e 's/%GECKO_VERSION%/'"$GECKO_VERSION"'/g' "$out/libexec/zotero/defaults/preferences/prefs.js"
# Add platform-specific standalone assets
cp -R assets/unix "$out/libexec/zotero"
mkdir -p "$out/bin"
substituteAll "${./zotero.sh}" "$out/bin/zotero"
chmod +x "$out/bin/zotero"
''; '';
};
doInstallCheck = true; fhsEnv = buildFHSUserEnv {
installCheckPhase = "$out/bin/zotero --version"; name = "zotero-fhs-env";
targetPkgs = pkgs: with pkgs; with xlibs; [
gtk3 dbus_glib
libXt nss
];
};
meta = with stdenv.lib; { desktopItem = makeDesktopItem rec {
homepage = https://www.zotero.org; name = "zotero-${version}";
description = "Collect, organize, cite, and share your research sources"; exec = "zotero -url %U";
license = licenses.agpl3; icon = "zotero";
platforms = platforms.linux; type = "Application";
broken = true; # probably; see #20049 comment = meta.description;
}; desktopName = "Zotero";
} genericName = "Reference Management";
categories = "Office;Database;";
startupNotify = "true";
};
in runCommand "zotero-${version}" { inherit meta; } ''
mkdir -p $out/bin $out/share/applications
cat >$out/bin/zotero <<EOF
#!${bash}/bin/bash
${fhsEnv}/bin/zotero-fhs-env ${zoteroSrc}/bin/zotero
EOF
chmod +x $out/bin/zotero
cp ${desktopItem}/share/applications/* $out/share/applications/
for size in 16 32 48 256; do
install -Dm444 ${zoteroSrc}/data/chrome/icons/default/default$size.png \
$out/share/icons/hicolor/''${size}x''${size}/apps/zotero.png
done
''

View File

@ -17643,9 +17643,7 @@ with pkgs;
zoom-us = callPackage ../applications/networking/instant-messengers/zoom-us { }; zoom-us = callPackage ../applications/networking/instant-messengers/zoom-us { };
zotero = callPackage ../applications/office/zotero { zotero = callPackage ../applications/office/zotero { };
firefox = firefox-esr-unwrapped;
};
zscroll = callPackage ../applications/misc/zscroll {}; zscroll = callPackage ../applications/misc/zscroll {};