diff --git a/pkgs/development/tools/build-managers/dub/default.nix b/pkgs/by-name/du/dub/package.nix similarity index 79% rename from pkgs/development/tools/build-managers/dub/default.nix rename to pkgs/by-name/du/dub/package.nix index d815a9515dc6..9f419d1e10f4 100644 --- a/pkgs/development/tools/build-managers/dub/default.nix +++ b/pkgs/by-name/du/dub/package.nix @@ -1,56 +1,49 @@ -{ lib, stdenv, fetchFromGitHub, curl, libevent, rsync, ldc, dcompiler ? ldc }: +{ lib +, stdenv +, fetchFromGitHub +, curl +, ldc +, libevent +, rsync +}: -assert dcompiler != null; - -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "dub"; - version = "1.33.0"; + version = "1.38.0"; enableParallelBuilding = true; src = fetchFromGitHub { owner = "dlang"; repo = "dub"; - rev = "v${version}"; - sha256 = "sha256-4Mha7WF6cg3DIccfpvOnheuvgfziv/7wo8iFsPXO4yY="; + rev = "v${finalAttrs.version}"; + hash = "sha256-+cG7tR4nAL4fhk9/1FMkfjQ8Rtqf+uTvGfVegmnjloY="; }; - dubvar = "\\$DUB"; postPatch = '' patchShebangs test - - - # Can be removed with https://github.com/dlang/dub/pull/1368 - substituteInPlace test/fetchzip.sh \ - --replace "dub remove" "\"${dubvar}\" remove" ''; - nativeBuildInputs = [ dcompiler libevent rsync ]; + nativeBuildInputs = [ ldc libevent rsync ]; buildInputs = [ curl ]; buildPhase = '' - for dc_ in dmd ldmd2 gdmd; do - echo "... check for D compiler $dc_ ..." - dc=$(type -P $dc_ || echo "") - if [ ! "$dc" == "" ]; then - break - fi - done - if [ "$dc" == "" ]; then - exit "Error: could not find D compiler" - fi - echo "$dc_ found and used as D compiler to build $pname" - $dc ./build.d - ./build + runHook preBuild + + export DMD=${ldc}/bin/ldmd2 + ldc2 -run ./build.d + + runHook postBuild ''; doCheck = !stdenv.isDarwin; checkPhase = '' + runHook preCheck + export DUB=$NIX_BUILD_TOP/source/bin/dub export PATH=$PATH:$NIX_BUILD_TOP/source/bin/ - export DC=${dcompiler.out}/bin/${if dcompiler.pname=="ldc" then "ldc2" else dcompiler.pname} - echo "DC out --> $DC" + export DC=${lib.getExe ldc} export HOME=$TMP rm -rf test/issue502-root-import @@ -138,21 +131,29 @@ stdenv.mkDerivation rec { rm -r test/sdl-package-simple rm -r test/dpath-variable # requires execution of dpath-variable.sh rm -r test/use-c-sources + rm -r test/pr2642-cache-db + rm -r test/pr2644-describe-artifact-path + rm -r test/pr2647-build-deep ./test/run-unittest.sh + + runHook postCheck ''; installPhase = '' - mkdir -p $out/bin - cp bin/dub $out/bin + runHook preInstall + + install -Dm755 bin/dub $out/bin/dub + + runHook postInstall ''; meta = with lib; { - description = "Package and build manager for D applications and libraries"; - mainProgram = "dub"; + description = "Package and build manager for D programs and libraries"; homepage = "https://code.dlang.org/"; license = licenses.mit; + mainProgram = "dub"; maintainers = with maintainers; [ jtbx ]; platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; }; -} +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 06a9b63930ae..bd3557c324cb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7410,8 +7410,6 @@ with pkgs; dt-schema = callPackage ../development/tools/dt-schema { }; - dub = callPackage ../development/tools/build-managers/dub { }; - inherit (import ../build-support/dlang/dub-support.nix { inherit callPackage; }) buildDubPackage dub-to-nix;