mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 05:00:16 +03:00

The build of the lexer dub subpackage requires running and building a little config.d tool as custom pregenerate command. Forwarding the target architecture via `--arch=$DUB_ARCH` to the nested dub build of config.d was added in #9275, to fix cross- compilation, but in reality broke it. Not specifying the architecture explicitly for the little helper build lets the compiler pick the default one, the host's native platform in practice, which is guaranteed to be runnable on that compiling **host**, independent from the **target** platform for the main dub build. Suppose one cross-compiles the dmd:lexer subpackage from x86_64 to AArch64 - an AArch64 config.d executable will hardly run on the x86_64 host, and won't be able to generate the `VERSION` and `SYSCONFDIR.imp` string-import files as pre- requisite of the build. Side note: using little separately-built .d tools/scripts as build helpers for autogenerating little VERSION files etc. is IMO bad practice - when cross-compiling, you require a D compiler that can a) cross-compile, and b) build successfully for the native platform too. Not sure this approach will e.g. ever work with GDC, where you have different toolchains for each host->target combination.
145 lines
3.1 KiB
Text
145 lines
3.1 KiB
Text
name "dmd"
|
|
description "The DMD compiler"
|
|
authors "Walter Bright"
|
|
copyright "Copyright © 1999-2018, The D Language Foundation"
|
|
license "BSL-1.0"
|
|
toolchainRequirements dub=">=1.29.0" # can use $DUB_EXE etc. in custom commands
|
|
|
|
targetType "none"
|
|
dependency ":frontend" version="*"
|
|
|
|
subPackage {
|
|
name "compiler"
|
|
targetType "executable"
|
|
targetName "dmd"
|
|
sourcePaths "compiler/src/dmd"
|
|
importPaths "compiler/src"
|
|
stringImportPaths "compiler/src/dmd/res" "."
|
|
dflags "-L/STACK:16777216" platform="windows"
|
|
dflags "-preview=dip1000"
|
|
preGenerateCommands "echo -n /etc > SYSCONFDIR.imp" platform="posix"
|
|
}
|
|
|
|
subPackage {
|
|
name "root"
|
|
targetType "library"
|
|
importPaths "compiler/src"
|
|
sourcePaths "compiler/src/dmd/common" "compiler/src/dmd/root"
|
|
}
|
|
|
|
subPackage {
|
|
name "lexer"
|
|
targetType "library"
|
|
importPaths "compiler/src"
|
|
sourcePaths
|
|
|
|
sourceFiles \
|
|
"compiler/src/dmd/console.d" \
|
|
"compiler/src/dmd/entity.d" \
|
|
"compiler/src/dmd/errors.d" \
|
|
"compiler/src/dmd/file_manager.d" \
|
|
"compiler/src/dmd/globals.d" \
|
|
"compiler/src/dmd/id.d" \
|
|
"compiler/src/dmd/identifier.d" \
|
|
"compiler/src/dmd/lexer.d" \
|
|
"compiler/src/dmd/location.d" \
|
|
"compiler/src/dmd/tokens.d" \
|
|
"compiler/src/dmd/utils.d" \
|
|
"compiler/src/dmd/errorsink.d"
|
|
|
|
versions \
|
|
"CallbackAPI" \
|
|
"DMDLIB"
|
|
|
|
# generate files `generated/dub/{VERSION,SYSCONFDIR.imp}` for string-imports
|
|
# by building & running the config.d tool
|
|
preGenerateCommands `"$DUB_EXE" "--compiler=$DC" --single "${DUB_PACKAGE_DIR}config.d" -- "${DUB_PACKAGE_DIR}generated/dub" "${DUB_PACKAGE_DIR}VERSION" /etc`
|
|
|
|
stringImportPaths \
|
|
"compiler/src/dmd/res" \
|
|
"generated/dub"
|
|
|
|
dependency "dmd:root" version="*"
|
|
}
|
|
|
|
subPackage {
|
|
name "parser"
|
|
targetType "library"
|
|
importPaths "compiler/src"
|
|
sourcePaths
|
|
|
|
sourceFiles \
|
|
"compiler/src/dmd/astbase.d" \
|
|
"compiler/src/dmd/parse.d" \
|
|
"compiler/src/dmd/transitivevisitor.d" \
|
|
"compiler/src/dmd/permissivevisitor.d" \
|
|
"compiler/src/dmd/strictvisitor.d"
|
|
|
|
versions "CallbackAPI"
|
|
|
|
dependency "dmd:lexer" version="*"
|
|
}
|
|
|
|
subPackage {
|
|
name "frontend"
|
|
targetType "library"
|
|
importPaths "compiler/src"
|
|
sourcePaths "compiler/src/dmd"
|
|
stringImportPaths "compiler/src/dmd/res"
|
|
|
|
versions \
|
|
"NoBackend" \
|
|
"GC" \
|
|
"NoMain" \
|
|
"MARS" \
|
|
"CallbackAPI"
|
|
|
|
excludedSourceFiles "compiler/src/dmd/backend/*"
|
|
excludedSourceFiles "compiler/src/dmd/root/*"
|
|
excludedSourceFiles "compiler/src/dmd/common/*"
|
|
excludedSourceFiles "compiler/src/dmd/{\
|
|
astbase,\
|
|
console,\
|
|
entity,\
|
|
errors,\
|
|
file_manager,\
|
|
globals,\
|
|
id,\
|
|
identifier,\
|
|
lexer,\
|
|
parse,\
|
|
permissivevisitor,\
|
|
strictvisitor,\
|
|
tokens,\
|
|
transitivevisitor,\
|
|
utf,\
|
|
utils\
|
|
}.d"
|
|
excludedSourceFiles "compiler/src/dmd/{\
|
|
dmsc,\
|
|
e2ir,\
|
|
eh,\
|
|
glue,\
|
|
iasmdmd,\
|
|
iasmgcc,\
|
|
irstate,\
|
|
lib,\
|
|
libelf,\
|
|
libmach,\
|
|
libmscoff,\
|
|
link,\
|
|
objc_glue,\
|
|
s2ir,\
|
|
scanelf,\
|
|
scanmach,\
|
|
scanmscoff,\
|
|
tocsym,\
|
|
toctype,\
|
|
tocvdebug,\
|
|
toobj,\
|
|
todt,\
|
|
toir\
|
|
}.d"
|
|
|
|
dependency "dmd:parser" version="*"
|
|
}
|