biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / development / tools / build-managers / dub / default.nix
blobd815a9515dc6e8866b13d08ee0ee0471b52a7979
1 { lib, stdenv, fetchFromGitHub, curl, libevent, rsync, ldc, dcompiler ? ldc }:
3 assert dcompiler != null;
5 stdenv.mkDerivation rec {
6   pname = "dub";
7   version = "1.33.0";
9   enableParallelBuilding = true;
11   src = fetchFromGitHub {
12     owner = "dlang";
13     repo = "dub";
14     rev = "v${version}";
15     sha256 = "sha256-4Mha7WF6cg3DIccfpvOnheuvgfziv/7wo8iFsPXO4yY=";
16   };
18   dubvar = "\\$DUB";
19   postPatch = ''
20     patchShebangs test
23     # Can be removed with https://github.com/dlang/dub/pull/1368
24     substituteInPlace test/fetchzip.sh \
25         --replace "dub remove" "\"${dubvar}\" remove"
26   '';
28   nativeBuildInputs = [ dcompiler libevent rsync ];
29   buildInputs = [ curl ];
31   buildPhase = ''
32     for dc_ in dmd ldmd2 gdmd; do
33       echo "... check for D compiler $dc_ ..."
34       dc=$(type -P $dc_ || echo "")
35       if [ ! "$dc" == "" ]; then
36         break
37       fi
38     done
39     if [ "$dc" == "" ]; then
40       exit "Error: could not find D compiler"
41     fi
42     echo "$dc_ found and used as D compiler to build $pname"
43     $dc ./build.d
44     ./build
45   '';
47   doCheck = !stdenv.isDarwin;
49   checkPhase = ''
50     export DUB=$NIX_BUILD_TOP/source/bin/dub
51     export PATH=$PATH:$NIX_BUILD_TOP/source/bin/
52     export DC=${dcompiler.out}/bin/${if dcompiler.pname=="ldc" then "ldc2" else dcompiler.pname}
53     echo "DC out --> $DC"
54     export HOME=$TMP
56     rm -rf test/issue502-root-import
57     rm test/issue674-concurrent-dub.sh
58     rm test/issue672-upgrade-optional.sh
59     rm test/issue990-download-optional-selected.sh
60     rm test/issue877-auto-fetch-package-on-run.sh
61     rm test/issue1037-better-dependency-messages.sh
62     rm test/issue1416-maven-repo-pkg-supplier.sh
63     rm test/issue1180-local-cache-broken.sh
64     rm test/issue1574-addcommand.sh
65     rm test/issue1524-maven-upgrade-dependency-tree.sh
66     rm test/issue1773-lint.sh
68     rm test/ddox.sh
69     rm test/fetchzip.sh
70     rm test/feat663-search.sh
71     rm -rf test/git-dependency
72     rm test/interactive-remove.sh
73     rm test/timeout.sh
74     rm test/version-spec.sh
75     rm test/0-init-multi.sh
76     rm test/0-init-multi-json.sh
77     rm test/4-describe-data-1-list.sh
78     rm test/4-describe-data-3-zero-delim.sh
79     rm test/4-describe-import-paths.sh
80     rm test/4-describe-string-import-paths.sh
81     rm test/4-describe-json.sh
82     rm test/5-convert-stdout.sh
83     rm test/issue1003-check-empty-ld-flags.sh
84     rm test/issue103-single-file-package.sh
85     rm test/issue1040-run-with-ver.sh
86     rm test/issue1091-bogus-rebuild.sh
87     rm test/issue1194-warn-wrong-subconfig.sh
88     rm test/issue1277.sh
89     rm test/issue1372-ignore-files-in-hidden-dirs.sh
90     rm test/issue1447-build-settings-vars.sh
91     rm test/issue1531-toolchain-requirements.sh
92     rm test/issue346-redundant-flags.sh
93     rm test/issue361-optional-deps.sh
94     rm test/issue564-invalid-upgrade-dependency.sh
95     rm test/issue586-subpack-dep.sh
96     rm test/issue616-describe-vs-generate-commands.sh
97     rm test/issue686-multiple-march.sh
98     rm test/issue813-fixed-dependency.sh
99     rm test/issue813-pure-sub-dependency.sh
100     rm test/issue820-extra-fields-after-convert.sh
101     rm test/issue923-subpackage-deps.sh
102     rm test/single-file-sdl-default-name.sh
103     rm test/subpackage-common-with-sourcefile-globbing.sh
104     rm test/issue934-path-dep.sh
105     rm -r test/issue2258-dynLib-exe-dep # requires files below
106     rm -r test/1-dynLib-simple
107     rm -r test/1-exec-simple-package-json
108     rm -r test/1-exec-simple
109     rm -r test/1-staticLib-simple
110     rm -r test/2-dynLib-dep
111     rm -r test/2-staticLib-dep
112     rm -r test/2-dynLib-with-staticLib-dep
113     rm -r test/2-sourceLib-dep/
114     rm -r test/3-copyFiles
115     rm -r test/custom-source-main-bug487
116     rm -r test/custom-unittest
117     rm -r test/issue1262-version-inheritance-diamond
118     rm -r test/issue1003-check-empty-ld-flags
119     rm -r test/ignore-hidden-1
120     rm -r test/ignore-hidden-2
121     rm -r test/issue1427-betterC
122     rm -r test/issue130-unicode-*
123     rm -r test/issue1262-version-inheritance
124     rm -r test/issue1372-ignore-files-in-hidden-dirs
125     rm -r test/issue1350-transitive-none-deps
126     rm -r test/issue1775
127     rm -r test/issue1447-build-settings-vars
128     rm -r test/issue1408-inherit-linker-files
129     rm -r test/issue1551-var-escaping
130     rm -r test/issue754-path-selection-fail
131     rm -r test/issue1788-incomplete-string-import-override
132     rm -r test/subpackage-ref
133     rm -r test/issue777-bogus-path-dependency
134     rm -r test/issue959-path-based-subpack-dep
135     rm -r test/issue97-targettype-none-nodeps
136     rm -r test/issue97-targettype-none-onerecipe
137     rm -r test/path-subpackage-ref
138     rm -r test/sdl-package-simple
139     rm -r test/dpath-variable # requires execution of dpath-variable.sh
140     rm -r test/use-c-sources
142     ./test/run-unittest.sh
143   '';
145   installPhase = ''
146     mkdir -p $out/bin
147     cp bin/dub $out/bin
148   '';
150   meta = with lib; {
151     description = "Package and build manager for D applications and libraries";
152     mainProgram = "dub";
153     homepage = "https://code.dlang.org/";
154     license = licenses.mit;
155     maintainers = with maintainers; [ jtbx ];
156     platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
157   };