summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorMatthew Justin Bauer <mjbauer95@gmail.com>2018-06-25 19:09:29 -0400
committerGitHub <noreply@github.com>2018-06-25 19:09:29 -0400
commit09c66f40454de7afceb2101105657e96def9133f (patch)
treece2c969ae6e0ae8f96b43f1d6168a053a3594cf8 /pkgs
parent889bb6873dfd8726fa76b148fb7ee3cf575ed645 (diff)
parent69cad91b5c34b9ff474e973d39dd114cd91e6e82 (diff)
downloadnixlib-09c66f40454de7afceb2101105657e96def9133f.tar
nixlib-09c66f40454de7afceb2101105657e96def9133f.tar.gz
nixlib-09c66f40454de7afceb2101105657e96def9133f.tar.bz2
nixlib-09c66f40454de7afceb2101105657e96def9133f.tar.lz
nixlib-09c66f40454de7afceb2101105657e96def9133f.tar.xz
nixlib-09c66f40454de7afceb2101105657e96def9133f.tar.zst
nixlib-09c66f40454de7afceb2101105657e96def9133f.zip
Merge pull request #42412 from obsidiansystems/even-more-android-fixes
Even more android fixes
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/compilers/ghc/8.4.3.nix10
-rw-r--r--pkgs/development/libraries/libiconv/default.nix9
-rw-r--r--pkgs/development/mobile/androidenv/androidndk-pkgs.nix8
-rw-r--r--pkgs/development/mobile/androidenv/androidndk.nix6
-rw-r--r--pkgs/development/mobile/androidenv/androidndk_r8e.nix5
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix14
-rw-r--r--pkgs/top-level/impure.nix3
7 files changed, 43 insertions, 12 deletions
diff --git a/pkgs/development/compilers/ghc/8.4.3.nix b/pkgs/development/compilers/ghc/8.4.3.nix
index 10035af90a89..0f5a43d57eda 100644
--- a/pkgs/development/compilers/ghc/8.4.3.nix
+++ b/pkgs/development/compilers/ghc/8.4.3.nix
@@ -22,7 +22,7 @@
 
 , # Whether to build dynamic libs for the standard library (on the target
   # platform). Static libs are always built.
-  enableShared ? !targetPlatform.isWindows && !targetPlatform.useAndroidPrebuilt && !targetPlatform.useiOSPrebuilt
+  enableShared ? !targetPlatform.isWindows && !targetPlatform.useiOSPrebuilt
 
 , # Whetherto build terminfo.
   enableTerminfo ? !targetPlatform.isWindows
@@ -75,7 +75,7 @@ let
   targetCC = builtins.head toolsForTarget;
 
 in
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (rec {
   version = "8.4.3";
   name = "${targetPrefix}ghc-${version}";
 
@@ -209,4 +209,8 @@ stdenv.mkDerivation rec {
     inherit (ghc.meta) license platforms;
   };
 
-}
+} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
+  dontStrip = true;
+  dontPatchELF = true;
+  noAuditTmpdir = true;
+})
diff --git a/pkgs/development/libraries/libiconv/default.nix b/pkgs/development/libraries/libiconv/default.nix
index 169a4d38bb53..0e900ca9db64 100644
--- a/pkgs/development/libraries/libiconv/default.nix
+++ b/pkgs/development/libraries/libiconv/default.nix
@@ -1,6 +1,7 @@
 { fetchurl, stdenv, lib
 , buildPlatform, hostPlatform
 , enableStatic ? stdenv.hostPlatform.useAndroidPrebuilt
+, enableShared ? !stdenv.hostPlatform.useAndroidPrebuilt
 }:
 
 # assert !stdenv.isLinux || hostPlatform != buildPlatform; # TODO: improve on cross
@@ -23,10 +24,14 @@ stdenv.mkDerivation rec {
     lib.optionalString ((hostPlatform != buildPlatform && hostPlatform.libc == "msvcrt") || stdenv.cc.nativeLibc)
       ''
         sed '/^_GL_WARN_ON_USE (gets/d' -i srclib/stdio.in.h
-      '';
+      ''
+    + lib.optionalString (!enableShared) ''
+      sed -i -e '/preload/d' Makefile.in
+    '';
 
   configureFlags = lib.optional stdenv.isFreeBSD "--with-pic"
-    ++ lib.optional enableStatic "--enable-static";
+    ++ lib.optional enableStatic "--enable-static"
+    ++ lib.optional (!enableShared) "--disable-shared";
 
   meta = {
     description = "An iconv(3) implementation";
diff --git a/pkgs/development/mobile/androidenv/androidndk-pkgs.nix b/pkgs/development/mobile/androidenv/androidndk-pkgs.nix
index 5c42f7bc3289..0f43705c0d42 100644
--- a/pkgs/development/mobile/androidenv/androidndk-pkgs.nix
+++ b/pkgs/development/mobile/androidenv/androidndk-pkgs.nix
@@ -58,13 +58,19 @@ rec {
   binutils = wrapBintoolsWith {
     bintools = binaries;
     libc = targetAndroidndkPkgs.libraries;
+    extraBuildCommands = ''
+      echo "--build-id" >> $out/nix-support/libc-ldflags
+    '';
   };
 
   gcc = wrapCCWith {
     cc = binaries;
     bintools = binutils;
     libc = targetAndroidndkPkgs.libraries;
-    extraBuildCommands = lib.optionalString targetPlatform.isAarch32 (let
+    extraBuildCommands = ''
+      echo "-D__ANDROID_API__=${targetPlatform.sdkVer}" >> $out/nix-support/cc-cflags
+    ''
+    + lib.optionalString targetPlatform.isAarch32 (let
         p =  targetPlatform.platform.gcc or {}
           // targetPlatform.parsed.abi;
         flags = lib.concatLists [
diff --git a/pkgs/development/mobile/androidenv/androidndk.nix b/pkgs/development/mobile/androidenv/androidndk.nix
index 150d8d758699..1e8ea65c73d9 100644
--- a/pkgs/development/mobile/androidenv/androidndk.nix
+++ b/pkgs/development/mobile/androidenv/androidndk.nix
@@ -1,6 +1,9 @@
 { stdenv, fetchurl, zlib, ncurses5, unzip, lib, makeWrapper
 , coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which
 , platformTools, python3, libcxx, version, sha256
+, fullNDK ? false # set to true if you want other parts of the NDK
+                  # that is not used by Nixpkgs like sources,
+                  # examples, docs, or LLVM toolchains
 }:
 
 stdenv.mkDerivation rec {
@@ -55,11 +58,14 @@ stdenv.mkDerivation rec {
     }
     cd ${pkg_path}
 
+  '' + lib.optionalString (!fullNDK) ''
     # Steps to reduce output size
     rm -rf docs sources tests
     # We only support cross compiling with gcc for now
     rm -rf toolchains/*-clang* toolchains/llvm*
+  '' +
 
+  ''
     find ${pkg_path}/toolchains \( \
         \( -type f -a -name "*.so*" \) -o \
         \( -type f -a -perm -0100 \) \
diff --git a/pkgs/development/mobile/androidenv/androidndk_r8e.nix b/pkgs/development/mobile/androidenv/androidndk_r8e.nix
index 44fa961b992f..3c12e16277d9 100644
--- a/pkgs/development/mobile/androidenv/androidndk_r8e.nix
+++ b/pkgs/development/mobile/androidenv/androidndk_r8e.nix
@@ -1,6 +1,9 @@
 { stdenv, fetchurl, zlib, ncurses, lib, makeWrapper
 , coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which
 , platformTools
+, fullNDK ? false # set to true if you want other parts of the NDK
+                  # that is not used by Nixpkgs like sources,
+                  # examples, docs, or LLVM toolchains
 }:
 
 stdenv.mkDerivation rec {
@@ -49,11 +52,13 @@ stdenv.mkDerivation rec {
         -d $out/libexec/${name} < ${ ./make-standalone-toolchain_r8e.patch }
     cd ${pkg_path}
 
+  '' + lib.optionalString (!fullNDK) ''
     # Steps to reduce output size
     rm -rf docs sources tests
     # We only support cross compiling with gcc for now
     rm -rf toolchains/*-clang* toolchains/llvm-*
 
+  '' + ''
     find ${pkg_path}/toolchains \( \
         \( -type f -a -name "*.so*" \) -o \
         \( -type f -a -perm -0100 \) \
diff --git a/pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix b/pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix
index bb9e4fa755db..369556fd5a1c 100644
--- a/pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix
+++ b/pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix
@@ -1,15 +1,19 @@
-{ stdenv, appleDerivation, autoreconfHook, targetPlatform, enableStatic ? targetPlatform.isiOS }:
+{ stdenv, appleDerivation, lib, autoreconfHook, targetPlatform
+, enableStatic ? targetPlatform.isiOS
+, enableShared ? !targetPlatform.isiOS
+}:
 
 appleDerivation {
   postUnpack = "sourceRoot=$sourceRoot/libiconv";
 
-  preConfigure = stdenv.lib.optionalString stdenv.hostPlatform.isiOS ''
+  preConfigure = lib.optionalString stdenv.hostPlatform.isiOS ''
     sed -i 's/darwin\*/ios\*/g' configure libcharset/configure
   '';
 
-  configureFlags = stdenv.lib.optionals enableStatic [ "--enable-static" "--disable-shared" ];
+  configureFlags = lib.optional enableStatic "--enable-static"
+                ++ lib.optional (!enableShared) "--disable-shared";
 
-  postInstall = stdenv.lib.optionalString (!enableStatic) ''
+  postInstall = lib.optionalString (!enableStatic) ''
     mv $out/lib/libiconv.dylib $out/lib/libiconv-nocharset.dylib
     ${stdenv.cc.bintools.targetPrefix}install_name_tool -id $out/lib/libiconv-nocharset.dylib $out/lib/libiconv-nocharset.dylib
 
@@ -26,6 +30,6 @@ appleDerivation {
   ];
 
   meta = {
-    platforms = stdenv.lib.platforms.darwin;
+    platforms = lib.platforms.darwin;
   };
 }
diff --git a/pkgs/top-level/impure.nix b/pkgs/top-level/impure.nix
index df462665dd16..dafa351c4e41 100644
--- a/pkgs/top-level/impure.nix
+++ b/pkgs/top-level/impure.nix
@@ -83,5 +83,6 @@ import ./. (builtins.removeAttrs args [ "system" "platform" ] // {
   inherit config overlays crossSystem;
   # Fallback: Assume we are building packages on the current (build, in GNU
   # Autotools parlance) system.
-  localSystem = { system = builtins.currentSystem; } // localSystem;
+  localSystem = (if args ? localSystem then {}
+                 else { system = builtins.currentSystem; }) // localSystem;
 })