Skip to content

Commit 3648f60

Browse files
Add steps to build with custom toolchains
1 parent b8f7ca6 commit 3648f60

2 files changed

Lines changed: 39 additions & 1 deletion

File tree

.github/workflows/prerelease.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ on:
1818
push:
1919
branches:
2020
- main
21+
pull_request:
2122

2223
permissions:
2324
contents: read
@@ -83,12 +84,17 @@ jobs:
8384
echo $GLIBC_VERSION
8485
sed "s/^MANYLINUX_VERSION.*/MANYLINUX_VERSION=\"manylinux_${GLIBC_VERSION}_x86_64.manylinux2014_x86_64\"/" BUILD -i || true
8586
bazel build --define GLIBC_VERSION=$GLIBC_VERSION --define TARGET_VERSION="$(python -c "print(\"py${TARGET_PYTHON}\".replace(\".\", \"\"))")" --define VERSION="$(cat version/version.txt)" :tesseract_decoder_wheel
86-
87+
8788
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
8889
with:
8990
name: python-wheels-${{ matrix.os }}-${{ matrix.python-version }}
9091
path: ./bazel-bin/*.whl
9192

93+
- name: Build with custom toolchain
94+
env:
95+
TARGET_PYTHON: ${{ matrix.python-version }}
96+
run: ./devtools/build_with_custom_toolchain.sh
97+
9298
release-wheels:
9399
name: Publish all wheels
94100
needs: [build_wheels]
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# 1. Start a temporary background container named 'sysroot-builder'
2+
docker run -d --name sysroot-builder debian:11.11 sleep 3600
3+
4+
# 2. Run the installation and packaging process inside the container
5+
docker exec sysroot-builder bash -c "
6+
apt-get update && apt-get install -y build-essential libc6-dev symlinks
7+
8+
# Convert absolute symlinks to relative (CRITICAL so Clang doesn't read your host OS files)
9+
symlinks -rc /lib /usr/lib /usr/include
10+
11+
# Create the staging directory
12+
mkdir -p /sysroot/usr/lib /sysroot/usr/include /sysroot/lib /sysroot/lib64
13+
14+
# Copy files while preserving symlinks (-a)
15+
cp -a /usr/include/* /sysroot/usr/include/
16+
cp -a /usr/lib/* /sysroot/usr/lib/
17+
cp -a /lib/* /sysroot/lib/ 2>/dev/null || true
18+
cp -a /lib64/* /sysroot/lib64/ 2>/dev/null || true
19+
20+
# Create a tarball inside the container
21+
cd /sysroot && tar -czf /sysroot.tar.gz .
22+
"
23+
24+
# 3. Copy the tarball from the container directly to your host machine
25+
docker cp sysroot-builder:/sysroot.tar.gz ./sysroot.tar.gz
26+
27+
# 4. Extract the contents into your project and clean up
28+
mkdir -p custom_sysroot
29+
tar -xzf sysroot.tar.gz -C custom_sysroot
30+
rm sysroot.tar.gz
31+
docker rm -f sysroot-builder
32+

0 commit comments

Comments
 (0)