@@ -671,11 +671,16 @@ stdenv.mkDerivation (rec {
671
671
${ hadrian } /bin/hadrian ${ hadrianArgs } _build/stage0/compiler/build/$a
672
672
cp _build/stage0/compiler/build/$a compiler/GHC/Builtin/$a
673
673
done
674
- '' + lib . optionalString stdenv . isDarwin ''
674
+ '' + lib . optionalString stdenv . isDarwin && ( __tryEval libcxxabi ) . success ''
675
675
substituteInPlace mk/system-cxx-std-lib-1.0.conf \
676
676
--replace 'dynamic-library-dirs:' 'dynamic-library-dirs: ${ libcxx } /lib ${ libcxxabi } /lib'
677
677
find . -name 'system*.conf*'
678
678
cat mk/system-cxx-std-lib-1.0.conf
679
+ '' + lib . optionalString stdenv . isDarwin && ! ( __tryEval libcxxabi ) . success ''
680
+ substituteInPlace mk/system-cxx-std-lib-1.0.conf \
681
+ --replace 'dynamic-library-dirs:' 'dynamic-library-dirs: ${ libcxx } /lib'
682
+ find . -name 'system*.conf*'
683
+ cat mk/system-cxx-std-lib-1.0.conf
679
684
'' + lib . optionalString ( installStage1 && stdenv . targetPlatform . isMusl ) ''
680
685
substituteInPlace hadrian/cfg/system.config \
681
686
--replace 'cross-compiling = YES' \
@@ -756,11 +761,16 @@ stdenv.mkDerivation (rec {
756
761
export XATTR=$(mktemp -d)/nothing
757
762
'' ;
758
763
} // lib . optionalAttrs useHadrian {
759
- postConfigure = lib . optionalString stdenv . isDarwin ''
764
+ postConfigure = lib . optionalString ( stdenv . isDarwin && ( __tryEval libcxxabi ) . success ) ''
760
765
substituteInPlace mk/system-cxx-std-lib-1.0.conf \
761
766
--replace 'dynamic-library-dirs:' 'dynamic-library-dirs: ${ libcxx } /lib ${ libcxxabi } /lib'
762
767
find . -name 'system*.conf*'
763
768
cat mk/system-cxx-std-lib-1.0.conf
769
+ '' + lib . optionalString ( stdenv . isDarwin && ! ( __tryEval libcxxabi ) . success ) ''
770
+ substituteInPlace mk/system-cxx-std-lib-1.0.conf \
771
+ --replace 'dynamic-library-dirs:' 'dynamic-library-dirs: ${ libcxx } /lib'
772
+ find . -name 'system*.conf*'
773
+ cat mk/system-cxx-std-lib-1.0.conf
764
774
'' + lib . optionalString ( installStage1 && ! haskell-nix . haskellLib . isCrossTarget && stdenv . targetPlatform . isMusl ) ''
765
775
substituteInPlace hadrian/cfg/system.config \
766
776
--replace 'cross-compiling = YES' \
@@ -820,12 +830,18 @@ stdenv.mkDerivation (rec {
820
830
${ hadrian } /bin/hadrian ${ hadrianArgs } binary-dist-dir
821
831
cd _build/bindist/ghc-*
822
832
./configure --prefix=$out ${ lib . concatStringsSep " " configureFlags }
823
- ${ lib . optionalString stdenv . isDarwin ''
833
+ ${ lib . optionalString ( stdenv . isDarwin && ( __tryEval libcxxabi ) . success ) ''
824
834
substituteInPlace mk/system-cxx-std-lib-1.0.conf \
825
835
--replace 'dynamic-library-dirs:' 'dynamic-library-dirs: ${ libcxx } /lib ${ libcxxabi } /lib'
826
836
substituteInPlace lib/package.conf.d/system-cxx-std-lib-1.0.conf \
827
837
--replace 'dynamic-library-dirs:' 'dynamic-library-dirs: ${ libcxx } /lib ${ libcxxabi } /lib'
828
838
'' }
839
+ ${ lib . optionalString ( stdenv . isDarwin && ! ( __tryEval libcxxabi ) . success ) ''
840
+ substituteInPlace mk/system-cxx-std-lib-1.0.conf \
841
+ --replace 'dynamic-library-dirs:' 'dynamic-library-dirs: ${ libcxx } /lib'
842
+ substituteInPlace lib/package.conf.d/system-cxx-std-lib-1.0.conf \
843
+ --replace 'dynamic-library-dirs:' 'dynamic-library-dirs: ${ libcxx } /lib'
844
+ '' }
829
845
mkdir -p utils
830
846
cp -r ../../../utils/completion utils
831
847
make install
0 commit comments