fixing the build pipeline
This commit is contained in:
1 parent
c08668058e
commit
cd3a347823
5 files changed
+18
-149
No files matched your search
@@ -39,41 +39,13 @@ sdk_dir=$(find "$work_dir" -mindepth 1 -maxdepth 1 -type d -name 'openwrt-sdk-*'
|
||||
|
||||
cd "$sdk_dir"
|
||||
|
||||
# OpenWrt publishes relocatable SDKs whose host tools are x86-64 binaries.
|
||||
# On ARM runners, invoke the SDK's bundled x86-64 loader explicitly through
|
||||
# QEMU. This works without privileged binfmt_misc registration on the host.
|
||||
build_host=$(uname -m)
|
||||
case $build_host in
|
||||
# OpenWrt release SDK host tools are x86-64 binaries. Keep the runner
|
||||
# requirement explicit so an incompatible host fails with a useful error.
|
||||
case "$(uname -m)" in
|
||||
x86_64|amd64)
|
||||
;;
|
||||
aarch64|arm64|armv7l|armv8l)
|
||||
qemu_x86_64=$(command -v qemu-x86_64-static || command -v qemu-x86_64 || true)
|
||||
[[ -n $qemu_x86_64 ]] || {
|
||||
echo "ARM build host requires qemu-x86_64-static (install qemu-user-static)" >&2
|
||||
exit 1
|
||||
}
|
||||
mapfile -d '' sdk_wrappers < <(
|
||||
find staging_dir -type f -exec grep -IlZ 'ld-linux-x86-64\.so\.2' {} +
|
||||
)
|
||||
[[ ${#sdk_wrappers[@]} -gt 0 ]] || {
|
||||
echo "no relocatable x86-64 SDK wrappers found" >&2
|
||||
exit 1
|
||||
}
|
||||
sed -i -E \
|
||||
-e 's|^export LD_PRELOAD=.*(\$dir/.*runas\.so)"$|sdk_preload="${SDK_GUEST_LD_PRELOAD:+$SDK_GUEST_LD_PRELOAD:}\1"\nunset LD_PRELOAD SDK_GUEST_LD_PRELOAD|' \
|
||||
-e "s|^exec (\"\\\$dir/.*ld-linux-x86-64\\.so\\.2\")|exec ${qemu_x86_64} \\1 --preload \"\\\$sdk_preload\"|" \
|
||||
"${sdk_wrappers[@]}"
|
||||
|
||||
# fakeroot normally exports its x86-64 preload before invoking a wrapped
|
||||
# command. Carry it in a private variable so ARM-native env/bash never try
|
||||
# to load it; the wrapper above passes it directly to the guest loader.
|
||||
fakeroot_script=staging_dir/host/bin/fakeroot
|
||||
sed -i 's/LD_PRELOAD="$FAKEROOT_LIB"/SDK_GUEST_LD_PRELOAD="$FAKEROOT_LIB"/g' "$fakeroot_script"
|
||||
grep -q 'SDK_GUEST_LD_PRELOAD="$FAKEROOT_LIB"' "$fakeroot_script"
|
||||
staging_dir/host/bin/sed --version >/dev/null
|
||||
;;
|
||||
*)
|
||||
echo "unsupported build host architecture: $build_host" >&2
|
||||
echo "OpenWrt release builds require an x86-64 host" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -84,17 +56,6 @@ esac
|
||||
./scripts/feeds update base packages
|
||||
./scripts/feeds install mbedtls uci usteer
|
||||
|
||||
# openuf needs the mbedTLS libraries, not its optional example/utility
|
||||
# executables. Under x86 user emulation on ARM, linking those large programs is
|
||||
# unreliable and unnecessary, so keep the library build and omit the programs.
|
||||
mbedtls_makefile=feeds/base_root/package/libs/mbedtls/Makefile
|
||||
[[ -f $mbedtls_makefile ]] || {
|
||||
echo "mbedTLS feed Makefile not found: $mbedtls_makefile" >&2
|
||||
exit 1
|
||||
}
|
||||
sed -i 's/-DENABLE_PROGRAMS:Bool=ON/-DENABLE_PROGRAMS:Bool=OFF/' "$mbedtls_makefile"
|
||||
grep -q -- '-DENABLE_PROGRAMS:Bool=OFF' "$mbedtls_makefile"
|
||||
|
||||
mkdir -p package/openuf
|
||||
(cd "$repo_root" && tar --exclude=.git --exclude="$output_dir" -cf - .) | (cd package/openuf && tar -xf -)
|
||||
sed -i -E "s/^(PKG_VERSION[[:space:]]*:?=[[:space:]]*).*/\\1${version}/" package/openuf/Makefile
|
||||
@@ -115,18 +76,10 @@ printf '%s\n' \
|
||||
'CONFIG_PACKAGE_openuf=m' >.config
|
||||
make defconfig
|
||||
build_jobs=$(nproc)
|
||||
case $build_host in
|
||||
aarch64|arm64|armv7l|armv8l)
|
||||
(( build_jobs <= 2 )) || build_jobs=2
|
||||
make -j"$build_jobs" package/openuf/compile V=sc
|
||||
;;
|
||||
*)
|
||||
if ! make -j"$build_jobs" package/openuf/compile; then
|
||||
echo "parallel build failed; retrying serially with verbose diagnostics" >&2
|
||||
make -j1 package/openuf/compile V=sc
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if ! make -j"$build_jobs" package/openuf/compile; then
|
||||
echo "parallel build failed; retrying serially with verbose diagnostics" >&2
|
||||
make -j1 package/openuf/compile V=sc
|
||||
fi
|
||||
|
||||
mapfile -t packages < <(find bin/packages -type f -name "openuf-${version}-*.apk")
|
||||
if [[ ${#packages[@]} -ne 1 ]]; then
|
||||
|
||||
Reference in new issue
Block a user