Skip to content

Commit 6a4223a

Browse files
committed
CI: correctly handle ldc2.conf directory
Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
1 parent 20494ea commit 6a4223a

File tree

5 files changed

+33
-81
lines changed

5 files changed

+33
-81
lines changed

.cirrus.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,17 @@ packaging_steps_template: &PACKAGING_STEPS_TEMPLATE
6565
cd build
6666
ninja install > /dev/null
6767
cd ..
68-
perl -pi -e s?$PWD/install/?%%ldcbinarypath%%/../?g install/etc/ldc2.conf
68+
perl -pi -e s?$PWD/install/?%%ldcbinarypath%%/../?g install/etc/ldc2.conf/*
6969
if [[ "$CI_OS" == "freebsd" ]]; then
70-
perl -pi -e "s?,druntime-ldc\",?,druntime-ldc\", \"-gcc=$CC\",?" install/etc/ldc2.conf
70+
cat > install/etc/ldc2.conf/35-ldc-default-CC.conf <<EOF
71+
"default":
72+
{
73+
switches ~= [ "-gcc=${CC}" ];
74+
}
75+
EOF
7176
fi
7277
cp $CIRRUS_WORKING_DIR/{LICENSE,packaging/README} install
73-
cat install/etc/ldc2.conf
78+
cat install/etc/ldc2.conf/*
7479
# Now rename the installation dir to test portability
7580
mv install installed
7681
# Run hello-world integration test with shared libs

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ runs:
2020
else
2121
# the cross-compiled runtime libs have already been installed:
2222
# * lib/: runtime library artifacts
23-
# * etc/ldc2.conf
23+
# * etc/ldc2.conf/30-ldc-runtime-lib.conf
2424
2525
# now extend by installing the cross-compiled compiler:
2626
# * bin/: executables

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ runs:
3232
CMAKE_OSX_DEPLOYMENT_TARGET="$deployment_target" \
3333
BUILD_LTO_LIBS=ON
3434
35-
section="
36-
\"$arch-apple-ios\":
35+
section="\"$arch-apple-ios\":
3736
{
3837
switches ~= [
3938
\"-Xcc=-isysroot\",
@@ -44,5 +43,5 @@ runs:
4443
];
4544
rpath = \"%%ldcbinarypath%%/../lib-ios-$arch\";
4645
};"
47-
echo "$section" >> installed/etc/ldc2.conf
48-
cat installed/etc/ldc2.conf
46+
echo "$section" >> installed/etc/ldc2.conf/31-ldc-runtime-lib-ios-$arch.conf
47+
cat installed/etc/ldc2.conf/*

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

Lines changed: 13 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -39,77 +39,26 @@ runs:
3939
rm lib-{x86_64,arm64}/libLTO.dylib
4040
4141
# ldc2.conf:
42-
# 1) make a backup copy
43-
cp etc/ldc2.conf /tmp/ldc2.conf.bak
44-
# 2) strip to the header comments (remove all existing sections, only keep `default:` or `"default":` line)
45-
sed -E -i '' '/^"?default"?:$/q' etc/ldc2.conf
46-
# 3) append all sections (except for wasm)
47-
cat >>etc/ldc2.conf <<EOF
48-
{
49-
// default switches injected before all explicit command-line switches
50-
switches = [
51-
"-defaultlib=phobos2-ldc,druntime-ldc",
52-
];
53-
// default switches appended after all explicit command-line switches
54-
post-switches = [
55-
"-I%%ldcbinarypath%%/../import",
56-
];
57-
// default directories to be searched for libraries when linking
58-
lib-dirs = [];
59-
// default rpath when linking against the shared default libs
60-
rpath = "";
61-
};
6242
63-
// macOS:
64-
65-
"x86_64-apple-":
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
49+
for arch in x86_64 arm64; do
50+
cat > etc/ldc2.conf/30-ldc-runtime-lib-${arch}.conf <<EOF
51+
"${arch}-apple-":
6652
{
6753
lib-dirs = [
68-
"%%ldcbinarypath%%/../lib-x86_64",
54+
"%%ldcbinarypath%%/../lib-${arch}",
6955
];
70-
rpath = "%%ldcbinarypath%%/../lib-x86_64";
56+
rpath = "%%ldcbinarypath%%/../lib-${arch}";
7157
};
72-
73-
"arm64-apple-":
74-
{
75-
lib-dirs = [
76-
"%%ldcbinarypath%%/../lib-arm64",
77-
];
78-
rpath = "%%ldcbinarypath%%/../lib-arm64";
79-
};
80-
81-
// iOS:
82-
83-
"x86_64-apple-ios":
84-
{
85-
switches ~= [
86-
"-Xcc=-isysroot",
87-
"-Xcc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk",
88-
];
89-
lib-dirs = [
90-
"%%ldcbinarypath%%/../lib-ios-x86_64",
91-
];
92-
rpath = "%%ldcbinarypath%%/../lib-ios-x86_64";
93-
};
94-
95-
"arm64-apple-ios":
96-
{
97-
switches ~= [
98-
"-Xcc=-isysroot",
99-
"-Xcc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk",
100-
];
101-
lib-dirs = [
102-
"%%ldcbinarypath%%/../lib-ios-arm64",
103-
];
104-
rpath = "%%ldcbinarypath%%/../lib-ios-arm64";
105-
};
106-
107-
// WebAssembly
10858
EOF
109-
# 4) append the wasm section from the backup
110-
sed -n '/^"\^wasm/,$p' /tmp/ldc2.conf.bak | sed '/^\};$/q' >> etc/ldc2.conf
59+
done
11160
112-
cat etc/ldc2.conf
61+
cat etc/ldc2.conf/*
11362
11463
- name: Run x86_64/arm64 macOS/iOS cross-compilation smoke tests
11564
shell: bash

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,23 @@ 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
2324
cp -R ../ldc2-x86/lib lib32
2425
cp ../ldc2-x86/bin/{*.dll,*.pdb,curl-ca-bundle.crt} lib32/
2526
- name: Merge ldc2.conf
2627
shell: pwsh
2728
run: |
2829
cd ldc2-multilib
29-
(cat etc\ldc2.conf).replace('%%ldcbinarypath%%/../lib', '%%ldcbinarypath%%/../lib64') | Set-Content etc\ldc2.conf
30-
$conf32 = '
31-
"i[3-6]86-.*-windows-msvc":
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
31+
$conf32 = '"i[3-6]86-.*-windows-msvc":
3232
{
3333
lib-dirs = [
3434
"%%ldcbinarypath%%/../lib32",
3535
];
3636
};
3737
'
38-
Add-Content etc\ldc2.conf $conf32 -NoNewline
39-
cat etc\ldc2.conf
38+
Set-Content etc\ldc2.conf\31-ldc-runtime-lib32.conf $conf32
39+
cat etc\ldc2.conf\*
4040
4141
- name: Generate hello.d
4242
shell: bash
@@ -88,16 +88,15 @@ runs:
8888
shell: pwsh
8989
run: |
9090
cd ldc2-multilib
91-
$conf = '
92-
"(aarch|arm)64-.*-windows-msvc":
91+
$conf = '"(aarch|arm)64-.*-windows-msvc":
9392
{
9493
lib-dirs = [
9594
"%%ldcbinarypath%%/../libarm64",
9695
];
9796
};
9897
'
99-
Add-Content etc\ldc2.conf $conf -NoNewline
100-
cat etc\ldc2.conf
98+
Set-Content etc\ldc2.conf\31-ldc-runtime-libarm64.conf $conf
99+
cat etc\ldc2.conf\*
101100
- name: Run arm64 hello-world cross-compilation smoke tests
102101
shell: cmd
103102
run: |

0 commit comments

Comments
 (0)