Skip to content

Commit c3f2749

Browse files
committed
CI: correctly handle ldc2.conf directory
Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
1 parent 703a958 commit c3f2749

File tree

4 files changed

+27
-79
lines changed

4 files changed

+27
-79
lines changed

.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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ runs:
4444
];
4545
rpath = \"%%ldcbinarypath%%/../lib-ios-$arch\";
4646
};"
47-
echo "$section" >> installed/etc/ldc2.conf
48-
cat installed/etc/ldc2.conf
47+
echo "$section" >> installed/etc/ldc2.conf/31-ldc-runtime-lib-ios-$arch.conf
48+
cat installed/etc/ldc2.conf/*

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

Lines changed: 17 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -39,77 +39,25 @@ 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-":
66-
{
67-
lib-dirs = [
68-
"%%ldcbinarypath%%/../lib-x86_64",
69-
];
70-
rpath = "%%ldcbinarypath%%/../lib-x86_64";
71-
};
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
108-
EOF
109-
# 4) append the wasm section from the backup
110-
sed -n '/^"\^wasm/,$p' /tmp/ldc2.conf.bak | sed '/^\};$/q' >> etc/ldc2.conf
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 .
47+
# 3) x86_64 & arm64 macos
48+
for arch in x86_64 arm64; do
49+
cat > etc/ldc2.conf/30-ldc-runtime-lib-${arch}.conf <<EOF
50+
"${arch}-apple-":
51+
{
52+
lib-dirs = [
53+
"%%ldcbinarypath%%/../lib-${arch}",
54+
];
55+
rpath = "%%ldcbinarypath%%/../lib-${arch}";
56+
};
57+
EOF
58+
done
11159
112-
cat etc/ldc2.conf
60+
cat etc/ldc2.conf/*
11361
11462
- name: Run x86_64/arm64 macOS/iOS cross-compilation smoke tests
11563
shell: bash

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

Lines changed: 7 additions & 7 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
@@ -96,8 +96,8 @@ runs:
9696
];
9797
};
9898
'
99-
Add-Content etc\ldc2.conf $conf -NoNewline
100-
cat etc\ldc2.conf
99+
Set-Content etc\ldc2.conf\31-ldc-runtime-libarm64.conf $conf
100+
cat etc\ldc2.conf\*
101101
- name: Run arm64 hello-world cross-compilation smoke tests
102102
shell: cmd
103103
run: |

0 commit comments

Comments
 (0)