Skip to content

Commit 1002b7a

Browse files
committed
feat: CI rebuild new refactor
use alpine chroot to build all gcc-musl and libs improve build system and support multiple gcc-musl configs BREAKING CHANGE:
1 parent ff2d388 commit 1002b7a

File tree

7 files changed

+115
-132
lines changed

7 files changed

+115
-132
lines changed

.github/workflows/main.yml

Lines changed: 30 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,9 @@ jobs:
3333
@semantic-release/changelog
3434
env:
3535
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36-
# - name: Upload release docs artifacts
37-
# uses: actions/upload-artifact@v4
38-
# with:
39-
# name: documentation
40-
# path: |
41-
# build/release-intro.md
4236

43-
linux-release:
44-
name: 🐧 Ubuntu build
37+
gcc-musl-build:
38+
name: 🐧 Build release
4539
runs-on: ubuntu-latest
4640
needs: [semantic-release]
4741
if: ${{ needs.semantic-release.outputs.new_release_published == 'true' }}
@@ -62,114 +56,49 @@ jobs:
6256
uses: actions/checkout@v4
6357
with:
6458
fetch-depth: 0
65-
- uses: hendrikmuhs/ccache-action@v1.2
66-
- name: Install build deps
59+
- name: Build chroot ${{ matrix.target }}
6760
run: |
68-
sudo apt install -qy tree cmake make autoconf automake libtool gcc g++ ccache ninja-build
69-
- name: Downoad sources from files.dyne.org
61+
sudo make chroot
62+
echo "export ARCH=\"${{ matrix.target }}\"" | sudo tee /alpine/etc/profile
63+
- name: Build gcc-musl ${{ matrix.target }}
7064
run: |
71-
cd sources && sh download_from_dyne.sh
72-
- name: Build ${{ matrix.target }}
73-
env:
74-
XZ_OPT: -9e -T0
75-
TARGET: ${{ matrix.target }}
65+
/alpine/enter-chroot make gcc
66+
- name: Build libs ${{ matrix.target }}
7667
run: |
77-
make -s -j`nproc`
78-
make -s install
79-
make -C libs ARCH=${{ matrix.target }}
80-
- name: Strip and clean binaries
68+
/alpine/enter-chroot make libs
69+
- name: Prepare ${{ matrix.target }}
8170
run: |
82-
rm -f /opt/musl-dyne/bin/*-lto-dump
83-
rm -f /opt/musl-dyne/${{ matrix.target }}/lib/*.py
84-
find /opt/musl-dyne/bin /opt/musl-dyne/lib -type f -exec file {} \; | grep -E '(LSB exec|pie exec|shared obj|ar archive)' | cut -d: -f1 | xargs strip -g
85-
find /opt/musl-dyne/${{ matrix.target }} -type f -exec file {} \; | grep -E '(LSB exec|pie exec|shared obj|ar archive)' | cut -d: -f1 | xargs /opt/musl-dyne/bin/${{ matrix.target }}-strip -g
86-
rm -rf /opt/musl-dyne/share/man
87-
cat README.md | awk '{gsub(/\[[^][]+\]\([^()]+\)/, gensub(/\[([^][]+)\]\([^()]+\)/, "\\1", "g")); print}' | fmt -w 72 > /opt/musl-dyne/README.txt
88-
cp settings.cmake /opt/musl-dyne/
71+
/alpine/enter-chroot make prepare
8972
- name: Compress the package
9073
env:
9174
XZ_OPT: -9e -T0
9275
TARGET: ${{ matrix.target }}
9376
run: |
94-
echo "Compressing: musl-dyne-${{ matrix.output }}.tar.xz"
95-
cd /opt && tar -cJf musl-dyne-${{ matrix.output }}.tar.xz musl-dyne
96-
- name: Upload release artifacts musl-dyne-${{ matrix.output }}
77+
echo "Compressing: dyne-gcc-musl-${{ matrix.output }}.tar.xz"
78+
tar -cJf dyne-gcc-musl-${{ matrix.output }}.tar.xz dyne
79+
- name: Upload release artifacts dyne-gcc-musl-${{ matrix.output }}
9780
uses: actions/upload-artifact@v4
9881
with:
9982
name: release-${{ matrix.output }}
10083
path: |
101-
/opt/musl-dyne-${{ matrix.output }}.tar.xz
102-
103-
alpine-release:
104-
name: 🗻 Alpine build
105-
runs-on: ubuntu-latest
106-
needs: [semantic-release]
107-
if: ${{ needs.semantic-release.outputs.new_release_published == 'true' }}
108-
strategy:
109-
matrix:
110-
include:
111-
- target: arm-linux-musleabihf
112-
output: arm_hf
113-
- target: riscv64-linux-musl
114-
output: riscv_64
115-
- target: aarch64-linux-musl
116-
output: arm_64
117-
steps:
118-
- uses: actions/checkout@v4
119-
- name: Setup latest Alpine Linux
120-
uses: jirutka/setup-alpine@v1
121-
with:
122-
volumes: /opt
123-
packages: >-
124-
bash
125-
make
126-
gcc
127-
build-base
128-
curl
129-
patch
130-
gawk
131-
ccache
132-
perl
133-
rsync
134-
xz
135-
- name: Download sources inside Alpine chroot
136-
run: |
137-
ls -la
138-
cd sources && sh download_from_dyne.sh
139-
shell: alpine.sh {0}
140-
- name: Build musl-dyne inside Alpine chroot
141-
env:
142-
XZ_OPT: -9e -T0
143-
TARGET: ${{ matrix.target }}
144-
shell: alpine.sh --root {0}
145-
run: |
146-
make -j`nproc`
147-
make install
148-
echo "Compressing: cross-alpine-${{ matrix.output }}.tar.xz"
149-
cd /opt && tar -cJf cross-alpine-${{ matrix.output }}.tar.xz musl-dyne
150-
- name: Upload release artifacts cross-alpine-${{ matrix.output }}
151-
uses: actions/upload-artifact@v4
152-
with:
153-
name: alpine-${{ matrix.output }}
154-
path: |
155-
/opt/cross-alpine-${{ matrix.output }}.tar.xz
84+
dyne-gcc-musl-${{ matrix.output }}.tar.xz
15685
15786
draft-binary-release:
158-
name: 📦 Pack release
159-
needs: [semantic-release, linux-release, alpine-release]
87+
name: 📦 Upload release
88+
needs: [semantic-release, gcc-musl-build]
16089
runs-on: ubuntu-latest
16190
steps:
16291
- name: download binary artifacts
16392
uses: actions/download-artifact@v4
16493
with:
16594
path: |
166-
musl-dyne
95+
dyne-gcc-musl
16796
- name: show directory structure
168-
run: tree -dL 3 musl-dyne
97+
run: tree -dL 3 dyne-gcc-musl
16998
- name: compute sha256 hash checksums
17099
run: |
171-
mkdir -p musl-dyne/checksums
172-
find musl-dyne -type f -exec sha256sum {} \; | awk '{ split($2, a, "/"); print $1, a[length(a)] }' | tee musl-dyne/checksums/SHA256SUMS.txt
100+
mkdir -p dyne-gcc-musl/checksums
101+
find dyne-gcc-musl -type f -exec sha256sum {} \; | awk '{ split($2, a, "/"); print $1, a[length(a)] }' | tee dyne-gcc-musl/checksums/SHA256SUMS.txt
173102
- name: upload releases to files.dyne.org
174103
uses: appleboy/scp-action@v1
175104
with:
@@ -180,14 +109,11 @@ jobs:
180109
# scp-drone uploads dirs if wildcards are in them, so here
181110
# we need to list uploaded files one by one.
182111
source: |
183-
musl-dyne/release-x86_64/musl-dyne-x86_64.tar.xz,
184-
musl-dyne/release-arm_hf/musl-dyne-arm_hf.tar.xz,
185-
musl-dyne/release-arm_64/musl-dyne-arm_64.tar.xz,
186-
musl-dyne/release-riscv_64/musl-dyne-riscv_64.tar.xz,
187-
musl-dyne/alpine-arm_hf/cross-alpine-arm_hf.tar.xz,
188-
musl-dyne/alpine-arm_64/cross-alpine-arm_64.tar.xz,
189-
musl-dyne/alpine-riscv_64/cross-alpine-riscv_64.tar.xz,
190-
musl-dyne/checksums/SHA256SUMS.txt
112+
dyne-gcc-musl/release-x86_64/dyne-gcc-musl-x86_64.tar.xz,
113+
dyne-gcc-musl/release-arm_hf/dyne-gcc-musl-arm_hf.tar.xz,
114+
dyne-gcc-musl/release-arm_64/dyne-gcc-musl-arm_64.tar.xz,
115+
dyne-gcc-musl/release-riscv_64/dyne-gcc-musl-riscv_64.tar.xz,
116+
dyne-gcc-musl/checksums/SHA256SUMS.txt
191117
target: |
192118
/srv/ftp/musl
193119
strip_components: 2
@@ -196,20 +122,17 @@ jobs:
196122
uses: softprops/action-gh-release@v2
197123
with:
198124
files: |
199-
musl-dyne/release-*/*
200-
musl-dyne/alpine-*/*
201-
musl-dyne/checksums/SHA256SUMS.txt
125+
dyne-gcc-musl/release-*/*
126+
dyne-gcc-musl/checksums/SHA256SUMS.txt
202127
tag_name: ${{ needs.semantic-release.outputs.new_release_version }}
203-
#body_path: musl-dyne/documentation/release-intro.md
204-
#append_body: true
205128
draft: false
206129
prerelease: false
207130
fail_on_unmatched_files: true
208131
generate_release_notes: true
209132

210133
remove-tag-on-fail:
211134
name: 🧻 Remove tag on fail
212-
needs: [semantic-release, linux-release, alpine-release]
135+
needs: [semantic-release, gcc-musl-build]
213136
runs-on: ubuntu-latest
214137
if: ${{ (failure() || cancelled()) && needs.semantic-release.outputs.new_release_published == 'True' }}
215138
steps:
@@ -223,4 +146,4 @@ jobs:
223146
tag_name: ${{ needs.semantic-release.outputs.new_release_version }}
224147
github_token: ${{ secrets.GITHUB_TOKEN }}
225148
delete_release: false
226-
repo: dyne/musl-dyne
149+
repo: dyne/musl

GNUmakefile

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,37 @@
11
ARCH ?= x86_64-linux-musl
22

3-
all: gcc libs strip
3+
# for a list of targets: ls gcc-musl/*.mak
4+
# shared-optim
5+
MUSL_CONFIG ?= static-small
6+
7+
all: gcc libs
8+
$(info Build completed!)
9+
$(MAKE) prepare
410

511
chroot: /alpine/enter-chroot
612

713
gcc: dyne/gcc-musl/bin/$(ARCH)-gcc
14+
815
libs: dyne/$(ARCH)/lib/libssl.a
16+
prepare:
17+
sh prepare.sh $(ARCH)
918

19+
/alpine/enter-chroot: APKS := bash make cmake gcc build-base curl patch gawk ccache perl rsync xz samurai coreutils-fmt
1020
/alpine/enter-chroot:
11-
./alpine-chroot-install -a x86_64 -d /alpine \
12-
-p "bash make cmake gcc build-base curl patch gawk ccache perl rsync xz samurai coreutils-fmt"
21+
$(info 💪 Alpine chroot packages: $(APKS))
22+
./alpine-chroot-install -a x86_64 -d /alpine -p "$(APKS)"
1323

1424
dyne/gcc-musl/bin/$(ARCH)-gcc:
15-
cd gcc-musl/sources && bash download_from_dyne.sh
25+
$(info 💪 GCC-musl build config: $(MUSL_CONFIG))
26+
cd gcc-musl && ln -sf config.$(MUSL_CONFIG).mak config.mak
27+
$(MAKE) -C gcc-musl/sources
1628
$(MAKE) -C gcc-musl -j`nproc`
1729
$(MAKE) -C gcc-musl install PREFIX=$(CURDIR)/dyne/gcc-musl
1830

1931
dyne/$(ARCH)/lib/libssl.a:
32+
$(info 💪 Base libs arch: $(ARCH))
2033
$(MAKE) -C libs ARCH=$(ARCH) PREFIX=$(CURDIR)/dyne/$(ARCH)
2134

22-
strip:
23-
rm -f dyne/bin/*-lto-dump
24-
rm -rf dyne/share
25-
cat README.md | awk '{gsub(/\[[^][]+\]\([^()]+\)/, gensub(/\[([^][]+)\]\([^()]+\)/, "\\1", "g")); print}' | fmt -w 72 | tee dyne/$(ARCH)/README.txt > dyne/gcc-musl/README.txt
26-
cp settings.cmake dyne/gcc-musl
27-
2835
clean:
2936
rm -rf dyne
3037
$(MAKE) -C gcc-musl clean

gcc-musl/config.shared-optim.mak

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
ARCH ?= x86_64-linux-musl
2+
PREFIX ?= $(shell dirname $(CURDIR))/dyne/gcc-musl
3+
4+
TARGET = $(ARCH)
5+
OUTPUT = $(PREFIX)
6+
GCC_VER = 15.1.0
7+
BINUTILS_VER = 2.44
8+
LINUX_VER = 5.8.5
9+
COMMON_CONFIG += CFLAGS="-g0 -O3 -march=native"
10+
COMMON_CONFIG += CXXFLAGS="-g0 -O3 -march=native"
11+
# -march=x86-64-v2 -march=haswell
12+
COMMON_CONFIG += LDFLAGS="-s"
13+
COMMON_CONFIG += CC="ccache gcc"
14+
COMMON_CONFIG += CXX="ccache g++"
15+
COMMON_CONFIG += --disable-nls --disable-libmudflap --disable-libsanitizer
16+
# --disable-libquadmath --disable-decimal-float --disable-libitm --disable-lto
17+
# --disable-fixed-point --disable-lto
18+
GCC_CONFIG += --enable-languages=c,c++

gcc-musl/sources/GNUmakefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# We redistribute the sources to overcome flaky mirrors upload to
2+
# files.dyne.org after downloading with upstream's makefile and then
3+
# scp all contents of sources subdir
4+
5+
all: config.sub \
6+
binutils-2.44.tar.gz \
7+
gcc-15.1.0.tar.xz \
8+
gmp-6.1.2.tar.bz2 \
9+
linux-5.8.5.tar.xz \
10+
mpc-1.1.0.tar.gz \
11+
mpfr-4.0.2.tar.bz2 \
12+
musl-1.2.5.tar.gz
13+
14+
%.sub:
15+
curl -L https://files.dyne.org/?file=musl/sources/$@ --output $@
16+
17+
%.tar.gz:
18+
curl -L https://files.dyne.org/?file=musl/sources/$@ --output $@
19+
20+
%.tar.xz:
21+
curl -L https://files.dyne.org/?file=musl/sources/$@ --output $@
22+
23+
%.tar.bz2:
24+
curl -L https://files.dyne.org/?file=musl/sources/$@ --output $@
25+
26+
clean:
27+
rm -f *.sub *.tar.*

gcc-musl/sources/download_from_dyne.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

prepare.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
3+
# Simply strip and prepare the build in dyne/
4+
# these operations are best done in a shell script
5+
set -e
6+
7+
rm -f dyne/bin/*-lto-dump
8+
rm -rf dyne/share
9+
rm -f dyne/${1}/lib/*.py
10+
11+
find dyne/gcc-musl/bin dyne/gcc-musl/lib -type f -exec file {} + \
12+
| grep -E '(LSB exec|pie exec|shared obj|ar archive)' | cut -d: -f1 \
13+
| xargs strip -g
14+
15+
find dyne/${1} -type f -exec file {} + \
16+
| grep -E '(LSB exec|pie exec|shared obj|ar archive)' | cut -d: -f1 \
17+
| xargs dyne/gcc-musl/bin/${1}-strip -g
18+
19+
cat README.md | awk '
20+
{gsub(/\[[^][]+\]\([^()]+\)/, gensub(/\[([^][]+)\]\([^()]+\)/, "\\1", "g")); print}
21+
' | fmt -w 72 | tee dyne/${1}/README.txt > dyne/gcc-musl/README.txt
22+
23+
cp settings.cmake dyne/gcc-musl

0 commit comments

Comments
 (0)