From 654ee2ba322afa83abbd489a33190923a64f2e96 Mon Sep 17 00:00:00 2001 From: CapCreeperGR Date: Thu, 4 Jul 2024 16:12:31 +0300 Subject: [PATCH] Initial Commit --- pkg.info | 7 ++++++ source-files/locale-gen | 42 +++++++++++++++++++++++++++++++ source.sh | 56 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 pkg.info create mode 100644 source-files/locale-gen create mode 100644 source.sh diff --git a/pkg.info b/pkg.info new file mode 100644 index 0000000..a181ede --- /dev/null +++ b/pkg.info @@ -0,0 +1,7 @@ +name: glibc +description: The GNU C Library +version: 2.39 +url: https://www.gnu.org/software/libc/ +license: GPL2-or-later +architecture: any +type: source diff --git a/source-files/locale-gen b/source-files/locale-gen new file mode 100644 index 0000000..ee88880 --- /dev/null +++ b/source-files/locale-gen @@ -0,0 +1,42 @@ +#!/bin/sh + +set -e + +LOCALEGEN=/etc/locale.gen +LOCALES=/usr/share/i18n/locales +if [ -n "$POSIXLY_CORRECT" ]; then + unset POSIXLY_CORRECT +fi + + +[ -f $LOCALEGEN -a -s $LOCALEGEN ] || exit 0; + +# Remove all old locale dir and locale-archive before generating new +# locale data. +rm -rf /usr/lib/locale/locale-archive || true + +umask 022 + +is_entry_ok() { + if [ -n "$locale" -a -n "$charset" ] ; then + true + else + echo "error: Bad entry '$locale $charset'" + false + fi +} + +echo "Generating locales..." +while read locale charset; do \ + case $locale in \#*) continue;; "") continue;; esac; \ + is_entry_ok || continue + echo -n " `echo $locale | sed 's/\([^.\@]*\).*/\1/'`"; \ + echo -n ".$charset"; \ + echo -n `echo $locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \ + echo -n '...'; \ + if [ -f $LOCALES/$locale ]; then input=$locale; else \ + input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; fi; \ + localedef -i $input -c -f $charset -A /usr/share/locale/locale.alias $locale; \ + echo ' done'; \ +done < $LOCALEGEN +echo "Generation complete." diff --git a/source.sh b/source.sh new file mode 100644 index 0000000..2d85cde --- /dev/null +++ b/source.sh @@ -0,0 +1,56 @@ +# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package +# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE +# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT + +DOWNLOAD="https://ftp.gnu.org/gnu/glibc/glibc-${BPM_PKG_VERSION}.tar.xz" +FILENAME="${DOWNLOAD##*/}" + +# The prepare function is executed in the root of the temp directory +# This function is used for downloading files and putting them into the correct location +prepare() { + wget "$DOWNLOAD" + tar -xvf "$FILENAME" --strip-components=1 -C "$BPM_SOURCE" +} + +# The build function is executed in the source directory +# This function is used to compile the source code +build() { + mkdir -p build + cd build + echo "rootsbindir=/usr/sbin" > configparms + ../configure --prefix=/usr \ + --disable-werror \ + --enable-kernel=4.19 \ + --enable-stack-protector=strong \ + --disable-nscd \ + libc_cv_slibdir=/usr/lib + make + make -C "$BPM_SOURCE"/localedata objdir="$BPM_SOURCE"/build DESTDIR="${BPM_WORKDIR}"/locales install-locale-files +} + +# The check function is executed in the source directory +# This function is used to run tests to verify the package has been compiled correctly +check() { + cd build + make check +} + +# The package function is executed in the source directory +# This function is used to move the compiled files into the output directory +package() { + cd build + make DESTDIR="$BPM_OUTPUT" install + sed '/RTLDLIST=/s@/usr@@g' -i "$BPM_OUTPUT"/usr/bin/ldd + mkdir -p "$BPM_OUTPUT"/usr/lib/locale + mkdir -p "$BPM_OUTPUT"/etc + mkdir -p "$BPM_OUTPUT"/usr/share/i18n + sed -e '1,3d' -e 's|/| |g' -e 's| \\||g' "$BPM_SOURCE"/localedata/SUPPORTED > "$BPM_OUTPUT"/usr/share/i18n/SUPPORTED + touch "$BPM_OUTPUT"/etc/locale.gen + sed -e '1,3d' -e 's|/| |g' -e 's|\\| |g' -e 's|^|#|g' "$BPM_SOURCE"/localedata/SUPPORTED >> "$BPM_OUTPUT"/etc/locale.gen + sed -i '/#C\.UTF-8 /d' "$BPM_OUTPUT"/etc/locale.gen + cp -r "$BPM_WORKDIR"/locales/usr/lib/locale/C.utf8 -t "$BPM_OUTPUT"/usr/lib/locale + cp "$BPM_WORKDIR"/locale-gen "$BPM_OUTPUT"/usr/bin/locale-gen + mkdir -p "$BPM_OUTPUT"/lib64/ + ln -sf ../lib/ld-linux-x86-64.so.2 "$BPM_OUTPUT"/lib64 + ln -sf ../lib/ld-linux-x86-64.so.2 "$BPM_OUTPUT"/lib64/ld-lsb-x86_64.so.3 +}