diff --git a/pkgs/development/compilers/ghc/8.10.7.nix b/pkgs/development/compilers/ghc/8.10.7.nix index 5badd8ca7e52f..2f359fd51a27f 100644 --- a/pkgs/development/compilers/ghc/8.10.7.nix +++ b/pkgs/development/compilers/ghc/8.10.7.nix @@ -10,7 +10,7 @@ , # GHC can be built with system libffi or a bundled one. libffi ? null -, useLLVM ? !stdenv.targetPlatform.isx86 +, useLLVM ? stdenv.targetPlatform.useiOSPrebuilt || !stdenv.targetPlatform.isx86 , # LLVM is conceptually a run-time-only depedendency, but for # non-x86, we need LLVM to bootstrap later stages, so it becomes a # build-time dependency too. @@ -248,7 +248,10 @@ stdenv.mkDerivation (rec { buildInputs = [ perl bash ] ++ (libDeps hostPlatform); propagatedBuildInputs = [ targetPackages.stdenv.cc ] - ++ lib.optional useLLVM llvmPackages.llvm; + ++ lib.optionals useLLVM [ + llvmPackages.llvm + llvmPackages.llvm.out + ]; depsTargetTarget = map lib.getDev (libDeps targetPlatform); depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform); diff --git a/pkgs/development/haskell-modules/with-packages-wrapper.nix b/pkgs/development/haskell-modules/with-packages-wrapper.nix index 8c8833ad82e83..ac6e2b13525ba 100644 --- a/pkgs/development/haskell-modules/with-packages-wrapper.nix +++ b/pkgs/development/haskell-modules/with-packages-wrapper.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, ghc, llvmPackages, packages, symlinkJoin, makeWrapper +{ lib, stdenv, ghc, darwin, llvmPackages, packages, symlinkJoin, makeWrapper , withLLVM ? !(stdenv.hostPlatform.isx86_64 || stdenv.hostPlatform.isPowerPC) , postBuild ? "" , ghcLibdir ? null # only used by ghcjs, when resolving plugins @@ -44,6 +44,10 @@ let packageCfgDir = "${libDir}/package.conf.d"; paths = lib.filter (x: x ? isHaskellLibrary) (lib.closePropagation packages); hasLibraries = lib.any (x: x.isHaskellLibrary) paths; + + dyld_root_path = "${darwin.iosSdkPkgs.sdk.iPhoneOSRoot}/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot"; + isSimulator = stdenv.targetPlatform.isiOS && stdenv.targetPlatform.isx86_64; + # CLang is needed on Darwin for -fllvm to work: # https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm llvm = lib.makeBinPath @@ -73,6 +77,9 @@ symlinkJoin { ${lib.optionalString (ghc.isGhcjs or false) ''--set NODE_PATH "${ghc.socket-io}/lib/node_modules"'' } \ + ${lib.optionalString (isSimulator) + ''--set DYLD_ROOT_PATH "${dyld_root_path}" \'' + } ${lib.optionalString withLLVM ''--prefix "PATH" ":" "${llvm}"''} fi done @@ -92,7 +99,7 @@ symlinkJoin { for prg in ${ghcCommand}-pkg ${ghcCommand}-pkg-${ghc.version}; do if [[ -x "${ghc}/bin/$prg" ]]; then rm -f $out/bin/$prg - makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "${packageDBFlag}=${packageCfgDir}" + makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "${packageDBFlag}=${packageCfgDir}" ${lib.optionalString (isSimulator) ''--set DYLD_ROOT_PATH "${dyld_root_path}"''} fi done diff --git a/pkgs/os-specific/darwin/xcode/sdk-pkgs.nix b/pkgs/os-specific/darwin/xcode/sdk-pkgs.nix index 6d8ed9f532260..a84914e0cd96d 100644 --- a/pkgs/os-specific/darwin/xcode/sdk-pkgs.nix +++ b/pkgs/os-specific/darwin/xcode/sdk-pkgs.nix @@ -22,6 +22,8 @@ rec { type = "derivation"; outPath = xcode + "/Contents/Developer/Platforms/${platform}.platform/Developer/SDKs/${platform}${version}.sdk"; + iPhoneOSRoot = xcode + "/Contents/Developer/Platforms/iPhoneOS.platform"; + platform = targetPlatform.xcodePlatform; version = targetPlatform.sdkVer; }; diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix index ef088bec75d7b..4844dc6f9ec7b 100644 --- a/pkgs/stdenv/cross/default.nix +++ b/pkgs/stdenv/cross/default.nix @@ -84,8 +84,13 @@ in lib.init bootStages ++ [ ++ lib.optional (hostPlatform.config == "x86_64-w64-mingw32") buildPackages.file ; + + # temp hack to avoid ios macos clash - preHook = lib.concatStringsSep "\n" + preHook = lib.optionalString (crossSystem.useiOSPrebuilt && crossSystem.isx86_64) '' + export DYLD_ROOT_PATH=${buildPackages.darwin.iosSdkPkgs.sdk.iPhoneOSRoot}/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot + echo -e "\n!! iOS Simulator in use !!\nDYLD_ROOT_PATH: $DYLD_ROOT_PATH\n!! iOS Simulator !!\n" + '' + lib.concatStringsSep "\n" (lib.filter (l: ! lib.strings.hasInfix "-sdk_version" l) (lib.strings.splitString "\n" old.preHook));