Skip to content

Commit 779cb95

Browse files
committed
Unify build scripts
1 parent 373266e commit 779cb95

3 files changed

Lines changed: 131 additions & 15 deletions

File tree

.github/workflows/build.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
id: check-cache
2121
uses: actions/cache@main
2222
with:
23-
key: gcc-15.2.1
23+
key: gcc-15
2424
lookup-only: true
2525
path: |
2626
/tmp/x86_64-linux-gnu.tar.xz
@@ -66,7 +66,7 @@ jobs:
6666
if: ${{ steps.check-cache.outputs.cache-hit != 'true' }}
6767
uses: actions/cache@main
6868
with:
69-
key: gcc-15.2.1
69+
key: gcc-15
7070
path: |
7171
/tmp/x86_64-linux-gnu.tar.xz
7272
/tmp/x86_64-linux-gnu.tar.xz.sha256
@@ -124,7 +124,7 @@ jobs:
124124
- name: Restore from cache
125125
uses: actions/cache@main
126126
with:
127-
key: gcc-15.2.1
127+
key: gcc-15
128128
fail-on-cache-miss: true
129129
path: |
130130
/tmp/x86_64-linux-gnu.tar.xz
@@ -148,9 +148,9 @@ jobs:
148148
export RAIDEN_HOME='/tmp/raiden'
149149
export PATH="${RAIDEN_HOME}/bin:${PATH}"
150150
151-
source "${RAIDEN_HOME}/usr/local/share/raiden/autotools/${{ matrix.target }}.sh"
151+
source "${RAIDEN_HOME}/build/autotools/${{ matrix.target }}.sh"
152152
elif [[ '${{ matrix.target }}' = *'-linux-gnu'* ]]; then
153-
declare -r OBGGCC_TAG='gcc-15'
153+
declare -r OBGGCC_TAG='gcc-16'
154154
declare -r OBGGCC_TARBALL='/tmp/toolchain.tar.xz'
155155
declare -r OBGGCC_URL="https://github.com/AmanoTeam/obggcc/releases/download/${OBGGCC_TAG}/x86_64-unknown-linux-gnu.tar.xz"
156156
@@ -160,7 +160,7 @@ jobs:
160160
export OBGGCC_HOME='/tmp/obggcc'
161161
export PATH="${OBGGCC_HOME}/bin:${PATH}"
162162
163-
source "${OBGGCC_HOME}/usr/local/share/obggcc/autotools/${{ matrix.target }}.sh"
163+
source "${OBGGCC_HOME}/build/autotools/${{ matrix.target }}.sh"
164164
elif [[ '${{ matrix.target }}' = *'-freebsd' ]]; then
165165
declare -r LOKI_TAG='gcc-15'
166166
declare -r LOKI_TARBALL='/tmp/toolchain.tar.xz'
@@ -172,7 +172,7 @@ jobs:
172172
export LOKI_HOME='/tmp/loki'
173173
export PATH="${LOKI_HOME}/bin:${PATH}"
174174
175-
source "${LOKI_HOME}/usr/local/share/loki/autotools/${{ matrix.target }}.sh"
175+
source "${LOKI_HOME}/build/autotools/${{ matrix.target }}.sh"
176176
elif [[ '${{ matrix.target }}' = *'-netbsd'* ]]; then
177177
declare -r DAKINI_TAG='gcc-15'
178178
declare -r DAKINI_TARBALL='/tmp/toolchain.tar.xz'
@@ -184,7 +184,7 @@ jobs:
184184
export DAKINI_HOME='/tmp/dakini'
185185
export PATH="${DAKINI_HOME}/bin:${PATH}"
186186
187-
source "${DAKINI_HOME}/usr/local/share/dakini/autotools/${{ matrix.target }}.sh"
187+
source "${DAKINI_HOME}/build/autotools/${{ matrix.target }}.sh"
188188
elif [[ '${{ matrix.target }}' = *'-dragonfly' ]]; then
189189
# declare -r VENTI_TAG='gcc-15'
190190
# declare -r VENTI_TARBALL='/tmp/toolchain.tar.xz'
@@ -196,7 +196,7 @@ jobs:
196196
# export VENTI_HOME='/tmp/venti'
197197
export PATH="${VENTI_HOME}/bin:${PATH}"
198198
199-
source "${VENTI_HOME}/usr/local/share/venti/autotools/${{ matrix.target }}.sh"
199+
source "${VENTI_HOME}/build/autotools/${{ matrix.target }}.sh"
200200
elif [[ '${{ matrix.target }}' = *'-haiku' ]]; then
201201
declare -r SIL_TAG='gcc-15'
202202
declare -r SIL_TARBALL='/tmp/toolchain.tar.xz'
@@ -208,7 +208,7 @@ jobs:
208208
export SIL_HOME='/tmp/sil'
209209
export PATH="${SIL_HOME}/bin:${PATH}"
210210
211-
source "${SIL_HOME}/usr/local/share/sil/autotools/${{ matrix.target }}.sh"
211+
source "${SIL_HOME}/build/autotools/${{ matrix.target }}.sh"
212212
elif [[ '${{ matrix.target }}' = *'-android'* ]]; then
213213
declare -r PINO_TAG='gcc-15'
214214
declare -r PINO_TARBALL='/tmp/toolchain.tar.xz'
@@ -220,7 +220,7 @@ jobs:
220220
export PINO_HOME='/tmp/pino'
221221
export PATH="${PINO_HOME}/bin:${PATH}"
222222
223-
source "${PINO_HOME}/usr/local/share/pino/autotools/${{ matrix.target }}.sh"
223+
source "${PINO_HOME}/build/autotools/${{ matrix.target }}.sh"
224224
elif [[ '${{ matrix.target }}' = *'-darwin' ]]; then
225225
curl \
226226
--silent \
@@ -232,7 +232,7 @@ jobs:
232232
export DARWIN_HOME='/tmp/darwin'
233233
export PATH="${DARWIN_HOME}/bin:${PATH}"
234234
235-
source "${DARWIN_HOME}/usr/local/share/darwin/autotools/${{ matrix.target }}.sh"
235+
source "${DARWIN_HOME}/build/autotools/${{ matrix.target }}.sh"
236236
fi
237237
238238
bash './build.sh' '${{ matrix.target }}'
@@ -279,12 +279,11 @@ jobs:
279279
uses: softprops/action-gh-release@master
280280
with:
281281
tag_name: gcc-15
282-
name: GCC 15.2.1
282+
name: GCC 15
283283
files: ./*/*-unknown-*.tar.xz*
284284
draft: false
285285
prerelease: false
286286
fail_on_unmatched_files: true
287-
body: "* Update to GCC 15.2.1"
287+
body: "* Update to GCC 15"
288288
env:
289289
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
290-

.github/workflows/sysroot.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
8+
jobs:
9+
build:
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@main
16+
with:
17+
submodules: true
18+
- name: Generate system roots
19+
run: |
20+
bash './sysroot.sh'
21+
- name: Upload artifact
22+
uses: actions/upload-artifact@main
23+
with:
24+
path: ./*.xz*
25+
- name: Create release
26+
uses: softprops/action-gh-release@master
27+
with:
28+
tag_name: sysroot
29+
name: DragonFly BSD sysroots
30+
files: ./*.xz*
31+
draft: false
32+
prerelease: false
33+
fail_on_unmatched_files: true
34+
body: "* Update sysroot"
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

sysroot.sh

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
5+
declare -r workdir="${PWD}"
6+
7+
declare -r system_image='/tmp/dragonflybsd.iso'
8+
declare -r system_image_compressed='/tmp/dragonflybsd.iso.bz2'
9+
declare -r system_directory='/tmp/dragonflybsd'
10+
11+
declare -r triplet='x86_64-unknown-dragonfly'
12+
13+
declare -r sysroot_directory="${workdir}/${triplet}"
14+
declare -r tarball_filename="${sysroot_directory}.tar.xz"
15+
16+
[ -d "${sysroot_directory}" ] || mkdir "${sysroot_directory}"
17+
18+
echo "- Generating sysroot for ${triplet}"
19+
20+
if [ -f "${tarball_filename}" ]; then
21+
echo "+ Already exists. Stop"
22+
exit '0'
23+
fi
24+
25+
declare url='https://mirror-master.dragonflybsd.org/iso-images/dfly-x86_64-6.4.2_REL.iso.bz2'
26+
27+
echo "- Fetching data from ${url}"
28+
29+
curl \
30+
--url "${url}" \
31+
--retry '30' \
32+
--retry-all-errors \
33+
--retry-delay '0' \
34+
--retry-max-time '0' \
35+
--location \
36+
--silent \
37+
--output "${system_image_compressed}"
38+
39+
cd "$(dirname "${system_image_compressed}")"
40+
41+
bzip2 --decompress "${system_image_compressed}"
42+
43+
[ -d "${system_directory}" ] || mkdir "${system_directory}"
44+
45+
sudo mount -o loop,ro "${system_image}" "${system_directory}"
46+
47+
echo "- Unpacking ${system_image}"
48+
49+
cp --recursive "${system_directory}/lib" "${sysroot_directory}"
50+
cp --recursive "${system_directory}/usr/lib" "${sysroot_directory}"
51+
cp --recursive "${system_directory}/usr/include" "${sysroot_directory}"
52+
53+
sudo umount "${system_directory}"
54+
55+
unlink "${system_image}"
56+
57+
rm \
58+
--force \
59+
--recursive \
60+
"${sysroot_directory}/lib/gcc"* \
61+
"${sysroot_directory}/lib/debug" \
62+
"${sysroot_directory}/lib/i18n" \
63+
"${sysroot_directory}/lib/profile" \
64+
"${sysroot_directory}/lib/security" \
65+
"${sysroot_directory}/include/c++"
66+
67+
cd "${sysroot_directory}/lib"
68+
69+
find . -type l | xargs ls -l | grep '/lib/' | awk '{print "unlink "$9" && ln --symbolic $(basename "$11") $(basename "$9")"}' | bash
70+
71+
ln \
72+
--symbolic \
73+
--force \
74+
--relative \
75+
'./priv/lib'*'.so'* \
76+
'./'
77+
78+
echo "- Creating tarball at ${tarball_filename}"
79+
80+
tar --directory="$(dirname "${sysroot_directory}")" --create --file=- "$(basename "${sysroot_directory}")" | xz --threads='0' --extreme --compress -9 > "${tarball_filename}"
81+
sha256sum "${tarball_filename}" | sed "s|$(dirname "${sysroot_directory}")/||" > "${tarball_filename}.sha256"

0 commit comments

Comments
 (0)