Skip to content

Commit 789efab

Browse files
authored
Merge pull request #4978 from kinke/conf_shuffle
ldc2.conf dir: Slightly shuffle order and file names, and make `ldc-build-runtime --installWithSuffix` install a .conf file
2 parents 4168997 + 5cbf841 commit 789efab

File tree

14 files changed

+104
-81
lines changed

14 files changed

+104
-81
lines changed

.cirrus.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,12 @@ packaging_steps_template: &PACKAGING_STEPS_TEMPLATE
6767
cd ..
6868
perl -pi -e s?$PWD/install/?%%ldcbinarypath%%/../?g install/etc/ldc2.conf/*
6969
if [[ "$CI_OS" == "freebsd" ]]; then
70-
cat > install/etc/ldc2.conf/35-ldc-default-CC.conf <<EOF
70+
cat > install/etc/ldc2.conf/31-compiler-default-CC.conf <<EOF
71+
// Default to the clang version matching LDC's LLVM version.
7172
"default":
7273
{
7374
switches ~= [ "-gcc=${CC}" ];
74-
}
75+
};
7576
EOF
7677
fi
7778
cp $CIRRUS_WORKING_DIR/{LICENSE,packaging/README} install

.github/actions/3-build-cross/action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ runs:
144144
--installWithSuffix "" \
145145
CMAKE_INSTALL_PREFIX="$PWD/install" \
146146
INCLUDE_INSTALL_DIR="$PWD/install/import" \
147-
CONF_INST_DIR="$PWD/install/etc" \
148147
"${flags[@]}"
149148
150149
- name: Cross-compile LDC executables

.github/actions/5-install/action.yml

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ runs:
2020
else
2121
# the cross-compiled runtime libs have already been installed:
2222
# * lib/: runtime library artifacts
23-
# * etc/ldc2.conf/30-ldc-runtime-lib.conf
23+
# * etc/ldc2.conf/: 50-target-default.conf
2424
2525
# now extend by installing the cross-compiled compiler:
2626
# * bin/: executables
2727
# * lib/: LTO plugin and compiler-rt libs
28+
# * etc/ldc2.conf/: 00-docs.conf, 30-compiler.conf, 55-target-wasm.conf, 70-compiler-rt.conf
2829
# * etc/bash_completion.d/
2930
# * import/: all runtime imports except for ldc/gccbuiltins_*.di
3031
ninja -C build-cross install
@@ -40,32 +41,14 @@ runs:
4041
cp ldc/packaging/README install/
4142
fi
4243
43-
- name: Make portable
44-
shell: bash
45-
run: |
46-
set -eux
47-
cd ..
48-
absInstallDir="$PWD/install"
49-
if [[ '${{ runner.os }}' == Windows ]]; then
50-
# /d/a/1/install => D:/a/1/install
51-
absInstallDir=$(cygpath --mixed "$absInstallDir")
52-
fi
53-
confs=( install/etc/ldc2.conf/* )
54-
perl -pi -e "s|$absInstallDir/|%%ldcbinarypath%%/../|g" "${confs[@]}"
55-
cat "${confs[@]}"
56-
57-
- name: Rename the installation dir to test portability
58-
shell: bash
59-
run: mv ../install ../installed
60-
6144
- name: 'Windows: Copy curl & MinGW-w64-based libs'
6245
if: runner.os == 'Windows'
6346
shell: bash
6447
run: |
6548
set -eux
6649
cd ..
6750
68-
cp libcurl/ldc2/* installed/bin/
51+
cp libcurl/ldc2/* install/bin/
6952
7053
curl -fL --retry 3 --max-time 60 -o mingw-w64-libs.7z \
7154
https://github.com/ldc-developers/mingw-w64-libs/releases/download/v8.0.0/mingw-w64-libs-v8.0.0.7z
@@ -79,4 +62,4 @@ runs:
7962
else
8063
model=64
8164
fi
82-
cp -r "lib$model" ../installed/lib/mingw
65+
cp -r "lib$model" ../install/lib/mingw

.github/actions/5a-android-x86/action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ runs:
2424
bootstrap-ldc/bin/ldc-build-runtime --ninja \
2525
--dFlags="-mtriple=$triple" \
2626
--ldcSrcDir="$PWD/ldc" \
27-
--installWithSuffix="-$arch" \
28-
CMAKE_INSTALL_PREFIX="$PWD/installed" \
27+
--installWithSuffix="-android-$arch" \
28+
CMAKE_INSTALL_PREFIX="$PWD/install" \
29+
RT_CONF_TRIPLE_REGEX="$arch-.*-linux-android" \
2930
"${flags[@]}" \
3031
ANDROID_ABI="$abi" # override the one in CROSS_CMAKE_FLAGS
32+
33+
# TODO: append default -gcc switch (x86_64-linux-android30-clang, i686-linux-android29-clang)
34+
cat install/etc/ldc2.conf/55-target-android-$arch.conf

.github/actions/5a-ios/action.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,17 @@ runs:
2222
sysroot='/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'
2323
fi
2424
25-
installed/bin/ldc-build-runtime --ninja \
25+
install/bin/ldc-build-runtime --ninja \
2626
--dFlags="-mtriple=$triple" \
2727
--ldcSrcDir="$PWD/ldc" \
2828
--installWithSuffix="-ios-$arch" \
29+
RT_CONF_TRIPLE_REGEX="$arch-apple-ios" \
2930
CMAKE_SYSTEM_NAME=iOS \
3031
CMAKE_OSX_SYSROOT="$sysroot" \
3132
CMAKE_OSX_ARCHITECTURES="$arch" \
3233
CMAKE_OSX_DEPLOYMENT_TARGET="$deployment_target" \
3334
BUILD_LTO_LIBS=ON
3435
35-
section="\"$arch-apple-ios\":
36-
{
37-
switches ~= [
38-
\"-Xcc=-isysroot\",
39-
\"-Xcc=$sysroot\",
40-
];
41-
lib-dirs = [
42-
\"%%ldcbinarypath%%/../lib-ios-$arch\",
43-
];
44-
rpath = \"%%ldcbinarypath%%/../lib-ios-$arch\";
45-
};"
46-
echo "$section" >> installed/etc/ldc2.conf/31-ldc-runtime-lib-ios-$arch.conf
47-
cat installed/etc/ldc2.conf/*
36+
# append cross-compile flags to generated .conf file
37+
sed -i "" "s|^{\$|{\n switches ~= [\n \"-Xcc=-isysroot\",\n \"-Xcc=${sysroot}\",\n ];|" install/etc/ldc2.conf/55-target-ios-$arch.conf
38+
cat install/etc/ldc2.conf/*
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Make LDC installation portable
2+
runs:
3+
using: composite
4+
steps:
5+
6+
- name: Make portable
7+
shell: bash
8+
run: |
9+
set -eux
10+
cd ..
11+
absInstallDir="$PWD/install"
12+
if [[ '${{ runner.os }}' == Windows ]]; then
13+
# /d/a/1/install => D:/a/1/install
14+
absInstallDir=$(cygpath --mixed "$absInstallDir")
15+
fi
16+
confs=( install/etc/ldc2.conf/* )
17+
perl -pi -e "s|$absInstallDir/|%%ldcbinarypath%%/../|g" "${confs[@]}"
18+
cat "${confs[@]}"
19+
20+
- name: Rename the installation dir to test portability
21+
shell: bash
22+
run: mv ../install ../installed

.github/actions/merge-macos/action.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,13 @@ runs:
4040
4141
# ldc2.conf:
4242
43-
# 1) x86_64 ios config
44-
# already present
45-
# 2) arm64 ios config
46-
cp ../ldc2-arm64/etc/ldc2.conf/31-ldc-runtime-lib-ios-arm64.conf etc/ldc2.conf
47-
# 3) x86_64 & arm64 macos
48-
rm etc/ldc2.conf/30-ldc-runtime-lib.conf # the old ldc2-x86_64 config
43+
# 1) x86_64 iOS: already present (55-target-ios-x86_64.conf)
44+
# 2) arm64 iOS config
45+
cp ../ldc2-arm64/etc/ldc2.conf/55-target-ios-arm64.conf etc/ldc2.conf/
46+
# 3) x86_64 & arm64 macOS
47+
rm etc/ldc2.conf/50-target-default.conf # the original x86_64 config
4948
for arch in x86_64 arm64; do
50-
cat > etc/ldc2.conf/30-ldc-runtime-lib-${arch}.conf <<EOF
49+
cat > etc/ldc2.conf/50-target-default-${arch}.conf <<EOF
5150
"${arch}-apple-":
5251
{
5352
lib-dirs = [

.github/actions/merge-windows/action.yml

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,21 @@ runs:
2020
mv ldc2-*-x64 ldc2-multilib
2121
cd ldc2-multilib
2222
mv lib lib64
23-
mv etc/ldc2.conf/30-ldc-runtime-{lib,lib64}.conf
2423
cp -R ../ldc2-x86/lib lib32
2524
cp ../ldc2-x86/bin/{*.dll,*.pdb,curl-ca-bundle.crt} lib32/
2625
- name: Merge ldc2.conf
2726
shell: pwsh
2827
run: |
2928
cd ldc2-multilib
30-
(cat etc\ldc2.conf\30-ldc-runtime-lib64.conf).replace('%%ldcbinarypath%%/../lib', '%%ldcbinarypath%%/../lib64') | Set-Content etc\ldc2.conf\30-ldc-runtime-lib64.conf
29+
(cat etc\ldc2.conf\50-target-default.conf).replace('%%ldcbinarypath%%/../lib', '%%ldcbinarypath%%/../lib64') | Set-Content etc\ldc2.conf\50-target-default.conf
3130
$conf32 = '"i[3-6]86-.*-windows-msvc":
3231
{
3332
lib-dirs = [
3433
"%%ldcbinarypath%%/../lib32",
3534
];
3635
};
3736
'
38-
Set-Content etc\ldc2.conf\31-ldc-runtime-lib32.conf $conf32
37+
Set-Content etc\ldc2.conf\55-target-windows-x86.conf $conf32
3938
cat etc\ldc2.conf\*
4039
4140
- name: Generate hello.d
@@ -80,21 +79,18 @@ runs:
8079
ldc2-multilib\bin\ldc-build-runtime --ninja ^
8180
--dFlags=-mtriple=aarch64-windows-msvc ^
8281
"--ldcSrcDir=%CD%" ^
83-
--installWithSuffix=arm64 ^
82+
--installWithSuffix=-windows-arm64 ^
83+
RT_CONF_TRIPLE_REGEX="(aarch|arm)64-.*-windows-msvc" ^
8484
BUILD_LTO_LIBS=ON
85-
- name: Add arm64 section to ldc2.conf
86-
shell: pwsh
85+
- name: Make arm64 .conf file portable
86+
shell: bash
8787
run: |
88+
set -eux
8889
cd ldc2-multilib
89-
$conf = '"(aarch|arm)64-.*-windows-msvc":
90-
{
91-
lib-dirs = [
92-
"%%ldcbinarypath%%/../libarm64",
93-
];
94-
};
95-
'
96-
Set-Content etc\ldc2.conf\31-ldc-runtime-libarm64.conf $conf
97-
cat etc\ldc2.conf\*
90+
absInstallDir=$(cygpath --mixed "$PWD")
91+
conf="etc/ldc2.conf/55-target-windows-arm64.conf"
92+
sed -i "s|$absInstallDir/|%%ldcbinarypath%%/../|g" $conf
93+
cat $conf
9894
- name: Run arm64 hello-world cross-compilation smoke tests
9995
shell: cmd
10096
run: |
@@ -111,9 +107,9 @@ runs:
111107
curl -fL --retry 3 --max-time 60 -o libcurl.zip "$url"
112108
7z x libcurl.zip >/dev/null
113109
rm libcurl.zip
114-
cp curl-*/bin/{libcurl*.dll,curl-ca-bundle.crt} ldc2-multilib/libarm64/
110+
cp curl-*/bin/{libcurl*.dll,curl-ca-bundle.crt} ldc2-multilib/lib-windows-arm64/
115111
rm -rf curl-*
116-
mv ldc2-multilib/libarm64/libcurl*.dll ldc2-multilib/libarm64/libcurl.dll
112+
mv ldc2-multilib/lib-windows-arm64/libcurl*.dll ldc2-multilib/lib-windows-arm64/libcurl.dll
117113
118114
- name: Pack multilib package
119115
shell: bash

.github/workflows/main.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ jobs:
196196
with:
197197
arch: ${{ matrix.arch }}
198198

199-
- name: Install LDC & make portable
199+
- name: Install LDC
200200
uses: ./.github/actions/5-install
201201
with:
202202
arch: ${{ matrix.arch }}
@@ -205,6 +205,8 @@ jobs:
205205
uses: ./.github/actions/5a-ios
206206
with:
207207
arch: ${{ matrix.arch }}
208+
- name: Make portable
209+
uses: ./.github/actions/5b-make-portable
208210

209211
- name: Run a few integration tests against the installed compiler
210212
uses: ./.github/actions/6-integration-test
@@ -277,7 +279,7 @@ jobs:
277279
cmake_flags: ${{ matrix.extra_cmake_flags }}
278280
with_pgo: ${{ matrix.with_pgo }}
279281

280-
- name: Install LDC & make portable
282+
- name: Install LDC
281283
uses: ./.github/actions/5-install
282284
with:
283285
cross_compiling: true
@@ -286,6 +288,8 @@ jobs:
286288
uses: ./.github/actions/5a-android-x86
287289
with:
288290
arch: ${{ matrix.android_x86_arch }}
291+
- name: Make portable
292+
uses: ./.github/actions/5b-make-portable
289293

290294
- name: Create package & upload artifact(s)
291295
uses: ./.github/actions/7-package

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Frontend, druntime and Phobos are at version ~[2.112.0](https://dlang.org/changelog/2.112.0.html), incl. new command-line options `-extI`, `-dllimport=externalOnly` and `-edition`. (#4949, #4962)
55
- **Breaking change for dcompute**: The special `@kernel` UDA is now a function and _**requires**_ parentheses as in `@kernel() void foo(){}`. Optionally you can provide launch dimensions, `@kernel([2,4,8])`, to specify to the compute runtime how the kernel is intended to be launched.
66
- ldc2.conf can now be a directory. All the files inside it, ordered naturally, will be concatenated and treated like a big config. (#4954)
7+
- Running `ldc-build-runtime --installWithSuffix` now includes installing a target-specific .conf file to that directory. (#4978)
78
- **Breaking change for ldc2.conf cmake generation**: The `cmake` build process now generates the `ldc2.conf` and `ldc2_install.conf` as directories. `ldc2*.conf.in` and `ADDITIONAL_DEFAULT_LDC_SWITCHES` have been removed, if you need to add switches check out `makeConfSection` in `LdcConfig.cmake`. (#4954)
89

910
#### Platform support

0 commit comments

Comments
 (0)