diff options
Diffstat (limited to 'nix-overlays/dmd/generic.nix')
-rw-r--r-- | nix-overlays/dmd/generic.nix | 79 |
1 files changed, 43 insertions, 36 deletions
diff --git a/nix-overlays/dmd/generic.nix b/nix-overlays/dmd/generic.nix index e500385..a2a1b8a 100644 --- a/nix-overlays/dmd/generic.nix +++ b/nix-overlays/dmd/generic.nix @@ -6,12 +6,14 @@ { stdenv , lib , fetchFromGitHub +, removeReferencesTo , makeWrapper , which , writeTextFile , curl , tzdata , gdb +#, Foundation , callPackage , targetPackages , fetchpatch @@ -19,7 +21,8 @@ , installShellFiles , git , unzip -, HOST_DMD ? "${callPackage ./bootstrap.nix { }}/bin/dmd" +, dmdBootstrap ? callPackage ./bootstrap.nix { } +, dmd_bin ? "${dmdBootstrap}/bin" }: let @@ -70,46 +73,38 @@ stdenv.mkDerivation rec { # https://issues.dlang.org/show_bug.cgi?id=19553 hardeningDisable = [ "fortify" ]; - #patches = lib.optionals (lib.versionOlder version "2.088.0") [ - # # Migrates D1-style operator overloads in DMD source, to allow building with - # # a newer DMD - # (fetchpatch { - # url = "https://github.com/dlang/dmd/commit/c4d33e5eb46c123761ac501e8c52f33850483a8a.patch"; - # stripLen = 1; - # extraPrefix = "dmd/"; - # sha256 = "sha256-N21mAPfaTo+zGCip4njejasraV5IsWVqlGR5eOdFZZE="; - # }) - #] ++ lib.optionals (lib.versionOlder version "2.092.2") [ - # # Fixes C++ tests that compiled on older C++ but not on the current one - # (fetchpatch { - # url = "https://github.com/dlang/druntime/commit/438990def7e377ca1f87b6d28246673bb38022ab.patch"; - # stripLen = 1; - # extraPrefix = "druntime/"; - # sha256 = "sha256-/pPKK7ZK9E/mBrxm2MZyBNhYExE8p9jz8JqBdZSE6uY="; - # }) - #]; + patches = lib.optionals (lib.versionOlder version "2.088.0") [ + # Migrates D1-style operator overloads in DMD source, to allow building with + # a newer DMD + (fetchpatch { + url = "https://github.com/dlang/dmd/commit/c4d33e5eb46c123761ac501e8c52f33850483a8a.patch"; + stripLen = 1; + extraPrefix = "dmd/"; + sha256 = "sha256-N21mAPfaTo+zGCip4njejasraV5IsWVqlGR5eOdFZZE="; + }) + ]; postPatch = '' patchShebangs dmd/compiler/test/{runnable,fail_compilation,compilable,tools}{,/extra-files}/*.sh - rm dmd/compiler/test/runnable_cxx/cppa.d - - # Grep'd string changed with gdb 12 - # https://issues.dlang.org/show_bug.cgi?id=23198 - substituteInPlace dmd/druntime/test/exceptions/Makefile \ - --replace 'in D main (' 'in _Dmain (' + rm dmd/compiler/test/runnable/gdb1.d + rm dmd/compiler/test/runnable/gdb10311.d + rm dmd/compiler/test/runnable/gdb14225.d + rm dmd/compiler/test/runnable/gdb14276.d + rm dmd/compiler/test/runnable/gdb14313.d + rm dmd/compiler/test/runnable/gdb14330.d + rm dmd/compiler/test/runnable/gdb15729.sh + rm dmd/compiler/test/runnable/gdb4149.d + rm dmd/compiler/test/runnable/gdb4181.d + rm dmd/compiler/test/compilable/ddocYear.d - # We're using gnused on all platforms - substituteInPlace dmd/druntime/test/coverage/Makefile \ - --replace 'freebsd osx' 'none' + # Disable tests that rely on objdump whitespace until fixed upstream: + # https://issues.dlang.org/show_bug.cgi?id=23317 + rm dmd/compiler/test/runnable/cdvecfill.sh + rm dmd/compiler/test/compilable/cdcmp.d '' - + lib.optionalString (lib.versionOlder version "2.091.0") '' - # This one has tested against a hardcoded year, then against a current year on - # and off again. It just isn't worth it to patch all the historical versions - # of it, so just remove it until the most recent change. - rm dmd/compiler/test/compilable/ddocYear.d - '' + lib.optionalString (lib.versionAtLeast version "2.089.0" && lib.versionOlder version "2.092.2") '' + + lib.optionalString (lib.versionAtLeast version "2.089.0" && lib.versionOlder version "2.092.2") '' rm dmd/compiler/test/dshell/test6952.d '' + lib.optionalString (lib.versionAtLeast version "2.092.2") '' substituteInPlace dmd/compiler/test/dshell/test6952.d --replace "/usr/bin/env bash" "${bash}/bin/bash" @@ -132,6 +127,8 @@ stdenv.mkDerivation rec { buildInputs = [ curl tzdata + # ] ++ lib.optionals stdenv.isDarwin [ + # Foundation ]; nativeCheckInputs = [ @@ -155,7 +152,8 @@ stdenv.mkDerivation rec { buildJobs=1 fi - make -C dmd -f posix.mak $buildFlags -j$buildJobs HOST_DMD=${HOST_DMD} + ${dmd_bin}/rdmd dmd/compiler/src/build.d -j$buildJobs HOST_DMD=${dmd_bin}/dmd $buildFlags + make -C dmd/druntime -f posix.mak DMD=${pathToDmd} $buildFlags -j$buildJobs echo ${tzdata}/share/zoneinfo/ > TZDatabaseDirFile echo ${lib.getLib curl}/lib/libcurl${stdenv.hostPlatform.extensions.sharedLibrary} > LibcurlPathFile make -C phobos -f posix.mak $buildFlags -j$buildJobs DMD=${pathToDmd} DFLAGS="-version=TZDatabaseDir -version=LibcurlPath -J$PWD" @@ -195,6 +193,9 @@ stdenv.mkDerivation rec { installManPage dmd/docs/man/man*/* + mkdir -p $out/include/dmd + cp -r {dmd/druntime/import/*,phobos/{std,etc}} $out/include/dmd/ + mkdir $out/lib cp phobos/generated/${osname}/release/${bits}/libphobos2.* $out/lib/ @@ -207,13 +208,19 @@ stdenv.mkDerivation rec { runHook postInstall ''; + preFixup = '' + find $out/bin -type f -exec ${removeReferencesTo}/bin/remove-references-to -t ${dmd_bin}/dmd '{}' + + ''; + + disallowedReferences = [ dmdBootstrap ]; + meta = with lib; { description = "Official reference compiler for the D language"; homepage = "https://dlang.org/"; # Everything is now Boost licensed, even the backend. # https://github.com/dlang/dmd/pull/6680 license = licenses.boost; - maintainers = with maintainers; [ ThomasMader lionello dukc ]; + maintainers = with maintainers; [ lionello dukc jtbx ]; platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ]; }; } |