diff --git a/source/dub/compilers/compiler.d b/source/dub/compilers/compiler.d index bca6114..0f4fb32 100644 --- a/source/dub/compilers/compiler.d +++ b/source/dub/compilers/compiler.d @@ -152,15 +152,20 @@ build_platform.compilerVersion = ver; } - // Hack: see #1059 - // When compiling with --arch=x86_mscoff build_platform.architecture is equal to ["x86"] and canFind below is false. - // This hack prevents unnesessary warning 'Failed to apply the selected architecture x86_mscoff. Got ["x86"]'. - // And also makes "x86_mscoff" available as a platform specifier in the package recipe - if (arch_override == "x86_mscoff") - build_platform.architecture ~= arch_override; - if (arch_override.length && !build_platform.architecture.canFind(arch_override)) { - logWarn(`Failed to apply the selected architecture %s. Got %s.`, - arch_override, build_platform.architecture); + // Skip the following check for LDC, emitting a warning if the specified `-arch` + // cmdline option does not lead to the same string being found among + // `build_platform.architecture`, as it's brittle and doesn't work with triples. + if (build_platform.compiler != "ldc") { + // Hack: see #1059 + // When compiling with --arch=x86_mscoff build_platform.architecture is equal to ["x86"] and canFind below is false. + // This hack prevents unnesessary warning 'Failed to apply the selected architecture x86_mscoff. Got ["x86"]'. + // And also makes "x86_mscoff" available as a platform specifier in the package recipe + if (arch_override == "x86_mscoff") + build_platform.architecture ~= arch_override; + if (arch_override.length && !build_platform.architecture.canFind(arch_override)) { + logWarn(`Failed to apply the selected architecture %s. Got %s.`, + arch_override, build_platform.architecture); + } } return build_platform; diff --git a/source/dub/compilers/dmd.d b/source/dub/compilers/dmd.d index fd5b73f..70df37e 100644 --- a/source/dub/compilers/dmd.d +++ b/source/dub/compilers/dmd.d @@ -226,7 +226,7 @@ case TargetType.dynamicLibrary: if (platform.platform.canFind("windows")) return settings.targetName ~ ".dll"; - else if (platform.platform.canFind("osx")) + else if (platform.platform.canFind("darwin")) return "lib" ~ settings.targetName ~ ".dylib"; else return "lib" ~ settings.targetName ~ ".so"; case TargetType.object: diff --git a/source/dub/compilers/gdc.d b/source/dub/compilers/gdc.d index 71f4257..ea2a596 100644 --- a/source/dub/compilers/gdc.d +++ b/source/dub/compilers/gdc.d @@ -170,7 +170,7 @@ case TargetType.dynamicLibrary: if (platform.platform.canFind("windows")) return settings.targetName ~ ".dll"; - else if (platform.platform.canFind("osx")) + else if (platform.platform.canFind("darwin")) return "lib" ~ settings.targetName ~ ".dylib"; else return "lib" ~ settings.targetName ~ ".so"; case TargetType.object: diff --git a/source/dub/compilers/ldc.d b/source/dub/compilers/ldc.d index da0cdff..02559c4 100644 --- a/source/dub/compilers/ldc.d +++ b/source/dub/compilers/ldc.d @@ -193,7 +193,7 @@ case TargetType.dynamicLibrary: if (p.canFind("windows")) return settings.targetName ~ ".dll"; - else if (p.canFind("osx")) + else if (p.canFind("darwin")) return "lib" ~ settings.targetName ~ ".dylib"; else return "lib" ~ settings.targetName ~ ".so"; case TargetType.object: @@ -269,6 +269,9 @@ private static bool isLinkerDFlag(string arg) { + if (arg.length > 2 && arg.startsWith("--")) + arg = arg[1 .. $]; // normalize to 1 leading hyphen + switch (arg) { case "-g", "-gc", "-m32", "-m64", "-shared", "-lib", "-betterC", "-disable-linker-strip-dead", "-static": diff --git a/source/dub/platform.d b/source/dub/platform.d index 10352d2..d908438 100644 --- a/source/dub/platform.d +++ b/source/dub/platform.d @@ -26,7 +26,10 @@ version(Windows) ret ~= "windows"; version(linux) ret ~= "linux"; version(Posix) ret ~= "posix"; - version(OSX) ret ~= "osx"; + version(OSX) ret ~= ["osx", "darwin"]; + version(iOS) ret ~= ["ios", "darwin"]; + version(TVOS) ret ~= ["tvos", "darwin"]; + version(WatchOS) ret ~= ["watchos", "darwin"]; version(FreeBSD) ret ~= "freebsd"; version(OpenBSD) ret ~= "openbsd"; version(NetBSD) ret ~= "netbsd";