git.iko.soy/typeable/nixpkgs
on master help sign in
Zotero: Fix to use patchelf instead of FHS Env.

Removed buildFHSUserEnv to use `patchelf` on prebuilt binaries and libs. Should fix issue #48814.

commit142260c991ae62904fb6b675a9dc5198fb0a85c9 authorjpathy <15735913+jpathy@users.noreply.github.com> dateMon 4 Mar 2019, 15:25 (8 years ago) parentdef5aeb
1 file changed+113−55
pkgs/applications/office/zotero/default.nix+113−55
pkgs/applications/office/zotero/default.nix+113−55
@@ -1,67 +1,125 @@
1−{ stdenv, fetchurl, buildFHSUserEnv, makeDesktopItem, runCommand, bash, wrapGAppsHook, gsettings-desktop-schemas, gtk3, gnome3 }:
2−
3−let
4−version = "5.0.60";
5−meta = with stdenv.lib; {
6− homepage = https://www.zotero.org;
7− description = "Collect, organize, cite, and share your research sources";
8− license = licenses.agpl3;
9− platforms = platforms.linux;
10−};
11−
12−zoteroSrc = stdenv.mkDerivation rec {
13− inherit version;
14− name = "zotero-${version}-pkg";
1+{ stdenv, fetchurl, wrapGAppsHook
2+, atk
3+, cairo
4+, curl
5+, cups
6+, dbus-glib
7+, dbus
8+, fontconfig
9+, freetype
10+, gdk_pixbuf
11+, glib
12+, glibc
13+, gtk3
14+, libX11
15+, libXScrnSaver
16+, libxcb
17+, libXcomposite
18+, libXcursor
19+, libXdamage
20+, libXext
21+, libXfixes
22+, libXi
23+, libXinerama
24+, libXrender
25+, libXt
26+, libnotify
27+, gnome3
28+, libGLU_combined
29+, nspr
30+, nss
31+, pango
32+, coreutils
33+, gnused
34+, gsettings-desktop-schemas
35+}:
1536
37+stdenv.mkDerivation rec {
38+ name = "zotero-${version}";
39+ version = "5.0.60";
40+
1641 src = fetchurl {
1742 url = "https://download.zotero.org/client/release/${version}/Zotero-${version}_linux-x86_64.tar.bz2";
1843 sha256 = "0753xk95shhxma4dvdxrj2q6y81z8lianxg7jnab9m17fb67jy2d";
1944 };
20−
45+
2146 buildInputs= [ wrapGAppsHook gsettings-desktop-schemas gtk3 gnome3.adwaita-icon-theme gnome3.dconf ];
22− phases = [ "unpackPhase" "installPhase" "fixupPhase"];
2347
24− installPhase = ''
25− mkdir -p $out/data
26− cp -r * $out/data
27− mkdir $out/bin
28− ln -s $out/data/zotero $out/bin/zotero
29− '';
30−};
48+ phases = [ "unpackPhase" "patchPhase" "installPhase" "fixupPhase" ];
3149
32−fhsEnv = buildFHSUserEnv {
33− name = "zotero-fhs-env";
34− targetPkgs = pkgs: with pkgs; with xorg; [
35− gtk3 dbus-glib glib
36− libXt nss
37− libX11
38− ];
39−};
50+ dontStrip = true;
51+ dontPatchELF = true;
4052
41−desktopItem = makeDesktopItem rec {
42− name = "zotero-${version}";
43− exec = "zotero -url %U";
44− icon = "zotero";
45− type = "Application";
46− comment = meta.description;
47− desktopName = "Zotero";
48− genericName = "Reference Management";
49− categories = "Office;Database;";
50− startupNotify = "true";
51−};
53+ libPath = stdenv.lib.makeLibraryPath
54+ [ stdenv.cc.cc
55+ atk
56+ cairo
57+ curl
58+ cups
59+ dbus-glib
60+ dbus
61+ fontconfig
62+ freetype
63+ gdk_pixbuf
64+ glib
65+ glibc
66+ gtk3
67+ libX11
68+ libXScrnSaver
69+ libXcomposite
70+ libXcursor
71+ libxcb
72+ libXdamage
73+ libXext
74+ libXfixes
75+ libXi
76+ libXinerama
77+ libXrender
78+ libXt
79+ libnotify
80+ libGLU_combined
81+ nspr
82+ nss
83+ pango
84+ ] + ":" + stdenv.lib.makeSearchPathOutput "lib" "lib64" [
85+ stdenv.cc.cc
86+ ];
5287
53−in runCommand "zotero-${version}" { inherit meta; } ''
54− mkdir -p $out/bin $out/share/applications
55− cat >$out/bin/zotero <<EOF
56−#!${bash}/bin/bash
57−${fhsEnv}/bin/zotero-fhs-env ${zoteroSrc}/bin/zotero
58−EOF
59− chmod +x $out/bin/zotero
88+ patchPhase = ''
89+ sed -i '/pref("app.update.enabled", true);/c\pref("app.update.enabled", false);' defaults/preferences/prefs.js
90+ '';
6091
61− cp ${desktopItem}/share/applications/* $out/share/applications/
92+ installPhase =
93+ ''
94+ mkdir -p "$prefix/usr/lib/zotero-bin-${version}"
95+ cp -r * "$prefix/usr/lib/zotero-bin-${version}"
96+ mkdir -p "$out/bin"
97+ ln -s "$prefix/usr/lib/zotero-bin-${version}/zotero" "$out/bin/"
6298
63− for size in 16 32 48 256; do
64− install -Dm444 ${zoteroSrc}/data/chrome/icons/default/default$size.png \
65− $out/share/icons/hicolor/''${size}x''${size}/apps/zotero.png
66− done
67−''
99+ install -Dm444 zotero.desktop $out/share/applications/zotero.desktop
100+ for size in 16 32 48 256; do
101+ install -Dm444 chrome/icons/default/default$size.png \
102+ $out/share/icons/hicolor/''${size}x''${size}/apps/zotero.png
103+ done
104+
105+ for executable in \
106+ zotero-bin plugin-container \
107+ updater minidump-analyzer
108+ do
109+ if [ -e "$out/usr/lib/zotero-bin-${version}/$executable" ]; then
110+ patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
111+ "$out/usr/lib/zotero-bin-${version}/$executable"
112+ fi
113+ done
114+ find . -executable -type f -exec \
115+ patchelf --set-rpath "$libPath" \
116+ "$out/usr/lib/zotero-bin-${version}/{}" \;
117+ '';
118+
119+ meta = with stdenv.lib; {
120+ homepage = https://www.zotero.org;
121+ description = "Collect, organize, cite, and share your research sources";
122+ license = licenses.agpl3;
123+ platforms = platforms.linux;
124+ };
125+}