Skip to content

Commit 64ffd68

Browse files
committed
Only build 2 flavors of linux binaries
- glibc (dynamic) - musl (fully static) 'gmp' and 'zlib' are always statically linked.
1 parent 108c974 commit 64ffd68

File tree

2 files changed

+66
-110
lines changed

2 files changed

+66
-110
lines changed

.github/scripts/build.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,3 @@ case "${TARBALL_EXT}" in
5353
;;
5454
esac
5555

56-
rm "cabal${ext}" plan.json
57-

.github/workflows/reusable-release.yml

Lines changed: 66 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
ghc_targets:
1515
type: string
1616
default: "install_bin install_lib update_package_db"
17+
gmp:
18+
type: string
19+
default: 6.3.0
1720
cabal:
1821
type: string
1922
default: 3.14.2.0
@@ -25,6 +28,7 @@ env:
2528
GHC_VERSION: ${{ inputs.ghc }}
2629
GHC_TARGETS: ${{ inputs.ghc_targets }}
2730
CABAL_VERSION: ${{ inputs.cabal }}
31+
GMP_VERSION: ${{ inputs.gmp }}
2832
DEBIAN_FRONTEND: noninteractive
2933
TZ: Asia/Singapore
3034

@@ -63,89 +67,19 @@ jobs:
6367
fail-fast: false
6468
matrix:
6569
branch: ${{ fromJSON(inputs.branches) }}
66-
platform: [ { image: "debian:11"
67-
, installCmd: "apt-get update && apt-get install -y"
68-
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools }}"
69-
, DISTRO: "Debian"
70-
, ARTIFACT: "x86_64-linux-deb11"
71-
, ADD_CABAL_ARGS: "--enable-split-sections"
72-
},
73-
{ image: "debian:12"
74-
, installCmd: "apt-get update && apt-get install -y"
75-
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools }}"
76-
, DISTRO: "Debian"
77-
, ARTIFACT: "x86_64-linux-deb12"
78-
, ADD_CABAL_ARGS: "--enable-split-sections"
79-
},
80-
{ image: "ubuntu:20.04"
81-
, installCmd: "apt-get update && apt-get install -y"
82-
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools }}"
83-
, DISTRO: "Ubuntu"
84-
, ARTIFACT: "x86_64-linux-ubuntu20.04"
85-
, ADD_CABAL_ARGS: "--enable-split-sections"
86-
},
87-
{ image: "ubuntu:22.04"
88-
, installCmd: "apt-get update && apt-get install -y"
89-
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools }}"
90-
, DISTRO: "Ubuntu"
91-
, ARTIFACT: "x86_64-linux-ubuntu22.04"
92-
, ADD_CABAL_ARGS: "--enable-split-sections"
93-
},
94-
{ image: "ubuntu:24.04"
95-
, installCmd: "apt-get update && apt-get install -y"
96-
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools_ncurses6 }}"
97-
, DISTRO: "Ubuntu"
98-
, ARTIFACT: "x86_64-linux-ubuntu24.04"
99-
, ADD_CABAL_ARGS: "--enable-split-sections"
100-
},
101-
{ image: "fedora:33"
102-
, installCmd: "dnf install -y"
103-
, toolRequirements: "${{ needs.tool-output.outputs.rpm_tools }}"
104-
, DISTRO: "Fedora"
105-
, ARTIFACT: "x86_64-linux-fedora33"
106-
, ADD_CABAL_ARGS: "--enable-split-sections"
107-
},
108-
{ image: "fedora:36"
109-
, installCmd: "dnf install -y"
110-
, toolRequirements: "${{ needs.tool-output.outputs.rpm_tools }}"
111-
, DISTRO: "Fedora"
112-
, ARTIFACT: "x86_64-linux-fedora36"
113-
, ADD_CABAL_ARGS: "--enable-split-sections"
114-
},
115-
{ image: "fedora:38"
116-
, installCmd: "dnf install -y"
117-
, toolRequirements: "${{ needs.tool-output.outputs.rpm_tools }}"
118-
, DISTRO: "Fedora"
119-
, ARTIFACT: "x86_64-linux-fedora38"
120-
, ADD_CABAL_ARGS: "--enable-split-sections"
121-
},
122-
{ image: "rockylinux:8"
70+
platform: [ { image: "rockylinux:8"
12371
, installCmd: "yum -y install epel-release && yum install -y --allowerasing"
12472
, toolRequirements: "${{ needs.tool-output.outputs.rpm_tools }}"
125-
, DISTRO: "Unknown"
126-
, ARTIFACT: "x86_64-linux-rocky8"
73+
, DISTRO: "Rockylinux"
74+
, ARTIFACT: "x86_64-linux-glibc"
12775
, ADD_CABAL_ARGS: "--enable-split-sections"
12876
},
12977
{ image: "alpine:3.20"
13078
, installCmd: "apk update && apk add"
13179
, toolRequirements: "${{ needs.tool-output.outputs.apk_tools }}"
132-
, DISTRO: "Unknown"
133-
, ARTIFACT: "x86_64-linux-unknown"
80+
, DISTRO: "Alpine"
81+
, ARTIFACT: "x86_64-linux-musl-static"
13482
, ADD_CABAL_ARGS: "--enable-split-sections --enable-executable-static"
135-
},
136-
{ image: "alpine:3.12"
137-
, installCmd: "apk update && apk add"
138-
, toolRequirements: "${{ needs.tool-output.outputs.apk_tools }}"
139-
, DISTRO: "Unknown"
140-
, ARTIFACT: "x86_64-linux-alpine312"
141-
, ADD_CABAL_ARGS: "--enable-split-sections"
142-
},
143-
{ image: "alpine:3.20"
144-
, installCmd: "apk update && apk add"
145-
, toolRequirements: "${{ needs.tool-output.outputs.apk_tools }}"
146-
, DISTRO: "Unknown"
147-
, ARTIFACT: "x86_64-linux-alpine320"
148-
, ADD_CABAL_ARGS: "--enable-split-sections"
14983
}
15084
]
15185
container:
@@ -165,15 +99,32 @@ jobs:
16599
with:
166100
ref: ${{ matrix.branch }}
167101

102+
- name: install GMP
103+
if: matrix.platform.DISTRO == 'Rockylinux'
104+
run: |
105+
set -eux
106+
107+
curl -O -L https://gmplib.org/download/gmp/gmp-${{ env.GMP_VERSION }}.tar.xz
108+
tar xf gmp-${{ env.GMP_VERSION }}.tar.xz
109+
cd gmp-${{ env.GMP_VERSION }}
110+
./configure --prefix=$HOME/.local/ --disable-shared
111+
make install
112+
cd ..
113+
echo "extra-lib-dirs: $HOME/.local/lib/" >> cabal.release.project.local
114+
168115
- name: Run build
169116
run: |
170117
bash .github/scripts/build.sh
171-
172118
env:
173119
ARTIFACT: ${{ matrix.platform.ARTIFACT }}
174120
DISTRO: ${{ matrix.platform.DISTRO }}
175121
ADD_CABAL_ARGS: ${{ matrix.platform.ADD_CABAL_ARGS }}
176122

123+
- name: check linking
124+
if: matrix.platform.DISTRO == 'Rockylinux'
125+
run: |
126+
ldd out/cabal | grep --quiet gmp && exit 1
127+
177128
- if: always()
178129
name: Upload artifact
179130
uses: ./.github/actions/upload
@@ -456,6 +407,7 @@ jobs:
456407
env:
457408
TARBALL_EXT: tar.xz
458409
ARCH: 64
410+
ADD_CABAL_ARGS: ""
459411
strategy:
460412
fail-fast: false
461413
matrix:
@@ -464,85 +416,91 @@ jobs:
464416
, installCmd: "apt-get update && apt-get install -y"
465417
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools }}"
466418
, DISTRO: "Debian"
467-
, ARTIFACT: "x86_64-linux-deb11"
468-
, ADD_CABAL_ARGS: "--enable-split-sections"
419+
, ARTIFACT: "x86_64-linux-glibc"
469420
},
470421
{ image: "debian:12"
471422
, installCmd: "apt-get update && apt-get install -y"
472423
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools }}"
473424
, DISTRO: "Debian"
474-
, ARTIFACT: "x86_64-linux-deb12"
475-
, ADD_CABAL_ARGS: "--enable-split-sections"
425+
, ARTIFACT: "x86_64-linux-glibc"
476426
},
477427
{ image: "ubuntu:20.04"
478428
, installCmd: "apt-get update && apt-get install -y"
479429
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools }}"
480430
, DISTRO: "Ubuntu"
481-
, ARTIFACT: "x86_64-linux-ubuntu20.04"
482-
, ADD_CABAL_ARGS: "--enable-split-sections"
431+
, ARTIFACT: "x86_64-linux-glibc"
483432
},
484433
{ image: "ubuntu:22.04"
485434
, installCmd: "apt-get update && apt-get install -y"
486435
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools }}"
487436
, DISTRO: "Ubuntu"
488-
, ARTIFACT: "x86_64-linux-ubuntu22.04"
489-
, ADD_CABAL_ARGS: "--enable-split-sections"
437+
, ARTIFACT: "x86_64-linux-glibc"
490438
},
491439
{ image: "ubuntu:24.04"
492440
, installCmd: "apt-get update && apt-get install -y"
493441
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools_ncurses6 }}"
494442
, DISTRO: "Ubuntu"
495-
, ARTIFACT: "x86_64-linux-ubuntu24.04"
496-
, ADD_CABAL_ARGS: "--enable-split-sections"
443+
, ARTIFACT: "x86_64-linux-glibc"
444+
},
445+
{ image: "linuxmintd/mint20.3-amd64"
446+
, installCmd: "apt-get update && apt-get install -y"
447+
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools }}"
448+
, DISTRO: "Mint"
449+
, ARTIFACT: "x86_64-linux-glibc"
450+
},
451+
{ image: "linuxmintd/mint21.3-amd64"
452+
, installCmd: "apt-get update && apt-get install -y"
453+
, toolRequirements: "${{ needs.tool-output.outputs.apt_tools }}"
454+
, DISTRO: "Mint"
455+
, ARTIFACT: "x86_64-linux-glibc"
497456
},
498457
{ image: "fedora:33"
499458
, installCmd: "dnf install -y"
500459
, toolRequirements: "${{ needs.tool-output.outputs.rpm_tools }}"
501460
, DISTRO: "Fedora"
502-
, ARTIFACT: "x86_64-linux-fedora33"
503-
, ADD_CABAL_ARGS: "--enable-split-sections"
461+
, ARTIFACT: "x86_64-linux-glibc"
504462
},
505-
{ image: "fedora:36"
463+
{ image: "fedora:37"
506464
, installCmd: "dnf install -y"
507465
, toolRequirements: "${{ needs.tool-output.outputs.rpm_tools }}"
508466
, DISTRO: "Fedora"
509-
, ARTIFACT: "x86_64-linux-fedora36"
510-
, ADD_CABAL_ARGS: "--enable-split-sections"
467+
, ARTIFACT: "x86_64-linux-glibc"
511468
},
512-
{ image: "fedora:38"
469+
{ image: "fedora:42"
513470
, installCmd: "dnf install -y"
514471
, toolRequirements: "${{ needs.tool-output.outputs.rpm_tools }}"
515472
, DISTRO: "Fedora"
516-
, ARTIFACT: "x86_64-linux-fedora38"
517-
, ADD_CABAL_ARGS: "--enable-split-sections"
473+
, ARTIFACT: "x86_64-linux-glibc"
518474
},
519475
{ image: "rockylinux:8"
520476
, installCmd: "yum -y install epel-release && yum install -y --allowerasing"
521477
, toolRequirements: "${{ needs.tool-output.outputs.rpm_tools }}"
522-
, DISTRO: "Unknown"
523-
, ARTIFACT: "x86_64-linux-rocky8"
524-
, ADD_CABAL_ARGS: "--enable-split-sections"
478+
, DISTRO: "Rockylinux"
479+
, ARTIFACT: "x86_64-linux-glibc"
480+
},
481+
{ image: "rockylinux:9"
482+
, installCmd: "yum -y install epel-release && yum install -y --allowerasing"
483+
, toolRequirements: "${{ needs.tool-output.outputs.rpm_tools }}"
484+
, DISTRO: "Rockylinux"
485+
, ARTIFACT: "x86_64-linux-glibc"
525486
},
526487
{ image: "alpine:3.20"
527488
, installCmd: "apk update && apk add"
528489
, toolRequirements: "${{ needs.tool-output.outputs.apk_tools }}"
529-
, DISTRO: "Unknown"
530-
, ARTIFACT: "x86_64-linux-unknown"
531-
, ADD_CABAL_ARGS: "--enable-split-sections --enable-executable-static"
490+
, DISTRO: "Alpine"
491+
, ARTIFACT: "x86_64-linux-musl-static"
532492
},
533493
{ image: "alpine:3.12"
534494
, installCmd: "apk update && apk add"
535495
, toolRequirements: "${{ needs.tool-output.outputs.apk_tools }}"
536-
, DISTRO: "Unknown"
537-
, ARTIFACT: "x86_64-linux-alpine312"
538-
, ADD_CABAL_ARGS: "--enable-split-sections"
496+
, DISTRO: "Alpine"
497+
, ARTIFACT: "x86_64-linux-musl-static"
539498
},
540-
{ image: "alpine:3.20"
541-
, installCmd: "apk update && apk add"
542-
, toolRequirements: "${{ needs.tool-output.outputs.apk_tools }}"
499+
{ image: "ghcr.io/void-linux/void-glibc:latest"
500+
, installCmd: "xbps-install -Suy xbps && xbps-install -Sy"
501+
, toolRequirements: "${{ needs.tool-output.outputs.xbps_tools }}"
543502
, DISTRO: "Unknown"
544-
, ARTIFACT: "x86_64-linux-alpine320"
545-
, ADD_CABAL_ARGS: "--enable-split-sections"
503+
, ARTIFACT: "x86_64-linux-musl-static"
546504
}
547505
]
548506
container:

0 commit comments

Comments
 (0)