Fix Dub package when cross-compiling

The pre generate commands were using the native platform instead of
target platform.
This commit is contained in:
Jacob Carlborg 2019-01-19 12:49:20 +01:00
parent 5574da0091
commit 65bd76713c
4 changed files with 24 additions and 14 deletions

View file

@ -1,3 +1,7 @@
/+
dub.sdl:
name "config"
+/
/**
Generates the compiler version, the version printed with `dmd --version`.

View file

@ -30,8 +30,8 @@ subPackage {
"src/dmd/tokens.d" \
"src/dmd/utf.d"
preGenerateCommands `"$${DC}" -run "$${DUB_PACKAGE_DIR}/config.d" "$${DUB_PACKAGE_DIR}/generated/dub" "$${DUB_PACKAGE_DIR}/VERSION" /etc` platform="posix"
preGenerateCommands `"%DC%" -run "%DUB_PACKAGE_DIR%/config.d" "%DUB_PACKAGE_DIR%/generated/dub" "%DUB_PACKAGE_DIR%/VERSION"` platform="windows"
preGenerateCommands `"$${DUB_EXE}" --arch=$${DUB_ARCH} --single "$${DUB_PACKAGE_DIR}config.d" -- "$${DUB_PACKAGE_DIR}generated/dub" "$${DUB_PACKAGE_DIR}VERSION" /etc` platform="posix"
preGenerateCommands `"%DUB_EXE%" --arch=%DUB_ARCH% --single "%DUB_PACKAGE_DIR%config.d" "%DUB_PACKAGE_DIR%generated/dub" "%DUB_PACKAGE_DIR%VERSION"` platform="windows"
stringImportPaths "generated/dub"
dependency "dmd:root" version="*"
@ -55,9 +55,6 @@ subPackage {
subPackage {
name "frontend"
targetType "library"
preGenerateCommands `"$${DC}" -run "$${DUB_PACKAGE_DIR}/config.d" "$${DUB_PACKAGE_DIR}/generated/dub" "$${DUB_PACKAGE_DIR}/VERSION" /etc` platform="posix"
preGenerateCommands `"%DC%" -run "%DUB_PACKAGE_DIR%/config.d" "%DUB_PACKAGE_DIR%/generated/dub" "%DUB_PACKAGE_DIR%/VERSION"` platform="windows"
stringImportPaths "generated/dub"
stringImportPaths "res"
versions "NoBackend"
versions "GC"
@ -66,4 +63,6 @@ subPackage {
sourcePaths "src/dmd"
excludedSourceFiles "src/dmd/backend/*"
excludedSourceFiles "src/dmd/{dmsc,e2ir,eh,glue,iasm,iasmdmd,iasmgcc,objc_glue,s2ir,tocsym,toctype,toobj,todt,toir}.d"
dependency "dmd:parser" version="*"
}

View file

@ -36,13 +36,21 @@ source ci.sh
# Always source a DMD instance
################################################################################
# FIXME: v2.082.0 has a broken DUB which fails the CI
# Remove this when a fixed v2.082.1 is released
# See https://github.com/dlang/dub/issues/1551
if [ "$DMD" == "dmd" ]; then
install_d "dmd-2.081.2"
elif [ "$DMD" == "ldc" ]; then
install_d "ldc-1.11.0"
# Later versions of LDC causes a linker error.
if [ "$DMD" == "ldc" ]; then
LDC_VERSION=1.11.0
DUB_VERSION=1.13.0
install_d "ldc-$LDC_VERSION"
source ~/dlang/ldc-$LDC_VERSION/activate
# Older versions of LDC are shipped with a version of Dub that doesn't
# support the `DUB_EXE` environment variable
curl -o dub.tar.gz -L https://github.com/dlang/dub/releases/download/v$DUB_VERSION/dub-v$DUB_VERSION-linux-x86_64.tar.gz
tar xf dub.tar.gz
# Replace default dub with newer version
mv dub $(which dub)
deactivate
else
install_d "$DMD"
fi

View file

@ -1125,9 +1125,8 @@ version (Posix)
*/
auto absPathThen(alias F)(const(char)[] fileName)
{
import core.sys.posix.stdlib: free;
auto absPath = FileName.canonicalName(fileName);
scope(exit) free(cast(void*)absPath.ptr);
scope(exit) mem.xfree(cast(void*)absPath.ptr);
return F(cast(char[])absPath);
}
}