git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #42412 from obsidiansystems/even-more-android-fixes

Even more android fixes

commit09c66f40454de7afceb2101105657e96def9133f authorMatthew Justin Bauer <mjbauer95@gmail.com> dateMon 25 Jun 2018, 19:09 (8 years ago) parent889bb6869cad91
7 files changed+43−12
pkgs/development/compilers/ghc/8.4.3.nix+7−3 pkgs/development/libraries/libiconv/default.nix+7−2 pkgs/development/mobile/androidenv/androidndk-pkgs.nix+7−1 pkgs/development/mobile/androidenv/androidndk.nix+6 pkgs/development/mobile/androidenv/androidndk_r8e.nix+5 pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix+9−5 pkgs/top-level/impure.nix+2−1
pkgs/development/compilers/ghc/8.4.3.nix+7−3
@@ -22,7 +22,7 @@
2222
2323, # Whether to build dynamic libs for the standard library (on the target
2424 # platform). Static libs are always built.
25− enableShared ? !targetPlatform.isWindows && !targetPlatform.useAndroidPrebuilt && !targetPlatform.useiOSPrebuilt
25+ enableShared ? !targetPlatform.isWindows && !targetPlatform.useiOSPrebuilt
2626
2727, # Whetherto build terminfo.
2828 enableTerminfo ? !targetPlatform.isWindows
@@ -75,7 +75,7 @@ let
7575 targetCC = builtins.head toolsForTarget;
7676
7777in
78−stdenv.mkDerivation rec {
78+stdenv.mkDerivation (rec {
7979 version = "8.4.3";
8080 name = "${targetPrefix}ghc-${version}";
8181
@@ -209,4 +209,8 @@ stdenv.mkDerivation rec {
209209 inherit (ghc.meta) license platforms;
210210 };
211211
212−}
212+} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
213+ dontStrip = true;
214+ dontPatchELF = true;
215+ noAuditTmpdir = true;
216+})
pkgs/development/libraries/libiconv/default.nix+7−2
@@ -1,6 +1,7 @@
11{ fetchurl, stdenv, lib
22, buildPlatform, hostPlatform
33, enableStatic ? stdenv.hostPlatform.useAndroidPrebuilt
4+, enableShared ? !stdenv.hostPlatform.useAndroidPrebuilt
45}:
56
67# assert !stdenv.isLinux || hostPlatform != buildPlatform; # TODO: improve on cross
@@ -23,10 +24,14 @@ stdenv.mkDerivation rec {
2324 lib.optionalString ((hostPlatform != buildPlatform && hostPlatform.libc == "msvcrt") || stdenv.cc.nativeLibc)
2425 ''
2526 sed '/^_GL_WARN_ON_USE (gets/d' -i srclib/stdio.in.h
26− '';
27+ ''
28+ + lib.optionalString (!enableShared) ''
29+ sed -i -e '/preload/d' Makefile.in
30+ '';
2731
2832 configureFlags = lib.optional stdenv.isFreeBSD "--with-pic"
29− ++ lib.optional enableStatic "--enable-static";
33+ ++ lib.optional enableStatic "--enable-static"
34+ ++ lib.optional (!enableShared) "--disable-shared";
3035
3136 meta = {
3237 description = "An iconv(3) implementation";
pkgs/development/mobile/androidenv/androidndk-pkgs.nix+7−1
@@ -58,13 +58,19 @@ rec {
5858 binutils = wrapBintoolsWith {
5959 bintools = binaries;
6060 libc = targetAndroidndkPkgs.libraries;
61+ extraBuildCommands = ''
62+ echo "--build-id" >> $out/nix-support/libc-ldflags
63+ '';
6164 };
6265
6366 gcc = wrapCCWith {
6467 cc = binaries;
6568 bintools = binutils;
6669 libc = targetAndroidndkPkgs.libraries;
67− extraBuildCommands = lib.optionalString targetPlatform.isAarch32 (let
70+ extraBuildCommands = ''
71+ echo "-D__ANDROID_API__=${targetPlatform.sdkVer}" >> $out/nix-support/cc-cflags
72+ ''
73+ + lib.optionalString targetPlatform.isAarch32 (let
6874 p = targetPlatform.platform.gcc or {}
6975 // targetPlatform.parsed.abi;
7076 flags = lib.concatLists [
pkgs/development/mobile/androidenv/androidndk.nix+6
@@ -1,6 +1,9 @@
11{ stdenv, fetchurl, zlib, ncurses5, unzip, lib, makeWrapper
22, coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which
33, platformTools, python3, libcxx, version, sha256
4+, fullNDK ? false # set to true if you want other parts of the NDK
5+ # that is not used by Nixpkgs like sources,
6+ # examples, docs, or LLVM toolchains
47}:
58
69stdenv.mkDerivation rec {
@@ -55,11 +58,14 @@ stdenv.mkDerivation rec {
5558 }
5659 cd ${pkg_path}
5760
61+ '' + lib.optionalString (!fullNDK) ''
5862 # Steps to reduce output size
5963 rm -rf docs sources tests
6064 # We only support cross compiling with gcc for now
6165 rm -rf toolchains/*-clang* toolchains/llvm*
66+ '' +
6267
68+ ''
6369 find ${pkg_path}/toolchains \( \
6470 \( -type f -a -name "*.so*" \) -o \
6571 \( -type f -a -perm -0100 \) \
pkgs/development/mobile/androidenv/androidndk_r8e.nix+5
@@ -1,6 +1,9 @@
11{ stdenv, fetchurl, zlib, ncurses, lib, makeWrapper
22, coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which
33, platformTools
4+, fullNDK ? false # set to true if you want other parts of the NDK
5+ # that is not used by Nixpkgs like sources,
6+ # examples, docs, or LLVM toolchains
47}:
58
69stdenv.mkDerivation rec {
@@ -49,11 +52,13 @@ stdenv.mkDerivation rec {
4952 -d $out/libexec/${name} < ${ ./make-standalone-toolchain_r8e.patch }
5053 cd ${pkg_path}
5154
55+ '' + lib.optionalString (!fullNDK) ''
5256 # Steps to reduce output size
5357 rm -rf docs sources tests
5458 # We only support cross compiling with gcc for now
5559 rm -rf toolchains/*-clang* toolchains/llvm-*
5660
61+ '' + ''
5762 find ${pkg_path}/toolchains \( \
5863 \( -type f -a -name "*.so*" \) -o \
5964 \( -type f -a -perm -0100 \) \
pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix+9−5
@@ -1,15 +1,19 @@
1−{ stdenv, appleDerivation, autoreconfHook, targetPlatform, enableStatic ? targetPlatform.isiOS }:
1+{ stdenv, appleDerivation, lib, autoreconfHook, targetPlatform
2+, enableStatic ? targetPlatform.isiOS
3+, enableShared ? !targetPlatform.isiOS
4+}:
25
36appleDerivation {
47 postUnpack = "sourceRoot=$sourceRoot/libiconv";
58
6− preConfigure = stdenv.lib.optionalString stdenv.hostPlatform.isiOS ''
9+ preConfigure = lib.optionalString stdenv.hostPlatform.isiOS ''
710 sed -i 's/darwin\*/ios\*/g' configure libcharset/configure
811 '';
912
10− configureFlags = stdenv.lib.optionals enableStatic [ "--enable-static" "--disable-shared" ];
13+ configureFlags = lib.optional enableStatic "--enable-static"
14+ ++ lib.optional (!enableShared) "--disable-shared";
1115
12− postInstall = stdenv.lib.optionalString (!enableStatic) ''
16+ postInstall = lib.optionalString (!enableStatic) ''
1317 mv $out/lib/libiconv.dylib $out/lib/libiconv-nocharset.dylib
1418 ${stdenv.cc.bintools.targetPrefix}install_name_tool -id $out/lib/libiconv-nocharset.dylib $out/lib/libiconv-nocharset.dylib
1519
@@ -26,6 +30,6 @@ appleDerivation {
2630 ];
2731
2832 meta = {
29− platforms = stdenv.lib.platforms.darwin;
33+ platforms = lib.platforms.darwin;
3034 };
3135}
pkgs/top-level/impure.nix+2−1
@@ -83,5 +83,6 @@ import ./. (builtins.removeAttrs args [ "system" "platform" ] // {
8383 inherit config overlays crossSystem;
8484 # Fallback: Assume we are building packages on the current (build, in GNU
8585 # Autotools parlance) system.
86− localSystem = { system = builtins.currentSystem; } // localSystem;
86+ localSystem = (if args ? localSystem then {}
87+ else { system = builtins.currentSystem; }) // localSystem;
8788})