diff options
author | Katharina Fey <kookie@spacekookie.de> | 2019-10-05 12:43:18 +0000 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2019-10-05 12:44:52 +0000 |
commit | cf85056ba64caf3267d43255ef4a1243e9c8ee3b (patch) | |
tree | 3051519e9c8275b870aac43f80af875715c9d124 /nixpkgs/pkgs/misc/emulators/wine | |
parent | 1148b1d122bc03e9a3665856c9b7bb96bd4e3994 (diff) | |
parent | 2436c27541b2f52deea3a4c1691216a02152e729 (diff) |
Add 'nixpkgs/' from commit '2436c27541b2f52deea3a4c1691216a02152e729'
git-subtree-dir: nixpkgs
git-subtree-mainline: 1148b1d122bc03e9a3665856c9b7bb96bd4e3994
git-subtree-split: 2436c27541b2f52deea3a4c1691216a02152e729
Diffstat (limited to 'nixpkgs/pkgs/misc/emulators/wine')
-rw-r--r-- | nixpkgs/pkgs/misc/emulators/wine/base.nix | 139 | ||||
-rw-r--r-- | nixpkgs/pkgs/misc/emulators/wine/builder-wow.sh | 30 | ||||
-rw-r--r-- | nixpkgs/pkgs/misc/emulators/wine/default.nix | 67 | ||||
-rw-r--r-- | nixpkgs/pkgs/misc/emulators/wine/fonts.nix | 22 | ||||
-rw-r--r-- | nixpkgs/pkgs/misc/emulators/wine/packages.nix | 35 | ||||
-rw-r--r-- | nixpkgs/pkgs/misc/emulators/wine/sources.nix | 65 | ||||
-rw-r--r-- | nixpkgs/pkgs/misc/emulators/wine/staging.nix | 24 | ||||
-rw-r--r-- | nixpkgs/pkgs/misc/emulators/wine/util.nix | 9 | ||||
-rw-r--r-- | nixpkgs/pkgs/misc/emulators/wine/winetricks.nix | 32 |
9 files changed, 423 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/misc/emulators/wine/base.nix b/nixpkgs/pkgs/misc/emulators/wine/base.nix new file mode 100644 index 00000000000..01d09659915 --- /dev/null +++ b/nixpkgs/pkgs/misc/emulators/wine/base.nix @@ -0,0 +1,139 @@ +{ stdenv, lib, pkgArches, + name, version, src, monos, geckos, platforms, + pkgconfig, fontforge, makeWrapper, flex, bison, + supportFlags, + buildScript ? null, configureFlags ? [] +}: + +with import ./util.nix { inherit lib; }; + +stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) { + builder = buildScript; +}) // rec { + inherit name src configureFlags; + + nativeBuildInputs = [ + pkgconfig fontforge makeWrapper flex bison + ]; + + buildInputs = toBuildInputs pkgArches (with supportFlags; (pkgs: + [ pkgs.freetype ] + ++ lib.optional stdenv.isLinux pkgs.libcap + ++ 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.samba4 + ++ lib.optional cursesSupport pkgs.ncurses + ++ lib.optional vaSupport pkgs.libva + ++ lib.optional pcapSupport pkgs.libpcap + ++ lib.optional v4lSupport pkgs.libv4l + ++ lib.optional saneSupport pkgs.sane-backends + ++ 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 udevSupport pkgs.udev + ++ lib.optional vulkanSupport pkgs.vulkan-loader + ++ lib.optional sdlSupport pkgs.SDL2 + ++ lib.optionals gstreamerSupport (with pkgs.gst_all_1; + [ gstreamer gst-plugins-base gst-plugins-good gst-plugins-ugly gst-libav + (gst-plugins-bad.override { enableZbar = false; }) ]) + ++ lib.optionals gtkSupport [ pkgs.gtk3 pkgs.glib ] + ++ lib.optionals openclSupport [ pkgs.opencl-headers pkgs.ocl-icd ] + ++ lib.optionals xmlSupport [ pkgs.libxml2 pkgs.libxslt ] + ++ lib.optionals tlsSupport [ pkgs.openssl pkgs.gnutls ] + ++ lib.optionals openglSupport [ pkgs.libGLU_combined pkgs.mesa.osmesa pkgs.libdrm ] + ++ lib.optionals stdenv.isDarwin (with pkgs.buildPackages.darwin.apple_sdk.frameworks; [ + CoreServices Foundation ForceFeedback AppKit OpenGL IOKit DiskArbitration Security + ApplicationServices AudioToolbox CoreAudio AudioUnit CoreMIDI OpenAL OpenCL Cocoa Carbon + ]) + ++ lib.optionals stdenv.isLinux (with pkgs.xorg; [ + libXi libXcursor libXrandr libXrender libXxf86vm libXcomposite libXext + ]) + ++ [ pkgs.xorg.libX11 pkgs.perl ])); + + # 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) ( + map (x: "${lib.getLib x}/lib") ([ stdenv.cc.cc ] ++ buildInputs) + # libpulsecommon.so is linked but not found otherwise + ++ lib.optionals supportFlags.pulseaudioSupport (map (x: "${lib.getLib x}/lib/pulseaudio") + (toBuildInputs pkgArches (pkgs: [ pkgs.libpulseaudio ]))) + ); + + # Don't shrink the ELF RPATHs in order to keep the extra RPATH + # elements specified above. + dontPatchELF = true; + + # Disable stripping to avoid breaking placeholder DLLs/EXEs. + # Symptoms of broken placeholders are: when the wineprefix is created + # drive_c/windows/system32 will only contain a few files instead of + # hundreds, there will be an error about winemenubuilder and MountMgr + # on startup of Wine, and the Drives tab in winecfg will show an error. + dontStrip = 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))} + '' + lib.optionalString supportFlags.gstreamerSupport '' + # Wrapping Wine is tricky. + # https://github.com/NixOS/nixpkgs/issues/63170 + # https://github.com/NixOS/nixpkgs/issues/28486 + # The main problem is that wine-preloader opens and loads the wine(64) binary, and + # breakage occurs if it finds a shell script instead of the real binary. We solve this + # by setting WINELOADER to point to the original binary. Additionally, the locations + # of the 32-bit and 64-bit binaries must differ only by the presence of "64" at the + # end, due to the logic Wine uses to find the other binary (see get_alternate_loader + # in dlls/kernel32/process.c). Therefore we do not use wrapProgram which would move + # the binaries to ".wine-wrapped" and ".wine64-wrapped", but use makeWrapper directly, + # and move the binaries to ".wine" and ".wine64". + for i in wine wine64 ; do + prog="$out/bin/$i" + if [ -e "$prog" ]; then + hidden="$(dirname "$prog")/.$(basename "$prog")" + mv "$prog" "$hidden" + makeWrapper "$hidden" "$prog" \ + --argv0 "" \ + --set WINELOADER "$hidden" \ + --prefix GST_PLUGIN_SYSTEM_PATH_1_0 ":" "$GST_PLUGIN_SYSTEM_PATH_1_0" + fi + done + ''; + + enableParallelBuilding = true; + + # https://bugs.winehq.org/show_bug.cgi?id=43530 + # https://github.com/NixOS/nixpkgs/issues/31989 + hardeningDisable = [ "bindnow" ] + ++ lib.optional (stdenv.hostPlatform.isDarwin) "fortify"; + + passthru = { inherit pkgArches; }; + meta = { + inherit version platforms; + homepage = "https://www.winehq.org/"; + license = with stdenv.lib.licenses; [ lgpl21Plus ]; + description = "An Open Source implementation of the Windows API on top of X, OpenGL, and Unix"; + maintainers = with stdenv.lib.maintainers; [ avnik raskin bendlas ]; + }; +}) diff --git a/nixpkgs/pkgs/misc/emulators/wine/builder-wow.sh b/nixpkgs/pkgs/misc/emulators/wine/builder-wow.sh new file mode 100644 index 00000000000..c006db3116b --- /dev/null +++ b/nixpkgs/pkgs/misc/emulators/wine/builder-wow.sh @@ -0,0 +1,30 @@ +## build described at http://wiki.winehq.org/Wine64 + +source $stdenv/setup + +unpackPhase +cd $TMP/$sourceRoot +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/wine-wow && make install +cd $TMP/wine64 && make install +eval "$postInstall" +fixupPhase diff --git a/nixpkgs/pkgs/misc/emulators/wine/default.nix b/nixpkgs/pkgs/misc/emulators/wine/default.nix new file mode 100644 index 00000000000..6ecca6c2503 --- /dev/null +++ b/nixpkgs/pkgs/misc/emulators/wine/default.nix @@ -0,0 +1,67 @@ +## Configuration: +# Control you default wine config in nixpkgs-config: +# wine = { +# release = "stable"; # "stable", "unstable", "staging" +# build = "wineWow"; # "wine32", "wine64", "wineWow" +# }; +# Make additional configurations on demand: +# wine.override { wineBuild = "wine32"; wineRelease = "staging"; }; +{ lib, stdenv, callPackage, + wineRelease ? "stable", + wineBuild ? if stdenv.hostPlatform.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, + udevSupport ? false, + xineramaSupport ? false, + xmlSupport ? false, + vulkanSupport ? false, + sdlSupport ? false, +}: + +let wine-build = build: release: + lib.getAttr build (callPackage ./packages.nix { + wineRelease = release; + 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 udevSupport vulkanSupport sdlSupport; + }; + }); + +in if wineRelease == "staging" then + callPackage ./staging.nix { + inherit libtxc_dxtn_Name; + wineUnstable = wine-build wineBuild "unstable"; + } +else + wine-build wineBuild wineRelease diff --git a/nixpkgs/pkgs/misc/emulators/wine/fonts.nix b/nixpkgs/pkgs/misc/emulators/wine/fonts.nix new file mode 100644 index 00000000000..0ee1b3973d8 --- /dev/null +++ b/nixpkgs/pkgs/misc/emulators/wine/fonts.nix @@ -0,0 +1,22 @@ +{ stdenv, lib, callPackage }: +let src = (callPackage ./sources.nix {}).stable; +in +stdenv.mkDerivation { + pname = "wine-fonts"; + inherit (src) version; + + sourceRoot = "wine-${src.version}/fonts"; + inherit src; + + installPhase = '' + install *.ttf -Dt $out/share/fonts/wine + ''; + + meta = { + description = "Microsoft replacement fonts by the Wine project"; + homepage = "https://wiki.winehq.org/Create_Fonts"; + license = with lib.licenses; [ lgpl21Plus ]; + platforms = lib.platforms.all; + maintainers = with lib.maintainers; [ avnik raskin bendlas johnazoidberg ]; + }; +} diff --git a/nixpkgs/pkgs/misc/emulators/wine/packages.nix b/nixpkgs/pkgs/misc/emulators/wine/packages.nix new file mode 100644 index 00000000000..3ea60e62c66 --- /dev/null +++ b/nixpkgs/pkgs/misc/emulators/wine/packages.nix @@ -0,0 +1,35 @@ +{ stdenv_32bit, lib, pkgs, pkgsi686Linux, callPackage, + wineRelease ? "stable", + supportFlags +}: + +let src = lib.getAttr wineRelease (callPackage ./sources.nix {}); +in with src; { + wine32 = pkgsi686Linux.callPackage ./base.nix { + name = "wine-${version}"; + inherit src version supportFlags; + pkgArches = [ pkgsi686Linux ]; + geckos = [ gecko32 ]; + monos = [ mono ]; + platforms = [ "i686-linux" "x86_64-linux" ]; + }; + wine64 = callPackage ./base.nix { + name = "wine64-${version}"; + inherit src version supportFlags; + pkgArches = [ pkgs ]; + geckos = [ gecko64 ]; + monos = [ mono ]; + configureFlags = [ "--enable-win64" ]; + platforms = [ "x86_64-linux" "x86_64-darwin" ]; + }; + wineWow = callPackage ./base.nix { + name = "wine-wow-${version}"; + inherit src version supportFlags; + stdenv = stdenv_32bit; + pkgArches = [ pkgs pkgsi686Linux ]; + geckos = [ gecko32 gecko64 ]; + monos = [ mono ]; + buildScript = ./builder-wow.sh; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/nixpkgs/pkgs/misc/emulators/wine/sources.nix b/nixpkgs/pkgs/misc/emulators/wine/sources.nix new file mode 100644 index 00000000000..7b26bf44cdc --- /dev/null +++ b/nixpkgs/pkgs/misc/emulators/wine/sources.nix @@ -0,0 +1,65 @@ +{ pkgs ? import <nixpkgs> {} }: +## we default to importing <nixpkgs> here, so that you can use +## a simple shell command to insert new sha256's into this file +## e.g. with emacs C-u M-x shell-command +## +## nix-prefetch-url sources.nix -A {stable{,.mono,.gecko64,.gecko32}, unstable, staging, winetricks} + +# here we wrap fetchurl and fetchFromGitHub, in order to be able to pass additional args around it +let fetchurl = args@{url, sha256, ...}: + pkgs.fetchurl { inherit url sha256; } // args; + fetchFromGitHub = args@{owner, repo, rev, sha256, ...}: + pkgs.fetchFromGitHub { inherit owner repo rev sha256; } // args; +in rec { + + stable = fetchurl rec { + version = "4.0.2"; + url = "https://dl.winehq.org/wine/source/4.0/wine-${version}.tar.xz"; + sha256 = "0x5x9pvhryzhq1m7i8gx5wwwj341zz05zymadlhfw5w45xlm0h4r"; + + ## see http://wiki.winehq.org/Gecko + gecko32 = fetchurl rec { + version = "2.47"; + url = "http://dl.winehq.org/wine/wine-gecko/${version}/wine_gecko-${version}-x86.msi"; + sha256 = "0fk4fwb4ym8xn0i5jv5r5y198jbpka24xmxgr8hjv5b3blgkd2iv"; + }; + gecko64 = fetchurl rec { + version = "2.47"; + url = "http://dl.winehq.org/wine/wine-gecko/${version}/wine_gecko-${version}-x86_64.msi"; + sha256 = "0zaagqsji6zaag92fqwlasjs8v9hwjci5c2agn9m7a8fwljylrf5"; + }; + + ## see http://wiki.winehq.org/Mono + mono = fetchurl rec { + version = "4.9.2"; + url = "http://dl.winehq.org/wine/wine-mono/${version}/wine-mono-${version}.msi"; + sha256 = "0x7z0216j21bzc9v1q283qlsvbfzn92yiaf26ilh6bd7zib4c7xr"; + }; + }; + + unstable = fetchurl rec { + # NOTE: Don't forget to change the SHA256 for staging as well. + version = "4.16"; + url = "https://dl.winehq.org/wine/source/4.x/wine-${version}.tar.xz"; + sha256 = "17qxbddv23ibbayw1ai984m0dlq63cgplms2jhsc09incjhafywd"; + inherit (stable) mono gecko32 gecko64; + }; + + staging = fetchFromGitHub rec { + # https://github.com/wine-staging/wine-staging/releases + inherit (unstable) version; + sha256 = "0zkvwl6rxr6xcqk4a3h43cak67w6bcyqqnajz6azif07ir3z1c61"; + owner = "wine-staging"; + repo = "wine-staging"; + rev = "v${version}"; + }; + + winetricks = fetchFromGitHub rec { + # https://github.com/Winetricks/winetricks/releases + version = "20190912"; + sha256 = "08my9crgpj5ai77bm64v99x4kmdb9dl8fw14581n69id449v7gzv"; + owner = "Winetricks"; + repo = "winetricks"; + rev = version; + }; +} diff --git a/nixpkgs/pkgs/misc/emulators/wine/staging.nix b/nixpkgs/pkgs/misc/emulators/wine/staging.nix new file mode 100644 index 00000000000..5264e66279f --- /dev/null +++ b/nixpkgs/pkgs/misc/emulators/wine/staging.nix @@ -0,0 +1,24 @@ +{ stdenv, callPackage, wineUnstable, libtxc_dxtn_Name }: + +with callPackage ./util.nix {}; + +let patch = (callPackage ./sources.nix {}).staging; + build-inputs = pkgNames: extra: + (mkBuildInputs wineUnstable.pkgArches pkgNames) ++ extra; +in assert (builtins.parseDrvName wineUnstable.name).version == patch.version; + +stdenv.lib.overrideDerivation wineUnstable (self: { + buildInputs = build-inputs [ "perl" "utillinux" "autoconf" libtxc_dxtn_Name ] self.buildInputs; + + name = "${self.name}-staging"; + + postPatch = self.postPatch or "" + '' + patchShebangs tools + cp -r ${patch}/patches . + chmod +w patches + cd patches + patchShebangs gitapply.sh + ./patchinstall.sh DESTDIR="$PWD/.." --all + cd .. + ''; +}) diff --git a/nixpkgs/pkgs/misc/emulators/wine/util.nix b/nixpkgs/pkgs/misc/emulators/wine/util.nix new file mode 100644 index 00000000000..b90a68e72df --- /dev/null +++ b/nixpkgs/pkgs/misc/emulators/wine/util.nix @@ -0,0 +1,9 @@ +{ lib }: +rec { + toPackages = pkgNames: pkgs: + map (pn: lib.getAttr pn pkgs) pkgNames; + toBuildInputs = pkgArches: archPkgs: + lib.concatLists (map archPkgs pkgArches); + mkBuildInputs = pkgArches: pkgNames: + toBuildInputs pkgArches (toPackages pkgNames); +} diff --git a/nixpkgs/pkgs/misc/emulators/wine/winetricks.nix b/nixpkgs/pkgs/misc/emulators/wine/winetricks.nix new file mode 100644 index 00000000000..76606edf53c --- /dev/null +++ b/nixpkgs/pkgs/misc/emulators/wine/winetricks.nix @@ -0,0 +1,32 @@ +{ stdenv, callPackage, wine, perl, which, coreutils, zenity, curl +, cabextract, unzip, p7zip, gnused, gnugrep, bash } : + +stdenv.mkDerivation rec { + name = "winetricks-${src.version}"; + + src = (callPackage ./sources.nix {}).winetricks; + + buildInputs = [ perl which ]; + + # coreutils is for sha1sum + pathAdd = stdenv.lib.concatMapStringsSep ":" (x: x + "/bin") + [ wine perl which coreutils zenity curl cabextract unzip p7zip gnused gnugrep bash ]; + + makeFlags = [ "PREFIX=$(out)" ]; + + doCheck = false; # requires "bashate" + + postInstall = '' + sed -i \ + -e '2i PATH="${pathAdd}:$PATH"' \ + "$out/bin/winetricks" + ''; + + meta = { + description = "A script to install DLLs needed to work around problems in Wine"; + license = stdenv.lib.licenses.lgpl21; + homepage = https://github.com/Winetricks/winetricks; + maintainers = with stdenv.lib.maintainers; [ the-kenny ]; + platforms = with stdenv.lib.platforms; linux; + }; +} |