Merge pull request #48602 from matthewbauer/cmake-cross

Set CMAKE_SYSTEM_* for cross compiling
This commit is contained in:
John Ericson
2018-10-18 15:47:04 -04:00
committed by GitHub
16 changed files with 82 additions and 40 deletions

View File

@@ -101,21 +101,17 @@ stdenv.mkDerivation {
inherit src;
patchFlags = optionalString (stdenv.hostPlatform.libc == "msvcrt") "-p0";
patchFlags = "";
patches = patches
++ optional stdenv.isDarwin ./darwin-no-system-python.patch
++ optional (stdenv.hostPlatform.libc == "msvcrt") (fetchurl {
url = "https://svn.boost.org/trac/boost/raw-attachment/tickaet/7262/"
+ "boost-mingw.patch";
sha256 = "0s32kwll66k50w6r5np1y5g907b7lcpsjhfgr7rsw7q5syhzddyj";
});
++ optional stdenv.isDarwin ./darwin-no-system-python.patch;
meta = {
homepage = http://boost.org/;
description = "Collection of C++ libraries";
license = stdenv.lib.licenses.boost;
platforms = (if versionOlder version "1.59" then remove "aarch64-linux" else id) platforms.unix;
platforms = (if versionOlder version "1.59" then remove "aarch64-linux" else id) (platforms.unix ++ platforms.windows);
maintainers = with maintainers; [ peti wkennington ];
};
@@ -139,7 +135,8 @@ stdenv.mkDerivation {
enableParallelBuilding = true;
nativeBuildInputs = [ which buildPackages.stdenv.cc ];
nativeBuildInputs = [ which ];
depsBuildBuild = [ buildPackages.stdenv.cc ];
buildInputs = [ expat zlib bzip2 libiconv ]
++ optional (stdenv.hostPlatform == stdenv.buildPlatform) icu
++ optional stdenv.isDarwin fixDarwinDylibNames

View File

@@ -9,6 +9,8 @@ stdenv.mkDerivation rec {
sha256 = "0vnwmbvymw677k780kpb6sb8i3szdp89rzy8mz1fwg1657yw3ls5";
};
configureFlags = if stdenv.hostPlatform.isWindows then [ "--disable-shared" "--enable-static" ] else null;
# ares_android.h header is missing
# see issue https://github.com/c-ares/c-ares/issues/216
postPatch = if stdenv.hostPlatform.isAndroid then ''

View File

@@ -15,8 +15,6 @@ stdenv.mkDerivation rec {
cmakeFlags = []
++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
"-DMSGPACK_BUILD_EXAMPLES=OFF"
++ stdenv.lib.optional (stdenv.hostPlatform.libc == "msvcrt")
"-DCMAKE_SYSTEM_NAME=Windows"
;
meta = with stdenv.lib; {

View File

@@ -6,6 +6,7 @@
, enableAsioLib ? false, boost ? null
, enableGetAssets ? false, libxml2 ? null
, enableJemalloc ? false, jemalloc ? null
, enableApp ? !stdenv.hostPlatform.isWindows
}:
assert enableHpack -> jansson != null;
@@ -35,8 +36,12 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
configureFlags = [ "--with-spdylay=no" "--disable-examples" "--disable-python-bindings" "--enable-app" ]
++ optional enableAsioLib "--enable-asio-lib --with-boost-libdir=${boost}/lib";
configureFlags = [
"--with-spdylay=no"
"--disable-examples"
"--disable-python-bindings"
(stdenv.lib.enableFeature enableApp "app")
] ++ optional enableAsioLib "--enable-asio-lib --with-boost-libdir=${boost}/lib";
#doCheck = true; # requires CUnit ; currently failing at test_util_localtime_date in util_test.cc

View File

@@ -18,8 +18,6 @@ stdenv.mkDerivation rec {
cmakeFlags = [
"-DBuildTests=${if doCheck then "ON" else "OFF"}"
] ++ stdenv.lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [
"-DCMAKE_SYSTEM_NAME=Windows"
];
doCheck = stdenv.hostPlatform == stdenv.buildPlatform;

View File

@@ -79,6 +79,6 @@ stdenv.mkDerivation rec {
homepage = http://www.sqlite.org/;
license = licenses.publicDomain;
maintainers = with maintainers; [ eelco np ];
platforms = platforms.unix;
platforms = platforms.unix ++ platforms.windows;
};
}

View File

@@ -82,4 +82,6 @@ stdenv.mkDerivation (rec {
preConfigure = ''
export CHOST=${stdenv.hostPlatform.config}
'';
} // stdenv.lib.optionalAttrs (stdenv.hostPlatform.libc == "msvcrt") {
configurePhase = ":";
})