mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-03-13 15:56:31 +00:00
Add zstd to the companion libs
Add zstd to the companion libs witch allows to use lto zstd compression in a canadian or cross-native enviroment Signed-off-by: QBos07 <62326551+QBos07@users.noreply.github.com> Signed-off-by: Quentin Boswank <62326551+QBos07@users.noreply.github.com>
This commit is contained in:
parent
0ce5b27385
commit
4cba299460
@ -180,9 +180,10 @@ config CC_GCC_USE_LTO
|
||||
config CC_GCC_LTO_ZSTD
|
||||
tristate
|
||||
prompt "Support LTO compression with zstd"
|
||||
default m if !CANADIAN && !STATIC_TOOLCHAIN
|
||||
default m
|
||||
depends on CC_GCC_USE_LTO
|
||||
depends on GCC_10_or_later
|
||||
select ZSTD_NEEDED
|
||||
help
|
||||
Support zstd compression for LTO object files. This will require
|
||||
libzstd to be installed when using the toolchain
|
||||
|
@ -105,6 +105,11 @@ config ZLIB_NEEDED
|
||||
bool "Build local zlib"
|
||||
select COMP_LIBS_ZLIB
|
||||
|
||||
config ZSTD_NEEDED
|
||||
bool "Build local zstd"
|
||||
default y if CANADIAN || CROSS_NATIVE
|
||||
select COMP_LIBS_ZSTD
|
||||
|
||||
# FIXME remove these legacy knobs
|
||||
config LIBICONV
|
||||
def_bool y
|
||||
@ -150,4 +155,8 @@ config ZLIB
|
||||
def_bool y
|
||||
depends on ZLIB_NEEDED
|
||||
|
||||
config ZSTD
|
||||
def_bool y
|
||||
depends on ZSTD_NEEDED
|
||||
|
||||
endmenu
|
||||
|
1
config/comp_libs/zstd.in
Normal file
1
config/comp_libs/zstd.in
Normal file
@ -0,0 +1 @@
|
||||
# Zstd options
|
4
packages/zstd/1.5.2/chksum
vendored
Normal file
4
packages/zstd/1.5.2/chksum
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
md5 zlib-1.5.2.tar.gz 072b10f71f5820c24761a65f31f43e73
|
||||
sha1 zlib-1.5.2.tar.gz c56c8e6d703d14029464b2a1a66164dc5cf80855
|
||||
sha256 zlib-1.5.2.tar.gz 7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0
|
||||
sha512 zlib-1.5.2.tar.gz 96dbd2eb6623e3564a0fd36489b61bc3cb27758a584fdc9f064f3985d2e8b5605d7022890d00a6d15464d3cd0707d7e75d8cf6210323782d0af406b90a6d6784
|
1
packages/zstd/1.5.2/version.desc
vendored
Normal file
1
packages/zstd/1.5.2/version.desc
vendored
Normal file
@ -0,0 +1 @@
|
||||
|
4
packages/zstd/package.desc
Normal file
4
packages/zstd/package.desc
Normal file
@ -0,0 +1,4 @@
|
||||
repository='git https://github.com/facebook/zstd.git'
|
||||
mirrors='https://github.com/facebook/zstd/releases/download/v${CT_ZSTD_VERSION} https://www.zstd.net/'
|
||||
archive_formats='.tar.gz'
|
||||
signature_format='packed/.sig'
|
@ -1087,7 +1087,7 @@ do_gcc_backend() {
|
||||
extra_config+=("--disable-lto")
|
||||
fi
|
||||
case "${CT_CC_GCC_LTO_ZSTD}" in
|
||||
y) extra_config+=("--with-zstd");;
|
||||
y) extra_config+=("--with-zstd=${complibs}");;
|
||||
m) ;;
|
||||
*) extra_config+=("--without-zstd");;
|
||||
esac
|
||||
|
102
scripts/build/companion_libs/070-zstd.sh
Normal file
102
scripts/build/companion_libs/070-zstd.sh
Normal file
@ -0,0 +1,102 @@
|
||||
# This file adds the functions to build the zstd library
|
||||
# Copyright 2023 Q. BOSWANK
|
||||
# Licensed under the GPL v2. See COPYING in the root of this package
|
||||
|
||||
do_zstd_get() { :; }
|
||||
do_zstd_extract() { :; }
|
||||
do_zstd_for_build() { :; }
|
||||
do_zstd_for_host() { :; }
|
||||
do_zstd_for_target() { :; }
|
||||
|
||||
# Overide functions depending on configuration
|
||||
if [ "${CT_ZSTD}" = "y" ]; then
|
||||
|
||||
# Download zstd
|
||||
do_zstd_get() {
|
||||
CT_Fetch ZSTD
|
||||
}
|
||||
|
||||
# Extract zstd
|
||||
do_zstd_extract() {
|
||||
CT_ExtractPatch ZSTD
|
||||
}
|
||||
|
||||
# Build zstd for running on build
|
||||
# - always build statically
|
||||
# - install in build-tools prefix
|
||||
do_zstd_for_build() {
|
||||
local -a zstd_opts
|
||||
|
||||
case "${CT_TOOLCHAIN_TYPE}" in
|
||||
native|cross) return 0;;
|
||||
esac
|
||||
|
||||
CT_DoStep INFO "Installing zstd for build"
|
||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-zstd-build-${CT_BUILD}"
|
||||
|
||||
zstd_opts+=( "host=${CT_BUILD}" )
|
||||
zstd_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
|
||||
zstd_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
|
||||
zstd_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
|
||||
|
||||
do_zstd_backend "${zstd_opts[@]}"
|
||||
|
||||
CT_Popd
|
||||
CT_EndStep
|
||||
}
|
||||
|
||||
# Build ZSTD zstd running on host
|
||||
do_zstd_for_host() {
|
||||
local -a zstd_opts
|
||||
|
||||
CT_DoStep INFO "Installing zstd for host"
|
||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-zstd-host-${CT_HOST}"
|
||||
|
||||
zstd_opts+=( "host=${CT_HOST}" )
|
||||
zstd_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
|
||||
zstd_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
|
||||
zstd_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
|
||||
do_zstd_backend "${zstd_opts[@]}"
|
||||
|
||||
CT_Popd
|
||||
CT_EndStep
|
||||
}
|
||||
|
||||
# Build zstd
|
||||
# Parameter : description : type : default
|
||||
# host : machine to run on : tuple : (none)
|
||||
# prefix : prefix to install into : dir : (none)
|
||||
# cflags : cflags to use : string : (empty)
|
||||
# ldflags : ldflags to use : string : (empty)
|
||||
do_zstd_backend() {
|
||||
local host
|
||||
local prefix
|
||||
local cflags
|
||||
local ldflags
|
||||
local arg
|
||||
local -a extra_config
|
||||
|
||||
for arg in "$@"; do
|
||||
eval "${arg// /\\ }"
|
||||
done
|
||||
|
||||
CT_DoLog EXTRA "Building zstd"
|
||||
CT_DoExecLog ALL make ${CT_JOBSFLAGS} -C "${CT_SRC_DIR}/zstd/lib" libzstd.a BUILD_DIR="${PWD}" CC="${host}-gcc" AS="${host}-as" CFLAGS="${cflags}" LDFLAGS="${ldflags}"
|
||||
|
||||
# TODO: Has to be tested
|
||||
|
||||
#if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
|
||||
# if [ "${host}" = "${CT_BUILD}" ]; then
|
||||
# CT_DoLog EXTRA "Checking zstd"
|
||||
# CT_DoExecLog ALL make ${CT_JOBSFLAGS} -s check
|
||||
# else
|
||||
# # Cannot run host binaries on build in a canadian cross
|
||||
# CT_DoLog EXTRA "Skipping check for zstd on the host"
|
||||
# fi
|
||||
#fi
|
||||
|
||||
CT_DoLog EXTRA "Installing zstd"
|
||||
CT_DoExecLog ALL make -C "${CT_SRC_DIR}/zstd/lib" install-static install-includes BUILD_DIR="${PWD}" PREFIX="$prefix"
|
||||
}
|
||||
|
||||
fi # CT_ZSTD
|
Loading…
x
Reference in New Issue
Block a user