From ae6d2796bc1d1a0ebc729f8826ae6ff5b97256e2 Mon Sep 17 00:00:00 2001 From: Herwig Hochleitner Date: Tue, 21 Apr 2015 18:00:59 +0200 Subject: [PATCH] wine: add 64 bit build and nixpkgs configuration The default release channel (stable/unstable) and the default build (wine32/wine64/wineWow) can be customized via the "wine" key in config --- pkgs/misc/emulators/wine/base.nix | 61 +++++++++++++++++++ pkgs/misc/emulators/wine/builder-wow.sh | 29 +++++++++ pkgs/misc/emulators/wine/default.nix | 15 +++++ pkgs/misc/emulators/wine/packages.nix | 60 ++++++++++++++++++ pkgs/misc/emulators/wine/stable.nix | 81 ------------------------- pkgs/misc/emulators/wine/unstable.nix | 78 ------------------------ pkgs/misc/emulators/wine/versions.nix | 25 ++++++++ pkgs/top-level/all-packages.nix | 24 ++++---- 8 files changed, 201 insertions(+), 172 deletions(-) create mode 100644 pkgs/misc/emulators/wine/base.nix create mode 100644 pkgs/misc/emulators/wine/builder-wow.sh create mode 100644 pkgs/misc/emulators/wine/default.nix create mode 100644 pkgs/misc/emulators/wine/packages.nix delete mode 100644 pkgs/misc/emulators/wine/stable.nix delete mode 100644 pkgs/misc/emulators/wine/unstable.nix create mode 100644 pkgs/misc/emulators/wine/versions.nix diff --git a/pkgs/misc/emulators/wine/base.nix b/pkgs/misc/emulators/wine/base.nix new file mode 100644 index 000000000000..ce39740f1133 --- /dev/null +++ b/pkgs/misc/emulators/wine/base.nix @@ -0,0 +1,61 @@ +{ stdenv, lib, pkgArches, + name, version, src, monos, geckos, platforms, + buildScript ? null, configureFlags ? "" +}: + +assert stdenv.isLinux; +assert stdenv.cc.cc.isGNU or false; + +stdenv.mkDerivation ((lib.optionalAttrs (! isNull buildScript) { + builder = buildScript; +}) // { + inherit name src configureFlags; + + buildInputs = lib.concatLists (map (pkgs: (with pkgs; [ + pkgconfig alsaLib ncurses libpng libjpeg lcms2 fontforge libxml2 libxslt + openssl gnutls cups makeWrapper flex bison mesa mesa_noglu.osmesa + ]) ++ (with pkgs.xlibs; [ + xlibs libXi libXcursor libXinerama libXrandr libXrender libXxf86vm libXcomposite + ])) pkgArches); + + # 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 + # LD_LIBRARY_PATH. + NIX_LDFLAGS = map (path: "-rpath ${path}/lib") ([ + stdenv.cc.cc + ] ++ (lib.concatLists (map (pkgs: + (with pkgs; [ + freetype fontconfig mesa mesa_noglu.osmesa libdrm + libpng libjpeg openssl gnutls cups ncurses + ]) ++ (with pkgs.xlibs; [ + libXinerama libXrender libXrandr libXcursor libXcomposite + ])) pkgArches))); + + # Don't shrink the ELF RPATHs in order to keep the extra RPATH + # elements specified above. + dontPatchELF = true; + + ## FIXME + # Add capability to ignore known failing tests + # and enable doCheck + doCheck = false; + + postInstall = let + links = prefix: pkg: "ln -s ${pkg} $out/${prefix}/${pkg.name}"; + in '' + mkdir -p $out/share/wine/gecko $out/share/wine/mono/ + ${lib.strings.concatStringsSep "\n" + ((map (links "share/wine/gecko") geckos) + ++ (map (links "share/wine/mono") monos))} + ''; + + enableParallelBuilding = true; + + meta = { + inherit version platforms; + homepage = "http://www.winehq.org/"; + license = "LGPL"; + description = "An Open Source implementation of the Windows API on top of X, OpenGL, and Unix"; + maintainers = [stdenv.lib.maintainers.raskin]; + }; +}) diff --git a/pkgs/misc/emulators/wine/builder-wow.sh b/pkgs/misc/emulators/wine/builder-wow.sh new file mode 100644 index 000000000000..9f946f3b71fd --- /dev/null +++ b/pkgs/misc/emulators/wine/builder-wow.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +source $stdenv/setup + +unpackPhase +patchPhase + +configureScript=$TMP/$sourceRoot/configure +mkdir -p $TMP/wine-wow $TMP/wine64 + +cd $TMP/wine64 +sourceRoot=`pwd` +configureFlags="--enable-win64" +configurePhase +buildPhase +# checkPhase + +cd $TMP/wine-wow +sourceRoot=`pwd` +configureFlags="--with-wine64=../wine64" +configurePhase +buildPhase +# checkPhase + +eval "$preInstall" +cd $TMP/wine64 && make install +cd $TMP/wine-wow && make install +eval "$postInstall" +fixupPhase diff --git a/pkgs/misc/emulators/wine/default.nix b/pkgs/misc/emulators/wine/default.nix new file mode 100644 index 000000000000..962aee9fb5d9 --- /dev/null +++ b/pkgs/misc/emulators/wine/default.nix @@ -0,0 +1,15 @@ +## Configuration: +# Control you default wine config in nixpkgs-config: +# wine = { +# release = "stable"; # "stable", "unstable" +# build = "wineWow"; # "wine32", "wine64", "wineWow" +# }; +# Make additional configurations on demand: +# wine.overrideConfig { build = "wine32"; }; +{ lib, system, callPackage, + wineRelease ? "stable", + wineBuild ? (if system == "x86_64-linux" then "wineWow" else "wine32") }: + +lib.getAttr wineBuild (callPackage ./packages.nix { + inherit wineRelease; +}) diff --git a/pkgs/misc/emulators/wine/packages.nix b/pkgs/misc/emulators/wine/packages.nix new file mode 100644 index 000000000000..4d95dc911dce --- /dev/null +++ b/pkgs/misc/emulators/wine/packages.nix @@ -0,0 +1,60 @@ +{ system, stdenv, stdenv_32bit, lib, pkgs, pkgsi686Linux, fetchurl, + wineRelease ? "stable" +}: + +let sources = with lib.getAttr wineRelease (import ./versions.nix); { + version = wineVersion; + src = fetchurl { + url = "mirror://sourceforge/wine/wine-${wineVersion}.tar.bz2"; + sha256 = wineSha256; + }; + + wineGecko32 = fetchurl { + url = "mirror://sourceforge/wine/wine_gecko-${geckoVersion}-x86.msi"; + sha256 = geckoSha256; + }; + + wineGecko64 = fetchurl { + url = "mirror://sourceforge/wine/wine_gecko-${gecko64Version}-x86_64.msi"; + sha256 = gecko64Sha256; + }; + + wineMono = fetchurl { + url = "mirror://sourceforge/wine/wine-mono-${monoVersion}.msi"; + sha256 = monoSha256; + }; + }; + inherit (sources) version; +in { + wine32 = import ./base.nix { + name = "wine32-${version}"; + inherit (sources) version src; + inherit (pkgsi686Linux) lib stdenv; + pkgArches = [ pkgsi686Linux ]; + geckos = with sources; [ wineGecko32 ]; + monos = with sources; [ wineMono ]; + platforms = [ "i686-linux" "x86_64-linux" ]; + }; + wine64 = import ./base.nix { + name = "wine64-${version}"; + inherit (sources) version src; + inherit lib stdenv; + pkgArches = [ pkgs ]; + geckos = with sources; [ wineGecko64 ]; + monos = with sources; [ wineMono ]; + configureFlags = "--enable-win64"; + platforms = [ "x86_64-linux" ]; + }; + wineWow = import ./base.nix { + name = "wineWow-${version}"; + inherit (sources) version src; + inherit lib; + stdenv = stdenv_32bit; + pkgArches = [ pkgs pkgsi686Linux ]; + geckos = with sources; [ wineGecko32 wineGecko64 ]; + monos = with sources; [ wineMono ]; + buildScript = ./builder-wow.sh; + platforms = [ "x86_64-linux" ]; + }; +} + diff --git a/pkgs/misc/emulators/wine/stable.nix b/pkgs/misc/emulators/wine/stable.nix deleted file mode 100644 index bdf696f541f9..000000000000 --- a/pkgs/misc/emulators/wine/stable.nix +++ /dev/null @@ -1,81 +0,0 @@ -{ stdenv, fetchurl, pkgconfig, xlibs, flex, bison, mesa, mesa_noglu, alsaLib -, ncurses, libpng, libjpeg, lcms2, freetype, fontconfig, fontforge -, libxml2, libxslt, openssl, gnutls, cups, libdrm, makeWrapper -}: - -assert stdenv.isLinux; -assert stdenv.cc.cc.isGNU or false; - -let - version = "1.6.2"; - name = "wine-${version}"; - - src = fetchurl { - url = "mirror://sourceforge/wine/${name}.tar.bz2"; - sha256 = "1gmc0ljgfz3qy50mdxcwwjcr2yrpz54jcs2hdszsrk50wpnrxazh"; - }; - - gecko = fetchurl { - url = "mirror://sourceforge/wine/wine_gecko-2.21-x86.msi"; - sha256 = "1n0zccnvchkg0m896sjx5psk4bxw9if32xyxib1rbfdasykay7zh"; - }; - - gecko64 = fetchurl { - url = "mirror://sourceforge/wine/wine_gecko-2.21-x86_64.msi"; - sha256 = "0grc86dkq90i59zw43hakh62ra1ajnk11m64667xjrlzi7f0ndxw"; - }; - - mono = fetchurl { - url = "mirror://sourceforge/wine/wine-mono-0.0.8.msi"; - sha256 = "00jl24qp7vh3hlqv7wsw1s529lr5p0ybif6s73jy85chqaxj7z1x"; - }; - -in stdenv.mkDerivation rec { - inherit version name src; - - buildInputs = [ - pkgconfig - xlibs.xlibs flex bison xlibs.libXi mesa mesa_noglu.osmesa - xlibs.libXcursor xlibs.libXinerama xlibs.libXrandr - xlibs.libXrender xlibs.libXxf86vm xlibs.libXcomposite - alsaLib ncurses libpng libjpeg lcms2 fontforge - libxml2 libxslt openssl gnutls cups makeWrapper - ]; - - # 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 - # LD_LIBRARY_PATH. - NIX_LDFLAGS = map (path: "-rpath ${path}/lib ") [ - freetype fontconfig stdenv.cc.cc mesa mesa_noglu.osmesa libdrm - xlibs.libXinerama xlibs.libXrender xlibs.libXrandr - xlibs.libXcursor xlibs.libXcomposite libpng libjpeg - openssl gnutls cups - ]; - - # Don't shrink the ELF RPATHs in order to keep the extra RPATH - # elements specified above. - dontPatchELF = true; - - postInstall = '' - install -D ${gecko} $out/share/wine/gecko/${gecko.name} - '' + stdenv.lib.optionalString (stdenv.system == "x86_64-linux") '' - install -D ${gecko} $out/share/wine/gecko/${gecko64.name} - '' + '' - install -D ${mono} $out/share/wine/mono/${mono.name} - - paxmark psmr $out/bin/wine{,-preloader} - - wrapProgram $out/bin/wine --prefix LD_LIBRARY_PATH : ${stdenv.cc.cc}/lib - ''; - - enableParallelBuilding = true; - - meta = { - homepage = "http://www.winehq.org/"; - license = "LGPL"; - inherit version; - description = "An Open Source implementation of the Windows API on top of X, OpenGL, and Unix"; - maintainers = [stdenv.lib.maintainers.raskin]; - platforms = stdenv.lib.platforms.linux; - }; -} diff --git a/pkgs/misc/emulators/wine/unstable.nix b/pkgs/misc/emulators/wine/unstable.nix deleted file mode 100644 index aac97fe05b8e..000000000000 --- a/pkgs/misc/emulators/wine/unstable.nix +++ /dev/null @@ -1,78 +0,0 @@ -{ stdenv, fetchurl, pkgconfig, xlibs, flex, bison, mesa, mesa_noglu, alsaLib -, ncurses, libpng, libjpeg, lcms, freetype, fontconfig, fontforge -, libxml2, libxslt, openssl, gnutls, cups, libdrm, makeWrapper -}: - -assert stdenv.isLinux; -assert stdenv.cc.cc.isGNU or false; - -let - version = "1.7.42"; - name = "wine-${version}"; - - src = fetchurl { - url = "mirror://sourceforge/wine/${name}.tar.bz2"; - sha256 = "18iv4dsx2p7bk5qhiqqc6fpnnzny9rx8vgbjlpnf3gr0n615qzss"; - }; - - gecko = fetchurl { - url = "mirror://sourceforge/wine/wine_gecko-2.36-x86.msi"; - sha256 = "12hjks32yz9jq4w3xhk3y1dy2g3iakqxd7aldrdj51cqiz75g95g"; - }; - - gecko64 = fetchurl { - url = "mirror://sourceforge/wine/wine_gecko-2.36-x86_64.msi"; - sha256 = "0i7dchrzsda4nqbkhp3rrchk74rc2whn2af1wzda517m9c0886vh"; - }; - - mono = fetchurl { - url = "mirror://sourceforge/wine/wine-mono-4.5.4.msi"; - sha256 = "1wnn273f232141x9x0sahg4w499x0g2p0xphxmwm5wh1xrzyvg10"; - }; - -in stdenv.mkDerivation rec { - inherit version name src; - - buildInputs = [ - pkgconfig - xlibs.xlibs flex bison xlibs.libXi mesa mesa_noglu.osmesa - xlibs.libXcursor xlibs.libXinerama xlibs.libXrandr - xlibs.libXrender xlibs.libXxf86vm xlibs.libXcomposite - alsaLib ncurses libpng libjpeg lcms fontforge - libxml2 libxslt openssl gnutls cups makeWrapper - ]; - - # 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 - # LD_LIBRARY_PATH. - NIX_LDFLAGS = map (path: "-rpath ${path}/lib ") [ - freetype fontconfig stdenv.cc.cc mesa mesa_noglu.osmesa libdrm - xlibs.libXinerama xlibs.libXrender xlibs.libXrandr - xlibs.libXcursor xlibs.libXcomposite libpng libjpeg - openssl gnutls cups ncurses - ]; - - # Don't shrink the ELF RPATHs in order to keep the extra RPATH - # elements specified above. - dontPatchELF = true; - - postInstall = '' - install -D ${gecko} $out/share/wine/gecko/${gecko.name} - '' + stdenv.lib.optionalString (stdenv.system == "x86_64-linux") '' - install -D ${gecko} $out/share/wine/gecko/${gecko64.name} - '' + '' - install -D ${mono} $out/share/wine/mono/${mono.name} - wrapProgram $out/bin/wine --prefix LD_LIBRARY_PATH : ${stdenv.cc.cc}/lib - ''; - - enableParallelBuilding = true; - - meta = { - homepage = "http://www.winehq.org/"; - license = "LGPL"; - inherit version; - description = "An Open Source implementation of the Windows API on top of X, OpenGL, and Unix"; - maintainers = [stdenv.lib.maintainers.raskin]; - platforms = stdenv.lib.platforms.linux; - }; -} diff --git a/pkgs/misc/emulators/wine/versions.nix b/pkgs/misc/emulators/wine/versions.nix new file mode 100644 index 000000000000..e599f04f8575 --- /dev/null +++ b/pkgs/misc/emulators/wine/versions.nix @@ -0,0 +1,25 @@ +{ + unstable = { + wineVersion = "1.7.42"; + wineSha256 = "18iv4dsx2p7bk5qhiqqc6fpnnzny9rx8vgbjlpnf3gr0n615qzss"; + geckoVersion = "2.36"; + geckoSha256 = "12hjks32yz9jq4w3xhk3y1dy2g3iakqxd7aldrdj51cqiz75g95g"; + gecko64Version = "2.36"; + gecko64Sha256 = "0i7dchrzsda4nqbkhp3rrchk74rc2whn2af1wzda517m9c0886vh"; + monoVersion = "4.5.6"; + monoSha256 = "09dwfccvfdp3walxzp6qvnyxdj2bbyw9wlh6cxw2sx43gxriys5c"; + }; + stable = { + wineVersion = "1.6.2"; + wineSha256 = "1gmc0ljgfz3qy50mdxcwwjcr2yrpz54jcs2hdszsrk50wpnrxazh"; + geckoVersion = "2.21"; + geckoSha256 = "1n0zccnvchkg0m896sjx5psk4bxw9if32xyxib1rbfdasykay7zh"; + gecko64Version = "2.21"; + gecko64Sha256 = "0grc86dkq90i59zw43hakh62ra1ajnk11m64667xjrlzi7f0ndxw"; + monoVersion = "4.5.6"; + monoSha256 = "09dwfccvfdp3walxzp6qvnyxdj2bbyw9wlh6cxw2sx43gxriys5c"; + ## TESTME wine stable should work with most recent mono + #monoVersion = "0.0.8"; + #monoSha256 = "00jl24qp7vh3hlqv7wsw1s529lr5p0ybif6s73jy85chqaxj7z1x"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4ba211f9e59a..716349d60741 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14345,27 +14345,25 @@ let VisualBoyAdvance = callPackage ../misc/emulators/VisualBoyAdvance { }; - # Wine cannot be built in 64-bit; use a 32-bit build instead. - wineStable = callPackage_i686 ../misc/emulators/wine/stable.nix { - bison = bison2; + # Wine defaults to a mixed 64 / 32 build on x86_64 and to pure 32 on x86 + wine = callPackage ../misc/emulators/wine { + wineRelease = config.wine.release or "stable"; + wineBuild = config.wine.build or (if system == "x86_64-linux" then "wineWow" else "wine32"); + }; + wineStable = wine.override { wineRelease = "stable"; }; + wineUnstable = wine.override { wineRelease = "unstable"; }; + + winetricks = callPackage ../misc/emulators/wine/winetricks.nix { + inherit (gnome2) zenity; }; - wineUnstable = lowPrio (callPackage_i686 ../misc/emulators/wine/unstable.nix { - bison = bison2; - }); - - wine = wineStable; - + ### FIXME integrate wineStaging into 64bit wineStaging = callPackage_i686 ../misc/emulators/wine/staging.nix { wine = pkgsi686Linux.wineUnstable; # Patent issues libtxc_dxtn = pkgsi686Linux.libtxc_dxtn_s2tc; }; - winetricks = callPackage ../misc/emulators/wine/winetricks.nix { - inherit (gnome2) zenity; - }; - wmutils-core = callPackage ../tools/X11/wmutils-core { }; wxmupen64plus = callPackage ../misc/emulators/wxmupen64plus { };