diff options
Diffstat (limited to 'pkgs/by-name/ld/ldc/package.nix')
-rw-r--r-- | pkgs/by-name/ld/ldc/package.nix | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/pkgs/by-name/ld/ldc/package.nix b/pkgs/by-name/ld/ldc/package.nix index a807831ec4350..112a9eeb1d8ed 100644 --- a/pkgs/by-name/ld/ldc/package.nix +++ b/pkgs/by-name/ld/ldc/package.nix @@ -3,18 +3,17 @@ , fetchFromGitHub , cmake , ninja -, llvm_17 +, llvm_18 , curl , tzdata -, libconfig , lit , gdb , unzip , darwin -, bash , callPackage , makeWrapper , runCommand +, writeText , targetPackages , ldcBootstrap ? callPackage ./bootstrap.nix { } @@ -31,13 +30,13 @@ in stdenv.mkDerivation (finalAttrs: { pname = "ldc"; - version = "1.38.0"; + version = "1.39.0"; src = fetchFromGitHub { owner = "ldc-developers"; repo = "ldc"; rev = "v${finalAttrs.version}"; - hash = "sha256-d/UREh+fHRRh0r3H60uPjHute+qspcm9TBFWZMbGDxk="; + hash = "sha256-ZiG0ATsY6Asu2nus3Y404fvqIwtKYoHl1JRUDU5A6mo="; fetchSubmodules = true; }; @@ -63,7 +62,7 @@ stdenv.mkDerivation (finalAttrs: { ''; nativeBuildInputs = [ - cmake ldcBootstrap lit lit.python llvm_17.dev makeWrapper ninja unzip + cmake ldcBootstrap lit lit.python llvm_18.dev makeWrapper ninja unzip ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.Foundation ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ @@ -73,8 +72,12 @@ stdenv.mkDerivation (finalAttrs: { buildInputs = [ curl tzdata ]; + outputs = [ "out" "include" ]; + outputInclude = "include"; + cmakeFlags = [ "-DD_FLAGS=-d-version=TZDatabaseDir;-d-version=LibcurlPath;-J${pathConfig}" + "-DINCLUDE_INSTALL_DIR=${placeholder "include"}/include/d" ]; postConfigure = '' @@ -142,4 +145,36 @@ stdenv.mkDerivation (finalAttrs: { maintainers = with maintainers; [ lionello jtbx ]; platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; }; + + passthru.ldcBootstrap = ldcBootstrap; + passthru.tests = let + ldc = finalAttrs.finalPackage; + helloWorld = stdenv.mkDerivation (finalAttrs: { + name = "ldc-hello-world"; + src = writeText "hello_world.d" '' + module hello_world; + import std.stdio; + void main() { + writeln("Hello, world!"); + } + ''; + dontUnpack = true; + buildInputs = [ ldc ]; + dFlags = []; + buildPhase = '' + ldc2 ${lib.escapeShellArgs finalAttrs.dFlags} -of=test $src + ''; + installPhase = '' + mkdir -p $out/bin + mv test $out/bin + ''; + }); + in { + # Without -shared, built binaries should not contain + # references to the compiler binaries. + no-references-to-compiler = helloWorld.overrideAttrs { + disallowedReferences = [ ldc ]; + dFlags = ["-g"]; + }; + }; }) |