[COPY] --- T2-COPYRIGHT-BEGIN --- [COPY] t2/package/*/dietlibc/dietlibc.desc [COPY] Copyright (C) 2004 - 2025 The T2 SDE Project [COPY] Copyright (C) 1998 - 2004 ROCK Linux Project [COPY] SPDX-License-Identifier: GPL-2.0 [COPY] --- T2-COPYRIGHT-END --- [I] A libc optimized for small size [T] The diet libc is a libc that is optimized for small size. It can be [T] used to create small statically linked binaries for Linux on alpha, [T] arm, hppa, mips, s390, sparc, ppc and i386. [U] https://www.fefe.de/dietlibc/ [A] Felix von Leitner [M] Rene Rebe [C] base/library [E] group libc [F] CROSS DIETLIBC LIBC NO-SSP NO-PIE NO-LTO.gcc [R] - avr32 blackfin cris m68k riscv riscv64 superh superh6 [K] + linux [L] GPL [S] Stable [V] 0.34 [P] O 01---5---9 102.000 [D] 81edc871f7f3ca9da4f418500117a19fb369311992087eb378b8fe3e dietlibc-0.34.tar.xz http://www.fefe.de/dietlibc/ #[D] X dietlibc-0.29-2004-12-18.tar.xz cvs://:pserver:cvs@cvs.fefe.de:/cvs dietlibc -D 2004-12-18 dietlibc_initial_fixup() { sed -i /WANT_SYSENTER/d dietfeatures.h case "$arch_machine" in powerpc) ln -vs bin-ppc bin-powerpc ;; powerpc64) ln -vs bin-ppc64 bin-powerpc64 ;; esac if atstage cross || [ "$toolsdir" == cross ]; then mkdir -p bin-$cpu bin-native ln -s bin-$cpu "bin-${CC%%-*}" fi } dietlibc_make_wrappers() { rm -rf $toolsbin; mkdir -p $toolsbin for x in gcc as ld ar ranlib nm; do # wrapper cat <<-EOT > $toolsbin/${arch_target}-$x #!/bin/sh exec $dietbin ${pkg_dietlibc_orig_target}-$x "\$@" EOT chmod +x $toolsbin/${arch_target}-$x done } dietlibc_install_toolscross() { local diet=bin-$1/diet cp -v $diet-i $toolsbin/diet [ ! -f $diet-dyn-i ] || cp -v $diet-dyn-i $toolsbin/diet-dyn } dietlibc_build_nativewrapper() { local DOPTCOMMON="-Os -DVERSION=\"$ver\" $dietfeatures" local DOPT="$DOPTCOMMON -DDIETHOME=\"$PWD\"" local DOPTI="$DOPTCOMMON -DDIETHOME=\"/$prefix\" -DINSTALLVERSION" patch -p1 < $confdir/hostlibc.diff $HOSTCC $DOPT diet.c -o bin-native/diet $HOSTCC $DOPT diet.c -o bin-native/diet-dyn -D__DYN_LIB $HOSTCC $DOPTI diet.c -o bin-native/diet-i $HOSTCC $DOPTI diet.c -o bin-native/diet-dyn-i -D__DYN_LIB patch -Rp1 < $confdir/hostlibc.diff } dietlibc_final_fixup() { for x in ppc ppc64 parisc; do local trg=${x/ppc/powerpc} trg=${x/parisc/hppa} if [ -d $root$libdir-$x ]; then rm -f $root$libdir-$trg ln -sfnv lib-$x $root$libdir-$trg fi done } prefix=usr/dietlibc set_confopt bindir=/usr/bin libdir=/$prefix/lib if [ "$SDECFG_LIBC" = "dietlibc" ]; then includedir=/usr/include fi var_append makeopt ' ' prefix=/$prefix var_append makeinstopt ' ' prefix=/$prefix var_append makeopt ' ' LIBDIR=$libdir var_append makeinstopt ' ' LIBDIR=$libdir var_append makeinstopt ' ' BINDIR=$bindir var_append makeinstopt ' ' MAN1DIR=$mandir/man1 cpu="`echo $arch | arch2uname | sed -e 's/sh.$/sh/; s/hppa/parisc/'`" hostcpu="native" # `/bin/uname -m | uname2arch | arch2uname`" var_append makeopt ' ' OBJDIR=bin-$cpu var_append makeinstopt ' ' OBJDIR=bin-$cpu var_append makeinstopt ' ' ILIBDIR=$libdir-$cpu [ "$SDECFG_X8664_X32" = 1 ] && cpu=x32 toolsbin=$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/diet-bin if [ "$SDECFG_DIETLIBC_DYN" = 1 ]; then case $cpu in arm|i386|x86_64) var_append makeopt ' ' dyn ;; esac fi # dietlibc contains non Thumb aware assembly ... var_remove GCC_WRAPPER_INSERT ' ' -mthumb # special features dietfeatures='-DWANT_MALLOC_ZERO' [[ $arch != hppa* ]] && var_append dietfeatures ' ' -DWANT_DYNAMIC [ "$SDECFG_DIETWANT_SYSENTER" = "1" ] && var_append dietfeatures ' ' -DWANT_SYSENTER var_append GCC_WRAPPER_APPEND ' ' $dietfeatures if atstage toolchain; then runmake=0 hook_add postmake 4 'mkdir -p $base/build/${SDECFG_ID}${includedir}/' hook_add postmake 4 'find . -name "*.orig" | xargs rm -vf' hook_add postmake 5 'cp -rv include/* $base/build/${SDECFG_ID}${includedir}/' else var_append makeopt ' ' all var_append makeinstopt ' ' -j1 hook_add postpatch 5 'dietlibc_initial_fixup' [ $toolsdir != cross ] || hook_add premake 5 'dietlibc_make_wrappers' if atstage cross || [ "$toolsdir" == cross ]; then # first build a native diet wrapper hook_add premake 7 "dietlibc_build_nativewrapper" hook_add premake 8 "dietlibc_install_toolscross native" # $hostcpu fi hook_add postmake 9 'dietlibc_final_fixup' dietarch=$cpu [[ $archprefix == mipsel* ]] && dietarch='mipsel' if atstage native; then # dietlibc uses uname - so we always need to set MYARCH var_append makeopt ' ' MYARCH=$dietarch var_append makeinstopt ' ' MYARCH=$dietarch else var_append makeopt ' ' "CROSS=$archprefix CC=cc" var_append makeopt ' ' MYARCH=$hostcpu var_append makeopt ' ' ARCH=$dietarch var_append makeinstopt ' ' MYARCH=$hostcpu var_append makeinstopt ' ' ARCH=$dietarch fi fi