-
-
Notifications
You must be signed in to change notification settings - Fork 1
190 lines (182 loc) · 7.09 KB
/
build-pkg.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# Build an MPR package.
name: Build Package
on:
pull_request:
branches:
- pkg/*
jobs:
get-targets:
name: Get Targets
runs-on: ubuntu-latest
outputs:
targets: ${{ steps.update-targets.outputs.targets }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: "${{ github.base_ref }}"
- name: Setup Prebuilt-MPR APT repository
uses: makedeb/setup-makedeb@main
with:
makedeb-repo: false
pbmpr-repo: true
- name: Get pkgbase
id: pkgbase
run: echo "${{ github.base_ref }}" | sed 's|^pkg/||' | echo "PKGBASE=$(cat)" >> "${GITHUB_OUTPUT}"
- name: Get update targets
id: update-targets
uses: ./.github/workflows/get-update-targets
with:
pkgbase: "${{ steps.pkgbase.outputs.PKGBASE }}"
makedeb_url: "${{ vars.MAKEDEB_URL }}"
update-pkg:
name: Build Package (${{ matrix.target.distro }}:${{ matrix.target.display-arch }})
runs-on: ubuntu-latest
needs: get-targets
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.get-targets.outputs.targets) }}
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
- name: Checkout repository
uses: actions/checkout@v4
with:
path: pkg
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker config
run: |
# The 'Maximize build space' step only makes the extra storage
# available to our workspace directory. Our Docker container
# will produce a lot of storage, so store all of that stuff in
# the workspace directory too.
echo "{\"data-root\":\"${PWD}/docker\"}" | sudo tee /etc/docker/daemon.json 1> /dev/null
sudo systemctl restart docker
- name: Get pkgbase
id: pkgbase
run: echo "${{ github.base_ref }}" | sed 's|^pkg/||' | echo "PKGBASE=$(cat)" >> "${GITHUB_OUTPUT}"
- name: Build package
run: |
chmod a+rwx pkg/
cd pkg/
echo "${SCRIPT}" | docker run \
-i \
-v "${PWD}:/home/makedeb" \
--platform "linux/${{ matrix.target.arch }}" \
"ghcr.io/makedeb/makedeb:${{ matrix.target.image-tag }}"
env:
SCRIPT: |
export "DEBIAN_FRONTEND=${{ vars.DEBIAN_FRONTEND }}"
PKGBASE="${{ steps.pkgbase.outputs.PKGBASE }}"
export CARGO_NET_GIT_FETCH_WITH_CLI=true # Workaround for https://github.com/rust-lang/cargo/issues/10583.
sudo chown 'makedeb:makedeb' "${HOME}" -R
# Install Prerequisites.
sudo apt-get update
sudo -E apt-get install git gpg locales-all wget -y
export LANG='en_US.UTF-8'
# Set up the Prebuilt-MPR.
wget -qO - 'https://proget.makedeb.org/debian-feeds/prebuilt-mpr.pub' | gpg --dearmor | sudo tee /usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg 1> /dev/null
echo "deb [arch=all,$(dpkg --print-architecture) signed-by=/usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg] https://proget.makedeb.org prebuilt-mpr $(lsb_release -cs)" | sudo tee /etc/apt/sources.list.d/prebuilt-mpr.list
sudo apt-get update
# Set up potentially needed packages.
# In general we want to avoid installing anything not needed, but
# some packages require setup before they can be used.
sudo apt-get install rustup -y
rustup update stable
# The args we pass to makedeb.
makedeb_args=('makedeb' '-s' '--no-confirm' '--pass-env')
# Package-specific changes.
case "${PKGBASE}" in
golang-go)
# We need this to build golang-go on some older distros.
sudo apt-get install golang-go-bin -y
;;
prismlauncher)
# Workaround for https://github.com/makedeb/prebuilt-mpr/pull/147#issuecomment-1604226684.
sudo apt-get install ca-certificates-java -y
;;
rustup)
# We don't build 'rustc' for all available architectures,
# so install the rust toolchain manually and use that.
#
# See https://github.com/makedeb/prebuilt-mpr/issues/247.
makedeb_args+=('-d')
sudo apt-get install rustup-init -y
rustup-init -y
source "${HOME}/.cargo/env"
;;
esac
# Set up the makedeb config. The stock makedeb config has
# issues when building on non-amd64 machines. This change
# fixes that until a fix is implemented in makedeb.
(
cat << EOF
CARCH="$(uname -m)"
DLAGENTS=(
'file::/usr/bin/curl -gqC - -o %o %u'
'ftp::/usr/bin/curl -gqfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
'http::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
'https::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
'rsync::/usr/bin/rsync --no-motd -z %u %o'
'scp::/usr/bin/scp -C %u %o'
)
VCSCLIENTS=(
'bzr::bzr'
'fossil::fossil'
'git::git'
'hg::mercurial'
'svn::subversion'
)
BUILDENV=(
'!distcc'
'color'
'!ccache'
'check'
'!sign'
)
OPTIONS=(
'strip'
'docs'
'!libtool'
'!staticlibs'
'emptydirs'
'zipman'
'purge'
'!debug'
'!lto'
)
INTEGRITY_CHECK=(sha256)
STRIP_BINARIES="--strip-all"
STRIP_SHARED="--strip-unneeded"
STRIP_STATIC="--strip-debug"
MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
DBGSRCDIR="/usr/src/debug"
COMPRESSGZ=(gzip -c -f -n)
COMPRESSBZ2=(bzip2 -c -f)
COMPRESSXZ=(xz -c -z -)
COMPRESSZST=(zstd -c -z -q -)
COMPRESSLRZ=(lrzip -q)
COMPRESSLZO=(lzop -q)
COMPRESSZ=(compress -c -f)
COMPRESSLZ4=(lz4 -q)
COMPRESSLZ=(lzip -c -f)
PKGEXT='.pkg.tar.zst'
SRCEXT='.src.tar.gz'
EOF
) | sudo tee /etc/makepkg.conf 1> /dev/null
"${makedeb_args[@]}"
- name: Upload built package
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.target.distro }}-${{ matrix.target.display-arch }}"
path: 'pkg/*.deb'