manylinux2014-aarch64: Install zlib in sysroot

This commit is contained in:
Mickaël Guérin 2023-01-30 08:26:57 +01:00
parent f152c4b25e
commit 787e0cbc41
5 changed files with 89 additions and 2 deletions

View File

@ -47,6 +47,7 @@ ENV XCC_PREFIX=/usr/xcc
# for users.
COPY \
imagefiles/install-crosstool-ng-toolchain.sh \
imagefiles/patch/crosstool-ng/crosstool-ng-zlib-target.patch \
manylinux2014-aarch64/crosstool-ng.config \
/dockcross/

View File

@ -38,6 +38,7 @@ ENV XCC_PREFIX=/usr/xcc
# for users.
COPY \
imagefiles/install-crosstool-ng-toolchain.sh \
imagefiles/patch/crosstool-ng/crosstool-ng-zlib-target.patch \
crosstool-ng.config \
/dockcross/

View File

@ -75,6 +75,13 @@ git fetch --tags
# checkout
git checkout ${REV}
if [ ${REV} = "crosstool-ng-1.25.0" ]; then
patch scripts/build/companion_libs/050-zlib.sh -i /dockcross/crosstool-ng-zlib-target.patch
# Clean patch
rm /dockcross/crosstool-ng-zlib-target.patch
fi
# Bootstrap and install the tool.
BOOTSTRAP_PREFIX="${CTNG}/prefix"
./bootstrap

View File

@ -0,0 +1,77 @@
--- a/scripts/build/companion_libs/050-zlib.sh
+++ b/scripts/build/companion_libs/050-zlib.sh
@@ -9,7 +9,7 @@ do_zlib_for_host() { :; }
do_zlib_for_target() { :; }
# Overide functions depending on configuration
-if [ "${CT_ZLIB}" = "y" ]; then
+if [ "${CT_ZLIB}" = "y" -o "${CT_ZLIB_TARGET}" = "y" ]; then
# Download zlib
do_zlib_get() {
@@ -21,6 +21,8 @@ do_zlib_extract() {
CT_ExtractPatch ZLIB
}
+if [ "${CT_ZLIB}" = "y" ]; then
+
# Build zlib for running on build
# - always build statically
# - install in build-tools prefix
@@ -61,6 +63,38 @@ do_zlib_for_host() {
CT_EndStep
}
+fi # CT_ZLIB
+
+if [ "${CT_ZLIB_TARGET}" = "y" ]; then
+
+do_zlib_for_target() {
+ local -a zlib_opts
+ local prefix
+
+ CT_DoStep INFO "Installing zlib for the target"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-zlib-target-${CT_TARGET}"
+
+ case "${CT_TARGET}" in
+ *-*-mingw*)
+ prefix="/mingw"
+ ;;
+ *)
+ prefix="/usr"
+ ;;
+ esac
+
+ zlib_opts+=( "host=${CT_TARGET}" )
+ zlib_opts+=( "prefix=${prefix}" )
+ zlib_opts+=( "destdir=${CT_SYSROOT_DIR}" )
+ zlib_opts+=( "cflags=${CT_ALL_TARGET_CFLAGS}" )
+ do_zlib_backend "${zlib_opts[@]}"
+
+ CT_Popd
+ CT_EndStep
+}
+
+fi # CT_ZLIB_TARGET
+
# Build zlib
# Parameter : description : type : default
# host : machine to run on : tuple : (none)
@@ -72,6 +106,7 @@ do_zlib_backend() {
local prefix
local cflags
local ldflags
+ local destdir
local arg
local -a extra_config
local -a extra_make
@@ -126,7 +161,7 @@ do_zlib_backend() {
fi
CT_DoLog EXTRA "Installing zlib"
- CT_DoExecLog ALL make "${extra_make[@]}" install
+ CT_DoExecLog ALL make "${extra_make[@]}" install DESTDIR="${destdir}"
}
-fi # CT_ZLIB
+fi # CT_ZLIB || CT_ZLIB_TARGET

View File

@ -541,7 +541,7 @@ CT_CC_GCC_ENABLE_CXX_FLAGS="-I/usr/include -fpermissive"
CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY=""
CT_CC_GCC_EXTRA_CONFIG_ARRAY=""
CT_CC_GCC_STATIC_LIBSTDCXX=y
# CT_CC_GCC_SYSTEM_ZLIB is not set
CT_CC_GCC_SYSTEM_ZLIB=y
CT_CC_GCC_CONFIG_TLS=m
#
@ -789,6 +789,7 @@ CT_NCURSES_TARGET_CONFIG_ARGS=""
CT_NCURSES_TARGET_FALLBACKS=""
CT_COMP_LIBS_ZLIB=y
CT_COMP_LIBS_ZLIB_PKG_KSYM="ZLIB"
CT_ZLIB_TARGET=y
CT_ZLIB_DIR_NAME="zlib"
CT_ZLIB_PKG_NAME="zlib"
CT_ZLIB_SRC_RELEASE=y
@ -796,7 +797,7 @@ CT_ZLIB_SRC_RELEASE=y
CT_ZLIB_PATCH_ORDER="global"
CT_ZLIB_V_1_2_12=y
CT_ZLIB_VERSION="1.2.13"
CT_ZLIB_MIRRORS="http://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION} https://www.zlib.net/"
CT_ZLIB_MIRRORS="https://github.com/madler/zlib/releases/download/v${CT_ZLIB_VERSION} https://www.zlib.net/ https://www.zlib.net/fossils"
CT_ZLIB_ARCHIVE_FILENAME="@{pkg_name}-@{version}"
CT_ZLIB_ARCHIVE_DIRNAME="@{pkg_name}-@{version}"
CT_ZLIB_ARCHIVE_FORMATS=".tar.xz .tar.gz"