From 498ad3e8c09245f956c557c10a8f583e89972c29 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Thu, 21 Feb 2019 00:57:23 -0500 Subject: [PATCH 1/6] apparmor: use stdenv.lib.getDev for headers --- pkgs/os-specific/linux/apparmor/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/linux/apparmor/default.nix b/pkgs/os-specific/linux/apparmor/default.nix index 6cb0c123406e..ccad9795301d 100644 --- a/pkgs/os-specific/linux/apparmor/default.nix +++ b/pkgs/os-specific/linux/apparmor/default.nix @@ -82,8 +82,8 @@ let prePatch = prePatchCommon + '' substituteInPlace ./libraries/libapparmor/swig/perl/Makefile.am --replace install_vendor install_site substituteInPlace ./libraries/libapparmor/swig/perl/Makefile.in --replace install_vendor install_site - substituteInPlace ./libraries/libapparmor/src/Makefile.am --replace "/usr/include/netinet/in.h" "${stdenv.cc.libc.dev}/include/netinet/in.h" - substituteInPlace ./libraries/libapparmor/src/Makefile.in --replace "/usr/include/netinet/in.h" "${stdenv.cc.libc.dev}/include/netinet/in.h" + substituteInPlace ./libraries/libapparmor/src/Makefile.am --replace "/usr/include/netinet/in.h" "${stdenv.lib.getDev stdenv.cc.libc}/include/netinet/in.h" + substituteInPlace ./libraries/libapparmor/src/Makefile.in --replace "/usr/include/netinet/in.h" "${stdenv.lib.getDev stdenv.cc.libc}/include/netinet/in.h" ''; inherit patches; From bfb45e96b946b85690d270df6a187d1ad4b39f7d Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Thu, 21 Feb 2019 21:02:59 -0500 Subject: [PATCH 2/6] mesa: armv7a-linux supports mesa --- lib/systems/doubles.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index 58677c0bdd90..2cf06b6ac1c8 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -47,5 +47,5 @@ in rec { unix = filterDoubles predicates.isUnix; windows = filterDoubles predicates.isWindows; - mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux" "powerpc64le-linux"]; + mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "armv7a-linux" "aarch64-linux" "powerpc64le-linux"]; } From be6d030b98934e906930187d2073b5c85450b242 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Thu, 21 Feb 2019 23:58:23 -0500 Subject: [PATCH 3/6] llvm6: remove enableTargets These are no longer used. We build all targets now. --- pkgs/development/compilers/llvm/6/llvm.nix | 3 --- 1 file changed, 3 deletions(-) diff --git a/pkgs/development/compilers/llvm/6/llvm.nix b/pkgs/development/compilers/llvm/6/llvm.nix index f16f3f721379..049f58af06e0 100644 --- a/pkgs/development/compilers/llvm/6/llvm.nix +++ b/pkgs/development/compilers/llvm/6/llvm.nix @@ -14,9 +14,6 @@ , debugVersion ? false , enableManpages ? false , enableSharedLibraries ? true -# Mesa requires AMDGPU target -# BPF is used by bcc -, enableTargets ? [ stdenv.hostPlatform stdenv.targetPlatform "AMDGPU" "BPF" ] }: let From e36cd48b6e09863e2099a894ca28bedbbeefdf99 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 11 Feb 2019 19:32:11 -0500 Subject: [PATCH 4/6] =?UTF-8?q?llvm:=20don=E2=80=99t=20use=20targetPlatfor?= =?UTF-8?q?m?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LLVM should be target independent because it will work with all machine types. This is different from GCC where it needs to know what target to build ahead of time. --- pkgs/development/compilers/llvm/3.8/llvm.nix | 4 ++-- pkgs/development/compilers/llvm/3.9/llvm.nix | 4 ++-- pkgs/development/compilers/llvm/4/llvm.nix | 4 ++-- pkgs/development/compilers/llvm/6/llvm.nix | 2 +- pkgs/development/compilers/llvm/7/llvm.nix | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkgs/development/compilers/llvm/3.8/llvm.nix b/pkgs/development/compilers/llvm/3.8/llvm.nix index ca6723172d7a..261a1d0f94ca 100644 --- a/pkgs/development/compilers/llvm/3.8/llvm.nix +++ b/pkgs/development/compilers/llvm/3.8/llvm.nix @@ -79,8 +79,8 @@ in stdenv.mkDerivation rec { "-DLLVM_ENABLE_RTTI=ON" "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" - "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.targetPlatform.config}" - "-DTARGET_TRIPLE=${stdenv.targetPlatform.config}" + "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" + "-DTARGET_TRIPLE=${stdenv.hostPlatform.config}" ] ++ stdenv.lib.optional enableSharedLibraries [ "-DLLVM_LINK_LLVM_DYLIB=ON" ] ++ stdenv.lib.optional (!isDarwin) diff --git a/pkgs/development/compilers/llvm/3.9/llvm.nix b/pkgs/development/compilers/llvm/3.9/llvm.nix index 678ec759425d..6c935fd88de5 100644 --- a/pkgs/development/compilers/llvm/3.9/llvm.nix +++ b/pkgs/development/compilers/llvm/3.9/llvm.nix @@ -120,8 +120,8 @@ in stdenv.mkDerivation rec { "-DCOMPILER_RT_INCLUDE_TESTS=OFF" # FIXME: requires clang source code "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" - "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.targetPlatform.config}" - "-DTARGET_TRIPLE=${stdenv.targetPlatform.config}" + "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" + "-DTARGET_TRIPLE=${stdenv.hostPlatform.config}" ] ++ stdenv.lib.optional enableSharedLibraries [ "-DLLVM_LINK_LLVM_DYLIB=ON" ] ++ stdenv.lib.optional (!isDarwin) diff --git a/pkgs/development/compilers/llvm/4/llvm.nix b/pkgs/development/compilers/llvm/4/llvm.nix index aac9c4275ad4..5cd7901fe22c 100644 --- a/pkgs/development/compilers/llvm/4/llvm.nix +++ b/pkgs/development/compilers/llvm/4/llvm.nix @@ -100,8 +100,8 @@ in stdenv.mkDerivation (rec { "-DCOMPILER_RT_INCLUDE_TESTS=OFF" # FIXME: requires clang source code "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" - "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.targetPlatform.config}" - "-DTARGET_TRIPLE=${stdenv.targetPlatform.config}" + "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" + "-DTARGET_TRIPLE=${stdenv.hostPlatform.config}" ] ++ stdenv.lib.optional enableSharedLibraries "-DLLVM_LINK_LLVM_DYLIB=ON" diff --git a/pkgs/development/compilers/llvm/6/llvm.nix b/pkgs/development/compilers/llvm/6/llvm.nix index 049f58af06e0..1d96513a0ece 100644 --- a/pkgs/development/compilers/llvm/6/llvm.nix +++ b/pkgs/development/compilers/llvm/6/llvm.nix @@ -91,7 +91,7 @@ in stdenv.mkDerivation (rec { "-DLLVM_ENABLE_FFI=ON" "-DLLVM_ENABLE_RTTI=ON" "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" - "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.targetPlatform.config}" + "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly" "-DLLVM_ENABLE_DUMP=ON" ] ++ optionals enableSharedLibraries [ diff --git a/pkgs/development/compilers/llvm/7/llvm.nix b/pkgs/development/compilers/llvm/7/llvm.nix index 5bb629931fd5..32f4b7972e40 100644 --- a/pkgs/development/compilers/llvm/7/llvm.nix +++ b/pkgs/development/compilers/llvm/7/llvm.nix @@ -101,7 +101,7 @@ in stdenv.mkDerivation (rec { "-DLLVM_ENABLE_FFI=ON" "-DLLVM_ENABLE_RTTI=ON" "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" - "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.targetPlatform.config}" + "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly" "-DLLVM_ENABLE_DUMP=ON" ] ++ optionals enableSharedLibraries [ From 76474b2da7a4c5a3c2f28bbbb42ccea9339371de Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Thu, 31 Jan 2019 13:50:53 -0500 Subject: [PATCH 5/6] libpfm: use hostPlatform (cherry picked from commit 08f5b419b9efc77db044f8c1d725632552617966) --- pkgs/development/libraries/libpfm/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/libpfm/default.nix b/pkgs/development/libraries/libpfm/default.nix index d64591273bcc..bf1d26cf90d0 100644 --- a/pkgs/development/libraries/libpfm/default.nix +++ b/pkgs/development/libraries/libpfm/default.nix @@ -12,8 +12,8 @@ stdenv.mkDerivation rec { makeFlags = [ "PREFIX=${placeholder "out"}" "LDCONFIG=true" - "ARCH=${stdenv.targetPlatform.uname.processor}" - "SYS=${stdenv.targetPlatform.uname.system}" + "ARCH=${stdenv.hostPlatform.uname.processor}" + "SYS=${stdenv.hostPlatform.uname.system}" ]; NIX_CFLAGS_COMPILE = [ "-Wno-error" ]; From d665b8ccf3781d56d3cd23b767af67286e11e5db Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Fri, 22 Feb 2019 10:36:48 -0500 Subject: [PATCH 6/6] SDL{,2}: support building for android This should be picking up the OpenGL ES headers provided by the NDK. More testing is needed. --- pkgs/development/libraries/SDL/default.nix | 16 +++++++------- pkgs/development/libraries/SDL2/default.nix | 21 ++++++++++--------- .../libraries/mesa-glu/default.nix | 1 + pkgs/top-level/all-packages.nix | 14 +++++++++---- 4 files changed, 29 insertions(+), 23 deletions(-) diff --git a/pkgs/development/libraries/SDL/default.nix b/pkgs/development/libraries/SDL/default.nix index e2ff66a47084..007cd02957ba 100644 --- a/pkgs/development/libraries/SDL/default.nix +++ b/pkgs/development/libraries/SDL/default.nix @@ -1,8 +1,9 @@ { stdenv, config, libGLSupported, fetchurl, fetchpatch, pkgconfig, audiofile, libcap, libiconv , openglSupport ? libGLSupported, libGL, libGLU -, alsaSupport ? stdenv.isLinux, alsaLib -, x11Support ? !stdenv.isCygwin, libXext, libICE, libXrandr -, pulseaudioSupport ? config.pulseaudio or stdenv.isLinux, libpulseaudio +, alsaSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid, alsaLib +, x11Support ? !stdenv.isCygwin && !stdenv.hostPlatform.isAndroid +, libXext, libICE, libXrandr +, pulseaudioSupport ? config.pulseaudio or stdenv.isLinux && !stdenv.hostPlatform.isAndroid, libpulseaudio , OpenGL, CoreAudio, CoreServices, AudioUnit, Kernel, Cocoa , cf-private }: @@ -12,9 +13,6 @@ with stdenv.lib; -assert !stdenv.isDarwin -> alsaSupport || pulseaudioSupport; -assert openglSupport -> (stdenv.isDarwin || x11Support && libGL != null && libGLU != null); - stdenv.mkDerivation rec { name = "SDL-${version}"; version = "1.2.15"; @@ -30,18 +28,18 @@ stdenv.mkDerivation rec { outputs = [ "out" "dev" ]; outputBin = "dev"; # sdl-config - nativeBuildInputs = [ pkgconfig ]; + nativeBuildInputs = [ pkgconfig ] + ++ optional stdenv.isLinux libcap; propagatedBuildInputs = [ libiconv ] ++ optionals x11Support [ libXext libICE libXrandr ] - ++ optional stdenv.isLinux libcap ++ optionals openglSupport [ libGL libGLU ] ++ optional alsaSupport alsaLib ++ optional pulseaudioSupport libpulseaudio ++ optional stdenv.isDarwin Cocoa; buildInputs = [ ] - ++ optional (!stdenv.hostPlatform.isMinGW) audiofile + ++ optional (!stdenv.hostPlatform.isMinGW && alsaSupport) audiofile ++ optionals stdenv.isDarwin [ AudioUnit CoreAudio CoreServices Kernel OpenGL # Needed for NSDefaultRunLoopMode symbols. diff --git a/pkgs/development/libraries/SDL2/default.nix b/pkgs/development/libraries/SDL2/default.nix index d82b25fb8926..8f1b7d93d002 100644 --- a/pkgs/development/libraries/SDL2/default.nix +++ b/pkgs/development/libraries/SDL2/default.nix @@ -1,12 +1,16 @@ { stdenv, config, libGLSupported, fetchurl, pkgconfig , openglSupport ? libGLSupported, libGL -, alsaSupport ? stdenv.isLinux, alsaLib -, x11Support ? !stdenv.isCygwin, libX11, xorgproto, libICE, libXi, libXScrnSaver, libXcursor, libXinerama, libXext, libXxf86vm, libXrandr -, waylandSupport ? stdenv.isLinux, wayland, wayland-protocols, libxkbcommon -, dbusSupport ? stdenv.isLinux, dbus +, alsaSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid, alsaLib +, x11Support ? !stdenv.isCygwin && !stdenv.hostPlatform.isAndroid +, libX11, xorgproto, libICE, libXi, libXScrnSaver, libXcursor +, libXinerama, libXext, libXxf86vm, libXrandr +, waylandSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid +, wayland, wayland-protocols, libxkbcommon +, dbusSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid, dbus , udevSupport ? false, udev , ibusSupport ? false, ibus -, pulseaudioSupport ? config.pulseaudio or stdenv.isLinux, libpulseaudio +, pulseaudioSupport ? config.pulseaudio or stdenv.isLinux && !stdenv.hostPlatform.isAndroid +, libpulseaudio , AudioUnit, Cocoa, CoreAudio, CoreServices, ForceFeedback, OpenGL , audiofile, cf-private, libiconv }: @@ -16,9 +20,6 @@ with stdenv.lib; -assert !stdenv.isDarwin -> alsaSupport || pulseaudioSupport; -assert openglSupport -> (stdenv.isDarwin || x11Support && libGL != null); - stdenv.mkDerivation rec { name = "SDL2-${version}"; version = "2.0.9"; @@ -44,14 +45,14 @@ stdenv.mkDerivation rec { ++ optionals x11Support [ libX11 xorgproto ]; dlopenBuildInputs = [ ] - ++ optional alsaSupport alsaLib + ++ optionals alsaSupport [ alsaLib audiofile ] ++ optional dbusSupport dbus ++ optional pulseaudioSupport libpulseaudio ++ optional udevSupport udev ++ optionals waylandSupport [ wayland wayland-protocols libxkbcommon ] ++ optionals x11Support [ libICE libXi libXScrnSaver libXcursor libXinerama libXext libXrandr libXxf86vm ]; - buildInputs = [ audiofile libiconv ] + buildInputs = [ libiconv ] ++ dlopenBuildInputs ++ optional ibusSupport ibus ++ optionals stdenv.isDarwin [ diff --git a/pkgs/development/libraries/mesa-glu/default.nix b/pkgs/development/libraries/mesa-glu/default.nix index 4e35d6ed24d1..cb238a6a5ae0 100644 --- a/pkgs/development/libraries/mesa-glu/default.nix +++ b/pkgs/development/libraries/mesa-glu/default.nix @@ -22,5 +22,6 @@ stdenv.mkDerivation rec { homepage = https://cgit.freedesktop.org/mesa/glu/; license = stdenv.lib.licenses.sgi-b-20; platforms = stdenv.lib.platforms.unix; + broken = stdenv.hostPlatform.isAndroid; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4ca0101f3096..9ce80e4640e2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11650,8 +11650,11 @@ in ## libGL/libGLU/Mesa stuff - # Default libGL implementation, should provide headers and libGL.so/libEGL.so/... to link agains them - libGL = mesa_noglu.stubs; + # Default libGL implementation, should provide headers and + # libGL.so/libEGL.so/... to link agains them. Android NDK provides + # an OpenGL implementation, we can just use that. + libGL = if stdenv.hostPlatform.useAndroidPrebuilt then stdenv + else mesa_noglu.stubs; # Default libGLU libGLU = mesa_glu; @@ -12453,10 +12456,13 @@ in schroedinger = callPackage ../development/libraries/schroedinger { }; - SDL = callPackage ../development/libraries/SDL { + SDL = callPackage ../development/libraries/SDL ({ inherit (darwin) cf-private; inherit (darwin.apple_sdk.frameworks) OpenGL CoreAudio CoreServices AudioUnit Kernel Cocoa; - }; + } // lib.optionalAttrs stdenv.hostPlatform.isAndroid { + # libGLU doesn’t work with Android’s SDL + libGLU = null; + }); SDL_sixel = callPackage ../development/libraries/SDL_sixel { };