mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-04 22:10:14 +00:00
{cpp-interop,xeus-cpp}: fix on darwin
Co-authored-by: Michael Daniels <mdaniels5757@gmail.com>
(cherry picked from commit 2b08e129ac)
This commit is contained in:
committed by
github-actions[bot]
parent
b28a3b1eb9
commit
bbe82e89ed
@@ -86,6 +86,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
strictDeps = true;
|
||||
__structuredAttrs = true;
|
||||
__darwinAllowLocalNetworking = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
@@ -106,6 +107,16 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
curl
|
||||
];
|
||||
|
||||
# xeus-cpp probes the host `c++` for its include search path and prepends the
|
||||
# result, which shadows the hermetic paths we hand it (Xcode's libc++ and SDK
|
||||
# win on any machine with Xcode). Skip the probe when those paths are supplied.
|
||||
postPatch = ''
|
||||
substituteInPlace src/xinterpreter.cpp --replace-fail \
|
||||
"Cpp::DetectSystemCompilerIncludePaths(CxxSystemIncludes);" \
|
||||
"if (const char* e = std::getenv(\"CPPINTEROP_EXTRA_INTERPRETER_ARGS\"); !e || !*e)
|
||||
Cpp::DetectSystemCompilerIncludePaths(CxxSystemIncludes);"
|
||||
'';
|
||||
|
||||
cmakeFlags = [
|
||||
(lib.cmakeBool "XEUS_CPP_BUILD_TESTS" finalAttrs.finalPackage.doCheck)
|
||||
"-DXEUS_CPP_RESOURCE_DIR=${resourceDir}"
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
{
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
cmake,
|
||||
ninja,
|
||||
python3,
|
||||
llvmPackages_21,
|
||||
apple-sdk,
|
||||
cling,
|
||||
cmake,
|
||||
fetchFromGitHub,
|
||||
gcc-unwrapped,
|
||||
lib,
|
||||
libffi,
|
||||
libxml2,
|
||||
llvmPackages_21,
|
||||
ncurses,
|
||||
ninja,
|
||||
python3,
|
||||
zlib,
|
||||
zstd,
|
||||
|
||||
@@ -46,20 +47,49 @@ let
|
||||
"${clingRoot}/lib/clang/20"
|
||||
else
|
||||
"${lib.getLib clang}/lib/clang/${lib.versions.major llvm.version}";
|
||||
|
||||
# These must precede the resource dir, because libc++ ships its own <stddef.h>
|
||||
# that include_next's Clang's and errors out if reached second.
|
||||
cxxIncludeArgs =
|
||||
if stdenv.hostPlatform.isDarwin then
|
||||
[
|
||||
"-isystem"
|
||||
"${lib.getDev llvmPackages.libcxx}/include/c++/v1"
|
||||
]
|
||||
else
|
||||
[
|
||||
"-isystem"
|
||||
"${gcc-unwrapped}/include/c++/${gcc-unwrapped.version}"
|
||||
"-isystem"
|
||||
"${gcc-unwrapped}/include/c++/${gcc-unwrapped.version}/${stdenv.hostPlatform.config}"
|
||||
];
|
||||
|
||||
libcIncludeArgs =
|
||||
if stdenv.hostPlatform.isDarwin then
|
||||
[
|
||||
"-isystem"
|
||||
"${apple-sdk.sdkroot}/usr/include"
|
||||
"-iframework"
|
||||
"${apple-sdk.sdkroot}/System/Library/Frameworks"
|
||||
]
|
||||
else
|
||||
[
|
||||
"-isystem"
|
||||
"${lib.getDev stdenv.cc.libc}/include"
|
||||
];
|
||||
|
||||
interpreterArgs = [
|
||||
"-nostdinc"
|
||||
"-nostdinc++"
|
||||
"-resource-dir"
|
||||
resourceDir
|
||||
]
|
||||
++ cxxIncludeArgs
|
||||
++ [
|
||||
"-isystem"
|
||||
"${resourceDir}/include"
|
||||
"-isystem"
|
||||
"${gcc-unwrapped}/include/c++/${gcc-unwrapped.version}"
|
||||
"-isystem"
|
||||
"${gcc-unwrapped}/include/c++/${gcc-unwrapped.version}/${stdenv.hostPlatform.config}"
|
||||
"-isystem"
|
||||
"${lib.getDev stdenv.cc.libc}/include"
|
||||
];
|
||||
]
|
||||
++ libcIncludeArgs;
|
||||
in
|
||||
|
||||
assert lib.assertOneOf "backend" backend [
|
||||
|
||||
Reference in New Issue
Block a user