1{ stdenv, lib, pkgArches,
2 name, version, src, monos, geckos, platforms,
3 buildScript ? null, configureFlags ? ""
4}:
5
6assert stdenv.isLinux;
7assert stdenv.cc.cc.isGNU or false;
8
9with import ./util.nix { inherit lib; };
10
11stdenv.mkDerivation ((lib.optionalAttrs (! isNull buildScript) {
12 builder = buildScript;
13}) // rec {
14 inherit name src configureFlags;
15
16 buildInputs = toBuildInputs pkgArches (pkgs: with pkgs; [
17 pkgconfig alsaLib lcms2 fontforge libxml2 libxslt makeWrapper flex bison
18 ]);
19
20 nativeBuildInputs = toBuildInputs pkgArches (pkgs: (with pkgs; [
21 freetype fontconfig mesa mesa_noglu.osmesa libdrm libpng libjpeg openssl gnutls cups ncurses
22 ]) ++ (with pkgs.xorg; [
23 xlibsWrapper libXi libXcursor libXinerama libXrandr libXrender libXxf86vm libXcomposite
24 ]));
25
26 # Wine locates a lot of libraries dynamically through dlopen(). Add
27 # them to the RPATH so that the user doesn't have to set them in
28 # LD_LIBRARY_PATH.
29 NIX_LDFLAGS = map
30 (path: "-rpath ${path}/lib")
31 ([ stdenv.cc.cc ] ++ nativeBuildInputs);
32
33 # Don't shrink the ELF RPATHs in order to keep the extra RPATH
34 # elements specified above.
35 dontPatchELF = true;
36
37 ## FIXME
38 # Add capability to ignore known failing tests
39 # and enable doCheck
40 doCheck = false;
41
42 postInstall = let
43 links = prefix: pkg: "ln -s ${pkg} $out/${prefix}/${pkg.name}";
44 in ''
45 mkdir -p $out/share/wine/gecko $out/share/wine/mono/
46 ${lib.strings.concatStringsSep "\n"
47 ((map (links "share/wine/gecko") geckos)
48 ++ (map (links "share/wine/mono") monos))}
49 '';
50
51 enableParallelBuilding = true;
52
53 passthru = { inherit pkgArches; };
54 meta = {
55 inherit version platforms;
56 homepage = "http://www.winehq.org/";
57 license = "LGPL";
58 description = "An Open Source implementation of the Windows API on top of X, OpenGL, and Unix";
59 maintainers = [stdenv.lib.maintainers.raskin];
60 };
61})