# 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=5.4 \ --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() { # disable tests that take too long on most systems sed -i "/tst-thread-affinity-pthread/d" nptl/Makefile sed -i "/tst-thread-affinity-sched/d" nptl/Makefile 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 chmod +x "$BPM_OUTPUT"/usr/bin/locale-gen install -Dm644 "$BPM_SOURCE"/LICENSES "$BPM_OUTPUT"/usr/share/licenses/glibc/LICENSES install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/glibc/COPYING install -Dm644 "$BPM_SOURCE"/COPYING.LIB "$BPM_OUTPUT"/usr/share/licenses/glibc/COPYING.LIB }