diff --git a/pkg.info b/pkg.info index 2867975..dc27718 100644 --- a/pkg.info +++ b/pkg.info @@ -1,20 +1,38 @@ name: gcc description: The GNU C Compiler version: 15.2.0 -revision: 3 +revision: 4 url: https://gcc.gnu.org/ license: GPL3-or-later,LGPL3-or-later,GPL3 with GCC-exception architecture: any -make_depends: ["python3","dejagnu","expect","inetutils","tcl"] type: source +make_depends: + - python3 + - dejagnu + - expect + - inetutils + - tcl +downloads: + - url: https://ftpmirror.gnu.org/gcc/gcc-${BPM_PKG_VERSION}/gcc-${BPM_PKG_VERSION}.tar.xz + extract_to: ${BPM_SOURCE} + extract_strip_components: 1 + checksum: 438fd996826b0c82485a29da03a72d71d6e3541a83ec702df4271f6fe025d24e split_packages: - name: gcc license: GPL3-or-later,LGPL3-or-later - depends: ["binutils","gcc-libs","mpc","zstd"] + depends: + - binutils + - gcc-libs + - mpc + - zstd - name: gcc-fortran - description: "Fortran compiler from GCC" - depends: ["gcc"] + description: Fortran compiler from GCC + depends: + - gcc - name: gcc-libs description: GCC runtime libraries license: GPL3 with GCC-exception - depends: ["glibc"] + depends: + - glibc + options: + - nostrip diff --git a/source.sh b/source.sh index e6c07bb..a690e4f 100644 --- a/source.sh +++ b/source.sh @@ -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/ }