2018-01-26 21:14:52 +00:00
|
|
|
{ stdenv, fetchFromGitHub, fetchpatch, curl, dmd, libevent, rsync }:
|
2015-01-18 00:41:39 +00:00
|
|
|
|
2017-11-25 18:27:49 +00:00
|
|
|
let
|
2015-01-18 00:41:39 +00:00
|
|
|
|
2017-11-25 18:27:49 +00:00
|
|
|
dubBuild = stdenv.mkDerivation rec {
|
|
|
|
name = "dubBuild-${version}";
|
2018-01-26 21:14:52 +00:00
|
|
|
version = "1.7.1";
|
2017-10-20 21:12:17 +01:00
|
|
|
|
2017-11-25 18:27:49 +00:00
|
|
|
enableParallelBuilding = true;
|
2017-10-20 21:12:17 +01:00
|
|
|
|
2017-11-25 18:27:49 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "dlang";
|
|
|
|
repo = "dub";
|
|
|
|
rev = "v${version}";
|
2018-01-26 21:14:52 +00:00
|
|
|
sha256 = "09bcc9bq2z1rbm8sdip1l81y5p8q13r30k02lzifyasiplrnpvlv";
|
2017-11-25 18:27:49 +00:00
|
|
|
};
|
2017-10-20 21:12:17 +01:00
|
|
|
|
2018-01-26 21:14:52 +00:00
|
|
|
patches = [
|
|
|
|
# TODO Remove with next release which contains https://github.com/dlang/dub/pull/1354
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://patch-diff.githubusercontent.com/raw/dlang/dub/pull/1354.patch";
|
|
|
|
sha256 = "01alky8a91qwjmlnfjbrn8kiivwr69f3j4c84cjlxrzfp1ph20ah";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2017-11-25 18:27:49 +00:00
|
|
|
postPatch = ''
|
|
|
|
# Avoid that the version file is overwritten
|
|
|
|
substituteInPlace build.sh \
|
|
|
|
--replace source/dub/version_.d /dev/null
|
2017-10-20 21:12:17 +01:00
|
|
|
|
2017-11-25 18:27:49 +00:00
|
|
|
patchShebangs .
|
|
|
|
'';
|
2017-10-20 21:12:17 +01:00
|
|
|
|
2017-11-25 18:27:49 +00:00
|
|
|
nativeBuildInputs = [ dmd libevent rsync ];
|
|
|
|
buildInputs = [ curl ];
|
2017-10-20 21:12:17 +01:00
|
|
|
|
2017-11-25 18:27:49 +00:00
|
|
|
buildPhase = ''
|
|
|
|
export DMD=${dmd.out}/bin/dmd
|
|
|
|
./build.sh
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir $out
|
|
|
|
mkdir $out/bin
|
|
|
|
cp bin/dub $out/bin
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Package and build manager for D applications and libraries";
|
|
|
|
homepage = http://code.dlang.org/;
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ ThomasMader ];
|
|
|
|
platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# Need to test in a fixed-output derivation, otherwise the
|
|
|
|
# network tests would fail if sandbox mode is enabled.
|
|
|
|
dubUnittests = stdenv.mkDerivation rec {
|
|
|
|
name = "dubUnittests-${version}";
|
|
|
|
version = dubBuild.version;
|
|
|
|
|
|
|
|
enableParallelBuilding = dubBuild.enableParallelBuilding;
|
|
|
|
preferLocalBuild = true;
|
|
|
|
inputString = dubBuild.outPath;
|
|
|
|
outputHashAlgo = "sha256";
|
|
|
|
outputHash = builtins.hashString "sha256" inputString;
|
|
|
|
|
|
|
|
src = dubBuild.src;
|
2018-01-26 21:14:52 +00:00
|
|
|
|
|
|
|
patches = dubBuild.patches;
|
2015-01-18 00:41:39 +00:00
|
|
|
|
2017-11-25 18:27:49 +00:00
|
|
|
postPatch = dubBuild.postPatch;
|
2017-10-20 21:12:17 +01:00
|
|
|
|
2017-11-25 18:27:49 +00:00
|
|
|
nativeBuildInputs = dubBuild.nativeBuildInputs;
|
|
|
|
buildInputs = dubBuild.buildInputs;
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
# Can't use dub from dubBuild directly because one unittest
|
|
|
|
# (issue895-local-configuration) needs to generate a config
|
|
|
|
# file under ../etc relative to the dub location.
|
|
|
|
cp ${dubBuild}/bin/dub bin/
|
|
|
|
export DUB=$NIX_BUILD_TOP/source/bin/dub
|
2017-10-20 21:12:17 +01:00
|
|
|
export DC=${dmd.out}/bin/dmd
|
|
|
|
export HOME=$TMP
|
|
|
|
./test/run-unittest.sh
|
2017-11-25 18:27:49 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
echo -n $inputString > $out
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
inherit dubUnittests;
|
|
|
|
name = "dub-${dubBuild.version}";
|
|
|
|
phases = "installPhase";
|
2017-12-08 21:12:11 +00:00
|
|
|
buildInputs = dubBuild.buildInputs;
|
2017-10-20 21:12:17 +01:00
|
|
|
|
2015-01-18 00:41:39 +00:00
|
|
|
installPhase = ''
|
2016-05-23 00:31:58 +01:00
|
|
|
mkdir $out
|
2017-11-25 18:27:49 +00:00
|
|
|
cp -r --symbolic-link ${dubBuild}/* $out/
|
2015-01-18 00:41:39 +00:00
|
|
|
'';
|
2017-12-08 21:12:11 +00:00
|
|
|
|
|
|
|
meta = dubBuild.meta;
|
2015-01-18 00:41:39 +00:00
|
|
|
}
|
|
|
|
|