mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-02-20 17:12:55 +00:00
Add zlib as a companion lib
with version 1.2.11. Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
parent
10db7887ce
commit
d91277e377
@ -2,6 +2,10 @@
|
||||
|
||||
if ARCH_BINFMT_FLAT
|
||||
|
||||
config ELF2FLT_REQUIRES_ZLIB
|
||||
def_bool y
|
||||
select ZLIB
|
||||
|
||||
comment "elf2flt"
|
||||
|
||||
choice
|
||||
|
@ -81,6 +81,9 @@ config CC_GCC_SYSTEM_ZLIB
|
||||
help
|
||||
Do not use bundled zlib, and use the zlib already available for
|
||||
the host (eg. the system library).
|
||||
|
||||
If zlib is built as a companion library, selecting this option
|
||||
will use it.
|
||||
|
||||
If you want to build a static toolchain, you will need to also
|
||||
install the static version of zlib for your host.
|
||||
|
@ -119,6 +119,12 @@ config NCURSES
|
||||
config NCURSES_TARGET
|
||||
bool
|
||||
|
||||
config ZLIB
|
||||
bool "Build local zlib"
|
||||
|
||||
if ZLIB
|
||||
source "config/companion_libs/zlib.in"
|
||||
endif
|
||||
if LIBICONV
|
||||
source "config/companion_libs/libiconv.in"
|
||||
endif
|
||||
|
19
config/companion_libs/zlib.in
Normal file
19
config/companion_libs/zlib.in
Normal file
@ -0,0 +1,19 @@
|
||||
# Zlib options
|
||||
|
||||
choice
|
||||
bool
|
||||
prompt "zlib version"
|
||||
# Don't remove next line
|
||||
# CT_INSERT_VERSION_BELOW
|
||||
|
||||
config ZLIB_V_1_2_11
|
||||
bool
|
||||
prompt "1.2.11"
|
||||
|
||||
endchoice
|
||||
|
||||
config ZLIB_VERSION
|
||||
string
|
||||
# Don't remove next line
|
||||
# CT_INSERT_VERSION_STRING_BELOW
|
||||
default "1.2.11" if ZLIB_V_1_2_11
|
@ -18,7 +18,7 @@ doHelp() {
|
||||
'tool' in one of:
|
||||
gcc, binutils, glibc, uClibc, uClibc-ng, newlib, linux, gdb,
|
||||
duma, strace, ltrace, libelf, gmp, mpfr, isl, cloog, mpc,
|
||||
mingw-w64, expat, ncurses, musl, gettext
|
||||
mingw-w64, expat, ncurses, musl, gettext, zlib
|
||||
|
||||
Valid options for all tools:
|
||||
--stable, -s, +x (default)
|
||||
@ -210,6 +210,7 @@ while [ $# -gt 0 ]; do
|
||||
--expat) EXP=; OBS=; cat=EXPAT; tool=expat; tool_prefix=companion_libs; dot2suffix=;;
|
||||
--ncurses) EXP=; OBS=; cat=NCURSES; tool=ncurses; tool_prefix=companion_libs; dot2suffix=;;
|
||||
--gettext) EXP=; OBS=; cat=GETTEXT; tool=gettext; tool_prefix=companion_libs; dot2suffix=;;
|
||||
--zlib) EXP=; OBS=; cat=ZLIB; tool=zlib; tool_prefix=companion_tools; dot2suffix=;;
|
||||
--make) EXP=; OBS=; cat=MAKE; tool=make; tool_prefix=companion_tools; dot2suffix=;;
|
||||
--m4) EXP=; OBS=; cat=M4; tool=m4; tool_prefix=companion_tools; dot2suffix=;;
|
||||
--autoconf) EXP=; OBS=; cat=AUTOCONF; tool=autoconf; tool_prefix=companion_tools; dot2suffix=;;
|
||||
|
108
scripts/build/companion_libs/050-zlib.sh
Normal file
108
scripts/build/companion_libs/050-zlib.sh
Normal file
@ -0,0 +1,108 @@
|
||||
# This file adds the functions to build the zlib library
|
||||
# Copyright 2017 Alexey Neyman
|
||||
# Licensed under the GPL v2. See COPYING in the root of this package
|
||||
|
||||
do_zlib_get() { :; }
|
||||
do_zlib_extract() { :; }
|
||||
do_zlib_for_build() { :; }
|
||||
do_zlib_for_host() { :; }
|
||||
do_zlib_for_target() { :; }
|
||||
|
||||
# Overide functions depending on configuration
|
||||
if [ "${CT_ZLIB}" = "y" ]; then
|
||||
|
||||
# Download zlib
|
||||
do_zlib_get() {
|
||||
CT_GetFile "zlib-${CT_ZLIB_VERSION}" \
|
||||
"http://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}"
|
||||
}
|
||||
|
||||
# Extract zlib
|
||||
do_zlib_extract() {
|
||||
CT_Extract "zlib-${CT_ZLIB_VERSION}"
|
||||
CT_Patch "zlib" "${CT_ZLIB_VERSION}"
|
||||
}
|
||||
|
||||
# Build zlib for running on build
|
||||
# - always build statically
|
||||
# - install in build-tools prefix
|
||||
do_zlib_for_build() {
|
||||
local -a zlib_opts
|
||||
|
||||
case "${CT_TOOLCHAIN_TYPE}" in
|
||||
native|cross) return 0;;
|
||||
esac
|
||||
|
||||
CT_DoStep INFO "Installing zlib for build"
|
||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-zlib-build-${CT_BUILD}"
|
||||
|
||||
zlib_opts+=( "host=${CT_BUILD}" )
|
||||
zlib_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
|
||||
zlib_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
|
||||
zlib_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
|
||||
do_zlib_backend "${zlib_opts[@]}"
|
||||
|
||||
CT_Popd
|
||||
CT_EndStep
|
||||
}
|
||||
|
||||
# Build zlib for running on host
|
||||
do_zlib_for_host() {
|
||||
local -a zlib_opts
|
||||
|
||||
CT_DoStep INFO "Installing zlib for host"
|
||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-zlib-host-${CT_HOST}"
|
||||
|
||||
zlib_opts+=( "host=${CT_HOST}" )
|
||||
zlib_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
|
||||
zlib_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
|
||||
zlib_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
|
||||
do_zlib_backend "${zlib_opts[@]}"
|
||||
|
||||
CT_Popd
|
||||
CT_EndStep
|
||||
}
|
||||
|
||||
# Build zlib
|
||||
# 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_zlib_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 "Configuring zlib"
|
||||
|
||||
CT_DoExecLog CFG \
|
||||
CFLAGS="${cflags}" \
|
||||
LDFLAGS="${ldflags}" \
|
||||
CROSS_PREFIX="${host}-" \
|
||||
${CONFIG_SHELL} \
|
||||
"${CT_SRC_DIR}/zlib-${CT_ZLIB_VERSION}/configure" \
|
||||
--prefix="${prefix}" \
|
||||
--static \
|
||||
"${extra_config[@]}"
|
||||
|
||||
CT_DoLog EXTRA "Building zlib"
|
||||
CT_DoExecLog ALL make ${JOBSFLAGS}
|
||||
|
||||
if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
|
||||
CT_DoLog EXTRA "Checking zlib"
|
||||
CT_DoExecLog ALL make ${JOBSFLAGS} -s check
|
||||
fi
|
||||
|
||||
CT_DoLog EXTRA "Installing zlib"
|
||||
CT_DoExecLog ALL make install
|
||||
}
|
||||
|
||||
fi # CT_ZLIB
|
@ -26,7 +26,6 @@ do_gmp_extract() {
|
||||
|
||||
# Build GMP for running on build
|
||||
# - always build statically
|
||||
# - we do not have build-specific CFLAGS
|
||||
# - install in build-tools prefix
|
||||
do_gmp_for_build() {
|
||||
local -a gmp_opts
|
||||
@ -101,7 +100,7 @@ do_gmp_backend() {
|
||||
--enable-cxx \
|
||||
--disable-shared \
|
||||
--enable-static \
|
||||
"${extra_config}"
|
||||
"${extra_config[@]}"
|
||||
|
||||
CT_DoLog EXTRA "Building GMP"
|
||||
CT_DoExecLog ALL make ${JOBSFLAGS}
|
||||
|
@ -68,7 +68,6 @@ do_mpfr_extract() {
|
||||
|
||||
# Build MPFR for running on build
|
||||
# - always build statically
|
||||
# - we do not have build-specific CFLAGS
|
||||
# - install in build-tools prefix
|
||||
do_mpfr_for_build() {
|
||||
local -a mpfr_opts
|
||||
|
@ -25,7 +25,6 @@ do_isl_extract() {
|
||||
|
||||
# Build ISL for running on build
|
||||
# - always build statically
|
||||
# - we do not have build-specific CFLAGS
|
||||
# - install in build-tools prefix
|
||||
do_isl_for_build() {
|
||||
local -a isl_opts
|
||||
|
@ -29,7 +29,6 @@ do_cloog_extract() {
|
||||
|
||||
# Build CLooG for running on build
|
||||
# - always build statically
|
||||
# - we do not have build-specific CFLAGS
|
||||
# - install in build-tools prefix
|
||||
do_cloog_for_build() {
|
||||
local -a cloog_opts
|
||||
|
@ -26,7 +26,6 @@ do_mpc_extract() {
|
||||
|
||||
# Build MPC for running on build
|
||||
# - always build statically
|
||||
# - we do not have build-specific CFLAGS
|
||||
# - install in build-tools prefix
|
||||
do_mpc_for_build() {
|
||||
local -a mpc_opts
|
||||
|
@ -24,7 +24,6 @@ if [ "${CT_LIBELF}" = "y" ]; then
|
||||
|
||||
# Build libelf for running on build
|
||||
# - always build statically
|
||||
# - we do not have build-specific CFLAGS
|
||||
# - install in build-tools prefix
|
||||
do_libelf_for_build() {
|
||||
local -a libelf_opts
|
||||
|
@ -128,7 +128,7 @@ gen_menu() {
|
||||
shift 4
|
||||
local file entry _entry
|
||||
|
||||
# GEnerate the menuconfig
|
||||
# Generate the menuconfig
|
||||
exec >"${out_file}"
|
||||
printf '# %s menu\n' "${label}"
|
||||
printf '# Generated file, do not edit!!!\n'
|
||||
|
Loading…
x
Reference in New Issue
Block a user