2019-10-07 10:22:33 +00:00
|
|
|
{ stdenv, lib, pkgArches, callPackage,
|
2020-11-09 23:33:43 +00:00
|
|
|
name, version, src, mingwGccs, monos, geckos, platforms,
|
2020-12-29 16:51:55 +00:00
|
|
|
bison, flex, fontforge, makeWrapper, pkg-config,
|
|
|
|
autoconf, hexdump, perl,
|
2016-05-29 08:43:47 +00:00
|
|
|
supportFlags,
|
2020-11-24 20:02:24 +00:00
|
|
|
patches,
|
2018-08-03 16:52:40 +00:00
|
|
|
buildScript ? null, configureFlags ? []
|
2015-04-21 16:00:59 +00:00
|
|
|
}:
|
|
|
|
|
2015-05-10 19:33:00 +00:00
|
|
|
with import ./util.nix { inherit lib; };
|
|
|
|
|
2019-10-07 10:22:33 +00:00
|
|
|
let
|
|
|
|
vkd3d = callPackage ./vkd3d.nix {};
|
2020-11-24 20:02:24 +00:00
|
|
|
patches' = patches;
|
2019-10-07 10:22:33 +00:00
|
|
|
in
|
2019-04-24 03:48:22 +00:00
|
|
|
stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) {
|
2015-04-21 16:00:59 +00:00
|
|
|
builder = buildScript;
|
2015-05-10 19:33:00 +00:00
|
|
|
}) // rec {
|
2015-04-21 16:00:59 +00:00
|
|
|
inherit name src configureFlags;
|
|
|
|
|
2020-11-09 23:33:43 +00:00
|
|
|
# Fixes "Compiler cannot create executables" building wineWow with mingwSupport
|
2020-12-29 16:51:55 +00:00
|
|
|
strictDeps = true;
|
2020-11-09 23:33:43 +00:00
|
|
|
|
2016-04-12 15:52:05 +00:00
|
|
|
nativeBuildInputs = [
|
2020-12-29 16:51:55 +00:00
|
|
|
bison
|
|
|
|
flex
|
|
|
|
fontforge
|
|
|
|
makeWrapper
|
|
|
|
pkg-config
|
|
|
|
|
|
|
|
# Required by staging
|
|
|
|
autoconf
|
|
|
|
hexdump
|
|
|
|
perl
|
2020-11-09 23:33:43 +00:00
|
|
|
]
|
|
|
|
++ lib.optionals supportFlags.mingwSupport mingwGccs;
|
2015-05-10 19:33:00 +00:00
|
|
|
|
2016-05-29 08:43:47 +00:00
|
|
|
buildInputs = toBuildInputs pkgArches (with supportFlags; (pkgs:
|
2020-12-29 16:51:55 +00:00
|
|
|
[ pkgs.freetype pkgs.perl pkgs.xorg.libX11 ]
|
2017-07-09 08:40:53 +00:00
|
|
|
++ lib.optional stdenv.isLinux pkgs.libcap
|
2016-05-29 08:43:47 +00:00
|
|
|
++ 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
|
2017-10-05 12:05:37 +00:00
|
|
|
++ lib.optional netapiSupport pkgs.samba4
|
2016-05-29 08:43:47 +00:00
|
|
|
++ lib.optional cursesSupport pkgs.ncurses
|
2018-02-09 04:05:38 +00:00
|
|
|
++ lib.optional vaSupport pkgs.libva
|
2016-05-29 08:43:47 +00:00
|
|
|
++ lib.optional pcapSupport pkgs.libpcap
|
|
|
|
++ lib.optional v4lSupport pkgs.libv4l
|
2018-03-13 00:47:10 +00:00
|
|
|
++ lib.optional saneSupport pkgs.sane-backends
|
2016-05-29 08:43:47 +00:00
|
|
|
++ lib.optional gsmSupport pkgs.gsm
|
|
|
|
++ lib.optional gphoto2Support pkgs.libgphoto2
|
|
|
|
++ lib.optional ldapSupport pkgs.openldap
|
|
|
|
++ lib.optional fontconfigSupport pkgs.fontconfig
|
2021-06-10 02:57:09 +00:00
|
|
|
++ lib.optional alsaSupport pkgs.alsa-lib
|
2016-05-29 08:43:47 +00:00
|
|
|
++ lib.optional pulseaudioSupport pkgs.libpulseaudio
|
|
|
|
++ lib.optional xineramaSupport pkgs.xorg.libXinerama
|
2017-05-23 23:07:23 +00:00
|
|
|
++ lib.optional udevSupport pkgs.udev
|
2018-04-23 14:02:12 +00:00
|
|
|
++ lib.optional vulkanSupport pkgs.vulkan-loader
|
2018-11-24 15:44:20 +00:00
|
|
|
++ lib.optional sdlSupport pkgs.SDL2
|
2019-10-07 10:22:33 +00:00
|
|
|
++ lib.optional faudioSupport pkgs.faudio
|
|
|
|
++ lib.optional vkd3dSupport vkd3d
|
2019-07-23 14:30:56 +00:00
|
|
|
++ lib.optionals gstreamerSupport (with pkgs.gst_all_1;
|
2019-10-07 10:22:33 +00:00
|
|
|
[ gstreamer gst-plugins-base gst-plugins-good gst-plugins-ugly gst-libav
|
2019-07-23 14:30:56 +00:00
|
|
|
(gst-plugins-bad.override { enableZbar = false; }) ])
|
2016-09-11 21:24:51 +00:00
|
|
|
++ lib.optionals gtkSupport [ pkgs.gtk3 pkgs.glib ]
|
2017-01-19 23:48:24 +00:00
|
|
|
++ lib.optionals openclSupport [ pkgs.opencl-headers pkgs.ocl-icd ]
|
2016-05-29 08:43:47 +00:00
|
|
|
++ lib.optionals xmlSupport [ pkgs.libxml2 pkgs.libxslt ]
|
|
|
|
++ lib.optionals tlsSupport [ pkgs.openssl pkgs.gnutls ]
|
2019-11-10 16:44:34 +00:00
|
|
|
++ lib.optionals openglSupport [ pkgs.libGLU pkgs.libGL pkgs.mesa.osmesa pkgs.libdrm ]
|
2018-05-17 07:21:23 +00:00
|
|
|
++ 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
|
2020-12-29 16:51:55 +00:00
|
|
|
])));
|
2015-04-21 16:00:59 +00:00
|
|
|
|
2020-11-24 20:02:24 +00:00
|
|
|
patches = [ ] ++ patches';
|
2020-01-24 11:21:11 +00:00
|
|
|
|
2015-04-21 16:00:59 +00:00
|
|
|
# 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.
|
2019-10-30 02:23:29 +00:00
|
|
|
NIX_LDFLAGS = toString (map (path: "-rpath " + path) (
|
2016-04-14 16:00:39 +00:00
|
|
|
map (x: "${lib.getLib x}/lib") ([ stdenv.cc.cc ] ++ buildInputs)
|
2016-04-12 15:30:28 +00:00
|
|
|
# libpulsecommon.so is linked but not found otherwise
|
2016-05-29 08:43:47 +00:00
|
|
|
++ lib.optionals supportFlags.pulseaudioSupport (map (x: "${lib.getLib x}/lib/pulseaudio")
|
2016-04-14 16:00:39 +00:00
|
|
|
(toBuildInputs pkgArches (pkgs: [ pkgs.libpulseaudio ])))
|
2019-10-30 02:23:29 +00:00
|
|
|
));
|
2015-04-21 16:00:59 +00:00
|
|
|
|
|
|
|
# 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;
|
2018-05-03 05:58:11 +00:00
|
|
|
|
2015-04-21 16:00:59 +00:00
|
|
|
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))}
|
2016-06-23 21:34:05 +00:00
|
|
|
'' + lib.optionalString supportFlags.gstreamerSupport ''
|
2019-06-26 16:38:14 +00:00
|
|
|
# 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" \
|
2017-05-27 11:12:36 +00:00
|
|
|
--argv0 "" \
|
2019-06-26 16:38:14 +00:00
|
|
|
--set WINELOADER "$hidden" \
|
2017-05-27 11:12:36 +00:00
|
|
|
--prefix GST_PLUGIN_SYSTEM_PATH_1_0 ":" "$GST_PLUGIN_SYSTEM_PATH_1_0"
|
|
|
|
fi
|
|
|
|
done
|
2015-04-21 16:00:59 +00:00
|
|
|
'';
|
2018-05-03 05:58:11 +00:00
|
|
|
|
2015-04-21 16:00:59 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2017-11-23 22:38:13 +00:00
|
|
|
# https://bugs.winehq.org/show_bug.cgi?id=43530
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/31989
|
2018-05-17 07:21:23 +00:00
|
|
|
hardeningDisable = [ "bindnow" ]
|
2020-11-09 23:33:43 +00:00
|
|
|
++ lib.optional (stdenv.hostPlatform.isDarwin) "fortify"
|
|
|
|
++ lib.optional (supportFlags.mingwSupport) "format";
|
2017-11-23 22:38:13 +00:00
|
|
|
|
2015-05-10 19:33:00 +00:00
|
|
|
passthru = { inherit pkgArches; };
|
2015-04-21 16:00:59 +00:00
|
|
|
meta = {
|
|
|
|
inherit version platforms;
|
2019-06-12 21:36:10 +00:00
|
|
|
homepage = "https://www.winehq.org/";
|
2021-01-15 13:21:58 +00:00
|
|
|
license = with lib.licenses; [ lgpl21Plus ];
|
2015-04-21 16:00:59 +00:00
|
|
|
description = "An Open Source implementation of the Windows API on top of X, OpenGL, and Unix";
|
2021-01-15 13:21:58 +00:00
|
|
|
maintainers = with lib.maintainers; [ avnik raskin bendlas ];
|
2021-04-29 14:34:54 +00:00
|
|
|
mainProgram = "wine";
|
2015-04-21 16:00:59 +00:00
|
|
|
};
|
|
|
|
})
|