Files
SimpleLinux/scripts/uclibc.sh
T
2026-02-26 13:40:18 +07:00

37 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
. ./scripts/colors.sh
. ./scripts/funcs.sh
. ./scripts/config.sh
#------------ glibc ----------------------------------------
uclibc() {
pkgname=uClibc-ng
pkgver=${UCLIBC_VERSION}
printf "$UGREEN** Building ${pkgname}\n$RESET"
[ -d $build/${pkgname} ] && return 0
mkdir -p $build/${pkgname} # &>> $fulllogfile
cd $build/${pkgname}
tar -xvf $root/downloads/${pkgname}-${pkgver}.tar.xz # &>> $fulllogfile
check $? "Extract ${pkgname}"
cd ${pkgname}-${pkgver}
cp -rv $UCLIBC_CONFIG_FILE .config
sed -i -e "s/KERNEL_HEADERS=/KERNEL_HEADERS=\"..\/..\/kernel-headers\/linux-$KERNEL_VERSION\/usr\/include\"/g" .config
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- oldconfig
check $? "Configure ${pkgname}"
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- $makeflags # &>> $fulllogfile
check $? "Build ${pkgname}"
sed -i 's/constexpr/is_constant/g' extra/scripts/unifdef.c
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- DESTDIR=$rootfspath install # &>> $fulllogfile
check $? "Install ${pkgname} to rootfs"
# cd $rootfspath
# find -name \*.a -delete # &>> $fulllogfile
# find -name \*.o -delete
# rm -v $rootfspath/usr/lib/libc.so
# ${CROSS_COMPILE}-strip --strip-unneeded $rootfspath/usr/lib/* $rootfspath/usr/bin/* # &>> $fulllogfile $rootfspath/usr/lib/*
# rm -rv $rootfspath/usr/include
# cd $root
check $? "Build and install ${pkgname}"
}
#-----------------------------------------------------------