Switch to new download format and update source.sh script

This commit is contained in:
2025-10-27 18:57:05 +02:00
parent 7498e8695d
commit 141e944d81
2 changed files with 48 additions and 43 deletions
+24 -37
View File
@@ -2,16 +2,6 @@
# 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://ftpmirror.gnu.org/gcc/gcc-${BPM_PKG_VERSION}/gcc-${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() {
@@ -47,6 +37,17 @@ check() {
"$BPM_SOURCE"/contrib/test_summary
}
_pick() {
local p="$1" f d; shift
for f; do
[ -d "$BPM_WORKDIR"/output_"$p" ] || { echo "Split package $p not found"; exit 1; }
d="$BPM_WORKDIR"/output_"$p"/"${f#$BPM_OUTPUT}"
mkdir -p "$(dirname "$d")"
mv "$f" "$d"
rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
done
}
# The package function is executed in the source directory
# This function is used to move the compiled files into the output directory
package_gcc() {
@@ -69,48 +70,34 @@ package_gcc() {
install -dm755 "$BPM_OUTPUT"/usr/share/gdb/auto-load/usr/lib
mv "$BPM_OUTPUT"/usr/lib/*gdb.py "$BPM_OUTPUT"/usr/share/gdb/auto-load/usr/lib
# Move runtime libraries to gcc-libs package
mkdir "$BPM_SOURCE"/output-gcc-libs
install -d "$BPM_SOURCE"/output-gcc-libs/usr/lib
install -d "$BPM_SOURCE"/output-gcc-libs/usr/share/{info,locale/de/LC_MESSAGES,locale/fr/LC_MESSAGES}
cd "$BPM_OUTPUT"
# Move runtime libraries into split package
for lib in libasan libatomic libgcc_s libgfortran libgomp libitm liblsan libobjc libquadmath libstdc++ libtsan libubsan; do
mv "$BPM_OUTPUT"/usr/lib/"$lib"* -t "$BPM_SOURCE"/output-gcc-libs/usr/lib/
_pick gcc-libs usr/lib/"$lib"*
done
mv "$BPM_OUTPUT"/usr/share/info/{libgomp,libitm,libquadmath}.info -t "$BPM_SOURCE"/output-gcc-libs/usr/share/info/
mv "$BPM_OUTPUT"/usr/share/locale/de/LC_MESSAGES/libstdc++.mo -t "$BPM_SOURCE"/output-gcc-libs/usr/share/locale/de/LC_MESSAGES/
mv "$BPM_OUTPUT"/usr/share/locale/fr/LC_MESSAGES/libstdc++.mo -t "$BPM_SOURCE"/output-gcc-libs/usr/share/locale/fr/LC_MESSAGES/
_pick gcc-libs usr/share/info/{libgomp,libitm,libquadmath}.info
_pick gcc-libs usr/share/locale/de/LC_MESSAGES/libstdc++.mo
_pick gcc-libs usr/share/locale/fr/LC_MESSAGES/libstdc++.mo
# Move fortran files to gcc-fortran package
mkdir "$BPM_SOURCE"/output-gcc-fortran
install -d "$BPM_SOURCE"/output-gcc-fortran/usr/bin
install -d "$BPM_SOURCE"/output-gcc-fortran/usr/lib/gcc/x86_64-pc-linux-gnu/"${BPM_PKG_VERSION}"/include/
install -d "$BPM_SOURCE"/output-gcc-fortran/usr/libexec/gcc/x86_64-pc-linux-gnu/"${BPM_PKG_VERSION}"/
install -d "$BPM_SOURCE"/output-gcc-fortran/usr/share/{info,man/man1}
mv "$BPM_OUTPUT"/usr/bin/{gfortran,x86_64-pc-linux-gnu-gfortran} -t "$BPM_SOURCE"/output-gcc-fortran/usr/bin/
mv "$BPM_OUTPUT"/usr/lib/gcc/x86_64-pc-linux-gnu/"${BPM_PKG_VERSION}"/{finclude,libcaf_single.a} -t "$BPM_SOURCE"/output-gcc-fortran/usr/lib/gcc/x86_64-pc-linux-gnu/"${BPM_PKG_VERSION}"/
mv "$BPM_OUTPUT"/usr/lib/gcc/x86_64-pc-linux-gnu/"${BPM_PKG_VERSION}"/include/ISO_Fortran_binding.h -t "$BPM_SOURCE"/output-gcc-fortran/usr/lib/gcc/x86_64-pc-linux-gnu/"${BPM_PKG_VERSION}"/include/
mv "$BPM_OUTPUT"/usr/libexec/gcc/x86_64-pc-linux-gnu/"${BPM_PKG_VERSION}"/f951 -t "$BPM_SOURCE"/output-gcc-fortran/usr/libexec/gcc/x86_64-pc-linux-gnu/"${BPM_PKG_VERSION}"/
mv "$BPM_OUTPUT"/usr/share/info/gfortran.info -t "$BPM_SOURCE"/output-gcc-fortran/usr/share/info/
mv "$BPM_OUTPUT"/usr/share/man/man1/gfortran.1 -t "$BPM_SOURCE"/output-gcc-fortran/usr/share/man/man1/
_pick gcc-libs usr/bin/{gfortran,x86_64-pc-linux-gnu-gfortran}
_pick gcc-libs usr/lib/gcc/x86_64-pc-linux-gnu/${BPM_PKG_VERSION}/{finclude,libcaf_single.a}
_pick gcc-libs usr/lib/gcc/x86_64-pc-linux-gnu/${BPM_PKG_VERSION}/include/ISO_Fortran_binding.h
_pick gcc-libs usr/libexec/gcc/x86_64-pc-linux-gnu/${BPM_PKG_VERSION}/f951
_pick gcc-libs usr/share/info/gfortran.info
_pick gcc-libs usr/share/man/man1/gfortran.1
# Install package license
install -Dm644 "$BPM_SOURCE"/COPYING{,3}{,.LIB} -t "$BPM_OUTPUT"/usr/share/licenses/gcc/
}
package_gcc-libs() {
# Replace 'output' directory with 'output-gcc-libs'
rmdir "$BPM_OUTPUT"
mv "$BPM_SOURCE"/output-gcc-libs "$BPM_OUTPUT"
# Install package license
install -Dm644 "$BPM_SOURCE"/{COPYING3,COPYING.RUNTIME} -t "$BPM_OUTPUT"/usr/share/licenses/gcc-libs/
}
package_gcc-fortran() {
# Replace 'output' directory with 'output-gcc-fortran'
rmdir "$BPM_OUTPUT"
mv "$BPM_SOURCE"/output-gcc-fortran "$BPM_OUTPUT"
# Install package license
install -Dm644 "$BPM_SOURCE"/{COPYING3,COPYING.RUNTIME} -t "$BPM_OUTPUT"/usr/share/licenses/gcc-fortran/
}