Skip to content

Commit 5f308df

Browse files
committed
Merge remote-tracking branch 'upstream/master' into stable
2 parents 7285fe8 + baa1d1c commit 5f308df

File tree

48 files changed

+1803
-1279
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1803
-1279
lines changed

.github/workflows/main.yml

+13-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
fail-fast: false
5353
matrix:
5454
# Latest stable version, update at will
55-
os: [ macOS-12, ubuntu-20.04, windows-2019 ]
55+
os: [ macOS-13, ubuntu-22.04, windows-2019 ]
5656
dc:
5757
# Always test latest as that is what we use to compile on release
5858
- dmd-latest
@@ -65,12 +65,21 @@ jobs:
6565
- dmd-2.099.1
6666
- dmd-2.102.2
6767
- dmd-2.105.3
68+
- dmd-2.108.1
6869
include:
6970
- { do_test: false }
7071
- { dc: dmd-latest, do_test: true }
7172
- { dc: ldc-latest, do_test: true }
7273
- { dc: dmd-master, do_test: true }
7374
- { dc: ldc-master, do_test: true }
75+
# Test on ARM64
76+
- { os: macOS-14, dc: ldc-latest, do_test: true }
77+
exclude:
78+
# Error with those versions:
79+
# ld: multiple errors: symbol count from symbol table and dynamic symbol table differ in [.../dub.o]; address=0x0 points to section(2) with no content in '[...]/osx/lib/libphobos2.a[3177](config_a68_4c3.o)'
80+
- { os: macOS-13, dc: dmd-2.099.1 }
81+
- { os: macOS-13, dc: dmd-2.102.2 }
82+
- { os: macOS-13, dc: dmd-2.105.3 }
7483

7584
runs-on: ${{ matrix.os }}
7685
steps:
@@ -79,7 +88,9 @@ jobs:
7988
- name: '[OSX] Install dependencies'
8089
if: runner.os == 'macOS'
8190
run: |
82-
brew install pkg-config coreutils
91+
# We need to install GNU utils as the test-suite scripts expect it.
92+
# Without them we may get slightly different behavior in tests and hard-to-track failures
93+
brew install coreutils diffutils
8394
echo "PKG_CONFIG_PATH=/usr/local/opt/[email protected]/lib/pkgconfig/" >> $GITHUB_ENV
8495
8596
- name: '[Linux] Install dependencies'

.github/workflows/pr_info_untrusted.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: '[Linux] Install dependencies'
2121
if: runner.os == 'Linux'
2222
run: |
23-
sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev netcat
23+
sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
2424
2525
# Compiler to test with
2626
- name: Prepare compiler

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
os: [ macOS-12, ubuntu-20.04, windows-2019 ]
17+
os: [ macOS-13, ubuntu-22.04, windows-2019 ]
1818
arch: [ x86_64 ]
1919
include:
2020
- { os: windows-2019, arch: i686 }

changelog/fix-cimport-paths.dd

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix issue where cImportPaths wasn't working with dmd and ldc
2+
3+
dub was passing -I<import path> instead of -P-I<import path> as is required by those compilers

dub.sdl

+7-6
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ license "MIT"
77

88
targetPath "bin"
99

10-
dflags "-preview=in" platform="dmd"
11-
dflags "-preview=in" platform="ldc"
12-
//Disabled due to ICEs in gdc.
13-
//dflags "-fpreview=in" platform="gdc"
1410
// Deprecated module(s)
1511
excludedSourceFiles "source/dub/packagesupplier.d"
1612

@@ -21,6 +17,11 @@ configuration "application" {
2117
// Uncomment to get rich output about the file parsing and json <-> YAML
2218
// integrity checks
2319
//debugVersions "ConfigFillerDebug"
20+
21+
dflags "-preview=in" platform="dmd"
22+
dflags "-preview=in" platform="ldc"
23+
//Disabled due to ICEs in gdc.
24+
//dflags "-fpreview=in" platform="gdc"
2425
}
2526

2627
configuration "library" {
@@ -31,13 +32,13 @@ configuration "library" {
3132
}
3233

3334
configuration "library-nonet" {
34-
dependency "vibe-d:http" version=">=0.9.0 <0.10.0" optional=true
35+
dependency "vibe-d:http" version=">=0.9.0 <0.11.0" optional=true
3536
targetType "library"
3637
excludedSourceFiles "source/app.d"
3738
}
3839

3940
configuration "dynamic-library-nonet" {
40-
dependency "vibe-d:http" version=">=0.9.0 <0.10.0" optional=true
41+
dependency "vibe-d:http" version=">=0.9.0 <0.11.0" optional=true
4142
targetType "dynamicLibrary"
4243
excludedSourceFiles "source/app.d"
4344
}

dub.selections.json

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
{
22
"fileVersion": 1,
33
"versions": {
4-
"botan": "1.12.19",
5-
"botan-math": "1.0.3",
6-
"diet-ng": "1.8.1",
7-
"eventcore": "0.9.30",
8-
"libasync": "0.8.6",
9-
"libev": "5.0.0+4.04",
10-
"libevent": "2.0.2+2.0.16",
11-
"memutils": "1.0.10",
12-
"mir-linux-kernel": "1.0.1",
13-
"openssl": "3.3.3",
4+
"diet-ng": "1.8.2",
5+
"eventcore": "0.9.35",
6+
"mir-linux-kernel": "1.2.1",
7+
"openssl": "3.3.4",
148
"openssl-static": "1.0.5+3.0.8",
159
"stdx-allocator": "2.77.5",
1610
"taggedalgebraic": "0.11.23",
17-
"vibe-container": "1.3.1",
18-
"vibe-core": "2.8.5",
19-
"vibe-d": "0.9.8"
11+
"vibe-container": "1.4.0",
12+
"vibe-core": "2.9.6",
13+
"vibe-d": "0.10.1",
14+
"vibe-http": "1.2.1",
15+
"vibe-inet": "1.1.0",
16+
"vibe-serialization": "1.0.7",
17+
"vibe-stream": "1.1.1"
2018
}
2119
}

source/dub/compilers/compiler.d

+19-17
Original file line numberDiff line numberDiff line change
@@ -171,20 +171,24 @@ interface Compiler {
171171
format("%s failed with exit code %s.", args[0], status));
172172
}
173173

174+
/** Default compiler arguments for performing a probe. They should
175+
be the D compiler equivalent of "don't output executables"
176+
*/
177+
protected string[] defaultProbeArgs() const;
178+
174179
/** Compiles platform probe file with the specified compiler and parses its output.
175180
Params:
176181
compiler_binary = binary to invoke compiler with
177-
args = arguments for the probe compilation
178-
arch_override = special handler for x86_mscoff
182+
arch_flags = compiler specific flags derived from the user's arch override
179183
*/
180-
protected final BuildPlatform probePlatform(string compiler_binary, string[] args, string arch_override)
184+
protected final BuildPlatform probePlatform(string compiler_binary, string[] arch_flags)
181185
{
182186
import dub.compilers.utils : generatePlatformProbeFile, readPlatformSDLProbe;
183187
import std.string : format, strip;
184188

185-
NativePath fil = generatePlatformProbeFile();
189+
immutable fileArg = generatePlatformProbeFile().toNativeString;
186190

187-
auto result = execute(compiler_binary ~ args ~ fil.toNativeString());
191+
auto result = execute(compiler_binary ~ defaultProbeArgs ~ arch_flags ~ fileArg);
188192
enforce!CompilerInvocationException(result.status == 0,
189193
format("Failed to invoke the compiler %s to determine the build platform: %s",
190194
compiler_binary, result.output));
@@ -200,22 +204,20 @@ interface Compiler {
200204
build_platform.compilerVersion = ver;
201205
}
202206

203-
// Skip the following check for LDC, emitting a warning if the specified `-arch`
204-
// cmdline option does not lead to the same string being found among
205-
// `build_platform.architecture`, as it's brittle and doesn't work with triples.
206-
if (build_platform.compiler != "ldc") {
207-
if (arch_override.length && !build_platform.architecture.canFind(arch_override) &&
208-
!(build_platform.compiler == "dmd" && arch_override.among("x86_omf", "x86_mscoff")) // Will be fixed in determinePlatform
209-
) {
210-
logWarn(`Failed to apply the selected architecture %s. Got %s.`,
211-
arch_override, build_platform.architecture);
212-
}
213-
}
214-
215207
return build_platform;
216208
}
209+
217210
}
218211

219212
private {
220213
Compiler[] s_compilers;
221214
}
215+
216+
/// Adds the given flags to the build settings if desired, otherwise informs the user
217+
package void maybeAddArchFlags(ref BuildSettings settings, bool keep_arch, string[] arch_flags, string arch_override) {
218+
if (keep_arch)
219+
settings.addDFlags(arch_flags);
220+
else if (arch_override.length) {
221+
logDebug("Ignoring arch_override '%s' for better caching because it doesn't affect the build", arch_override);
222+
}
223+
}

source/dub/compilers/dmd.d

+39-22
Original file line numberDiff line numberDiff line change
@@ -110,34 +110,37 @@ config /etc/dmd.conf
110110
{
111111
// Set basic arch flags for the probe - might be revised based on the exact value + compiler version
112112
string[] arch_flags;
113-
if (arch_override.length)
114-
arch_flags = [ arch_override != "x86_64" ? "-m32" : "-m64" ];
115-
else
116-
{
117-
// Don't use Optlink by default on Windows
118-
version (Windows) {
119-
const is64bit = isWow64();
120-
if (!is64bit.isNull)
121-
arch_flags = [ is64bit.get ? "-m64" : "-m32" ];
122-
}
123-
}
124-
125-
BuildPlatform bp = probePlatform(
126-
compiler_binary,
127-
arch_flags ~ ["-quiet", "-c", "-o-", "-v"],
128-
arch_override
129-
);
130-
131113
switch (arch_override) {
132114
default: throw new UnsupportedArchitectureException(arch_override);
133-
case "": break;
115+
case "":
116+
// Don't use Optlink by default on Windows
117+
version (Windows) {
118+
const is64bit = isWow64();
119+
if (!is64bit.isNull)
120+
arch_flags = [ is64bit.get ? "-m64" : "-m32" ];
121+
}
122+
break;
134123
// DMD 2.099 made MsCOFF the default, and DMD v2.109 removed OMF
135124
// support. Default everything to MsCOFF, people wanting to use OMF
136125
// should use an older DMD / dub.
137126
case "x86", "x86_omf", "x86_mscoff": arch_flags = ["-m32"]; break;
138127
case "x86_64": arch_flags = ["-m64"]; break;
139128
}
140-
settings.addDFlags(arch_flags);
129+
130+
auto bp = probePlatform(compiler_binary, arch_flags);
131+
132+
bool keep_arch;
133+
if (arch_flags.length)
134+
keep_arch = bp.architecture != probePlatform(compiler_binary, []).architecture;
135+
settings.maybeAddArchFlags(keep_arch, arch_flags, arch_override);
136+
137+
if (arch_override.length
138+
&& !bp.architecture.canFind(arch_override)
139+
&& !arch_override.among("x86_omf", "x86_mscoff")
140+
) {
141+
logWarn(`Failed to apply the selected architecture %s. Got %s.`,
142+
arch_override, bp.architecture);
143+
}
141144

142145
return bp;
143146
}
@@ -171,10 +174,20 @@ config /etc/dmd.conf
171174
version (LDC) unittest {
172175
import std.conv : to;
173176

177+
version (ARM)
178+
enum isARM = true;
179+
version (AArch64)
180+
enum isARM = true;
181+
else
182+
enum isARM = false;
183+
174184
BuildSettings settings;
175185
auto compiler = new DMDCompiler;
176186
auto bp = compiler.determinePlatform(settings, "ldmd2", "x86");
177-
assert(bp.architecture.canFind("x86"), bp.architecture.to!string);
187+
static if (isARM)
188+
assert(bp.architecture.canFind("arm"), bp.architecture.to!string);
189+
else
190+
assert(bp.architecture.canFind("x86"), bp.architecture.to!string);
178191
bp = compiler.determinePlatform(settings, "ldmd2", "");
179192
version (X86) assert(bp.architecture.canFind("x86"), bp.architecture.to!string);
180193
version (X86_64) assert(bp.architecture.canFind("x86_64"), bp.architecture.to!string);
@@ -212,7 +225,7 @@ config /etc/dmd.conf
212225
}
213226

214227
if (!(fields & BuildSetting.cImportPaths)) {
215-
settings.addDFlags(settings.cImportPaths.map!(s => "-I"~s)().array());
228+
settings.addDFlags(settings.cImportPaths.map!(s => "-P-I"~s)().array());
216229
settings.cImportPaths = null;
217230
}
218231

@@ -396,4 +409,8 @@ config /etc/dmd.conf
396409
|| arg.startsWith("-defaultlib=");
397410
}
398411
}
412+
413+
protected string[] defaultProbeArgs () const {
414+
return ["-quiet", "-c", "-o-", "-v"];
415+
}
399416
}

source/dub/compilers/gdc.d

+12-6
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,15 @@ class GDCCompiler : Compiler {
7676
case "x86": arch_flags = ["-m32"]; break;
7777
case "x86_64": arch_flags = ["-m64"]; break;
7878
}
79-
settings.addDFlags(arch_flags);
8079

81-
return probePlatform(
82-
compiler_binary,
83-
arch_flags ~ ["-fsyntax-only", "-v"],
84-
arch_override
85-
);
80+
auto bp = probePlatform(compiler_binary, arch_flags);
81+
82+
bool keep_arch;
83+
if (arch_flags.length)
84+
keep_arch = bp.architecture != probePlatform(compiler_binary, []).architecture;
85+
settings.maybeAddArchFlags(keep_arch, arch_flags, arch_override);
86+
87+
return bp;
8688
}
8789

8890
void prepareBuildSettings(ref BuildSettings settings, const scope ref BuildPlatform platform, BuildSetting fields = BuildSetting.all) const
@@ -266,6 +268,10 @@ class GDCCompiler : Compiler {
266268

267269
return dflags;
268270
}
271+
272+
protected string[] defaultProbeArgs () const {
273+
return ["-fsyntax-only", "-v"];
274+
}
269275
}
270276

271277
private string extractTarget(const string[] args) { auto i = args.countUntil("-o"); return i >= 0 ? args[i+1] : null; }

source/dub/compilers/ldc.d

+17-9
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ config /etc/ldc2.conf (x86_64-pc-linux-gnu)
7979
BuildPlatform determinePlatform(ref BuildSettings settings, string compiler_binary, string arch_override)
8080
{
8181
string[] arch_flags;
82+
bool arch_override_is_triple = false;
8283
switch (arch_override) {
8384
case "": break;
8485
case "x86": arch_flags = ["-march=x86"]; break;
@@ -87,19 +88,22 @@ config /etc/ldc2.conf (x86_64-pc-linux-gnu)
8788
case "aarch64": arch_flags = ["-march=aarch64"]; break;
8889
case "powerpc64": arch_flags = ["-march=powerpc64"]; break;
8990
default:
90-
if (arch_override.canFind('-'))
91+
if (arch_override.canFind('-')) {
92+
arch_override_is_triple = true;
9193
arch_flags = ["-mtriple="~arch_override];
92-
else
94+
} else
9395
throw new UnsupportedArchitectureException(arch_override);
9496
break;
9597
}
96-
settings.addDFlags(arch_flags);
9798

98-
return probePlatform(
99-
compiler_binary,
100-
arch_flags ~ ["-c", "-o-", "-v"],
101-
arch_override
102-
);
99+
auto bp = probePlatform(compiler_binary, arch_flags);
100+
101+
bool keep_arch = arch_override_is_triple;
102+
if (!keep_arch && arch_flags.length)
103+
keep_arch = bp.architecture != probePlatform(compiler_binary, []).architecture;
104+
settings.maybeAddArchFlags(keep_arch, arch_flags, arch_override);
105+
106+
return bp;
103107
}
104108

105109
void prepareBuildSettings(ref BuildSettings settings, const scope ref BuildPlatform platform, BuildSetting fields = BuildSetting.all) const
@@ -133,7 +137,7 @@ config /etc/ldc2.conf (x86_64-pc-linux-gnu)
133137
}
134138

135139
if (!(fields & BuildSetting.cImportPaths)) {
136-
settings.addDFlags(settings.cImportPaths.map!(s => "-I"~s)().array());
140+
settings.addDFlags(settings.cImportPaths.map!(s => "-P-I"~s)().array());
137141
settings.cImportPaths = null;
138142
}
139143

@@ -335,4 +339,8 @@ config /etc/ldc2.conf (x86_64-pc-linux-gnu)
335339
|| arg.startsWith("-mtriple=");
336340
}
337341
}
342+
343+
protected string[] defaultProbeArgs () const {
344+
return ["-c", "-o-", "-v"];
345+
}
338346
}

source/dub/data/settings.d

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ unittest {
195195
import std.exception : assertThrown;
196196

197197
const str1 = `{
198-
"skipRegistry": "all"
199-
`;
198+
"skipRegistry": "default_"
199+
}`;
200200
assertThrown!Exception(parseConfigString!Settings(str1, "/dev/null"));
201201
}

0 commit comments

Comments
 (0)