summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2024-09-30 21:01:59 +0100
committerSam James <sam@gentoo.org>2024-10-01 02:10:27 +0100
commit2fecbe438a39dfc3b226ff2c474c297a0763998f (patch)
treec6afd0075a8deffe23e044b08a1de4d719d27458
parentdev-libs/angelscript: Version bump to 2.37.0 (diff)
downloadgentoo-2fecbe438a39dfc3b226ff2c474c297a0763998f.tar.gz
gentoo-2fecbe438a39dfc3b226ff2c474c297a0763998f.tar.bz2
gentoo-2fecbe438a39dfc3b226ff2c474c297a0763998f.zip
dev-lang/ada-bootstrap: new package, add 0_p2021
Split dev-lang/gnat-gpl into dev-lang/ada-bootstrap. This ebuild was initially a clone of dev-lang/gnat-gpl-2021-r5 then had some cleanups done, toolchain.eclass use removed, and simplified what it configures/builds/installs. As I mentioned in 799693623d76c89e8b04d2434d0dfece44bb49f9, there were two jobs left -- this fixes the first one: splitting dev-lang/gnat-gpl into its own package which doesn't collide with sys-devel/gcc:10 and also does the least possible work, not with lots of USE, etc.) Some inspiration taken from sys-devel/bpf-toolchain. Considered using the *-toolchain name again but given the purpose of this is *not* just to avoid crossdev use but instead to bootstrap from a binary for Ada, it didn't feel appropriate. (Planned to do this anyway but the issue mentioned in 9732ef3475830dbe289fc80358613e90b612563c pushed me to get on with it now.) Later versions of ada-bootstrap will be our own binaries for both newer GCC as a base (although this is mostly a nice-to-have and to keep things building rather than it being essential, AFAIK) as well as more importantly musl and other arch support. For that future work, see https://bugs.gentoo.org/940471#c1 for a suggestion from Luke A. Guest. That will be tracked in bug #940472. Bug: https://bugs.gentoo.org/547358 Bug: https://bugs.gentoo.org/919667 Bug: https://bugs.gentoo.org/940472 Closes: https://bugs.gentoo.org/940471 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--dev-lang/ada-bootstrap/Manifest5
-rw-r--r--dev-lang/ada-bootstrap/ada-bootstrap-0_p2021.ebuild183
-rw-r--r--dev-lang/ada-bootstrap/files/ada-bootstrap-0_p2021-gentoo.patch72
-rw-r--r--dev-lang/ada-bootstrap/files/gcc-configure-texinfo.patch16
-rw-r--r--dev-lang/ada-bootstrap/metadata.xml7
5 files changed, 283 insertions, 0 deletions
diff --git a/dev-lang/ada-bootstrap/Manifest b/dev-lang/ada-bootstrap/Manifest
new file mode 100644
index 000000000000..e62b3fdcdcf7
--- /dev/null
+++ b/dev-lang/ada-bootstrap/Manifest
@@ -0,0 +1,5 @@
+DIST gcc-10-2021-20210519-19A74-src.tar.gz 109157702 BLAKE2B 8ec307e4fde35c8726bc7b9702717329695bad928d5222a7bb691cce47500de31a60bcfcbb925129a57cb81d3d7ea92e60599aa7383d5358e63cc087b0482550 SHA512 2e2cc0ec9a3a82816a5d399d2db261c356e106b82a44efd54a1ac882b96549ab8de79c69858127c4397de6e9e9463ce6fb9994fc2e426e7d3d2f98d5efa2edb6
+DIST gcc-interface-10-2021-20210519-19A75-src.tar.gz 359085 BLAKE2B 75f941a7635f2880cc0192acb49d8e7f567baca7530fb981be14dc6cb1bf46fda0e3c043c8703cdbeeb242b548894e0bc6787adfff0f27198354d150e6e36386 SHA512 0251a93d20c59cc4705963438880fe265e2e0bb94a35b7ddaaf03e9efae60e044e585a2204d0773a46f17b3b774e4d0c73adf852f5d06ba17373d26ed580ca8d
+DIST gnat-2021-20210519-19A70-src.tar.gz 8765762 BLAKE2B ef48f54c6109566e37bfa5dee9262305d0529b3dfd333ee28bc4e66f4709a0673f673d742bc04deb15dc145404f7618d350dbdf3f2a7ab37c861e57d011946fa SHA512 3cb79be024fdd9b738d99ffc8e224d32bb382b5da2d02b97b2061a5ea58456f33d4564c92e224af2713ce15fd5481edd715e5b9a52abc74fdc142f27e103c201
+DIST gnat-gpl-2014-x86-linux-bin.tar.gz 233049287 BLAKE2B 2e8bab113f6a319533ec12fdf71c481f72aee227c22bd0cc42a53bd727b323caba1e7b6298053db8b4d3016236b31649b0b255f4ebcbb81a08a69f29f78f13fc SHA512 ac7f53fb4bd71b0e8fbd62abc45de76f7f8f2f405b80e9b60b4b65a6cef6ee98e3b06848e4b752af3c8268237e5a0529cf6145ebc5b33cd6e5cf4928d85f5be2
+DIST gnat-gpl-2014-x86_64-linux-bin.tar.gz 236253400 BLAKE2B c1db70db9442ba24688b8e323d5a02e2e9707ba1f02835ea551038d0a09aafede93a224091e5186f2f2a9d0f96144027af2184ee05ca1c19cc997a6cf3902df7 SHA512 5e40a251baac3d0ace78352956ca21a7d294d902d344a9ed7a8d376e900468c283721ebfb773adfedbf4d623ace02536505c0147815a0c1908933ad611ea085e
diff --git a/dev-lang/ada-bootstrap/ada-bootstrap-0_p2021.ebuild b/dev-lang/ada-bootstrap/ada-bootstrap-0_p2021.ebuild
new file mode 100644
index 000000000000..1e5371d3215a
--- /dev/null
+++ b/dev-lang/ada-bootstrap/ada-bootstrap-0_p2021.ebuild
@@ -0,0 +1,183 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+MYP=gcc-10-${PV##*_p}-20210519-19A74-src
+GNATDIR=gnat-${PV##*_p}-20210519-19A70-src
+INTFDIR=gcc-interface-10-${PV##*_p}-20210519-19A75-src
+BTSTRP_X86=gnat-gpl-2014-x86-linux-bin
+BTSTRP_AMD64=gnat-gpl-2014-x86_64-linux-bin
+BASE_URI=https://community.download.adacore.com/v1
+
+inherit flag-o-matic toolchain-funcs
+
+DESCRIPTION="GNAT Ada Compiler - GPL version"
+HOMEPAGE="http://libre.adacore.com/"
+SRC_URI="
+ ${BASE_URI}/005d2b2eff627177986d2517eb31e1959bec6f3a?filename=${GNATDIR}.tar.gz
+ -> ${GNATDIR}.tar.gz
+ ${BASE_URI}/44cd393be0b468cc253bf2cf9cf7804c993e7b5b?filename=${MYP}.tar.gz
+ -> ${MYP}.tar.gz
+ ${BASE_URI}/8ace7d06e469d36d726cc8badb0ed78411e727f3?filename=${INTFDIR}.tar.gz
+ -> ${INTFDIR}.tar.gz
+ amd64? (
+ ${BASE_URI}/6eb6eef6bb897e4c743a519bfebe0b1d6fc409c6?filename=${BTSTRP_AMD64}.tar.gz&rand=1193
+ -> ${BTSTRP_AMD64}.tar.gz
+ )
+ x86? (
+ ${BASE_URI}/c5e9e6fdff5cb77ed90cf8c62536653e27c0bed6?filename=${BTSTRP_X86}.tar.gz&rand=436
+ -> ${BTSTRP_X86}.tar.gz
+ )
+"
+S="${WORKDIR}"/${MYP}
+
+LICENSE="GPL-2 GPL-3"
+SLOT="0" # TODO: slot based on GCC version used
+KEYWORDS="-* ~amd64 ~x86"
+RESTRICT="test"
+
+BDEPEND="sys-devel/binutils"
+
+pkg_pretend() {
+ if tc-is-clang; then
+ die "${P} does not build with clang. It is bootstrapped."
+ fi
+}
+
+src_prepare() {
+ local bundledchost
+ case ${ARCH} in
+ amd64)
+ BTSTRP=${BTSTRP_AMD64}
+ bundledchost="x86_64"
+ ;;
+ x86)
+ BTSTRP=${BTSTRP_X86}
+ bundledchost="i686"
+ ;;
+ *)
+ die "Unknown \${ARCH}=${ARCH}!"
+ ;;
+ esac
+
+ local cleanup
+ for cleanup in as ld ; do
+ rm "${WORKDIR}"/${BTSTRP}/libexec/gcc/${bundledchost}-pc-linux-gnu/4.7.4/${cleanup} || die
+
+ ln -s "${BROOT}"/usr/bin/${CHOST}-${cleanup} \
+ "${WORKDIR}"/${BTSTRP}/libexec/gcc/${bundledchost}-pc-linux-gnu/4.7.4/${cleanup} || die
+ done
+
+ export GCC="${WORKDIR}"/${BTSTRP}/bin/gcc
+
+ gnatbase=$(basename ${GCC})
+ gnatpath=$(dirname ${GCC})
+ GNATMAKE=${gnatbase/gcc/gnatmake}
+ if [[ ${gnatpath} != "." ]] ; then
+ GNATMAKE="${gnatpath}/${GNATMAKE}"
+ fi
+
+ export CC=${GCC}
+ export CXX="${gnatbase/gcc/g++}"
+ export GNATBIND="${gnatbase/gcc/gnatbind}"
+ export GNATLINK="${gnatbase/gcc/gnatlink}"
+ export GNATLS="${gnatbase/gcc/gnatls}"
+ if [[ ${gnatpath} != "." ]] ; then
+ CXX="${gnatpath}/${CXX}"
+ GNATBIND="${gnatpath}/${GNATBIND}"
+ GNATLINK="${gnatpath}/${GNATLINK}"
+ GNATLS="${gnatpath}/${GNATLS}"
+ fi
+
+ mkdir bin || die
+ local tool
+ for tool in gnat{make,bind,link,ls} ; do
+ ln -s $(type -P ${tool^^}) bin/${tool} || die
+ ln -s $(type -P ${tool^^}) bin/${bundledchost}-pc-linux-gnu-${tool} || die
+ done
+ ln -s $(type -P ${GCC}) bin/gcc || die
+ ln -s $(type -P ${GCC}) bin/${bundledchost}-pc-linux-gnu-gcc || die
+ ln -s $(type -P ${CXX}) bin/g++ || die
+ ln -s $(type -P ${CXX}) bin/${bundledchost}-pc-linux-gnu-g++ || die
+
+ cd .. || die
+ mv ${GNATDIR}/src/ada ${MYP}/gcc/ || die
+ mv ${INTFDIR} ${MYP}/gcc/ada/gcc-interface || die
+ eapply "${FILESDIR}"/${P}-gentoo.patch
+ cd - || die
+
+ sed -i \
+ -e 's:-fcf-protection":":' \
+ libiberty/configure \
+ lto-plugin/configure || die
+ sed -i \
+ -e 's:$(P) ::g' \
+ gcc/ada/gcc-interface/Makefile.in \
+ || die "sed failed"
+ default
+}
+
+src_configure() {
+ local adabdir=/usr/lib/${PN}
+ local prefix=${EPREFIX}${adabdir}
+ local -x PATH=${PWD}/bin:${PATH}
+
+ # This version is GCC 4.7.4 with a bolted-on newer GNAT; be very
+ # conservative, we just want it to build for bootstrapping proper
+ # sys-devel/gcc[ada]. We don't need it to be fast.
+ strip-flags
+ strip-unsupported-flags
+ filter-lto
+ append-flags -O2
+ append-flags -fno-strict-aliasing
+
+ local conf=(
+ --{doc,info,man}dir=/.skip # let the real gcc handle docs
+ MAKEINFO=: #922230
+ --prefix="${prefix}"
+ --disable-bootstrap
+ --disable-cc1
+ --disable-cet
+ --disable-gcov #843989
+ --disable-gomp
+ --disable-nls # filename collisions
+ --disable-libcc1
+ --disable-libquadmath
+ --disable-libsanitizer
+ --disable-libssp
+ --disable-libvtv
+ --disable-shared
+ --disable-werror
+ --enable-languages=ada
+ --with-gcc-major-version-only
+ --with-system-zlib
+ --without-isl
+ --without-zstd
+ --disable-multilib
+ )
+
+ # libstdc++ may misdetect sys/sdt.h on systemtap-enabled system and fail
+ # (not passed in conf_gcc above given it is lost in sub-configure calls)
+ local -x glibcxx_cv_sys_sdt_h=no
+
+ mkdir "${WORKDIR}"/build || die
+ cd "${WORKDIR}"/build
+ ECONF_SOURCE="${S}" econf "${conf[@]}"
+}
+
+src_compile() {
+ emake -C "${WORKDIR}"/build MAKEINFO=: V=1
+}
+
+src_install() {
+ # -j1 to match bug #906155, other packages may be fragile too
+ emake -C "${WORKDIR}"/build -j1 MAKEINFO=: V=1 DESTDIR="${D}" install
+
+ # Delete libdep.a, which has a colliding name and is useless for bpf,
+ # which does not make use of cross-library dependencies: the libdep.a
+ # for the native binutils will do.
+ rm -f "${ED}"/${adabdir}/lib/bfd-plugins/libdep.a || die
+}
+
+# TODO: pkg_postinst warning/log?
diff --git a/dev-lang/ada-bootstrap/files/ada-bootstrap-0_p2021-gentoo.patch b/dev-lang/ada-bootstrap/files/ada-bootstrap-0_p2021-gentoo.patch
new file mode 100644
index 000000000000..c75ee9ce8da7
--- /dev/null
+++ b/dev-lang/ada-bootstrap/files/ada-bootstrap-0_p2021-gentoo.patch
@@ -0,0 +1,72 @@
+--- a/gcc-10-2021-20210519-19A74-src/gcc/ada/osint.adb 2017-03-10 21:58:02.600710156 +0100
++++ b/gcc-10-2021-20210519-19A74-src/gcc/ada/osint.adb 2017-03-10 21:59:38.033983293 +0100
+@@ -2229,14 +2229,11 @@
+ for J in Start_Of_Prefix .. Name_Len - Prog'Length + 1 loop
+ if Name_Buffer (J .. J + Prog'Length - 1) = Prog then
+ End_Of_Prefix := J - 1;
++ Start_Of_Suffix := J + Prog'Length;
+ exit;
+ end if;
+ end loop;
+
+- if End_Of_Prefix > 1 then
+- Start_Of_Suffix := End_Of_Prefix + Prog'Length + 1;
+- end if;
+-
+ -- Create the new program name
+
+ return new String'
+--- a/gcc-10-2021-20210519-19A74-src/config/cet.m4 2022-01-01 11:18:09.663425422 +0100
++++ b/gcc-10-2021-20210519-19A74-src/config/cet.m4 2022-01-01 11:18:14.809345911 +0100
+@@ -62,7 +62,6 @@
+ i[[34567]]86-*-linux* | x86_64-*-linux*)
+ may_have_cet=yes
+ save_CFLAGS="$CFLAGS"
+- CFLAGS="$CFLAGS -fcf-protection"
+ case "$enable_cet" in
+ auto)
+ # Check if target supports multi-byte NOPs
+--- a/gcc-10-2021-20210519-19A74-src/libiberty/configure 2024-03-02 19:45:34.658271627 +0100
++++ b/gcc-10-2021-20210519-19A74-src/libiberty/configure 2024-03-02 19:54:48.013538533 +0100
+@@ -6709,6 +6709,9 @@
+ if test "$cross_compiling" = yes; then :
+ ac_cv_c_stack_direction=0
+ else
++ cat >>confdefs.h <<_ACEOF
++extern void exit(int status);
++_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+ find_stack_direction ()
+@@ -7539,6 +7542,11 @@
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_strncmp_works=yes
+ else
++ cat >>confdefs.h <<_ACEOF
++ extern long unsigned int strlen(const char *s);
++ extern char *strcpy(char *dst, const char *src);
++ extern int strncmp(const char *s1, const char *s2, long unsigned int n);
++_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+
+--- a/gcc-10-2021-20210519-19A74-src/libsanitizer/configure 2024-03-02 20:41:56.810707374 +0100
++++ b/gcc-10-2021-20210519-19A74-src/libsanitizer/configure 2024-03-02 20:43:00.189080219 +0100
+@@ -16073,6 +16073,7 @@
+ sanitizer_supported=no
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+ #include <sys/syscall.h>
++#include <unistd.h>
+ int
+ main ()
+--- a/gcc-10-2021-20210519-19A74-src/libgfortran/configure 2024-03-02 21:57:47.282939696 +0100
++++ b/gcc-10-2021-20210519-19A74-src/libgfortran/configure 2024-03-02 21:58:34.702446345 +0100
+@@ -26391,6 +26391,7 @@
+ #if HAVE_IEEEFP_H
+ # include <ieeefp.h>
+ #endif /* HAVE_IEEEFP_H */
++extern void fpsetmask(int);
+ int
+ main ()
+ {
diff --git a/dev-lang/ada-bootstrap/files/gcc-configure-texinfo.patch b/dev-lang/ada-bootstrap/files/gcc-configure-texinfo.patch
new file mode 100644
index 000000000000..99e90998a469
--- /dev/null
+++ b/dev-lang/ada-bootstrap/files/gcc-configure-texinfo.patch
@@ -0,0 +1,16 @@
+Chances are quite good that the installed makeinfo is sufficient.
+So ignore false positives where the makeinfo installed is so new
+that it violates the cheesy version grep.
+
+http://bugs.gentoo.org/198182
+
+--- a/configure
++++ b/configure
+@@ -3573,6 +3573,6 @@
+ :
+ else
+- MAKEINFO="$MISSING makeinfo"
++ :
+ fi
+ ;;
+
diff --git a/dev-lang/ada-bootstrap/metadata.xml b/dev-lang/ada-bootstrap/metadata.xml
new file mode 100644
index 000000000000..91e8ad9f5e33
--- /dev/null
+++ b/dev-lang/ada-bootstrap/metadata.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>ada@gentoo.org</email>
+ </maintainer>
+</pkgmetadata>