|
27 | 27 | matrix: |
28 | 28 | os: [macos-11, windows-2019, ubuntu-20.04] |
29 | 29 | arch: [x86, x64] |
30 | | - go: [1.16.3] |
31 | 30 | include: |
32 | 31 | - os: macos-11 |
33 | 32 | friendlyName: macOS |
|
36 | 35 | friendlyName: macOS |
37 | 36 | targetPlatform: macOS |
38 | 37 | arch: arm64 |
39 | | - go: 1.16.3 |
40 | 38 | - os: windows-2019 |
41 | 39 | friendlyName: Windows |
42 | 40 | targetPlatform: win32 |
|
69 | 67 | submodules: recursive |
70 | 68 | # Needed for script/package.sh to work |
71 | 69 | fetch-depth: 0 |
72 | | - - name: Use go ${{ matrix.go }} |
| 70 | + - name: Install go |
| 71 | + if: matrix.targetPlatform == 'macOS' |
73 | 72 | uses: actions/setup-go@v2 |
74 | | - with: |
75 | | - go-version: ${{ matrix.go }} |
76 | 73 | - name: Install dependencies |
77 | 74 | run: npm install |
78 | 75 | - name: Check formatting |
@@ -108,6 +105,70 @@ jobs: |
108 | 105 | sudo dpkg --add-architecture armhf |
109 | 106 | sudo apt-get update |
110 | 107 | sudo apt-get install gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf libcurl4-gnutls-dev:armhf zlib1g-dev:armhf gettext |
| 108 | + - name: Add patches to minimize needed GLIBC version |
| 109 | + if: matrix.targetPlatform == 'ubuntu' |
| 110 | + run: | |
| 111 | + CURRENT_DIR="$(pwd)" |
| 112 | + sudo apt-get -yq install python3 |
| 113 | + # download chromium reversion_glibc.py script from chromium source tree at pinned commit (incase they ever move or change it) |
| 114 | + wget https://raw.githubusercontent.com/chromium/chromium/01bc42d648c45439e1beef8fd25fde3aef9079bc/build/linux/sysroot_scripts/reversion_glibc.py -O /tmp/reversion_glibc.py |
| 115 | + # set targeted minimum GLIBC to 2.17 |
| 116 | + sed -i 's/26]/17]/g' /tmp/reversion_glibc.py |
| 117 | + chmod +x /tmp/reversion_glibc.py |
| 118 | + # download the host libc6 package from apt and patch the binaries in it |
| 119 | + # replacing the host libc6 at runtime causes crashs and hangs but apt is able to do it without issue |
| 120 | + sudo apt-get install --download-only --reinstall -y libc6 |
| 121 | + sudo rm -rf /tmp/libc6 |
| 122 | + sudo mkdir /tmp/libc6 |
| 123 | + sudo cp /var/cache/apt/archives/libc6_2.31-*_amd64.deb /tmp/libc6 |
| 124 | + cd /tmp/libc6 |
| 125 | + deb_name="$(ls)" |
| 126 | + sudo ar x "$deb_name" |
| 127 | + sudo tar xf data.tar.xz |
| 128 | + sudo mkdir DEBIAN |
| 129 | + sudo tar xf control.tar.xz -C DEBIAN |
| 130 | + sudo rm -f control.tar.xz \ |
| 131 | + data.tar.xz \ |
| 132 | + debian-binary \ |
| 133 | + DEBIAN/md5sums \ |
| 134 | + DEBIAN/archives \ |
| 135 | + DEBIAN/conffiles \ |
| 136 | + "$deb_name" |
| 137 | +
|
| 138 | + # patch libc6 in host download deb and cross compilers using the reversion_glibc.py script |
| 139 | + files=(/tmp/libc6/lib/x86_64-linux-gnu/libc.so.6 /tmp/libc6/lib/x86_64-linux-gnu/libm.so.6 \ |
| 140 | + /usr/aarch64-linux-gnu/lib/libc.so.6 /usr/aarch64-linux-gnu/lib/libm.so.6 \ |
| 141 | + /usr/arm-linux-gnueabihf/lib/libc.so.6 /usr/arm-linux-gnueabihf/lib/libm.so.6 \ |
| 142 | + /libx32/libc.so.6 /libx32/libm.so.6 \ |
| 143 | + /lib32/libc.so.6 /lib32/libm.so.6 \ |
| 144 | + /usr/i686-linux-gnu/lib/libc.so.6 /usr/i686-linux-gnu/lib/libm.so.6) |
| 145 | + for file in "${files[@]}"; do |
| 146 | + [ -f $file ] && sudo python3 /tmp/reversion_glibc.py "$file" |
| 147 | + done |
| 148 | +
|
| 149 | + # install patched libc6 deb |
| 150 | + sudo dpkg-deb -b . "$deb_name" |
| 151 | + sudo apt install --reinstall --allow-downgrades -y ./"$deb_name" |
| 152 | + cd "$CURRENT_DIR" |
| 153 | + # __GLIBC_MINOR__ is used as a feature test macro. Replace it with the |
| 154 | + # earliest supported version of glibc 2.17 |
| 155 | + files=(/usr/include/features.h \ |
| 156 | + /usr/aarch64-linux-gnu/include/features.h \ |
| 157 | + /usr/arm-linux-gnueabihf/include/features.h \ |
| 158 | + /usr/i686-linux-gnu/include/features.h) |
| 159 | + for file in "${files[@]}"; do |
| 160 | + [ -f $file ] && sudo sed -i 's|\(#define\s\+__GLIBC_MINOR__\)|\1 17 //|' "$file" |
| 161 | + done |
| 162 | +
|
| 163 | + # fcntl64() was introduced in glibc 2.28. Make sure to use fcntl() instead. |
| 164 | + files=(/usr/include/fcntl.h \ |
| 165 | + /usr/aarch64-linux-gnu/include/fcntl.h \ |
| 166 | + /usr/arm-linux-gnueabihf/include/fcntl.h \ |
| 167 | + /usr/i686-linux-gnu/include/fcntl.h) |
| 168 | + for file in "${files[@]}"; do |
| 169 | + [ -f $file ] && sudo sed -i '{N; s/#ifndef __USE_FILE_OFFSET64\(\nextern int fcntl\)/#if 1\1/}' "$file" |
| 170 | + done |
| 171 | + true |
111 | 172 | - name: Build (except macOS arm64) |
112 | 173 | if: matrix.targetPlatform != 'macOS' || matrix.arch != 'arm64' |
113 | 174 | shell: bash |
|
0 commit comments