Merge pull request #42412 from obsidiansystems/even-more-android-fixes

Even more android fixes
This commit is contained in:
Matthew Justin Bauer 2018-06-25 19:09:29 -04:00 committed by GitHub
commit 09c66f4045
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 43 additions and 12 deletions

View File

@ -22,7 +22,7 @@
, # Whether to build dynamic libs for the standard library (on the target , # Whether to build dynamic libs for the standard library (on the target
# platform). Static libs are always built. # platform). Static libs are always built.
enableShared ? !targetPlatform.isWindows && !targetPlatform.useAndroidPrebuilt && !targetPlatform.useiOSPrebuilt enableShared ? !targetPlatform.isWindows && !targetPlatform.useiOSPrebuilt
, # Whetherto build terminfo. , # Whetherto build terminfo.
enableTerminfo ? !targetPlatform.isWindows enableTerminfo ? !targetPlatform.isWindows
@ -75,7 +75,7 @@ let
targetCC = builtins.head toolsForTarget; targetCC = builtins.head toolsForTarget;
in in
stdenv.mkDerivation rec { stdenv.mkDerivation (rec {
version = "8.4.3"; version = "8.4.3";
name = "${targetPrefix}ghc-${version}"; name = "${targetPrefix}ghc-${version}";
@ -209,4 +209,8 @@ stdenv.mkDerivation rec {
inherit (ghc.meta) license platforms; inherit (ghc.meta) license platforms;
}; };
} } // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
dontStrip = true;
dontPatchELF = true;
noAuditTmpdir = true;
})

View File

@ -1,6 +1,7 @@
{ fetchurl, stdenv, lib { fetchurl, stdenv, lib
, buildPlatform, hostPlatform , buildPlatform, hostPlatform
, enableStatic ? stdenv.hostPlatform.useAndroidPrebuilt , enableStatic ? stdenv.hostPlatform.useAndroidPrebuilt
, enableShared ? !stdenv.hostPlatform.useAndroidPrebuilt
}: }:
# assert !stdenv.isLinux || hostPlatform != buildPlatform; # TODO: improve on cross # 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) lib.optionalString ((hostPlatform != buildPlatform && hostPlatform.libc == "msvcrt") || stdenv.cc.nativeLibc)
'' ''
sed '/^_GL_WARN_ON_USE (gets/d' -i srclib/stdio.in.h 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" configureFlags = lib.optional stdenv.isFreeBSD "--with-pic"
++ lib.optional enableStatic "--enable-static"; ++ lib.optional enableStatic "--enable-static"
++ lib.optional (!enableShared) "--disable-shared";
meta = { meta = {
description = "An iconv(3) implementation"; description = "An iconv(3) implementation";

View File

@ -58,13 +58,19 @@ rec {
binutils = wrapBintoolsWith { binutils = wrapBintoolsWith {
bintools = binaries; bintools = binaries;
libc = targetAndroidndkPkgs.libraries; libc = targetAndroidndkPkgs.libraries;
extraBuildCommands = ''
echo "--build-id" >> $out/nix-support/libc-ldflags
'';
}; };
gcc = wrapCCWith { gcc = wrapCCWith {
cc = binaries; cc = binaries;
bintools = binutils; bintools = binutils;
libc = targetAndroidndkPkgs.libraries; 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 {} p = targetPlatform.platform.gcc or {}
// targetPlatform.parsed.abi; // targetPlatform.parsed.abi;
flags = lib.concatLists [ flags = lib.concatLists [

View File

@ -1,6 +1,9 @@
{ stdenv, fetchurl, zlib, ncurses5, unzip, lib, makeWrapper { stdenv, fetchurl, zlib, ncurses5, unzip, lib, makeWrapper
, coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which , coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which
, platformTools, python3, libcxx, version, sha256 , 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 { stdenv.mkDerivation rec {
@ -55,11 +58,14 @@ stdenv.mkDerivation rec {
} }
cd ${pkg_path} cd ${pkg_path}
'' + lib.optionalString (!fullNDK) ''
# Steps to reduce output size # Steps to reduce output size
rm -rf docs sources tests rm -rf docs sources tests
# We only support cross compiling with gcc for now # We only support cross compiling with gcc for now
rm -rf toolchains/*-clang* toolchains/llvm* rm -rf toolchains/*-clang* toolchains/llvm*
'' +
''
find ${pkg_path}/toolchains \( \ find ${pkg_path}/toolchains \( \
\( -type f -a -name "*.so*" \) -o \ \( -type f -a -name "*.so*" \) -o \
\( -type f -a -perm -0100 \) \ \( -type f -a -perm -0100 \) \

View File

@ -1,6 +1,9 @@
{ stdenv, fetchurl, zlib, ncurses, lib, makeWrapper { stdenv, fetchurl, zlib, ncurses, lib, makeWrapper
, coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which , coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which
, platformTools , 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 { stdenv.mkDerivation rec {
@ -49,11 +52,13 @@ stdenv.mkDerivation rec {
-d $out/libexec/${name} < ${ ./make-standalone-toolchain_r8e.patch } -d $out/libexec/${name} < ${ ./make-standalone-toolchain_r8e.patch }
cd ${pkg_path} cd ${pkg_path}
'' + lib.optionalString (!fullNDK) ''
# Steps to reduce output size # Steps to reduce output size
rm -rf docs sources tests rm -rf docs sources tests
# We only support cross compiling with gcc for now # We only support cross compiling with gcc for now
rm -rf toolchains/*-clang* toolchains/llvm-* rm -rf toolchains/*-clang* toolchains/llvm-*
'' + ''
find ${pkg_path}/toolchains \( \ find ${pkg_path}/toolchains \( \
\( -type f -a -name "*.so*" \) -o \ \( -type f -a -name "*.so*" \) -o \
\( -type f -a -perm -0100 \) \ \( -type f -a -perm -0100 \) \

View File

@ -1,15 +1,19 @@
{ stdenv, appleDerivation, autoreconfHook, targetPlatform, enableStatic ? targetPlatform.isiOS }: { stdenv, appleDerivation, lib, autoreconfHook, targetPlatform
, enableStatic ? targetPlatform.isiOS
, enableShared ? !targetPlatform.isiOS
}:
appleDerivation { appleDerivation {
postUnpack = "sourceRoot=$sourceRoot/libiconv"; 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 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 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 ${stdenv.cc.bintools.targetPrefix}install_name_tool -id $out/lib/libiconv-nocharset.dylib $out/lib/libiconv-nocharset.dylib
@ -26,6 +30,6 @@ appleDerivation {
]; ];
meta = { meta = {
platforms = stdenv.lib.platforms.darwin; platforms = lib.platforms.darwin;
}; };
} }

View File

@ -83,5 +83,6 @@ import ./. (builtins.removeAttrs args [ "system" "platform" ] // {
inherit config overlays crossSystem; inherit config overlays crossSystem;
# Fallback: Assume we are building packages on the current (build, in GNU # Fallback: Assume we are building packages on the current (build, in GNU
# Autotools parlance) system. # Autotools parlance) system.
localSystem = { system = builtins.currentSystem; } // localSystem; localSystem = (if args ? localSystem then {}
else { system = builtins.currentSystem; }) // localSystem;
}) })