From 1c215828d5c811a523fbc599e7c38d96b586d9e8 Mon Sep 17 00:00:00 2001 From: Herwig Hochleitner Date: Sun, 29 May 2016 10:43:47 +0200 Subject: [PATCH] wine: make features configurable --- pkgs/misc/emulators/wine/base.nix | 51 +++++++++++++++++++-------- pkgs/misc/emulators/wine/default.nix | 40 +++++++++++++++++++-- pkgs/misc/emulators/wine/packages.nix | 10 +++--- pkgs/top-level/all-packages.nix | 46 +++++++++++++++++++++++- 4 files changed, 124 insertions(+), 23 deletions(-) diff --git a/pkgs/misc/emulators/wine/base.nix b/pkgs/misc/emulators/wine/base.nix index 4d4e897ba9d2..f5b64f1517f6 100644 --- a/pkgs/misc/emulators/wine/base.nix +++ b/pkgs/misc/emulators/wine/base.nix @@ -1,7 +1,7 @@ { stdenv, lib, pkgArches, name, version, src, monos, geckos, platforms, pkgconfig, fontforge, makeWrapper, flex, bison, - pulseaudioSupport, + supportFlags, buildScript ? null, configureFlags ? "" }: @@ -19,20 +19,41 @@ stdenv.mkDerivation ((lib.optionalAttrs (! isNull buildScript) { pkgconfig fontforge makeWrapper flex bison ]; - buildInputs = toBuildInputs pkgArches (pkgs: (with pkgs; [ - freetype fontconfig mesa mesa_noglu.osmesa libdrm libpng libjpeg openssl gnutls cups ncurses - alsaLib libxml2 libxslt lcms2 gettext dbus mpg123 openal - - libva libpcap saneBackends libv4l libgphoto2 gtk3 gsm openldap - opencl-headers opencl-icd gnome.glib cairo libtiff unixODBC - - ## for libnetapi - samba3_light - ]) - ++ lib.optional pulseaudioSupport pkgs.libpulseaudio + buildInputs = toBuildInputs pkgArches (with supportFlags; (pkgs: + [ pkgs.freetype ] + ++ lib.optional pngSupport pkgs.libpng + ++ lib.optional jpegSupport pkgs.libjpeg + ++ lib.optional cupsSupport pkgs.cups + ++ lib.optional colorManagementSupport pkgs.lcms2 + ++ lib.optional gettextSupport pkgs.gettext + ++ lib.optional dbusSupport pkgs.dbus + ++ lib.optional mpg123Support pkgs.mpg123 + ++ lib.optional openalSupport pkgs.openal + ++ lib.optional cairoSupport pkgs.cairo + ++ lib.optional tiffSupport pkgs.libtiff + ++ lib.optional odbcSupport pkgs.unixODBC + ++ lib.optional netapiSupport pkgs.samba3_light + ++ lib.optional cursesSupport pkgs.ncurses + ++ lib.optional vaSupport pkgs.libva + ++ lib.optional pcapSupport pkgs.libpcap + ++ lib.optional v4lSupport pkgs.libv4l + ++ lib.optional saneSupport pkgs.saneBackends + ++ lib.optional gsmSupport pkgs.gsm + ++ lib.optional gphoto2Support pkgs.libgphoto2 + ++ lib.optional ldapSupport pkgs.openldap + ++ lib.optional fontconfigSupport pkgs.fontconfig + ++ lib.optional alsaSupport pkgs.alsaLib + ++ lib.optional pulseaudioSupport pkgs.libpulseaudio + ++ lib.optional xineramaSupport pkgs.xorg.libXinerama + ++ lib.optional gstreamerSupport pkgs.gst_plugins_base + ++ lib.optionals gtkSupport [ pkgs.gtk3 pkgs.gnome.glib ] + ++ lib.optionals openclSupport [ pkgs.opencl-headers pkgs.opencl-icd ] + ++ lib.optionals xmlSupport [ pkgs.libxml2 pkgs.libxslt ] + ++ lib.optionals tlsSupport [ pkgs.openssl pkgs.gnutls ] + ++ lib.optionals openglSupport [ pkgs.mesa pkgs.mesa_noglu.osmesa pkgs.libdrm ] ++ (with pkgs.xorg; [ - libX11 libXi libXcursor libXinerama libXrandr libXrender libXxf86vm libXcomposite libXext - ])); + libX11 libXi libXcursor libXrandr libXrender libXxf86vm libXcomposite libXext + ]))); # Wine locates a lot of libraries dynamically through dlopen(). Add # them to the RPATH so that the user doesn't have to set them in @@ -40,7 +61,7 @@ stdenv.mkDerivation ((lib.optionalAttrs (! isNull buildScript) { NIX_LDFLAGS = map (path: "-rpath " + path) ( map (x: "${lib.getLib x}/lib") ([ stdenv.cc.cc ] ++ buildInputs) # libpulsecommon.so is linked but not found otherwise - ++ lib.optionals pulseaudioSupport (map (x: "${lib.getLib x}/lib/pulseaudio") + ++ lib.optionals supportFlags.pulseaudioSupport (map (x: "${lib.getLib x}/lib/pulseaudio") (toBuildInputs pkgArches (pkgs: [ pkgs.libpulseaudio ]))) ); diff --git a/pkgs/misc/emulators/wine/default.nix b/pkgs/misc/emulators/wine/default.nix index a402fba69f67..deeff3c73437 100644 --- a/pkgs/misc/emulators/wine/default.nix +++ b/pkgs/misc/emulators/wine/default.nix @@ -9,13 +9,49 @@ { lib, pkgs, system, callPackage, wineRelease ? "stable", wineBuild ? (if system == "x86_64-linux" then "wineWow" else "wine32"), + libtxc_dxtn_Name ? "libtxc_dxtn_s2tc", + pngSupport ? false, + jpegSupport ? false, + tiffSupport ? false, + gettextSupport ? false, + fontconfigSupport ? false, + alsaSupport ? false, + gtkSupport ? false, + openglSupport ? false, + tlsSupport ? false, + gstreamerSupport ? false, + cupsSupport ? false, + colorManagementSupport ? false, + dbusSupport ? false, + mpg123Support ? false, + openalSupport ? false, + openclSupport ? false, + cairoSupport ? false, + odbcSupport ? false, + netapiSupport ? false, + cursesSupport ? false, + vaSupport ? false, + pcapSupport ? false, + v4lSupport ? false, + saneSupport ? false, + gsmSupport ? false, + gphoto2Support ? false, + ldapSupport ? false, pulseaudioSupport ? false, - libtxc_dxtn_Name ? "libtxc_dxtn_s2tc" }: + xineramaSupport ? false, + xmlSupport ? false }: let wine-build = build: release: lib.getAttr build (callPackage ./packages.nix { wineRelease = release; - inherit pulseaudioSupport; + supportFlags = { + inherit pngSupport jpegSupport cupsSupport colorManagementSupport gettextSupport + dbusSupport mpg123Support openalSupport cairoSupport tiffSupport odbcSupport + netapiSupport cursesSupport vaSupport pcapSupport v4lSupport saneSupport + gsmSupport gphoto2Support ldapSupport fontconfigSupport alsaSupport + pulseaudioSupport xineramaSupport gtkSupport openclSupport xmlSupport tlsSupport + openglSupport gstreamerSupport; + }; }); in if wineRelease == "staging" then diff --git a/pkgs/misc/emulators/wine/packages.nix b/pkgs/misc/emulators/wine/packages.nix index 206deb01b8bb..6c06bcb0949b 100644 --- a/pkgs/misc/emulators/wine/packages.nix +++ b/pkgs/misc/emulators/wine/packages.nix @@ -1,14 +1,14 @@ { system, stdenv, stdenv_32bit, lib, pkgs, pkgsi686Linux, callPackage, callPackage_i686, overrideCC, wrapCCMulti, gcc49, - pulseaudioSupport, - wineRelease ? "stable" + wineRelease ? "stable", + supportFlags }: let src = lib.getAttr wineRelease (callPackage ./sources.nix {}); in with src; { wine32 = callPackage_i686 ./base.nix { name = "wine-${version}"; - inherit src version pulseaudioSupport; + inherit src version supportFlags; pkgArches = [ pkgsi686Linux ]; geckos = [ gecko32 ]; monos = [ mono ]; @@ -16,7 +16,7 @@ in with src; { }; wine64 = callPackage ./base.nix { name = "wine64-${version}"; - inherit src version pulseaudioSupport; + inherit src version supportFlags; # FIXME: drop this when GCC is updated to >5.3. # Corresponding bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69140 stdenv = overrideCC stdenv gcc49; @@ -28,7 +28,7 @@ in with src; { }; wineWow = callPackage ./base.nix { name = "wine-wow-${version}"; - inherit src version pulseaudioSupport; + inherit src version supportFlags; # FIXME: see above. stdenv = overrideCC stdenv_32bit (wrapCCMulti gcc49); pkgArches = [ pkgs pkgsi686Linux ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cc714d2f2039..01a65e76ffed 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16819,8 +16819,52 @@ in wineRelease = config.wine.release or "stable"; wineBuild = config.wine.build or "wine32"; pulseaudioSupport = config.pulseaudio or stdenv.isLinux; + pngSupport = true; + jpegSupport = true; + tiffSupport = true; + gettextSupport = true; + fontconfigSupport = true; + alsaSupport = true; + openglSupport = true; + tlsSupport = true; + cursesSupport = true; }; - wineStable = wine.override { wineRelease = "stable"; }; + wineMinimal = lowPrio (self.wine.override { + pulseaudioSupport = false; + pngSupport = false; + jpegSupport = false; + tiffSupport = false; + gettextSupport = false; + fontconfigSupport = false; + alsaSupport = false; + openglSupport = false; + tlsSupport = false; + cursesSupport = false; + }); + wineFull = lowPrio (self.wine.override { + gtkSupport = true; + gstreamerSupport = true; + cupsSupport = true; + colorManagementSupport = true; + dbusSupport = true; + mpg123Support = true; + openalSupport = true; + openclSupport = true; + cairoSupport = true; + odbcSupport = true; + netapiSupport = true; + vaSupport = true; + pcapSupport = true; + v4lSupport = true; + saneSupport = true; + gsmSupport = true; + gphoto2Support = true; + ldapSupport = true; + pulseaudioSupport = true; + xineramaSupport = true; + xmlSupport = true; + }); + wineStable = self.wine.override { wineRelease = "stable"; }; wineUnstable = lowPrio (self.wine.override { wineRelease = "unstable"; }); wineStaging = lowPrio (self.wine.override { wineRelease = "staging"; });