From 4535c0bbfe187023979cb38c3bf9647139bbf5b3 Mon Sep 17 00:00:00 2001 From: aszlig Date: Sat, 25 May 2013 05:18:08 +0200 Subject: [PATCH] gajim: Clean up and rewrite package expression. This should clean up the package expression significantly by actually using explicit input attributes and setting PYTHONPATH and GST_PLUGIN_PATH from environment variables in the builder. In addition, this adds a small patch from the upstream Mercurial repository to add an index.theme to the icons, so Gajim is able to load them correctly from the store. With this change, I'm adding myself to the maintainers list as well, because I'm switching over from TKabber to Gajim. Signed-off-by: aszlig --- .../instant-messengers/gajim/default.nix | 101 +++++++++++------- pkgs/top-level/all-packages.nix | 12 +-- 2 files changed, 61 insertions(+), 52 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/gajim/default.nix b/pkgs/applications/networking/instant-messengers/gajim/default.nix index bf7b050cd0d9..ecd3181134ff 100644 --- a/pkgs/applications/networking/instant-messengers/gajim/default.nix +++ b/pkgs/applications/networking/instant-messengers/gajim/default.nix @@ -1,54 +1,73 @@ -a : -let - fetchurl = a.fetchurl; +{ stdenv, fetchurl, python, intltool, pkgconfig, libX11, gtk +, pyopenssl, pythonDBus, pythonPackages + +, enableJingle ? true, farstream ? null, gst_plugins_bad ? null +, libnice ? null +, enableE2E ? true +, enableRST ? true +, enableSpelling ? true, gtkspell ? null +}: + +assert enableJingle -> farstream != null && gst_plugins_bad != null + && libnice != null; +assert enableE2E -> pythonPackages.pycrypto != null; +assert enableRST -> pythonPackages.docutils != null; +assert enableSpelling -> gtkspell != null; + +with stdenv.lib; + +stdenv.mkDerivation rec { + name = "gajim-${version}"; + version = "0.15.3"; - version = a.lib.attrByPath ["version"] "0.15.3" a; - buildInputs = with a; [ - python pyGtkGlade gtk perl intltool dbus gettext - pkgconfig makeWrapper libglade pyopenssl libXScrnSaver - libXt xproto libXext xextproto libX11 gtkspell aspell - scrnsaverproto pycrypto pythonDBus pythonSexy - docutils pyasn1 farstream gst_plugins_bad gstreamer - gst_ffmpeg gst_python - ]; -in -rec { src = fetchurl { url = "http://www.gajim.org/downloads/0.15/gajim-${version}.tar.gz"; sha256 = "139yl7v1i6g9q66fdmzw0x7hhp7c4x44n4l8hl9g6m9zig5v3s28"; }; - inherit buildInputs; - configureFlags = []; + patches = singleton (fetchurl { + name = "gajim-icon-index.patch"; + url = "http://hg.gajim.org/gajim/raw-rev/b9ec78663dfb"; + sha256 = "0w54hr5dq9y36val55kmh8d6cid7h4fs2nghx09714jylz2nyxxv"; + }); - preConfigure = a.fullDepEntry ('' - export PYTHONPATH="$PYTHONPATH''${PYTHONPATH:+:}$(toPythonPath ${a.pyGtkGlade})/gtk-2.0" - export PYTHONPATH="$PYTHONPATH''${PYTHONPATH:+:}$(toPythonPath ${a.pygobject})/gtk-2.0" - sed -e '/-L[$]x_libraries/d' -i configure - sed -e 's@tmpfd.close()@os.close(tmpfd)@' -i src/common/latex.py - '') ["addInputs" "doUnpack"]; + postPatch = '' + sed -i -e '0,/^[^#]/ { + /^[^#]/i export \\\ + PYTHONPATH="'"$PYTHONPATH\''${PYTHONPATH:+:}\$PYTHONPATH"'" \\\ + GST_PLUGIN_PATH="'"\$GST_PLUGIN_PATH''${GST_PLUGIN_PATH:+:}${"" + }$GST_PLUGIN_PATH"'" + }' scripts/gajim.in - fixScriptNames = a.fullDepEntry ('' - mkdir "$out"/bin-wrapped - for i in "$out"/bin/.*-wrapped; do - name="$i" - name="''${name%-wrapped}" - name="''${name##*/.}" - mv "$i" "$out/bin-wrapped/$name" - sed -e 's^'"$i"'^'"$out/bin-wrapped/$name"'^' -i "$out/bin/$name" - sed -e "2aexport LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH\''${LD_LIBRARY_PATH:+:}${a.gtkspell}/lib:${a.gtkspell}/lib64\"" -i "$out/bin/gajim" - sed -e "2aexport NIX_LDFLAGS=\"\$NIX_LDFLAGS -L${a.gtkspell}/lib -L${a.gtkspell}/lib64\"" -i "$out/bin/gajim" - sed -e "2aexport GST_PLUGIN_PATH=\"\$GST_PLUGIN_PATH''${GST_PLUGIN_PATH:+:}$(echo ${a.gst_plugins_bad}/lib/gstreamer-*):$(echo ${a.gst_ffmpeg}/lib/gstreamer-*):$(echo ${a.farstream}/lib/gstreamer-*)\"" -i "$out/bin/gajim" - done - '') ["wrapBinContentsPython"]; + sed -i -e 's/return helpers.is_in_path('"'"'drill.*/return True/' \ + src/features_window.py + sed -i -e "s|'drill'|'${ldns}/bin/drill'|" src/common/resolver.py + '' + optionalString enableSpelling '' + sed -i -e 's|=.*find_lib.*|= "${gtkspell}/lib/libgtkspell.so"|' \ + src/gtkspell.py + ''; - /* doConfigure should be removed if not needed */ - phaseNames = ["preConfigure" (a.doDump "1") "doConfigure" "doMakeInstall" - "wrapBinContentsPython" "fixScriptNames"]; + buildInputs = [ + python intltool pkgconfig libX11 + pythonPackages.pygobject pythonPackages.pyGtkGlade + pythonPackages.sqlite3 pythonPackages.pyasn1 + pythonPackages.pyxdg + pyopenssl pythonDBus + ] ++ optionals enableJingle [ farstream gst_plugins_bad libnice ] + ++ optional enableE2E pythonPackages.pycrypto + ++ optional enableRST pythonPackages.docutils; + + postInstall = '' + install -m 644 -t "$out/share/gajim/icons/hicolor" \ + "icons/hicolor/index.theme" + ''; + + enableParallelBuilding = true; - name = "gajim-" + version; meta = { - description = "Jabber client with meta-contacts"; - maintainers = [a.lib.maintainers.raskin]; + homepage = "http://gajim.org/"; + description = "Jabber client written in PyGTK"; + license = licenses.gpl3Plus; + maintainers = [ maintainers.raskin maintainers.aszlig ]; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 41ffa073a0a8..2e6e5aafce91 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9075,17 +9075,7 @@ let freestyle = callPackage ../misc/freestyle { }; - gajim = builderDefsPackage (import ../applications/networking/instant-messengers/gajim) { - inherit perl intltool pyGtkGlade gettext pkgconfig makeWrapper pygobject - pyopenssl gtkspell libsexy pycrypto aspell pythonDBus pythonSexy - docutils gtk farstream gst_plugins_bad gstreamer gst_ffmpeg gst_python; - dbus = dbus.libs; - inherit (gnome) libglade; - inherit (xlibs) libXScrnSaver libXt xproto libXext xextproto libX11 - scrnsaverproto; - inherit (pythonPackages) pyasn1; - python = pythonFull; - }; + gajim = callPackage ../applications/networking/instant-messengers/gajim { }; gensgs = callPackage_i686 ../misc/emulators/gens-gs { };