Merge pull request #56809 from jpathy/patch-2
Zotero: Fix to use patchelf instead of FHS Env.
This commit is contained in:
commit
bd50fc942b
@ -1,67 +1,140 @@
|
|||||||
{ stdenv, fetchurl, buildFHSUserEnv, makeDesktopItem, runCommand, bash, wrapGAppsHook, gsettings-desktop-schemas, gtk3, gnome3 }:
|
{ stdenv, fetchurl, wrapGAppsHook, makeDesktopItem
|
||||||
|
, atk
|
||||||
let
|
, cairo
|
||||||
version = "5.0.60";
|
, curl
|
||||||
meta = with stdenv.lib; {
|
, cups
|
||||||
homepage = https://www.zotero.org;
|
, dbus-glib
|
||||||
description = "Collect, organize, cite, and share your research sources";
|
, dbus
|
||||||
license = licenses.agpl3;
|
, fontconfig
|
||||||
platforms = platforms.linux;
|
, freetype
|
||||||
};
|
, gdk_pixbuf
|
||||||
|
, glib
|
||||||
zoteroSrc = stdenv.mkDerivation rec {
|
, glibc
|
||||||
inherit version;
|
, gtk3
|
||||||
name = "zotero-${version}-pkg";
|
, libX11
|
||||||
|
, libXScrnSaver
|
||||||
|
, libxcb
|
||||||
|
, libXcomposite
|
||||||
|
, libXcursor
|
||||||
|
, libXdamage
|
||||||
|
, libXext
|
||||||
|
, libXfixes
|
||||||
|
, libXi
|
||||||
|
, libXinerama
|
||||||
|
, libXrender
|
||||||
|
, libXt
|
||||||
|
, libnotify
|
||||||
|
, gnome3
|
||||||
|
, libGLU_combined
|
||||||
|
, nspr
|
||||||
|
, nss
|
||||||
|
, pango
|
||||||
|
, coreutils
|
||||||
|
, gnused
|
||||||
|
, gsettings-desktop-schemas
|
||||||
|
}:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
name = "zotero-${version}";
|
||||||
|
version = "5.0.60";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://download.zotero.org/client/release/${version}/Zotero-${version}_linux-x86_64.tar.bz2";
|
url = "https://download.zotero.org/client/release/${version}/Zotero-${version}_linux-x86_64.tar.bz2";
|
||||||
sha256 = "0753xk95shhxma4dvdxrj2q6y81z8lianxg7jnab9m17fb67jy2d";
|
sha256 = "0753xk95shhxma4dvdxrj2q6y81z8lianxg7jnab9m17fb67jy2d";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs= [ wrapGAppsHook gsettings-desktop-schemas gtk3 gnome3.adwaita-icon-theme gnome3.dconf ];
|
buildInputs= [ wrapGAppsHook gsettings-desktop-schemas gtk3 gnome3.adwaita-icon-theme gnome3.dconf ];
|
||||||
phases = [ "unpackPhase" "installPhase" "fixupPhase"];
|
|
||||||
|
|
||||||
installPhase = ''
|
phases = [ "unpackPhase" "patchPhase" "installPhase" "fixupPhase" ];
|
||||||
mkdir -p $out/data
|
|
||||||
cp -r * $out/data
|
dontStrip = true;
|
||||||
mkdir $out/bin
|
dontPatchELF = true;
|
||||||
ln -s $out/data/zotero $out/bin/zotero
|
|
||||||
|
libPath = stdenv.lib.makeLibraryPath
|
||||||
|
[ stdenv.cc.cc
|
||||||
|
atk
|
||||||
|
cairo
|
||||||
|
curl
|
||||||
|
cups
|
||||||
|
dbus-glib
|
||||||
|
dbus
|
||||||
|
fontconfig
|
||||||
|
freetype
|
||||||
|
gdk_pixbuf
|
||||||
|
glib
|
||||||
|
glibc
|
||||||
|
gtk3
|
||||||
|
libX11
|
||||||
|
libXScrnSaver
|
||||||
|
libXcomposite
|
||||||
|
libXcursor
|
||||||
|
libxcb
|
||||||
|
libXdamage
|
||||||
|
libXext
|
||||||
|
libXfixes
|
||||||
|
libXi
|
||||||
|
libXinerama
|
||||||
|
libXrender
|
||||||
|
libXt
|
||||||
|
libnotify
|
||||||
|
libGLU_combined
|
||||||
|
nspr
|
||||||
|
nss
|
||||||
|
pango
|
||||||
|
] + ":" + stdenv.lib.makeSearchPathOutput "lib" "lib64" [
|
||||||
|
stdenv.cc.cc
|
||||||
|
];
|
||||||
|
|
||||||
|
patchPhase = ''
|
||||||
|
sed -i '/pref("app.update.enabled", true);/c\pref("app.update.enabled", false);' defaults/preferences/prefs.js
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
fhsEnv = buildFHSUserEnv {
|
desktopItem = makeDesktopItem rec {
|
||||||
name = "zotero-fhs-env";
|
name = "zotero-${version}";
|
||||||
targetPkgs = pkgs: with pkgs; with xorg; [
|
exec = "zotero -url %U";
|
||||||
gtk3 dbus-glib glib
|
icon = "zotero";
|
||||||
libXt nss
|
type = "Application";
|
||||||
libX11
|
comment = meta.description;
|
||||||
];
|
desktopName = "Zotero";
|
||||||
};
|
genericName = "Reference Management";
|
||||||
|
categories = "Office;Database;";
|
||||||
|
startupNotify = "true";
|
||||||
|
mimeType = "text/plain";
|
||||||
|
};
|
||||||
|
|
||||||
desktopItem = makeDesktopItem rec {
|
installPhase =
|
||||||
name = "zotero-${version}";
|
''
|
||||||
exec = "zotero -url %U";
|
mkdir -p "$prefix/usr/lib/zotero-bin-${version}"
|
||||||
icon = "zotero";
|
cp -r * "$prefix/usr/lib/zotero-bin-${version}"
|
||||||
type = "Application";
|
mkdir -p "$out/bin"
|
||||||
comment = meta.description;
|
ln -s "$prefix/usr/lib/zotero-bin-${version}/zotero" "$out/bin/"
|
||||||
desktopName = "Zotero";
|
|
||||||
genericName = "Reference Management";
|
|
||||||
categories = "Office;Database;";
|
|
||||||
startupNotify = "true";
|
|
||||||
};
|
|
||||||
|
|
||||||
in runCommand "zotero-${version}" { inherit meta; } ''
|
# install desktop file and icons.
|
||||||
mkdir -p $out/bin $out/share/applications
|
mkdir -p $out/share/applications
|
||||||
cat >$out/bin/zotero <<EOF
|
cp ${desktopItem}/share/applications/* $out/share/applications/
|
||||||
#!${bash}/bin/bash
|
for size in 16 32 48 256; do
|
||||||
${fhsEnv}/bin/zotero-fhs-env ${zoteroSrc}/bin/zotero
|
install -Dm444 chrome/icons/default/default$size.png \
|
||||||
EOF
|
$out/share/icons/hicolor/''${size}x''${size}/apps/zotero.png
|
||||||
chmod +x $out/bin/zotero
|
done
|
||||||
|
|
||||||
cp ${desktopItem}/share/applications/* $out/share/applications/
|
for executable in \
|
||||||
|
zotero-bin plugin-container \
|
||||||
|
updater minidump-analyzer
|
||||||
|
do
|
||||||
|
if [ -e "$out/usr/lib/zotero-bin-${version}/$executable" ]; then
|
||||||
|
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
||||||
|
"$out/usr/lib/zotero-bin-${version}/$executable"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
find . -executable -type f -exec \
|
||||||
|
patchelf --set-rpath "$libPath" \
|
||||||
|
"$out/usr/lib/zotero-bin-${version}/{}" \;
|
||||||
|
'';
|
||||||
|
|
||||||
for size in 16 32 48 256; do
|
meta = with stdenv.lib; {
|
||||||
install -Dm444 ${zoteroSrc}/data/chrome/icons/default/default$size.png \
|
homepage = https://www.zotero.org;
|
||||||
$out/share/icons/hicolor/''${size}x''${size}/apps/zotero.png
|
description = "Collect, organize, cite, and share your research sources";
|
||||||
done
|
license = licenses.agpl3;
|
||||||
''
|
platforms = platforms.linux;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user