Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 74 additions & 8 deletions .github/workflows/toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

on: [push, pull_request]

jobs:
Expand All @@ -12,35 +16,96 @@ jobs:

runs-on: ubuntu-latest
container:
image: koreader/kobase:0.4.0-22.04
image: koreader/kobase:2.0.0-22.04

strategy:
fail-fast: false
matrix:
tc: [kindle, kindle5, kindlepw2, kindlehf, kobo, kobov4, kobov5, nickel, remarkable, remarkable-aarch64, cervantes, pocketbook, bookeen]
tc: [
bookeen,
cervantes,
kindle,
kindle5,
kindlehf,
kindlepw2,
kobo,
kobov4,
kobov5,
nickel,
pocketbook,
pocketbookhf,
remarkable,
remarkable-aarch64,
]

env:
CCACHE_DIR: "${{ format('{0}/ccache', github.workspace) }}"

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
fetch-depth: 1

- name: Install deps
run: |
set -x
sudo apt-get update
sudo apt-get install --no-install-recommends -y bison flex gawk gperf help2man libncurses-dev libtool-bin rsync texinfo

- name: Restore build cache
id: cache-restore
uses: actions/cache/restore@v6
with:
path: &CACHE_PATHS |
${{ env.CCACHE_DIR }}
key: ${{ matrix.tc }}-cache-${{ github.sha }}-${{ github.run_number }}
restore-keys: |
${{ matrix.tc }}-cache-${{ github.sha }}-
${{ matrix.tc }}-cache-

- name: Setup build cache
if: steps.build-restore.outputs.cache-hit != 'true'
run: |
set -x
ccache --version
ccache --zero-stats
ccache --max-size=1G
ccache --show-config
ccache_bindir='/usr/local/ccache'
sudo mkdir "${ccache_bindir}"
for f in /usr/bin/{c++,cc,g++,gcc,x86_64-*-gcc,x86_64-*-g++}; do
[[ -x "$f" ]] || exit $?
sudo ln --symbolic --no-dereference --force --relative /usr/local/bin/ccache "$ccache_bindir/${f##*/}"
done
printf '%s\n' "${ccache_bindir}" >>"${GITHUB_PATH}"

- name: Generate toolchain
run: ./gen-tc.sh ${{ matrix.tc }}

- name: Clean build cache
if: always()
run: |
set -x
ccache --cleanup >/dev/null
ccache --show-stats --verbose

- name: Save build cache
uses: actions/cache/save@v6
if: always() && steps.cache-restore.outputs.cache-hit != 'true'
with:
path: *CACHE_PATHS
key: ${{ steps.cache-restore.outputs.cache-primary-key }}

- name: Tar artifacts
run: tar -C ~ -czf ${{ matrix.tc }}.tar.gz x-tools
run: tar -C ~ -caf ${{ matrix.tc }}.tar.zst x-tools

- name: Upload artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
archive: false
name: ${{ matrix.tc }}
path: ${{ matrix.tc }}.tar.gz
path: ${{ matrix.tc }}.tar.zst

release:

Expand All @@ -54,15 +119,16 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
fetch-depth: 1

- name: Download artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
merge-multiple: true
path: artifacts
skip-decompress: true

- name: Create release
env:
Expand Down
101 changes: 35 additions & 66 deletions gen-tc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BUILD_ROOT="${CUR_DIR}/build"
DEFAULT_GIT_REPO="https://github.com/crosstool-ng/crosstool-ng.git"
DEFAULT_GIT_REPO='https://github.com/benoit-pierre/crosstool-ng.git'
DEFAULT_GIT_REV='34844bc8e985ad1ba26b072a5b58264967072e19'

Build_CT-NG() {
echo "[*] Building CrossTool-NG . . ."
Expand Down Expand Up @@ -103,6 +104,7 @@ Supported platforms:
remarkable-aarch64
cervantes
pocketbook
pocketbookhf
bookeen
"

Expand All @@ -119,126 +121,93 @@ case $1 in
;;
kobov5)
Build_CT-NG \
https://github.com/NiLuJe/crosstool-ng.git \
62fb5946719c24dd38c1f41a35a7f8bdf35462d6 \
"$DEFAULT_GIT_REPO" \
"$DEFAULT_GIT_REV" \
"arm-${1}-linux-gnueabihf"
;;
kobov4)
Build_CT-NG \
https://github.com/NiLuJe/crosstool-ng.git \
62fb5946719c24dd38c1f41a35a7f8bdf35462d6 \
"$DEFAULT_GIT_REPO" \
"$DEFAULT_GIT_REV" \
"arm-${1}-linux-gnueabihf"
;;
kobo)
Build_CT-NG \
https://github.com/NiLuJe/crosstool-ng.git \
62fb5946719c24dd38c1f41a35a7f8bdf35462d6 \
"$DEFAULT_GIT_REPO" \
"$DEFAULT_GIT_REV" \
"arm-${1}-linux-gnueabihf"
;;
nickel)
Build_CT-NG \
https://github.com/NiLuJe/crosstool-ng.git \
62fb5946719c24dd38c1f41a35a7f8bdf35462d6 \
"$DEFAULT_GIT_REPO" \
"$DEFAULT_GIT_REV" \
"arm-${1}-linux-gnueabihf"
;;
kindlehf)
Build_CT-NG \
https://github.com/NiLuJe/crosstool-ng.git \
62fb5946719c24dd38c1f41a35a7f8bdf35462d6 \
"$DEFAULT_GIT_REPO" \
"$DEFAULT_GIT_REV" \
"arm-${1}-linux-gnueabihf"
;;
kindlepw2)
Build_CT-NG \
https://github.com/NiLuJe/crosstool-ng.git \
62fb5946719c24dd38c1f41a35a7f8bdf35462d6 \
"$DEFAULT_GIT_REPO" \
"$DEFAULT_GIT_REV" \
"arm-${1}-linux-gnueabi"
;;
kindle5)
Build_CT-NG \
https://github.com/NiLuJe/crosstool-ng.git \
62fb5946719c24dd38c1f41a35a7f8bdf35462d6 \
"$DEFAULT_GIT_REPO" \
"$DEFAULT_GIT_REV" \
"arm-${1}-linux-gnueabi"
;;
kindle)
# NOTE: Prevent libstdc++ from pulling in utimensat@GLIBC_2.6
export glibcxx_cv_utimensat=no

Build_CT-NG \
https://github.com/NiLuJe/crosstool-ng.git \
62fb5946719c24dd38c1f41a35a7f8bdf35462d6 \
"$DEFAULT_GIT_REPO" \
"$DEFAULT_GIT_REV" \
"arm-${1}-linux-gnueabi"
unset glibcxx_cv_utimensat
;;
remarkable)
Build_CT-NG \
https://github.com/NiLuJe/crosstool-ng.git \
62fb5946719c24dd38c1f41a35a7f8bdf35462d6 \
"$DEFAULT_GIT_REPO" \
"$DEFAULT_GIT_REV" \
"arm-${1}-linux-gnueabihf"
;;
remarkable-aarch64)
Build_CT-NG \
https://github.com/NiLuJe/crosstool-ng.git \
9d4156d109d22e9b0e8958e56bbbd947cd7ce065 \
"$DEFAULT_GIT_REPO" \
"$DEFAULT_GIT_REV" \
"aarch64-remarkable-linux-gnu"
;;
cervantes)
Build_CT-NG \
https://github.com/NiLuJe/crosstool-ng.git \
62fb5946719c24dd38c1f41a35a7f8bdf35462d6 \
"$DEFAULT_GIT_REPO" \
"$DEFAULT_GIT_REV" \
"arm-${1}-linux-gnueabi"
;;
pocketbook)
# NOTE: Prevent libstdc++ from pulling in utimensat@GLIBC_2.6
export glibcxx_cv_utimensat=no

Build_CT-NG \
https://github.com/NiLuJe/crosstool-ng.git \
62fb5946719c24dd38c1f41a35a7f8bdf35462d6 \
"$DEFAULT_GIT_REPO" \
"$DEFAULT_GIT_REV" \
"arm-${1}-linux-gnueabi"
# Then, pull InkView from the (old) official SDK...
# NOTE: See also https://github.com/pocketbook/SDK_6.3.0/tree/5.19/SDK-iMX6/usr/arm-obreey-linux-gnueabi/sysroot/usr/local for newer FWs...
chmod a+w "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/lib"
wget https://github.com/blchinezu/pocketbook-sdk/raw/5.17/SDK_481/arm-obreey-linux-gnueabi/sysroot/usr/local/lib/libinkview.481.5.17.so \
-O "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/lib/libinkview.so"
chmod a-w "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/lib/libinkview.so"
wget https://github.com/blchinezu/pocketbook-sdk/raw/5.17/SDK_481/arm-obreey-linux-gnueabi/sysroot/usr/local/lib/libhwconfig.so \
-O "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/lib/libhwconfig.so"
chmod a-w "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/lib/libhwconfig.so"
wget https://github.com/blchinezu/pocketbook-sdk/raw/5.17/FRSCSDK/arm-none-linux-gnueabi/sysroot/usr/lib/libbookstate.so \
-O "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/lib/libbookstate.so"
chmod a-w "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/lib/libbookstate.so"
chmod a-w "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/lib"
chmod a+w "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/include"
wget https://github.com/blchinezu/pocketbook-sdk/raw/5.17/SDK_481/arm-obreey-linux-gnueabi/sysroot/usr/local/include/inkview.h \
-O "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/include/inkview.h"
# Don't pull 3rd-party includes...
sed -e '/^#include <zlib.h>/i \/*' -i "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/include/inkview.h"
sed -e '/^#include FT_OUTLINE_H/a *\/' -i "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/include/inkview.h"
# NOTE: This also comments <pthread.h>, which the header itself doesn't need anyway...
chmod a-w "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/include/inkview.h"
wget https://github.com/blchinezu/pocketbook-sdk/raw/5.17/SDK_481/arm-obreey-linux-gnueabi/sysroot/usr/local/include/inkplatform.h \
-O "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/include/inkplatform.h"
chmod a-w "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/include/inkplatform.h"
wget https://github.com/blchinezu/pocketbook-sdk/raw/5.17/SDK_481/arm-obreey-linux-gnueabi/sysroot/usr/local/include/inklog.h \
-O "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/include/inklog.h"
chmod a-w "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/include/inklog.h"
wget https://github.com/blchinezu/pocketbook-sdk/raw/5.17/SDK_481/arm-obreey-linux-gnueabi/sysroot/usr/local/include/inkinternal.h \
-O "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/include/inkinternal.h"
chmod a-w "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/include/inkinternal.h"
wget https://github.com/blchinezu/pocketbook-sdk/raw/5.17/SDK_481/arm-obreey-linux-gnueabi/sysroot/usr/local/include/hwconfig.h \
-O "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/include/hwconfig.h"
chmod a-w "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/include/hwconfig.h"
wget https://github.com/blchinezu/pocketbook-sdk/raw/5.17/FRSCSDK/arm-none-linux-gnueabi/sysroot/usr/include/bookstate.h \
-O "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/include/bookstate.h"
chmod a-w "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/include/bookstate.h"
chmod a-w "${HOME}/x-tools/arm-${1}-linux-gnueabi/arm-${1}-linux-gnueabi/sysroot/usr/include"

unset glibcxx_cv_utimensat
;;
pocketbookhf)
Build_CT-NG \
"$DEFAULT_GIT_REPO" \
"$DEFAULT_GIT_REV" \
"arm-${1}-linux-gnueabihf"
;;
bookeen)
Build_CT-NG \
https://github.com/NiLuJe/crosstool-ng.git \
62fb5946719c24dd38c1f41a35a7f8bdf35462d6 \
"$DEFAULT_GIT_REPO" \
"$DEFAULT_GIT_REV" \
"arm-${1}-linux-gnueabi"
;;
*)
Expand Down