Merge pull request #324400 from CyberShadow/ldc-include-output

ldc: split includes to separate output
This commit is contained in:
Peder Bergebakken Sundt 2024-07-21 21:02:32 +02:00 committed by GitHub
commit beab3b862a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,6 +15,7 @@
, callPackage
, makeWrapper
, runCommand
, writeText
, targetPackages
, ldcBootstrap ? callPackage ./bootstrap.nix { }
@ -73,8 +74,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 +147,35 @@ stdenv.mkDerivation (finalAttrs: {
maintainers = with maintainers; [ lionello jtbx ];
platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
};
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"];
};
};
})