mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-19 02:44:17 +03:00
darwin.ICU: cross compilation
This commit is contained in:
parent
aa3361326b
commit
cbe172fa67
@ -1,8 +1,20 @@
|
||||
{ appleDerivation, python3 }:
|
||||
{ appleDerivation, lib, stdenv, buildPackages, python3 }:
|
||||
|
||||
let
|
||||
formatVersionNumeric = version:
|
||||
let
|
||||
versionParts = lib.versions.splitVersion version;
|
||||
major = lib.toInt (lib.elemAt versionParts 0);
|
||||
minor = lib.toInt (lib.elemAt versionParts 1);
|
||||
patch = if lib.length versionParts > 2 then lib.toInt (lib.elemAt versionParts 2) else 0;
|
||||
in toString (major * 10000 + minor * 100 + patch);
|
||||
in
|
||||
|
||||
appleDerivation {
|
||||
nativeBuildInputs = [ python3 ];
|
||||
|
||||
depsBuildBuild = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [ buildPackages.stdenv.cc ];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace makefile \
|
||||
--replace "/usr/bin/" "" \
|
||||
@ -26,6 +38,13 @@ appleDerivation {
|
||||
--replace "&TestMailFilterCSS" "NULL"
|
||||
|
||||
patchShebangs icuSources
|
||||
'' + lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
|
||||
|
||||
# This looks like a bug in the makefile. It defines ENV_BUILDHOST to
|
||||
# propagate the correct value of CC, CXX, etc, but has the following double
|
||||
# expansion that results in the empty string.
|
||||
substituteInPlace makefile \
|
||||
--replace '$($(ENV_BUILDHOST))' '$(ENV_BUILDHOST)'
|
||||
'';
|
||||
|
||||
# APPLE is using makefile to save its default configuration and call ./configure, so we hack makeFlags
|
||||
@ -42,8 +61,19 @@ appleDerivation {
|
||||
"DATA_LOOKUP_DIR=$(DSTROOT)$(DATA_INSTALL_DIR)"
|
||||
|
||||
# hack to use our lower macos version
|
||||
"MAC_OS_X_VERSION_MIN_REQUIRED=__MAC_OS_X_VERSION_MIN_REQUIRED"
|
||||
"OSX_HOST_VERSION_MIN_STRING=$(MACOSX_DEPLOYMENT_TARGET)"
|
||||
"MAC_OS_X_VERSION_MIN_REQUIRED=${formatVersionNumeric stdenv.hostPlatform.darwinMinVersion}"
|
||||
"ICU_TARGET_VERSION=-m${stdenv.hostPlatform.darwinPlatform}-version-min=${stdenv.hostPlatform.darwinMinVersion}"
|
||||
]
|
||||
++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
|
||||
"CROSS_BUILD=YES"
|
||||
"BUILD_TYPE="
|
||||
"RC_ARCHS=${stdenv.hostPlatform.darwinArch}"
|
||||
"HOSTCC=cc"
|
||||
"HOSTCXX=c++"
|
||||
"CC=${stdenv.cc.targetPrefix}cc"
|
||||
"CXX=${stdenv.cc.targetPrefix}c++"
|
||||
"HOSTISYSROOT="
|
||||
"OSX_HOST_VERSION_MIN_STRING=${stdenv.buildPlatform.darwinMinVersion}"
|
||||
];
|
||||
|
||||
doCheck = true;
|
||||
|
Loading…
Reference in New Issue
Block a user