forked from hesa/gnu-xnee
-
Notifications
You must be signed in to change notification settings - Fork 0
185 lines (169 loc) · 7.51 KB
/
Copy pathel6.yml
File metadata and controls
185 lines (169 loc) · 7.51 KB
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
name: Enterprise Linux 6 CI/CD
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
workflow_dispatch:
jobs:
build-and-package-el6:
name: Build and package on Enterprise Linux 6 (${{ matrix.arch }})
# Run on the Ubuntu host so that actions/checkout (Node 20) works; all
# CentOS 6 work is done via explicit `docker run centos:6` invocations
# below. Using `container:` at job level would inject Node 20 into the
# CentOS 6 container, which fails because CentOS 6 ships glibc 2.12 and
# Node 20 requires glibc >= 2.17.
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
arch: [x86_64, i686]
steps:
- name: Checkout source
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Write shared CentOS 6 vault repo helper
run: |
# CentOS 6 reached EOL; vault.centos.org returns 403 on HTTP so HTTPS
# is required. The x86_64 vault repos are correct for both arches:
# CentOS 6 multilib ships i686 packages in the same repositories.
# Use printf to avoid a nested heredoc that would break YAML parsing.
cat > "$RUNNER_TEMP/setup-el6-repos.sh" << 'SETUP'
setup_centos6_vault_repos() {
printf '%s\n' \
'[base]' \
'name=CentOS-6 - Base' \
'baseurl=https://vault.centos.org/6.10/os/x86_64/' \
'gpgcheck=1' \
'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6' \
'' \
'[updates]' \
'name=CentOS-6 - Updates' \
'baseurl=https://vault.centos.org/6.10/updates/x86_64/' \
'gpgcheck=1' \
'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6' \
'' \
'[extras]' \
'name=CentOS-6 - Extras' \
'baseurl=https://vault.centos.org/6.10/extras/x86_64/' \
'gpgcheck=1' \
'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6' \
> /etc/yum.repos.d/CentOS-Base.repo
}
SETUP
- name: Build and test inside CentOS 6 container
run: |
cat > "$RUNNER_TEMP/build-el6.sh" << 'SCRIPT'
set -ex
# shellcheck source=/dev/null
. /setup-el6-repos.sh
setup_centos6_vault_repos
# Install base build dependencies
yum install -y \
gcc make autoconf automake libtool pkgconfig perl \
libX11-devel libXtst-devel texinfo rpm-build git
# 32-bit (i686) extras and compiler wrapper
if [ "$TARGET_ARCH" = "i686" ]; then
# libgcc.i686 provides /lib/libgcc_s.so.1 needed by gcc -m32
yum install -y \
libgcc.i686 glibc-devel.i686 \
libX11-devel.i686 libXtst-devel.i686
# Provide i686-redhat-linux-gnu-gcc so --host= works with autoconf
printf '#!/bin/sh\nexec gcc -m32 "$@"\n' \
> /usr/local/bin/i686-redhat-linux-gnu-gcc
chmod +x /usr/local/bin/i686-redhat-linux-gnu-gcc
ln -sf /usr/local/bin/i686-redhat-linux-gnu-gcc \
/usr/local/bin/i686-redhat-linux-gnu-g++
# CFLAGS/LDFLAGS are for this build+test step only.
# The RPM step drives -m32 via rpmbuild --define "optflags ..."
# so these are intentionally not set there.
export CFLAGS="-m32 -march=i686 -mtune=generic"
export LDFLAGS="-m32"
CONFIGURE_HOST="--host=i686-redhat-linux-gnu --build=x86_64-redhat-linux-gnu"
else
CONFIGURE_HOST=""
fi
cd /workspace
make -f Makefile.cvs generate
# word-split of $CONFIGURE_HOST is intentional (empty or two flags)
# shellcheck disable=SC2086
./configure --disable-gui --disable-doc --disable-xinput2 \
$CONFIGURE_HOST
make
make -C cnee/src man
chmod +x tests/e2e_cnee.sh
./tests/e2e_cnee.sh ./cnee/src/cnee
SCRIPT
docker run --rm \
-e TARGET_ARCH="${{ matrix.arch }}" \
-v "$PWD:/workspace" \
-v "$RUNNER_TEMP/build-el6.sh:/build.sh:ro" \
-v "$RUNNER_TEMP/setup-el6-repos.sh:/setup-el6-repos.sh:ro" \
centos:6 bash /build.sh
- name: Create source distribution
run: |
XNEE_VERSION=$(grep 'AC_INIT' configure.in \
| awk 'BEGIN {FS=","} { print $2 }' \
| tr -d ' ')
# git safe.directory was added in git 2.35.2; ignore errors on older git.
git config --global --add safe.directory "$(pwd)" 2>/dev/null || true
git archive --prefix="xnee-${XNEE_VERSION}/" HEAD \
| gzip > "xnee-${XNEE_VERSION}.tar.gz"
- name: Build RPM inside CentOS 6 container
run: |
cat > "$RUNNER_TEMP/rpm-el6.sh" << 'SCRIPT'
set -ex
# shellcheck source=/dev/null
. /setup-el6-repos.sh
setup_centos6_vault_repos
yum install -y \
gcc make autoconf automake libtool pkgconfig perl \
libX11-devel libXtst-devel texinfo rpm-build
if [ "$TARGET_ARCH" = "i686" ]; then
yum install -y \
libgcc.i686 glibc-devel.i686 \
libX11-devel.i686 libXtst-devel.i686
printf '#!/bin/sh\nexec gcc -m32 "$@"\n' \
> /usr/local/bin/i686-redhat-linux-gnu-gcc
chmod +x /usr/local/bin/i686-redhat-linux-gnu-gcc
ln -sf /usr/local/bin/i686-redhat-linux-gnu-gcc \
/usr/local/bin/i686-redhat-linux-gnu-g++
fi
cd /workspace
XNEE_VERSION=$(grep 'AC_INIT' configure.in \
| awk 'BEGIN {FS=","} { print $2 }' | tr -d ' ')
XNEE_RELEASE=1
mkdir -p "$HOME/rpmbuild"/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
cp "xnee-${XNEE_VERSION}.tar.gz" "$HOME/rpmbuild/SOURCES/"
sed \
-e "s/XNEE_VERSION/${XNEE_VERSION}/g" \
-e "s/XNEE_RELEASE/${XNEE_RELEASE}/g" \
build/SPECS/cnee-el6.spec \
> "$HOME/rpmbuild/SPECS/cnee.spec"
if [ "$TARGET_ARCH" = "i686" ]; then
# Set host to i686 so %configure uses our wrapper gcc.
# Do not export CFLAGS/LDFLAGS here to avoid polluting %configure.
rpmbuild -ba \
--define "_host i686-redhat-linux-gnu" \
--define "_host_alias i686-redhat-linux-gnu" \
--define "_target_cpu i686" \
--define "optflags -O2 -g -m32 -march=i686 -mtune=generic" \
"$HOME/rpmbuild/SPECS/cnee.spec"
else
rpmbuild -ba "$HOME/rpmbuild/SPECS/cnee.spec"
fi
find "$HOME/rpmbuild/RPMS" "$HOME/rpmbuild/SRPMS" -name "*.rpm" \
-exec cp {} /workspace/ \;
SCRIPT
docker run --rm \
-e TARGET_ARCH="${{ matrix.arch }}" \
-v "$PWD:/workspace" \
-v "$RUNNER_TEMP/rpm-el6.sh:/rpm.sh:ro" \
-v "$RUNNER_TEMP/setup-el6-repos.sh:/setup-el6-repos.sh:ro" \
centos:6 bash /rpm.sh
- name: Upload RPM artifact
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
with:
name: cnee-el6-${{ matrix.arch }}-rpm
path: "*.rpm"
if-no-files-found: error