2016-01-10 09:35:45 +00:00
|
|
|
{ stdenv, lib, makeDesktopItem, makeWrapper, config
|
|
|
|
|
|
|
|
## various stuff that can be plugged in
|
|
|
|
, gnash, flashplayer, hal-flash
|
|
|
|
, MPlayerPlugin, gecko_mediaplayer, gst_all, xorg, libpulseaudio, libcanberra
|
|
|
|
, supportsJDK, jrePlugin, icedtea_web
|
2016-02-09 17:19:56 +00:00
|
|
|
, trezor-bridge, bluejeans, djview4, adobe-reader
|
2016-01-10 09:35:45 +00:00
|
|
|
, google_talk_plugin, fribid, gnome3/*.gnome_shell*/
|
|
|
|
}:
|
|
|
|
|
|
|
|
## configurability of the wrapper itself
|
|
|
|
browser :
|
|
|
|
{ browserName ? (lib.head (lib.splitString "-" browser.name)) # name of the executable
|
|
|
|
, name ? (browserName + "-" + (builtins.parseDrvName browser.name).version)
|
|
|
|
, desktopName ? # browserName with first letter capitalized
|
|
|
|
(lib.toUpper (lib.substring 0 1 browserName) + lib.substring 1 (-1) browserName)
|
|
|
|
, nameSuffix ? ""
|
|
|
|
, icon ? browserName, libtrick ? true
|
2010-05-18 15:58:45 +01:00
|
|
|
}:
|
2004-10-17 14:28:28 +01:00
|
|
|
|
2016-01-10 09:35:45 +00:00
|
|
|
let
|
|
|
|
cfg = stdenv.lib.attrByPath [ browserName ] {} config;
|
|
|
|
enableAdobeFlash = cfg.enableAdobeFlash or false;
|
|
|
|
enableGnash = cfg.enableGnash or false;
|
|
|
|
jre = cfg.jre or false;
|
|
|
|
icedtea = cfg.icedtea or false;
|
2014-03-10 14:18:48 +00:00
|
|
|
|
2016-01-10 09:35:45 +00:00
|
|
|
plugins =
|
|
|
|
assert !(enableGnash && enableAdobeFlash);
|
|
|
|
assert !(jre && icedtea);
|
|
|
|
([ ]
|
|
|
|
++ lib.optional enableGnash gnash
|
|
|
|
++ lib.optional enableAdobeFlash flashplayer
|
|
|
|
++ lib.optional (cfg.enableDjvu or false) (djview4)
|
|
|
|
++ lib.optional (cfg.enableMPlayer or false) (MPlayerPlugin browser)
|
|
|
|
++ lib.optional (cfg.enableGeckoMediaPlayer or false) gecko_mediaplayer
|
|
|
|
++ lib.optional (supportsJDK && jre && jrePlugin ? mozillaPlugin) jrePlugin
|
|
|
|
++ lib.optional icedtea icedtea_web
|
|
|
|
++ lib.optional (cfg.enableGoogleTalkPlugin or false) google_talk_plugin
|
|
|
|
++ lib.optional (cfg.enableFriBIDPlugin or false) fribid
|
|
|
|
++ lib.optional (cfg.enableGnomeExtensions or false) gnome3.gnome_shell
|
|
|
|
++ lib.optional (cfg.enableTrezor or false) trezor-bridge
|
|
|
|
++ lib.optional (cfg.enableBluejeans or false) bluejeans
|
2016-02-09 17:19:56 +00:00
|
|
|
++ lib.optional (cfg.enableAdobeReader or false) adobe-reader
|
2016-01-10 09:35:45 +00:00
|
|
|
);
|
|
|
|
libs = [ gst_all.gstreamer gst_all.gst-plugins-base ]
|
|
|
|
++ lib.optionals (cfg.enableQuakeLive or false)
|
|
|
|
(with xorg; [ stdenv.cc libX11 libXxf86dga libXxf86vm libXext libXt alsaLib zlib ])
|
|
|
|
++ lib.optional (enableAdobeFlash && (cfg.enableAdobeFlashDRM or false)) hal-flash
|
|
|
|
++ lib.optional (config.pulseaudio or false) libpulseaudio;
|
|
|
|
gst-plugins = with gst_all; [ gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-ffmpeg ];
|
|
|
|
gtk_modules = [ libcanberra ];
|
|
|
|
|
|
|
|
in
|
2004-10-17 14:28:28 +01:00
|
|
|
stdenv.mkDerivation {
|
2016-01-10 09:35:45 +00:00
|
|
|
inherit name;
|
2004-10-17 14:28:28 +01:00
|
|
|
|
2009-05-10 13:03:53 +01:00
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = browserName;
|
2012-03-20 23:23:00 +00:00
|
|
|
exec = browserName + " %U";
|
2015-05-17 23:13:34 +01:00
|
|
|
inherit icon;
|
2009-05-10 13:03:53 +01:00
|
|
|
comment = "";
|
2010-05-18 15:58:45 +01:00
|
|
|
desktopName = desktopName;
|
2009-05-10 13:03:53 +01:00
|
|
|
genericName = "Web Browser";
|
2012-03-20 23:23:00 +00:00
|
|
|
categories = "Application;Network;WebBrowser;";
|
2015-01-25 20:35:22 +00:00
|
|
|
mimeType = stdenv.lib.concatStringsSep ";" [
|
|
|
|
"text/html"
|
|
|
|
"text/xml"
|
|
|
|
"application/xhtml+xml"
|
2015-02-13 15:12:59 +00:00
|
|
|
"application/vnd.mozilla.xul+xml"
|
2015-01-25 20:35:22 +00:00
|
|
|
"x-scheme-handler/http"
|
|
|
|
"x-scheme-handler/https"
|
|
|
|
"x-scheme-handler/ftp"
|
|
|
|
];
|
2009-05-10 13:03:53 +01:00
|
|
|
};
|
|
|
|
|
2016-01-10 09:35:45 +00:00
|
|
|
buildInputs = [makeWrapper] ++ gst-plugins;
|
2004-10-17 14:28:28 +01:00
|
|
|
|
2008-06-14 22:42:07 +01:00
|
|
|
buildCommand = ''
|
2008-07-28 17:25:09 +01:00
|
|
|
if [ ! -x "${browser}/bin/${browserName}" ]
|
|
|
|
then
|
|
|
|
echo "cannot find executable file \`${browser}/bin/${browserName}'"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
makeWrapper "${browser}/bin/${browserName}" \
|
|
|
|
"$out/bin/${browserName}${nameSuffix}" \
|
2008-06-14 22:42:07 +01:00
|
|
|
--suffix-each MOZ_PLUGIN_PATH ':' "$plugins" \
|
2011-12-12 17:25:51 +00:00
|
|
|
--suffix-each LD_LIBRARY_PATH ':' "$libs" \
|
2013-05-10 01:44:03 +01:00
|
|
|
--suffix-each GTK_PATH ':' "$gtk_modules" \
|
2012-04-01 16:32:48 +01:00
|
|
|
--suffix-each LD_PRELOAD ':' "$(cat $(filterExisting $(addSuffix /extra-ld-preload $plugins)))" \
|
2015-08-19 04:56:37 +01:00
|
|
|
--prefix GST_PLUGIN_SYSTEM_PATH : "$GST_PLUGIN_SYSTEM_PATH" \
|
2014-12-12 18:33:23 +00:00
|
|
|
--prefix-contents PATH ':' "$(filterExisting $(addSuffix /extra-bin-path $plugins))" \
|
2015-05-17 23:13:19 +01:00
|
|
|
--set MOZ_OBJDIR "$(ls -d "${browser}/lib/${browserName}"*)"
|
2014-12-12 18:33:23 +00:00
|
|
|
|
|
|
|
${ lib.optionalString libtrick
|
|
|
|
''
|
|
|
|
libdirname="$(echo "${browser}/lib/${browserName}"*)"
|
|
|
|
libdirbasename="$(basename "$libdirname")"
|
|
|
|
mkdir -p "$out/lib/$libdirbasename"
|
|
|
|
ln -s "$libdirname"/* "$out/lib/$libdirbasename"
|
|
|
|
script_location="$(mktemp "$out/lib/$libdirbasename/${browserName}${nameSuffix}.XXXXXX")"
|
|
|
|
mv "$out/bin/${browserName}${nameSuffix}" "$script_location"
|
|
|
|
ln -s "$script_location" "$out/bin/${browserName}${nameSuffix}"
|
|
|
|
''
|
|
|
|
}
|
2009-05-10 13:03:53 +01:00
|
|
|
|
2015-05-17 23:13:34 +01:00
|
|
|
if [ -e "${browser}/share/icons" ]; then
|
|
|
|
mkdir -p "$out/share"
|
2015-05-18 14:52:50 +01:00
|
|
|
ln -s "${browser}/share/icons" "$out/share/icons"
|
2015-05-17 23:13:34 +01:00
|
|
|
else
|
|
|
|
mkdir -p "$out/share/icons/hicolor/128x128/apps"
|
|
|
|
ln -s "$out/lib/$libdirbasename/browser/icons/mozicon128.png" \
|
|
|
|
"$out/share/icons/hicolor/128x128/apps/${browserName}.png"
|
|
|
|
fi
|
2015-02-13 15:12:59 +00:00
|
|
|
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/share/applications
|
2009-05-10 13:03:53 +01:00
|
|
|
cp $desktopItem/share/applications/* $out/share/applications
|
2012-03-25 21:21:45 +01:00
|
|
|
|
|
|
|
# For manpages, in case the program supplies them
|
|
|
|
mkdir -p $out/nix-support
|
|
|
|
echo ${browser} > $out/nix-support/propagated-user-env-packages
|
2008-06-14 22:42:07 +01:00
|
|
|
'';
|
2007-11-24 10:49:52 +00:00
|
|
|
|
2014-02-10 20:03:17 +00:00
|
|
|
preferLocalBuild = true;
|
|
|
|
|
2005-02-16 11:24:40 +00:00
|
|
|
# Let each plugin tell us (through its `mozillaPlugin') attribute
|
|
|
|
# where to find the plugin in its tree.
|
2006-08-09 16:05:30 +01:00
|
|
|
plugins = map (x: x + x.mozillaPlugin) plugins;
|
2011-12-12 17:25:51 +00:00
|
|
|
libs = map (x: x + "/lib") libs ++ map (x: x + "/lib64") libs;
|
2013-05-10 01:44:03 +01:00
|
|
|
gtk_modules = map (x: x + x.gtkModule) gtk_modules;
|
2006-03-10 16:12:46 +00:00
|
|
|
|
2016-01-10 09:35:45 +00:00
|
|
|
passthru = { unwrapped = browser; };
|
|
|
|
|
|
|
|
meta = browser.meta // {
|
2006-10-12 11:53:16 +01:00
|
|
|
description =
|
2008-07-28 17:25:09 +01:00
|
|
|
browser.meta.description
|
2006-10-12 11:53:16 +01:00
|
|
|
+ " (with plugins: "
|
2013-09-30 21:43:34 +01:00
|
|
|
+ lib.concatStrings (lib.intersperse ", " (map (x: x.name) plugins))
|
2006-10-12 11:53:16 +01:00
|
|
|
+ ")";
|
2016-01-10 09:35:45 +00:00
|
|
|
hydraPlatforms = [];
|
|
|
|
priority = (browser.meta.priority or 0) - 1; # prefer wrapper over the package
|
2006-03-10 16:12:46 +00:00
|
|
|
};
|
2004-10-17 14:28:28 +01:00
|
|
|
}
|