at 23.05-pre 2.0 kB view raw
1{ lib, stdenv, fetchurl, curl, tzdata, autoPatchelfHook, fixDarwinDylibNames, glibc 2, version, hashes }: 3 4let 5 inherit (stdenv) hostPlatform; 6 OS = if hostPlatform.isDarwin then "osx" else hostPlatform.parsed.kernel.name; 7 MODEL = toString hostPlatform.parsed.cpu.bits; 8in stdenv.mkDerivation { 9 pname = "dmd-bootstrap"; 10 inherit version; 11 12 src = fetchurl rec { 13 name = "dmd.${version}.${OS}.tar.xz"; 14 url = "http://downloads.dlang.org/releases/2.x/${version}/${name}"; 15 sha256 = hashes.${OS} or (throw "missing bootstrap sha256 for OS ${OS}"); 16 }; 17 18 dontConfigure = true; 19 dontBuild = true; 20 21 nativeBuildInputs = lib.optionals hostPlatform.isLinux [ 22 autoPatchelfHook 23 ] ++ lib.optionals hostPlatform.isDarwin [ 24 fixDarwinDylibNames 25 ]; 26 propagatedBuildInputs = [ 27 curl 28 tzdata 29 ] ++ lib.optionals hostPlatform.isLinux [ 30 glibc 31 ]; 32 33 installPhase = '' 34 runHook preInstall 35 36 mkdir -p $out 37 38 # try to copy model-specific binaries into bin first 39 mv ${OS}/bin${MODEL} $out/bin || true 40 41 mv src license.txt ${OS}/* $out/ 42 43 # move man into place 44 mkdir -p $out/share 45 mv man $out/share/ 46 47 # move docs into place 48 mkdir -p $out/share/doc 49 mv html/d $out/share/doc/ 50 51 # fix paths in dmd.conf (one level less) 52 substituteInPlace $out/bin/dmd.conf --replace "/../../" "/../" 53 54 runHook postInstall 55 ''; 56 57 # Stripping on Darwin started to break libphobos2.a 58 # Undefined symbols for architecture x86_64: 59 # "_rt_envvars_enabled", referenced from: 60 # __D2rt6config16rt_envvarsOptionFNbNiAyaMDFNbNiQkZQnZQq in libphobos2.a(config_99a_6c3.o) 61 dontStrip = hostPlatform.isDarwin; 62 63 meta = with lib; { 64 description = "Digital Mars D Compiler Package"; 65 # As of 2.075 all sources and binaries use the boost license 66 license = licenses.boost; 67 maintainers = [ maintainers.lionello ]; 68 homepage = "https://dlang.org/"; 69 platforms = [ "x86_64-darwin" "i686-linux" "x86_64-linux" ]; 70 }; 71}