@@ -3,10 +3,10 @@
33, curl, tzdata, gdb, darwin
44, callPackage
55, bootstrapVersion ? false
6−, version ? "2.078.2"
7−, dmdSha256 ? "0x9q4aw4jl36dz7m5111y2sm8jdaj3zg36zhj6vqg1lqpdn3bhls"
8−, druntimeSha256 ? "0nfqjcmwqc490bzi3582x1c3zigkf306g4nyd1cyd3vs8lfm6x66"
9−, phobosSha256 ? "08ircpf4ilznz638kra272hz8fi5ccvw2cswj5hqckssl1lyqzs8"
6+, version ? "2.079.0"
7+, dmdSha256 ? "1k6cky71pqnss6h6391p1ich2mjs598f5fda018aygnxg87qgh4y"
8+, druntimeSha256 ? "183pqygj5w4105czs5kswyjn9mrcybx3wmkynz3in0m3ylzzjmvl"
9+, phobosSha256 ? "0y9i86ggmf41ww2xk2bsrlsv9b1blj5dbyan6q6r6xp8dmgrd79w"
1010}:
1111
1212let
@@ -80,17 +80,6 @@ let
8080 "phobos/std/datetime/timezone.d";
8181
8282 phobosPatches = ''
83− substituteInPlace ${datetimePath} \
84− --replace "import core.time;" "import core.time;import std.path;"
85−
86− substituteInPlace ${datetimePath} \
87− --replace "tzName == \"leapseconds\"" "baseName(tzName) == \"leapseconds\""
88−
89− # Ugly hack to fix the hardcoded path to zoneinfo in the source file.
90− # https://issues.dlang.org/show_bug.cgi?id=15391
91− substituteInPlace ${datetimePath} \
92− --replace /usr/share/zoneinfo/ ${tzdata}/share/zoneinfo/
93−
9483 # Ugly hack so the dlopen call has a chance to succeed.
9584 # https://issues.dlang.org/show_bug.cgi?id=15391
9685 substituteInPlace phobos/std/net/curl.d \
@@ -102,15 +91,29 @@ let
10291
10392 ''
10493
94+ + stdenv.lib.optionalString (!bootstrapVersion) ''
95+ # Can be removed when https://github.com/dlang/phobos/pull/6224 is included.
96+ substituteInPlace ${datetimePath} \
97+ --replace "foreach (DirEntry de; dirEntries(tzDatabaseDir, SpanMode.depth))" "import std.path : baseName; foreach (DirEntry de; dirEntries(tzDatabaseDir, SpanMode.depth))"
98+
99+ substituteInPlace ${datetimePath} \
100+ --replace "tzName == \"leapseconds\"" "baseName(tzName) == \"leapseconds\""
101+ ''
102+
105103 + stdenv.lib.optionalString (bootstrapVersion) ''
106104 substituteInPlace ${datetimePath} \
107105 --replace "import std.traits;" "import std.traits;import std.path;"
108106
109107 substituteInPlace ${datetimePath} \
110108 --replace "tzName == \"+VERSION\"" "baseName(tzName) == \"leapseconds\" || tzName == \"+VERSION\""
109+
110+ # Ugly hack to fix the hardcoded path to zoneinfo in the source file.
111+ # https://issues.dlang.org/show_bug.cgi?id=15391
112+ substituteInPlace ${datetimePath} \
113+ --replace /usr/share/zoneinfo/ ${tzdata}/share/zoneinfo/
111114 ''
112115
113− + stdenv.lib.optionalString stdenv.hostPlatform.isLinux ''
116+ + stdenv.lib.optionalString (bootstrapVersion && stdenv.hostPlatform.isLinux) ''
114117 # See https://github.com/dlang/phobos/pull/5960
115118 substituteInPlace phobos/std/path.d \
116119 --replace "\"/root" "\"${ROOT_HOME_DIR}"
@@ -122,9 +125,6 @@ let
122125 "dmd";
123126
124127 postPatch = ''
125− # Use proper C++ compiler
126− substituteInPlace ${dmdPath}/posix.mak \
127− --replace g++ $CXX
128128 ''
129129
130130 + stdenv.lib.optionalString (!bootstrapVersion) ''
@@ -132,6 +132,12 @@ let
132132 --replace "DFLAGS:=" "DFLAGS:=${usePIC} "
133133 ''
134134
135+ + stdenv.lib.optionalString (bootstrapVersion) ''
136+ # Use proper C++ compiler
137+ substituteInPlace ${dmdPath}/posix.mak \
138+ --replace g++ $CXX
139+ ''
140+
135141 + phobosPatches
136142
137143 + stdenv.lib.optionalString (stdenv.hostPlatform.isLinux && bootstrapVersion) ''
@@ -145,9 +151,9 @@ let
145151 ''
146152
147153 + stdenv.lib.optionalString (stdenv.hostPlatform.isDarwin && bootstrapVersion) ''
148− # Was not able to compile on darwin due to "__inline_isnanl"
149− # being undefined.
150− substituteInPlace ${dmdPath}/root/port.c --replace __inline_isnanl __inline_isnan
154+ # Was not able to compile on darwin due to "__inline_isnanl"
155+ # being undefined.
156+ substituteInPlace ${dmdPath}/root/port.c --replace __inline_isnanl __inline_isnan
151157 '';
152158
153159 nativeBuildInputs = [ bootstrapDmd makeWrapper unzip which gdb ]
@@ -176,7 +182,7 @@ let
176182 cd ../druntime
177183 make -j$NIX_BUILD_CORES -f posix.mak PIC=1 INSTALL_DIR=$out DMD=${pathToDmd}
178184 cd ../phobos
179− make -j$NIX_BUILD_CORES -f posix.mak PIC=1 INSTALL_DIR=$out DMD=${pathToDmd}
185+ make -j$NIX_BUILD_CORES -f posix.mak PIC=1 INSTALL_DIR=$out DMD=${pathToDmd} TZ_DATABASE_DIR=${tzdata}/share/zoneinfo/
180186 cd ..
181187 '';
182188
@@ -260,7 +266,7 @@ let
260266
261267 buildPhase = ''
262268 cd phobos
263− make -j$NIX_BUILD_CORES -f posix.mak unittest PIC=1 DMD=${dmdBuild}/bin/dmd BUILD=release
269+ make -j$NIX_BUILD_CORES -f posix.mak unittest PIC=1 DMD=${dmdBuild}/bin/dmd BUILD=release TZ_DATABASE_DIR=${tzdata}/share/zoneinfo/
264270 '';
265271
266272 installPhase = ''