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
# 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;
})

View file

@ -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";

View file

@ -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 [

View file

@ -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 \) \

View file

@ -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 \) \

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 {
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;
};
}

View file

@ -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;
})