SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "glibc"

# SliTaz package receipt.

PACKAGE="glibc"
VERSION="2.28"
CATEGORY="meta"
SHORT_DESC="The GNU C libraries. This package is used to compile the libc."
MAINTAINER="pankso@slitaz.org"
LICENSE="GPL2"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WEB_SITE="http://www.gnu.org/software/libc/"
WGET_URL="$GNU_MIRROR/$PACKAGE/$TARBALL"

DEPENDS="glibc-base glibc-locale glibc-dev"
BUILD_DEPENDS="linux-api-headers autoconf bash advancecomp"

# Genpkg order for tazwok.
COOK_OPT="genpkg=glibc-base:glib-locale:glibc-dev"

current_version()
{
    wget -O - $(dirname $WGET_URL) 2>/dev/null | \
    sed '/href="glibc-[0-9]/!d;/tar/!d;s|.*>glibc-||;s|.tar.*||' | \
    sort -Vr | sed q
}

# Rules to compile & install the temporary toolchain.
cook_tmp_toolchain()
{
    cd $src
    
    # Glibc Bug Fixes Patch from LFS
    patch -Np1 -i $stuff/glibc-2.14.1-fixes-1.patch
    # Glibc Bug Sort Relocatable Objects Patch
    patch -Np1 -i $stuff/glibc-2.14.1-sort-1.patch
    # Fix a bug that prevents Glibc from building with GCC-4.6.2
    patch -Np1 -i $stuff/glibc-2.14.1-gcc_fix-1.patch
    # GHOST
    patch -Np1 -i $stuff/glibc-2.14.1-CVE-2015-0235.patch

    # Build in a separate directory.
    mkdir ../glibc-build && cd ../glibc-build

    # glibc no longer support i386, so use -march=i486 for better compatibility.
    # If i686 ???
    unset CFLAGS CXXFLAGS
    case $ARCH in
        i386|i486)
            echo "CFLAGS += -O2 -march=i486 -mtune=i486" > configparms ;;
        *)
            echo "CFLAGS += -O2 -march=$ARCH -mtune=$ARCH" > configparms ;;
    esac

    { $src/configure \
        --host=$HOST_SYSTEM \
        --build=$($src/scripts/config.guess) \
        --disable-profile --enable-add-ons \
        --enable-kernel=2.6.30 --with-headers=/tools/include \
        libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes &&
    make -j1 &&
    make -j1 install
    } || return 1

    # Link compiler to this new glibc.
    SPECS=`dirname $($HOST_SYSTEM-gcc -print-libgcc-file-name)`/specs
    $HOST_SYSTEM-gcc -dumpspecs | sed \
        -e 's@/lib\(64\)\?/ld@/tools&@g' \
        -e "/^\*cpp:$/{n;s,$, -isystem /tools/include,}" > $SPECS 
    unset SPECS
}

# Rules to configure and make the package.
compile_rules()
{
    # SliTaz is a Busybox based OS, why we so small and fast. Using gawk by
    # default to build package will not ensure package work with Busybox awk
    # and so should NOT be use to cook.
    if [ -x /usr/bin/cook ]; then
        [ -d "/var/lib/tazpkg/installed/gawk" ] || tazpkg get-install gawk
    fi

    # Make 4.x support...
    sed -i 's/3\.79/4.* | &/' configure*
    # Fixes and patches from LFS, Redhat
    sed -i -e 's/"db1"/& \&\& $name ne "nss_test1"/' scripts/test-installation.pl
    sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in

        # Fix a bug that prevents Glibc from building with GCC-6.3.0
        # https://bugzilla.redhat.com/show_bug.cgi?id=1312963 (-Werror=parentheses)
        # https://sourceware.org/pipermail/libc-alpha/2015-April/059886.html (array-bounds)
        #patch -p1 -i $stuff/glibc-2.21-gcc6_fix-1.patch
        # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68024 (patch for style-definition)
        #patch -p1 -i $stuff/glibc-2.21-gcc6_fix-2.patch
        # https://gcc.gnu.org/legacy-ml/gcc-patches/2015-11/msg00105.html
        #patch -p1 -i $stuff/glibc-2.21-gcc6_fix-3.patch

        # Glibc misc Bug Fixes
        # fix for {linux,sys}/xattr.h incompatibility - commit fdbe8eae
        #patch -p1 -i $stuff/glibc-2.19-xattr_header.patch

        # fix issues in sin/cos slow path calculation - commit ffe768a9
        #patch -p1 -i $stuff/glibc-2.19-fix-sign-in-bsloww1-input.patch

        # fix tzselect with missing TZDIR - commit 893b4f37/c72399fb
        #patch -p1 -i $stuff/glibc-2.19-tzselect-default.patch

    # Glibc misc Bug Fixes
    #patch -Np1 -i $stuff/glibc-2.14.1-fixes-1.patch
    
    # Glibc Bug Sort Relocatable Objects Patch
    #patch -Np1 -i $stuff/glibc-2.14.1-sort-1.patch
    
    # Fix a bug that prevents Glibc from building with GCC-4.6.2
    #patch -Np1 -i $stuff/glibc-2.14.1-gcc_fix-1.patch
    
    # Revert commit causing issues with crappy DNS servers
    #patch -Np1 -i $stuff/glibc-2.14-revert-4768ae77.patch
    
    # re-export RPC interface until libtirpc is ready as a replacement
    # http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=acee4873 (only fedora branch...)
    #patch -Np1 -i $stuff/glibc-2.14-reexport-rpc-interface.patch
    # http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=bdd816a3 (only fedora branch...)
    #patch -Np1 -i $stuff/glibc-2.14-reinstall-nis-rpc-headers.patch
    # GHOST
    #patch -Np1 -i $stuff/glibc-2.14.1-CVE-2015-0235.patch

        # https://sourceware.org/bugzilla/show_bug.cgi?id=21661
        #patch -p1 -i $stuff/glibc-2.23-gcc.patch

    # Patch for reenable C.UTF8
    patch -p1 -i $stuff/glibc-c-utf8-locale.patch

    # Patch for CVE-2024-2961
    # see https://sourceware.org/git/?p=glibc.git;a=blob;f=advisories/GLIBC-SA-2024-0004;h=23a8115d;hb=HEAD
    # https://sourceware.org/git/?p=glibc.git;a=patch;h=682ad4c8 (adjust little for 2.28)
    patch -p1 < $stuff/glibc-2.28-CVE-2024-2961.patch

    # Update for binutils 2.29, see https://sourceware.org/bugzilla/show_bug.cgi?id=21661
    sed -i 's|obstack_compat;|obstack_compat  __attribute__ ((nocommon));|' malloc/obstack.c

        # Fix unused const variable
        sed -i 's|static const float one=1.0;|static const float __attribute__ ((unused)) one=1.0;|' \
        sysdeps/ieee754/flt-32/s_cosf.c 
        sed -i 's|static const char rcsid\[\] =|static const char __attribute__ ((unused)) rcsid\[\] =|' \
        resolv/base64.c

    # Fix a stack imbalance that occurs under some conditions:
    #sed -i '195,213 s/PRIVATE_FUTEX/FUTEX_CLOCK_REALTIME/' \
    #    nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S \
    #    nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S

    # Glibc needs ld.so.conf in the install destdir.
    mkdir -p $WOK/$PACKAGE/install/etc
    touch $WOK/$PACKAGE/install/etc/ld.so.conf
    mkdir ../glibc-build && cd ../glibc-build
    
    # Read the INSTALL file in glibc. Also Glibc dont build with -Os flag.
    # --enale-kernel use latest SliTaz Kernel version. From Glibc INSTALL:
    # "The higher the VERSION number is, the less compatibility code is
    # added, and the faster the code gets."
    unset CFLAGS CXXFLAGS
    case "$ARCH" in
        i386|i486)
            echo "CFLAGS += -O2 -march=i486 -mtune=i486" > configparms ;;
        *)
            echo "CFLAGS += -O2 -march=$ARCH -mtune=$ARCH" > configparms ;;
    esac
    { $src/configure \
        --disable-profile \
        --enable-add-ons \
        --enable-kernel=2.6.30 \
        --enable-obsolete-rpc \
        --libexecdir=/usr/lib/glibc \
        --build=$HOST_SYSTEM \
        --host=$HOST_SYSTEM \
        --target=$BUILD_SYSTEM &&
    make -j1 && make install_root=$DESTDIR install
    } || return 1
    for i in $DESTDIR/usr/share/i18n/charmaps/*.gz ; do
        advdef -z4 $i
    done

    # If temporary toolchain was previously used, switch to regular toolchain.
    [ -d /tools ] || return
    mv /tools/bin/ld /tools/bin/ld-old
    mv /tools/$(gcc -dumpmachine)/bin/ld /tools/$(gcc -dumpmachine)/bin/ld-old
    mv /tools/bin/ld-new /tools/bin/ld
    ln -s /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld
    gcc -dumpspecs | sed -e 's@/tools@@g' \
        -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \
        -e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' > \
        `dirname $(gcc --print-libgcc-file-name)`/specs
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    LOCALE=""
    mkdir -p $fs/var

    # Remove build directory.
    rm -rf $WOK/$PACKAGE/source/$PACKAGE-build
    rm -rf $WOK/$PACKAGE/$PACKAGE-build

    # check install
    ls $install/lib/
}
6025 packages and 203154 files in current database (Thu Apr 25 06:17:47 2024)