distribution/packages/devel/glibc/package.mk

170 lines
5.5 KiB
Makefile
Raw Normal View History

2022-02-05 14:23:32 +00:00
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="glibc"
2023-02-13 22:43:44 +00:00
PKG_VERSION="2.37"
2022-02-05 14:23:32 +00:00
PKG_LICENSE="GPL"
2022-07-02 11:20:10 +00:00
PKG_SITE="https://www.gnu.org/software/libc/"
PKG_URL="https://ftp.gnu.org/pub/gnu/glibc/${PKG_NAME}-${PKG_VERSION}.tar.xz"
2022-02-05 14:23:32 +00:00
PKG_DEPENDS_TARGET="ccache:host autotools:host linux:host gcc:bootstrap pigz:host Python3:host"
PKG_DEPENDS_INIT="glibc"
PKG_LONGDESC="The Glibc package contains the main C library."
PKG_BUILD_FLAGS="+bfd -gold"
2022-02-05 14:23:32 +00:00
2022-09-18 14:48:56 +00:00
case "${DEVICE}" in
RK3566)
2023-02-13 22:43:44 +00:00
OPT_ENABLE_KERNEL=4.4.0
;;
2023-01-08 22:49:32 +00:00
RK3588)
OPT_ENABLE_KERNEL=5.10.0
2023-02-13 22:43:44 +00:00
;;
*)
2023-02-13 22:43:44 +00:00
OPT_ENABLE_KERNEL=6.1.0
;;
2022-07-02 11:20:10 +00:00
esac
2022-02-05 14:23:32 +00:00
PKG_CONFIGURE_OPTS_TARGET="BASH_SHELL=/bin/sh \
ac_cv_path_PERL=no \
ac_cv_prog_MAKEINFO= \
--libexecdir=/usr/lib/glibc \
--cache-file=config.cache \
--disable-profile \
--disable-sanity-checks \
--enable-add-ons \
--enable-bind-now \
--with-elf \
--with-tls \
--with-__thread \
--with-binutils=${BUILD}/toolchain/bin \
--with-headers=${SYSROOT_PREFIX}/usr/include \
--enable-kernel=${OPT_ENABLE_KERNEL} \
2022-02-05 14:23:32 +00:00
--without-cvs \
--without-gd \
--disable-build-nscd \
--disable-nscd \
--disable-timezone-tools"
if build_with_debug; then
PKG_CONFIGURE_OPTS_TARGET+=" --enable-debug"
else
PKG_CONFIGURE_OPTS_TARGET+=" --disable-debug"
fi
post_unpack() {
find "${PKG_BUILD}" -type f -name '*.py' -exec sed -e '1s,^#![[:space:]]*/usr/bin/python.*,#!/usr/bin/env python3,' -i {} \;
}
pre_configure_target() {
# Filter out some problematic *FLAGS
export CFLAGS=$(echo ${CFLAGS} | sed -e "s|-ffast-math||g")
2023-02-21 12:20:13 +00:00
export CFLAGS=$(echo ${CFLAGS} | sed -e "s|-Ofast|-O3|g")
export CFLAGS=$(echo ${CFLAGS} | sed -e "s|-O.|-O3|g")
2022-02-05 14:23:32 +00:00
2022-07-02 11:20:10 +00:00
export CFLAGS=$(echo ${CFLAGS} | sed -e "s|-Wunused-but-set-variable||g")
export CFLAGS="${CFLAGS} -Wno-unused-variable"
2022-02-05 14:23:32 +00:00
if [ -n "${PROJECT_CFLAGS}" ]; then
export CFLAGS=$(echo ${CFLAGS} | sed -e "s|${PROJECT_CFLAGS}||g")
fi
export LDFLAGS=$(echo ${LDFLAGS} | sed -e "s|-ffast-math||g")
2023-02-21 12:20:13 +00:00
export LDFLAGS=$(echo ${LDFLAGS} | sed -e "s|-Ofast|-O3|g")
export LDFLAGS=$(echo ${LDFLAGS} | sed -e "s|-O.|-O3|g")
2022-02-05 14:23:32 +00:00
export LDFLAGS=$(echo ${LDFLAGS} | sed -e "s|-Wl,--as-needed||")
unset LD_LIBRARY_PATH
# set some CFLAGS we need
export CFLAGS="${CFLAGS} -g -fno-stack-protector"
export BUILD_CC=${HOST_CC}
export OBJDUMP_FOR_HOST=objdump
cat >config.cache <<EOF
libc_cv_forced_unwind=yes
libc_cv_c_cleanup=yes
libc_cv_ssp=no
libc_cv_ssp_strong=no
libc_cv_slibdir=/usr/lib
EOF
cat >configparms <<EOF
libdir=/usr/lib
slibdir=/usr/lib
sbindir=/usr/bin
rootsbindir=/usr/bin
build-programs=yes
EOF
# binaries to install into target
GLIBC_INCLUDE_BIN="getent ldd locale localedef"
# glibc does not need / nor build successfully with _FILE_OFFSET_BITS or _TIME_BITS set
case ${ARCH} in
arm|aarch64)
export CFLAGS=$(echo ${CFLAGS} | sed -e "s|-D_FILE_OFFSET_BITS=64||g")
export CFLAGS=$(echo ${CFLAGS} | sed -e "s|-D_TIME_BITS=64||g")
export CXXFLAGS=$(echo ${CXXFLAGS} | sed -e "s|-D_FILE_OFFSET_BITS=64||g")
export CXXFLAGS=$(echo ${CXXFLAGS} | sed -e "s|-D_TIME_BITS=64||g")
;;
esac
2022-02-05 14:23:32 +00:00
}
post_makeinstall_target() {
2022-07-02 11:20:10 +00:00
mkdir -p ${INSTALL}/.noinstall
cp -p ${INSTALL}/usr/bin/localedef ${INSTALL}/.noinstall
cp -a ${INSTALL}/usr/share/i18n/locales ${INSTALL}/.noinstall
mv ${INSTALL}/usr/share/i18n/charmaps ${INSTALL}/.noinstall
2022-02-05 14:23:32 +00:00
safe_remove ${INSTALL}/usr/lib/audit
safe_remove ${INSTALL}/usr/lib/glibc
safe_remove ${INSTALL}/usr/lib/*.o
safe_remove ${INSTALL}/var
2022-07-02 11:20:10 +00:00
# add UTF-8 charmap
mkdir -p ${INSTALL}/usr/share/i18n/charmaps
cp -PR ${INSTALL}/.noinstall/charmaps/UTF-8.gz ${INSTALL}/usr/share/i18n/charmaps
2022-02-05 14:23:32 +00:00
if [ ! "${GLIBC_LOCALES}" = yes ]; then
safe_remove ${INSTALL}/usr/share/i18n/locales
mkdir -p ${INSTALL}/usr/share/i18n/locales
cp -PR ${PKG_BUILD}/localedata/locales/POSIX ${INSTALL}/usr/share/i18n/locales
fi
# create default configs
mkdir -p ${INSTALL}/etc
cp ${PKG_DIR}/config/nsswitch-target.conf ${INSTALL}/etc/nsswitch.conf
cp ${PKG_DIR}/config/host.conf ${INSTALL}/etc
cp ${PKG_DIR}/config/gai.conf ${INSTALL}/etc
cp ${PKG_DIR}/config/ld.so.conf ${INSTALL}/etc
2022-02-05 14:23:32 +00:00
}
configure_init() {
cd ${PKG_BUILD}
rm -rf ${PKG_BUILD}/.${TARGET_NAME}-init
}
make_init() {
: # reuse make_target()
}
makeinstall_init() {
mkdir -p ${INSTALL}/usr/lib
cp -PR ${PKG_BUILD}/.${TARGET_NAME}/elf/ld*.so* ${INSTALL}/usr/lib
cp -PR ${PKG_BUILD}/.${TARGET_NAME}/libc.so* ${INSTALL}/usr/lib
cp -PR ${PKG_BUILD}/.${TARGET_NAME}/math/libm.so* ${INSTALL}/usr/lib
cp -PR ${PKG_BUILD}/.${TARGET_NAME}/nptl/libpthread.so* ${INSTALL}/usr/lib
cp -PR ${PKG_BUILD}/.${TARGET_NAME}/rt/librt.so* ${INSTALL}/usr/lib
cp -PR ${PKG_BUILD}/.${TARGET_NAME}/resolv/libnss_dns.so* ${INSTALL}/usr/lib
cp -PR ${PKG_BUILD}/.${TARGET_NAME}/resolv/libresolv.so* ${INSTALL}/usr/lib
}
post_makeinstall_init() {
# create default configs
mkdir -p ${INSTALL}/etc
cp ${PKG_DIR}/config/nsswitch-init.conf ${INSTALL}/etc/nsswitch.conf
}