Skip to content

Commit

Permalink
Try #1450:
Browse files Browse the repository at this point in the history
  • Loading branch information
iohk-bors[bot] committed May 14, 2022
2 parents ca0be13 + 417d0e6 commit 1885509
Show file tree
Hide file tree
Showing 241 changed files with 38,415 additions and 1,064 deletions.
32 changes: 21 additions & 11 deletions builder/comp-builder.nix
Expand Up @@ -223,6 +223,14 @@ let
"--ghc-option=-fPIC" "--gcc-option=-fPIC"
]
++ map (o: ''--ghc${lib.optionalString (stdenv.hostPlatform.isGhcjs) "js"}-options="${o}"'') ghcOptions
++ lib.optional (
# GHC 9.2 cross compiler built with older versions of GHC seem to have problems
# with unique conters. Perhaps because the name changed for the counters.
# TODO This work around to use `-j1` should be removed once we are able to build 9.2 with 9.2.
haskellLib.isCrossHost
&& builtins.compareVersions defaults.ghc.version "9.2.1" >= 0
&& builtins.compareVersions defaults.ghc.version "9.3" < 0)
"--ghc-options=-j1"
);

executableToolDepends =
Expand Down Expand Up @@ -346,10 +354,14 @@ let
frameworks # Frameworks will be needed at link time
# Not sure why pkgconfig needs to be propagatedBuildInputs but
# for gi-gtk-hs it seems to help.
++ builtins.concatLists pkgconfig;
++ builtins.concatLists pkgconfig
++ lib.optionals (stdenv.hostPlatform.isWindows)
(lib.flatten component.libs
++ map haskellLib.dependToLib component.depends);

buildInputs = component.libs
++ map haskellLib.dependToLib component.depends;
buildInputs = lib.optionals (!stdenv.hostPlatform.isWindows)
(lib.flatten component.libs
++ map haskellLib.dependToLib component.depends);

nativeBuildInputs =
[shellWrappers buildPackages.removeReferencesTo]
Expand Down Expand Up @@ -482,22 +494,20 @@ let
fi
'')
# In case `setup copy` did not create this
+ (lib.optionalString enableSeparateDataOutput "mkdir -p $data")
+ (lib.optionalString enableSeparateDataOutput ''
mkdir -p $data
'')
+ (lib.optionalString (stdenv.hostPlatform.isWindows && (haskellLib.mayHaveExecutable componentId)) (''
echo "Symlink libffi and gmp .dlls ..."
for p in ${lib.concatStringsSep " " [ libffi gmp ]}; do
find "$p" -iname '*.dll' -exec ln -s {} $out/bin \;
done
''
# symlink all .dlls into the local directory.
# we ask ghc-pkg for *all* dynamic-library-dirs and then iterate over the unique set
# to symlink over dlls as needed.
+ ''
echo "Symlink library dependencies..."
for libdir in $(${stdenv.hostPlatform.config}-ghc-pkg field "*" dynamic-library-dirs --simple-output|xargs|sed 's/ /\n/g'|sort -u); do
if [ -d "$libdir" ]; then
find "$libdir" -iname '*.dll' -exec ln -s {} $out/bin \;
fi
for p in $pkgsHostTargetAsString; do
find "$p" -iname '*.dll' -exec ln -s {} $out/bin \;
find "$p" -iname '*.dll.a' -exec ln -s {} $out/bin \;
done
''))
+ (lib.optionalString doCoverage ''
Expand Down
6 changes: 3 additions & 3 deletions builder/make-config-files.nix
Expand Up @@ -85,12 +85,12 @@ let
${target-pkg} init $out/${packageCfgDir}
${lib.concatStringsSep "\n" (lib.mapAttrsToList flagsAndConfig {
"extra-lib-dirs" = map (p: "${lib.getLib p}/lib") component.libs
"extra-lib-dirs" = map (p: "${lib.getLib p}/lib") (lib.flatten component.libs)
# On windows also include `bin` directories that may contain DLLs
++ lib.optionals (stdenv.hostPlatform.isWindows)
(map (p: "${lib.getBin p}/bin")
(component.libs ++ lib.concatLists component.pkgconfig));
"extra-include-dirs" = map (p: "${lib.getDev p}/include") component.libs;
(lib.flatten component.libs ++ lib.concatLists component.pkgconfig));
"extra-include-dirs" = map (p: "${lib.getDev p}/include") (lib.flatten component.libs);
"extra-framework-dirs" = map (p: "${p}/Library/Frameworks") component.frameworks;
})}
Expand Down
4 changes: 2 additions & 2 deletions ci.nix
Expand Up @@ -63,10 +63,10 @@
|| (system == "x86_64-darwin" && __elem compiler-nix-name ["ghc8107"]))) {
inherit (lib.systems.examples) ghcjs;
} // lib.optionalAttrs (system == "x86_64-linux" &&
nixpkgsName == "unstable" && (__elem compiler-nix-name ["ghc810420210212" "ghc8107"])) {
nixpkgsName == "unstable" && (__elem compiler-nix-name ["ghc810420210212" "ghc8107" "ghc902" "ghc922"])) {
# Windows cross compilation is currently broken on macOS
inherit (lib.systems.examples) mingwW64;
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && compiler-nix-name == "ghc8107") {
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && __elem compiler-nix-name ["ghc8107" "ghc902" "ghc922"]) {
# Musl cross only works on linux
# aarch64 cross only works on linux
inherit (lib.systems.examples) musl64 aarch64-multiplatform;
Expand Down
132 changes: 0 additions & 132 deletions compiler/ghc/configured-src.nix

This file was deleted.

0 comments on commit 1885509

Please sign in to comment.