diff options
139 files changed, 7183 insertions, 9884 deletions
diff --git a/.github/workflows/scripts.yml b/.github/workflows/scripts.yml index 461bd8d036..ec027738e5 100644 --- a/.github/workflows/scripts.yml +++ b/.github/workflows/scripts.yml @@ -18,6 +18,6 @@ jobs: bash -n "${script}" done - name: Test scripts with ShellCheck - uses: ludeeus/action-shellcheck@1.1.0 + uses: ludeeus/action-shellcheck@master with: scandir: "./scripts" diff --git a/app-arch/bzip2/bzip2-1.0.8-r1.ebuild b/app-arch/bzip2/bzip2-1.0.8-r1.ebuild deleted file mode 100644 index 2ba7042d39..0000000000 --- a/app-arch/bzip2/bzip2-1.0.8-r1.ebuild +++ /dev/null @@ -1,142 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -# XXX: atm, libbz2.a is always PIC :(, so it is always built quickly -# (since we're building shared libs) ... - -EAPI=7 - -inherit toolchain-funcs multilib-minimal usr-ldscript prefix - -DESCRIPTION="A high-quality data compressor used extensively by Gentoo Linux" -HOMEPAGE="https://sourceware.org/bzip2/" -SRC_URI="https://sourceware.org/pub/${PN}/${P}.tar.gz" - -LICENSE="BZIP2" -SLOT="0/1" # subslot = SONAME -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt" -IUSE="static static-libs" - -PATCHES=( - "${FILESDIR}"/${PN}-1.0.4-makefile-CFLAGS.patch - "${FILESDIR}"/${PN}-1.0.8-saneso.patch - "${FILESDIR}"/${PN}-1.0.4-man-links.patch #172986 - "${FILESDIR}"/${PN}-1.0.6-progress.patch - "${FILESDIR}"/${PN}-1.0.3-no-test.patch - "${FILESDIR}"/${PN}-1.0.8-mingw.patch #393573 - "${FILESDIR}"/${PN}-1.0.8-out-of-tree-build.patch -) - -DOCS=( CHANGES README{,.COMPILATION.PROBLEMS,.XML.STUFF} manual.pdf ) -HTML_DOCS=( manual.html ) - -src_prepare() { - default - - # - Use right man path - # - Generate symlinks instead of hardlinks - # - pass custom variables to control libdir - sed -i \ - -e 's:\$(PREFIX)/man:\$(PREFIX)/share/man:g' \ - -e 's:ln -s -f $(PREFIX)/bin/:ln -s -f :' \ - -e 's:$(PREFIX)/lib:$(PREFIX)/$(LIBDIR):g' \ - Makefile || die - - hprefixify -w "/^PATH=/" bz{diff,grep,more} - # this a makefile for Darwin, which already "includes" saneso - cp "${FILESDIR}"/${P}-Makefile-libbz2_dylib Makefile-libbz2_dylib || die - - if [[ ${CHOST} == *-cygwin* ]] ; then - sed -i -e "s/-o libbz2\.so\.${PV}/-Wl,--out-implib=libbz2$(get_libname ${PV})/" \ - -e "s/-Wl,-soname -Wl,libbz2\.so\.1/-o cygbz2-${PV%%.*}.dll/" \ - -e "s/libbz2\.so/libbz2$(get_libname)/g" \ - Makefile-libbz2_so - fi -} - -bemake() { - emake \ - VPATH="${S}" \ - CC="$(tc-getCC)" \ - AR="$(tc-getAR)" \ - RANLIB="$(tc-getRANLIB)" \ - "$@" -} - -multilib_src_compile() { - local checkopts= - case "${CHOST}" in - *-darwin*) - bemake PREFIX="${EPREFIX}"/usr -f "${S}"/Makefile-libbz2_dylib all - ;; - *) - bemake -f "${S}"/Makefile-libbz2_so all - ;; - esac - # Make sure we link against the shared lib #504648 - ln -sf libbz2$(get_libname ${PV}) libbz2$(get_libname) || die - bemake -f "${S}"/Makefile all LDFLAGS="${LDFLAGS} $(usex static -static '')" -} - -multilib_src_install() { - into /usr - - # Install the shared lib manually. We install: - # .x.x.x - standard shared lib behavior - # .x.x - SONAME some distros use #338321 - # .x - SONAME Gentoo uses - dolib.so libbz2$(get_libname ${PV}) - [[ ${CHOST} == *-cygwin* ]] && dobin cygbz2-${PV%%.*}.dll - local v - for v in libbz2$(get_libname) libbz2$(get_libname ${PV%%.*}) libbz2$(get_libname ${PV%.*}) ; do - dosym libbz2$(get_libname ${PV}) /usr/$(get_libdir)/${v} - done - - # Install libbz2.so.1.0 due to accidental soname change in 1.0.7. - # Reference: 98da0ad82192d21ad74ae52366ea8466e2acea24. - # OK to remove one year after 2020-04-11. - if [[ ! -L "${ED}/usr/$(get_libdir)/libbz2$(get_libname 1.0)" ]]; then - dosym libbz2.so.${PV} "/usr/$(get_libdir)/libbz2$(get_libname 1.0)" - fi - - use static-libs && dolib.a libbz2.a - - if multilib_is_native_abi ; then - gen_usr_ldscript -a bz2 - - dobin bzip2recover - into / - dobin bzip2 - fi -} - -multilib_src_install_all() { - # `make install` doesn't cope with out-of-tree builds, nor with - # installing just non-binaries, so handle things ourselves. - insinto /usr/include - doins bzlib.h - into /usr - dobin bz{diff,grep,more} - doman *.1 - - dosym bzdiff /usr/bin/bzcmp - dosym bzdiff.1 /usr/share/man/man1/bzcmp.1 - - dosym bzmore /usr/bin/bzless - dosym bzmore.1 /usr/share/man/man1/bzless.1 - - local x - for x in bunzip2 bzcat bzip2recover ; do - dosym bzip2.1 /usr/share/man/man1/${x}.1 - done - for x in bz{e,f}grep ; do - dosym bzgrep /usr/bin/${x} - dosym bzgrep.1 /usr/share/man/man1/${x}.1 - done - - einstalldocs - - # move "important" bzip2 binaries to /bin and use the shared libbz2.so - dosym bzip2 /bin/bzcat - dosym bzip2 /bin/bunzip2 -} diff --git a/app-arch/bzip2/bzip2-1.0.8-r3.ebuild b/app-arch/bzip2/bzip2-1.0.8-r4.ebuild index 1c2b65d3b8..8d94165783 100644 --- a/app-arch/bzip2/bzip2-1.0.8-r3.ebuild +++ b/app-arch/bzip2/bzip2-1.0.8-r4.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2022 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # XXX: atm, libbz2.a is always PIC :(, so it is always built quickly @@ -6,7 +6,7 @@ EAPI=7 -VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/bzip2.gpg +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/bzip2.gpg inherit toolchain-funcs multilib-minimal usr-ldscript verify-sig prefix DESCRIPTION="A high-quality data compressor used extensively by Gentoo Linux" @@ -16,12 +16,15 @@ SRC_URI+=" verify-sig? ( https://sourceware.org/pub/${PN}/${P}.tar.gz.sig )" LICENSE="BZIP2" SLOT="0/1" # subslot = SONAME -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt" +KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" IUSE="static static-libs" -BDEPEND="verify-sig? ( sec-keys/openpgp-keys-bzip2 )" -RDEPEND="!app-arch/lbzip2[symlink(-)] - !app-arch/pbzip2[symlink(-)]" +BDEPEND=" + verify-sig? ( sec-keys/openpgp-keys-bzip2 ) +" +PDEPEND=" + app-alternatives/bzip2 +" PATCHES=( "${FILESDIR}"/${PN}-1.0.4-makefile-CFLAGS.patch @@ -101,7 +104,7 @@ multilib_src_install() { dobin bzip2recover into / - dobin bzip2 + newbin bzip2 bzip2-reference fi } @@ -112,7 +115,8 @@ multilib_src_install_all() { doins bzlib.h into /usr dobin bz{diff,grep,more} - doman *.1 + doman bz{diff,grep,more}.1 + newman bzip2.1 bzip2-reference.1 dosym bzdiff /usr/bin/bzcmp dosym bzdiff.1 /usr/share/man/man1/bzcmp.1 @@ -120,18 +124,23 @@ multilib_src_install_all() { dosym bzmore /usr/bin/bzless dosym bzmore.1 /usr/share/man/man1/bzless.1 + dosym bzip2-reference.1 /usr/share/man/man1/bzip2recover.1 local x - for x in bunzip2 bzcat bzip2recover ; do - dosym bzip2.1 /usr/share/man/man1/${x}.1 - done for x in bz{e,f}grep ; do dosym bzgrep /usr/bin/${x} dosym bzgrep.1 /usr/share/man/man1/${x}.1 done einstalldocs +} - # move "important" bzip2 binaries to /bin and use the shared libbz2.so - dosym bzip2 /bin/bzcat - dosym bzip2 /bin/bunzip2 +pkg_postinst() { + # ensure to preserve the symlinks before app-alternatives/bzip2 + # is installed + local x + for x in bzip2 bunzip2 bzcat; do + if [[ ! -h ${EROOT}/bin/${x} ]]; then + ln -s bzip2-reference "${EROOT}/bin/${x}" || die + fi + done } diff --git a/dev-build/meson/Manifest b/dev-build/meson/Manifest new file mode 100644 index 0000000000..d7742feeed --- /dev/null +++ b/dev-build/meson/Manifest @@ -0,0 +1,3 @@ +DIST meson-1.4.0.tar.gz 2224663 BLAKE2B 7f742ef870c182e552c1ff3508d65f251009d610def6a08e01fddb6c6a4ed6d608ead0d52cf8ca7d66b5bd7a4732dccd7ab5d98f141a4a61e275398885f79486 SHA512 2787941fbc77d5ad95011753df52fe39812929a06d84dbce8bdc965c9c1e62fd6bfa819712eb1f5934c2ebe6919a65f7874ecac2caf40d111ea024343108cfbd +DIST meson-1.4.0.tar.gz.asc 833 BLAKE2B 6e4002303da16bcaa3d1d3c76a3485b23174074de2d29bd34347a4671d7fb0f1c0767559ed9267e0f0b52c02638b85a11a5980f4ee188e7e4d35c733b0821c62 SHA512 ea73e72d929bf30d28c033f103fd1d26bac7cef175aabbf9b3a24c7b336682c28f5aae184e04d2189731cf80dd7571939cb02de642bb5b412cea996ca30dfdad +DIST meson-reference-1.4.0.3 339324 BLAKE2B 8ad24592c1a9100832dead97a55d4cb358892fc1cd6aee641f9610cb6a5df211831e6cfc42e047d5e835ed53de1bb9c7d711dd1a0a8cfe18a0f85e92a1a3f925 SHA512 8df06f63db6db01a6c8c0a5b4a8b26c868bb027f26580d290288b1067429a526fb654fae01a45085c1f20ee8dab1b5325e8b2fd285faf175d2fcfc2c704b4768 diff --git a/dev-build/meson/files/meson-1.2.1-python-path.patch b/dev-build/meson/files/meson-1.2.1-python-path.patch new file mode 100644 index 0000000000..d6151881f8 --- /dev/null +++ b/dev-build/meson/files/meson-1.2.1-python-path.patch @@ -0,0 +1,26 @@ +From 2b33c94e6315e9a397dd48a58a5becb0df3b8aba Mon Sep 17 00:00:00 2001 +From: James Le Cuirot <chewi@gentoo.org> +Date: Sat, 12 Aug 2023 09:56:44 +0100 +Subject: [PATCH 2/2] python module: Respect PATH when python is not given in + machine file + +We should only fall back to the Python interpreter running Meson itself +if `python3` is not found in the PATH. + +https://github.com/mesonbuild/meson/pull/12116 + +diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py +index 5654e4231..2b2395a9b 100644 +--- a/mesonbuild/modules/python.py ++++ b/mesonbuild/modules/python.py +@@ -381,7 +381,9 @@ class PythonModule(ExtensionModule): + + def _find_installation_impl(self, state: 'ModuleState', display_name: str, name_or_path: str, required: bool) -> MaybePythonProg: + if not name_or_path: +- python = PythonExternalProgram('python3', mesonlib.python_command) ++ python = PythonExternalProgram('python3') ++ if not python.found(): ++ python = PythonExternalProgram('python3', mesonlib.python_command) + else: + tmp_python = ExternalProgram.from_entry(display_name, name_or_path) + python = PythonExternalProgram(display_name, ext_prog=tmp_python) diff --git a/dev-build/meson/files/meson-1.4.0-darwin-rpath.patch b/dev-build/meson/files/meson-1.4.0-darwin-rpath.patch new file mode 100644 index 0000000000..abcb9be6bb --- /dev/null +++ b/dev-build/meson/files/meson-1.4.0-darwin-rpath.patch @@ -0,0 +1,101 @@ +From c9565bd44149041d613046d02be4cb9a5bd9ee2b Mon Sep 17 00:00:00 2001 +From: Fabian Groffen <grobian@gentoo.org> +Date: Wed, 27 Mar 2024 17:20:16 +0000 +Subject: [PATCH] depfixer: change fix_darwin to act like fix_rpathtype_entry + +This somewhat aligns "darwin" (Mach-O) with how ELF RPATHs are treated. +Instead of blindly removing all RPATHs, only remove the ones that are in +the rpath_dirs_to_remove set. This way, RPATHs that were added by the +toolchain or user are left untouched. + +It is important not to remove RPATHs as they may be vital for the +executable at runtime. Issues #12045 and #12288 are examples of this. + +Issue: https://github.com/mesonbuild/meson/issues/12045 +Signed-off-by: Fabian Groffen <grobian@gentoo.org> +--- + mesonbuild/scripts/depfixer.py | 53 ++++++++++++++-------------------- + 1 file changed, 21 insertions(+), 32 deletions(-) + +diff --git a/mesonbuild/scripts/depfixer.py b/mesonbuild/scripts/depfixer.py +index 61b7ffa642f1..71599f784e73 100644 +--- a/mesonbuild/scripts/depfixer.py ++++ b/mesonbuild/scripts/depfixer.py +@@ -379,7 +379,7 @@ def fix_elf(fname: str, rpath_dirs_to_remove: T.Set[bytes], new_rpath: T.Optiona + # note: e.get_rpath() and e.get_runpath() may be useful + e.fix_rpath(fname, rpath_dirs_to_remove, new_rpath) + +-def get_darwin_rpaths_to_remove(fname: str) -> T.List[str]: ++def get_darwin_rpaths(fname: str) -> T.List[str]: + p, out, _ = Popen_safe(['otool', '-l', fname], stderr=subprocess.DEVNULL) + if p.returncode != 0: + raise subprocess.CalledProcessError(p.returncode, p.args, out) +@@ -397,43 +397,32 @@ def get_darwin_rpaths_to_remove(fname: str) -> T.List[str]: + result.append(rp) + return result + +-def fix_darwin(fname: str, new_rpath: str, final_path: str, install_name_mappings: T.Dict[str, str]) -> None: ++def fix_darwin(fname: str, rpath_dirs_to_remove: T.Set[bytes], new_rpath: str, final_path: str, install_name_mappings: T.Dict[str, str]) -> None: + try: +- rpaths = get_darwin_rpaths_to_remove(fname) ++ old_rpaths = get_darwin_rpaths(fname) + except subprocess.CalledProcessError: + # Otool failed, which happens when invoked on a + # non-executable target. Just return. + return ++ new_rpaths: OrderedSet[str] = OrderedSet() ++ if new_rpath: ++ new_rpaths.update(new_rpath) ++ # filter out build-only rpath entries, like in ++ # fix_rpathtype_entry ++ remove_rpaths = [x.decode('utf8') for x in rpath_dirs_to_remove] ++ for rpath_dir in old_rpaths: ++ if rpath_dir and rpath_dir not in remove_rpaths: ++ new_rpaths.add(rpath_dir) + try: + args = [] +- if rpaths: +- # TODO: fix this properly, not totally clear how +- # +- # removing rpaths from binaries on macOS has tons of +- # weird edge cases. For instance, if the user provided +- # a '-Wl,-rpath' argument in LDFLAGS that happens to +- # coincide with an rpath generated from a dependency, +- # this would cause installation failures, as meson would +- # generate install_name_tool calls with two identical +- # '-delete_rpath' arguments, which install_name_tool +- # fails on. Because meson itself ensures that it never +- # adds duplicate rpaths, duplicate rpaths necessarily +- # come from user variables. The idea of using OrderedSet +- # is to remove *at most one* duplicate RPATH entry. This +- # is not optimal, as it only respects the user's choice +- # partially: if they provided a non-duplicate '-Wl,-rpath' +- # argument, it gets removed, if they provided a duplicate +- # one, it remains in the final binary. A potentially optimal +- # solution would split all user '-Wl,-rpath' arguments from +- # LDFLAGS, and later add them back with '-add_rpath'. +- for rp in OrderedSet(rpaths): +- args += ['-delete_rpath', rp] +- subprocess.check_call(['install_name_tool', fname] + args, +- stdout=subprocess.DEVNULL, +- stderr=subprocess.DEVNULL) +- args = [] +- if new_rpath: +- args += ['-add_rpath', new_rpath] ++ # compute diff, translate it into -delete_rpath and -add_rpath ++ # calls ++ for path in new_rpaths: ++ if path not in old_rpaths: ++ args += ['-add_rpath', path] ++ for path in old_rpaths: ++ if path not in new_rpaths: ++ args += ['-delete_rpath', path] + # Rewrite -install_name @rpath/libfoo.dylib to /path/to/libfoo.dylib + if fname.endswith('dylib'): + args += ['-id', final_path] +@@ -492,4 +481,4 @@ def fix_rpath(fname: str, rpath_dirs_to_remove: T.Set[bytes], new_rpath: T.Union + if INSTALL_NAME_TOOL: + if isinstance(new_rpath, bytes): + new_rpath = new_rpath.decode('utf8') +- fix_darwin(fname, new_rpath, final_path, install_name_mappings) ++ fix_darwin(fname, rpath_dirs_to_remove, new_rpath, final_path, install_name_mappings) diff --git a/dev-build/meson/meson-1.4.0-r1.ebuild b/dev-build/meson/meson-1.4.0-r1.ebuild new file mode 100644 index 0000000000..e29322ee47 --- /dev/null +++ b/dev-build/meson/meson-1.4.0-r1.ebuild @@ -0,0 +1,181 @@ +# Copyright 2016-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..12} pypy3 ) +DISTUTILS_USE_PEP517=setuptools + +inherit bash-completion-r1 edo distutils-r1 flag-o-matic toolchain-funcs + +if [[ ${PV} = *9999* ]]; then + EGIT_REPO_URI="https://github.com/mesonbuild/meson" + inherit ninja-utils git-r3 + + BDEPEND=" + ${NINJA_DEPEND} + $(python_gen_any_dep 'dev-python/pyyaml[${PYTHON_USEDEP}]') + " + +else + inherit verify-sig + + MY_PV=${PV/_/} + MY_P=${P/_/} + S=${WORKDIR}/${MY_P} + + SRC_URI=" + https://github.com/mesonbuild/meson/releases/download/${MY_PV}/${MY_P}.tar.gz + verify-sig? ( https://github.com/mesonbuild/meson/releases/download/${MY_PV}/${MY_P}.tar.gz.asc ) + https://github.com/mesonbuild/meson/releases/download/${MY_PV}/meson-reference.3 -> meson-reference-${MY_PV}.3 + " + BDEPEND="verify-sig? ( sec-keys/openpgp-keys-jpakkane )" + VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/jpakkane.gpg + + if [[ ${PV} != *_rc* ]] ; then + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" + fi +fi + +DESCRIPTION="Open source build system" +HOMEPAGE="https://mesonbuild.com/" + +LICENSE="Apache-2.0" +SLOT="0" +IUSE="test" +RESTRICT="!test? ( test )" + +DEPEND=" + test? ( + dev-libs/glib:2 + dev-libs/gobject-introspection + app-alternatives/ninja + dev-vcs/git + sys-libs/zlib[static-libs(+)] + virtual/pkgconfig + ) +" +RDEPEND=" + !<dev-build/muon-0.2.0-r2[man(-)] + virtual/pkgconfig +" + +PATCHES=( + "${FILESDIR}"/${PN}-1.2.1-python-path.patch + "${FILESDIR}"/${PN}-1.4.0-darwin-rpath.patch +) + +src_unpack() { + if [[ ${PV} = *9999* ]]; then + git-r3_src_unpack + else + default + use verify-sig && verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.gz{,.asc} + fi +} + +python_prepare_all() { + local disable_unittests=( + # ASAN and sandbox both want control over LD_PRELOAD + # https://bugs.gentoo.org/673016 + -e 's/test_generate_gir_with_address_sanitizer/_&/' + + # ASAN is unsupported on some targets + # https://bugs.gentoo.org/692822 + -e 's/test_pch_with_address_sanitizer/_&/' + ) + + sed -i "${disable_unittests[@]}" unittests/*.py || die + + # Broken due to python2 script created by python_wrapper_setup + rm -r "test cases/frameworks/1 boost" || die + + distutils-r1_python_prepare_all +} + +python_check_deps() { + if [[ ${PV} = *9999* ]]; then + python_has_version "dev-python/pyyaml[${PYTHON_USEDEP}]" + fi +} + +python_configure_all() { + if [[ ${PV} = *9999* ]]; then + # We use the unsafe_yaml loader because strictyaml is not packaged. In + # theory they produce the same results, but pyyaml is faster and + # without safety checks. + edo ./meson.py setup \ + --prefix "${EPREFIX}/usr" \ + -Dhtml=false \ + -Dunsafe_yaml=true \ + docs/ docs/builddir + fi +} + +python_compile_all() { + if [[ ${PV} = *9999* ]]; then + eninja -C docs/builddir + fi +} + +src_test() { + tc-export PKG_CONFIG + if ${PKG_CONFIG} --exists Qt5Core && ! ${PKG_CONFIG} --exists Qt5Gui; then + ewarn "Found Qt5Core but not Qt5Gui; skipping tests" + else + distutils-r1_src_test + fi +} + +python_test() { + ( + # meson has its own tests for LTO support. We don't need to verify that + # all tests work when they happen to use it. And in particular, this + # breaks rust. + filter-lto + + # remove unwanted python_wrapper_setup contents + # We actually do want to non-error if python2 is installed and tested. + remove="${T}/${EPYTHON}/bin:" + PATH=${PATH/${remove}/} + + # test_meson_installed + unset PYTHONDONTWRITEBYTECODE + + # https://bugs.gentoo.org/687792 + unset PKG_CONFIG + + # test_cross_file_system_paths + unset XDG_DATA_HOME + + # 'test cases/unit/73 summary' expects 80 columns + export COLUMNS=80 + + # If JAVA_HOME is not set, meson looks for javac in PATH. + # If javac is in /usr/bin, meson assumes /usr/include is a valid + # JDK include path. Setting JAVA_HOME works around this broken + # autodetection. If no JDK is installed, we should end up with an empty + # value in JAVA_HOME, and the tests should get skipped. + export JAVA_HOME=$(java-config -O 2>/dev/null) + + ${EPYTHON} -u run_tests.py + ) || die "Testing failed with ${EPYTHON}" +} + +python_install_all() { + distutils-r1_python_install_all + + insinto /usr/share/vim/vimfiles + doins -r data/syntax-highlighting/vim/{ftdetect,indent,syntax} + + insinto /usr/share/zsh/site-functions + doins data/shell-completions/zsh/_meson + + dobashcomp data/shell-completions/bash/meson + + if [[ ${PV} = *9999* ]]; then + DESTDIR="${ED}" eninja -C docs/builddir install + else + newman "${DISTDIR}"/meson-reference-${PV}.3 meson-reference.3 + fi +} diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest index 2ca341d15b..1f45842d37 100644 --- a/dev-lang/python/Manifest +++ b/dev-lang/python/Manifest @@ -1,5 +1,11 @@ DIST Python-3.10.4.tar.xz 19342692 BLAKE2B c430ad9bed71729fda29433af0614b6c0110a85e23f4cb5cff3a9b501febe99b20094367a5428f256fb3aeef97f34d439ef677fc8ae4d596d52da7976b65ebb5 SHA512 6c9aeecddc55c7896b2e8527fca131c7b2b6127d56ce1a001ccedfebf590334e0c0bb7c517ed3cf1da3c1910e002552b56aa7e03eeb672f42ff0bd8150799113 DIST Python-3.10.4.tar.xz.asc 833 BLAKE2B 289f2e96bfc2b60c4ae94b1591779d604f203890c4f5db2ee16e305bf03c6ddb9c8d6da4471a06b5943e12888f37ca572ea30876e9a80382a26814f66b41b7bf SHA512 699e37bf09067083af159e3734b38c952bdc75432c8abfb7a7b8cce7ca975038da37490abeb5c13befd2dacb84a5341ad30de5d0a63d35af5c512215744f4d6d +DIST Python-3.11.3.tar.xz 19906156 BLAKE2B c23815e09a0012b2af03f3e18471389382978ef0991cb081c4c6410e98613589d47d3ad782c0a06a48ddd86fc5df7f1d59e93dbab5871b89559e225084544248 SHA512 a3bba4b69322a47bfeefe42ba0fd7331b5b67fd2ab41441e2219d16ef8c6f307f1a48977afd073c18cfd24ec6cb1bfe0c4bb4b273031eb524dc7e9fb5fbcc3b6 +DIST Python-3.11.3.tar.xz.asc 833 BLAKE2B 1846858480428293047bfaf87a74f5a6cf28227f63dbc36e658ab68444a5b91c2178fca42f35a413591103a0ceeea3cd5f8b757fb2f42cbcad023c62970ab950 SHA512 34bfb6e74e2bbec15bf3f653e32a3d705961b5f724e3f4713cf9b6b530f9c9e7e94f5cf855798bdf9763235b97a60ec9ad554d24cdc793e21a0c39540b5818d8 +DIST Python-3.11.7.tar.xz 20074108 BLAKE2B 3414118d30076e4223571825b5c595c5795422244de20dc70d07389a03b2c2b03b98a9ff562a8fd164db8f776dd741a9d7beb1c2ae4087ec6af677619a9dfd80 SHA512 11e06f2ffe1f66888cb5b4e9f607de815294d6863a77eda6ec6d7c724ef158df9f51881f4a956d4a6fa973c2fb6fd031d495e3496e9b0bb53793fb1cc8434c63 +DIST Python-3.11.7.tar.xz.asc 833 BLAKE2B 32d6984631d7b4b064e2c2588835a89098842a0ecc3d8ccb893830c9946124a159123e2082e6da3abcdb97d27dde0fb68c1fd11e4ed2bf2e0641fa95191354bb SHA512 7b342990c6e32897047f8ba33c4d264f1be987b73843b61bd7db08bfa1a7280c616e9dcd96225f37602f876549d011ff82a4d79f1e32a5ab7d7cc22651bba44f +DIST Python-3.12.3.tar.xz 20625068 BLAKE2B fc4f57ae50183db4c8cb37d94c37a7e58da5d031e03866841a678b986f01bbb8afdefb38124ba82b0a4988445b647214be43338dea13b0f063d3c2bf81c48c0b SHA512 4a2213b108e7f1f1525baa8348e68b2a2336d925e60d0a59f0225fc470768a2c8031edafc0b8243f94dbae18afda335ee5adf2785328c2218fd64cbb439f13a4 +DIST Python-3.12.3.tar.xz.asc 963 BLAKE2B f9668dde210793f8da0e0bb026b8ec3e0b4bc3abc58e72732f8faf356b19ca88a59b9d89b4b10f77b3602d9a967f0f2f44a0f091d698bc28ba9bad8049e5e006 SHA512 c291ec5b5e4f8deba867cc517624dd9a174745f04061ef737e58f3d52b9b30318264aec350e339fe88ccb493809ca1a90a378e86d86b8ec4a4f578b1a5843624 DIST Python-3.8.8.tar.xz 18271736 BLAKE2B af0ff1acd919b365a58278e82678324ff884cc8120bcaf12e0e3afb1bd978e6469e256335df131935f51ff481fb83dda04e4b6f1cd1746611f9ec944db73d692 SHA512 64181db5aa48281284a3230436ebfb8cb91b645a9dec956fd48c0048334498477073fc4e14d6b426d0ef7fbcdcfd5d59cbf01a504e6c9014dc9529494b9309fb DIST Python-3.8.8.tar.xz.asc 833 BLAKE2B a11188f9f68c518259de1a4e271bf56409d7356a7eb3dd8cbea7bbb0b5bc1b43f9aeb85bda4add65bbae906bef65cb20a30bcc77da04c0d383cd5b527821fd85 SHA512 0e6f11a310c1796dd056d9a4b63b5e03aa8dbd290088966e04a590a78c00003887dbfd7a7029a6cf8c5626ecd6ca91c1c16433bb0a41bf1225b02b8db8541b95 DIST Python-3.9.12.tar.xz 19740524 BLAKE2B 05f2469aa53ca36221ef4976b17bfde3e5b86afd5a8114e5a7fd899f975a8e55022555ef718d5352ab68de1b7b23865a0bf713768c9c2b30d591438c9a396d25 SHA512 081981901e14149748fd35228db0b3b1d96fef227ae7404f07b8bad0fda4b02649bf31c348c94aefdaf3327565d78f9489437c2c02f647b15d41376a27a23e97 @@ -7,10 +13,16 @@ DIST Python-3.9.12.tar.xz.asc 833 BLAKE2B 33436d0404a643215a8fd2b967ffd216201da2 DIST Python-3.9.6.tar.xz 19051972 BLAKE2B 0d8586b2935088eeab7138cf2210c1a74f1bf7359359d25750af5f69de55eb39c92f518b887a8b749c772ed7d33e85b912928ae6d878514eb58d85ef210f54f0 SHA512 01c529e3207738d8771caeb5ed6217e10745c21aa39832fe3185e1c87fdb6aedead97ce38dbb11e02d873654028bd8071c3f345c18452769520723284efe9dc1 DIST Python-3.9.6.tar.xz.asc 833 BLAKE2B 41901bfb80a901f2f14e86769e6d08ded8f75656d347201345183162e180e61442da871a1067572a54da579551166a19bf5436e51581bb10cb78afc4d28773fc SHA512 0673c8833f302c829bfde97453c52744f6aa99b4a72520f4cc384d4aa9d6ffd28a1407ceafb0a1ec4462b3aa74b656bf39c67872c4e6a131429ea58c47ad0ecc DIST python-gentoo-patches-3.10.4.tar.xz 8592 BLAKE2B 67fba3e1fedb17430e5cd93da995b4acaf714db512031b5a2f775a25f793f007941561663cfa413d645ccddc2e22d65d250a40fa166cafda8805488d877ff57d SHA512 3ed2b8ff8f1eb8febe7dcd4b5d13d6d54468be1d525f8f1118977d3bbc78f690a597b09383939d023b03380a306e4bff1693382e29ff562312d803305b1709b2 +DIST python-gentoo-patches-3.11.3.tar.xz 7776 BLAKE2B 78bf26f554c608c68826b9ea3c63a1df2b45bff755860f39f14306ebb63f17f5111b117519c4a9cb30452a62a14a3a7393798b8920c3d108ec8b6a30db88641e SHA512 64b79c90055fd940590b72ffd3744fe02ab9e46caf7b46f4aa1d074bf3e62d355e128bb2ac68c42f228f2e1bcdee2b0b114d9e2b9bf8427512083c1c5f8680e8 +DIST python-gentoo-patches-3.11.7_p1.tar.xz 8364 BLAKE2B 246da406e6d58d85ab2ef79dd3a018a134e473f90d42f8dd9274629f998a6129f3b03da228aa5e65c1b4508a71979ceb1f752a28066c356f813be21c30a40f70 SHA512 c5c1448a2e9b15b8084125e07cee288b667267779d89da8aab9df4b1d014739ba9af4d09e51b3cdc37e8942821d7aee0d1998e55820b67b83ef654d0a442767e +DIST python-gentoo-patches-3.12.3.tar.xz 6028 BLAKE2B 7953a48a1d95a6a33bd88060fbcac463a5469371aa0c882c3945f1fea64a63c4d45fca8451f51f4eaeea00a04267ad2e54e4cc720c95e8bb5a3477e00263b80a SHA512 4779bab2b24e59e4a77987ce3e9611d99e87c9c4d016309758c26a65fe2e11ef04d48d5af628c02b1552dc1f31b768f87448f8e19e716b4fe372941e6dacac3f DIST python-gentoo-patches-3.8.8_p1.tar.xz 15456 BLAKE2B 7d9f55f951f97ef7e08d0245dddd21f5b8d126735c1c392ba6326ad1c18023b477f62e9b6663d8e5b6f0362e442137d0b6ed3ea13b279cca6734d36dbe6e654f SHA512 7fff74d03a0c4cd4b5c977761179c2b9a0ed472847ee9544f54331cef7549557ac4d6b78e676058bd2b01c96ca59d84f04c55beca8ddc45f16b11ce349210eea DIST python-gentoo-patches-3.9.12.tar.xz 12848 BLAKE2B 5dd66fa94b136a463d2c4be3a5b7dfad770c3905467a1d81af02a35b2783ce7d614881c915ee8f8e764c1656963d6886d9c60c6e524f512e1bc496e42d01307b SHA512 07de63e47a8e547724099062239df8fcfd254f19d38be28131e6bbb094ffbab8483861fb6a5905e60d7fa7a1a5dc06785951fa31984ecad89516b0b742c47f91 DIST python-gentoo-patches-3.9.6_p1.tar.xz 12764 BLAKE2B 927718f1aadb5d5ef67e647a639a10bffdd48474bf01e50bd37ef1242bce57606b7b54c4823c1da3585ee76e737028163e38e9b4e19037585cc53f925e1c5fa7 SHA512 f06fb55786bd942e72e3225ee9ce218724aeee29f301279743588749007e991851a8f29db5b5dfd85435e3d763c00942947909a6fc60581bd0f3e8a6e913bff8 DIST python-prefix-gentoo-3.10.4-patches-r0.tar.xz 6772 BLAKE2B b807ae02242926d99c3823b73ce33193926d55891d54b5d214b4bdf24d2213b4d7b248030146a01698ceadd255affffef8937d84fc11e6d587ffcc91286e81b2 SHA512 a8f16d12b785a4b9ca884e4235cb298e4155273534a7957e517a679f0c2d4b35dcca08e445bed3fe2a80e3a6441f04004eae955a362eb1091ac1f9e2b9a5448f +DIST python-prefix-gentoo-3.11.3-patches-r3.tar.xz 5404 BLAKE2B 7c76056854361a4dad879218d2e0f60f874d534ac354c6b47158b5b0de18e5c66a522e717efa8a0a8a0ca3c77dbe5e9297a2ea17b725cb9c7e59478defd951ae SHA512 1bfb1c5e9b53c0b2f5d5fbf112c1742cc91a5cc3f505dc0d8d54683b508063be3578e3e6b8ad617bb0ea0a311b9235d862867ec4e9ca3fbcefcda98613235c72 +DIST python-prefix-gentoo-3.11.7-patches-r1.tar.xz 5752 BLAKE2B 8d6ee07491b23d1947af748b0178fd5c81cce78e77e2153480425d38a6b9badeb3b42cd635d340ddf50a451f977f04f498ac25ad1a18250ddae851aac06b9a0d SHA512 c5687c97a41c2e1ed0eacac987a7ea4b38bb8b60b91a16d2ea36ce9aad2f3360d25295951c083386b791b33f18267e545bfcb8280172f878736fef57d7188d0f +DIST python-prefix-gentoo-3.12.3-patches-r0.tar.xz 3464 BLAKE2B 965ccf0cc82b26e58adc332a2bcaa346578dfbec7abc1bed5451e0b8ac7c1e7612a7abe3ce757777f0fd6e38d1e0c7682c2ac3b617fb03fd2849686593b10e27 SHA512 a5648e7a9fc6fdc20f868d53c121d2e63ee370719b1b84d253df1fd472306879ab4b32d4d0685c576562ba6a8c06d3ac2250a8cbd44bbe2c7a1dd832e0c19d6d DIST python-prefix-gentoo-3.8.7-patches-r2.tar.xz 8312 BLAKE2B 268f3cff62dc51d4f91994c3f6b05cea0e29edb1ccf39476ba52485fb94c3cad72b54ed5cd941c227bdad004a7ae0069d60ee6bbde5a30d16115263d0dc2a5c3 SHA512 e43ce1e9e851bebce968ee025f765fc9a558c8edc4ee2d51616043183fd12301ab3d5c7f92915238e53b5cf92f6c00617ab0fcf9859d4cebe0966271e6f64725 DIST python-prefix-gentoo-3.9.12-patches-r1.tar.xz 7124 BLAKE2B afff1a574e13515084b0bee3aee1d0f0796ed885451086485f54f3c9a2498de6b4f403fdec1fe7fc5718a45fd89773720a4ef24d700b494337665b3f6d74e2de SHA512 4a12e8be1b38217d66e4a6374e09f93f956fdf4970130edcea2fedd6989c9a1af309fa939c213f8645676401c6d10b5e8789dbe902de9c03b8ea2b57c1632b72 DIST python-prefix-gentoo-3.9.6_p1-patches-r0.tar.xz 6984 BLAKE2B 8b032d3000fd2dfcb8e099ac071c1a911ba2a0e30343788f7191043800f9d0088307cd7007b2b3f6cc7d2f315fc22bbac5990fed81f0dd8d60dca0314bd59b88 SHA512 76c56895c99ee203bd266f475766d2572659939abaf478932e7c9c65ddc52cb5e012e23c9455dd0a4bf0281a07c70e23a2fea8337c693b8a4ac8abb534e21982 diff --git a/dev-lang/python/python-3.10.4.ebuild b/dev-lang/python/python-3.10.4.ebuild index 337fa138dd..fa646ffba1 100644 --- a/dev-lang/python/python-3.10.4.ebuild +++ b/dev-lang/python/python-3.10.4.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2022 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI="7" @@ -27,7 +27,7 @@ S="${WORKDIR}/${MY_P}" LICENSE="PSF-2" SLOT="${PYVER}" -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" IUSE="aqua bluetooth build examples gdbm hardened libedit lto +ncurses pgo +readline +sqlite +ssl test tk wininst +xml" RESTRICT="!test? ( test )" @@ -70,8 +70,8 @@ DEPEND=" " # autoconf-archive needed to eautoreconf BDEPEND=" - sys-devel/autoconf-archive - virtual/awk + dev-build/autoconf-archive + app-alternatives/awk virtual/pkgconfig verify-sig? ( sec-keys/openpgp-keys-python ) !sys-devel/gcc[libffi(-)] @@ -80,7 +80,7 @@ RDEPEND+=" build? ( app-misc/mime-types ) " -VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/python.org.asc # large file tests involve a 2.5G file being copied (duplicated) CHECKREQS_DISK_BUILD=5500M diff --git a/dev-lang/python/python-3.11.3.ebuild b/dev-lang/python/python-3.11.3.ebuild new file mode 100644 index 0000000000..39522bf64c --- /dev/null +++ b/dev-lang/python/python-3.11.3.ebuild @@ -0,0 +1,601 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" +WANT_LIBTOOL="none" + +inherit autotools check-reqs flag-o-matic multiprocessing pax-utils +inherit prefix python-utils-r1 toolchain-funcs verify-sig + +MY_PV=${PV/_rc/rc} +MY_P="Python-${MY_PV%_p*}" +PYVER=$(ver_cut 1-2) +PATCHSET="python-gentoo-patches-${MY_PV}" +PREFIX_PATCHSET="python-prefix-gentoo-${MY_PV}-patches-r3" + +DESCRIPTION="An interpreted, interactive, object-oriented programming language" +HOMEPAGE=" + https://www.python.org/ + https://github.com/python/cpython/ +" +SRC_URI=" + https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz + https://dev.gentoo.org/~grobian/distfiles/${PREFIX_PATCHSET}.tar.xz + verify-sig? ( + https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc + ) +" +S="${WORKDIR}/${MY_P}" + +LICENSE="PSF-2" +SLOT="${PYVER}" +KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" +IUSE=" + aqua + bluetooth build +ensurepip examples gdbm hardened libedit lto + +ncurses pgo +readline +sqlite +ssl test tk valgrind +" +RESTRICT="!test? ( test )" + +# Do not add a dependency on dev-lang/python to this ebuild. +# If you need to apply a patch which requires python for bootstrapping, please +# run the bootstrap code on your dev box and include the results in the +# patchset. See bug 447752. + +RDEPEND=" + app-arch/bzip2:= + app-arch/xz-utils:= + app-crypt/libb2 + >=dev-libs/expat-2.1:= + dev-libs/libffi:= + dev-python/gentoo-common + kernel_linux? ( sys-apps/util-linux:= ) + >=sys-libs/zlib-1.1.3:= + virtual/libcrypt:= + virtual/libintl + ensurepip? ( dev-python/ensurepip-wheels ) + gdbm? ( sys-libs/gdbm:=[berkdb] ) + ncurses? ( >=sys-libs/ncurses-5.2:= ) + readline? ( + !libedit? ( >=sys-libs/readline-4.1:= ) + libedit? ( dev-libs/libedit:= ) + ) + sqlite? ( >=dev-db/sqlite-3.3.8:3= ) + ssl? ( >=dev-libs/openssl-1.1.1:= ) + tk? ( + >=dev-lang/tcl-8.0:= + >=dev-lang/tk-8.0:= + dev-tcltk/blt:= + dev-tcltk/tix + ) + !!<sys-apps/sandbox-2.21 + elibc_Darwin? ( sys-libs/native-uuid ) + elibc_SunOS? ( sys-libs/libuuid ) +" +# bluetooth requires headers from bluez +DEPEND=" + ${RDEPEND} + bluetooth? ( net-wireless/bluez ) + test? ( app-arch/xz-utils[extra-filters(+)] ) + valgrind? ( dev-util/valgrind ) +" +# autoconf-archive needed to eautoreconf +BDEPEND=" + dev-build/autoconf-archive + app-alternatives/awk + virtual/pkgconfig + verify-sig? ( sec-keys/openpgp-keys-python ) +" +RDEPEND+=" + !build? ( app-misc/mime-types ) +" +if [[ ${PV} != *_alpha* ]]; then + RDEPEND+=" + dev-lang/python-exec[python_targets_python${PYVER/./_}(-)] + " +fi + +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/python.org.asc + +# large file tests involve a 2.5G file being copied (duplicated) +CHECKREQS_DISK_BUILD=5500M + +QA_PKGCONFIG_VERSION=${PYVER} +# false positives -- functions specific to *BSD +QA_CONFIG_IMPL_DECL_SKIP=( chflags lchflags ) + +pkg_pretend() { + use test && check-reqs_pkg_pretend +} + +pkg_setup() { + use test && check-reqs_pkg_setup +} + +src_unpack() { + if use verify-sig; then + verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc} + fi + default +} + +src_prepare() { + # Ensure that internal copies of expat and libffi are not used. + rm -r Modules/expat || die + rm -r Modules/_ctypes/libffi* || die + + local PATCHES=( + "${WORKDIR}/${PATCHSET}" + # Prefix' round of patches + "${WORKDIR}"/${PREFIX_PATCHSET} + ) + + default + + # https://bugs.gentoo.org/850151 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" setup.py || die + + # force the correct number of jobs + # https://bugs.gentoo.org/737660 + local jobs=$(makeopts_jobs) + sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die + sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die + + # workaround a problem on ppc-macos with >=GCC-8 where dtoa gets + # miscompiled when optimisation is being used + if [[ ${CHOST} == powerpc*-darwin* ]] && \ + tc-is-gcc && [[ $(gcc-major-version) -ge 8 ]] ; + then + sed -i \ + -e '/^CFLAGS_ALIASING=/s/$/ -fno-tree-ter/' Makefile.pre.in || die + fi + + # Darwin 9's kqueue seems to act up (at least at this stage), so + # make Python's selectors resort to poll() or select() + if [[ ${CHOST} == powerpc*-darwin9 ]] ; then + sed -i \ + -e 's/KQUEUE/KQUEUE_DISABLED/' \ + configure.ac configure || die + fi + + if [[ ${CHOST} == *-darwin19 ]] ; then + # HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH is set because + # _dyld_shared_cache_contains_path could be found, yet it cannot + # be resolved when dlopen()ing, so simply pretend it doesn't + # exist here + sed -i \ + -e 's/_dyld_shared_cache_contains_path/disabled&/' \ + configure.ac configure || die + fi + + if [[ ${CHOST} == *-solaris* ]] ; then + # OpenIndiana/Solaris 11 defines inet_aton no longer in + # libresolv, so use hstrerror to check if we need -lresolv + sed -i -e '/AC_CHECK_LIB/s/inet_aton/hstrerror/' \ + configure.ac configure || die + fi + + eautoreconf +} + +src_configure() { + local disable + # disable automagic bluetooth headers detection + if ! use bluetooth; then + local -x ac_cv_header_bluetooth_bluetooth_h=no + fi + + append-flags -fwrapv + filter-flags -malign-double + + # https://bugs.gentoo.org/700012 + if is-flagq -flto || is-flagq '-flto=*'; then + append-cflags $(test-flags-CC -ffat-lto-objects) + fi + + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. + # PKG_CONFIG needed for cross. + tc-export CXX PKG_CONFIG + + local dbmliborder= + if use gdbm; then + dbmliborder+="${dbmliborder:+:}gdbm" + fi + + if use pgo; then + local profile_task_flags=( + -m test + "-j$(makeopts_jobs)" + --pgo-extended + -u-network + + # We use a timeout because of how often we've had hang issues + # here. It also matches the default upstream PROFILE_TASK. + --timeout 1200 + + -x test_gdb + + # All of these seem to occasionally hang for PGO inconsistently + # They'll even hang here but be fine in src_test sometimes. + # bug #828535 (and related: bug #788022) + -x test_asyncio + -x test_httpservers + -x test_logging + -x test_multiprocessing_fork + -x test_socket + -x test_xmlrpc + + # Hangs (actually runs indefinitely executing itself w/ many cpython builds) + # bug #900429 + -x test_tools + ) + + if has_version "app-arch/rpm" ; then + # Avoid sandbox failure (attempts to write to /var/lib/rpm) + profile_task_flags+=( + -x test_distutils + ) + fi + local -x PROFILE_TASK="${profile_task_flags[*]}" + fi + + # flock on 32-bits sparc Solaris is broken + [[ ${CHOST} == sparc-*-solaris* ]] && \ + export ac_cv_flock_decl=no + + local myeconfargs=( + # glibc-2.30 removes it; since we can't cleanly force-rebuild + # Python on glibc upgrade, remove it proactively to give + # a chance for users rebuilding python before glibc + # except on non-glibc systems this breaks the build, so be + # conservative! + $(use elibc_glibc && echo ac_cv_header_stropts_h=no) + + $(use aqua && echo --config-cache) + --enable-shared + --without-static-libpython + --enable-ipv6 + --infodir='${prefix}/share/info' + --mandir='${prefix}/share/man' + --with-computed-gotos + --with-dbmliborder="${dbmliborder}" + --with-libc= + --enable-loadable-sqlite-extensions + --without-ensurepip + --with-system-expat + --with-system-ffi + --with-platlibdir=lib + --with-pkg-config=yes + --with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip + + $(use_with lto) + $(use_enable pgo optimizations) + $(use_with readline readline "$(usex libedit editline readline)") + $(use_with valgrind) + ) + + # disable implicit optimization/debugging flags + local -x OPT= + + if tc-is-cross-compiler ; then + # Hack to workaround get_libdir not being able to handle CBUILD, bug #794181 + local cbuild_libdir=$(unset PKG_CONFIG_PATH ; $(tc-getBUILD_PKG_CONFIG) --keep-system-libs --libs-only-L libffi) + + # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get + # propagated to sysconfig for built extensions + local -x CFLAGS_NODIST=${CFLAGS_FOR_BUILD} + local -x LDFLAGS_NODIST=${LDFLAGS_FOR_BUILD} + local -x CFLAGS= LDFLAGS= + + # We need to build our own Python on CBUILD first, and feed it in. + # bug #847910 + local myeconfargs_cbuild=( + "${myeconfargs[@]}" + + --libdir="${cbuild_libdir:2}" + + # Avoid needing to load the right libpython.so. + --disable-shared + + # As minimal as possible for the mini CBUILD Python + # we build just for cross to satisfy --with-build-python. + --without-lto + --without-readline + --disable-optimizations + ) + + myeconfargs+=( + # Point the imminent CHOST build to the Python we just + # built for CBUILD. + --with-build-python="${WORKDIR}"/${P}-${CBUILD}/python + ) + + mkdir "${WORKDIR}"/${P}-${CBUILD} || die + pushd "${WORKDIR}"/${P}-${CBUILD} &> /dev/null || die + # We disable _ctypes and _crypt for CBUILD because Python's setup.py can't handle locating + # libdir correctly for cross. + PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _ctypes _crypt" \ + ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}" + + # Avoid as many dependencies as possible for the cross build. + cat >> Makefile <<-EOF || die + MODULE_NIS_STATE=disabled + MODULE__DBM_STATE=disabled + MODULE__GDBM_STATE=disabled + MODULE__DBM_STATE=disabled + MODULE__SQLITE3_STATE=disabled + MODULE__HASHLIB_STATE=disabled + MODULE__SSL_STATE=disabled + MODULE__CURSES_STATE=disabled + MODULE__CURSES_PANEL_STATE=disabled + MODULE_READLINE_STATE=disabled + MODULE__TKINTER_STATE=disabled + MODULE_PYEXPAT_STATE=disabled + MODULE_ZLIB_STATE=disabled + EOF + + # Unfortunately, we do have to build this immediately, and + # not in src_compile, because CHOST configure for Python + # will check the existence of the --with-build-python value + # immediately. + PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _ctypes _crypt" emake + popd &> /dev/null || die + fi + + # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get + # propagated to sysconfig for built extensions + local -x CFLAGS_NODIST=${CFLAGS} + local -x LDFLAGS_NODIST=${LDFLAGS} + local -x CFLAGS= LDFLAGS= + + # Fix implicit declarations on cross and prefix builds. Bug #674070. + if use ncurses; then + append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw + fi + + if use aqua ; then + ECONF_SOURCE="${S}" OPT="" \ + econf \ + --enable-framework="${EPREFIX}" \ + --config-cache + fi + + hprefixify setup.py + econf "${myeconfargs[@]}" + + if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then + eerror "configure has detected that the sem_open function is broken." + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." + die "Broken sem_open function (bug 496328)" + fi + + # force-disable modules we don't want built + local disable_modules=( NIS ) + use gdbm || disable_modules+=( _GDBM _DBM ) + use sqlite || disable_modules+=( _SQLITE3 ) + use ssl || disable_modules+=( _HASHLIB _SSL ) + use ncurses || disable_modules+=( _CURSES _CURSES_PANEL ) + use readline || disable_modules+=( READLINE ) + use tk || disable_modules+=( _TKINTER ) + use kernel_linux || disable_modules+=( OSSAUDIODEV ) + [[ ${CHOST} == *-apple-darwin* ]] && disable_modules+=( _SCPROXY ) + + local mod + for mod in "${disable_modules[@]}"; do + echo "MODULE_${mod}_STATE=disabled" + done >> Makefile || die + + # install epython.py as part of stdlib + echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die +} + +src_compile() { + # Ensure sed works as expected + # https://bugs.gentoo.org/594768 + local -x LC_ALL=C + # Prevent using distutils bundled by setuptools. + # https://bugs.gentoo.org/823728 + export SETUPTOOLS_USE_DISTUTILS=stdlib + export PYTHONSTRICTEXTENSIONBUILD=1 + + # Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't + # end up writing bytecode & violating sandbox. + # bug #831897 + local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE} + + if use pgo ; then + # bug 660358 + local -x COLUMNS=80 + local -x PYTHONDONTWRITEBYTECODE= + + addpredict "/usr/lib/python${PYVER}/site-packages" + fi + + # also need to clear the flags explicitly here or they end up + # in _sysconfigdata* + emake CPPFLAGS= CFLAGS= LDFLAGS= + + # Restore saved value from above. + local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE} + + # Work around bug 329499. See also bug 413751 and 457194. + if has_version dev-libs/libffi[pax-kernel]; then + pax-mark E python + else + pax-mark m python + fi +} + +src_test() { + # Tests will not work when cross compiling. + if tc-is-cross-compiler; then + elog "Disabling tests due to crosscompiling." + return + fi + + # this just happens to skip test_support.test_freeze that is broken + # without bundled expat + # TODO: get a proper skip for it upstream + local -x LOGNAME=buildbot + + local test_opts=( + -u-network + -j "$(makeopts_jobs)" + + # fails + -x test_gdb + ) + + if use sparc ; then + # bug #788022 + test_opts+=( + -x test_multiprocessing_fork + -x test_multiprocessing_forkserver + ) + fi + + # workaround docutils breaking tests + cat > Lib/docutils.py <<-EOF || die + raise ImportError("Thou shalt not import!") + EOF + + # bug 660358 + local -x COLUMNS=80 + local -x PYTHONDONTWRITEBYTECODE= + # workaround https://bugs.gentoo.org/775416 + addwrite "/usr/lib/python${PYVER}/site-packages" + + nonfatal emake test EXTRATESTOPTS="${test_opts[*]}" \ + CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty + local ret=${?} + + rm Lib/docutils.py || die + + [[ ${ret} -eq 0 ]] || die "emake test failed" +} + +src_install() { + local libdir=${ED}/usr/lib/python${PYVER} + + # -j1 hack for now for bug #843458 + emake -j1 DESTDIR="${D}" altinstall + + if use aqua ; then + # avoid config.status to be triggered + find Mac -name "Makefile" -exec touch \{\} + || die + + # Python_Launcher is kind of a wrapper, and we should fix it for + # Prefix (it uses /usr/bin/pythonw) so useless + # IDLE doesn't run, no idea, but definitely not used + emake DESTDIR="${D}" -C Mac install_Python || die + rmdir "${ED}"/Applications/Python* || die + rmdir "${ED}"/Applications || die + + local fwdir=/Frameworks/Python.framework/Versions/${PYVER} + ln -s "${EPREFIX}"/usr/include/python${PYVER} \ + "${ED}${fwdir}"/Headers || die + ln -s "${EPREFIX}"/usr/lib/libpython${PYVER}.dylib \ + "${ED}${fwdir}"/Python || die + fi + + # Fix collisions between different slots of Python. + rm -f "${ED}/usr/$(get_libdir)/libpython3$(get_libname)" || die + + # Cheap hack to get version with ABIFLAGS + local abiver=$(cd "${ED}/usr/include"; echo python*) + if [[ ${abiver} != python${PYVER} ]]; then + # Replace python3.X with a symlink to python3.Xm + rm "${ED}/usr/bin/python${PYVER}" || die + dosym "${abiver}" "/usr/bin/python${PYVER}" + # Create python3.X-config symlink + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" + # Create python-3.5m.pc symlink + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" + fi + + # python seems to get rebuilt in src_install (bug 569908) + # Work around it for now. + if has_version dev-libs/libffi[pax-kernel]; then + pax-mark E "${ED}/usr/bin/${abiver}" + else + pax-mark m "${ED}/usr/bin/${abiver}" + fi + + rm -r "${libdir}"/ensurepip/_bundled || die + if ! use ensurepip; then + rm -r "${libdir}"/ensurepip || die + fi + if ! use sqlite; then + rm -r "${libdir}/"sqlite3 || die + fi + if ! use tk; then + rm -r "${ED}/usr/bin/idle${PYVER}" || die + rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die + fi + + ln -s ../python/EXTERNALLY-MANAGED "${libdir}/EXTERNALLY-MANAGED" || die + + dodoc Misc/{ACKS,HISTORY,NEWS} + + if use examples; then + docinto examples + find Tools -name __pycache__ -exec rm -fr {} + || die + dodoc -r Tools + fi + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 + local libname=$( + printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | + emake --no-print-directory -s -f - 2>/dev/null + ) + newins Tools/gdb/libpython.py "${libname}"-gdb.py + + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} + sed \ + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ + -e "s:@PYDOC@:pydoc${PYVER}:" \ + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" + + # python-exec wrapping support + local pymajor=${PYVER%.*} + local EPYTHON=python${PYVER} + local scriptdir=${D}$(python_get_scriptdir) + mkdir -p "${scriptdir}" || die + # python and pythonX + ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die + ln -s "python${pymajor}" "${scriptdir}/python" || die + # python-config and pythonX-config + # note: we need to create a wrapper rather than symlinking it due + # to some random dirname(argv[0]) magic performed by python-config + cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die + #!/bin/sh + exec "${abiver}-config" "\${@}" + EOF + chmod +x "${scriptdir}/python${pymajor}-config" || die + ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die + # 2to3, pydoc + ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die + ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die + # idle + if use tk; then + ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die + fi +} + +pkg_postinst() { + local v + for v in ${REPLACING_VERSIONS}; do + if ver_test "${v}" -lt 3.11.0_beta4-r2; then + ewarn "Python 3.11.0b4 has changed its module ABI. The .pyc files" + ewarn "installed previously are no longer valid and will be regenerated" + ewarn "(or ignored) on the next import. This may cause sandbox failures" + ewarn "when installing some packages and checksum mismatches when removing" + ewarn "old versions. To actively prevent this, rebuild all packages" + ewarn "installing Python 3.11 modules, e.g. using:" + ewarn + ewarn " emerge -1v /usr/lib/python3.11/site-packages" + fi + done +} diff --git a/dev-lang/python/python-3.11.7.ebuild b/dev-lang/python/python-3.11.7.ebuild new file mode 100644 index 0000000000..6c8c839266 --- /dev/null +++ b/dev-lang/python/python-3.11.7.ebuild @@ -0,0 +1,606 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" +WANT_LIBTOOL="none" + +inherit autotools check-reqs flag-o-matic multiprocessing pax-utils +inherit prefix python-utils-r1 toolchain-funcs verify-sig + +MY_PV=${PV/_rc/rc} +MY_P="Python-${MY_PV%_p*}" +PYVER=$(ver_cut 1-2) +PATCHSET="python-gentoo-patches-${MY_PV}_p1" +PREFIX_PATCHSET="python-prefix-gentoo-${MY_PV}-patches-r1" + +DESCRIPTION="An interpreted, interactive, object-oriented programming language" +HOMEPAGE=" + https://www.python.org/ + https://github.com/python/cpython/ +" +SRC_URI=" + https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz + https://dev.gentoo.org/~grobian/distfiles/${PREFIX_PATCHSET}.tar.xz + verify-sig? ( + https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc + ) +" +S="${WORKDIR}/${MY_P}" + +LICENSE="PSF-2" +SLOT="${PYVER}" +KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" +IUSE=" + aqua + bluetooth build debug +ensurepip examples gdbm libedit + +ncurses pgo +readline +sqlite +ssl test tk valgrind +" +RESTRICT="!test? ( test )" + +# Do not add a dependency on dev-lang/python to this ebuild. +# If you need to apply a patch which requires python for bootstrapping, please +# run the bootstrap code on your dev box and include the results in the +# patchset. See bug 447752. + +RDEPEND=" + app-arch/bzip2:= + app-arch/xz-utils:= + app-crypt/libb2 + >=dev-libs/expat-2.1:= + dev-libs/libffi:= + dev-python/gentoo-common + >=sys-libs/zlib-1.1.3:= + virtual/libcrypt:= + virtual/libintl + ensurepip? ( dev-python/ensurepip-wheels ) + gdbm? ( sys-libs/gdbm:=[berkdb] ) + kernel_linux? ( sys-apps/util-linux:= ) + ncurses? ( >=sys-libs/ncurses-5.2:= ) + readline? ( + !libedit? ( >=sys-libs/readline-4.1:= ) + libedit? ( dev-libs/libedit:= ) + ) + sqlite? ( >=dev-db/sqlite-3.3.8:3= ) + ssl? ( >=dev-libs/openssl-1.1.1:= ) + tk? ( + >=dev-lang/tcl-8.0:= + >=dev-lang/tk-8.0:= + dev-tcltk/blt:= + dev-tcltk/tix + ) + elibc_Darwin? ( sys-libs/native-uuid ) + elibc_SunOS? ( sys-libs/libuuid ) +" +# bluetooth requires headers from bluez +DEPEND=" + ${RDEPEND} + bluetooth? ( net-wireless/bluez ) + test? ( app-arch/xz-utils ) + valgrind? ( dev-debug/valgrind ) +" +# autoconf-archive needed to eautoreconf +BDEPEND=" + dev-build/autoconf-archive + app-alternatives/awk + virtual/pkgconfig + verify-sig? ( sec-keys/openpgp-keys-python ) +" +RDEPEND+=" + !build? ( app-misc/mime-types ) +" +if [[ ${PV} != *_alpha* ]]; then + RDEPEND+=" + dev-lang/python-exec[python_targets_python${PYVER/./_}(-)] + " +fi + +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/python.org.asc + +# large file tests involve a 2.5G file being copied (duplicated) +CHECKREQS_DISK_BUILD=5500M + +QA_PKGCONFIG_VERSION=${PYVER} +# false positives -- functions specific to *BSD +QA_CONFIG_IMPL_DECL_SKIP=( chflags lchflags ) + +pkg_pretend() { + use test && check-reqs_pkg_pretend +} + +pkg_setup() { + use test && check-reqs_pkg_setup +} + +src_unpack() { + if use verify-sig; then + verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc} + fi + default +} + +src_prepare() { + local PATCHES=( + "${WORKDIR}/${PATCHSET}" + # Prefix' round of patches + "${WORKDIR}"/${PREFIX_PATCHSET} + ) + + default + + # https://bugs.gentoo.org/850151 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" setup.py || die + + # enable this to create a pre-patched (prefix bootstrap) tree + if [[ -n ${GENTOO_PREFIX_CREATE_TAR} ]] ; then + eautoreconf + tarfile="${T}"/Python-${PV}-gentoo-prefix-patched.tar.xz + tar --numeric-owner -Jcf "${tarfile}" -C .. Python-${PV} + die "${tarfile}" + fi + + # Ensure that internal copies of expat and libffi are not used. + rm -r Modules/expat || die + rm -r Modules/_ctypes/libffi* || die + + # force the correct number of jobs + # https://bugs.gentoo.org/737660 + local jobs=$(makeopts_jobs) + sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die + sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die + + # workaround a problem on ppc-macos with >=GCC-8 where dtoa gets + # miscompiled when optimisation is being used + if [[ ${CHOST} == powerpc*-darwin* ]] && \ + tc-is-gcc && [[ $(gcc-major-version) -ge 8 ]] ; + then + sed -i \ + -e '/^CFLAGS_ALIASING=/s/$/ -fno-tree-ter/' Makefile.pre.in || die + fi + + if [[ ${CHOST} == *-solaris* ]] ; then + # OpenIndiana/Solaris 11 defines inet_aton no longer in + # libresolv, so use hstrerror to check if we need -lresolv + sed -i -e '/AC_CHECK_LIB/s/inet_aton/hstrerror/' \ + configure.ac configure || die + fi + + eautoreconf +} + +build_cbuild_python() { + # Hack to workaround get_libdir not being able to handle CBUILD, bug #794181 + local cbuild_libdir=$(unset PKG_CONFIG_PATH ; $(tc-getBUILD_PKG_CONFIG) --keep-system-libs --libs-only-L libffi) + + # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get + # propagated to sysconfig for built extensions + # + # -fno-lto to avoid bug #700012 (not like it matters for mini-CBUILD Python anyway) + local -x CFLAGS_NODIST="${BUILD_CFLAGS} -fno-lto" + local -x LDFLAGS_NODIST=${BUILD_LDFLAGS} + local -x CFLAGS= LDFLAGS= + local -x BUILD_CFLAGS="${CFLAGS_NODIST}" + local -x BUILD_LDFLAGS=${LDFLAGS_NODIST} + + # We need to build our own Python on CBUILD first, and feed it in. + # bug #847910 + local myeconfargs_cbuild=( + "${myeconfargs[@]}" + + --prefix="${BROOT}"/usr + --libdir="${cbuild_libdir:2}" + + # Avoid needing to load the right libpython.so. + --disable-shared + + # As minimal as possible for the mini CBUILD Python + # we build just for cross to satisfy --with-build-python. + --without-lto + --without-readline + --disable-optimizations + ) + + mkdir "${WORKDIR}"/${P}-${CBUILD} || die + pushd "${WORKDIR}"/${P}-${CBUILD} &> /dev/null || die + # We disable _ctypes and _crypt for CBUILD because Python's setup.py can't handle locating + # libdir correctly for cross. + PYTHON_DISABLE_MODULES+=" _ctypes _crypt" \ + ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}" + + # Avoid as many dependencies as possible for the cross build. + cat >> Makefile <<-EOF || die + MODULE_NIS_STATE=disabled + MODULE__DBM_STATE=disabled + MODULE__GDBM_STATE=disabled + MODULE__DBM_STATE=disabled + MODULE__SQLITE3_STATE=disabled + MODULE__HASHLIB_STATE=disabled + MODULE__SSL_STATE=disabled + MODULE__CURSES_STATE=disabled + MODULE__CURSES_PANEL_STATE=disabled + MODULE_READLINE_STATE=disabled + MODULE__TKINTER_STATE=disabled + MODULE_PYEXPAT_STATE=disabled + MODULE_ZLIB_STATE=disabled + EOF + + # Unfortunately, we do have to build this immediately, and + # not in src_compile, because CHOST configure for Python + # will check the existence of the --with-build-python value + # immediately. + PYTHON_DISABLE_MODULES+=" _ctypes _crypt" emake + popd &> /dev/null || die +} + +src_configure() { + # disable automagic bluetooth headers detection + if ! use bluetooth; then + local -x ac_cv_header_bluetooth_bluetooth_h=no + fi + + append-flags -fwrapv + filter-flags -malign-double + + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. + # PKG_CONFIG needed for cross. + tc-export CXX PKG_CONFIG + + local dbmliborder= + if use gdbm; then + dbmliborder+="${dbmliborder:+:}gdbm" + fi + + if use pgo; then + local profile_task_flags=( + -m test + "-j$(makeopts_jobs)" + --pgo-extended + -u-network + + # We use a timeout because of how often we've had hang issues + # here. It also matches the default upstream PROFILE_TASK. + --timeout 1200 + + -x test_gdb + -x test_dtrace + + # All of these seem to occasionally hang for PGO inconsistently + # They'll even hang here but be fine in src_test sometimes. + # bug #828535 (and related: bug #788022) + -x test_asyncio + -x test_httpservers + -x test_logging + -x test_multiprocessing_fork + -x test_socket + -x test_xmlrpc + + # Hangs (actually runs indefinitely executing itself w/ many cpython builds) + # bug #900429 + -x test_tools + ) + + if has_version "app-arch/rpm" ; then + # Avoid sandbox failure (attempts to write to /var/lib/rpm) + profile_task_flags+=( + -x test_distutils + ) + fi + local -x PROFILE_TASK="${profile_task_flags[*]}" + fi + + # flock on 32-bits sparc Solaris is broken + [[ ${CHOST} == sparc-*-solaris* ]] && \ + export ac_cv_flock_decl=no + # Darwin 9's kqueue seems to act up (at least at this stage), so + # make Python's selectors resort to poll() or select() + [[ ${CHOST} == powerpc*-darwin9 ]] && \ + export ac_cv_func_kqueue=no + + local myeconfargs=( + # glibc-2.30 removes it; since we can't cleanly force-rebuild + # Python on glibc upgrade, remove it proactively to give + # a chance for users rebuilding python before glibc + # except on non-glibc systems this breaks the build, so be + # conservative! + $(use elibc_glibc && echo ac_cv_header_stropts_h=no) + + $(use aqua && echo --config-cache) + --enable-shared + --without-static-libpython + --enable-ipv6 + --infodir='${prefix}/share/info' + --mandir='${prefix}/share/man' + --with-computed-gotos + --with-dbmliborder="${dbmliborder}" + --with-libc= + --enable-loadable-sqlite-extensions + --without-ensurepip + --without-lto + --with-system-expat + --with-system-ffi + --with-platlibdir=lib + --with-pkg-config=yes + --with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip + + $(use_with debug assertions) + $(use_enable pgo optimizations) + $(use_with readline readline "$(usex libedit editline readline)") + $(use_with valgrind) + ) + + # disable implicit optimization/debugging flags + local -x OPT= + + # https://bugs.gentoo.org/700012 + if tc-is-lto; then + append-cflags $(test-flags-CC -ffat-lto-objects) + myeconfargs+=( + --with-lto + ) + fi + + if tc-is-cross-compiler ; then + build_cbuild_python + myeconfargs+=( + # Point the imminent CHOST build to the Python we just + # built for CBUILD. + --with-build-python="${WORKDIR}"/${P}-${CBUILD}/python + ) + fi + + # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get + # propagated to sysconfig for built extensions + local -x CFLAGS_NODIST=${CFLAGS} + local -x LDFLAGS_NODIST=${LDFLAGS} + local -x CFLAGS= LDFLAGS= + + # Fix implicit declarations on cross and prefix builds. Bug #674070. + if use ncurses; then + append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw + fi + + if use aqua ; then + ECONF_SOURCE="${S}" OPT="" \ + econf \ + --enable-framework="${EPREFIX}" \ + --config-cache + fi + + hprefixify setup.py + econf "${myeconfargs[@]}" + + if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then + eerror "configure has detected that the sem_open function is broken." + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." + die "Broken sem_open function (bug 496328)" + fi + + # force-disable modules we don't want built + local disable_modules=( NIS ) + use gdbm || disable_modules+=( _GDBM _DBM ) + use sqlite || disable_modules+=( _SQLITE3 ) + use ssl || disable_modules+=( _HASHLIB _SSL ) + use ncurses || disable_modules+=( _CURSES _CURSES_PANEL ) + use readline || disable_modules+=( READLINE ) + use tk || disable_modules+=( _TKINTER ) + use kernel_linux || disable_modules+=( OSSAUDIODEV ) + [[ ${CHOST} == *-apple-darwin* ]] && disable_modules+=( _SCPROXY ) + + local mod + for mod in "${disable_modules[@]}"; do + echo "MODULE_${mod}_STATE=disabled" + done >> Makefile || die + + # install epython.py as part of stdlib + echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die +} + +src_compile() { + # Ensure sed works as expected + # https://bugs.gentoo.org/594768 + local -x LC_ALL=C + # Prevent using distutils bundled by setuptools. + # https://bugs.gentoo.org/823728 + export SETUPTOOLS_USE_DISTUTILS=stdlib + export PYTHONSTRICTEXTENSIONBUILD=1 + + # Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't + # end up writing bytecode & violating sandbox. + # bug #831897 + local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE} + + if use pgo ; then + # bug 660358 + local -x COLUMNS=80 + local -x PYTHONDONTWRITEBYTECODE= + + addpredict "/usr/lib/python${PYVER}/site-packages" + fi + + # also need to clear the flags explicitly here or they end up + # in _sysconfigdata* + emake CPPFLAGS= CFLAGS= LDFLAGS= + + # Restore saved value from above. + local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE} + + # Work around bug 329499. See also bug 413751 and 457194. + if has_version dev-libs/libffi[pax-kernel]; then + pax-mark E python + else + pax-mark m python + fi +} + +src_test() { + # Tests will not work when cross compiling. + if tc-is-cross-compiler; then + elog "Disabling tests due to crosscompiling." + return + fi + + # this just happens to skip test_support.test_freeze that is broken + # without bundled expat + # TODO: get a proper skip for it upstream + local -x LOGNAME=buildbot + + local test_opts=( + -u-network + -j "$(makeopts_jobs)" + + # fails + -x test_gdb + ) + + if use sparc ; then + # bug #788022 + test_opts+=( + -x test_multiprocessing_fork + -x test_multiprocessing_forkserver + ) + fi + + # workaround docutils breaking tests + cat > Lib/docutils.py <<-EOF || die + raise ImportError("Thou shalt not import!") + EOF + + # bug 660358 + local -x COLUMNS=80 + local -x PYTHONDONTWRITEBYTECODE= + # workaround https://bugs.gentoo.org/775416 + addwrite "/usr/lib/python${PYVER}/site-packages" + + nonfatal emake test EXTRATESTOPTS="${test_opts[*]}" \ + CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty + local ret=${?} + + rm Lib/docutils.py || die + + [[ ${ret} -eq 0 ]] || die "emake test failed" +} + +src_install() { + local libdir=${ED}/usr/lib/python${PYVER} + + # -j1 hack for now for bug #843458 + emake -j1 DESTDIR="${D}" altinstall + + if use aqua ; then + # avoid config.status to be triggered + find Mac -name "Makefile" -exec touch \{\} + || die + + # Python_Launcher is kind of a wrapper, and we should fix it for + # Prefix (it uses /usr/bin/pythonw) so useless + # IDLE doesn't run, no idea, but definitely not used + emake DESTDIR="${D}" -C Mac install_Python || die + rmdir "${ED}"/Applications/Python* || die + rmdir "${ED}"/Applications || die + + local fwdir=/Frameworks/Python.framework/Versions/${PYVER} + ln -s "${EPREFIX}"/usr/include/python${PYVER} \ + "${ED}${fwdir}"/Headers || die + ln -s "${EPREFIX}"/usr/lib/libpython${PYVER}.dylib \ + "${ED}${fwdir}"/Python || die + fi + + # Fix collisions between different slots of Python. + rm -f "${ED}/usr/$(get_libdir)/libpython3$(get_libname)" || die + + # Cheap hack to get version with ABIFLAGS + local abiver=$(cd "${ED}/usr/include"; echo python*) + if [[ ${abiver} != python${PYVER} ]]; then + # Replace python3.X with a symlink to python3.Xm + rm "${ED}/usr/bin/python${PYVER}" || die + dosym "${abiver}" "/usr/bin/python${PYVER}" + # Create python3.X-config symlink + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" + # Create python-3.5m.pc symlink + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" + fi + + # python seems to get rebuilt in src_install (bug 569908) + # Work around it for now. + if has_version dev-libs/libffi[pax-kernel]; then + pax-mark E "${ED}/usr/bin/${abiver}" + else + pax-mark m "${ED}/usr/bin/${abiver}" + fi + + rm -r "${libdir}"/ensurepip/_bundled || die + if ! use ensurepip; then + rm -r "${libdir}"/ensurepip || die + fi + if ! use sqlite; then + rm -r "${libdir}/"sqlite3 || die + fi + if ! use tk; then + rm -r "${ED}/usr/bin/idle${PYVER}" || die + rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die + fi + + ln -s ../python/EXTERNALLY-MANAGED "${libdir}/EXTERNALLY-MANAGED" || die + + dodoc Misc/{ACKS,HISTORY,NEWS} + + if use examples; then + docinto examples + find Tools -name __pycache__ -exec rm -fr {} + || die + dodoc -r Tools + fi + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 + local libname=$( + printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | + emake --no-print-directory -s -f - 2>/dev/null + ) + newins Tools/gdb/libpython.py "${libname}"-gdb.py + + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} + sed \ + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ + -e "s:@PYDOC@:pydoc${PYVER}:" \ + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" + + # python-exec wrapping support + local pymajor=${PYVER%.*} + local EPYTHON=python${PYVER} + local scriptdir=${D}$(python_get_scriptdir) + mkdir -p "${scriptdir}" || die + # python and pythonX + ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die + ln -s "python${pymajor}" "${scriptdir}/python" || die + # python-config and pythonX-config + # note: we need to create a wrapper rather than symlinking it due + # to some random dirname(argv[0]) magic performed by python-config + cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die + #!/bin/sh + exec "${abiver}-config" "\${@}" + EOF + chmod +x "${scriptdir}/python${pymajor}-config" || die + ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die + # 2to3, pydoc + ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die + ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die + # idle + if use tk; then + ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die + fi +} + +pkg_postinst() { + local v + for v in ${REPLACING_VERSIONS}; do + if ver_test "${v}" -lt 3.11.0_beta4-r2; then + ewarn "Python 3.11.0b4 has changed its module ABI. The .pyc files" + ewarn "installed previously are no longer valid and will be regenerated" + ewarn "(or ignored) on the next import. This may cause sandbox failures" + ewarn "when installing some packages and checksum mismatches when removing" + ewarn "old versions. To actively prevent this, rebuild all packages" + ewarn "installing Python 3.11 modules, e.g. using:" + ewarn + ewarn " emerge -1v /usr/lib/python3.11/site-packages" + fi + done +} diff --git a/dev-lang/python/python-3.12.3.ebuild b/dev-lang/python/python-3.12.3.ebuild new file mode 100644 index 0000000000..01e1834a66 --- /dev/null +++ b/dev-lang/python/python-3.12.3.ebuild @@ -0,0 +1,605 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="8" +WANT_LIBTOOL="none" + +inherit autotools check-reqs flag-o-matic multiprocessing pax-utils +inherit prefix python-utils-r1 toolchain-funcs verify-sig + +MY_PV=${PV/_rc/rc} +MY_P="Python-${MY_PV%_p*}" +PYVER=$(ver_cut 1-2) +PATCHSET="python-gentoo-patches-${MY_PV}" +PREFIX_PATCHSET="python-prefix-gentoo-${MY_PV%_p*}-patches-r0" + +DESCRIPTION="An interpreted, interactive, object-oriented programming language" +HOMEPAGE=" + https://www.python.org/ + https://github.com/python/cpython/ +" +SRC_URI=" + https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz + https://dev.gentoo.org/~grobian/distfiles/${PREFIX_PATCHSET}.tar.xz + verify-sig? ( + https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc + ) +" +S="${WORKDIR}/${MY_P}" + +LICENSE="PSF-2" +SLOT="${PYVER}" +KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" +IUSE=" + aqua + bluetooth build debug +ensurepip examples gdbm libedit + +ncurses pgo +readline +sqlite +ssl test tk valgrind +" +RESTRICT="!test? ( test )" + +# Do not add a dependency on dev-lang/python to this ebuild. +# If you need to apply a patch which requires python for bootstrapping, please +# run the bootstrap code on your dev box and include the results in the +# patchset. See bug 447752. + +RDEPEND=" + app-arch/bzip2:= + app-arch/xz-utils:= + app-crypt/libb2 + >=dev-libs/expat-2.1:= + dev-libs/libffi:= + dev-python/gentoo-common + >=sys-libs/zlib-1.1.3:= + virtual/libcrypt:= + virtual/libintl + ensurepip? ( dev-python/ensurepip-pip ) + gdbm? ( sys-libs/gdbm:=[berkdb] ) + kernel_linux? ( sys-apps/util-linux:= ) + ncurses? ( >=sys-libs/ncurses-5.2:= ) + readline? ( + !libedit? ( >=sys-libs/readline-4.1:= ) + libedit? ( dev-libs/libedit:= ) + ) + sqlite? ( >=dev-db/sqlite-3.3.8:3= ) + ssl? ( >=dev-libs/openssl-1.1.1:= ) + tk? ( + >=dev-lang/tcl-8.0:= + >=dev-lang/tk-8.0:= + dev-tcltk/blt:= + dev-tcltk/tix + ) + elibc_Darwin? ( sys-libs/native-uuid ) + elibc_SunOS? ( sys-libs/libuuid ) +" +# bluetooth requires headers from bluez +DEPEND=" + ${RDEPEND} + bluetooth? ( net-wireless/bluez ) + test? ( + app-arch/xz-utils + dev-python/ensurepip-pip + dev-python/ensurepip-setuptools + dev-python/ensurepip-wheel + ) + valgrind? ( dev-debug/valgrind ) +" +# autoconf-archive needed to eautoreconf +BDEPEND=" + dev-build/autoconf-archive + app-alternatives/awk + virtual/pkgconfig + verify-sig? ( >=sec-keys/openpgp-keys-python-20221025 ) +" +RDEPEND+=" + !build? ( app-misc/mime-types ) +" +if [[ ${PV} != *_alpha* ]]; then + RDEPEND+=" + dev-lang/python-exec[python_targets_python${PYVER/./_}(-)] + " +fi + +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/python.org.asc + +# large file tests involve a 2.5G file being copied (duplicated) +CHECKREQS_DISK_BUILD=5500M + +QA_PKGCONFIG_VERSION=${PYVER} +# false positives -- functions specific to *BSD +QA_CONFIG_IMPL_DECL_SKIP=( chflags lchflags ) + +pkg_pretend() { + use test && check-reqs_pkg_pretend +} + +pkg_setup() { + use test && check-reqs_pkg_setup +} + +src_unpack() { + if use verify-sig; then + verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc} + fi + default +} + +src_prepare() { + # Ensure that internal copies of expat and libffi are not used. + # TODO: Makefile has annoying deps on expat headers + #rm -r Modules/expat || die + + local PATCHES=( + "${WORKDIR}/${PATCHSET}" + # Prefix' round of patches + "${WORKDIR}"/${PREFIX_PATCHSET} + ) + + default + + # enable this to create a pre-patched (prefix bootstrap) tree + if [[ -n ${GENTOO_PREFIX_CREATE_TAR} ]] ; then + eautoreconf + tarfile="${T}"/Python-${PV}-gentoo-prefix-patched.tar.xz + tar --numeric-owner -Jcf "${tarfile}" -C .. Python-${PV} + die "${tarfile}" + fi + + # force the correct number of jobs + # https://bugs.gentoo.org/737660 + sed -i -e "s:-j0:-j$(makeopts_jobs):" Makefile.pre.in || die + # workaround a problem on ppc-macos with >=GCC-8 where dtoa gets + # miscompiled when optimisation is being used + if [[ ${CHOST} == powerpc*-darwin* ]] && \ + tc-is-gcc && [[ $(gcc-major-version) -ge 8 ]] ; + then + sed -i \ + -e '/^CFLAGS_ALIASING=/s/$/ -fno-tree-ter/' Makefile.pre.in || die + fi + + if [[ ${CHOST} == *-solaris* ]] ; then + # OpenIndiana/Solaris 11 defines inet_aton no longer in + # libresolv, so use hstrerror to check if we need -lresolv + sed -i -e '/AC_CHECK_LIB/s/inet_aton/hstrerror/' \ + configure.ac configure || die + fi + + eautoreconf +} + +build_cbuild_python() { + # Hack to workaround get_libdir not being able to handle CBUILD, bug #794181 + local cbuild_libdir=$(unset PKG_CONFIG_PATH ; $(tc-getBUILD_PKG_CONFIG) --keep-system-libs --libs-only-L libffi) + + # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get + # propagated to sysconfig for built extensions + # + # -fno-lto to avoid bug #700012 (not like it matters for mini-CBUILD Python anyway) + local -x CFLAGS_NODIST="${BUILD_CFLAGS} -fno-lto" + local -x LDFLAGS_NODIST=${BUILD_LDFLAGS} + local -x CFLAGS= LDFLAGS= + local -x BUILD_CFLAGS="${CFLAGS_NODIST}" + local -x BUILD_LDFLAGS=${LDFLAGS_NODIST} + + # We need to build our own Python on CBUILD first, and feed it in. + # bug #847910 + local myeconfargs_cbuild=( + "${myeconfargs[@]}" + + --prefix="${BROOT}"/usr + --libdir="${cbuild_libdir:2}" + + # Avoid needing to load the right libpython.so. + --disable-shared + + # As minimal as possible for the mini CBUILD Python + # we build just for cross to satisfy --with-build-python. + --without-lto + --without-readline + --disable-optimizations + ) + + mkdir "${WORKDIR}"/${P}-${CBUILD} || die + pushd "${WORKDIR}"/${P}-${CBUILD} &> /dev/null || die + + # Avoid as many dependencies as possible for the cross build. + mkdir Modules || die + cat > Modules/Setup.local <<-EOF || die + *disabled* + nis + _dbm _gdbm + _sqlite3 + _hashlib _ssl + _curses _curses_panel + readline + _tkinter + pyexpat + zlib + # We disabled these for CBUILD because Python's setup.py can't handle locating + # libdir correctly for cross. This should be rechecked for the pure Makefile approach, + # and uncommented if needed. + #_ctypes _crypt + EOF + + ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}" + + # Unfortunately, we do have to build this immediately, and + # not in src_compile, because CHOST configure for Python + # will check the existence of the --with-build-python value + # immediately. + emake + popd &> /dev/null || die +} + +src_configure() { + # disable automagic bluetooth headers detection + if ! use bluetooth; then + local -x ac_cv_header_bluetooth_bluetooth_h=no + fi + + append-flags -fwrapv + filter-flags -malign-double + + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. + # PKG_CONFIG needed for cross. + tc-export CXX PKG_CONFIG + + local dbmliborder= + if use gdbm; then + dbmliborder+="${dbmliborder:+:}gdbm" + fi + + if use pgo; then + local profile_task_flags=( + -m test + "-j$(makeopts_jobs)" + --pgo-extended + -u-network + + # We use a timeout because of how often we've had hang issues + # here. It also matches the default upstream PROFILE_TASK. + --timeout 1200 + + -x test_gdb + -x test_dtrace + + # All of these seem to occasionally hang for PGO inconsistently + # They'll even hang here but be fine in src_test sometimes. + # bug #828535 (and related: bug #788022) + -x test_asyncio + -x test_concurrent_futures + -x test_httpservers + -x test_logging + -x test_multiprocessing_fork + -x test_socket + -x test_xmlrpc + + # Hangs (actually runs indefinitely executing itself w/ many cpython builds) + # bug #900429 + -x test_tools + ) + + if has_version "app-arch/rpm" ; then + # Avoid sandbox failure (attempts to write to /var/lib/rpm) + profile_task_flags+=( + -x test_distutils + ) + fi + local -x PROFILE_TASK="${profile_task_flags[*]}" + fi + + # flock on 32-bits sparc Solaris is broken + [[ ${CHOST} == sparc-*-solaris* ]] && \ + export ac_cv_flock_decl=no + # Darwin 9's kqueue seems to act up (at least at this stage), so + # make Python's selectors resort to poll() or select() + [[ ${CHOST} == powerpc*-darwin9 ]] && \ + export ac_cv_func_kqueue=no + + local myeconfargs=( + # glibc-2.30 removes it; since we can't cleanly force-rebuild + # Python on glibc upgrade, remove it proactively to give + # a chance for users rebuilding python before glibc + # except on non-glibc systems this breaks the build, so be + # conservative! + $(use elibc_glibc && echo ac_cv_header_stropts_h=no) + + $(use aqua && echo --config-cache) + --enable-shared + --without-static-libpython + --enable-ipv6 + --infodir='${prefix}/share/info' + --mandir='${prefix}/share/man' + --with-computed-gotos + --with-dbmliborder="${dbmliborder}" + --with-libc= + --enable-loadable-sqlite-extensions + --without-ensurepip + --without-lto + --with-system-expat + --with-platlibdir=lib + --with-pkg-config=yes + --with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip + + $(use_with debug assertions) + $(use_enable pgo optimizations) + $(use_with readline readline "$(usex libedit editline readline)") + $(use_with valgrind) + ) + + # https://bugs.gentoo.org/700012 + if tc-is-lto; then + append-cflags $(test-flags-CC -ffat-lto-objects) + myeconfargs+=( + --with-lto + ) + fi + + # Force-disable modules we don't want built. + # See Modules/Setup for docs on how this works. Setup.local contains our local deviations. + cat > Modules/Setup.local <<-EOF || die + *disabled* + nis + $(usev !gdbm '_gdbm _dbm') + $(usev !sqlite '_sqlite3') + $(usev !ssl '_hashlib _ssl') + $(usev !ncurses '_curses _curses_panel') + $(usev !readline 'readline') + $(usev !tk '_tkinter') + $([[ ${CHOST} == *-apple-darwin* ]] && echo '_scproxy') + $([[ ${CHOST} != *-linux-* ]] && echo 'ossaudiodev') + EOF + + # disable implicit optimization/debugging flags + local -x OPT= + + if tc-is-cross-compiler ; then + build_cbuild_python + myeconfargs+=( + # Point the imminent CHOST build to the Python we just + # built for CBUILD. + --with-build-python="${WORKDIR}"/${P}-${CBUILD}/python + ) + fi + + # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get + # propagated to sysconfig for built extensions + local -x CFLAGS_NODIST=${CFLAGS} + local -x LDFLAGS_NODIST=${LDFLAGS} + local -x CFLAGS= LDFLAGS= + + # Fix implicit declarations on cross and prefix builds. Bug #674070. + if use ncurses; then + append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw + fi + + if use aqua ; then + ECONF_SOURCE="${S}" OPT="" \ + econf \ + --enable-framework="${EPREFIX}" \ + --config-cache + fi + + econf "${myeconfargs[@]}" + + if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then + eerror "configure has detected that the sem_open function is broken." + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." + die "Broken sem_open function (bug 496328)" + fi + + # install epython.py as part of stdlib + echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die +} + +src_compile() { + # Ensure sed works as expected + # https://bugs.gentoo.org/594768 + local -x LC_ALL=C + export PYTHONSTRICTEXTENSIONBUILD=1 + + # Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't + # end up writing bytecode & violating sandbox. + # bug #831897 + local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE} + + if use pgo ; then + # bug 660358 + local -x COLUMNS=80 + local -x PYTHONDONTWRITEBYTECODE= + + addpredict "/usr/lib/python${PYVER}/site-packages" + fi + + # also need to clear the flags explicitly here or they end up + # in _sysconfigdata* + emake CPPFLAGS= CFLAGS= LDFLAGS= + + # Restore saved value from above. + local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE} + + # Work around bug 329499. See also bug 413751 and 457194. + if has_version dev-libs/libffi[pax-kernel]; then + pax-mark E python + else + pax-mark m python + fi +} + +src_test() { + # Tests will not work when cross compiling. + if tc-is-cross-compiler; then + elog "Disabling tests due to crosscompiling." + return + fi + + # this just happens to skip test_support.test_freeze that is broken + # without bundled expat + # TODO: get a proper skip for it upstream + local -x LOGNAME=buildbot + + local test_opts=( + -u-network + -j "$(makeopts_jobs)" + + # fails + -x test_concurrent_futures + -x test_gdb + ) + + if use sparc ; then + # bug #788022 + test_opts+=( + -x test_multiprocessing_fork + -x test_multiprocessing_forkserver + ) + fi + + # workaround docutils breaking tests + cat > Lib/docutils.py <<-EOF || die + raise ImportError("Thou shalt not import!") + EOF + + # bug 660358 + local -x COLUMNS=80 + local -x PYTHONDONTWRITEBYTECODE= + # workaround https://bugs.gentoo.org/775416 + addwrite "/usr/lib/python${PYVER}/site-packages" + + nonfatal emake -Onone test EXTRATESTOPTS="${test_opts[*]}" \ + CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty + local ret=${?} + + rm Lib/docutils.py || die + + [[ ${ret} -eq 0 ]] || die "emake test failed" +} + +src_install() { + local libdir=${ED}/usr/lib/python${PYVER} + + # the Makefile rules are broken + # https://github.com/python/cpython/issues/100221 + mkdir -p "${libdir}"/lib-dynload || die + + # -j1 hack for now for bug #843458 + emake -j1 DESTDIR="${D}" altinstall + + if use aqua ; then + # avoid config.status to be triggered + find Mac -name "Makefile" -exec touch \{\} + || die + + # Python_Launcher is kind of a wrapper, and we should fix it for + # Prefix (it uses /usr/bin/pythonw) so useless + # IDLE doesn't run, no idea, but definitely not used + emake DESTDIR="${D}" -C Mac install_Python || die + rmdir "${ED}"/Applications/Python* || die + rmdir "${ED}"/Applications || die + + local fwdir=/Frameworks/Python.framework/Versions/${PYVER} + ln -s "${EPREFIX}"/usr/include/python${PYVER} \ + "${ED}${fwdir}"/Headers || die + ln -s "${EPREFIX}"/usr/lib/libpython${PYVER}.dylib \ + "${ED}${fwdir}"/Python || die + fi + + # Fix collisions between different slots of Python. + rm -f "${ED}/usr/$(get_libdir)/libpython3$(get_libname)" || die + + # Cheap hack to get version with ABIFLAGS + local abiver=$(cd "${ED}/usr/include"; echo python*) + if [[ ${abiver} != python${PYVER} ]]; then + # Replace python3.X with a symlink to python3.Xm + rm "${ED}/usr/bin/python${PYVER}" || die + dosym "${abiver}" "/usr/bin/python${PYVER}" + # Create python3.X-config symlink + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" + # Create python-3.5m.pc symlink + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" + fi + + # python seems to get rebuilt in src_install (bug 569908) + # Work around it for now. + if has_version dev-libs/libffi[pax-kernel]; then + pax-mark E "${ED}/usr/bin/${abiver}" + else + pax-mark m "${ED}/usr/bin/${abiver}" + fi + + rm -r "${libdir}"/ensurepip/_bundled || die + if ! use ensurepip; then + rm -r "${libdir}"/ensurepip || die + fi + if ! use sqlite; then + rm -r "${libdir}/"sqlite3 || die + fi + if ! use tk; then + rm -r "${ED}/usr/bin/idle${PYVER}" || die + rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die + fi + + ln -s ../python/EXTERNALLY-MANAGED "${libdir}/EXTERNALLY-MANAGED" || die + + dodoc Misc/{ACKS,HISTORY,NEWS} + + if use examples; then + docinto examples + find Tools -name __pycache__ -exec rm -fr {} + || die + dodoc -r Tools + fi + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 + local libname=$( + printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | + emake --no-print-directory -s -f - 2>/dev/null + ) + newins Tools/gdb/libpython.py "${libname}"-gdb.py + + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} + sed \ + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ + -e "s:@PYDOC@:pydoc${PYVER}:" \ + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" + + # python-exec wrapping support + local pymajor=${PYVER%.*} + local EPYTHON=python${PYVER} + local scriptdir=${D}$(python_get_scriptdir) + mkdir -p "${scriptdir}" || die + # python and pythonX + ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die + ln -s "python${pymajor}" "${scriptdir}/python" || die + # python-config and pythonX-config + # note: we need to create a wrapper rather than symlinking it due + # to some random dirname(argv[0]) magic performed by python-config + cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die + #!/bin/sh + exec "${abiver}-config" "\${@}" + EOF + chmod +x "${scriptdir}/python${pymajor}-config" || die + ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die + # 2to3, pydoc + ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die + ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die + # idle + if use tk; then + ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die + fi +} + +pkg_postinst() { + local v + for v in ${REPLACING_VERSIONS}; do + if ver_test "${v}" -lt 3.11.0_beta4-r2; then + ewarn "Python 3.11.0b4 has changed its module ABI. The .pyc files" + ewarn "installed previously are no longer valid and will be regenerated" + ewarn "(or ignored) on the next import. This may cause sandbox failures" + ewarn "when installing some packages and checksum mismatches when removing" + ewarn "old versions. To actively prevent this, rebuild all packages" + ewarn "installing Python 3.11 modules, e.g. using:" + ewarn + ewarn " emerge -1v /usr/lib/python3.11/site-packages" + fi + done +} diff --git a/dev-lang/python/python-3.8.8_p1-r1.ebuild b/dev-lang/python/python-3.8.8_p1-r1.ebuild index 046cbbc700..46e8ceda5d 100644 --- a/dev-lang/python/python-3.8.8_p1-r1.ebuild +++ b/dev-lang/python/python-3.8.8_p1-r1.ebuild @@ -25,7 +25,7 @@ S="${WORKDIR}/${MY_P}" LICENSE="PSF-2" SLOT="${PYVER}" -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" IUSE="aqua bluetooth build examples gdbm hardened ipv6 +ncurses +readline +sqlite +ssl test tk wininst +xml" RESTRICT="!test? ( test )" @@ -60,7 +60,7 @@ DEPEND="${RDEPEND} test? ( app-arch/xz-utils[extra-filters(+)] )" BDEPEND=" virtual/pkgconfig - sys-devel/autoconf-archive + dev-build/autoconf-archive verify-sig? ( sec-keys/openpgp-keys-python ) !sys-devel/gcc[libffi(-)]" PDEPEND="app-eselect/eselect-python" diff --git a/dev-lang/python/python-3.9.12.ebuild b/dev-lang/python/python-3.9.12.ebuild index b3d6bb0223..10c3b971fc 100644 --- a/dev-lang/python/python-3.9.12.ebuild +++ b/dev-lang/python/python-3.9.12.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2022 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI="7" @@ -27,7 +27,7 @@ S="${WORKDIR}/${MY_P}" LICENSE="PSF-2" SLOT="${PYVER}" -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" IUSE="aqua bluetooth build examples gdbm hardened lto +ncurses pgo +readline +sqlite +ssl test tk wininst +xml" RESTRICT="!test? ( test )" @@ -65,9 +65,9 @@ DEPEND=" test? ( app-arch/xz-utils[extra-filters(+)] ) " BDEPEND=" - virtual/awk + app-alternatives/awk virtual/pkgconfig - sys-devel/autoconf-archive + dev-build/autoconf-archive verify-sig? ( sec-keys/openpgp-keys-python ) !sys-devel/gcc[libffi(-)] " @@ -75,7 +75,7 @@ RDEPEND+=" !build? ( app-misc/mime-types ) " -VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/python.org.asc # large file tests involve a 2.5G file being copied (duplicated) CHECKREQS_DISK_BUILD=5500M diff --git a/dev-lang/python/python-3.9.6_p1-r1.ebuild b/dev-lang/python/python-3.9.6_p1-r1.ebuild index 7885b7cfcc..4c2c3f1d02 100644 --- a/dev-lang/python/python-3.9.6_p1-r1.ebuild +++ b/dev-lang/python/python-3.9.6_p1-r1.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI="7" @@ -25,7 +25,7 @@ S="${WORKDIR}/${MY_P}" LICENSE="PSF-2" SLOT="${PYVER}" -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" IUSE="aqua bluetooth build examples gdbm hardened ipv6 +ncurses +readline +sqlite +ssl test tk wininst +xml" RESTRICT="!test? ( test )" @@ -60,12 +60,12 @@ DEPEND="${RDEPEND} test? ( app-arch/xz-utils[extra-filters(+)] )" BDEPEND=" virtual/pkgconfig - sys-devel/autoconf-archive + dev-build/autoconf-archive verify-sig? ( sec-keys/openpgp-keys-python ) !sys-devel/gcc[libffi(-)]" RDEPEND+=" !build? ( app-misc/mime-types )" -VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/python.org.asc # large file tests involve a 2.5G file being copied (duplicated) CHECKREQS_DISK_BUILD=5500M diff --git a/dev-libs/glib/Manifest b/dev-libs/glib/Manifest deleted file mode 100644 index 08fe290e6c..0000000000 --- a/dev-libs/glib/Manifest +++ /dev/null @@ -1,10 +0,0 @@ -AUX 2.56-gmodule-cygwin.patch 3482 BLAKE2B 094036560ed444e050858ff52a4c5f25e13c4988069898e78417def247dae78145d337ff8a6265c7d23fa91f26a48c255b5562de2e9634c5262b90b36a5677f4 SHA512 b5faedf2a484c70c16abf3e4a3557ce5b6939995b93fa46644ee4ae7527bdd6a47cced5ae6837b79d1f74836ace0de14d568358a31125ccb9d4d4273219ca0e7 -AUX glib-2.54.3-external-gdbus-codegen.patch 3233 BLAKE2B 6b96851b7485164ef6c94da1847152a87064eb5c9f9b0ae6996eca84e89c7807bea5cb7c58b8d42dee07eee96647d2439b8c62af023b37849d4465e0c013eca6 SHA512 70d942086f6181532b5f95c5a3e0d8bfc7d204ca2d4ee68850af82062b572cc146ac4a5516547011ef39386e10bc291deea32a19fe518e649f4f8ac60271b69c -AUX glib-2.64.1-mark-gdbus-server-auth-test-flaky.patch 842 BLAKE2B 6b2eb57b8923c8bb54ead80d829aeb7a5c8a42c62e960e7305bc3fad69c67fd21e1c9f20b5c9002c0319cf3d77992b9cb71912c9b813b723e0a56aaea38330ad SHA512 ccd92d2f1fd495618ac788ffe6b69acec05a521a0ee8ff2bacb1dce6e283a04bbc2a10e61b37fc29f3893003fa154fa0d30bc37ed266b3f813200cd8ed17c116 -DIST glib-2.56.2.tar.xz 8041756 BLAKE2B 1af5bb37378856e959602bcb9299266bba46b990839c923f6b9881624aed306af0779005281b3e3a46b5994c54812edc86aade9cb782c596fd63b6fd91baba51 SHA512 8201ea82d3613d2e879284abe01520b766da30957c5a1a22f3e6019b0cce6bf95d25beae78867b6a133401c4165153c0c92974dd459ab12f9e0e9dd0c95df5d4 -DIST glib-2.66.2.tar.xz 4836456 BLAKE2B 5484a7fe497dbe06df7ce11dbc8836c95dbb01e6e309516b82158f2915eeee36ccbe6e904cb6ae9a5a0223ccc0b52f6e64d61a418bf790538bc90388430977b2 SHA512 30278c066c6b209f45fcfdb9ffc4732236451464506b93c0fff0964ff8aac58c15be85c3793c686d4740d9d97857984bc0ab71e38d5da11c5fd860e569fb6cb9 -DIST glib-cygwinports-3a873fdd1b9a9e649563fe8e6b8ae6951b0dd3be.zip 13038 BLAKE2B 08f217e204c8518137722dcd535c100cbdc56e43dcf3d16a339c93353c594287670215c130b2c7f83235145632fad6d30903ae099f5999bf72ec070a12da4484 SHA512 fd4925d6a2380c5ff551e812a182de20f7b59e5d134a2c54b985efe85ab334499b0050097ca5c3271f14e2c3c5e89650e134a01e4c5be06bad05a12eaaf9fe53 -DIST pkg-config-0.28.tar.gz 1931203 BLAKE2B bafdd4e838623965c6bd454421ddd9051fc43fc29948e1615b49fef463c3c3a18807aabe6416f96cfdf58d6b1c9e114d77f97bd985facee7c14284a8a64a768b SHA512 6eafa5ca77c5d44cd15f48457a5e96fcea2555b66d8e35ada5ab59864a0aa03d441e15f54ab9c6343693867b3b490f392c75b7d9312f024c9b7ec6a0194d8320 -EBUILD glib-2.56.2-r1.ebuild 11695 BLAKE2B f0f846b08805b59dda01de904738ef78d9ee9c6483b51c592858117fc07d11322194ae209d396691f25fbb4d09d02b233548350986cc0fb003d04a9c98591407 SHA512 515997880fdd4f99d53a4883aaab7e1647d60c5a51f300d741f22bef395338adf4cda8790308032775d251a3c93b73b7010aa71c072691e4527899705a11258f -EBUILD glib-2.66.2-r1.ebuild 10805 BLAKE2B fdf2468b6db411f5014442b3595eb59cb9df86ede91dd3dff49e54232585a0c23bbbff6ffed1c0681fcfbd52223465b4ae26474538bc95fb371deea426a9ee7d SHA512 426d81d96283664d41fef2e2fa7ee16453d10c6f434f502a0fd52d43477c3080bad1b1e4ddfaa79e02b03b6fc981f4a36f77cf3d398b36df97c83b02138b4ac8 -MISC metadata.xml 1098 BLAKE2B f2bd17f50d68c553b9040e954c0ef91edd29a3f1f7731bc7f45e3a936f702209985d111ad376ca0b51bdb4736d9ee508151fbb57b273a32beb1148aa027226c6 SHA512 2745b70b29ba0517144343f5d3f4b7c3389200b1ecbd2830e29bd9a90ca59ebeedf4d66b26a3241e3d3a3066f9a26ae223d075b9b2b82d67e4642e784f236c20 diff --git a/dev-libs/glib/files/2.56-gmodule-cygwin.patch b/dev-libs/glib/files/2.56-gmodule-cygwin.patch deleted file mode 100644 index 4665a2901a..0000000000 --- a/dev-libs/glib/files/2.56-gmodule-cygwin.patch +++ /dev/null @@ -1,149 +0,0 @@ -This is derived from github/cygwinports/glib2.0/2.50-gmodule-cygwin.patch -as of commit id 3a873fdd1b9a9e649563fe8e6b8ae6951b0dd3be for glib-2.54.3, -and rebased for glib-2.56.2. ---- origsrc/glib-2.50.3/gmodule/gmodule-win32.c -+++ src/glib-2.50.3/gmodule/gmodule-win32.c -@@ -37,7 +37,20 @@ - - #ifdef G_WITH_CYGWIN - #include <sys/cygwin.h> --#endif -+#include <dlfcn.h> -+ -+static gchar* -+fetch_dlerror (gboolean replace_null) -+{ -+ gchar *msg = dlerror (); -+ -+ if (!msg && replace_null) -+ return "unknown dl-error"; -+ -+ return msg; -+} -+ -+#else - - static void - set_error (const gchar *format, -@@ -62,22 +75,26 @@ set_error (const gchar *format, - g_free (error); - } - -+#endif /* G_WITH_CYGWIN */ -+ - /* --- functions --- */ - static gpointer - _g_module_open (const gchar *file_name, - gboolean bind_lazy, - gboolean bind_local) - { -+#ifdef G_WITH_CYGWIN -+ gpointer handle; -+ -+ handle = dlopen (file_name, -+ (bind_local ? RTLD_LOCAL : RTLD_GLOBAL) | (bind_lazy ? RTLD_LAZY : RTLD_NOW)); -+ if (!handle) -+ g_module_set_error (fetch_dlerror (TRUE)); -+#else - HINSTANCE handle; - wchar_t *wfilename; - DWORD old_mode; - BOOL success; --#ifdef G_WITH_CYGWIN -- gchar tmp[MAX_PATH]; -- -- cygwin_conv_to_win32_path(file_name, tmp); -- file_name = tmp; --#endif - wfilename = g_utf8_to_utf16 (file_name, -1, NULL, NULL, NULL); - - /* suppress error dialog */ -@@ -91,26 +108,44 @@ _g_module_open (const gchar *file_name, - - if (!handle) - set_error ("'%s': ", file_name); -+#endif - - return handle; - } - -+#ifndef G_WITH_CYGWIN - static gint dummy; - static gpointer null_module_handle = &dummy; -+#endif - - static gpointer - _g_module_self (void) - { -+#ifdef G_WITH_CYGWIN -+ gpointer handle; -+ -+ handle = dlopen (NULL, RTLD_GLOBAL | RTLD_LAZY); -+ if (!handle) -+ g_module_set_error (fetch_dlerror (TRUE)); -+ -+ return handle; -+#else - return null_module_handle; -+#endif - } - - static void - _g_module_close (gpointer handle, - gboolean is_unref) - { -+#ifdef G_WITH_CYGWIN -+ if (dlclose (handle) != 0) -+ g_module_set_error (fetch_dlerror (TRUE)); -+#else - if (handle != null_module_handle) - if (!FreeLibrary (handle)) - set_error (""); -+#endif - } - - static gpointer -@@ -129,8 +164,19 @@ find_in_any_module_using_toolhelp (const - if (Module32First (snapshot, &me32)) - { - do { -- if ((p = GetProcAddress (me32.hModule, symbol_name)) != NULL) -- break; -+ if ((p = GetProcAddress (me32.hModule, symbol_name)) != NULL) { -+#ifdef G_WITH_CYGWIN -+ /* if symbol is found in another module, we probably do not want it */ -+ ssize_t size = cygwin_conv_path (CCP_WIN_A_TO_POSIX, me32.szExePath, NULL, 0); -+ char *posix = (char *) alloca (size); -+ cygwin_conv_path (CCP_WIN_A_TO_POSIX, me32.szExePath, posix, size); -+ if (g_strstr_len (posix, size, "/usr/lib") -+ || g_strstr_len (posix, size, "/usr/local/lib")) -+ p = NULL; -+ else -+#endif -+ break; -+ } - } while (Module32Next (snapshot, &me32)); - } - -@@ -156,6 +202,13 @@ _g_module_symbol (gpointer handle, - { - gpointer p; - -+#ifdef G_WITH_CYGWIN -+ p = dlsym (handle, symbol_name); -+ if (!p) -+ p = find_in_any_module (symbol_name); -+ if (!p) -+ g_module_set_error (fetch_dlerror (FALSE)); -+#else - if (handle == null_module_handle) - { - if ((p = GetProcAddress (GetModuleHandle (NULL), symbol_name)) == NULL) -@@ -166,6 +219,7 @@ _g_module_symbol (gpointer handle, - - if (!p) - set_error (""); -+#endif - - return p; - } diff --git a/dev-libs/glib/files/glib-2.54.3-external-gdbus-codegen.patch b/dev-libs/glib/files/glib-2.54.3-external-gdbus-codegen.patch deleted file mode 100644 index a27966e039..0000000000 --- a/dev-libs/glib/files/glib-2.54.3-external-gdbus-codegen.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 2e47d49bc91d83cd0abea4c1944bfca4336040fa Mon Sep 17 00:00:00 2001 -From: Sobhan Mohammadpour <sobhan@gentoo.org> -Date: Fri, 23 Feb 2018 15:27:33 +0330 -Subject: [PATCH] glib-2.54.3-external-gdbus-codegen-for-autotools - ---- - configure.ac | 1 - - docs/reference/gio/Makefile.am | 1 - - gio/Makefile.am | 2 +- - gio/tests/Makefile.am | 6 ++---- - gio/tests/gdbus-object-manager-example/Makefile.am | 6 ++---- - 5 files changed, 5 insertions(+), 11 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 0457c90..07166c9 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -3469,7 +3469,6 @@ gobject/glib-mkenums - gobject/tests/Makefile - gthread/Makefile - gio/Makefile --gio/gdbus-2.0/codegen/Makefile - gio/gdbus-2.0/codegen/config.py - gio/gnetworking.h - gio/xdgmime/Makefile -diff --git a/docs/reference/gio/Makefile.am b/docs/reference/gio/Makefile.am -index 5741a3e..d38e768 100644 ---- a/docs/reference/gio/Makefile.am -+++ b/docs/reference/gio/Makefile.am -@@ -177,7 +177,6 @@ man_MANS += \ - gsettings.1 \ - gresource.1 \ - gdbus.1 \ -- gdbus-codegen.1 \ - gio.1 \ - $(NULL) - -diff --git a/gio/Makefile.am b/gio/Makefile.am -index b2db995..53d7162 100644 ---- a/gio/Makefile.am -+++ b/gio/Makefile.am -@@ -1,6 +1,6 @@ - include $(top_srcdir)/glib.mk - --SUBDIRS = gdbus-2.0/codegen -+SUBDIRS = - - if OS_UNIX - if !OS_COCOA -diff --git a/gio/tests/Makefile.am b/gio/tests/Makefile.am -index acc1da4..7c51eab 100644 ---- a/gio/tests/Makefile.am -+++ b/gio/tests/Makefile.am -@@ -460,10 +460,8 @@ gnotification_SOURCES = $(gdbus_sessionbus_sources) gnotifica - - BUILT_SOURCES += gdbus-test-codegen-generated.c gdbus-test-codegen-generated.h - gdbus-test-codegen.o: gdbus-test-codegen-generated.h --gdbus-test-codegen-generated.h: test-codegen.xml Makefile $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen -- $(AM_V_GEN) UNINSTALLED_GLIB_SRCDIR=$(top_srcdir) \ -- UNINSTALLED_GLIB_BUILDDIR=$(top_builddir) \ -- $(PYTHON) $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen \ -+gdbus-test-codegen-generated.h: test-codegen.xml Makefile -+ $(AM_V_GEN) gdbus-codegen \ - --interface-prefix org.project. \ - --generate-c-code gdbus-test-codegen-generated \ - --c-generate-object-manager \ -diff --git a/gio/tests/gdbus-object-manager-example/Makefile.am b/gio/tests/gdbus-object-manager-example/Makefile.am -index 1d0464c..f390dca 100644 ---- a/gio/tests/gdbus-object-manager-example/Makefile.am -+++ b/gio/tests/gdbus-object-manager-example/Makefile.am -@@ -11,10 +11,8 @@ GDBUS_GENERATED = \ - gdbus-example-objectmanager-generated-org.gtk.GDBus.Example.ObjectManager.Cat.xml \ - $(NULL) - --$(GDBUS_GENERATED) : gdbus-example-objectmanager.xml Makefile $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen -- $(AM_V_GEN) UNINSTALLED_GLIB_SRCDIR=$(top_srcdir) \ -- UNINSTALLED_GLIB_BUILDDIR=$(top_builddir) \ -- $(PYTHON) $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen \ -+$(GDBUS_GENERATED) : gdbus-example-objectmanager.xml Makefile -+ $(AM_V_GEN) gdbus-codegen \ - --interface-prefix org.gtk.GDBus.Example.ObjectManager. \ - --c-namespace Example \ - --c-generate-object-manager \ --- -2.16.1 - diff --git a/dev-libs/glib/files/glib-2.64.1-mark-gdbus-server-auth-test-flaky.patch b/dev-libs/glib/files/glib-2.64.1-mark-gdbus-server-auth-test-flaky.patch deleted file mode 100644 index d1a41ecb79..0000000000 --- a/dev-libs/glib/files/glib-2.64.1-mark-gdbus-server-auth-test-flaky.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 95b22035f6151ab465c37fe5e3e340713cb74e23 Mon Sep 17 00:00:00 2001 -From: Matt Turner <mattst88@gmail.com> -Date: Tue, 24 Mar 2020 18:44:54 -0700 -Subject: [PATCH] Mark gdbus-server-auth test flaky - -See https://gitlab.gnome.org/GNOME/glib/-/issues/1954 ---- - gio/tests/meson.build | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/gio/tests/meson.build b/gio/tests/meson.build -index 788cf978b..7f45d0191 100644 ---- a/gio/tests/meson.build -+++ b/gio/tests/meson.build -@@ -122,12 +122,13 @@ if dbus1_dep.found() - }, - 'gdbus-server-auth' : { - 'dependencies' : [dbus1_dep], -+ 'suite' : ['flaky'], - }, - } - else - # We can build a cut-down version of this test without libdbus - gio_tests += { -- 'gdbus-server-auth' : {}, -+ 'gdbus-server-auth' : {'suite' : ['flaky']}, - } - endif - --- -2.24.1 - diff --git a/dev-libs/glib/glib-2.56.2-r1.ebuild b/dev-libs/glib/glib-2.56.2-r1.ebuild deleted file mode 100644 index b160eea0a1..0000000000 --- a/dev-libs/glib/glib-2.56.2-r1.ebuild +++ /dev/null @@ -1,350 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 -PYTHON_COMPAT=( python{2_7,3_5,3_6,3_7,3_8,3_9} ) # only for tests -GNOME2_EAUTORECONF=yes - -inherit autotools bash-completion-r1 flag-o-matic gnome2 libtool linux-info \ - multilib multilib-minimal pax-utils python-any-r1 toolchain-funcs virtualx - -# Until bug #537330 glib is a reverse dependency of pkgconfig and, then -# adding new dependencies end up making stage3 to grow. Every addition needs -# then to be think very closely. - -DESCRIPTION="The GLib library of C routines" -HOMEPAGE="https://www.gtk.org/" -SRC_URI="${SRC_URI} - https://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz" # pkg.m4 for eautoreconf -CYGWINPORTS_GITREV="3a873fdd1b9a9e649563fe8e6b8ae6951b0dd3be" - -[[ -n ${CYGWINPORTS_GITREV} ]] && -SRC_URI+=" elibc_Cygwin? ( - https://github.com/cygwinports/glib2.0/archive/${CYGWINPORTS_GITREV}.zip - -> ${PN}-cygwinports-${CYGWINPORTS_GITREV}.zip )" - -LICENSE="LGPL-2.1+" -SLOT="2" -IUSE="dbus debug fam kernel_linux +mime selinux static-libs systemtap test utils xattr" - -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt" - -# Added util-linux multilib dependency to have libmount support (which -# is always turned on on linux systems, unless explicitly disabled, but -# this ebuild does not do that anyway) (bug #599586) - -RDEPEND=" - !<dev-util/gdbus-codegen-${PV} - >=dev-libs/libpcre-8.13:3[${MULTILIB_USEDEP},static-libs?] - >=virtual/libiconv-0-r1[${MULTILIB_USEDEP}] - dev-libs/libffi:=[${MULTILIB_USEDEP}] - >=virtual/libintl-0-r2[${MULTILIB_USEDEP}] - >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] - !prefix-stack? ( kernel_linux? ( sys-apps/util-linux[${MULTILIB_USEDEP}] ) ) - selinux? ( >=sys-libs/libselinux-2.2.2-r5[${MULTILIB_USEDEP}] ) - xattr? ( >=sys-apps/attr-2.4.47-r1[${MULTILIB_USEDEP}] ) - fam? ( >=virtual/fam-0-r1[${MULTILIB_USEDEP}] ) - utils? ( - >=dev-util/gdbus-codegen-${PV} - virtual/libelf:0= - ) -" -DEPEND="${RDEPEND} - app-text/docbook-xml-dtd:4.1.2 - >=dev-libs/libxslt-1.0 - >=sys-devel/gettext-0.11 - >=dev-util/gtk-doc-am-1.20 - systemtap? ( >=dev-util/systemtap-1.3 ) - ${PYTHON_DEPS} - test? ( - sys-devel/gdb - >=dev-util/gdbus-codegen-${PV} - >=sys-apps/dbus-1.2.14 ) - !<dev-util/gtk-doc-1.15-r2 -" -# Migration of glib-genmarshal, glib-mkenums and gtester-report to a separate -# python depending package, which can be buildtime depended in packages that -# need these tools, without pulling in python at runtime. -RDEPEND="${RDEPEND} - !prefix-stack? ( >=dev-util/glib-utils-${PV} )" -PDEPEND=" - dbus? ( gnome-base/dconf ) - mime? ( x11-misc/shared-mime-info ) -" -# shared-mime-info needed for gio/xdgmime, bug #409481 -# dconf is needed to be able to save settings, bug #498436 - -MULTILIB_CHOST_TOOLS=( - /usr/bin/gio-querymodules$(get_exeext) -) - -pkg_setup() { - if use kernel_linux ; then - CONFIG_CHECK="~INOTIFY_USER" - if use test ; then - CONFIG_CHECK="~IPV6" - WARNING_IPV6="Your kernel needs IPV6 support for running some tests, skipping them." - fi - linux-info_pkg_setup - fi - python-any-r1_pkg_setup -} - -src_prepare() { - # Prevent build failure in stage3 where pkgconfig is not available, bug #481056 - mv -f "${WORKDIR}"/pkg-config-*/pkg.m4 "${S}"/m4macros/ || die - - if use test; then - # Disable tests requiring dev-util/desktop-file-utils when not installed, bug #286629, upstream bug #629163 - if ! has_version dev-util/desktop-file-utils ; then - ewarn "Some tests will be skipped due dev-util/desktop-file-utils not being present on your system," - ewarn "think on installing it to get these tests run." - sed -i -e "/appinfo\/associations/d" gio/tests/appinfo.c || die - sed -i -e "/g_test_add_func/d" gio/tests/desktop-app-info.c || die - fi - - # gdesktopappinfo requires existing terminal (gnome-terminal or any - # other), falling back to xterm if one doesn't exist - if ! has_version x11-terms/xterm && ! has_version x11-terms/gnome-terminal ; then - ewarn "Some tests will be skipped due to missing terminal program" - sed -i -e "/appinfo\/launch/d" gio/tests/appinfo.c || die - fi - - # https://bugzilla.gnome.org/show_bug.cgi?id=722604 - sed -i -e "/timer\/stop/d" glib/tests/timer.c || die - sed -i -e "/timer\/basic/d" glib/tests/timer.c || die - - ewarn "Tests for search-utils have been skipped" - sed -i -e "/search-utils/d" glib/tests/Makefile.am || die - else - # Don't build tests, also prevents extra deps, bug #512022 - sed -i -e 's/ tests//' {.,gio,glib}/Makefile.am || die - fi - - # gdbus-codegen is a separate package - eapply "${FILESDIR}"/${PN}-2.54.3-external-gdbus-codegen.patch - - if [[ -n ${CYGWINPORTS_GITREV} ]] && use elibc_Cygwin; then - local p d="${WORKDIR}/glib2.0-${CYGWINPORTS_GITREV}" - for p in $( - sed -ne '/PATCH_URI="/,/"/{s/.*="//;s/".*//;p}' \ - < "${d}"/glib2.0.cygport - ); do - if [[ ${p} == 2.50-gmodule-cygwin.patch ]]; then - # Cygwinports has not upgraded to 2.56 yet - epatch "${FILESDIR}"/2.56-gmodule-cygwin.patch - continue - fi - epatch "${d}/${p}" - done - fi - - # make default sane for us - if use prefix ; then - sed -i -e "s:/usr/local:${EPREFIX}/usr:" gio/xdgmime/xdgmime.c || die - # bug #308609, without path, bug #314057 - export PERL=perl - fi - - if [[ ${CHOST} == *-solaris* ]] ; then - # fix standards conflicts - sed -i \ - -e 's/\<\(_XOPEN_SOURCE_EXTENDED\)\>/\1_DISABLED/' \ - -e '/\<_XOPEN_SOURCE\>/s/ 2,/600,/' \ - configure.ac || die - sed -i -e '/#define\s\+_POSIX_SOURCE/d' \ - glib/giounix.c || die - fi - - # disable native macOS integrations - sed -i -e '/glib_have_\(carbon\|cocoa\)=yes/s/yes/no/' \ - configure{.ac,} || die - - gnome2_src_prepare -} - -multilib_src_configure() { - # Avoid circular depend with dev-util/pkgconfig and - # native builds (cross-compiles won't need pkg-config - # in the target ROOT to work here) - if ! tc-is-cross-compiler && ! $(tc-getPKG_CONFIG) --version >& /dev/null; then - if has_version sys-apps/dbus; then - export DBUS1_CFLAGS="-I${EPREFIX}/usr/include/dbus-1.0 -I${EPREFIX}/usr/$(get_libdir)/dbus-1.0/include" - export DBUS1_LIBS="-ldbus-1" - fi - export LIBFFI_CFLAGS="-I$(echo ${EPREFIX}/usr/$(get_libdir)/libffi-*/include)" - export LIBFFI_LIBS="-lffi" - export PCRE_CFLAGS=" " # test -n "$PCRE_CFLAGS" needs to pass - export PCRE_LIBS="-lpcre" - fi - - # These configure tests don't work when cross-compiling. - if tc-is-cross-compiler ; then - # https://bugzilla.gnome.org/show_bug.cgi?id=756473 - case ${CHOST} in - hppa*|metag*) export glib_cv_stack_grows=yes ;; - *) export glib_cv_stack_grows=no ;; - esac - # https://bugzilla.gnome.org/show_bug.cgi?id=756474 - export glib_cv_uscore=no - # https://bugzilla.gnome.org/show_bug.cgi?id=756475 - export ac_cv_func_posix_get{pwuid,grgid}_r=yes - fi - - local myconf - - case "${CHOST}" in - *-mingw*) myconf="${myconf} --with-threads=win32" ;; - *) myconf="${myconf} --with-threads=posix" ;; - esac - - # non-glibc platforms use GNU libiconv, but configure needs to know about - # that not to get confused when it finds something outside the prefix too - if use !elibc_glibc ; then - myconf="${myconf} --with-libiconv=gnu" - # add the libdir for libtool, otherwise it'll make love with system - # installed libiconv. Automake passes LDFLAGS before local libs, - # add this to LIBS instead to come after local lib dirs. - append-libs "-L${EPREFIX}/usr/$(get_libdir)" - fi - - local xmlcatalog="${EPREFIX}/etc/xml/catalog" - grep -q catalog= "${xmlcatalog}" || - grep -q catalog= "${BROOT-${PORTAGE_OVERRIDE_EPREFIX}}/etc/xml/catalog" && - xmlcatalog="${BROOT-${PORTAGE_OVERRIDE_EPREFIX}}/etc/xml/catalog" - - # libelf used only by the gresource bin - ECONF_SOURCE="${S}" gnome2_src_configure ${myconf} \ - $(usex debug --enable-debug=yes ' ') \ - $(use_enable xattr) \ - $(use_enable fam) \ - $(use_enable kernel_linux libmount) \ - $(use_enable selinux) \ - $(use_enable static-libs static) \ - $(use_enable systemtap dtrace) \ - $(use_enable systemtap systemtap) \ - $(multilib_native_use_enable utils libelf) \ - --with-python=${EPYTHON} \ - --disable-compile-warnings \ - --enable-man \ - --with-pcre=system \ - --with-xml-catalog="${xmlcatalog}" - - if multilib_is_native_abi; then - local d - for d in glib gio gobject; do - ln -s "${S}"/docs/reference/${d}/html docs/reference/${d}/html || die - done - fi -} - -multilib_src_test() { - export XDG_CONFIG_DIRS="${EPREFIX}"/etc/xdg - export XDG_DATA_DIRS="${EPREFIX}"/usr/local/share:/usr/share - export G_DBUS_COOKIE_SHA1_KEYRING_DIR="${T}/temp" - export LC_TIME=C # bug #411967 - unset GSETTINGS_BACKEND # bug #596380 - python_setup - - # Related test is a bit nitpicking - mkdir "$G_DBUS_COOKIE_SHA1_KEYRING_DIR" - chmod 0700 "$G_DBUS_COOKIE_SHA1_KEYRING_DIR" - - # Hardened: gdb needs this, bug #338891 - if host-is-pax ; then - pax-mark -mr "${BUILD_DIR}"/tests/.libs/assert-msg-test \ - || die "Hardened adjustment failed" - fi - - # Need X for dbus-launch session X11 initialization - virtx emake check -} - -multilib_src_install() { - emake DESTDIR="${D}" completiondir="$(get_bashcompdir)" install - keepdir /usr/$(get_libdir)/gio/modules -} - -multilib_src_install_all() { - einstalldocs - - # These are installed by dev-util/glib-utils - # TODO: With patching we might be able to get rid of the python-any deps and removals, and test depend on glib-utils instead; revisit with meson - rm "${ED}usr/bin/glib-genmarshal" || die - rm "${ED}usr/share/man/man1/glib-genmarshal.1" || die - rm "${ED}usr/bin/glib-mkenums" || die - rm "${ED}usr/share/man/man1/glib-mkenums.1" || die - rm "${ED}usr/bin/gtester-report" || die - rm "${ED}usr/share/man/man1/gtester-report.1" || die - - # Do not install charset.alias even if generated, leave it to libiconv - rm -f "${ED}/usr/$(get_libdir)/charset.alias" - - # Don't install gdb python macros, bug 291328 - rm -rf "${ED}/usr/share/gdb/" "${ED}/usr/share/glib-2.0/gdb/" - - # Completely useless with or without USE static-libs, people need to use pkg-config - find "${ED}" -name '*.la' -delete || die -} - -pkg_preinst() { - gnome2_pkg_preinst - - # Make gschemas.compiled belong to glib alone - local cache="usr/share/glib-2.0/schemas/gschemas.compiled" - - if [[ -e ${EROOT}${cache} ]]; then - cp "${EROOT}"${cache} "${ED}"/${cache} || die - else - touch "${ED}"/${cache} || die - fi - - multilib_pkg_preinst() { - # Make giomodule.cache belong to glib alone - local cache="usr/$(get_libdir)/gio/modules/giomodule.cache" - - if [[ -e ${EROOT}${cache} ]]; then - cp "${EROOT}"${cache} "${ED}"/${cache} || die - else - touch "${ED}"/${cache} || die - fi - } - - # Don't run the cache ownership when cross-compiling, as it would end up with an empty cache - # file due to inability to create it and GIO might not look at any of the modules there - if ! tc-is-cross-compiler ; then - multilib_foreach_abi multilib_pkg_preinst - fi -} - -pkg_postinst() { - # force (re)generation of gschemas.compiled - GNOME2_ECLASS_GLIB_SCHEMAS="force" - - gnome2_pkg_postinst - - multilib_pkg_postinst() { - gnome2_giomodule_cache_update \ - || die "Update GIO modules cache failed (for ${ABI})" - } - if ! tc-is-cross-compiler ; then - multilib_foreach_abi multilib_pkg_postinst - else - ewarn "Updating of GIO modules cache skipped due to cross-compilation." - ewarn "You might want to run gio-querymodules manually on the target for" - ewarn "your final image for performance reasons and re-run it when packages" - ewarn "installing GIO modules get upgraded or added to the image." - fi -} - -pkg_postrm() { - gnome2_pkg_postrm - - if [[ -z ${REPLACED_BY_VERSION} ]]; then - multilib_pkg_postrm() { - rm -f "${EROOT}"usr/$(get_libdir)/gio/modules/giomodule.cache - } - multilib_foreach_abi multilib_pkg_postrm - rm -f "${EROOT}"usr/share/glib-2.0/schemas/gschemas.compiled - fi -} diff --git a/dev-libs/glib/glib-2.66.2-r1.ebuild b/dev-libs/glib/glib-2.66.2-r1.ebuild deleted file mode 100644 index 9621a46221..0000000000 --- a/dev-libs/glib/glib-2.66.2-r1.ebuild +++ /dev/null @@ -1,300 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 -PYTHON_COMPAT=( python3_{6,7,8,9} ) - -inherit flag-o-matic gnome.org gnome2-utils linux-info meson multilib multilib-minimal python-any-r1 toolchain-funcs xdg - -DESCRIPTION="The GLib library of C routines" -HOMEPAGE="https://www.gtk.org/" - -LICENSE="LGPL-2.1+" -SLOT="2" -IUSE="dbus debug elibc_glibc fam gtk-doc kernel_linux +mime selinux static-libs sysprof systemtap test utils xattr" -RESTRICT="!test? ( test )" - -# meson/ninja buildsystem, breaks of course (at least on Solaris), most -# likely will introduce problems during bootstrap too -#KEYWORDS="~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt" - -# * libelf isn't strictly necessary, but makes gresource tool more useful, and -# the check is automagic in gio/meson.build. gresource is not a multilib tool -# right now, thus it doesn't matter if non-native ABI libelf exists or not -# (non-native binary is overwritten, it doesn't matter if libelf was linked to). -# * elfutils (via libelf) does not build on Windows. gresources are not embedded -# within ELF binaries on that platform anyway and inspecting ELF binaries from -# other platforms is not that useful so exclude the dependency in this case. -# * Technically static-libs is needed on zlib, util-linux and perhaps more, but -# these are used by GIO, which glib[static-libs] consumers don't really seem -# to need at all, thus not imposing the deps for now and once some consumers -# are actually found to static link libgio-2.0.a, we can revisit and either add -# them or just put the (build) deps in that rare consumer instead of recursive -# RDEPEND here (due to lack of recursive DEPEND). -RDEPEND=" - !<dev-util/gdbus-codegen-2.66.0 - >=virtual/libiconv-0-r1[${MULTILIB_USEDEP}] - >=dev-libs/libpcre-8.31:3[${MULTILIB_USEDEP},static-libs?] - dev-libs/libffi:=[${MULTILIB_USEDEP}] - >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] - >=virtual/libintl-0-r2[${MULTILIB_USEDEP}] - !prefix-stack? ( kernel_linux? ( >=sys-apps/util-linux-2.23[${MULTILIB_USEDEP}] ) ) - selinux? ( >=sys-libs/libselinux-2.2.2-r5[${MULTILIB_USEDEP}] ) - xattr? ( !elibc_glibc? ( >=sys-apps/attr-2.4.47-r1[${MULTILIB_USEDEP}] ) ) - kernel_linux? ( virtual/libelf:0= ) - fam? ( >=virtual/fam-0-r1[${MULTILIB_USEDEP}] ) -" -DEPEND="${RDEPEND} - sysprof? ( >=dev-util/sysprof-capture-3.38:4[${MULTILIB_USEDEP}] ) -" -# libxml2 used for optional tests that get automatically skipped -BDEPEND=" - app-text/docbook-xsl-stylesheets - dev-libs/libxslt - >=sys-devel/gettext-0.19.8 - gtk-doc? ( >=dev-util/gtk-doc-1.32-r2 - app-text/docbook-xml-dtd:4.2 - app-text/docbook-xml-dtd:4.5 ) - systemtap? ( >=dev-util/systemtap-1.3 ) - ${PYTHON_DEPS} - test? ( >=sys-apps/dbus-1.2.14 ) - virtual/pkgconfig -" -# TODO: >=dev-util/gdbus-codegen-${PV} test dep once we modify gio/tests/meson.build to use external gdbus-codegen - -PDEPEND=" - dbus? ( gnome-base/dconf ) - mime? ( x11-misc/shared-mime-info ) -" -# shared-mime-info needed for gio/xdgmime, bug #409481 -# dconf is needed to be able to save settings, bug #498436 - -MULTILIB_CHOST_TOOLS=( - /usr/bin/gio-querymodules$(get_exeext) -) - -PATCHES=( - "${FILESDIR}"/${PN}-2.64.1-mark-gdbus-server-auth-test-flaky.patch -) - -pkg_setup() { - if use kernel_linux ; then - CONFIG_CHECK="~INOTIFY_USER" - if use test ; then - CONFIG_CHECK="~IPV6" - WARNING_IPV6="Your kernel needs IPV6 support for running some tests, skipping them." - fi - linux-info_pkg_setup - fi - python-any-r1_pkg_setup -} - -src_prepare() { - if use test; then - # TODO: Review the test exclusions, especially now with meson - # Disable tests requiring dev-util/desktop-file-utils when not installed, bug #286629, upstream bug #629163 - if ! has_version dev-util/desktop-file-utils ; then - ewarn "Some tests will be skipped due dev-util/desktop-file-utils not being present on your system," - ewarn "think on installing it to get these tests run." - sed -i -e "/appinfo\/associations/d" gio/tests/appinfo.c || die - sed -i -e "/g_test_add_func/d" gio/tests/desktop-app-info.c || die - fi - - # gdesktopappinfo requires existing terminal (gnome-terminal or any - # other), falling back to xterm if one doesn't exist - #if ! has_version x11-terms/xterm && ! has_version x11-terms/gnome-terminal ; then - # ewarn "Some tests will be skipped due to missing terminal program" - # These tests seem to sometimes fail even with a terminal; skip for now and reevulate with meson - # Also try https://gitlab.gnome.org/GNOME/glib/issues/1601 once ready for backport (or in a bump) and file new issue if still fails - sed -i -e "/appinfo\/launch/d" gio/tests/appinfo.c || die - # desktop-app-info/launch* might fail similarly - sed -i -e "/desktop-app-info\/launch-as-manager/d" gio/tests/desktop-app-info.c || die - #fi - - # https://bugzilla.gnome.org/show_bug.cgi?id=722604 - sed -i -e "/timer\/stop/d" glib/tests/timer.c || die - sed -i -e "/timer\/basic/d" glib/tests/timer.c || die - - ewarn "Tests for search-utils have been skipped" - sed -i -e "/search-utils/d" glib/tests/meson.build || die - - # Play nice with network-sandbox, but this approach would defeat the purpose of the test - #sed -i -e "s/localhost/127.0.0.1/g" gio/tests/gsocketclient-slow.c || die - else - # Don't build tests, also prevents extra deps, bug #512022 - sed -i -e '/subdir.*tests/d' {.,gio,glib}/meson.build || die - fi - - # Don't build fuzzing binaries - not used - sed -i -e '/subdir.*fuzzing/d' meson.build || die - - # gdbus-codegen is a separate package - sed -i -e '/install_dir/d' gio/gdbus-2.0/codegen/meson.build || die - - # Same kind of meson-0.50 issue with some installed-tests files; will likely be fixed upstream soon - sed -i -e '/install_dir/d' gio/tests/meson.build || die - - cat > "${T}/glib-test-ld-wrapper" <<-EOF - #!/usr/bin/env sh - exec \${LD:-ld} "\$@" - EOF - chmod a+x "${T}/glib-test-ld-wrapper" || die - sed -i -e "s|'ld'|'${T}/glib-test-ld-wrapper'|g" gio/tests/meson.build || die - - # make default sane for us - if use prefix ; then - sed -i -e "s:/usr/local:${EPREFIX}/usr:" gio/xdgmime/xdgmime.c || die - # bug #308609, without path, bug #314057 - export PERL=perl - fi - - xdg_src_prepare - gnome2_environment_reset - # TODO: python_name sedding for correct python shebang? Might be relevant mainly for glib-utils only -} - -multilib_src_configure() { - if use debug; then - append-cflags -DG_ENABLE_DEBUG - else - append-cflags -DG_DISABLE_CAST_CHECKS # https://gitlab.gnome.org/GNOME/glib/issues/1833 - fi - - # TODO: figure a way to pass appropriate values for all cross properties that glib uses (search for get_cross_property) - #if tc-is-cross-compiler ; then - # https://bugzilla.gnome.org/show_bug.cgi?id=756473 - # TODO-meson: This should be in meson cross file as 'growing_stack' property; and more, look at get_cross_property - #case ${CHOST} in - #hppa*|metag*) export glib_cv_stack_grows=yes ;; - #*) export glib_cv_stack_grows=no ;; - #esac - #fi - - local emesonargs=( - -Ddefault_library=$(usex static-libs both shared) - $(meson_feature selinux) - $(meson_use xattr) - -Dlibmount=enabled # only used if host_system == 'linux' - -Dinternal_pcre=false - -Dman=true - $(meson_use systemtap dtrace) - $(meson_use systemtap) - $(meson_feature sysprof) - -Dgtk_doc=$(multilib_native_usex gtk-doc true false) - $(meson_use fam) - -Dinstalled_tests=false - -Dnls=enabled - -Doss_fuzz=disabled - ) - meson_src_configure -} - -multilib_src_compile() { - meson_src_compile -} - -multilib_src_test() { - export XDG_CONFIG_DIRS="${EPREFIX}"/etc/xdg - export XDG_DATA_DIRS="${EPREFIX}"/usr/local/share:/usr/share - export G_DBUS_COOKIE_SHA1_KEYRING_DIR="${T}/temp" - export LC_TIME=C # bug #411967 - unset GSETTINGS_BACKEND # bug #596380 - python_setup - - # Related test is a bit nitpicking - mkdir "$G_DBUS_COOKIE_SHA1_KEYRING_DIR" - chmod 0700 "$G_DBUS_COOKIE_SHA1_KEYRING_DIR" - - meson_src_test --timeout-multiplier 2 --no-suite flaky -} - -multilib_src_install() { - meson_src_install - keepdir /usr/$(get_libdir)/gio/modules -} - -multilib_src_install_all() { - einstalldocs - - # These are installed by dev-util/glib-utils - # TODO: With patching we might be able to get rid of the python-any deps and removals, and test depend on glib-utils instead; revisit now with meson - rm "${ED}/usr/bin/glib-genmarshal" || die - rm "${ED}/usr/share/man/man1/glib-genmarshal.1" || die - rm "${ED}/usr/bin/glib-mkenums" || die - rm "${ED}/usr/share/man/man1/glib-mkenums.1" || die - rm "${ED}/usr/bin/gtester-report" || die - rm "${ED}/usr/share/man/man1/gtester-report.1" || die - # gdbus-codegen manpage installed by dev-util/gdbus-codegen - rm "${ED}/usr/share/man/man1/gdbus-codegen.1" || die -} - -pkg_preinst() { - xdg_pkg_preinst - - # Make gschemas.compiled belong to glib alone - local cache="/usr/share/glib-2.0/schemas/gschemas.compiled" - - if [[ -e ${EROOT}${cache} ]]; then - cp "${EROOT}"${cache} "${ED}"/${cache} || die - else - touch "${ED}"${cache} || die - fi - - multilib_pkg_preinst() { - # Make giomodule.cache belong to glib alone - local cache="/usr/$(get_libdir)/gio/modules/giomodule.cache" - - if [[ -e ${EROOT}${cache} ]]; then - cp "${EROOT}"${cache} "${ED}"${cache} || die - else - touch "${ED}"${cache} || die - fi - } - - # Don't run the cache ownership when cross-compiling, as it would end up with an empty cache - # file due to inability to create it and GIO might not look at any of the modules there - if ! tc-is-cross-compiler ; then - multilib_foreach_abi multilib_pkg_preinst - fi -} - -pkg_postinst() { - xdg_pkg_postinst - # glib installs no schemas itself, but we force update for fresh install in case - # something has dropped in a schemas file without direct glib dep; and for upgrades - # in case the compiled schema format could have changed - gnome2_schemas_update - - multilib_pkg_postinst() { - gnome2_giomodule_cache_update \ - || die "Update GIO modules cache failed (for ${ABI})" - } - if ! tc-is-cross-compiler ; then - multilib_foreach_abi multilib_pkg_postinst - else - ewarn "Updating of GIO modules cache skipped due to cross-compilation." - ewarn "You might want to run gio-querymodules manually on the target for" - ewarn "your final image for performance reasons and re-run it when packages" - ewarn "installing GIO modules get upgraded or added to the image." - fi - - for v in ${REPLACING_VERSIONS}; do - if ver_test "$v" "-lt" "2.63.6"; then - ewarn "glib no longer installs the gio-launch-desktop binary. You may need" - ewarn "to restart your session for \"Open With\" dialogs to work." - fi - done -} - -pkg_postrm() { - xdg_pkg_postrm - gnome2_schemas_update - - if [[ -z ${REPLACED_BY_VERSION} ]]; then - multilib_pkg_postrm() { - rm -f "${EROOT}"/usr/$(get_libdir)/gio/modules/giomodule.cache - } - multilib_foreach_abi multilib_pkg_postrm - rm -f "${EROOT}"/usr/share/glib-2.0/schemas/gschemas.compiled - fi -} diff --git a/dev-libs/glib/metadata.xml b/dev-libs/glib/metadata.xml deleted file mode 100644 index 2d02878840..0000000000 --- a/dev-libs/glib/metadata.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> -<pkgmetadata> - <maintainer type="project"> - <email>gnome@gentoo.org</email> - <name>Gentoo GNOME Desktop</name> - </maintainer> - <use> - <flag name="dbus"> - Enable dependencies required by glib libraries - using dbus service to manage settings saving - </flag> - <flag name="mime"> - Pull in shared MIME database that many glib-based - applications require at runtime to detect or open files. Warning: - do not disable this flag unless installing on a headless server. - </flag> - <flag name="systemtap"> - Build support for profiling and tracing using - <pkg>dev-util/systemtap</pkg> - </flag> - <flag name="sysprof"> - Enable profiling data capture support using - <pkg>dev-util/sysprof-capture</pkg> - </flag> - <flag name="utils"> - Install gtester-report utility to generate test - report files for your software; build gresource utility with - ELF support. - </flag> - </use> - <upstream> - <remote-id type="cpe">cpe:/a:gnome:glib</remote-id> - </upstream> -</pkgmetadata> diff --git a/dev-util/dialog/dialog-1.3.20181022.ebuild b/dev-util/dialog/dialog-1.3.20181022.ebuild index 2765e27ff0..17e088f5e5 100644 --- a/dev-util/dialog/dialog-1.3.20181022.ebuild +++ b/dev-util/dialog/dialog-1.3.20181022.ebuild @@ -11,7 +11,7 @@ SRC_URI="https://dev.gentoo.org/~jer/${DIA_P}.tgz" LICENSE="GPL-2" SLOT="0/15" -KEYWORDS="~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" IUSE="examples minimal nls static-libs unicode" RDEPEND=" @@ -19,7 +19,7 @@ RDEPEND=" " DEPEND=" ${RDEPEND} - nls? ( sys-devel/gettext ) + nls? ( dev-build/gettext ) !minimal? ( sys-devel/libtool ) !<=sys-freebsd/freebsd-contrib-8.9999 " diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass index fa46b72b3d..a84f7c3002 100644 --- a/eclass/java-utils-2.eclass +++ b/eclass/java-utils-2.eclass @@ -1,4 +1,4 @@ -# Copyright 2004-2022 Gentoo Authors +# Copyright 2004-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: java-utils-2.eclass @@ -6,7 +6,7 @@ # java@gentoo.org # @AUTHOR: # Thomas Matthijs <axxo@gentoo.org>, Karl Trygve Kalleberg <karltk@gentoo.org> -# @SUPPORTED_EAPIS: 5 6 7 8 +# @SUPPORTED_EAPIS: 6 7 8 # @BLURB: Base eclass for Java packages # @DESCRIPTION: # This eclass provides functionality which is used by java-pkg-2.eclass, @@ -17,17 +17,17 @@ # that have optional Java support. In addition you can inherit java-ant-2 for # Ant-based packages. -case ${EAPI:-0} in - [5678]) ;; +case ${EAPI} in + 6|7|8) ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac if [[ -z ${_JAVA_UTILS_2_ECLASS} ]] ; then _JAVA_UTILS_2_ECLASS=1 -# EAPI 7 has version functions built-in. Use eapi7-ver for all earlier eclasses. +# EAPI 7 has version functions built-in. Use eapi7-ver for all earlier EAPIs. # Keep versionator inheritance in case consumers are using it implicitly. -[[ ${EAPI} == [56] ]] && inherit eapi7-ver eutils multilib versionator +[[ ${EAPI} == 6 ]] && inherit eapi7-ver eqawarn multilib versionator # Make sure we use java-config-2 export WANT_JAVA_CONFIG="2" @@ -37,7 +37,7 @@ has test ${JAVA_PKG_IUSE} && RESTRICT+=" !test? ( test )" # @VARIABLE: JAVA_PKG_E_DEPEND # @INTERNAL # @DESCRIPTION: -# This is a convience variable to be used from the other java eclasses. This is +# This is a convenience variable to be used from the other java eclasses. This is # the version of java-config we want to use. Usually the latest stable version # so that ebuilds can use new features without depending on specific versions. JAVA_PKG_E_DEPEND=">=dev-java/java-config-2.2.0-r3" @@ -66,6 +66,21 @@ JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"} # JAVA_PKG_FORCE_VM=openjdk-11 emerge foo # @CODE +# @ECLASS_VARIABLE: JAVA_PKG_NO_CLEAN +# @DEFAULT_UNSET +# @DESCRIPTION: +# An array of expressions to match *.class or *.jar files in order to protect +# them against deletion by java-pkg_clean. +# +# @CODE +# JAVA_PKG_NO_CLEAN=( +# "*/standard.jar" +# "*/launch4j.jar" +# "*/apps/jetty/apache-tomcat*" +# "*/lib/jetty*" +# ) +# @CODE + # @ECLASS_VARIABLE: JAVA_PKG_WANT_BUILD_VM # @DEFAULT_UNSET # @DESCRIPTION: @@ -124,7 +139,7 @@ JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"} # ) # @CODE -# @ECLASS-VARIABLE: JAVA_TEST_RUNNER_EXTRA_ARGS +# @ECLASS_VARIABLE: JAVA_TEST_RUNNER_EXTRA_ARGS # @DEFAULT_UNSET # @DESCRIPTION: # Array of extra arguments that should be passed to the test runner when running tests. @@ -203,6 +218,46 @@ JAVA_PKG_COMPILERS_CONF=${JAVA_PKG_COMPILERS_CONF:="${EPREFIX}/etc/java-config-2 # ebuild foo.ebuild compile # @CODE +# @ECLASS_VARIABLE: JAVADOC_CLASSPATH +# @DEFAULT_UNSET +# @DESCRIPTION: +# Comma or space separated list of java packages that are needed for generating +# javadocs. Can be used to avoid overloading the compile classpath in multi-jar +# packages if there are jar files which have different dependencies. +# +# @CODE +# Example: +# JAVADOC_CLASSPATH=" +# jna-4 +# jsch +# " +# @CODE + +# @ECLASS_VARIABLE: JAVADOC_SRC_DIRS +# @DEFAULT_UNSET +# @DESCRIPTION: +# An array of directories relative to ${S} which contain the sources of +# the application. It needs to sit in global scope; if put in src_compile() +# it would not work. +# It is needed by the java-pkg-simple.eclass to decide whether to call ejavadoc +# or not. If this variable is defined then java-pkg-simple_src_compile will not +# call ejavadoc automatically. ejavadoc has then to be called explicitly from +# the ebuild. It is meant for usage in multi-jar packages in order to avoid an +# extra compilation run only for producing the javadocs. +# +# @CODE +# Example: +# JAVADOC_SRC_DIRS=( +# "${PN}-core" +# "${PN}-jsch" +# "${PN}-pageant" +# "${PN}-sshagent" +# "${PN}-usocket-jna" +# "${PN}-usocket-nc" +# "${PN}-connector-factory" +# ) +# @CODE + # TODO document me JAVA_PKG_QA_VIOLATIONS=0 @@ -316,7 +371,6 @@ java-pkg_rm_files() { [[ ! -f "${filename}" ]] && die "${filename} is not a regular file. Aborting." einfo "Removing unneeded file ${filename}" rm -f "${S}/${filename}" || die "cannot remove ${filename}" - eend $? done } @@ -769,7 +823,7 @@ java-pkg_dosrc() { # @FUNCTION: java-pkg_dolauncher # @USAGE: <filename> [options] # @DESCRIPTION: -# Make a wrapper script to lauch/start this package +# Make a wrapper script to launch/start this package # If necessary, the wrapper will switch to the appropriate VM. # # Can be called without parameters if the package installs only one jar @@ -939,7 +993,7 @@ java-pkg_recordjavadoc() # Example: get a specific jar from xerces slot 2 # java-pkg_jar-from xerces-2 xml-apis.jar # -# Example: get a specific jar from xerces slot 2, and name it diffrently +# Example: get a specific jar from xerces slot 2, and name it differently # java-pkg_jar-from xerces-2 xml-apis.jar xml.jar # # Example: get junit.jar which is needed only for building @@ -1350,7 +1404,7 @@ java-pkg_register-optional-dependency() { # @DESCRIPTION: # Register an arbitrary environment variable into package.env. The gjl launcher # for this package or any package depending on this will export it into -# environement before executing java command. +# environment before executing java command. # Must only be called in src_install phase. JAVA_PKG_EXTRA_ENV="${T}/java-pkg-extra-env" JAVA_PKG_EXTRA_ENV_VARS="" @@ -1696,16 +1750,6 @@ java-pkg_get-jni-cflags() { echo ${flags} } -java-pkg_ensure-gcj() { - # was enforcing sys-devel/gcc[gcj] - die "${FUNCNAME} was removed. Use use-deps available as of EAPI 2 instead. #261562" -} - -java-pkg_ensure-test() { - # was enforcing USE=test if FEATURES=test - die "${FUNCNAME} was removed. Package mangers handle this already. #278965" -} - # @FUNCTION: java-pkg_register-ant-task # @USAGE: [--version x.y] [<name>] # @DESCRIPTION: @@ -1879,13 +1923,17 @@ ejunit4() { # @CODE # $1 - -cp or -classpath # $2 - the classpath passed to it -# $@ - test classes for testng to run. +# $@ - test classes or testng.xml for testng to run. # @CODE etestng() { debug-print-function ${FUNCNAME} $* local runner=org.testng.TestNG - local cp=$(java-pkg_getjars --with-dependencies testng) + if [[ ${PN} != testng ]]; then + local cp=$(java-pkg_getjars --with-dependencies testng) + else + local cp=testng.jar + fi local tests if [[ ${1} = -cp || ${1} = -classpath ]]; then @@ -1903,14 +1951,24 @@ etestng() { -cp ${cp} -Djava.io.tmpdir="${T}" -Djava.awt.headless=true + -Dtest.resources.dir="${JAVA_TEST_RESOURCE_DIRS}" ${JAVA_TEST_EXTRA_ARGS[@]} ${runner} ${JAVA_TEST_RUNNER_EXTRA_ARGS[@]} ) - [[ ! "${JAVA_TEST_RUNNER_EXTRA_ARGS[@]}" =~ "-usedefaultlisteners" ]] && args+=( -usedefaultlisteners false ) + if [[ ! "${JAVA_TEST_RUNNER_EXTRA_ARGS[@]}" =~ "-usedefaultlisteners" ]]; then + args+=( + -verbose 3 + -usedefaultlisteners true + ) + fi - args+=( -testclass ${tests} ) + if [[ "${test%.xml}" == "${test}" ]]; then + args+=( -testclass ${tests} ) + else + args+=( ${tests%,} ) + fi debug-print "java ${args[@]}" java ${args[@]} || die "Running TestNG failed." @@ -1921,13 +1979,9 @@ etestng() { # src_prepare Searches for bundled jars # Don't call directly, but via java-pkg-2_src_prepare! java-utils-2_src_prepare() { - case ${EAPI:-0} in - 5) - java-pkg_func-exists java_prepare && java_prepare ;; - *) - java-pkg_func-exists java_prepare && - eqawarn "java_prepare is no longer called, define src_prepare instead." - eapply_user ;; + case ${EAPI} in + [678]) eapply_user ;; + *) default_src_prepare ;; esac # Check for files in JAVA_RM_FILES array. @@ -2148,9 +2202,27 @@ ejavadoc() { einfo "javadoc ${javadoc_args} ${@}" fi - local args=( javadoc ${javadoc_args} "${@}" ) - echo "${args[@]}" >&2 - "${args[@]}" || die "ejavadoc failed" + if [[ "${JAVADOC_SRC_DIRS[@]}" ]]; then + mkdir -p target/api || die "cannot create target/api" + local dependency + for dependency in ${JAVADOC_CLASSPATH}; do + classpath="${classpath}:$(java-pkg_getjars \ + --build-only \ + --with-dependencies \ + ${dependency})" + done + find "${JAVADOC_SRC_DIRS[@]}" -name '*.java' > sources + javadoc \ + "${javadoc_args}" \ + -d target/api \ + -cp "${classpath}" \ + -quiet \ + @sources || die "ejavadoc failed" + else + local args=( javadoc ${javadoc_args} "${@}" ) + echo "${args[@]}" >&2 + "${args[@]}" || die "ejavadoc failed" + fi } # @FUNCTION: java-pkg_filter-compiler @@ -2378,7 +2450,7 @@ java-pkg_init-compiler_() { } -# @FUNCTION: init_paths_ +# @FUNCTION: java-pkg_init_paths_ # @INTERNAL # @DESCRIPTION: # Initializes some variables that will be used. These variables are mostly used @@ -2628,7 +2700,7 @@ java-pkg_get-vm-version() { # @RETURN: VM handle of an available JDK # @DESCRIPTION: # Selects a build vm from a list of vm handles. First checks for the system-vm -# beeing usable, then steps through the listed handles till a suitable vm is +# being usable, then steps through the listed handles till a suitable vm is # found. # java-pkg_build-vm-from-handle() { @@ -2931,11 +3003,13 @@ is-java-strict() { # @FUNCTION: java-pkg_clean # @DESCRIPTION: # Java package cleaner function. This will remove all *.class and *.jar -# files, removing any bundled dependencies. +# files, except those specified by expressions in JAVA_PKG_NO_CLEAN. java-pkg_clean() { - if [[ -z "${JAVA_PKG_NO_CLEAN}" ]]; then - find "${@}" '(' -name '*.class' -o -name '*.jar' ')' -type f -delete -print || die - fi + NO_DELETE=() + for keep in ${JAVA_PKG_NO_CLEAN[@]}; do + NO_DELETE+=( '!' '-path' ${keep} ) + done + find "${@}" '(' -name '*.class' -o -name '*.jar' ${NO_DELETE[@]} ')' -type f -delete -print || die } # @FUNCTION: java-pkg_gen-cp diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index c50da71ac8..5abe526b45 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2022 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: python-utils-r1.eclass @@ -7,7 +7,7 @@ # @AUTHOR: # Author: MichaÅ‚ Górny <mgorny@gentoo.org> # Based on work of: Krzysztof Pawlik <nelchael@gentoo.org> -# @SUPPORTED_EAPIS: 6 7 8 +# @SUPPORTED_EAPIS: 7 8 # @BLURB: Utility functions for packages with Python parts. # @DESCRIPTION: # A utility eclass providing functions to query Python implementations, @@ -22,19 +22,16 @@ # NOTE: When dropping support for EAPIs here, we need to update # metadata/install-qa-check.d/60python-pyc # See bug #704286, bug #781878 -case "${EAPI:-0}" in - [0-5]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;; - [6-8]) ;; - *) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;; -esac -if [[ ${_PYTHON_ECLASS_INHERITED} ]]; then - die 'python-r1 suite eclasses can not be used with python.eclass.' -fi +case ${EAPI} in + 7|8) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; +esac -if [[ ! ${_PYTHON_UTILS_R1} ]]; then +if [[ ! ${_PYTHON_UTILS_R1_ECLASS} ]]; then +_PYTHON_UTILS_R1_ECLASS=1 -[[ ${EAPI} == [67] ]] && inherit eapi8-dosym +[[ ${EAPI} == 7 ]] && inherit eapi8-dosym inherit multiprocessing toolchain-funcs # @ECLASS_VARIABLE: _PYTHON_ALL_IMPLS @@ -43,7 +40,7 @@ inherit multiprocessing toolchain-funcs # All supported Python implementations, most preferred last. _PYTHON_ALL_IMPLS=( pypy3 - python3_{8..11} + python3_{10..12} ) readonly _PYTHON_ALL_IMPLS @@ -55,7 +52,7 @@ _PYTHON_HISTORICAL_IMPLS=( jython2_7 pypy pypy1_{8,9} pypy2_0 python2_{5..7} - python3_{1..7} + python3_{1..9} ) readonly _PYTHON_HISTORICAL_IMPLS @@ -83,7 +80,7 @@ _python_verify_patterns() { local impl pattern for pattern; do case ${pattern} in - -[23]|3.[89]|3.1[01]) + -[23]|3.[89]|3.1[012]) continue ;; esac @@ -117,11 +114,18 @@ _python_verify_patterns() { _python_set_impls() { local i - if ! declare -p PYTHON_COMPAT &>/dev/null; then - die 'PYTHON_COMPAT not declared.' + # TODO: drop BASH_VERSINFO check when we require EAPI 8 + if [[ ${BASH_VERSINFO[0]} -ge 5 ]]; then + [[ ${PYTHON_COMPAT@a} == *a* ]] + else + [[ $(declare -p PYTHON_COMPAT) == "declare -a"* ]] fi - if [[ $(declare -p PYTHON_COMPAT) != "declare -a"* ]]; then - die 'PYTHON_COMPAT must be an array.' + if [[ ${?} -ne 0 ]]; then + if ! declare -p PYTHON_COMPAT &>/dev/null; then + die 'PYTHON_COMPAT not declared.' + else + die 'PYTHON_COMPAT must be an array.' + fi fi local obsolete=() @@ -132,9 +136,9 @@ _python_set_impls() { # please keep them in sync with _PYTHON_ALL_IMPLS # and _PYTHON_HISTORICAL_IMPLS case ${i} in - pypy3|python2_7|python3_[89]|python3_1[01]) + pypy3|python3_9|python3_1[0-2]) ;; - jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-6]|python3_[1-7]) + jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-7]|python3_[1-9]) obsolete+=( "${i}" ) ;; *) @@ -149,17 +153,6 @@ _python_set_impls() { done fi - if [[ -n ${obsolete[@]} && ${EBUILD_PHASE} == setup ]]; then - # complain if people don't clean up old impls while touching - # the ebuilds recently. use the copyright year to infer last - # modification - # NB: this check doesn't have to work reliably - if [[ $(head -n 1 "${EBUILD}" 2>/dev/null) == *2022* ]]; then - eqawarn "Please clean PYTHON_COMPAT of obsolete implementations:" - eqawarn " ${obsolete[*]}" - fi - fi - local supp=() unsupp=() for i in "${_PYTHON_ALL_IMPLS[@]}"; do @@ -171,13 +164,7 @@ _python_set_impls() { done if [[ ! ${supp[@]} ]]; then - # special-case python2_7 for python-any-r1 - if [[ ${_PYTHON_ALLOW_PY27} ]] && has python2_7 "${PYTHON_COMPAT[@]}" - then - supp+=( python2_7 ) - else - die "No supported implementation in PYTHON_COMPAT." - fi + die "No supported implementation in PYTHON_COMPAT." fi if [[ ${_PYTHON_SUPPORTED_IMPLS[@]} ]]; then @@ -223,7 +210,7 @@ _python_impl_matches() { for pattern; do case ${pattern} in -2|python2*|pypy) - if [[ ${EAPI} != [67] ]]; then + if [[ ${EAPI} != 7 ]]; then eerror eerror "Python 2 is no longer supported in Gentoo, please remove Python 2" eerror "${FUNCNAME[1]} calls." @@ -232,7 +219,7 @@ _python_impl_matches() { ;; -3) # NB: "python3*" is fine, as "not pypy3" - if [[ ${EAPI} != [67] ]]; then + if [[ ${EAPI} != 7 ]]; then eerror eerror "Python 2 is no longer supported in Gentoo, please remove Python 2" eerror "${FUNCNAME[1]} calls." @@ -240,12 +227,11 @@ _python_impl_matches() { fi return 0 ;; - 3.9) - # the only unmasked pypy3 version is pypy3.9 atm + 3.10) [[ ${impl} == python${pattern/./_} || ${impl} == pypy3 ]] && return 0 ;; - 3.8|3.1[01]) + 3.8|3.9|3.1[1-2]) [[ ${impl} == python${pattern/./_} ]] && return 0 ;; *) @@ -341,7 +327,9 @@ _python_export() { debug-print "${FUNCNAME}: EPYTHON = ${EPYTHON}" ;; PYTHON) - export PYTHON=${EPREFIX}/usr/bin/${impl} + # Under EAPI 7+, this should just use ${BROOT}, but Portage + # <3.0.50 was buggy, and prefix users need this to update. + export PYTHON=${BROOT-${EPREFIX}}/usr/bin/${impl} if [[ " python jython pypy pypy3 " != *" ${PN} "* ]] \ && [[ ! -x ${EPREFIX}/usr/bin/${impl} ]] \ && { has prefix-stack ${USE} || has stacked-prefix ${FEATURES} ;} ; then @@ -355,9 +343,9 @@ _python_export() { PYTHON_SITEDIR) [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it" PYTHON_SITEDIR=$( - "${PYTHON}" - <<-EOF || die - import sysconfig - print(sysconfig.get_path("purelib")) + "${PYTHON}" - "${EPREFIX}/usr" <<-EOF || die + import sys, sysconfig + print(sysconfig.get_path("purelib", vars={"base": sys.argv[1]})) EOF ) export PYTHON_SITEDIR @@ -366,9 +354,9 @@ _python_export() { PYTHON_INCLUDEDIR) [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it" PYTHON_INCLUDEDIR=$( - "${PYTHON}" - <<-EOF || die - import sysconfig - print(sysconfig.get_path("platinclude")) + "${PYTHON}" - "${ESYSROOT}/usr" <<-EOF || die + import sys, sysconfig + print(sysconfig.get_path("platinclude", vars={"installed_platbase": sys.argv[1]})) EOF ) export PYTHON_INCLUDEDIR @@ -419,10 +407,6 @@ _python_export() { local val case "${impl}" in - python2*|python3.6|python3.7*) - # python* up to 3.7 - val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}) || die - ;; python*) # python3.8+ val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}-embed) || die @@ -461,22 +445,12 @@ _python_export() { PYTHON_PKG_DEP) local d case ${impl} in - python2.7) - PYTHON_PKG_DEP='>=dev-lang/python-2.7.5-r2:2.7';; - python3.8) - PYTHON_PKG_DEP=">=dev-lang/python-3.8.12_p1-r1:3.8";; - python3.9) - PYTHON_PKG_DEP=">=dev-lang/python-3.9.9-r1:3.9";; - python3.10) - PYTHON_PKG_DEP=">=dev-lang/python-3.10.0_p1-r1:3.10";; - python3.11) - PYTHON_PKG_DEP=">=dev-lang/python-3.11.0_beta1-r1:3.11";; python*) - PYTHON_PKG_DEP="dev-lang/python:${impl#python}";; - pypy) - PYTHON_PKG_DEP='>=dev-python/pypy-7.3.0:0=';; + PYTHON_PKG_DEP="dev-lang/python:${impl#python}" + ;; pypy3) - PYTHON_PKG_DEP='>=dev-python/pypy3-7.3.7-r1:0=';; + PYTHON_PKG_DEP="dev-python/${impl}:=" + ;; *) die "Invalid implementation: ${impl}" esac @@ -658,22 +632,22 @@ python_optimize() { einfo "Optimize Python modules for ${instpath}" case "${EPYTHON}" in - python2.7|python3.[34]) - "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}" - "${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}" - ;; - python3.[5678]|pypy3) + python3.8) # both levels of optimization are separate since 3.5 "${PYTHON}" -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}" "${PYTHON}" -O -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}" "${PYTHON}" -OO -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}" ;; - python*) + python*|pypy3) + # Python 3.9+ "${PYTHON}" -m compileall -j "${jobs}" -o 0 -o 1 -o 2 --hardlink-dupes -q -f -d "${instpath}" "${d}" ;; - *) + pypy|jython2.7) "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}" ;; + *) + die "${FUNCNAME}: unexpected EPYTHON=${EPYTHON}" + ;; esac done } @@ -755,7 +729,7 @@ python_newexe() { # install the wrapper local dosym=dosym - [[ ${EAPI} == [67] ]] && dosym=dosym8 + [[ ${EAPI} == 7 ]] && dosym=dosym8 "${dosym}" -r /usr/lib/python-exec/python-exec2 "${wrapd}/${newfn}" # don't use this at home, just call python_doscript() instead @@ -970,15 +944,6 @@ _python_wrapper_setup() { local EPYTHON PYTHON _python_export "${impl}" EPYTHON PYTHON - local pyver pyother - if [[ ${EPYTHON} != python2* ]]; then - pyver=3 - pyother=2 - else - pyver=2 - pyother=3 - fi - # Python interpreter # note: we don't use symlinks because python likes to do some # symlink reading magic that breaks stuff @@ -987,10 +952,10 @@ _python_wrapper_setup() { #!/bin/sh exec "${PYTHON}" "\${@}" _EOF_ - cp "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || die - chmod +x "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || die + cp "${workdir}/bin/python" "${workdir}/bin/python3" || die + chmod +x "${workdir}/bin/python" "${workdir}/bin/python3" || die - local nonsupp=( "python${pyother}" "python${pyother}-config" ) + local nonsupp=( python2 python2-config ) # CPython-specific if [[ ${EPYTHON} == python* ]]; then @@ -999,24 +964,22 @@ _python_wrapper_setup() { exec "${PYTHON}-config" "\${@}" _EOF_ cp "${workdir}/bin/python-config" \ - "${workdir}/bin/python${pyver}-config" || die + "${workdir}/bin/python3-config" || die chmod +x "${workdir}/bin/python-config" \ - "${workdir}/bin/python${pyver}-config" || die + "${workdir}/bin/python3-config" || die # Python 2.6+. ln -s "${PYTHON/python/2to3-}" "${workdir}"/bin/2to3 || die # Python 2.7+. ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}.pc \ - "${workdir}"/pkgconfig/python${pyver}.pc || die + "${workdir}"/pkgconfig/python3.pc || die # Python 3.8+. - if [[ ${EPYTHON} != python[23].[67] ]]; then - ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}-embed.pc \ - "${workdir}"/pkgconfig/python${pyver}-embed.pc || die - fi + ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}-embed.pc \ + "${workdir}"/pkgconfig/python3-embed.pc || die else - nonsupp+=( 2to3 python-config "python${pyver}-config" ) + nonsupp+=( 2to3 python-config python3-config ) fi local x @@ -1067,8 +1030,6 @@ python_fix_shebang() { debug-print-function ${FUNCNAME} "${@}" [[ ${EPYTHON} ]] || die "${FUNCNAME}: EPYTHON unset (pkg_setup not called?)" - local PYTHON - _python_export "${EPYTHON}" PYTHON local force quiet while [[ ${@} ]]; do @@ -1113,11 +1074,10 @@ python_fix_shebang() { "${EPYTHON}") match=1 ;; - python|python[23]) + python|python3) match=1 - [[ ${in_path##*/} == python2 ]] && error=1 ;; - python[23].[0-9]|python3.[1-9][0-9]|pypy|pypy3|jython[23].[0-9]) + python2|python[23].[0-9]|python3.[1-9][0-9]|pypy|pypy3|jython[23].[0-9]) # Explicit mismatch. match=1 error=1 @@ -1278,6 +1238,62 @@ _python_check_EPYTHON() { fi } +# @FUNCTION: _python_check_occluded_packages +# @INTERNAL +# @DESCRIPTION: +# Check if the current directory does not contain any incomplete +# package sources that would block installed packages from being used +# (and effectively e.g. make it impossible to load compiled extensions). +_python_check_occluded_packages() { + debug-print-function ${FUNCNAME} "${@}" + + [[ -z ${BUILD_DIR} || ! -d ${BUILD_DIR}/install ]] && return + + local sitedir="${BUILD_DIR}/install$(python_get_sitedir)" + # avoid unnecessarily checking if we are inside install dir + [[ ${sitedir} -ef . ]] && return + + local f fn diff l + for f in "${sitedir}"/*/; do + f=${f%/} + fn=${f##*/} + + # skip metadata directories + [[ ${fn} == *.dist-info || ${fn} == *.egg-info ]] && continue + + if [[ -d ${fn} ]]; then + diff=$( + comm -1 -3 <( + find "${fn}" -type f -not -path '*/__pycache__/*' | + sort + assert + ) <( + cd "${sitedir}" && + find "${fn}" -type f -not -path '*/__pycache__/*' | + sort + assert + ) + ) + + if [[ -n ${diff} ]]; then + eqawarn "The directory ${fn} occludes package installed for ${EPYTHON}." + eqawarn "The installed package includes additional files:" + eqawarn + while IFS= read -r l; do + eqawarn " ${l}" + done <<<"${diff}" + eqawarn + + if [[ ! ${_PYTHON_WARNED_OCCLUDED_PACKAGES} ]]; then + eqawarn "For more information on occluded packages, please see:" + eqawarn "https://projects.gentoo.org/python/guide/test.html#importerrors-for-c-extensions" + _PYTHON_WARNED_OCCLUDED_PACKAGES=1 + fi + fi + fi + done +} + # @VARIABLE: EPYTEST_DESELECT # @DEFAULT_UNSET # @DESCRIPTION: @@ -1296,6 +1312,31 @@ _python_check_EPYTHON() { # parameter, when calling epytest. The listed files will be entirely # skipped from test collection. +# @ECLASS_VARIABLE: EPYTEST_TIMEOUT +# @DEFAULT_UNSET +# @DESCRIPTION: +# If set to a non-empty value, enables pytest-timeout plugin and sets +# test timeout to the specified value. This variable can be either set +# in ebuilds that are known to hang, or by user to prevent hangs +# in automated test environments. If this variable is set prior +# to calling distutils_enable_tests in distutils-r1, a test dependency +# on dev-python/pytest-timeout is added automatically. + +# @ECLASS_VARIABLE: EPYTEST_XDIST +# @DEFAULT_UNSET +# @DESCRIPTION: +# If set to a non-empty value, enables running tests in parallel +# via pytest-xdist plugin. If this variable is set prior to calling +# distutils_enable_tests in distutils-r1, a test dependency +# on dev-python/pytest-xdist is added automatically. + +# @ECLASS_VARIABLE: EPYTEST_JOBS +# @USER_VARIABLE +# @DEFAULT_UNSET +# @DESCRIPTION: +# Specifies the number of jobs for parallel (pytest-xdist) test runs. +# When unset, defaults to -j from MAKEOPTS, or the current nproc. + # @FUNCTION: epytest # @USAGE: [<args>...] # @DESCRIPTION: @@ -1308,16 +1349,10 @@ epytest() { debug-print-function ${FUNCNAME} "${@}" _python_check_EPYTHON + _python_check_occluded_packages - local color - case ${NOCOLOR} in - true|yes) - color=no - ;; - *) - color=yes - ;; - esac + local color=yes + [[ ${NO_COLOR} ]] && color=no local args=( # verbose progress reporting and tracebacks @@ -1335,18 +1370,74 @@ epytest() { # count is more precise when we're dealing with a large number # of tests -o console_output_style=count - # disable the undesirable-dependency plugins by default to - # trigger missing argument strips. strip options that require - # them from config files. enable them explicitly via "-p ..." - # if you *really* need them. - -p no:cov - -p no:flake8 - -p no:flakes - -p no:pylint - # sterilize pytest-markdown as it runs code snippets from all - # *.md files found without any warning - -p no:markdown + # minimize the temporary directory retention, the test suites + # of some packages can grow them pretty large and normally + # we don't need to preserve them + -o tmp_path_retention_count=0 + -o tmp_path_retention_policy=failed ) + + if [[ ! ${PYTEST_DISABLE_PLUGIN_AUTOLOAD} ]]; then + args+=( + # disable the undesirable-dependency plugins by default to + # trigger missing argument strips. strip options that require + # them from config files. enable them explicitly via "-p ..." + # if you *really* need them. + -p no:cov + -p no:flake8 + -p no:flakes + -p no:pylint + # sterilize pytest-markdown as it runs code snippets from all + # *.md files found without any warning + -p no:markdown + # pytest-sugar undoes everything that's good about pytest output + # and makes it hard to read logs + -p no:sugar + # pytest-xvfb automatically spawns Xvfb for every test suite, + # effectively forcing it even when we'd prefer the tests + # not to have DISPLAY at all, causing crashes sometimes + # and causing us to miss missing virtualx usage + -p no:xvfb + # intrusive packages that break random test suites + -p no:pytest-describe + -p no:plus + -p no:tavern + # does something to logging + -p no:salt-factories + ) + fi + + if [[ -n ${EPYTEST_TIMEOUT} ]]; then + if [[ ${PYTEST_PLUGINS} != *pytest_timeout* ]]; then + args+=( + -p timeout + ) + fi + + args+=( + "--timeout=${EPYTEST_TIMEOUT}" + ) + fi + + if [[ ${EPYTEST_XDIST} ]]; then + local jobs=${EPYTEST_JOBS:-$(makeopts_jobs)} + if [[ ${jobs} -gt 1 ]]; then + if [[ ${PYTEST_PLUGINS} != *xdist.plugin* ]]; then + args+=( + # explicitly enable the plugin, in case the ebuild was + # using PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 + -p xdist + ) + fi + args+=( + -n "${jobs}" + # worksteal ensures that workers don't end up idle when heavy + # jobs are unevenly distributed + --dist=worksteal + ) + fi + fi + local x for x in "${EPYTEST_DESELECT[@]}"; do args+=( --deselect "${x}" ) @@ -1382,8 +1473,14 @@ eunittest() { debug-print-function ${FUNCNAME} "${@}" _python_check_EPYTHON + _python_check_occluded_packages - set -- "${EPYTHON}" -m unittest_or_fail discover -v "${@}" + # unittest fails with "no tests" correctly since Python 3.12 + local runner=unittest + if _python_impl_matches "${EPYTHON}" 3.{9..11}; then + runner=unittest_or_fail + fi + set -- "${EPYTHON}" -m "${runner}" discover -v "${@}" echo "${@}" >&2 "${@}" || die -n "Tests failed with ${EPYTHON}" @@ -1401,15 +1498,13 @@ _python_run_check_deps() { debug-print-function ${FUNCNAME} "${@}" local impl=${1} - local hasv_args=( -b ) - [[ ${EAPI} == 6 ]] && hasv_args=( --host-root ) einfo "Checking whether ${impl} is suitable ..." local PYTHON_PKG_DEP _python_export "${impl}" PYTHON_PKG_DEP ebegin " ${PYTHON_PKG_DEP}" - has_version "${hasv_args[@]}" "${PYTHON_PKG_DEP}" + has_version -b "${PYTHON_PKG_DEP}" eend ${?} || return 1 declare -f python_check_deps >/dev/null || return 0 @@ -1426,10 +1521,8 @@ _python_run_check_deps() { # A convenience wrapper for has_version() with verbose output and better # defaults for use in python_check_deps(). # -# The wrapper accepts EAPI 7+-style -b/-d/-r options to indicate -# the root to perform the lookup on. Unlike has_version, the default -# is -b. In EAPI 6, -b and -d are translated to --host-root -# for compatibility. +# The wrapper accepts -b/-d/-r options to indicate the root to perform +# the lookup on. Unlike has_version, the default is -b. # # The wrapper accepts multiple package specifications. For the check # to succeed, *all* specified atoms must match. @@ -1444,14 +1537,6 @@ python_has_version() { ;; esac - if [[ ${EAPI} == 6 ]]; then - if [[ ${root_arg} == -r ]]; then - root_arg=() - else - root_arg=( --host-root ) - fi - fi - local pkg for pkg; do ebegin " ${pkg}" @@ -1462,5 +1547,4 @@ python_has_version() { return 0 } -_PYTHON_UTILS_R1=1 fi diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass index b86a9682b1..5338dc6509 100644 --- a/eclass/toolchain-funcs.eclass +++ b/eclass/toolchain-funcs.eclass @@ -1,10 +1,10 @@ -# Copyright 2002-2022 Gentoo Authors +# Copyright 2002-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: toolchain-funcs.eclass # @MAINTAINER: # Toolchain Ninjas <toolchain@gentoo.org> -# @SUPPORTED_EAPIS: 5 6 7 8 +# @SUPPORTED_EAPIS: 6 7 8 # @BLURB: functions to query common info about the toolchain # @DESCRIPTION: # The toolchain-funcs aims to provide a complete suite of functions @@ -13,9 +13,8 @@ # in such a way that you can rely on the function always returning # something sane. -case ${EAPI:-0} in - # EAPI=0 is still used by crossdev, bug #797367 - 0|5|6|7|8) ;; +case ${EAPI} in + 6|7|8) ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac @@ -341,7 +340,7 @@ tc-is-static-only() { tc-stack-grows-down() { # List the few that grow up. case ${ARCH} in - hppa|metag) return 1 ;; + hppa|metag) return 1 ;; esac # Assume all others grow down. @@ -358,16 +357,16 @@ tc-export_build_env() { # Some build envs will initialize vars like: # : ${BUILD_LDFLAGS:-${LDFLAGS}} # So make sure all variables are non-empty. #526734 - : ${BUILD_CFLAGS:=-O1 -pipe} - : ${BUILD_CXXFLAGS:=-O1 -pipe} - : ${BUILD_CPPFLAGS:= } - : ${BUILD_LDFLAGS:= } + : "${BUILD_CFLAGS:=-O1 -pipe}" + : "${BUILD_CXXFLAGS:=-O1 -pipe}" + : "${BUILD_CPPFLAGS:= }" + : "${BUILD_LDFLAGS:= }" else # https://bugs.gentoo.org/654424 - : ${BUILD_CFLAGS:=${CFLAGS}} - : ${BUILD_CXXFLAGS:=${CXXFLAGS}} - : ${BUILD_CPPFLAGS:=${CPPFLAGS}} - : ${BUILD_LDFLAGS:=${LDFLAGS}} + : "${BUILD_CFLAGS:=${CFLAGS}}" + : "${BUILD_CXXFLAGS:=${CXXFLAGS}}" + : "${BUILD_CPPFLAGS:=${CPPFLAGS}}" + : "${BUILD_LDFLAGS:=${LDFLAGS}}" fi export BUILD_{C,CXX,CPP,LD}FLAGS @@ -380,7 +379,6 @@ tc-export_build_env() { # @FUNCTION: tc-env_build # @USAGE: <command> [command args] -# @INTERNAL # @DESCRIPTION: # Setup the compile environment to the build tools and then execute the # specified command. We use tc-getBUILD_XX here so that we work with @@ -426,26 +424,27 @@ tc-env_build() { # src_configure() { # ECONF_SOURCE=${S} # if tc-is-cross-compiler ; then -# mkdir "${WORKDIR}"/${CBUILD} -# pushd "${WORKDIR}"/${CBUILD} >/dev/null +# mkdir "${WORKDIR}"/${CBUILD} || die +# pushd "${WORKDIR}"/${CBUILD} >/dev/null || die # econf_build --disable-some-unused-stuff -# popd >/dev/null +# popd >/dev/null || die # fi # ... normal build paths ... # } # src_compile() { # if tc-is-cross-compiler ; then -# pushd "${WORKDIR}"/${CBUILD} >/dev/null +# pushd "${WORKDIR}"/${CBUILD} >/dev/null || die # emake one-or-two-build-tools -# ln/mv build-tools to normal build paths in ${S}/ -# popd >/dev/null +# ln/mv build-tools to normal build paths in ${S}/ || die +# popd >/dev/null || die # fi # ... normal build paths ... # } # @CODE econf_build() { local CBUILD=${CBUILD:-${CHOST}} - tc-env_build econf --build=${CBUILD} --host=${CBUILD} "$@" + econf_env() { CHOST=${CBUILD} econf "$@"; } + tc-env_build econf_env "$@" } # @FUNCTION: tc-ld-is-gold @@ -455,6 +454,9 @@ econf_build() { tc-ld-is-gold() { local out + # Ensure ld output is in English. + local -x LC_ALL=C + # First check the linker directly. out=$($(tc-getLD "$@") --version 2>&1) if [[ ${out} == *"GNU gold"* ]] ; then @@ -466,7 +468,7 @@ tc-ld-is-gold() { # options and not CFLAGS/CXXFLAGS. local base="${T}/test-tc-gold" cat <<-EOF > "${base}.c" - int main() { return 0; } + int main(void) { return 0; } EOF out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1) rm -f "${base}"* @@ -485,6 +487,9 @@ tc-ld-is-gold() { tc-ld-is-lld() { local out + # Ensure ld output is in English. + local -x LC_ALL=C + # First check the linker directly. out=$($(tc-getLD "$@") --version 2>&1) if [[ ${out} == *"LLD"* ]] ; then @@ -496,7 +501,7 @@ tc-ld-is-lld() { # options and not CFLAGS/CXXFLAGS. local base="${T}/test-tc-lld" cat <<-EOF > "${base}.c" - int main() { return 0; } + int main(void) { return 0; } EOF out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1) rm -f "${base}"* @@ -531,43 +536,15 @@ tc-ld-force-bfd() { ewarn "Forcing usage of the BFD linker" # Set up LD to point directly to bfd if it's available. - # We need to extract the first word in case there are flags appended - # to its value (like multilib). #545218 - local ld=$(tc-getLD "$@") - local bfd_ld="${ld%% *}.bfd" - local path_ld=$(which "${bfd_ld}" 2>/dev/null) + # Unset LD first so we get the default value from tc-getLD. + local ld=$(unset LD; tc-getLD "$@") + local bfd_ld="${ld}.bfd" + local path_ld=$(type -P "${bfd_ld}" 2>/dev/null) [[ -e ${path_ld} ]] && export LD=${bfd_ld} # Set up LDFLAGS to select bfd based on the gcc / clang version. - local fallback="true" - if tc-is-gcc; then - local major=$(gcc-major-version "$@") - local minor=$(gcc-minor-version "$@") - if [[ ${major} -gt 4 ]] || [[ ${major} -eq 4 && ${minor} -ge 8 ]]; then - # gcc-4.8+ supports -fuse-ld directly. - export LDFLAGS="${LDFLAGS} -fuse-ld=bfd" - fallback="false" - fi - elif tc-is-clang; then - local major=$(clang-major-version "$@") - local minor=$(clang-minor-version "$@") - if [[ ${major} -gt 3 ]] || [[ ${major} -eq 3 && ${minor} -ge 5 ]]; then - # clang-3.5+ supports -fuse-ld directly. - export LDFLAGS="${LDFLAGS} -fuse-ld=bfd" - fallback="false" - fi - fi - if [[ ${fallback} == "true" ]] ; then - # <=gcc-4.7 and <=clang-3.4 require some coercion. - # Only works if bfd exists. - if [[ -e ${path_ld} ]] ; then - local d="${T}/bfd-linker" - mkdir -p "${d}" - ln -sf "${path_ld}" "${d}"/ld - export LDFLAGS="${LDFLAGS} -B${d}" - else - die "unable to locate a BFD linker" - fi + if tc-is-gcc || tc-is-clang ; then + export LDFLAGS="${LDFLAGS} -fuse-ld=bfd" fi } @@ -580,7 +557,7 @@ _tc-has-openmp() { local base="${T}/test-tc-openmp" cat <<-EOF > "${base}.c" #include <omp.h> - int main() { + int main(void) { int nthreads, tid, ret = 0; #pragma omp parallel private(nthreads, tid) { @@ -596,23 +573,11 @@ _tc-has-openmp() { return ${ret} } -# @FUNCTION: tc-has-openmp -# @DEPRECATED: tc-check-openmp -# @USAGE: [toolchain prefix] -# @DESCRIPTION: -# See if the toolchain supports OpenMP. This function is deprecated and will be -# removed on 2023-01-01. -tc-has-openmp() { - _tc-has-openmp "$@" -} - # @FUNCTION: tc-check-openmp # @DESCRIPTION: # Test for OpenMP support with the current compiler and error out with # a clear error message, telling the user how to rectify the missing -# OpenMP support that has been requested by the ebuild. Using this function -# to test for OpenMP support should be preferred over tc-has-openmp and -# printing a custom message, as it presents a uniform interface to the user. +# OpenMP support that has been requested by the ebuild. # # You should test for any necessary OpenMP support in pkg_pretend in order to # warn the user of required toolchain changes. You must still check for OpenMP @@ -654,6 +619,7 @@ tc-has-tls() { return *i ? j : *i; } EOF + local flags case $1 in -s) flags="-S";; @@ -680,7 +646,7 @@ tc-has-tls() { # Parse information from CBUILD/CHOST/CTARGET rather than # use external variables from the profile. tc-ninja_magic_to_arch() { -ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; } + _tc_echo_kernel_alias() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; } local type=$1 local host=$2 @@ -689,6 +655,7 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; } case ${host} in powerpc-apple-darwin*) echo ppc-macos;; x86_64-apple-darwin*) echo x64-macos;; + arm64-apple-darwin*) echo arm64-macos;; sparc-sun-solaris*) echo sparc-solaris;; sparcv9-sun-solaris*) echo sparc64-solaris;; i?86-pc-solaris*) echo x86-solaris;; @@ -697,14 +664,15 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; } aarch64*) echo arm64;; alpha*) echo alpha;; + arc*) echo arc;; arm*) echo arm;; - avr*) ninj avr32 avr;; - bfin*) ninj blackfin bfin;; + avr*) _tc_echo_kernel_alias avr32 avr;; + bfin*) _tc_echo_kernel_alias blackfin bfin;; c6x*) echo c6x;; cris*) echo cris;; frv*) echo frv;; hexagon*) echo hexagon;; - hppa*) ninj parisc hppa;; + hppa*) _tc_echo_kernel_alias parisc hppa;; i?86*) # Starting with linux-2.6.24, the 'x86_64' and 'i386' # trees have been unified into 'x86'. @@ -716,7 +684,7 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; } fi ;; ia64*) echo ia64;; - loongarch*) ninj loongarch loong;; + loongarch*) _tc_echo_kernel_alias loongarch loong;; m68*) echo m68k;; metag*) echo metag;; microblaze*) echo microblaze;; @@ -739,16 +707,15 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; } riscv*) echo riscv;; s390*) echo s390;; score*) echo score;; - sh64*) ninj sh64 sh;; + sh64*) _tc_echo_kernel_alias sh64 sh;; sh*) echo sh;; - sparc64*) ninj sparc64 sparc;; + sparc64*) _tc_echo_kernel_alias sparc64 sparc;; sparc*) [[ ${PROFILE_ARCH} == "sparc64" ]] \ - && ninj sparc64 sparc \ + && _tc_echo_kernel_alias sparc64 sparc \ || echo sparc ;; tile*) echo tile;; vax*) echo vax;; - x86_64*freebsd*) echo amd64;; x86_64*) # Starting with linux-2.6.24, the 'x86_64' and 'i386' # trees have been unified into 'x86'. @@ -763,7 +730,7 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; } # since our usage of tc-arch is largely concerned with # normalizing inputs for testing ${CTARGET}, let's filter # other cross targets (mingw and such) into the unknown. - *) echo unknown;; + *) echo unknown;; esac } # @FUNCTION: tc-arch-kernel @@ -779,6 +746,13 @@ tc-arch() { tc-ninja_magic_to_arch portage "$@" } +# @FUNCTION: tc-endian +# @USAGE: [toolchain prefix] +# @RETURN: 'big' or 'little' corresponding to the passed (or host) endianness +# @DESCRIPTION: +# Accepts 'host' as an argument which defaults to CTARGET and falls back to CHOST +# if unspecified. Returns 'big' or 'little' depending on whether 'host' is +# big or little endian. tc-endian() { local host=$1 [[ -z ${host} ]] && host=${CTARGET:-${CHOST}} @@ -788,6 +762,8 @@ tc-endian() { aarch64*be) echo big;; aarch64) echo little;; alpha*) echo little;; + arc*b*) echo big;; + arc*) echo little;; arm*b*) echo big;; arm*) echo little;; cris*) echo little;; @@ -806,7 +782,7 @@ tc-endian() { sh*) echo little;; sparc*) echo big;; x86_64*) echo little;; - *) echo wtf;; + *) echo wtf;; esac } @@ -827,8 +803,8 @@ tc-get-compiler-type() { case ${res} in *HAVE_PATHCC*) echo pathcc;; *HAVE_CLANG*) echo clang;; - *HAVE_GCC*) echo gcc;; - *) echo unknown;; + *HAVE_GCC*) echo gcc;; + *) echo unknown;; esac } @@ -846,11 +822,11 @@ tc-is-clang() { # Internal func. The first argument is the version info to expand. # Query the preprocessor to improve compatibility across different -# compilers rather than maintaining a --version flag matrix. #335943 +# compilers rather than maintaining a --version flag matrix, bug #335943. _gcc_fullversion() { local ver="$1"; shift set -- $($(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__") - eval echo "$ver" + eval echo "${ver}" } # @FUNCTION: gcc-fullversion @@ -883,7 +859,7 @@ gcc-micro-version() { _clang_fullversion() { local ver="$1"; shift set -- $($(tc-getCPP "$@") -E -P - <<<"__clang_major__ __clang_minor__ __clang_patchlevel__") - eval echo "$ver" + eval echo "${ver}" } # @FUNCTION: clang-fullversion @@ -1008,6 +984,15 @@ gcc-specs-stack-check() { [[ "${directive/\{!fno-stack-check:}" != "${directive}" ]] } +# @FUNCTION: tc-enables-cxx-assertions +# @RETURN: Truth if the current compiler enables assertions in the C++ standard library +# @DESCRIPTION: +# Return truth if the current compiler enables assertions in the C++ standard +# library. For libstdc++, this is -D_GLIBCXX_ASSERTIONS, and for libcxx/libc++, +# this is -D_LIBCPP_ENABLE_ASSERTIONS (deprecated) or -D_LIBCPP_ENABLE_HARDENED_MODE. +tc-enables-cxx-assertions() { + tc-cpp-is-true "defined(_GLIBCXX_ASSERTIONS) || defined(_LIBCPP_ENABLE_ASSERTIONS) || defined(_LIBCPP_ENABLE_HARDENED_MODE)" ${CPPFLAGS} ${CXXFLAGS} +} # @FUNCTION: tc-enables-pie # @RETURN: Truth if the current compiler generates position-independent code (PIC) which can be linked into executables @@ -1015,7 +1000,16 @@ gcc-specs-stack-check() { # Return truth if the current compiler generates position-independent code (PIC) # which can be linked into executables. tc-enables-pie() { - tc-cpp-is-true "defined(__PIE__)" ${CPPFLAGS} ${CFLAGS} + tc-cpp-is-true "defined(__PIE__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS} +} + +# @FUNCTION: tc-enables-fortify-source +# @RETURN: Truth if the current compiler enables FORTIFY_SOURCE at any level +# @DESCRIPTION: +# Return truth if the current compiler enables fortification (FORTIFY_SOURCE) +# at any level (-D_FORTIFY_SOURCE). +tc-enables-fortify-source() { + tc-cpp-is-true "defined(_FORTIFY_SOURCE)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS} } # @FUNCTION: tc-enables-ssp @@ -1027,7 +1021,7 @@ tc-enables-pie() { # -fstack-protector-strong # -fstack-protector-all tc-enables-ssp() { - tc-cpp-is-true "defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} + tc-cpp-is-true "defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS} } # @FUNCTION: tc-enables-ssp-strong @@ -1038,7 +1032,7 @@ tc-enables-ssp() { # -fstack-protector-strong # -fstack-protector-all tc-enables-ssp-strong() { - tc-cpp-is-true "defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} + tc-cpp-is-true "defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS} } # @FUNCTION: tc-enables-ssp-all @@ -1048,7 +1042,7 @@ tc-enables-ssp-strong() { # on level corresponding to any of the following options: # -fstack-protector-all tc-enables-ssp-all() { - tc-cpp-is-true "defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} + tc-cpp-is-true "defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS} } @@ -1066,18 +1060,18 @@ gen_usr_ldscript() { tc-is-static-only && return use prefix && return - # We only care about stuffing / for the native ABI. #479448 + # We only care about stuffing / for the native ABI, bug #479448 if [[ $(type -t multilib_is_native_abi) == "function" ]] ; then multilib_is_native_abi || return 0 fi - # Eventually we'd like to get rid of this func completely #417451 + # Eventually we'd like to get rid of this func completely, bug #417451 case ${CTARGET:-${CHOST}} in - *-darwin*) ;; - *-android*) return 0 ;; - *linux*|*-freebsd*|*-openbsd*|*-netbsd*) - use prefix && return 0 ;; - *) return 0 ;; + *-darwin*) ;; + *-android*) return 0 ;; + *linux*|*-freebsd*|*-openbsd*|*-netbsd*) + use prefix && return 0 ;; + *) return 0 ;; esac # Just make sure it exists @@ -1093,10 +1087,10 @@ gen_usr_ldscript() { # is referenced ... makes multilib saner local flags=( ${CFLAGS} ${LDFLAGS} -Wl,--verbose ) if $(tc-getLD) --version | grep -q 'GNU gold' ; then - # If they're using gold, manually invoke the old bfd. #487696 + # If they're using gold, manually invoke the old bfd, bug #487696 local d="${T}/bfd-linker" mkdir -p "${d}" - ln -sf $(which ${CHOST}-ld.bfd) "${d}"/ld + ln -sf $(type -P ${CHOST}-ld.bfd) "${d}"/ld flags+=( -B"${d}" ) fi output_format=$($(tc-getCC) "${flags[@]}" 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p') @@ -1186,4 +1180,103 @@ gen_usr_ldscript() { done } +# @FUNCTION: tc-get-cxx-stdlib +# @DESCRIPTION: +# Attempt to identify the C++ standard library used by the compiler. +# If the library is identified, the function returns 0 and prints one +# of the following: +# +# - ``libc++`` for ``sys-libs/libcxx`` +# - ``libstdc++`` for ``sys-devel/gcc``'s libstdc++ +# +# If the library is not recognized, the function returns 1. +tc-get-cxx-stdlib() { + local code='#include <ciso646> + +#if defined(_LIBCPP_VERSION) + HAVE_LIBCXX +#elif defined(__GLIBCXX__) + HAVE_LIBSTDCPP +#endif +' + local res=$( + $(tc-getCXX) ${CPPFLAGS} ${CXXFLAGS} -x c++ -E -P - \ + <<<"${code}" 2>/dev/null + ) + + case ${res} in + *HAVE_LIBCXX*) + echo libc++;; + *HAVE_LIBSTDCPP*) + echo libstdc++;; + *) + return 1;; + esac + + return 0 +} + +# @FUNCTION: tc-get-c-rtlib +# @DESCRIPTION: +# Attempt to identify the runtime used by the C/C++ compiler. +# If the runtime is identifed, the function returns 0 and prints one +# of the following: +# +# - ``compiler-rt`` for ``sys-libs/compiler-rt`` +# - ``libgcc`` for ``sys-devel/gcc``'s libgcc +# +# If the runtime is not recognized, the function returns 1. +tc-get-c-rtlib() { + local res=$( + $(tc-getCC) ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} \ + -print-libgcc-file-name 2>/dev/null + ) + + case ${res} in + *libclang_rt*) + echo compiler-rt;; + *libgcc*) + echo libgcc;; + *) + return 1;; + esac + + return 0 +} + +# @FUNCTION: tc-get-ptr-size +# @RETURN: Size of a pointer in bytes for CHOST (e.g. 4 or 8). +tc-get-ptr-size() { + $(tc-getCPP) -P - <<< __SIZEOF_POINTER__ || + die "Could not determine CHOST pointer size" +} + +# @FUNCTION: tc-get-build-ptr-size +# @RETURN: Size of a pointer in bytes for CBUILD (e.g. 4 or 8). +tc-get-build-ptr-size() { + $(tc-getBUILD_CPP) -P - <<< __SIZEOF_POINTER__ || + die "Could not determine CBUILD pointer size" +} + +# @FUNCTION: tc-is-lto +# @RETURN: Shell true if we are using LTO, shell false otherwise +tc-is-lto() { + local f="${T}/test-lto.o" + + case $(tc-get-compiler-type) in + clang) + $(tc-getCC) ${CFLAGS} -c -o "${f}" -x c - <<<"" || die + # If LTO is used, clang will output bytecode and llvm-bcanalyzer + # will run successfully. Otherwise, it will output plain object + # file and llvm-bcanalyzer will exit with error. + llvm-bcanalyzer "${f}" &>/dev/null && return 0 + ;; + gcc) + $(tc-getCC) ${CFLAGS} -c -o "${f}" -x c - <<<"" || die + [[ $($(tc-getREADELF) -S "${f}") == *.gnu.lto* ]] && return 0 + ;; + esac + return 1 +} + fi diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index 642bf54a89..85bb14220c 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2022 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: toolchain.eclass @@ -6,14 +6,17 @@ # Toolchain Ninjas <toolchain@gentoo.org> # @SUPPORTED_EAPIS: 7 8 # @BLURB: Common code for sys-devel/gcc ebuilds +# @DESCRIPTION: +# Common code for sys-devel/gcc ebuilds (and occasionally GCC forks, like +# GNAT for Ada). If not building GCC itself, please use toolchain-funcs.eclass +# instead. case ${EAPI} in - 7) inherit eutils ;; - 8) ;; + 7|8) ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac -if [[ ! ${_TOOLCHAIN_ECLASS} ]]; then +if [[ -z ${_TOOLCHAIN_ECLASS} ]]; then _TOOLCHAIN_ECLASS=1 DESCRIPTION="The GNU Compiler Collection" @@ -49,9 +52,9 @@ if [[ ${CTARGET} = ${CHOST} ]] ; then export CTARGET=${CATEGORY#cross-} fi fi -: ${TARGET_ABI:=${ABI}} -: ${TARGET_MULTILIB_ABIS:=${MULTILIB_ABIS}} -: ${TARGET_DEFAULT_ABI:=${DEFAULT_ABI}} +: "${TARGET_ABI:=${ABI}}" +: "${TARGET_MULTILIB_ABIS:=${MULTILIB_ABIS}}" +: "${TARGET_DEFAULT_ABI:=${DEFAULT_ABI}}" is_crosscompile() { [[ ${CHOST} != ${CTARGET} ]] @@ -141,6 +144,32 @@ GCCMINOR=$(ver_cut 2 ${GCC_PV}) # GCC micro version. GCCMICRO=$(ver_cut 3 ${GCC_PV}) +tc_use_major_version_only() { + local use_major_version_only=0 + + if ! tc_version_is_at_least 10 ; then + return 1 + fi + + if [[ ${GCCMAJOR} -eq 10 ]] && ver_test ${PV} -ge 10.4.1_p20220929 ; then + use_major_version_only=1 + elif [[ ${GCCMAJOR} -eq 11 ]] && ver_test ${PV} -ge 11.3.1_p20220930 ; then + use_major_version_only=1 + elif [[ ${GCCMAJOR} -eq 12 ]] && ver_test ${PV} -ge 12.2.1_p20221001 ; then + use_major_version_only=1 + elif [[ ${GCCMAJOR} -eq 13 ]] && ver_test ${PV} -ge 13.0.0_pre20221002 ; then + use_major_version_only=1 + elif [[ ${GCCMAJOR} -gt 13 ]] ; then + use_major_version_only=1 + fi + + if [[ ${use_major_version_only} -eq 1 ]] ; then + return 0 + fi + + return 1 +} + # @ECLASS_VARIABLE: GCC_CONFIG_VER # @INTERNAL # @DESCRIPTION: @@ -148,7 +177,11 @@ GCCMICRO=$(ver_cut 3 ${GCC_PV}) # of binary and gcc-config names not directly tied to upstream # versioning. In practice it's hard to untangle from gcc/BASE-VER # (GCC_RELEASE_VER) value. -GCC_CONFIG_VER=${GCC_RELEASE_VER} +if tc_use_major_version_only ; then + GCC_CONFIG_VER=${GCCMAJOR} +else + GCC_CONFIG_VER=${GCC_RELEASE_VER} +fi # Pre-release support. Versioning schema: # 1.0.0_pre9999: live ebuild @@ -168,7 +201,7 @@ fi # Require minimum gcc version to simplify assumptions. # Normally we would require gcc-6+ (based on sys-devel/gcc) # but we still have sys-devel/gcc-apple-4.2.1_p5666. -tc_version_is_at_least 4.2.1 || die "${ECLASS}: ${GCC_RELEASE_VER} is too old." +tc_version_is_at_least 8 || die "${ECLASS}: ${GCC_RELEASE_VER} is too old." PREFIX=${TOOLCHAIN_PREFIX:-${EPREFIX}/usr} @@ -204,49 +237,45 @@ tc_has_feature() { if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] || [[ ${PN} == "gcc-apple" && $(tc_version_is_at_least 12.1) == 0 ]] ; then IUSE+=" debug +cxx +nptl" TC_FEATURES+=( nptl ) - [[ -n ${PIE_VER} ]] && IUSE+=" nopie" - [[ -n ${SPECS_VER} ]] && IUSE+=" nossp" IUSE+=" +fortran" TC_FEATURES+=( fortran ) IUSE+=" doc hardened multilib objc" - tc_version_is_between 3 7 && IUSE+=" awt gcj" TC_FEATURES+=( gcj ) IUSE+=" pgo" IUSE+=" objc-gc" TC_FEATURES+=( objc-gc ) IUSE+=" libssp objc++" - IUSE+=" +openmp" - - tc_version_is_at_least 4.3 && IUSE+=" fixed-point" - tc_version_is_at_least 4.7 && IUSE+=" go" - - # sanitizer support appeared in gcc-4.8, but <gcc-5 does not - # support modern glibc. - tc_version_is_at_least 5 && IUSE+=" +sanitize" TC_FEATURES+=( sanitize ) - - # Note: - # <gcc-4.8 supported graphite, it required forked ppl - # versions which we dropped. Since graphite was also experimental in - # the older versions, we don't want to bother supporting it. #448024 - # <gcc-5 supported graphite, it required cloog - # <gcc-6.5 supported graphite, it required old incompatible isl - tc_version_is_at_least 6.5 && - IUSE+=" graphite" TC_FEATURES+=( graphite ) - - tc_version_is_between 4.9 8 && IUSE+=" cilk" - tc_version_is_at_least 4.9 && IUSE+=" ada" - tc_version_is_at_least 4.9 && IUSE+=" vtv" - tc_version_is_at_least 5.0 && IUSE+=" jit" - tc_version_is_between 5.0 9 && IUSE+=" mpx" - tc_version_is_at_least 6.0 && IUSE+=" +pie +ssp +pch" - - # systemtap is a gentoo-specific switch: bug #654748 - tc_version_is_at_least 8.0 && - IUSE+=" systemtap" TC_FEATURES+=( systemtap ) - - tc_version_is_at_least 9.0 && IUSE+=" d" + + # Stop forcing openmp on by default in the eclass. Gradually phase it out. + # See bug #890999. + if tc_version_is_at_least 13.0.0_pre20221218 ; then + IUSE+=" openmp" + else + IUSE+=" +openmp" + fi + + IUSE+=" fixed-point" + IUSE+=" go" + IUSE+=" +sanitize" TC_FEATURES+=( sanitize ) + IUSE+=" graphite" TC_FEATURES+=( graphite ) + IUSE+=" ada" + IUSE+=" vtv" + IUSE+=" jit" + IUSE+=" +pie +ssp pch" + + IUSE+=" systemtap" TC_FEATURES+=( systemtap ) + + tc_version_is_at_least 9.0 && IUSE+=" d" TC_FEATURES+=( d ) tc_version_is_at_least 9.1 && IUSE+=" lto" tc_version_is_at_least 10 && IUSE+=" cet" tc_version_is_at_least 10 && IUSE+=" zstd" TC_FEATURES+=( zstd ) tc_version_is_at_least 11 && IUSE+=" valgrind" TC_FEATURES+=( valgrind ) tc_version_is_at_least 11 && IUSE+=" custom-cflags" + tc_version_is_at_least 12 && IUSE+=" ieee-long-double" + tc_version_is_at_least 12.2.1_p20221203 ${PV} && IUSE+=" default-znow" + tc_version_is_at_least 12.2.1_p20221203 ${PV} && IUSE+=" default-stack-clash-protection" + tc_version_is_at_least 13.0.0_pre20221218 ${PV} && IUSE+=" modula2" + # See https://gcc.gnu.org/pipermail/gcc-patches/2023-April/615944.html + # and https://rust-gcc.github.io/2023/04/24/gccrs-and-gcc13-release.html for why + # it was disabled in 13. + tc_version_is_at_least 14.0.0_pre20230423 ${PV} && IUSE+=" rust" fi if tc_version_is_at_least 10; then @@ -259,24 +288,18 @@ fi #---->> DEPEND <<---- -RDEPEND="sys-libs/zlib +RDEPEND=" + sys-libs/zlib virtual/libiconv nls? ( virtual/libintl ) " GMP_MPFR_DEPS=">=dev-libs/gmp-4.3.2:0= >=dev-libs/mpfr-2.4.2:0=" -if tc_version_is_at_least 4.3 ; then - RDEPEND+=" ${GMP_MPFR_DEPS}" -elif tc_has_feature fortran ; then - RDEPEND+=" fortran? ( ${GMP_MPFR_DEPS} )" -fi - -tc_version_is_at_least 4.5 && RDEPEND+=" >=dev-libs/mpc-0.8.1:0=" +RDEPEND+=" ${GMP_MPFR_DEPS}" +RDEPEND+=" >=dev-libs/mpc-0.8.1:0=" if tc_has_feature objc-gc ; then - if tc_version_is_at_least 7 ; then - RDEPEND+=" objc-gc? ( >=dev-libs/boehm-gc-7.4.2 )" - fi + RDEPEND+=" objc-gc? ( >=dev-libs/boehm-gc-7.4.2 )" fi if tc_has_feature graphite ; then @@ -284,32 +307,21 @@ if tc_has_feature graphite ; then fi BDEPEND=" - >=sys-devel/bison-1.875 + app-alternatives/yacc >=sys-devel/flex-2.5.4 nls? ( sys-devel/gettext ) test? ( >=dev-util/dejagnu-1.4.4 >=sys-devel/autogen-5.5.4 - )" + ) +" DEPEND="${RDEPEND}" -if tc_has_feature gcj ; then - DEPEND+=" - gcj? ( - app-arch/zip - app-arch/unzip - >=media-libs/libart_lgpl-2.1 - awt? ( - x11-base/xorg-proto - x11-libs/libXt - x11-libs/libX11 - x11-libs/libXtst - =x11-libs/gtk+-2* - x11-libs/pango - virtual/pkgconfig - ) - ) - " +if [[ ${PN} == gcc && ${PV} == *_p* ]] ; then + # Snapshots don't contain info pages. + # If they start to, adjust gcc_cv_prog_makeinfo_modern logic in toolchain_src_configure. + # Needed unless/until https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106899 is fixed + BDEPEND+=" sys-apps/texinfo" fi if tc_has_feature sanitize ; then @@ -321,7 +333,7 @@ fi if tc_has_feature systemtap ; then # gcc needs sys/sdt.h headers on target - DEPEND+=" systemtap? ( dev-util/systemtap )" + DEPEND+=" systemtap? ( dev-debug/systemtap )" fi if tc_has_feature zstd ; then @@ -329,12 +341,26 @@ if tc_has_feature zstd ; then RDEPEND+=" zstd? ( app-arch/zstd:= )" fi -if tc_has_feature valgrind; then - BDEPEND+=" valgrind? ( dev-util/valgrind )" +if tc_has_feature valgrind ; then + BDEPEND+=" valgrind? ( dev-debug/valgrind )" +fi + +# TODO: Add a pkg_setup & pkg_pretend check for whether the active compiler +# supports Ada. +if tc_has_feature ada ; then + BDEPEND+=" ada? ( || ( sys-devel/gcc[ada] dev-lang/gnat-gpl[ada] ) )" +fi + +# TODO: Add a pkg_setup & pkg_pretend check for whether the active compiler +# supports D. +if tc_has_feature d && tc_version_is_at_least 12.0 ; then + # D in 12+ is self-hosting and needs D to bootstrap. + # TODO: package some binary we can use, like for Ada + # bug #840182 + BDEPEND+=" d? ( || ( sys-devel/gcc[d(-)] <sys-devel/gcc-12[d(-)] ) )" fi -# Prefix: our version is 1.9, so can't go with gx86's 2.3 -PDEPEND=">=sys-devel/gcc-config-1.9" +PDEPEND=">=sys-devel/gcc-config-2.3" #---->> S + SRC_URI essentials <<---- @@ -343,38 +369,39 @@ PDEPEND=">=sys-devel/gcc-config-1.9" # Used to override compression used for for patchsets. # Default is xz for EAPI 8+ and bz2 for older EAPIs. if [[ ${EAPI} == 8 ]] ; then - : ${TOOLCHAIN_PATCH_SUFFIX:=xz} + : "${TOOLCHAIN_PATCH_SUFFIX:=xz}" else # Older EAPIs - : ${TOOLCHAIN_PATCH_SUFFIX:=bz2} + : "${TOOLCHAIN_PATCH_SUFFIX:=bz2}" fi # @ECLASS_VARIABLE: TOOLCHAIN_SET_S # @DESCRIPTION: # Used to override value of S for snapshots and such. Mainly useful # if needing to set GCC_TARBALL_SRC_URI. -: ${TOOLCHAIN_SET_S:=yes} +: "${TOOLCHAIN_SET_S:=yes}" # Set the source directory depending on whether we're using # a live git tree, snapshot, or release tarball. if [[ ${TOOLCHAIN_SET_S} == yes ]] ; then - S=$( - if tc_is_live ; then - echo ${EGIT_CHECKOUT_DIR} - elif [[ -n ${SNAPSHOT} ]] ; then - echo ${WORKDIR}/gcc-${SNAPSHOT} - else - echo ${WORKDIR}/gcc-${GCC_RELEASE_VER} - fi - ) + if tc_is_live ; then + S=${EGIT_CHECKOUT_DIR} + elif [[ -n ${SNAPSHOT} ]] ; then + S=${WORKDIR}/gcc-${SNAPSHOT} + else + S=${WORKDIR}/gcc-${GCC_RELEASE_VER} + fi fi gentoo_urls() { + # the list is sorted by likelihood of getting the patches tarball from + # respective devspace # slyfox's distfiles are mirrored to sam's devspace declare -A devspace_urls=( [soap]=HTTP~soap/distfiles/URI [sam]=HTTP~sam/distfiles/sys-devel/gcc/URI [slyfox]=HTTP~sam/distfiles/URI + [xen0n]=HTTP~xen0n/distfiles/sys-devel/gcc/URI [tamiko]=HTTP~tamiko/distfiles/URI [zorry]=HTTP~zorry/patches/gcc/URI [vapier]=HTTP~vapier/dist/URI @@ -402,7 +429,8 @@ gentoo_urls() { HTTP~tamiko/distfiles/URI HTTP~zorry/patches/gcc/URI HTTP~vapier/dist/URI - HTTP~blueness/dist/URI" + HTTP~blueness/dist/URI + " devspace=${devspace//HTTP/https:\/\/dev.gentoo.org\/} echo ${devspace//URI/$1} mirror://gentoo/$1 } @@ -431,43 +459,9 @@ gentoo_urls() { # The resulting filename of this tarball will be: # gcc-${PATCH_GCC_VER:-${GCC_RELEASE_VER}}-patches-${PATCH_VER}.tar.xz # -# PIE_VER -# PIE_GCC_VER -# These variables control patching in various updates for the logic -# controlling Position Independent Executables. PIE_VER is expected -# to be the version of this patch, and PIE_GCC_VER the gcc version of -# the patch: -# An example: -# PIE_VER="8.7.6.5" -# PIE_GCC_VER="3.4.0" -# The resulting filename of this tarball will be: -# gcc-${PIE_GCC_VER:-${GCC_RELEASE_VER}}-piepatches-v${PIE_VER}.tar.xz -# -# SPECS_VER -# SPECS_GCC_VER -# This is for the minispecs files included in the hardened gcc-4.x -# The specs files for hardenedno*, vanilla and for building the "specs" file. -# SPECS_VER is expected to be the version of this patch, SPECS_GCC_VER -# the gcc version of the patch. -# An example: -# SPECS_VER="8.7.6.5" -# SPECS_GCC_VER="3.4.0" -# The resulting filename of this tarball will be: -# gcc-${SPECS_GCC_VER:-${GCC_RELEASE_VER}}-specs-${SPECS_VER}.tar.xz -# -# CYGWINPORTS_GITREV -# If set, this variable signals that we should apply additional patches -# maintained by upstream Cygwin developers at github/cygwinports/gcc, -# using the specified git commit id there. The list of patches to -# apply is extracted from gcc.cygport, maintained there as well. -# This is done for compilers running on Cygwin, not for cross compilers -# with a Cygwin target. get_gcc_src_uri() { export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}} export MUSL_GCC_VER=${MUSL_GCC_VER:-${PATCH_GCC_VER}} - export PIE_GCC_VER=${PIE_GCC_VER:-${GCC_RELEASE_VER}} - export HTB_GCC_VER=${HTB_GCC_VER:-${GCC_RELEASE_VER}} - export SPECS_GCC_VER=${SPECS_GCC_VER:-${GCC_RELEASE_VER}} # Set where to download gcc itself depending on whether we're using a # live git tree, snapshot, or release tarball. @@ -477,13 +471,12 @@ get_gcc_src_uri() { # Pull gcc tarball from another location. Frequently used by gnat-gpl. GCC_SRC_URI="${GCC_TARBALL_SRC_URI}" elif [[ -n ${SNAPSHOT} ]] ; then - GCC_SRC_URI="https://gcc.gnu.org/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.xz" + GCC_SRC_URI="mirror://gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.xz" else - if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then - GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.xz" - else - GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.bz2" - fi + GCC_SRC_URI=" + mirror://gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.xz + mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.xz + " fi [[ -n ${PATCH_VER} ]] && \ @@ -491,27 +484,6 @@ get_gcc_src_uri() { [[ -n ${MUSL_VER} ]] && \ GCC_SRC_URI+=" $(gentoo_urls gcc-${MUSL_GCC_VER}-musl-patches-${MUSL_VER}.tar.${TOOLCHAIN_PATCH_SUFFIX})" - [[ -n ${PIE_VER} ]] && \ - PIE_CORE=${PIE_CORE:-gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.${TOOLCHAIN_PATCH_SUFFIX}} && \ - GCC_SRC_URI+=" $(gentoo_urls ${PIE_CORE})" - - # gcc minispec for the hardened gcc 4 compiler - [[ -n ${SPECS_VER} ]] && \ - GCC_SRC_URI+=" $(gentoo_urls gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.${TOOLCHAIN_PATCH_SUFFIX})" - - if tc_has_feature gcj ; then - if tc_version_is_at_least 4.5 ; then - GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.5.jar )" - elif tc_version_is_at_least 4.3 ; then - GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.3.jar )" - fi - fi - - # Cygwin patches from https://github.com/cygwinports/gcc - [[ -n ${CYGWINPORTS_GITREV} ]] && \ - GCC_SRC_URI+=" elibc_Cygwin? ( https://github.com/cygwinports/gcc/archive/${CYGWINPORTS_GITREV}.tar.gz - -> gcc-cygwinports-${CYGWINPORTS_GITREV}.tar.gz )" - echo "${GCC_SRC_URI}" } @@ -525,11 +497,7 @@ toolchain_pkg_pretend() { ewarn 'Go requires a C++ compiler, disabled due to USE="-cxx"' _tc_use_if_iuse objc++ && \ ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="-cxx"' - _tc_use_if_iuse gcj && \ - ewarn 'GCJ requires a C++ compiler, disabled due to USE="-cxx"' fi - - want_minispecs } #---->> pkg_setup <<---- @@ -584,6 +552,11 @@ toolchain_src_unpack() { if tc_is_live ; then git-r3_src_unpack + # Needed for gcc --version to include the upstream commit used + # rather than only the commit after we apply our patches. + # It includes both with this. + echo "${EGIT_VERSION}" > "${S}"/gcc/REVISION || die + if [[ -z ${PATCH_VER} ]] && ! use vanilla ; then toolchain_fetch_git_patches fi @@ -601,8 +574,6 @@ toolchain_src_prepare() { cd "${S}" || die do_gcc_gentoo_patches - do_gcc_PIE_patches - do_gcc_CYGWINPORTS_patches if tc_is_live ; then BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, commit ${EGIT_VERSION}" @@ -610,9 +581,8 @@ toolchain_src_prepare() { eapply_user - if ( tc_version_is_at_least 4.8.2 || _tc_use_if_iuse hardened ) \ - && ! use vanilla ; then - make_gcc_hard + if ! use vanilla ; then + tc_enable_hardened_gcc fi # we use our libtool on Darwin (no longer applies since 12) @@ -634,7 +604,6 @@ toolchain_src_prepare() { -exec sed -i '/^pkgconfigdir/s:=.*:=$(toolexeclibdir)/pkgconfig:' {} + || die setup_multilib_osdirnames - gcc_version_patch local actual_version=$(< "${S}"/gcc/BASE-VER) if [[ "${GCC_RELEASE_VER}" != "${actual_version}" ]] ; then @@ -642,23 +611,6 @@ toolchain_src_prepare() { die "Please set 'TOOLCHAIN_GCC_PV' to '${actual_version}'" fi - # >= gcc-4.3 doesn't bundle ecj.jar, so copy it - if tc_version_is_at_least 4.3 && _tc_use_if_iuse gcj ; then - if tc_version_is_at_least 4.5 ; then - einfo "Copying ecj-4.5.jar" - cp -pPR "${DISTDIR}/ecj-4.5.jar" "${S}/ecj.jar" || die - else - einfo "Copying ecj-4.3.jar" - cp -pPR "${DISTDIR}/ecj-4.3.jar" "${S}/ecj.jar" || die - fi - fi - - # Prevent libffi from being installed - if tc_version_is_between 3.0 4.8 ; then - sed -i -e 's/\(install.*:\) install-.*recursive/\1/' "${S}"/libffi/Makefile.in || die - sed -i -e 's/\(install-data-am:\).*/\1/' "${S}"/libffi/include/Makefile.in || die - fi - # Fixup libtool to correctly generate .la files with portage elibtoolize --portage --shallow --no-uclibc @@ -673,21 +625,25 @@ toolchain_src_prepare() { || eerror "Please file a bug about this" eend $? done - # bug #215828 - sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk || die - - # Prevent new texinfo from breaking old versions (see #198182, bug #464008) - einfo "Remove texinfo (bug #198182, bug #464008)" - eapply "${FILESDIR}"/gcc-configure-texinfo.patch - - # >=gcc-4 - if [[ -x contrib/gcc_update ]] ; then - einfo "Touching generated files" - ./contrib/gcc_update --touch | \ - while read f ; do - einfo " ${f%%...}" - done + + if ! use prefix-guest && [[ -n ${EPREFIX} ]] ; then + einfo "Prefixifying dynamic linkers..." + for f in gcc/config/*/*linux*.h ; do + ebegin " Updating ${f}" + if [[ ${f} == gcc/config/rs6000/linux*.h ]]; then + sed -i -r "s,(DYNAMIC_LINKER_PREFIX\s+)\"\",\1\"${EPREFIX}\",g" "${f}" || die + else + sed -i -r "/_DYNAMIC_LINKER/s,([\":])(/lib),\1${EPREFIX}\2,g" "${f}" || die + fi + eend $? + done fi + + einfo "Touching generated files" + ./contrib/gcc_update --touch | \ + while read f ; do + einfo " ${f%%...}" + done } do_gcc_gentoo_patches() { @@ -718,93 +674,47 @@ do_gcc_gentoo_patches() { fi } -do_gcc_PIE_patches() { - want_pie || return 0 - use vanilla && return 0 - - einfo "Applying PIE patches ..." - eapply "${WORKDIR}"/piepatch/*.patch +# configure to build with the hardened GCC specs as the default +tc_enable_hardened_gcc() { + local hardened_gcc_flags="" - BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}" -} + if _tc_use_if_iuse pie ; then + einfo "Updating gcc to use automatic PIE building ..." + fi -do_gcc_CYGWINPORTS_patches() { - [[ -n ${CYGWINPORTS_GITREV} ]] || return 0 - use elibc_Cygwin || return 0 - - local p d="${WORKDIR}/gcc-${CYGWINPORTS_GITREV}" - # readarray -t is available since bash-4.4 only, bug #690686 - local patches=( $( - for p in $( - sed -e '1,/PATCH_URI="/d;/"/,$d' < "${d}"/gcc.cygport - ); do - echo "${d}/${p}" - done - ) ) - einfo "Applying cygwin port patches ..." - eapply -- "${patches[@]}" -} + if _tc_use_if_iuse ssp ; then + einfo "Updating gcc to use automatic SSP building ..." + fi -# configure to build with the hardened GCC specs as the default -make_gcc_hard() { - local gcc_hard_flags="" + if _tc_use_if_iuse default-stack-clash-protection ; then + # The define DEF_GENTOO_SCP is checked in 24_all_DEF_GENTOO_SCP-fstack-clash-protection.patch + einfo "Updating gcc to use automatic stack clash protection ..." + hardened_gcc_flags+=" -DDEF_GENTOO_SCP" + fi - # If we use gcc-6 or newer with PIE enabled to compile older gcc, - # we need to pass -no-pie to stage1; bug #618908 - if ! tc_version_is_at_least 6.0 && [[ $(gcc-major-version) -ge 6 ]] ; then - einfo "Disabling PIE in stage1 (only) ..." - sed -i -e "/^STAGE1_LDFLAGS/ s/$/ -no-pie/" "${S}"/Makefile.in || die + if _tc_use_if_iuse default-znow ; then + # The define DEF_GENTOO_ZNOW is checked in 23_all_DEF_GENTOO_ZNOW-z-now.patch + einfo "Updating gcc to request symbol resolution at start (-z now) ..." + hardened_gcc_flags+=" -DDEF_GENTOO_ZNOW" fi - # For gcc >= 6.x, we can use configuration options to turn PIE/SSP - # on as default - if tc_version_is_at_least 6.0 ; then - if _tc_use_if_iuse pie ; then - einfo "Updating gcc to use automatic PIE building ..." - fi - if _tc_use_if_iuse ssp ; then - einfo "Updating gcc to use automatic SSP building ..." - fi - if _tc_use_if_iuse hardened ; then - # Will add some hardened options as default, like: - # * -fstack-clash-protection - # * -z now - # See gcc *_all_extra-options.patch patches. - gcc_hard_flags+=" -DEXTRA_OPTIONS" - - if _tc_use_if_iuse cet && [[ ${CTARGET} == *x86_64*-linux* ]] ; then - gcc_hard_flags+=" -DEXTRA_OPTIONS_CF" - fi + if _tc_use_if_iuse hardened ; then + # Will add some hardened options as default, e.g. for gcc-12 + # * -fstack-clash-protection + # * -z now + # See gcc *_all_extra-options.patch patches. + hardened_gcc_flags+=" -DEXTRA_OPTIONS" + # Default to -D_FORTIFY_SOURCE=3 instead of -D_FORTIFY_SOURCE=2 + hardened_gcc_flags+=" -DGENTOO_FORTIFY_SOURCE_LEVEL=3" + # Add -D_GLIBCXX_ASSERTIONS + hardened_gcc_flags+=" -DDEF_GENTOO_GLIBCXX_ASSERTIONS" - # Rebrand to make bug reports easier - BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened} - fi - else - if _tc_use_if_iuse hardened ; then - # Rebrand to make bug reports easier - BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened} - if hardened_gcc_works ; then - einfo "Updating gcc to use automatic PIE + SSP building ..." - gcc_hard_flags+=" -DEFAULT_PIE_SSP" - elif hardened_gcc_works pie ; then - einfo "Updating gcc to use automatic PIE building ..." - ewarn "SSP has not been enabled by default" - gcc_hard_flags+=" -DEFAULT_PIE" - elif hardened_gcc_works ssp ; then - einfo "Updating gcc to use automatic SSP building ..." - ewarn "PIE has not been enabled by default" - gcc_hard_flags+=" -DEFAULT_SSP" - else - # Do nothing if hardened isn't supported, but don't die either - ewarn "hardened is not supported for this arch in this gcc version" - return 0 - fi - else - if hardened_gcc_works ssp ; then - einfo "Updating gcc to use automatic SSP building ..." - gcc_hard_flags+=" -DEFAULT_SSP" - fi + if _tc_use_if_iuse cet && [[ ${CTARGET} == *x86_64*-linux* ]] ; then + hardened_gcc_flags+=" -DEXTRA_OPTIONS_CF" fi + + # Rebrand to make bug reports easier + BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened} fi # We want to be able to control the PIE patch logic via something other @@ -812,15 +722,13 @@ make_gcc_hard() { sed -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \ -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \ -i "${S}"/gcc/Makefile.in || die - # Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7 - if tc_version_is_at_least 4.7 ; then - sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \ - -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \ - -i "${S}"/gcc/Makefile.in || die - fi + + sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \ + -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \ + -i "${S}"/gcc/Makefile.in || die sed -i \ - -e "/^HARD_CFLAGS = /s|=|= ${gcc_hard_flags} |" \ + -e "/^HARD_CFLAGS = /s|=|= ${hardened_gcc_flags} |" \ "${S}"/gcc/Makefile.in || die } @@ -832,7 +740,7 @@ make_gcc_hard() { # Most other distros use the logic (including mainline gcc): # lib - 32bit binaries (x86) # lib64 - 64bit binaries (x86_64) -# Over time, Gentoo is migrating to the latter form. +# Over time, Gentoo is migrating to the latter form (17.1 profiles). # # Unfortunately, due to distros picking the lib32 behavior, newer gcc # versions will dynamically detect whether to use lib or lib32 for its @@ -856,16 +764,10 @@ setup_multilib_osdirnames() { config+="/t-linux64" local sed_args=() - if tc_version_is_at_least 4.6 ; then - sed_args+=( -e 's:$[(]call if_multiarch[^)]*[)]::g' ) - fi + sed_args+=( -e 's:$[(]call if_multiarch[^)]*[)]::g' ) if [[ ${SYMLINK_LIB} == "yes" ]] ; then einfo "Updating multilib directories to be: ${libdirs}" - if tc_version_is_at_least 4.6.4 || tc_version_is_at_least 4.7 ; then - sed_args+=( -e '/^MULTILIB_OSDIRNAMES.*lib32/s:[$][(]if.*):../lib32:' ) - else - sed_args+=( -e "/^MULTILIB_OSDIRNAMES/s:=.*:= ${libdirs}:" ) - fi + sed_args+=( -e '/^MULTILIB_OSDIRNAMES.*lib32/s:[$][(]if.*):../lib32:' ) else einfo "Using upstream multilib; disabling lib32 autodetection" sed_args+=( -r -e 's:[$][(]if.*,(.*)[)]:\1:' ) @@ -873,30 +775,21 @@ setup_multilib_osdirnames() { sed -i "${sed_args[@]}" "${S}"/gcc/config/${config} || die } -gcc_version_patch() { - # gcc-4.3+ has configure flags (whoo!) - tc_version_is_at_least 4.3 && return 0 - - local version_string=${GCC_RELEASE_VER} - - einfo "Patching gcc version: ${version_string} (${BRANDING_GCC_PKGVERSION})" - - local gcc_sed=( -e 's:gcc\.gnu\.org/bugs\.html:bugs\.gentoo\.org/:' ) - if grep -qs VERSUFFIX "${S}"/gcc/version.c ; then - gcc_sed+=( -e "/VERSUFFIX \"\"/s:\"\":\" (${BRANDING_GCC_PKGVERSION})\":" ) - else - version_string="${version_string} (${BRANDING_GCC_PKGVERSION})" - gcc_sed+=( -e "/const char version_string\[\] = /s:= \".*\":= \"${version_string}\":" ) - fi - sed -i "${gcc_sed[@]}" "${S}"/gcc/version.c || die -} - #---->> src_configure <<---- toolchain_src_configure() { + BUILD_CONFIG_TARGETS=() + is-flagq '-O3' && BUILD_CONFIG_TARGETS+=( bootstrap-O3 ) + downgrade_arch_flags gcc_do_filter_flags + if ! tc_version_is_at_least 11 && [[ $(gcc-major-version) -ge 12 ]] ; then + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105695 + # bug #849359 + export ac_cv_std_swap_in_utility=no + fi + einfo "CFLAGS=\"${CFLAGS}\"" einfo "CXXFLAGS=\"${CXXFLAGS}\"" einfo "LDFLAGS=\"${LDFLAGS}\"" @@ -905,16 +798,8 @@ toolchain_src_configure() { # issues with 3rd party jar implementations. bug #384291 export JAR=no - # For hardened gcc 4.3: add the pie patchset to build the hardened specs - # file (build.specs) to use when building gcc. - if ! tc_version_is_at_least 4.4 && want_minispecs ; then - setup_minispecs_gcc_build_specs - fi - local confgcc=( --host=${CHOST} ) - local build_config_targets=() - if is_crosscompile || tc-is-cross-compiler ; then # Straight from the GCC install doc: # "GCC has code to correctly determine the correct value for target @@ -932,8 +817,19 @@ toolchain_src_configure() { --mandir="${DATAPATH}/man" --infodir="${DATAPATH}/info" --with-gxx-include-dir="${STDCXX_INCDIR}" + + # portage's econf() does not detect presence of --d-s-r + # because it greps only top-level ./configure. But not + # libiberty's or gcc's configure. + --disable-silent-rules ) + if tc_version_is_at_least 10 ; then + confgcc+=( + --disable-dependency-tracking + ) + fi + # Stick the python scripts in their own slotted directory (bug #279252) # # --with-python-dir=DIR @@ -943,16 +839,13 @@ toolchain_src_configure() { # then --with-python-dir=/lib/python2.5/site-packages should be passed. # # This should translate into "/share/gcc-data/${CTARGET}/${GCC_CONFIG_VER}/python" - if tc_version_is_at_least 4.4 ; then - confgcc+=( --with-python-dir=${DATAPATH/$PREFIX/}/python ) - fi + confgcc+=( --with-python-dir=${DATAPATH/$PREFIX/}/python ) ### language options local GCC_LANG="c" is_cxx && GCC_LANG+=",c++" is_d && GCC_LANG+=",d" - is_gcj && GCC_LANG+=",java" is_go && GCC_LANG+=",go" if is_objc || is_objcxx ; then GCC_LANG+=",objc" @@ -966,8 +859,9 @@ toolchain_src_configure() { is_fortran && GCC_LANG+=",fortran" is_f77 && GCC_LANG+=",f77" is_f95 && GCC_LANG+=",f95" - is_ada && GCC_LANG+=",ada" + is_modula2 && GCC_LANG+=",m2" + is_rust && GCC_LANG+=",rust" confgcc+=( --enable-languages=${GCC_LANG} ) @@ -988,43 +882,57 @@ toolchain_src_configure() { confgcc+=( --disable-libunwind-exceptions ) - # Use the default ("release") checking because upstream usually neglects - # to test "disabled" so it has a history of breaking. bug #317217 if in_iuse debug ; then - # The "release" keyword is new to 4.0. bug #551636 - local off=$(tc_version_is_at_least 4.0 && echo release || echo no) - confgcc+=( --enable-checking="${GCC_CHECKS_LIST:-$(usex debug yes ${off})}" ) + # Non-released versions get extra checks, follow configure.ac's default to for those + # unless USE=debug. Note that snapshots on stable branches don't count as "non-released" + # for these purposes. + if grep -q "experimental" gcc/DEV-PHASE ; then + # - USE=debug for pre-releases: yes,extra,rtl + # - USE=-debug for pre-releases: yes,extra (following upstream default) + confgcc+=( --enable-checking="${GCC_CHECKS_LIST:-$(usex debug yes,extra,rtl yes,extra)}" ) + else + # - Use the default ("release") checking because upstream usually neglects + # to test "disabled" so it has a history of breaking. bug #317217. + # - The "release" keyword is new to 4.0. bug #551636. + # - After discussing in #gcc, we concluded that =yes,extra,rtl makes + # more sense when a user explicitly requests USE=debug. If rtl is too slow, + # we can change this to yes,extra. + confgcc+=( --enable-checking="${GCC_CHECKS_LIST:-$(usex debug yes,extra,rtl release)}" ) + fi fi # Branding - tc_version_is_at_least 4.3 && confgcc+=( + confgcc+=( --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion="${BRANDING_GCC_PKGVERSION}" ) - # If we want hardened support with the newer PIE patchset for >=gcc 4.4 - if tc_version_is_at_least 4.4 && want_minispecs && in_iuse hardened ; then - confgcc+=( $(use_enable hardened esp) ) + if tc_use_major_version_only ; then + confgcc+=( --with-gcc-major-version-only ) fi # Allow gcc to search for clock funcs in the main C lib. # if it can't find them, then tough cookies -- we aren't # going to link in -lrt to all C++ apps. bug #411681 - if tc_version_is_at_least 4.4 && is_cxx ; then + if is_cxx ; then confgcc+=( --enable-libstdcxx-time ) fi + # This only controls whether the compiler *supports* LTO, not whether + # it's *built using* LTO. Hence we do it without a USE flag. + confgcc+=( --enable-lto ) + # Build compiler itself using LTO if tc_version_is_at_least 9.1 && _tc_use_if_iuse lto ; then - build_config_targets+=( bootstrap-lto ) + BUILD_CONFIG_TARGETS+=( bootstrap-lto ) fi if tc_version_is_at_least 12 && _tc_use_if_iuse cet ; then - build_config_targets+=( bootstrap-cet ) + BUILD_CONFIG_TARGETS+=( bootstrap-cet ) fi # Support to disable PCH when building libstdcxx - if tc_version_is_at_least 6.0 && ! _tc_use_if_iuse pch ; then + if ! _tc_use_if_iuse pch ; then confgcc+=( --disable-libstdcxx-pch ) fi @@ -1040,12 +948,6 @@ toolchain_src_configure() { # ;; # esac - # Newer gcc versions like to bootstrap themselves with C++, - # so we need to manually disable it ourselves - if tc_version_is_between 4.7 4.8 && ! is_cxx ; then - confgcc+=( --disable-build-with-cxx --disable-build-poststage1-with-cxx ) - fi - ### Cross-compiler options if is_crosscompile ; then # Enable build warnings by default with cross-compilers when system @@ -1079,15 +981,16 @@ toolchain_src_configure() { *-musl*) needed_libc=musl ;; - *-cygwin) - needed_libc=cygwin - ;; x86_64-*-mingw*|*-w64-mingw*) needed_libc=mingw64-runtime ;; avr) confgcc+=( --enable-shared --disable-threads ) ;; + nvptx*) + # "LTO is not supported for this target" + confgcc+=( --disable-lto ) + ;; # Prefix targets *-apple-darwin*) confgcc+=( --with-sysroot="${EPREFIX}${PREFIX}/${CTARGET}" ) @@ -1095,17 +998,14 @@ toolchain_src_configure() { *-solaris*) confgcc+=( --with-sysroot="${EPREFIX}${PREFIX}/${CTARGET}" ) ;; - *-freebsd*) - confgcc+=( --with-sysroot="${EPREFIX}${PREFIX}/${CTARGET}" ) - ;; esac if [[ -n ${needed_libc} ]] ; then local confgcc_no_libc=( --disable-shared ) # requires libc: bug #734820 - tc_version_is_at_least 4.6 && confgcc_no_libc+=( --disable-libquadmath ) + confgcc_no_libc+=( --disable-libquadmath ) # requires libc - tc_version_is_at_least 4.8 && confgcc_no_libc+=( --disable-libatomic ) + confgcc_no_libc+=( --disable-libatomic ) if ! has_version ${CATEGORY}/${needed_libc} ; then confgcc+=( @@ -1132,7 +1032,13 @@ toolchain_src_configure() { fi fi - confgcc+=( --disable-bootstrap ) + confgcc+=( + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100289 + # TOOD: Find a way to disable this just for stage1 cross? + --disable-gcov + + --disable-bootstrap + ) else if tc-is-static-only ; then confgcc+=( --disable-shared ) @@ -1148,7 +1054,20 @@ toolchain_src_configure() { ;; esac - if use prefix ; then + if ! use prefix-guest ; then + # GNU ld scripts, such as those in glibc, reference unprefixed paths + # as the sysroot given here is automatically prepended. For + # prefix-guest, we use the host's libc instead. + if [[ -n ${EPREFIX} ]] ; then + confgcc+=( --with-sysroot="${EPREFIX}" ) + fi + + # We need to build against the right headers and libraries. Again, + # for prefix-guest, this is the host's. + if [[ -n ${ESYSROOT} ]] ; then + confgcc+=( --with-build-sysroot="${ESYSROOT}" ) + fi + elif use prefix ; then # should be /usr, because it's the path to search includes # for, which is unrelated to TOOLCHAIN_PREFIX, a.k.a. # PREFIX @@ -1190,7 +1109,7 @@ toolchain_src_configure() { # gcc has fixed-point arithmetic support in 4.3 for mips targets that can # significantly increase compile time by several hours. This will allow # users to control this feature in the event they need the support. - tc_version_is_at_least 4.3 && in_iuse fixed-point && confgcc+=( $(use_enable fixed-point) ) + in_iuse fixed-point && confgcc+=( $(use_enable fixed-point) ) case $(tc-is-softfloat) in yes) @@ -1222,13 +1141,11 @@ toolchain_src_configure() { fi done - # Convert armv6m to armv6-m - [[ ${arm_arch} == armv6m ]] && arm_arch=armv6-m # Convert armv7{a,r,m} to armv7-{a,r,m} [[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-} # See if this is a valid --with-arch flag if (srcdir=${S}/gcc target=${CTARGET} with_arch=${arm_arch}; - . "${srcdir}"/config.gcc) &>/dev/null + . "${srcdir}"/config.gcc) &>/dev/null then confgcc+=( --with-arch=${arm_arch} ) fi @@ -1237,10 +1154,7 @@ toolchain_src_configure() { [[ ${arm_arch} == *-m ]] && confgcc+=( --with-mode=thumb ) # Enable hardvfp - if [[ $(tc-is-softfloat) == "no" ]] && \ - [[ ${CTARGET} == armv[67]* ]] && \ - tc_version_is_at_least 4.5 - then + if [[ $(tc-is-softfloat) == "no" ]] && [[ ${CTARGET} == armv[67]* ]] ; then # Follow the new arm hardfp distro standard by default confgcc+=( --with-float=hard ) case ${CTARGET} in @@ -1248,6 +1162,15 @@ toolchain_src_configure() { armv7*) confgcc+=( --with-fpu=vfpv3-d16 ) ;; esac fi + + # If multilib is used, make the compiler build multilibs + # for A or R and M architecture profiles. Do this only + # when no specific arch/mode/float is specified, e.g. + # for target arm-none-eabi, since doing this is + # incompatible with --with-arch/cpu/float/fpu. + if is_multilib && [[ ${arm_arch} == arm ]] ; then + confgcc+=( --with-multilib-list=aprofile,rmprofile ) + fi ;; mips) # Add --with-abi flags to set default ABI @@ -1255,9 +1178,9 @@ toolchain_src_configure() { ;; amd64) - # drop the older/ABI checks once this get's merged into some + # drop the older/ABI checks once this gets merged into some # version of gcc upstream - if tc_version_is_at_least 4.8 && has x32 $(get_all_abis TARGET) ; then + if has x32 $(get_all_abis TARGET) ; then confgcc+=( --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI}) ) fi ;; @@ -1266,10 +1189,6 @@ toolchain_src_configure() { # since glibc will do so based on CTARGET anyways confgcc+=( --with-arch=${CTARGET%%-*} ) ;; - hppa) - # Enable sjlj exceptions for backward compatibility on hppa - [[ ${GCCMAJOR} == "3" ]] && confgcc+=( --enable-sjlj-exceptions ) - ;; ppc) # Set up defaults based on current CFLAGS is-flagq -mfloat-gprs=double && confgcc+=( --enable-e500-double ) @@ -1284,6 +1203,13 @@ toolchain_src_configure() { # - bug #704784 # - https://gcc.gnu.org/PR93157 [[ ${CTARGET} == powerpc64-*-musl ]] && confgcc+=( --with-abi=elfv2 ) + + if in_iuse ieee-long-double; then + # musl requires 64-bit long double, not IBM double-double or IEEE quad. + if [[ ${CTARGET} == powerpc64le-*-gnu ]]; then + use ieee-long-double && confgcc+=( --with-long-double-format=ieee ) + fi + fi ;; riscv) # Add --with-abi flags to set default ABI @@ -1295,19 +1221,15 @@ toolchain_src_configure() { # be small, and should simplify building of 64bit kernels in a 32bit # userland by not needing sys-devel/kgcc64. bug #349405 case $(tc-arch) in - ppc|ppc64) + amd64|ppc|ppc64|sparc|x86) confgcc+=( --enable-targets=all ) ;; - sparc) - tc_version_is_at_least 4.4 && confgcc+=( --enable-targets=all ) - ;; - amd64|x86) - tc_version_is_at_least 4.3 && confgcc+=( --enable-targets=all ) + *) ;; esac # On Darwin we need libdir to be set in order to get correct install names - # for things like libobjc-gnu, libgcj and libfortran. If we enable it on + # for things like libobjc-gnu and libfortran. If we enable it on # non-Darwin we screw up the behaviour this eclass relies on. We in # particular need this over --libdir for bug #255315. [[ ${CTARGET} == *-darwin* ]] && \ @@ -1315,15 +1237,6 @@ toolchain_src_configure() { ### library options - if tc_version_is_between 3.0 7.0 ; then - if is_gcj ; then - confgcc+=( --disable-gjdoc ) - use awt && confgcc+=( --enable-java-awt=gtk ) - else - confgcc+=( --disable-libgcj ) - fi - fi - if in_iuse openmp ; then # Make sure target has pthreads support: bug #326757, bug #335883 # There shouldn't be a chicken & egg problem here as openmp won't @@ -1345,10 +1258,6 @@ toolchain_src_configure() { if _tc_use_if_iuse libssp ; then confgcc+=( --enable-libssp ) else - if hardened_gcc_is_stable ssp; then - export gcc_cv_libc_provides_ssp=yes - fi - if _tc_use_if_iuse ssp; then # On some targets USE="ssp -libssp" is an invalid # configuration as the target libc does not provide @@ -1374,14 +1283,6 @@ toolchain_src_configure() { confgcc+=( $(use_enable cet) ) fi - if in_iuse cilk ; then - confgcc+=( $(use_enable cilk libcilkrts) ) - fi - - if in_iuse mpx ; then - confgcc+=( $(use_enable mpx libmpx) ) - fi - if in_iuse systemtap ; then confgcc+=( $(use_enable systemtap) ) fi @@ -1402,50 +1303,52 @@ toolchain_src_configure() { confgcc+=( $(use_with zstd) ) fi - # This only controls whether the compiler *supports* LTO, not whether - # it's *built using* LTO. Hence we do it without a USE flag. - if tc_version_is_at_least 4.6 ; then - confgcc+=( --enable-lto ) - elif tc_version_is_at_least 4.5 ; then - confgcc+=( --disable-lto ) - fi - # graphite was added in 4.4 but we only support it in 6.5+ due to external # library issues. bug #448024, bug #701270 - if tc_version_is_at_least 6.5 && in_iuse graphite ; then + if in_iuse graphite ; then confgcc+=( $(use_with graphite isl) ) use graphite && confgcc+=( --disable-isl-version-check ) - elif tc_version_is_at_least 5.0 ; then + else confgcc+=( --without-isl ) - elif tc_version_is_at_least 4.8 ; then - confgcc+=( --without-cloog ) - elif tc_version_is_at_least 4.4 ; then - confgcc+=( --without-{cloog,ppl} ) fi - if tc_version_is_at_least 4.8; then - if in_iuse sanitize ; then - # See Note [implicitly enabled flags] - confgcc+=( $(usex sanitize '' --disable-libsanitizer) ) - else - confgcc+=( --disable-libsanitizer ) - fi + if in_iuse sanitize ; then + # See Note [implicitly enabled flags] + confgcc+=( $(usex sanitize '' --disable-libsanitizer) ) + else + confgcc+=( --disable-libsanitizer ) fi - if tc_version_is_at_least 6.0 && in_iuse pie ; then + if in_iuse pie ; then confgcc+=( $(use_enable pie default-pie) ) + + if tc_version_is_at_least 14.0.0_pre20230612 ${PV} ; then + confgcc+=( --enable-host-pie ) + fi fi - if tc_version_is_at_least 6.0 && in_iuse ssp ; then + if in_iuse default-znow && tc_version_is_at_least 14.0.0_pre20230619 ${PV}; then + # See https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=33ebb0dff9bb022f1e0709e0e73faabfc3df7931. + # TODO: Add to LDFLAGS_FOR_TARGET? + confgcc+=( + $(use_enable default-znow host-bind-now) + ) + fi + + if in_iuse ssp ; then confgcc+=( # This defaults to -fstack-protector-strong. $(use_enable ssp default-ssp) ) fi - # Disable gcc info regeneration -- it ships with generated info pages - # already. Our custom version/urls/etc... trigger it. bug #464008 - export gcc_cv_prog_makeinfo_modern=no + # TODO: Ignore RCs here (but TOOLCHAIN_IS_RC isn't yet an eclass var) + if [[ ${PV} == *_p* && -f "${S}"/gcc/doc/gcc.info ]] ; then + # Safeguard against https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106899 being fixed + # without corresponding ebuild changes. + eqawarn "Snapshot release with pre-generated info pages found!" + eqawarn "The BDEPEND in the ebuild should be updated to drop texinfo." + fi # Do not let the X detection get in our way. We know things can be found # via system paths, so no need to hardcode things that'll break multilib. @@ -1455,9 +1358,9 @@ toolchain_src_configure() { confgcc+=( "$@" ${EXTRA_ECONF} ) - if [[ -n ${build_config_targets} ]] ; then - # ./configure --with-build-config='bootstrap-lto bootstrap-cet' - confgcc+=( --with-build-config="${build_config_targets[*]}" ) + if ! is_crosscompile && ! tc-is-cross-compiler && [[ -n ${BUILD_CONFIG_TARGETS} ]] ; then + # e.g. ./configure --with-build-config='bootstrap-lto bootstrap-cet' + confgcc+=( --with-build-config="${BUILD_CONFIG_TARGETS[*]}" ) fi # Nothing wrong with a good dose of verbosity @@ -1487,20 +1390,46 @@ toolchain_src_configure() { if is_jit ; then einfo "Configuring JIT gcc" + local confgcc_jit=( + "${confgcc[@]}" + + --disable-analyzer + --disable-bootstrap + --disable-cet + --disable-default-pie + --disable-default-ssp + --disable-gcov + --disable-libada + --disable-libatomic + --disable-libgomp + --disable-libitm + --disable-libquadmath + --disable-libsanitizer + --disable-libssp + --disable-libstdcxx-pch + --disable-libvtv + --disable-lto + --disable-nls + --disable-objc-gc + --disable-systemtap + --enable-host-shared + --enable-languages=jit + # Might be used for the just-built GCC. Easier to just + # respect USE=graphite here in case the user passes some + # graphite flags rather than try strip them out. + $(use_with graphite isl) + --without-zstd + --with-system-zlib + ) + + if tc_version_is_at_least 13.1 ; then + confgcc_jit+=( --disable-fixincludes ) + fi + mkdir -p "${WORKDIR}"/build-jit || die pushd "${WORKDIR}"/build-jit > /dev/null || die - CONFIG_SHELL="${gcc_shell}" edo "${gcc_shell}" "${S}"/configure \ - "${confgcc[@]}" \ - --disable-libada \ - --disable-libsanitizer \ - --disable-libvtv \ - --disable-libgomp \ - --disable-libquadmath \ - --disable-libatomic \ - --disable-lto \ - --disable-bootstrap \ - --enable-host-shared \ - --enable-languages=jit + + CONFIG_SHELL="${gcc_shell}" edo "${gcc_shell}" "${S}"/configure "${confgcc_jit[@]}" popd > /dev/null || die fi @@ -1529,6 +1458,7 @@ downgrade_arch_flags() { # "added" "arch" "replacement" local archlist=( + 12.3 znver4 znver3 10 znver3 znver2 9 znver2 znver1 4.9 bdver4 bdver3 @@ -1634,9 +1564,34 @@ gcc_do_filter_flags() { # Lock gcc at -O2; we want to be conservative here. filter-flags '-O?' - append-flags -O2 + + # We allow -O3 given it's a supported option upstream. + # Only add -O2 if we're not doing -O3. + if [[ ${BUILD_CONFIG_TARGETS[@]} == *bootstrap-O3* ]] ; then + append-flags '-O3' + else + append-flags '-O2' + fi fi + + if ver_test -lt 13.6 ; then + # These aren't supported by the just-built compiler either. + filter-flags -fharden-compares -fharden-conditional-branches \ + -fharden-control-flow-redundancy -fno-harden-control-flow-redundancy \ + -fhardcfr-skip-leaf -fhardcfr-check-exceptions \ + -fhardcfr-check-returning-calls '-fhardcfr-check-noreturn-calls=*' + + # New in GCC 14. + filter-flags -Walloc-size + else + # Makes things painfully slow and no real benefit for the compiler. + append-flags $(test-flags-CC -fno-harden-control-flow-redundancy) + fi + + # Please use USE=lto instead (bug #906007). + filter-lto + # Avoid shooting self in foot filter-flags '-mabi*' -m31 -m32 -m64 @@ -1647,39 +1602,14 @@ gcc_do_filter_flags() { filter-flags '-fsanitize=*' - if tc_version_is_between 6 8 ; then - # -mstackrealign triggers crashes in exception throwing - # at least on ada: bug #688580 - # The reason is unknown. Drop the flag for now. - filter-flags -mstackrealign - fi - case $(tc-arch) in amd64|x86) filter-flags '-mcpu=*' - - # bug #357287 - tc_version_is_between 4.4 4.5 && append-flags -mno-avx - - if tc_version_is_between 4.6 4.7 ; then - # bug #411333, bug #466454 - replace-cpu-flags c3-2 pentium2 pentium3 pentium3m pentium-m i686 - fi ;; alpha) # bug #454426 append-ldflags -Wl,--no-relax ;; - sparc) - # Temporary workaround for random ICEs reproduced by multiple users - # bug #457062 - tc_version_is_between 4.6 4.8 && MAKEOPTS+=" -j1" - ;; - *-macos) - # https://gcc.gnu.org/PR25127 - tc_version_is_between 4.0 4.2 && \ - filter-flags '-mcpu=*' '-march=*' '-mtune=*' - ;; esac strip-unsupported-flags @@ -1695,27 +1625,6 @@ gcc_do_filter_flags() { local VAR="CFLAGS_"${CTARGET//[-.]/_} CXXFLAGS=${!VAR-${CFLAGS}} fi - - export GCJFLAGS=${GCJFLAGS:-${CFLAGS}} -} - -setup_minispecs_gcc_build_specs() { - # Setup the "build.specs" file for gcc 4.3 to use when building. - if hardened_gcc_works pie ; then - cat "${WORKDIR}"/specs/pie.specs >> "${WORKDIR}"/build.specs - fi - - if hardened_gcc_works ssp ; then - for s in ssp sspall ; do - cat "${WORKDIR}"/specs/${s}.specs >> "${WORKDIR}"/build.specs - done - fi - - for s in nostrict znow ; do - cat "${WORKDIR}"/specs/${s}.specs >> "${WORKDIR}"/build.specs - done - - export GCC_SPECS="${WORKDIR}"/build.specs } gcc-multilib-configure() { @@ -1739,7 +1648,7 @@ gcc-multilib-configure() { if [[ -n ${list} ]] ; then case ${CTARGET} in x86_64*) - tc_version_is_at_least 4.8 && confgcc+=( --with-multilib-list=${list:1} ) + confgcc+=( --with-multilib-list=${list:1} ) ;; esac fi @@ -1773,7 +1682,7 @@ toolchain_src_compile() { touch "${S}"/gcc/c-gperf.h || die # Do not make manpages if we do not have perl ... - [[ ! -x /usr/bin/perl ]] \ + [[ ! -x "${BROOT}"/usr/bin/perl ]] \ && find "${WORKDIR}"/build -name '*.[17]' -exec touch {} + # To compile ada library standard files special compiler options are passed @@ -1814,7 +1723,7 @@ gcc_do_make() { GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all} ewarn "Disabling bootstrapping. ONLY recommended for development." - ewarn "This is NOT a safe configuration for endusers!" + ewarn "This is NOT a safe configuration for end users!" ewarn "This compiler may not be safe or reliable for production use!" elif _tc_use_if_iuse pgo; then GCC_MAKE_TARGET=${GCC_MAKE_TARGET-profiledbootstrap} @@ -1823,55 +1732,65 @@ gcc_do_make() { fi fi - # Older versions of GCC could not do profiledbootstrap in parallel due to - # collisions with profiling info. - if [[ ${GCC_MAKE_TARGET} == "profiledbootstrap" ]] ; then - ! tc_version_is_at_least 4.6 && export MAKEOPTS="${MAKEOPTS} -j1" - fi - - if [[ ${GCC_MAKE_TARGET} == "all" ]] ; then - STAGE1_CFLAGS=${STAGE1_CFLAGS-"${CFLAGS}"} - elif [[ $(gcc-version) == "3.4" && ${GCC_BRANCH_VER} == "3.4" ]] && gcc-specs-ssp ; then - # See bug #79852 - STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O2"} - fi + local emakeargs=( + LDFLAGS="${LDFLAGS}" + LIBPATH="${LIBPATH}" + ) if is_crosscompile; then # In 3.4, BOOT_CFLAGS is never used on a crosscompile... # but I'll leave this in anyways as someone might have had # some reason for putting it in here... --eradicator BOOT_CFLAGS=${BOOT_CFLAGS-"-O2"} + emakeargs+=( BOOT_CFLAGS="${BOOT_CFLAGS}" ) else - # we only want to use the system's CFLAGS if not building a + # XXX: Hack for bug #914881, clean this up when fixed and go back + # to just calling get_abi_LDFLAGS as before. + local abi_ldflags="$(get_abi_LDFLAGS ${TARGET_DEFAULT_ABI})" + if [[ -n ${abi_ldflags} ]] ; then + printf -v abi_ldflags -- "-Wl,%s " ${abi_ldflags} + fi + + # If the host compiler is too old, let's use -O0 per the upstream + # default to be safe (to avoid a bootstrap comparison failure later). + # + # The last known issues are with < GCC 4.9 or so, but it's easier + # to keep this bound somewhat fresh just to avoid problems. Ultimately, + # using not-O0 is just a build-time speed improvement anyway. + if tc-is-gcc && ver_test $(gcc-fullversion) -lt 10 ; then + STAGE1_CFLAGS="-O0" + fi + + # We only want to use the system's CFLAGS if not building a # cross-compiler. + STAGE1_CFLAGS=${STAGE1_CFLAGS-"$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CFLAGS}"} + STAGE1_LDFLAGS=${STAGE1_LDFLAGS-"${abi_ldflags} ${LDFLAGS}"} BOOT_CFLAGS=${BOOT_CFLAGS-"$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CFLAGS}"} + BOOT_LDFLAGS=${BOOT_LDFLAGS-"${abi_ldflags} ${LDFLAGS}"} + LDFLAGS_FOR_TARGET="${LDFLAGS_FOR_TARGET:-${LDFLAGS}}" + + emakeargs+=( + STAGE1_CFLAGS="${STAGE1_CFLAGS}" + STAGE1_LDFLAGS="${STAGE1_LDFLAGS}" + BOOT_CFLAGS="${BOOT_CFLAGS}" + BOOT_LDFLAGS="${BOOT_LDFLAGS}" + LDFLAGS_FOR_TARGET="${LDFLAGS_FOR_TARGET}" + ) fi if is_jit ; then # TODO: docs for jit? - pushd "${WORKDIR}"/build-jit > /dev/null || die - einfo "Building JIT" - emake \ - LDFLAGS="${LDFLAGS}" \ - STAGE1_CFLAGS="${STAGE1_CFLAGS}" \ - LIBPATH="${LIBPATH}" \ - BOOT_CFLAGS="${BOOT_CFLAGS}" - popd > /dev/null || die - fi + emake -C "${WORKDIR}"/build-jit "${emakeargs[@]}" + fi einfo "Compiling ${PN} (${GCC_MAKE_TARGET})..." - pushd "${WORKDIR}"/build >/dev/null || die # we "undef" T because the GCC makefiles use this variable, and if it's set # in the environment (like Portage does) the build fails, bug #286494 emake \ T= \ - LDFLAGS="${LDFLAGS}" \ - STAGE1_CFLAGS="${STAGE1_CFLAGS}" \ - LIBPATH="${LIBPATH}" \ - BOOT_CFLAGS="${BOOT_CFLAGS}" \ ${GCC_MAKE_TARGET} if is_ada; then @@ -1888,13 +1807,9 @@ gcc_do_make() { if ! is_crosscompile && _tc_use_if_iuse cxx && _tc_use_if_iuse doc ; then if type -p doxygen > /dev/null ; then - if tc_version_is_at_least 4.3 ; then - cd "${CTARGET}"/libstdc++-v3/doc - emake doc-man-doxygen - else - cd "${CTARGET}"/libstdc++-v3 - emake doxygen-man - fi + cd "${CTARGET}"/libstdc++-v3/doc || die + emake doc-man-doxygen + # Clean bogus manpages. bug #113902 find -name '*_build_*' -delete @@ -1923,12 +1838,39 @@ toolchain_src_test() { # 'asan' wants to be preloaded first, so does 'sandbox'. # To make asan tests work disable sandbox for all of test suite. # 'backtrace' tests also does not like 'libsandbox.so' presence. - SANDBOX_ON=0 LD_PRELOAD= emake -k check + # + # Nonfatal here as we die if compare_tests failed + SANDBOX_ON=0 LD_PRELOAD= nonfatal emake -k check + local success_tests=$? + + if [[ ! -d "${BROOT}"/var/cache/gcc/${SLOT} ]] && ! [[ ${success_tests} -eq 0 ]] ; then + # We have no reference data saved from a previous run to know if + # the failures are tolerable or not, so we bail out. + eerror "Reference test data does NOT exist at ${BROOT}/var/cache/gcc/${SLOT}" + eerror "Tests failed and nothing to compare with, so this is a fatal error." + eerror "(Set GCC_TESTS_IGNORE_NO_BASELINE=1 to make this non-fatal for initial run.)" + + if [[ -z ${GCC_TESTS_IGNORE_NO_BASELINE} ]] ; then + die "Tests failed (failures occurred with no reference data)" + fi + fi - einfo "Testing complete." + einfo "Testing complete! Review the following output to check for success or failure." einfo "Please ignore any 'mail' lines in the summary output below (no mail is sent)." einfo "Summary:" "${S}"/contrib/test_summary + + # If previous results exist on the system, compare with it + # TODO: Distribute some baseline results in e.g. gcc-patches.git? + if [[ -d "${BROOT}"/var/cache/gcc/${SLOT} ]] ; then + einfo "Comparing with previous cached results at ${BROOT}/var/cache/gcc/${SLOT}" + + # Exit with the following values: + # 0 if there is nothing of interest + # 1 if there are errors when comparing single test case files + # N for the number of errors found when comparing directories + "${S}"/contrib/compare_tests "${BROOT}"/var/cache/gcc/${SLOT}/ . || die "Comparison for tests results failed, error code: $?" + fi } #---->> src_install <<---- @@ -1939,26 +1881,20 @@ toolchain_src_install() { # Don't allow symlinks in private gcc include dir as this can break the build find gcc/include*/ -type l -delete || die - # Copy over the info pages. We disabled their generation earlier, but the - # build system only expects to install out of the build dir, not the source. bug #464008 - mkdir -p gcc/doc || die - local x= - for x in "${S}"/gcc/doc/*.info* ; do - if [[ -f ${x} ]] ; then - cp "${x}" gcc/doc/ || die - fi - done - - # We remove the generated fixincludes, as they can cause things to break - # (ncurses, openssl, etc). We do not prevent them from being built, as - # in the following commit which we revert: - # https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/toolchain.eclass?r1=1.647&r2=1.648 - # This is because bsd userland needs fixedincludes to build gcc, while - # linux does not. Both can dispose of them afterwards. - while read x ; do - grep -q 'It has been auto-edited by fixincludes from' "${x}" \ - && use !prefix && rm -f "${x}" - done < <(find gcc/include*/ -name '*.h') + # Re-enable fixincludes for >= GCC 13 + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107128 + if [[ ${GCCMAJOR} -lt 13 ]] ; then + # We remove the generated fixincludes, as they can cause things to break + # (ncurses, openssl, etc). We do not prevent them from being built, as + # in the following commit which we revert: + # https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/toolchain.eclass?r1=1.647&r2=1.648 + # This is because bsd userland needs fixedincludes to build gcc, while + # linux does not. Both can dispose of them afterwards. + while read x ; do + grep -q 'It has been auto-edited by fixincludes from' "${x}" \ + && rm -f "${x}" + done < <(find gcc/include*/ -name '*.h') + fi if is_jit ; then # See https://gcc.gnu.org/onlinedocs/gcc-11.3.0/jit/internals/index.html#packaging-notes @@ -1971,7 +1907,7 @@ toolchain_src_install() { # # Do the 'make install' from the build directory pushd "${WORKDIR}"/build-jit > /dev/null || die - S="${WORKDIR}"/build-jit emake DESTDIR="${D}" install + S="${WORKDIR}"/build-jit emake DESTDIR="${D}" -j1 install # Punt some tools which are really only useful while building gcc find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \; @@ -1985,7 +1921,17 @@ toolchain_src_install() { fi # Do the 'make install' from the build directory - S="${WORKDIR}"/build emake DESTDIR="${D}" install + # + # Unfortunately, we have to use -j1 for make install. Upstream + # don't really test it and there's not much appetite for fixing bugs + # with it. Several reported bugs exist where the resulting image + # was wrong, rather than a simple compile/install failure: + # - bug #906155 + # - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42980 + # - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51814 + # - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103656 + # - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109898 + S="${WORKDIR}"/build emake DESTDIR="${D}" -j1 install # Punt some tools which are really only useful while building gcc find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \; @@ -2006,18 +1952,11 @@ toolchain_src_install() { create_gcc_env_entry create_revdep_rebuild_entry - # Setup the gcc_env_entry for hardened gcc 4 with minispecs - want_minispecs && copy_minispecs_gcc_specs - - # Make sure we don't have stuff lying around that - # can nuke multiple versions of gcc - gcc_slot_java - dodir /usr/bin cd "${D}"${BINPATH} || die # Ugh: we really need to auto-detect this list. # It's constantly out of date. - for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo gnat* ; do + for x in cpp gcc gccrs g++ c++ gcov g77 gfortran gccgo gnat* ; do # For some reason, g77 gets made instead of ${CTARGET}-g77... # this should take care of that if [[ -f ${x} ]] ; then @@ -2049,7 +1988,7 @@ toolchain_src_install() { if ! is_crosscompile; then # Rename the main go binaries as we don't want to clobber dev-lang/go # when gcc-config runs. bug #567806 - if tc_version_is_at_least 5 && is_go ; then + if is_go ; then for x in go gofmt; do mv ${x} ${x}-${GCCMAJOR} || die done @@ -2104,8 +2043,6 @@ toolchain_src_install() { # libgfortran.la: gfortran itself handles linkage correctly in the # dynamic & static case (libgfortran.spec). bug #573302 # libgfortranbegin.la: Same as above, and it's an internal lib. - # libmpx.la: gcc itself handles linkage correctly (libmpx.spec). - # libmpxwrappers.la: See above. # libitm.la: gcc itself handles linkage correctly (libitm.spec). # libvtv.la: gcc itself handles linkage correctly. # lib*san.la: Sanitizer linkage is handled internally by gcc, and they @@ -2122,8 +2059,6 @@ toolchain_src_install() { -name 'libgomp-plugin-*.la' -o \ -name libgfortran.la -o \ -name libgfortranbegin.la -o \ - -name libmpx.la -o \ - -name libmpxwrappers.la -o \ -name libitm.la -o \ -name libvtv.la -o \ -name 'lib*san.la' \ @@ -2154,15 +2089,20 @@ toolchain_src_install() { export QA_WX_LOAD="usr/lib*/go/*/*.gox" # Disable RANDMMAP so PCH works, bug #301299 - if tc_version_is_at_least 4.3 ; then - pax-mark -r "${ED}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1" - pax-mark -r "${ED}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus" - fi - - # Disable MPROTECT so java works, bug #574808 - if is_gcj ; then - pax-mark -m "${ED}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/ecj1" - pax-mark -m "${ED}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}/gij" + pax-mark -r "${ED}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1" + pax-mark -r "${ED}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus" + + if use test ; then + # TODO: In future, install orphaned to allow comparison across + # more versions even after unmerged? Also would be useful for + # historical records and tracking down regressions a while + # after they first appeared, but were only just reported. + einfo "Copying test results to ${EPREFIX}/var/cache/gcc/${SLOT} for future comparison" + ( + dodir /var/cache/gcc/${SLOT} + cd "${WORKDIR}"/build || die + find . -name \*.sum -exec cp --parents -v {} "${ED}"/var/cache/gcc/${SLOT} \; + ) fi } @@ -2174,7 +2114,7 @@ gcc_movelibs() { # move them to the compiler-specific CHOST internal dir. This is stuff # that you want to link against when building tools rather than building # code to run on the target. - if tc_version_is_at_least 5 && is_crosscompile ; then + if is_crosscompile ; then dodir "${HOSTLIBPATH#${EPREFIX}}" mv "${ED}"/usr/$(get_libdir)/libcc1* "${D}${HOSTLIBPATH}" || die fi @@ -2216,14 +2156,6 @@ gcc_movelibs() { fi done fix_libtool_libdir_paths "${LIBPATH}/${MULTIDIR}" - - # SLOT up libgcj.pc if it's available (and let gcc-config worry about links) - FROMDIR="${PREFIX}/lib/${OS_MULTIDIR}" - for x in "${D}${FROMDIR}"/pkgconfig/libgcj*.pc ; do - [[ -f ${x} ]] || continue - sed -i "/^libdir=/s:=.*:=${LIBPATH}/${MULTIDIR}:" "${x}" || die - mv "${x}" "${D}${FROMDIR}"/pkgconfig/libgcj-${GCC_PV}.pc || die - done done # We remove directories separately to avoid this case: @@ -2272,7 +2204,7 @@ create_gcc_env_entry() { local gcc_envd_file="${ED}${gcc_envd_base}" if [[ -z $1 ]] ; then # I'm leaving the following commented out to remind me that it - # was an insanely -bad- idea. Stuff broke. GCC_SPECS isnt unset + # was an insanely -bad- idea. Stuff broke. GCC_SPECS isn't unset # on chroot or in non-toolchain.eclass gcc ebuilds! #gcc_specs_file="${LIBPATH}/specs" gcc_specs_file="" @@ -2336,67 +2268,6 @@ create_revdep_rebuild_entry() { EOF } -copy_minispecs_gcc_specs() { - # On gcc 6, we don't need minispecs - if tc_version_is_at_least 6.0 ; then - return 0 - fi - - # Setup the hardenedno* specs files and the vanilla specs file. - if hardened_gcc_works ; then - create_gcc_env_entry hardenednopiessp - fi - if hardened_gcc_works pie ; then - create_gcc_env_entry hardenednopie - fi - if hardened_gcc_works ssp ; then - create_gcc_env_entry hardenednossp - fi - create_gcc_env_entry vanilla - insinto ${LIBPATH#${EPREFIX}} - doins "${WORKDIR}"/specs/*.specs || die "failed to install specs" - # Build system specs file which, if it exists, must be a complete set of - # specs as it completely and unconditionally overrides the builtin specs. - if ! tc_version_is_at_least 4.4 ; then - $(XGCC) -dumpspecs > "${WORKDIR}"/specs/specs - cat "${WORKDIR}"/build.specs >> "${WORKDIR}"/specs/specs - doins "${WORKDIR}"/specs/specs || die "failed to install the specs file" - fi -} - -gcc_slot_java() { - local x - - # Move Java headers to compiler-specific dir - for x in "${D}${PREFIX}"/include/gc*.h "${D}${PREFIX}"/include/j*.h ; do - [[ -f ${x} ]] && mv -f "${x}" "${D}${LIBPATH}"/include/ - done - for x in gcj gnu java javax org ; do - if [[ -d ${D}${PREFIX}/include/${x} ]] ; then - dodir /${LIBPATH#${EPREFIX}}/include/${x} - mv -f "${D}${PREFIX}"/include/${x}/* "${D}${LIBPATH}"/include/${x}/ - rm -rf "${D}${PREFIX}"/include/${x} - fi - done - - if [[ -d ${D}${PREFIX}/lib/security ]] || [[ -d ${D}${PREFIX}/$(get_libdir)/security ]] ; then - dodir /${LIBPATH#${EPREFIX}}/security - mv -f "${D}${PREFIX}"/lib*/security/* "${D}${LIBPATH}"/security - rm -rf "${D}${PREFIX}"/lib*/security - fi - - # Move random gcj files to compiler-specific directories - for x in libgcj.spec logging.properties ; do - x="${D}${PREFIX}/lib/${x}" - [[ -f ${x} ]] && mv -f "${x}" "${D}${LIBPATH}"/ - done - - # Rename jar because it could clash with Kaffe's jar if this gcc is - # primary compiler (aka doesn't have the -<version> extension) - cd "${D}${BINPATH}" - [[ -f jar ]] && mv -f jar gcj-jar -} - #---->> pkg_post* <<---- toolchain_pkg_postinst() { @@ -2459,14 +2330,14 @@ do_gcc_config() { ewarn "The currently selected specs-specific gcc config," ewarn "${current_specs}, doesn't exist anymore. This is usually" ewarn "due to enabling/disabling hardened or switching to a version" - ewarn "of gcc that doesnt create multiple specs files. The default" + ewarn "of gcc that doesn't create multiple specs files. The default" ewarn "config will be used, and the previous preference forgotten." use_specs="" fi target="${CTARGET}-${GCC_CONFIG_VER}${use_specs}" else - # The curent target is invalid. Attempt to switch to a valid one. + # The current target is invalid. Attempt to switch to a valid one. # Blindly pick the latest version. bug #529608 # TODO: Should update gcc-config to accept `-l ${CTARGET}` rather than # doing a partial grep like this. @@ -2489,7 +2360,9 @@ should_we_gcc_config() { local curr_branch_ver=$(ver_cut 1-2 ${curr_config_ver}) - if [[ ${curr_branch_ver} == ${GCC_BRANCH_VER} ]] ; then + if tc_use_major_version_only && [[ ${curr_config_ver} == ${GCCMAJOR} ]] ; then + return 0 + elif ! tc_use_major_version_only && [[ ${curr_branch_ver} == ${GCC_BRANCH_VER} ]] ; then return 0 else # If we're installing a genuinely different compiler version, @@ -2519,7 +2392,7 @@ should_we_gcc_config() { #---->> support and misc functions <<---- # This is to make sure we don't accidentally try to enable support for a -# language that doesnt exist. GCC 3.4 supports f77, while 4.0 supports f95, etc. +# language that doesn't exist. GCC 3.4 supports f77, while 4.0 supports f95, etc. # # Also add a hook so special ebuilds (kgcc64) can control which languages # exactly get enabled @@ -2563,11 +2436,6 @@ is_fortran() { _tc_use_if_iuse fortran } -is_gcj() { - gcc-lang-supported java || return 1 - _tc_use_if_iuse cxx && _tc_use_if_iuse gcj -} - is_go() { gcc-lang-supported go || return 1 _tc_use_if_iuse cxx && _tc_use_if_iuse go @@ -2598,6 +2466,16 @@ is_objcxx() { _tc_use_if_iuse cxx && _tc_use_if_iuse objc++ } +is_modula2() { + gcc-lang-supported m2 || return 1 + _tc_use_if_iuse cxx && _tc_use_if_iuse modula2 +} + +is_rust() { + gcc-lang-supported rust || return 1 + _tc_use_if_iuse rust +} + # Grab a variable from the build system (taken from linux-info.eclass) get_make_var() { local var=$1 makefile=${2:-${WORKDIR}/build/Makefile} @@ -2607,91 +2485,17 @@ get_make_var() { XGCC() { get_make_var GCC_FOR_TARGET ; } -# The gentoo pie-ssp patches allow for 3 configurations: -# 1) PIE+SSP by default -# 2) PIE by default -# 3) SSP by default -hardened_gcc_works() { - if [[ $1 == "pie" ]] ; then - # $gcc_cv_ld_pie is unreliable as it simply take the output of - # `ld --help | grep -- -pie`, that reports the option in all cases, also if - # the loader doesn't actually load the resulting executables. - - want_pie || return 1 - _tc_use_if_iuse nopie && return 1 - hardened_gcc_is_stable pie - return $? - elif [[ $1 == "ssp" ]] ; then - [[ -n ${SPECS_VER} ]] || return 1 - _tc_use_if_iuse nossp && return 1 - hardened_gcc_is_stable ssp - return $? - else - # laziness ;) - hardened_gcc_works pie || return 1 - hardened_gcc_works ssp || return 1 - return 0 - fi -} - -hardened_gcc_is_stable() { - local tocheck - if [[ $1 == "pie" ]] ; then - tocheck=${PIE_GLIBC_STABLE} - elif [[ $1 == "ssp" ]] ; then - tocheck=${SSP_STABLE} - else - die "hardened_gcc_stable needs to be called with pie or ssp" - fi - - has $(tc-arch) ${tocheck} && return 0 - return 1 -} - -want_minispecs() { - # On gcc 6, we don't need minispecs - if tc_version_is_at_least 6.0 ; then - return 0 - fi - if tc_version_is_at_least 4.3.2 && _tc_use_if_iuse hardened ; then - if ! want_pie ; then - ewarn "PIE_VER or SPECS_VER is not defined in the GCC ebuild." - elif use vanilla ; then - ewarn "You will not get hardened features if you have the vanilla USE-flag." - elif _tc_use_if_iuse nopie && _tc_use_if_iuse nossp ; then - ewarn "You will not get hardened features if you have the nopie and nossp USE-flag." - elif ! hardened_gcc_works ; then - ewarn "Your $(tc-arch) arch is not supported." - else - return 0 - fi - ewarn "Hope you know what you are doing. Hardened will not work." - return 0 - fi - return 1 -} - -want_pie() { - ! _tc_use_if_iuse hardened && [[ -n ${PIE_VER} ]] \ - && _tc_use_if_iuse nopie && return 1 - [[ -n ${PIE_VER} ]] && [[ -n ${SPECS_VER} ]] && return 0 - tc_version_is_at_least 4.3.2 && return 1 - [[ -z ${PIE_VER} ]] && return 1 - _tc_use_if_iuse nopie || return 0 - return 1 -} - has toolchain_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" toolchain_death_notice" toolchain_death_notice() { if [[ -e "${WORKDIR}"/build ]] ; then pushd "${WORKDIR}"/build >/dev/null (echo '' | $(tc-getCC ${CTARGET}) ${CFLAGS} -v -E - 2>&1) > gccinfo.log [[ -e "${T}"/build.log ]] && cp "${T}"/build.log . - tar jcf "${WORKDIR}"/gcc-build-logs.tar.bz2 \ + tar -acf "${WORKDIR}"/gcc-build-logs.tar.xz \ gccinfo.log build.log $(find -name config.log) rm gccinfo.log build.log eerror - eerror "Please include ${WORKDIR}/gcc-build-logs.tar.bz2 in your bug report." + eerror "Please include ${WORKDIR}/gcc-build-logs.tar.xz in your bug report." eerror popd >/dev/null fi @@ -2699,9 +2503,6 @@ toolchain_death_notice() { fi -EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure \ - src_compile src_test src_install pkg_postinst pkg_postrm - # Note [implicitly enabled flags] # ------------------------------- # Usually configure-based packages handle explicit feature requests @@ -2719,3 +2520,5 @@ EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure \ # Thus safer way to enable/disable the feature is to rely on implicit # enabled-by-default state: # econf $(usex foo '' --disable-foo) + +EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_postinst pkg_postrm diff --git a/scripts/auto-bootstraps/analyse_result.py b/scripts/auto-bootstraps/analyse_result.py index a131dfc848..5314d66593 100755 --- a/scripts/auto-bootstraps/analyse_result.py +++ b/scripts/auto-bootstraps/analyse_result.py @@ -10,11 +10,23 @@ from functools import cmp_to_key resultsdir='./results' deprecated_archs = ( + 'i386-apple-darwin9', 'x86_64-pc-cygwin', + 'i386-pc-solaris2.11', 'sparc-sun-solaris2.10', 'sparcv9-sun-solaris2.10', 'sparc-sun-solaris2.11', - 'sparcv9-sun-solaris2.11' + 'sparcv9-sun-solaris2.11', + 'x86_64-apple-darwin19', + 'x86_64-apple-darwin20', + 'x86_64-apple-darwin21', + 'x86_64-apple-darwin22', + 'arm64-apple-darwin21', + 'arm64-apple-darwin22', + 'x86_64-pc-linux-centos8.3', + 'x86_64-pc-linux-ubuntu16.04', + 'x86_64-rap-linux-ubuntu16.04', + 'x86_64-rap-linux-ubuntu18.04', ) def find_last_stage(d): @@ -177,8 +189,8 @@ with os.scandir(resultsdir) as it: if 'Fetching ' in x: if 'portage-latest.tar.bz2' in x: snapshot = 'latest' - elif 'prefix-overlay-' in x: - snapshot = re.split('[-.]', x)[2] + elif re.search(r'(prefix-overlay|portage)-\d{8}\.tar\.bz2', x) is not None: + snapshot = x.split('.')[0].split('-')[-1] elif 'total size is' in x: snapshot = 'rsync' elif 'Darwin with GCC toolchain' in x: diff --git a/scripts/auto-bootstraps/dobootstrap b/scripts/auto-bootstraps/dobootstrap index b4042a66e0..cafd4df1fa 100755 --- a/scripts/auto-bootstraps/dobootstrap +++ b/scripts/auto-bootstraps/dobootstrap @@ -5,14 +5,14 @@ BOOTURL="http://rsync.prefix.bitzolder.nl/scripts/bootstrap-prefix.sh" UPLOAD="rsync1.prefix.bitzolder.nl::gentoo-portage-bootstraps" do_fetch() { - local FETCHCOMMAND + local FETCH_COMMAND # Try to find a download manager, we only deal with wget, # curl, FreeBSD's fetch and ftp. - if [[ x$(type -t wget) == "xfile" ]] ; then + if [[ $(type -t wget) == "file" ]] ; then FETCH_COMMAND="wget -O -" [[ $(wget -h) == *"--no-check-certificate"* ]] && \ FETCH_COMMAND+=" --no-check-certificate" - elif [[ x$(type -t curl) == "xfile" ]] ; then + elif [[ $(type -t curl) == "file" ]] ; then FETCH_COMMAND="curl -f -L" else echo "could not download ${1##*/}" @@ -26,17 +26,32 @@ do_prepare() { local bitw=$1 local dte=$2 local bootstrap + local chost + local bootstrapscript if [[ -n ${RESUME} && -n ${bitw} && -n ${dte} ]] ; then bootstrap=${OVERRIDE_EPREFIX:-bootstrap${bitw}-${dte}}/bootstrap-prefix.sh elif [[ -n ${DOLOCAL} ]] ; then bootstrap=${BOOTSTRAP} - else + fi + if [[ ! -e ${bootstrap} ]] ; then bootstrap=dobootstrap-do_prepare-$$ do_fetch ${BOOTURL} > ${bootstrap} fi - local chost=$(${BASH} ${bootstrap} chost.guess x) + chost=$("${BASH}" "${bootstrap}" chost.guess x) + case ${chost} in + *-darwin[89]) + # ppc64-darwin never really worked for unknown reasons + # darwin9 (Leopard) doesn't work on Intel either + bitw=32 + ;; + *-solaris*|*-darwin*) + # force 64-bits for these targets, 32-bits is no longer + # supported + bitw=64 + ;; + esac case ${chost} in *86-*) if [[ ${bitw} == 64 ]] ; then @@ -73,7 +88,7 @@ do_prepare() { chost=sparc-${chost#*-} fi ;; - sparcv9-*|sparc64-*) + SParcv9-*|sparc64-*) if [[ ${bitw} == 32 ]] ; then chost=sparc-${chost#*-} else @@ -92,11 +107,11 @@ do_prepare() { EPREFIX=${PWD}/bootstrap${bitw}-${dte} [[ -n ${OVERRIDE_EPREFIX} ]] && EPREFIX=${OVERRIDE_EPREFIX} - local bootstrapscript=$(realpath ${BASH_SOURCE[0]} 2>/dev/null) + bootstrapscript=$(realpath "${BASH_SOURCE[0]}" 2>/dev/null) if [[ -z ${bootstrapscript} ]] ; then local b=${BASH_SOURCE[0]} - cd "${b%/*}" - bootstrapscript=$(pwd -P)/${b##*/} + cd "${b%/*}" || exit 1 + bootstrapscript="$(pwd -P)/${b##*/}" fi echo "EPREFIX=${EPREFIX}" mkdir -p "${EPREFIX}" @@ -111,58 +126,33 @@ do_prepare() { # USE-flags in make.conf prior to stage2 (first emerge usage) starttime=${SECONDS} env -i \ - HOME=${EPREFIX} \ - SHELL=/bin/sh \ - TERM=${TERM} \ - USER=${USER} \ - CHOST=${chost} \ - EPREFIX=${EPREFIX} \ + HOME="${EPREFIX}" \ + SHELL="/bin/sh" \ + TERM="${TERM}" \ + USER="${USER}" \ + CHOST="${chost}" \ + EPREFIX="${EPREFIX}" \ ${GENTOO_MIRRORS+GENTOO_MIRRORS="${GENTOO_MIRRORS}"} \ ${DOLOCAL+DOLOCAL=1} \ ${RESUME+RESUME=1} \ ${LATEST_TREE_YES+LATEST_TREE_YES=1} \ - ${TREE_FROM_SRC+TREE_FROM_SRC=}${TREE_FROM_SRC} \ - ${USE_CPU_CORES+USE_CPU_CORES=}${USE_CPU_CORES} \ - ${DARWIN_USE_GCC+DARWIN_USE_GCC=}${DARWIN_USE_GCC} \ - ${PREFIX_DISABLE_RAP+PREFIX_DISABLE_RAP=}${PREFIX_DISABLE_RAP} \ - ${BP_KEEPALIVE_ACTIVE+BP_KEEPALIVE_ACTIVE=}${BP_KEEPALIVE_ACTIVE} \ - ${BASH} ${bootstrapscript} bootstrap + ${TREE_FROM_SRC+TREE_FROM_SRC="${TREE_FROM_SRC}"} \ + ${USE_CPU_CORES+USE_CPU_CORES="${USE_CPU_CORES}"} \ + ${DARWIN_USE_GCC+DARWIN_USE_GCC="${DARWIN_USE_GCC}"} \ + ${PREFIX_DISABLE_RAP+PREFIX_DISABLE_RAP="${PREFIX_DISABLE_RAP}"} \ + ${BP_KEEPALIVE_ACTIVE+BP_KEEPALIVE_ACTIVE="${BP_KEEPALIVE_ACTIVE}"} \ + "${BASH}" "${bootstrapscript}" bootstrap endtime=${SECONDS} if [[ -n ${DOPUBLISH} ]] ; then echo $((endtime - starttime)) > elapsedtime - # massage CHOST on Linux systems - if [[ ${chost} == *-linux-gnu* ]] ; then - # two choices here: x86_64_ubuntu16-linux-gnu - # x86_64-pc-linux-ubuntu16 - # I choose the latter because it is compatible with most - # UNIX vendors - local dist=$(lsb_release -si) - local rel=$(lsb_release -sr) - if [[ -z ${dist} ]] || [[ -z ${rel} ]] ; then - source /etc/os-release # this may fail if the file isn't there - [[ -z ${dist} ]] && dist=${NAME} - [[ -z ${dist} ]] && dist=${ID} - [[ -z ${rel} ]] && rel=${VERSION_ID} - - # Gentoo's versioning isn't really relevant, since it is - # a rolling distro - [[ ${dist,,} == "gentoo" ]] && rel= - fi - [[ -z ${dist} ]] && dist=linux - # leave rel unset/empty if we don't know about it - while [[ ${rel} == *.*.* ]] ; do - rel=${rel%.*} - done - local platform=pc - # this is the logic used in bootstrap-prefix.sh - [[ ${PREFIX_DISABLE_RAP} != "yes" ]] && platform=rap - chost=${chost%%-*}-${platform}-linux-${dist,,}${rel} - fi + # get identification of host that includes Linux distro, RAP, ... + chost="$(env CHOST="${chost}" \ + "${BASH}" ./bootstrap-prefix.sh chost.identify x)" - rsync -q /dev/null ${UPLOAD}/${HOSTNAME}-$$/ - rsync -q /dev/null ${UPLOAD}/${HOSTNAME}-$$/${chost}/ + rsync -q /dev/null "${UPLOAD}/${HOSTNAME}-$$"/ + rsync -q /dev/null "${UPLOAD}/${HOSTNAME}-$$/${chost}"/ rsync -rltv \ --exclude=work/ \ --exclude=homedir/ \ @@ -177,15 +167,15 @@ do_prepare() { var/tmp/portage \ var/log/emerge.log \ etc/portage/make.conf \ - ${UPLOAD}/${HOSTNAME}-$$/${chost}/${dte}/ + "${UPLOAD}/${HOSTNAME}-$$/${chost}/${dte}"/ rsync -q /dev/null \ - ${UPLOAD}/${HOSTNAME}-$$/${chost}/${dte}/push-complete/ + "${UPLOAD}/${HOSTNAME}-$$/${chost}/${dte}"/push-complete/ fi } do_bootstrap() { chmod 755 bootstrap-prefix.sh || exit 1 - ${BASH} ./bootstrap-prefix.sh ${EPREFIX} noninteractive + "${BASH}" ./bootstrap-prefix.sh "${EPREFIX}" noninteractive } # re-exec under keepalive wrapper, such that the machine we're running @@ -207,28 +197,28 @@ case $1 in ;; local) export DOLOCAL=1 - do_prepare $2 + do_prepare "$2" ;; resume) export RESUME=1 - do_prepare "$2" ${3:-${BOOTSTRAP_DATE}} + do_prepare "$2" "${3:-${BOOTSTRAP_DATE}}" ;; *) bitw= - if [[ ${0} == /net/* ]] ; then + if [[ ${0} == /net/* || ${0} == /System/* ]] ; then echo "internal host, activating local and DOPUBLISH" export DOLOCAL=1 export DOPUBLISH=1 - export GENTOO_MIRRORS="http://distfileslocal" + export GENTOO_MIRRORS="http://distfileslocal http://distfiles.gentoo.org" fi for arg in "${@:1}" ; do case "${arg}" in latesttree) export LATEST_TREE_YES=1 ;; norap|no-rap) export PREFIX_DISABLE_RAP=yes ;; - 32|64) bitw=${arg} ;; + 32|64) bitw="${arg}" ;; esac done - do_prepare ${bitw} + do_prepare "${bitw}" ;; esac diff --git a/scripts/auto-bootstraps/process_uploads.sh b/scripts/auto-bootstraps/process_uploads.sh index ca39789510..8e51f7c992 100755 --- a/scripts/auto-bootstraps/process_uploads.sh +++ b/scripts/auto-bootstraps/process_uploads.sh @@ -1,10 +1,21 @@ #!/usr/bin/env bash +#shellcheck disable=SC1091 UPLOADDIR="./uploads" RESULTSDIR="./results" +if [[ -x ${BASH_SOURCE[0]%/*}/process_uploads_local.sh ]] ; then + source "${BASH_SOURCE[0]%/*}"/process_uploads_local.sh +fi + +if [[ $(type -t process_file) != function ]] ; then + process_file() { + return + } +fi + didsomething= -for d in ${UPLOADDIR}/* ; do +for d in "${UPLOADDIR}"/* ; do if [[ ! -d "${d}" ]] ; then rm -f "${d}" continue @@ -18,7 +29,7 @@ for d in ${UPLOADDIR}/* ; do continue fi - dir=${1#${d}/} + dir=${1#"${d}"/} # skip this thing from auto-processing if it is new platform [[ -d ${RESULTSDIR}/${dir%/*} ]] || continue # skip this thing if it already exists @@ -30,27 +41,31 @@ for d in ${UPLOADDIR}/* ; do # behind mkdir "${RESULTSDIR}/${dir}" for f in \ + distfiles \ stage{1,2,3}.log \ .stage{1,2,3}-finished \ bootstrap-prefix.sh \ emerge.log \ startprefix \ elapsedtime \ - make.conf \ - distfiles ; + make.conf ; do - [[ -e "${d}/${dir}/${f}" ]] && \ + if [[ -e "${d}/${dir}/${f}" ]] ; then mv "${d}/${dir}/${f}" "${RESULTSDIR}/${dir}"/ + process_file "${RESULTSDIR}/${dir}/${f}" + fi done if [[ -e "${d}/${dir}/portage" ]] ; then for pkg in "${d}/${dir}/portage"/*/* ; do [[ -e ${pkg} ]] || continue - w=${pkg#${d}/} + w=${pkg#"${d}"/} mkdir -p "${RESULTSDIR}/${w}" [[ -e "${pkg}"/build-info ]] && \ mv "${pkg}"/build-info "${RESULTSDIR}/${w}"/ - [[ -e "${pkg}"/temp ]] && \ + if [[ -e "${pkg}"/temp ]] ; then mv "${pkg}"/temp "${RESULTSDIR}/${w}"/ + process_file "${RESULTSDIR}/${w}"/temp + fi done fi chmod -R o+rX,go-w "${RESULTSDIR}/${dir}" diff --git a/scripts/auto-bootstraps/update_distfiles.py b/scripts/auto-bootstraps/update_distfiles.py index 76d3da64df..33b5ed2065 100755 --- a/scripts/auto-bootstraps/update_distfiles.py +++ b/scripts/auto-bootstraps/update_distfiles.py @@ -18,6 +18,9 @@ for path in sys.argv[1:]: for f in it: if not f.is_file() or f.name.startswith('.'): continue + # ensure this live snapshot never ends up in a mirror + if f.name.startswith('portage-latest.tar.'): + continue srcfile = os.path.join(path, f.name) h = hash_file(srcfile) distname = os.path.join(distfilessrc, diff --git a/scripts/bootstrap-bash.sh b/scripts/bootstrap-bash.sh index b24015fc19..db9d8c2795 100755 --- a/scripts/bootstrap-bash.sh +++ b/scripts/bootstrap-bash.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 2006-2018 Gentoo Foundation; Distributed under the GPL v2 +# Copyright 2006-2024 Gentoo Authors; Distributed under the GPL v2 # bash installer # @@ -14,15 +14,15 @@ if [ -z "$1" ] ; then fi mkdir -p "$1" -cd "$1" +cd "$1" || exit 1 mkdir bash-build -cd bash-build +cd bash-build || exit 1 -GENTOO_MIRRORS=${GENTOO_MIRRORS:="http://distfiles.gentoo.org/distfiles"} +GENTOO_MIRRORS=${GENTOO_MIRRORS:="http://distfiles.prefix.bitzolder.nl/distfiles"} command_exists() { check_cmd="$1" - command -v $check_cmd >/dev/null 2>&1 + command -v "${check_cmd}" >/dev/null 2>&1 } same_file() { @@ -40,7 +40,7 @@ if [ ! -e bash-4.2.tar.gz ] ; then eerror() { echo "!!! $*" 1>&2; } einfo() { echo "* $*"; } - if [ -z ${FETCH_COMMAND} ] ; then + if [ -z "${FETCH_COMMAND}" ] ; then # Try to find a download manager, we only deal with wget, # curl, FreeBSD's fetch and ftp. if command_exists wget; then @@ -65,7 +65,7 @@ if [ ! -e bash-4.2.tar.gz ] ; then ;; esac fi - if [ -z ${FETCH_COMMAND} ]; then + if [ -z "${FETCH_COMMAND}" ]; then eerror "no suitable download manager found (need wget, curl, fetch or ftp)" eerror "could not download ${1##*/}" eerror "download the file manually, and put it in ${PWD}" @@ -77,7 +77,7 @@ fi gzip -d bash-4.2.tar.gz tar -xf bash-4.2.tar -cd bash-4.2 +cd bash-4.2 || exit 2 ./configure --prefix="${1}"/usr --disable-nls make diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh index 4a6125b769..741f6e6cde 100755 --- a/scripts/bootstrap-prefix.sh +++ b/scripts/bootstrap-prefix.sh @@ -1,12 +1,13 @@ #!/usr/bin/env bash -# Copyright 2006-2022 Gentoo Authors +#shellcheck disable=SC1091,SC2015,SC2016,SC2030,SC2031,SC2038,SC2185,SC2120 +# Copyright 2006-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -trap 'exit 1' TERM KILL INT QUIT ABRT +trap 'exit 1' TERM INT QUIT ABRT # RAP (libc) mode is triggered on Linux kernel and glibc. is-rap() { [[ ${PREFIX_DISABLE_RAP} != "yes" && ${CHOST} = *linux-gnu* ]]; } -rapx() { is-rap && echo $1 || echo $2; } +rapx() { is-rap && echo "$1" || echo "$2"; } ## Functions Start Here @@ -15,57 +16,67 @@ estatus() { # disturbing -- if it works, it makes it easy to see where we are in # the bootstrap from the terminal status line (usually the window # name) - printf '\033]2;'"$*"'\007' + printf '\033]2;%s\007' "$*" } -eerror() { estatus $*; echo "!!! $*" 1>&2; } +eerror() { estatus "$*"; echo "!!! $*" 1>&2; } einfo() { echo "* $*"; } v() { echo "$@"; "$@"; } econf() { estatus "stage1: configuring ${PWD##*/}" - v ${CONFIG_SHELL} ./configure \ - --host=${CHOST} \ + v ${CONFIG_SHELL:+"${CONFIG_SHELL}"} ./configure \ + --host="${CHOST}" \ --prefix="${ROOT}"/tmp/usr \ --mandir="${ROOT}"/tmp/usr/share/man \ --infodir="${ROOT}"/tmp/usr/share/info \ --datadir="${ROOT}"/tmp/usr/share \ --sysconfdir="${ROOT}"/tmp/etc \ --localstatedir="${ROOT}"/tmp/var/lib \ - --build=${CHOST} \ + --build="${CHOST}" \ "$@" || return 1 } emake() { - [[ $* == *install* ]] \ - && estatus "stage1: installing ${PWD##*/}" \ - || estatus "stage1: building ${PWD##*/}" - v ${MAKE} ${MAKEOPTS} "$@" || return 1 + if [[ $* == *install* ]] ; then + estatus "stage1: installing ${PWD##*/}" + else + estatus "stage1: building ${PWD##*/}" + fi + read -r -a makeopts <<< "${MAKEOPTS}" + v "${MAKE}" "${makeopts[@]}" "$@" || return 1 } efetch() { if [[ ! -e ${DISTDIR}/${1##*/} ]] ; then - if [[ ${OFFLINE_MODE} ]]; then - echo "I need ${1##*/} from $1 in $DISTDIR, can you give it to me?" - read - [[ -e ${DISTDIR}/${1##*/} ]] && return 0 - # Give fetch a try + mkdir -p "${DISTDIR}" >& /dev/null + + # Try fetching from local mirrors first, as this requires no connection + for loc in ${GENTOO_MIRRORS} ; do + if [[ ${loc} = /* && -e "${loc}/${1##*/}" ]]; then + cp "${loc}/${1##*/}" "${DISTDIR}/${1##*/}" && return 0 + fi + done + + if [[ ${OFFLINE_MODE} ]] ; then + echo "I need ${1##*/} from $1 in $DISTDIR, can you give it to me?" + read -r + [[ -e ${DISTDIR}/${1##*/} ]] && return 0 + # Give fetch a try fi if [[ -z ${FETCH_COMMAND} ]] ; then # Try to find a download manager, we only deal with wget, # curl, FreeBSD's fetch and ftp. - if [[ x$(type -t wget) == "xfile" ]] ; then + if [[ $(type -t wget) == "file" ]] ; then FETCH_COMMAND="wget" [[ $(wget -h) == *"--no-check-certificate"* ]] \ && FETCH_COMMAND+=" --no-check-certificate" - elif [[ x$(type -t curl) == "xfile" ]] ; then + elif [[ $(type -t curl) == "file" ]] ; then FETCH_COMMAND="curl -f -L -O" - elif [[ x$(type -t fetch) == "xfile" ]] ; then + elif [[ $(type -t fetch) == "file" ]] ; then FETCH_COMMAND="fetch" - elif [[ x$(type -t ftp) == "xfile" ]] && - [[ ${CHOST} != *-cygwin* || \ - ! $(type -P ftp) -ef $(cygpath -S)/ftp ]] ; then + elif [[ $(type -t ftp) == "file" ]] ; then FETCH_COMMAND="ftp" else eerror "no suitable download manager found!" @@ -75,10 +86,9 @@ efetch() { fi fi - mkdir -p "${DISTDIR}" >& /dev/null einfo "Fetching ${1##*/}" estatus "stage1: fetching ${1##*/}" - pushd "${DISTDIR}" > /dev/null + pushd "${DISTDIR}" > /dev/null || exit 1 # Try for mirrors first, fall back to distfiles, then try given location local locs=( ) @@ -91,21 +101,25 @@ efetch() { done locs=( "${locs[@]}" "$1" ) + read -r -a fetchcmd <<< "${FETCH_COMMAND}" for loc in "${locs[@]}" ; do - v ${FETCH_COMMAND} "${loc}" < /dev/null + v "${fetchcmd[@]}" "${loc}" < /dev/null [[ -f ${1##*/} ]] && break done if [[ ! -f ${1##*/} ]] ; then eerror "downloading ${1} failed!" return 1 fi - popd > /dev/null + popd > /dev/null || exit 1 fi return 0 } configure_cflags() { export CPPFLAGS="-I${ROOT}/tmp/usr/include" + # keep it fairly reasonable (no -march or whatever) + export OVERRIDE_CFLAGS="-O2 -pipe" + export OVERRIDE_CXXFLAGS="-O2 -pipe" case ${CHOST} in *-darwin*) @@ -114,9 +128,6 @@ configure_cflags() { *-solaris*) export LDFLAGS="-L${ROOT}/tmp/usr/lib -R${ROOT}/tmp/usr/lib" ;; - i586-pc-winnt* | *-pc-cygwin*) - export LDFLAGS="-L${ROOT}/tmp/usr/lib" - ;; *) export LDFLAGS="-L${ROOT}/tmp/usr/lib -Wl,-rpath=${ROOT}/tmp/usr/lib" ;; @@ -148,40 +159,23 @@ configure_cflags() { configure_toolchain() { linker="sys-devel/binutils" - local gcc_deps="dev-libs/gmp dev-libs/mpfr dev-libs/mpc" + local gcc_deps="dev-libs/gmp dev-libs/mpfr dev-libs/mpc dev-libs/libffi" compiler="${gcc_deps} sys-devel/gcc-config sys-devel/gcc" compiler_stage1="${gcc_deps} sys-devel/gcc-config" compiler_type="gcc" - case ${CHOST} in - *-cygwin*) - # not supported in gcc-4.7 yet, easy enough to install g++ - # Cygwin patches come as .zip from github - compiler_stage1+=" app-arch/unzip sys-devel/gcc" - ;; - *-darwin*) - # handled below - ;; - *-freebsd* | *-openbsd*) - # comes with clang, handled below - ;; - *) - # The host may not have a functioning c++ toolchain, so use a - # stage1 compiler that can build with C only. - # But gcc-4.7 fails to build with gcc-5.4, so we check for - # >gcc-4.7, as anything newer provides c++ anyway (#619542). - # gcc-4.7 is the last version not to require a c++ compiler to - # build - eval $( (gcc -E - | grep compiler_stage1) <<-EOP - #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 7)) - compiler_stage1+=" sys-devel/gcc" - #elif defined(__GNUC__) && __GNUC__ >= 4 - compiler_stage1+=" <sys-devel/gcc-4.8" - #else - compiler_stage1+=" <sys-devel/gcc-4.7" - #endif - EOP - ) - esac + + # The host may not have a functioning C++ toolchain, but all + # compilers available to us require C++ to build. The last known + # version not to require C++ is gcc-4.7. + # We can bootstrap 4.7 in stage1 perhaps if we find envs that do + # not have a functioning C++ toolchain, but for now we assume this + # is not a problem. + # On top of this since gcc-11, C++11 is necessary. This was + # introduced in gcc-4.8, but apparently gcc-5 is still buildable + # with Apple's gcc-apple-4.0.1, so that's a good candidate + # The Prefix tree only contains gcc-12 as of this writing. + # The bootstrap Python 3.7 we have in use requires C11, so Apple's + # 4.x line is no longer enough for that. CC=gcc CXX=g++ @@ -190,52 +184,34 @@ configure_toolchain() { *darwin*:1) einfo "Triggering Darwin with GCC toolchain" compiler_stage1+=" sys-apps/darwin-miscutils" - local ccvers="$(unset CHOST; /usr/bin/gcc --version 2>/dev/null)" - local isgcc= - case "${ccvers}" in - *"(GCC) 4.2.1 "*) - linker="=sys-devel/binutils-apple-3.2.6" - isgcc=true - ;; - *"(GCC) 4.0.1 "*) - linker="=sys-devel/binutils-apple-3.2.6" - # upgrade to 4.2.1 first - compiler_stage1+=" - sys-devel/gcc-apple - =sys-devel/binutils-apple-3.2.6" - isgcc=true - ;; - *"Apple clang version "*|*"Apple LLVM version "*) - # recent binutils-apple are hard to build (C++11 - # features, and cmake build system) so avoid going - # there, the system ld is good enough to bring us to - # stage3, after which the @system set will take care of - # the rest - linker=sys-devel/native-cctools + compiler_stage1+=" sys-devel/gcc" + + # binutils-apple/xtools doesn't work (yet) on arm64. The + # profiles will mask and keep using native-cctools for that, + # otherwise stage3 and @system will take care of switching + # to binutils-apple. + # one problem: when we have a really old linker, we need + # to use it sooner or else packages like libffi won't + # compile. + case ${CHOST} in + *-darwin[89]) + linker="=sys-devel/binutils-apple-3.2.6*" ;; *) - eerror "unknown compiler: ${ccvers}" - return 1 + linker="sys-devel/native-cctools" ;; esac - if [[ ${isgcc} == true ]] ; then - # current compiler (gcc-11) requires C++11, which is - # available since 4.8, so need to bootstrap with <11 - compiler_stage1+=" <sys-devel/gcc-11" - compiler="${compiler%sys-devel/gcc} <sys-devel/gcc-11" - else - # assume LLVM/Clang has C++11 support - compiler_stage1+=" sys-devel/gcc" - fi ;; *-darwin*) + local ccvers + local llvm_deps einfo "Triggering Darwin with LLVM/Clang toolchain" # for compilers choice, see bug: # https://bugs.gentoo.org/show_bug.cgi?id=538366 compiler_stage1="sys-apps/darwin-miscutils" compiler_type="clang" - local ccvers="$(unset CHOST; /usr/bin/gcc --version 2>/dev/null)" - local llvm_deps="dev-util/ninja" + ccvers="$(unset CHOST; ${CC} --version 2>/dev/null)" + llvm_deps="dev-build/ninja" case "${ccvers}" in *"Apple clang version "*|*"Apple LLVM version "*) # this is Clang, recent enough to compile recent clang @@ -268,29 +244,12 @@ configure_toolchain() { sys-devel/llvm sys-devel/clang" ;; - *-freebsd* | *-openbsd*) - CC=clang - CXX=clang++ - # TODO: target clang toolchain someday? - ;; - *-solaris*) - local ccvers="$(unset CHOST; gcc --version 2>/dev/null)" - case "${ccvers}" in - *"gcc (GCC) 3.4.3"*) - # host compiler doesn't cope with the asm introduced - # in mpfr-4, so force using an older one during - # bootstrap for this target - compiler_stage1=${compiler_stage1/" dev-libs/mpfr "/" <dev-libs/mpfr-4 "} - ;; - esac - local nmout=$(nm -B 2>&1) - case "${nmout}" in - */dev/null*) : ;; # apparently GNU - *) export NM="$(type -P nm) -p" ;; # Solaris nm - esac - ;; *-linux*) is-rap && einfo "Triggering Linux RAP bootstrap" + compiler_stage1+=" sys-devel/gcc" + ;; + *) + compiler_stage1+=" sys-devel/gcc" ;; esac @@ -298,24 +257,8 @@ configure_toolchain() { } bootstrap_setup() { - local profile="" einfo "Setting up some guessed defaults" - # 2.6.32.1 -> 2*256^3 + 6*256^2 + 32 * 256 + 1 = 33955841 - kver() { uname -r|cut -d\- -f1|awk -F. '{for (i=1; i<=NF; i++){s+=lshift($i,(4-i)*8)};print s}'; } - # >=glibc-2.20 requires >=linux-2.6.32. - profile-kernel() { - if [[ $(kver) -ge 50462720 ]] ; then # 3.2 - echo kernel-3.2+ - elif [[ $(kver) -ge 33955840 ]] ; then # 2.6.32 - echo kernel-2.6.32+ - elif [[ $(kver) -ge 33951744 ]] ; then # 2.6.16 - echo kernel-2.6.16+ - elif [[ $(kver) -ge 33947648 ]] ; then # 2.6 - echo kernel-2.6+ - fi - } - local FS_INSENSITIVE=0 touch "${ROOT}"/FOO.$$ [[ -e ${ROOT}/foo.$$ ]] && FS_INSENSITIVE=1 @@ -353,33 +296,68 @@ bootstrap_setup() { echo "USE=\"\${USE} ${MAKE_CONF_ADDITIONAL_USE}\"" [[ ${OFFLINE_MODE} ]] && \ echo 'FETCHCOMMAND="bash -c \"echo I need \${FILE} from \${URI} in \${DISTDIR}; read\""' + + if [[ ${CHOST} == i*86-apple-darwin9 ]] ; then + # There's no legitimate reason to use 10.5 with x86 (10.6 and + # 10.7 run on every device that ever ran 10.5 x86) but it's + # vastly easier to access and faster than ppc. Don't want to + # burden the tree with this aid-arch, so just use the ppc + # keyword. + echo + echo 'ACCEPT_KEYWORDS="~ppc-macos"' + fi } > "${MAKE_CONF_DIR}/0100_bootstrap_prefix_make.conf" fi if is-rap ; then if [[ ! -f ${ROOT}/etc/passwd ]]; then - if grep -q $(id -un) /etc/passwd; then + if grep -q "^$(id -un):" /etc/passwd; then ln -sf {,"${ROOT}"}/etc/passwd else getent passwd > "${ROOT}"/etc/passwd # add user if it's not in /etc/passwd, bug #766417 - getent passwd $(id -un) >> "${ROOT}"/etc/passwd + getent passwd "$(id -un)" >> "${ROOT}"/etc/passwd fi fi if [[ ! -f ${ROOT}/etc/group ]]; then - if grep -q $(id -gn) /etc/group; then + if grep -q "^$(id -gn):" /etc/group; then ln -sf {,"${ROOT}"}/etc/group else getent group > "${ROOT}"/etc/group # add group if it's not in /etc/group, bug #766417 - getent group $(id -gn) >> "${ROOT}"/etc/group + getent group "$(id -gn)" >> "${ROOT}"/etc/group fi fi [[ -f ${ROOT}/etc/resolv.conf ]] || ln -s {,"${ROOT}"}/etc/resolv.conf [[ -f ${ROOT}/etc/hosts ]] || cp {,"${ROOT}"}/etc/hosts - local profile_linux=default/linux/ARCH/17.0/prefix/$(profile-kernel) + fi + + bootstrap_profile +} + +bootstrap_profile() { + local profile + local profile_linux + + # 2.6.32.1 -> 2*256^3 + 6*256^2 + 32 * 256 + 1 = 33955841 + kver() { uname -r|cut -d- -f1|awk -F. '{for (i=1; i<=NF; i++){s+=lshift($i,(4-i)*8)};print s}'; } + # >=glibc-2.20 requires >=linux-2.6.32. + profile-kernel() { + if [[ $(kver) -ge 50462720 ]] ; then # 3.2 + echo kernel-3.2+ + elif [[ $(kver) -ge 33955840 ]] ; then # 2.6.32 + echo kernel-2.6.32+ + elif [[ $(kver) -ge 33951744 ]] ; then # 2.6.16 + echo kernel-2.6.16+ + elif [[ $(kver) -ge 33947648 ]] ; then # 2.6 + echo kernel-2.6+ + fi + } + + if is-rap ; then + profile_linux="default/linux/ARCH/17.0/prefix/$(profile-kernel)" else - local profile_linux=prefix/linux/ARCH + profile_linux="prefix/linux/ARCH" fi case ${CHOST} in @@ -387,10 +365,15 @@ bootstrap_setup() { rev=${CHOST##*darwin} profile="prefix/darwin/macos/10.$((rev - 4))/ppc" ;; - i*86-apple-darwin1[578]) + i*86-apple-darwin9) rev=${CHOST##*darwin} profile="prefix/darwin/macos/10.$((rev - 4))/x86" ;; + i*86-apple-darwin1[578]) + eerror "REMOVED ARCH: this 32-bit MacOS architecture was removed," + eerror "bootstrapping is impossible" + exit 1 + ;; x86_64-apple-darwin1[5789]) rev=${CHOST##*darwin} profile="prefix/darwin/macos/10.$((rev - 4))/x64" @@ -410,7 +393,7 @@ bootstrap_setup() { i*86-pc-linux-gnu) profile=${profile_linux/ARCH/x86} ;; - riscv64-pc-linux-gnu) + riscv64-*-linux-gnu) profile=${profile_linux/ARCH/riscv} profile=${profile/17.0/20.0/rv64gc/lp64d} ;; @@ -434,26 +417,22 @@ bootstrap_setup() { aarch64-unknown-linux-gnu) profile=${profile_linux/ARCH/arm64} ;; - armv7l-pc-linux-gnu) + armv7*-unknown-linux-gnueabi*) profile=${profile_linux/ARCH/arm} - ;; - i386-pc-solaris2.11) - profile="prefix/sunos/solaris/5.11/x86" + profile=${profile/17.0/17.0/armv7a} ;; x86_64-pc-solaris2.11) profile="prefix/sunos/solaris/5.11/x64" ;; - sparc-sun-solaris2.11) - profile="prefix/sunos/solaris/5.11/sparc" - ;; - sparcv9-sun-solaris2.11) - profile="prefix/sunos/solaris/5.11/sparc64" - ;; - i586-pc-winnt*) - profile="prefix/windows/winnt/${CHOST#i586-pc-winnt}/x86" + i386-pc-solaris2*|sparc-sun-solaris2*|sparcv9-sun-solaris2*) + eerror "REMOVED ARCH: this Solaris architecture was removed," + eerror "bootstrapping is impossible" + exit 1 ;; - x86_64-pc-cygwin*) - profile="prefix/windows/cygwin/x64" + i586-pc-winnt*|x86_64-pc-cygwin*) + eerror "REMOVED ARCH: this Windows architecture was removed," + eerror "bootstrapping is impossible" + exit 1 ;; *) eerror "UNKNOWN ARCH: You need to set up a make.profile symlink to a" @@ -465,12 +444,36 @@ bootstrap_setup() { if [[ ${CHOST} == *-darwin* ]] ; then # setup MacOSX.sdk symlink for GCC, this should probably be # managed using an eselect module in the future + # FWIW, just use system (/) if it seems OK, for some reason + # early versions of TAPI-based SDKs did not include some symbols + # like fclose, which ld64 is able to resolve from the dylibs + # although they are unvisible using e.g. nm. rm -f "${ROOT}"/MacOSX.sdk - local SDKPATH=$(xcrun --show-sdk-path --sdk macosx) - if [[ ! -e ${SDKPATH} ]] ; then - SDKPATH=$(xcodebuild -showsdks | sort -nr \ - | grep -o "macosx.*" | head -n1) - SDKPATH=$(xcode-select -print-path)/SDKs/MacOSX${SDKPATH#macosx}.sdk + local SDKPATH + if [[ -e /usr/lib/libSystem.B.dylib && -d /usr/include ]] ; then + SDKPATH=/ + else + SDKPATH=$(xcrun --show-sdk-path --sdk macosx) + if [[ -L ${SDKPATH} ]] ; then + local fsdk + local osvers + # try and find a matching OS SDK + fsdk="$(readlink -f "${SDKPATH}")" + osvers="$(sw_vers -productVersion)" + if [[ ${osvers%%.*} -le 10 ]] ; then + osvers=$(echo "${osvers}" | cut -d'.' -f1-2) + else + osvers=${osvers%%.*} + fi + fsdk=${fsdk%/MacOSX*.sdk} + fsdk=${fsdk}/MacOSX${osvers}.sdk + [[ -e ${fsdk} ]] && SDKPATH=${fsdk} + fi + if [[ ! -e ${SDKPATH} ]] ; then + SDKPATH=$(xcodebuild -showsdks | sort -nr \ + | grep -o "macosx.*" | head -n1) + SDKPATH=$(xcode-select -print-path)/SDKs/MacOSX${SDKPATH#macosx}.sdk + fi fi ( cd "${ROOT}" && ln -s "${SDKPATH}" MacOSX.sdk ) einfo "using system sources from ${SDKPATH}" @@ -512,8 +515,7 @@ bootstrap_setup() { # Strange enough, -cxx causes wrong libtool config on Cygwin, # but we require a C++ compiler there anyway - so just use it. - [[ ${CHOST} == *-cygwin* ]] || - cat >> "${ROOT}"/etc/portage/make.profile/package.use <<-EOF + cat >> "${ROOT}"/etc/portage/make.profile/package.use <<-EOF # gmp has cxx flag enabled by default. When dealing with a host # compiler without cxx support this causes configure failure. # In addition, The stage2 g++ is only for compiling stage3 compiler, @@ -551,29 +553,35 @@ do_tree() { # latest tree cannot be fetched from mirrors, always have to # respect the source to get the latest if [[ -n ${LATEST_TREE_YES} ]] ; then - echo "$1" - ( export GENTOO_MIRRORS= DISTFILES_G_O= DISTFILES_PFX= ; + ( export GENTOO_MIRRORS='' DISTFILES_G_O='' DISTFILES_PFX='' ; efetch "$1/$2" ) || return 1 else - efetch "$1/$2" || return 1 + # use only Prefix mirror + ( export GENTOO_MIRRORS='' DISTFILES_G_O='' ; + efetch "$1/$2" ) || return 1 fi einfo "Unpacking, this may take a while" estatus "stage1: unpacking Portage tree" - bzip2 -dc ${DISTDIR}/$2 | tar -xf - -C ${PORTDIR} --strip-components=1 + bzip2 -dc "${DISTDIR}/$2" \ + | tar -xf - -C "${PORTDIR}" --strip-components=1 [[ ${PIPESTATUS[*]} == '0 0' ]] || return 1 - touch ${PORTDIR}/.unpacked + touch "${PORTDIR}"/.unpacked fi } bootstrap_tree() { + # retain this comment and the line below to + # keep this snapshot around in the snapshots + # MKSNAPSHOT-ANCHOR -- directory of rsync slaves + local PV="20240409" + # RAP uses the latest gentoo main repo snapshot to bootstrap. is-rap && LATEST_TREE_YES=1 - local PV="20221104" - if [[ -n ${LATEST_TREE_YES} ]]; then - do_tree "${SNAPSHOT_URL}" portage-latest.tar.bz2 - else - do_tree http://dev.gentoo.org/~grobian/distfiles prefix-overlay-${PV}.tar.bz2 - fi + + [[ -n ${LATEST_TREE_YES} ]] && PV=latest + + do_tree "${SNAPSHOT_URL}" portage-${PV}.tar.bz2 + local ret=$? if [[ -n ${TREE_FROM_SRC} ]]; then estatus "stage1: rsyncing Portage tree" @@ -598,7 +606,7 @@ bootstrap_startscript() { fi einfo "Trying to emerge the shell you use, if necessary by running:" einfo "emerge -u ${theshell}" - if ! emerge -u ${theshell} ; then + if ! emerge -u "${theshell}" ; then eerror "Your shell is not available in portage, hence we cannot" > /dev/stderr eerror "automate starting your prefix, set SHELL and rerun this script" > /dev/stderr return 1 @@ -608,8 +616,10 @@ bootstrap_startscript() { einfo "To start Gentoo Prefix, run the script ${ROOT}/startprefix" # see if PATH is kept/respected - local minPATH="preamble:${BASH%/*}:postlude" - local theirPATH="$(echo 'echo "${PATH}"' | env LS_COLORS= PATH="${minPATH}" $SHELL -l 2>/dev/null | grep "preamble:.*:postlude")" + local minPATH + local theirPATH + minPATH="preamble:${BASH%/*}:postlude" + theirPATH="$(echo 'echo "${PATH}"' | env LS_COLORS= PATH="${minPATH}" "${SHELL}" -l 2>/dev/null | grep "preamble:.*:postlude")" if [[ ${theirPATH} != *"preamble:"*":postlude"* ]] ; then einfo "WARNING: your shell initialisation (.cshrc, .bashrc, .profile)" einfo " seems to overwrite your PATH, this effectively kills" @@ -635,24 +645,24 @@ bootstrap_portage() { # STABLE_PV that is known to work. Intended for power users only. ## It is critical that STABLE_PV is the lastest (non-masked) version that is ## included in the snapshot for bootstrap_tree. - STABLE_PV="3.0.30.1" - [[ ${TESTING_PV} == latest ]] && TESTING_PV="3.0.30.1" + STABLE_PV="3.0.56.1" + [[ ${TESTING_PV} == latest ]] && TESTING_PV="3.0.56.1" PV="${TESTING_PV:-${STABLE_PV}}" A=prefix-portage-${PV}.tar.bz2 einfo "Bootstrapping ${A%.tar.*}" - efetch ${DISTFILES_URL}/${A} || return 1 + efetch "${DISTFILES_URL}/${A}" || return 1 einfo "Unpacking ${A%.tar.*}" export S="${PORTAGE_TMPDIR}"/portage-${PV} ptmp=${S} rm -rf "${S}" >& /dev/null mkdir -p "${S}" >& /dev/null - cd "${S}" + cd "${S}" || return 1 bzip2 -dc "${DISTDIR}/${A}" | tar -xf - [[ ${PIPESTATUS[*]} == '0 0' ]] || return 1 S="${S}/prefix-portage-${PV}" - cd "${S}" + cd "${S}" || return 1 fix_config_sub @@ -678,8 +688,8 @@ bootstrap_portage() { einfo "Compiling ${A%.tar.*}" econf \ --with-offset-prefix="${ROOT}"/tmp \ - --with-portage-user="`id -un`" \ - --with-portage-group="`id -gn`" \ + --with-portage-user="$(id -un)" \ + --with-portage-group="$(id -gn)" \ --with-extra-path="${PATH}" \ || return 1 emake || return 1 @@ -687,8 +697,8 @@ bootstrap_portage() { einfo "Installing ${A%.tar.*}" emake install || return 1 - cd "${ROOT}" - rm -Rf ${ptmp} >& /dev/null + cd "${ROOT}" || return 1 + rm -Rf "${ptmp}" >& /dev/null # Some people will skip the tree() step and hence var/log is not created # As such, portage complains.. @@ -697,11 +707,11 @@ bootstrap_portage() { # in Prefix the sed wrapper is deadly, so kill it rm -f "${ROOT}"/tmp/usr/lib/portage/bin/ebuild-helpers/sed - local tmpportdir=${ROOT}/tmp/${PORTDIR#${ROOT}} + local tmpportdir=${ROOT}/tmp/${PORTDIR#"${ROOT}"} [[ -e "${tmpportdir}" ]] || ln -s "${PORTDIR}" "${tmpportdir}" - for d in "${ROOT}"/tmp/usr/lib/python${PYTHONMAJMIN}; do - [[ -e ${d}/portage ]] || ln -s "${ROOT}"/tmp/usr/lib/portage/lib/portage ${d}/portage - [[ -e ${d}/_emerge ]] || ln -s "${ROOT}"/tmp/usr/lib/portage/lib/_emerge ${d}/_emerge + for d in "${ROOT}"/tmp/usr/lib/python$(python_ver); do + [[ -e ${d}/portage ]] || ln -s "${ROOT}"/tmp/usr/lib/portage/lib/portage "${d}"/portage + [[ -e ${d}/_emerge ]] || ln -s "${ROOT}"/tmp/usr/lib/portage/lib/_emerge "${d}"/_emerge done if [[ -s ${PORTDIR}/profiles/repo_name ]]; then @@ -719,6 +729,7 @@ fix_config_sub() { # for various versions of autoconf if [[ ${CHOST} == arm64-apple-darwin* ]] ; then # Apple Silicon doesn't use aarch64, but arm64 + # note: macOS /usr/bin/find knows no -print0 or -exec find . -name "config.sub" | \ xargs sed -i -e 's/ arm\(-\*\)* / arm\1 | arm64\1 /' find . -name "config.sub" | \ @@ -733,41 +744,46 @@ bootstrap_simple() { A=${PN}-${PV}.tar.${3:-gz} einfo "Bootstrapping ${A%.tar.*}" - efetch ${4:-${DISTFILES_G_O}/distfiles}/${A} || return 1 + efetch "${4:-${DISTFILES_G_O}/distfiles}/${A}" || return 1 einfo "Unpacking ${A%.tar.*}" S="${PORTAGE_TMPDIR}/${PN}-${PV}" rm -rf "${S}" - mkdir -p "${S}" - cd "${S}" + mkdir -p "${S}" || return 1 + cd "${S}" || return 1 case $3 in + zstd) decomp=zstd ;; xz) decomp=xz ;; bz2) decomp=bzip2 ;; gz|"") decomp=gzip ;; esac - ${decomp} -dc "${DISTDIR}"/${A} | tar -xf - + ${decomp} -dc "${DISTDIR}/${A}" | tar -xf - [[ ${PIPESTATUS[*]} == '0 0' ]] || return 1 S="${S}"/${PN}-${PV} - cd "${S}" + cd "${S}" || return 1 fix_config_sub # for libressl, only provide static lib, such that wget (above) # links it in and we don't have to bother about RPATH or something if [[ ${PN} == "libressl" ]] ; then - myconf="${myconf} --enable-static --disable-shared" + myconf=( + "${myconf[@]}" + --enable-static + --disable-shared + ) fi einfo "Compiling ${A%.tar.*}" if [[ -x configure ]] ; then - econf ${myconf} || return 1 + econf "${myconf[@]}" || return 1 fi emake || return 1 einfo "Installing ${A%.tar.*}" emake PREFIX="${ROOT}"/tmp/usr install || return 1 - cd "${ROOT}" + cd "${ROOT}" || return 1 rm -Rf "${S}" einfo "${A%.tar.*} successfully bootstrapped" } @@ -779,6 +795,7 @@ bootstrap_gnu() { einfo "Bootstrapping ${A%.tar.*}" + # GNU does not use zstd (yet?) for t in tar.xz tar.bz2 tar.gz tar ; do A=${PN}-${PV}.${t} @@ -794,19 +811,19 @@ bootstrap_gnu() { fi URL=${GNU_URL}/${PN}/${A} - efetch ${URL} || continue + efetch "${URL}" || continue einfo "Unpacking ${A%.tar.*}" S="${PORTAGE_TMPDIR}/${PN}-${PV}" rm -rf "${S}" - mkdir -p "${S}" - cd "${S}" + mkdir -p "${S}" || return 1 + cd "${S}" || return 1 case ${t} in tar.xz) decomp=xz ;; tar.bz2) decomp=bzip2 ;; tar.gz) decomp=gzip ;; tar) - tar -xf "${DISTDIR}"/${A} || continue + tar -xf "${DISTDIR}/${A}" || continue break ;; *) @@ -814,7 +831,7 @@ bootstrap_gnu() { return 1 ;; esac - ${decomp} -dc "${DISTDIR}"/${URL##*/} | tar -xf - + ${decomp} -dc "${DISTDIR}/${URL##*/}" | tar -xf - [[ ${PIPESTATUS[*]} == '0 0' ]] || continue break done @@ -833,30 +850,12 @@ bootstrap_gnu() { # have a suffix. Remove suffix by copy, not move, to not # trigger refetch on repeated invocations of this script. if [[ -f "${DISTDIR}/${tar_patch_file}?${tar_patch_id}" ]]; then - cp ${DISTDIR}/${tar_patch_file}{?${tar_patch_id},} || return 1 + cp "${DISTDIR}/${tar_patch_file}"{"?${tar_patch_id}",} || return 1 fi - patch -p1 < ${DISTDIR}/${tar_patch_file} || return 1 - fi - - if [[ ${PN}-${PV} == "bash-4.3" && ${CHOST} == *-cygwin* ]] ; then - local p patchopts - for p in \ - "-p0" \ - "${DISTFILES_G_O}/distfiles/bash43-"{001..048} \ - "-p2" \ - "https://dev.gentoo.org/~haubi/distfiles/bash-4.3_p39-cygwin-r2.patch" \ - ; do - if [[ ${p} == -* ]] ; then - patchopts=${p} - continue - fi - efetch "${p}" || return 1 - patch --forward --no-backup-if-mismatch ${patchopts} \ - < "${DISTDIR}/${p##*/}" || return 1 - done + patch -p1 < "${DISTDIR}/${tar_patch_file}" || return 1 fi - local myconf="" + local -a myconf if [[ ${PN} == "make" && ${PV} == "4.2.1" ]] ; then if [[ ${CHOST} == *-linux-gnu* ]] ; then # force this, macros aren't set correctly with newer glibc @@ -888,21 +887,39 @@ bootstrap_gnu() { # so just don't set it at all. # Solaris 11 has a messed up prce installation. We don't need # it anyway, so just disable it - myconf="${myconf} --disable-perl-regexp" + myconf+=( "--disable-perl-regexp" ) + fi + + if [[ ${PN} == "mpfr" || ${PN} == "mpc" || ${PN} == "gcc" ]] ; then + [[ -e "${ROOT}"/tmp/usr/include/gmp.h ]] \ + && myconf+=( "--with-gmp=${ROOT}/tmp/usr" ) + fi + if [[ ${PN} == "mpc" || ${PN} == "gcc" ]] ; then + [[ -e "${ROOT}"/tmp/usr/include/mpfr.h ]] \ + && myconf+=( "--with-mpfr=${ROOT}/tmp/usr" ) + fi + if [[ ${PN} == "gcc" ]] ; then + [[ -e "${ROOT}"/tmp/usr/include/mpc.h ]] \ + && myconf+=( "--with-mpc=${ROOT}/tmp/usr" ) + + myconf+=( + "--enable-languages=c,c++" + "--disable-bootstrap" + "--disable-multilib" + "--disable-nls" + ) + + export CFLAGS="-O1 -pipe" + export CXXFLAGS="-O1 -pipe" fi # pod2man may be too old (not understanding --utf8) but we don't # care about manpages at this stage export ac_cv_path_POD2MAN=no - # Darwin9 in particular doesn't compile when using system readline, - # but we don't need any groovy input handling at all, so just disable it - [[ ${PN} == "bash" ]] && myconf="${myconf} --disable-readline" - # On e.g. musl systems bash will crash with a malloc error if we use # bash' internal malloc, so disable it during it this stage - [[ ${PN} == "bash" ]] && \ - myconf="${myconf} --without-bash-malloc" + [[ ${PN} == "bash" ]] && myconf+=( "--without-bash-malloc" ) # Ensure we don't read system-wide shell initialisation, it may # contain cruft, bug #650284 @@ -919,30 +936,35 @@ bootstrap_gnu() { # stdbuf is giving many problems, and we don't really care about it # at this level, so disable it too if [[ ${PN} == "coreutils" ]] ; then - myconf="${myconf} --disable-acl --without-gmp" - myconf="${myconf} --enable-no-install-program=stdbuf" + myconf+=( + "--disable-acl" + "--without-gmp" + "--enable-no-install-program=stdbuf" + ) fi # Gentoo Bug 400831, fails on Ubuntu with libssl-dev installed if [[ ${PN} == "wget" ]] ; then if [[ -x ${ROOT}/tmp/usr/bin/openssl ]] ; then - myconf="${myconf} --with-ssl=openssl" - myconf="${myconf} --with-libssl-prefix=${ROOT}/tmp/usr" + myconf+=( + "-with-ssl=openssl" + "--with-libssl-prefix=${ROOT}/tmp/usr" + ) export CPPFLAGS="${CPPFLAGS} -I${ROOT}/tmp/usr/include" export LDFLAGS="${LDFLAGS} -L${ROOT}/tmp/usr/lib" else - myconf="${myconf} --without-ssl" + myconf+=( "--without-ssl" ) fi fi # SuSE 11.1 has GNU binutils-2.20, choking on crc32_x86 - [[ ${PN} == "xz" ]] && myconf="${myconf} --disable-assembler" + [[ ${PN} == "xz" ]] && myconf+=( "--disable-assembler" ) if [[ ${PN} == "libffi" ]] ; then # we do not have pkg-config to find lib/libffi-*/include/ffi.h sed -i -e '/includesdir =/s/=.*/= $(includedir)/' include/Makefile.in # force install into libdir - myconf="${myconf} --libdir=${ROOT}/tmp/usr/lib" + myconf+=( "--libdir=${ROOT}/tmp/usr/lib" ) sed -i -e '/toolexeclibdir =/s/=.*/= $(libdir)/' Makefile.in # we have to build the libraries for correct bitwidth case $CHOST in @@ -960,7 +982,7 @@ bootstrap_gnu() { fi einfo "Compiling ${A%.tar.*}" - econf ${myconf} || return 1 + econf "${myconf[@]}" || return 1 if [[ ${PN} == "make" && $(type -t $MAKE) != "file" ]]; then estatus "stage1: building ${A%.tar.*}" v ./build.sh || return 1 @@ -976,83 +998,51 @@ bootstrap_gnu() { emake install || return 1 fi - cd "${ROOT}" + cd "${ROOT}" || return 1 rm -Rf "${S}" einfo "${A%.tar.*} successfully bootstrapped" } -PYTHONMAJMIN=3.10 # keep this number in line with PV below for stage1,2 +python_ver() { + # keep this number in line with PV below for stage1,2 + # also, note that this version must match the Python version in the + # snapshot for stage3, else packages will break with some python + # mismatch error due to Portage using a different version after it + # upgraded itself with a newer Python + echo 3.11 + export PYTHON_FULL_VERSION="3.11.7-gentoo-prefix-patched" + # keep this number in line with PV below for stage1,2 +} + bootstrap_python() { - PV=3.10.4 + python_ver # to get full version + PV=${PYTHON_FULL_VERSION} A=Python-${PV}.tar.xz einfo "Bootstrapping ${A%.tar.*}" - efetch https://www.python.org/ftp/python/${PV}/${A} + if [[ ${PV} == *-gentoo-prefix-patched ]] ; then + efetch https://dev.gentoo.org/~grobian/distfiles/${A} + else + efetch https://www.python.org/ftp/python/${PV}/${A} + fi einfo "Unpacking ${A%.tar.*}" export S="${PORTAGE_TMPDIR}/python-${PV}" rm -rf "${S}" - mkdir -p "${S}" - cd "${S}" + mkdir -p "${S}" || return 1 + cd "${S}" || return 1 case ${A} in *bz2) bzip2 -dc "${DISTDIR}"/${A} | tar -xf - ;; *xz) xz -dc "${DISTDIR}"/${A} | tar -xf - ;; *) einfo "Don't know to unpack ${A}" ;; esac [[ ${PIPESTATUS[*]} == '0 0' ]] || return 1 - S="${S}"/Python-${PV} - cd "${S}" + S="${S}"/Python-${PV%%-*} + cd "${S}" || return 1 rm -rf Modules/_ctypes/libffi* || return 1 rm -rf Modules/zlib || return 1 case ${CHOST} in - (*-*-cygwin*) - local gitrev cygpyver pf pn patch_folder ffail - - # try github first, if that fails, it means that cygwin has not - # archived that repo yet - # ideally the version of python used by bootstrap would be one - # that cygwin has packaged if we don't do exact matches on the - # version then some patches may not apply cleanly - - ffail=0 - gitrev="42494e325a050ba03638568d7318f8f0075e25fb" - efetch "https://github.com/cygwinports/python39/archive/${gitrev}.tar.gz" \ - || ffail=1 - if [[ -z ${ffail} ]]; then - gzip -dc "${DISTDIR}"/"${gitrev}.tar.gz" | tar -xf - - [[ ${PIPESTATUS[*]} == '0 0' ]] || return 1 - patch_folder="python39-${gitrev}" - else - cygpyver="3.9.9-1" - efetch "https://mirrors.kernel.org/sourceware/cygwin/x86_64/release/python39/python39-${cygpyver}-src.tar.xz" \ - || return 1 - xz -dc "${DISTDIR}"/"python39-${cygpyver}-src.tar.xz" | tar -xf - - [[ ${PIPESTATUS[*]} == '0 0' ]] || return 1 - patch_folder="python39-${cygpyver}.src" - ffail=0 - fi - [[ ${ffail} == 0 ]] || return 1 - - for pf in $( - sed -ne '/PATCH_URI="/,/"/{s/.*="//;s/".*$//;p}' \ - < "${patch_folder}/python39.cygport" \ - | grep -v rpm-wheels | grep -v revert-bpo - ); do - pf="${patch_folder}/${pf}" - for pn in {1..2} fail; do - if [[ ${pn} == fail ]]; then - eerror "failed to apply ${pf}" - return 1 - fi - patch -N -p${pn} -i "${pf}" --dry-run >/dev/null 2>&1 \ - || continue - echo "applying (-p${pn}) ${pf}" - patch -N -p${pn} -i "${pf}" || return 1 - break - done - done - ;; (*-solaris*) # Solaris' host compiler (if old -- 3.4.3) doesn't grok HUGE_VAL, # and barfs on isnan() so patch it out @@ -1060,15 +1050,22 @@ bootstrap_python() { -e '/^#define Py_HUGE_VAL/s/HUGE_VAL$/(__builtin_huge_val())/' \ -e '/defined HAVE_DECL_ISNAN/s/ISNAN/USE_FALLBACK/' \ Include/pymath.h + # OpenIndiana/Solaris 11 defines inet_aton no longer in + # libresolv, so use hstrerror to check if we need -lresolv + sed -i -e '/AC_CHECK_LIB/s/inet_aton/hstrerror/' \ + configure.ac || die + # we don't regenerate configure at this point, so just force the + # fix result + export LIBS="${LIBS} -lresolv" ;; (*-darwin9) # Darwin 9's kqueue seems to act up (at least at this stage), so # make Python's selectors resort to poll() or select() for the # time being sed -i \ - -e 's/KQUEUE/KQUEUE_DISABLED/' \ + -e 's/kqueue/kqueue_DISABLED/' \ configure - # fixup thread id detection + # fixup thread id detection (only needed on vanilla Python tar) efetch "https://dev.gentoo.org/~sam/distfiles/dev-lang/python/python-3.9.6-darwin9_pthreadid.patch" patch -p1 < "${DISTDIR}"/python-3.9.6-darwin9_pthreadid.patch ;; @@ -1091,8 +1088,6 @@ bootstrap_python() { fix_config_sub - local myconf="" - case ${CHOST} in (x86_64-*-*|sparcv9-*-*) export CFLAGS="-m64" @@ -1103,16 +1098,12 @@ bootstrap_python() { esac case ${CHOST} in - *-*-cygwin*) - # --disable-shared would link modules against "python.exe" - # so renaming to "pythonX.Y.exe" will break them. - # And ctypes dynamically loads "libpythonX.Y.dll" anyway. - myconf="${myconf} --enable-shared" - ;; *-linux*) # Bug 382263: make sure Python will know about the libdir in use for # the current arch - libdir="-L/usr/lib/$(gcc ${CFLAGS} -print-multi-os-directory)" + local -a flgarg + read -r -a flgarg <<< "${CFLAGS}" + libdir="-L/usr/lib/$(gcc "${flgarg[@]}" -print-multi-os-directory)" ;; x86_64-*-solaris*|sparcv9-*-solaris*) # Like above, make Python know where GCC's 64-bits @@ -1159,21 +1150,21 @@ bootstrap_python() { # configure to not find them using HAS_HG (TODO: obsolete?) # - Do not find libffi via pkg-config using PKG_CONFIG HAS_HG=no \ - PKG_CONFIG= \ + PKG_CONFIG='' \ econf \ --with-system-ffi \ --without-ensurepip \ --disable-ipv6 \ --disable-shared \ --libdir="${ROOT}"/tmp/usr/lib \ - ${myconf} || return 1 + || return 1 emake || return 1 einfo "Installing ${A%.tar.*}" emake -k install || echo "??? Python failed to install *sigh* continuing anyway" - cd "${ROOT}"/tmp/usr/bin + cd "${ROOT}"/tmp/usr/bin || return 1 ln -sf python${PV%.*} python - cd "${ROOT}"/tmp/usr/lib + cd "${ROOT}"/tmp/usr/lib || return 1 # messes up python emerges, and shouldn't be necessary for anything # http://forums.gentoo.org/viewtopic-p-6890526.html rm -f libpython${PV%.*}.a @@ -1187,18 +1178,18 @@ bootstrap_cmake_core() { einfo "Bootstrapping ${A%.tar.*}" - efetch https://github.com/Kitware/CMake/releases/download/v${PV}/${A} \ + efetch "https://github.com/Kitware/CMake/releases/download/v${PV}/${A}" \ || return 1 einfo "Unpacking ${A%.tar.*}" export S="${PORTAGE_TMPDIR}/cmake-${PV}" rm -rf "${S}" - mkdir -p "${S}" - cd "${S}" - gzip -dc "${DISTDIR}"/${A} | tar -xf - + mkdir -p "${S}" || return 1 + cd "${S}" || return 1 + gzip -dc "${DISTDIR}/${A}" | tar -xf - [[ ${PIPESTATUS[*]} == '0 0' ]] || return 1 S="${S}"/cmake-${PV} - cd "${S}" + cd "${S}" || return 1 # don't set a POSIX standard, system headers don't like that, #757426 sed -i -e 's/^#if !defined(_WIN32) && !defined(__sun)/& \&\& !defined(__APPLE__)/' \ @@ -1221,10 +1212,10 @@ bootstrap_cmake_core() { # later on, so kill it in the installed version ver=${A%-*} ; ver=${ver%.*} sed -i -e '/cmake_gnu_set_sysroot_flag/d' \ - "${ROOT}"/tmp/usr/share/${ver}/Modules/Platform/Apple-GNU-*.cmake || die + "${ROOT}/tmp/usr/share/${ver}/Modules/Platform"/Apple-GNU-*.cmake || die # disable isysroot usage with clang as well sed -i -e '/_SYSROOT_FLAG/d' \ - "${ROOT}"/tmp/usr/share/${ver}/Modules/Platform/Apple-Clang.cmake || die + "${ROOT}/tmp/usr/share/${ver}/Modules/Platform"/Apple-Clang.cmake || die einfo "${A%.tar.*} bootstrapped" } @@ -1240,21 +1231,21 @@ bootstrap_zlib_core() { einfo "Bootstrapping ${A%.tar.*}" - efetch ${DISTFILES_G_O}/distfiles/${A} || return 1 + efetch "${DISTFILES_G_O}/distfiles/${A}" || return 1 einfo "Unpacking ${A%.tar.*}" export S="${PORTAGE_TMPDIR}/zlib-${PV}" rm -rf "${S}" - mkdir -p "${S}" - cd "${S}" + mkdir -p "${S}" || return 1 + cd "${S}" || return 1 case ${A} in *.tar.gz) decomp=gzip ;; *) decomp=bzip2 ;; esac - ${decomp} -dc "${DISTDIR}"/${A} | tar -xf - + ${decomp} -dc "${DISTDIR}/${A}" | tar -xf - [[ ${PIPESTATUS[*]} == '0 0' ]] || return 1 S="${S}"/zlib-${PV} - cd "${S}" + cd "${S}" || return 1 if [[ ${CHOST} == x86_64-*-* || ${CHOST} == sparcv9-*-* ]] ; then # 64-bits targets need zlib as library (not just to unpack), @@ -1269,31 +1260,13 @@ bootstrap_zlib_core() { # compiler to 32-bits code generation if requested here export CC="${CC} -m32" fi - local makeopts=( ${MAKEOPTS} ) + local makeopts=() # 1.2.5 suffers from a concurrency problem - [[ ${PV} == 1.2.5 ]] && makeopts=() - - if [[ ${CHOST} == *-cygwin* ]] ; then - # gzopen_w is for real _WIN32 only - sed -i -e '/gzopen_w/d' win32/zlib.def - makeopts=( - -f win32/Makefile.gcc - SHARED_MODE=1 - # avoid toolchain finding ./cygz.dll (esp. in parallel build) - SHAREDLIB=win32/cygz.dll - IMPLIB=libz.dll.a - BINARY_PATH="${ROOT}"/tmp/usr/bin - INCLUDE_PATH="${ROOT}"/tmp/usr/include - LIBRARY_PATH="${ROOT}"/tmp/usr/lib - "${makeopts[@]}" - ) - # stage1 python searches for lib/libz.dll - ln -sf libz.dll.a "${ROOT}"/tmp/usr/lib/libz.dll - fi + [[ ${PV} == 1.2.5 ]] || read -r -a makeopts <<< "${MAKEOPTS}" einfo "Compiling ${A%.tar.*}" - CHOST= ${CONFIG_SHELL} ./configure --prefix="${ROOT}"/tmp/usr || return 1 - MAKEOPTS= + CHOST='' ${CONFIG_SHELL} ./configure --prefix="${ROOT}"/tmp/usr || return 1 + MAKEOPTS='' emake "${makeopts[@]}" || return 1 einfo "Installing ${A%.tar.*}" @@ -1317,8 +1290,27 @@ bootstrap_zlib() { } bootstrap_libffi() { + # 3.0.8: last version to bootstrap on Darwin 9 x86 bootstrap_gnu libffi 3.3 || \ - bootstrap_gnu libffi 3.2.1 + bootstrap_gnu libffi 3.2.1 || \ + bootstrap_gnu libffi 3.0.8 +} + +bootstrap_gmp() { + bootstrap_gnu gmp 6.2.1 +} + +bootstrap_mpfr() { + bootstrap_gnu mpfr 4.1.0 +} + +bootstrap_mpc() { + bootstrap_gnu mpc 1.2.1 +} + +bootstrap_gcc5() { + # bootstraps with gcc-4.0.1 (Darwin 8), provides C11 + bootstrap_gnu gcc 5.5.0 } bootstrap_sed() { @@ -1327,6 +1319,7 @@ bootstrap_sed() { } bootstrap_findutils() { + bootstrap_gnu findutils 4.9.0 || bootstrap_gnu findutils 4.7.0 || bootstrap_gnu findutils 4.5.10 || bootstrap_gnu findutils 4.2.33 @@ -1363,7 +1356,7 @@ bootstrap_make() { bootstrap_gnu make 4.2.1 || return 1 if [[ ${MAKE} == gmake ]] ; then # make make available as gmake - ( cd ${ROOT}/tmp/usr/bin && ln -s make gmake ) + ( cd "${ROOT}"/tmp/usr/bin && ln -s make gmake ) fi } @@ -1389,19 +1382,21 @@ bootstrap_texinfo() { } bootstrap_bash() { + bootstrap_gnu bash 5.2 || bootstrap_gnu bash 5.1 || - bootstrap_gnu bash 4.3 || - bootstrap_gnu bash 4.2 + bootstrap_gnu bash 5.0 } bootstrap_bison() { - bootstrap_gnu bison 2.6.2 || bootstrap_gnu bison 2.6.1 || \ - bootstrap_gnu bison 2.6 || bootstrap_gnu bison 2.5.1 || \ + bootstrap_gnu bison 3.8.2 || \ + bootstrap_gnu bison 2.6.2 || \ + bootstrap_gnu bison 2.5.1 || \ bootstrap_gnu bison 2.4 } bootstrap_m4() { - bootstrap_gnu m4 1.4.19 || bootstrap_gnu m4 1.4.18 # version is patched, so beware + bootstrap_gnu m4 1.4.19 || \ + bootstrap_gnu m4 1.4.18 # version is patched, so beware } bootstrap_gzip() { @@ -1409,6 +1404,7 @@ bootstrap_gzip() { } bootstrap_xz() { + GNU_URL=http://tukaani.org/xz bootstrap_gnu xz 5.4.5 || \ GNU_URL=http://tukaani.org/xz bootstrap_gnu xz 5.2.4 || \ GNU_URL=http://tukaani.org/xz bootstrap_gnu xz 5.2.3 } @@ -1468,12 +1464,33 @@ bootstrap_stage1() { # See comments in do_tree(). local portroot=${PORTDIR%/*} - mkdir -p "${ROOT}"/tmp/${portroot#${ROOT}/} + mkdir -p "${ROOT}/tmp/${portroot#"${ROOT}"/}" for x in lib sbin bin; do mkdir -p "${ROOT}"/tmp/usr/${x} [[ -e ${ROOT}/tmp/${x} ]] || ( cd "${ROOT}"/tmp && ln -s usr/${x} ) done + # we could check compiler version here, but we just know + # it's Darwin 8 and 9 being affected here, so handle them to + # get a GCC-5 which is sufficient to compile the current tree + # packages + # see also configure_toolchain + if [[ ${CHOST} == *-darwin[89] ]] ; then + # benefit from 4.2 if it's present + if [[ -e /usr/bin/gcc-4.2 ]] ; then + export CC=gcc-4.2 + export CXX=g++-4.2 + fi + [[ -e ${ROOT}/tmp/usr/include/gmp.h ]] \ + || (bootstrap_gmp) || return 1 + [[ -e ${ROOT}/tmp/usr/include/mpfr.h ]] \ + || (bootstrap_mpfr) || return 1 + [[ -e ${ROOT}/tmp/usr/include/mpc.h ]] \ + || (bootstrap_mpc) || return 1 + [[ -x ${ROOT}/tmp/usr/bin/gcc ]] \ + || (bootstrap_gcc5) || return 1 + fi + configure_toolchain export CC CXX @@ -1503,8 +1520,8 @@ bootstrap_stage1() { || [[ $(m4 --version 2>&1) == *GNU*1.4.1?* ]] \ || (bootstrap_m4) || return 1 [[ -x ${ROOT}/tmp/usr/bin/bison ]] \ - || [[ $(bison --version 2>&1) == *GNU" "Bison") "2.[3-7]* ]] \ - || [[ $(bison --version 2>&1) == *GNU" "Bison") "[3-9]* ]] \ + || [[ $(bison --version 2>&1) == *"GNU Bison) "2.[3-7]* ]] \ + || [[ $(bison --version 2>&1) == *"GNU Bison) "[3-9]* ]] \ || (bootstrap_bison) || return 1 if [[ ! -x ${ROOT}/tmp/usr/bin/uniq ]]; then # If the system has a uniq, let's use it to test whether @@ -1531,7 +1548,7 @@ bootstrap_stage1() { || (bootstrap_grep) || return 1 [[ -x ${ROOT}/tmp/usr/bin/gawk ]] \ || [[ $(awk --version < /dev/null 2>&1) == *GNU" Awk "[456789]* ]] \ - || bootstrap_gawk || return 1 + || (bootstrap_gawk) || return 1 # always build our own bash, for we don't know what devilish thing # we're working with now, bug #650284 [[ -x ${ROOT}/tmp/usr/bin/bash ]] \ @@ -1563,24 +1580,39 @@ bootstrap_stage1() { # If the version of our binutils an older one, they may not # provide what the system gcc is configured to use. # We need to direct the system gcc to find the system binutils. + EXEC="$(PATH="${ORIGINAL_PATH}" type -P gcc)" + if [[ -z ${EXEC} ]] ; then + eerror "could not find 'gcc' in your PATH!" + eerror "please install gcc or provide access via PATH or symlink" + return 1 + fi cat >> "${ROOT}"/tmp/usr/local/bin/gcc <<-EOF #! /bin/sh PATH="${ORIGINAL_PATH}" export PATH - exec "$(type -P gcc)" "\$@" + exec "${EXEC}" "\$@" EOF + EXEC="$(PATH="${ORIGINAL_PATH}" type -P g++)" + if [[ -z ${EXEC} ]] ; then + eerror "could not find 'g++' in your PATH!" + eerror "please install g++ or provide access via PATH or symlink" + return 1 + fi cat >> "${ROOT}"/tmp/usr/local/bin/g++ <<-EOF #! /bin/sh PATH="${ORIGINAL_PATH}" export PATH - exec "$(type -P g++)" "\$@" + exec "${EXEC}" "\$@" EOF chmod 755 "${ROOT}"/tmp/usr/local/bin/g{cc,++} fi ;; esac + # Host compiler can output a variety of libdirs. At stage1, # they should be the same as lib. Otherwise libffi may not be - # found by python. - if is-rap ; then + # found by python. Don't do this when we're using a Gentoo host to + # speed up bootstrapping, it should be good, and we shouldn't be + # touching the host either. Bug #927957 + if is-rap && [[ ! -L "${ROOT}"/tmp ]] ; then [[ -d ${ROOT}/tmp/usr/lib ]] || mkdir -p "${ROOT}"/tmp/usr/lib local libdir for libdir in lib64 lib32 libx32; do @@ -1598,12 +1630,12 @@ bootstrap_stage1() { # Portage) and binutils use it # note that this actually breaks the concept of stage1, this will be # compiled for the target prefix - for zlib in ${ROOT}/tmp/usr/lib/libz.* ; do + for zlib in "${ROOT}"/tmp/usr/lib*/libz.* ; do [[ -e ${zlib} ]] && break zlib= done [[ -n ${zlib} ]] || (bootstrap_zlib) || return 1 - for libffi in ${ROOT}/tmp/usr/lib*/libffi.* ; do + for libffi in "${ROOT}"/tmp/usr/lib*/libffi.* ; do [[ -e ${libffi} ]] && break libffi= done @@ -1624,8 +1656,13 @@ bootstrap_stage1() { [[ -e ${ROOT}/etc/portage/make.profile && \ -e ${MAKE_CONF_DIR}/0100_bootstrap_prefix_make.conf ]] \ || (bootstrap_setup) || return 1 + + # setup a profile for stage2 mkdir -p "${ROOT}"/tmp/etc/. || return 1 - [[ -e ${ROOT}/tmp/etc/portage/make.profile ]] || "${CP}" -dpR "${ROOT}"/etc/portage "${ROOT}"/tmp/etc || return 1 + [[ -e ${ROOT}/tmp/etc/portage/make.profile ]] || \ + ( "${CP}" -dpR "${ROOT}"/etc/portage "${ROOT}"/tmp/etc && \ + rm -f "${ROOT}"/tmp/etc/portage/make.profile && \ + (ROOT="${ROOT}"/tmp PREFIX_DISABLE_RAP=yes bootstrap_profile) ) || return 1 # setup portage [[ -e ${ROOT}/tmp/usr/bin/emerge ]] || (bootstrap_portage) || return 1 @@ -1636,10 +1673,16 @@ bootstrap_stage1() { } bootstrap_stage1_log() { - bootstrap_stage1 ${@} 2>&1 | tee -a ${ROOT}/stage1.log + { + echo "===== stage 1 -- $(date -u +%Y-%m-%dT%H:%M:%SZ) =====" + echo "CHOST: ${CHOST}" + echo "IDENT: ${CHOST_IDENTIFY}" + echo "===========================================" + } >> "${ROOT}"/stage1.log + bootstrap_stage1 "${@}" 2>&1 | tee -a "${ROOT}"/stage1.log local ret=${PIPESTATUS[0]} - [[ ${ret} == 0 ]] && touch ${ROOT}/.stage1-finished - return ${ret} + [[ ${ret} == 0 ]] && touch "${ROOT}"/.stage1-finished + return "${ret}" } do_emerge_pkgs() { @@ -1657,18 +1700,18 @@ do_emerge_pkgs() { else vdb=${vdb}-\* fi - for pvdb in ${EPREFIX}/var/db/pkg/${vdb%-*}-* ; do + for pvdb in "${EPREFIX}/var/db/pkg/${vdb%-*}"-* ; do if [[ -d ${pvdb} ]] ; then evdb=${pvdb##*/} if [[ ${pkg} == "="* ]] ; then # exact match required (* should work here) - [[ ${evdb} == ${vdb##*/} ]] && break + [[ ${evdb} == "${vdb##*/}" ]] && break else vdb=${vdb%-*} evdb=${evdb%-r*} evdb=${evdb%_p*} evdb=${evdb%-*} - [[ ${evdb} == ${vdb#*/} ]] && break + [[ ${evdb} == "${vdb#*/}" ]] && break fi fi pvdb= @@ -1682,6 +1725,7 @@ do_emerge_pkgs() { -gdbm -git -libcxx + -http2 -nls -pcre -python @@ -1692,7 +1736,7 @@ do_emerge_pkgs() { clang internal-glib ) - local override_make_conf_dir="${PORTAGE_OVERRIDE_EPREFIX}${MAKE_CONF_DIR#${ROOT}}" + local override_make_conf_dir="${PORTAGE_OVERRIDE_EPREFIX}${MAKE_CONF_DIR#"${ROOT}"}" if [[ " ${USE} " == *" prefix-stack "* ]] && [[ ${PORTAGE_OVERRIDE_EPREFIX} == */tmp ]] && @@ -1707,54 +1751,51 @@ do_emerge_pkgs() { echo "USE=\"\${USE} ${myuse[*]}\" # by bootstrap-prefix.sh" \ >> "${override_make_conf_dir}/0101_bootstrap_prefix_stack.conf" fi - myuse=" ${myuse[*]} " + local smyuse=" ${myuse[*]} " local use for use in ${USE} ; do - myuse=" ${myuse/ ${use} /} " - myuse=" ${myuse/ -${use} /} " - myuse=" ${myuse/ ${use#-} /} " - myuse+=" ${use} " + smyuse=" ${smyuse/ ${use} /} " + smyuse=" ${smyuse/ -${use} /} " + smyuse=" ${smyuse/ ${use#-} /} " + smyuse=" ${smyuse} ${use} " done - myuse=( ${myuse} ) + read -r -a myuse <<< "${smyuse}" # Disable the STALE warning because the snapshot frequently gets stale. # - # Need need to spam the user about news until the emerge -e system - # because the tools aren't available to read the news item yet anyway. + # No need to spam the user about news until the final emerge @world + # because the tools aren't available to read the news items yet anyway. # # Avoid circular deps caused by the default profiles (and IUSE # defaults). echo "USE=${myuse[*]} PKG=${pkg}" ( + local -a eopts + read -r -a eopts <<< "${opts}" + eopts=( + "--color" "n" + "-v" + "--oneshot" + "--root-deps" + "${eopts[@]}" + ) estatus "${STAGE}: emerge ${pkg}" unset CFLAGS CXXFLAGS [[ -n ${OVERRIDE_CFLAGS} ]] \ - && export CFLAGS=${OVERRIDE_CFLAGS} + && export CFLAGS="${OVERRIDE_CFLAGS}" [[ -n ${OVERRIDE_CXXFLAGS} ]] \ - && export CXXFLAGS=${OVERRIDE_CXXFLAGS} - PORTAGE_CONFIGROOT="${EPREFIX}" \ + && export CXXFLAGS="${OVERRIDE_CXXFLAGS}" PORTAGE_SYNC_STALE=0 \ FEATURES="-news ${FEATURES}" \ USE="${myuse[*]}" \ - emerge --color n -v --oneshot --root-deps ${opts} "${pkg}" - ) - [[ $? -eq 0 ]] || return 1 - - case ${pkg},${CHOST} in - app-shells/bash,*-cygwin*) - # Cygwin would resolve 'bin/bash' to 'bin/bash.exe', but - # merging bin/bash.exe does not replace the bin/bash symlink. - # When we can execute both bin/bash and bin/bash.exe, but - # they are different files, then we need to drop the symlink. - [[ -x ${EPREFIX}/bin/bash && -x ${EPREFIX}/bin/bash.exe && - ! ${EPREFIX}/bin/bash -ef ${EPREFIX}/bin/bash.exe ]] && - rm -f "${EPREFIX}"/bin/bash - ;; - esac + emerge "${eopts[@]}" "${pkg}" + ) || return 1 done } bootstrap_stage2() { + export PORTAGE_CONFIGROOT="${ROOT}"/tmp + if ! type -P emerge > /dev/null ; then eerror "emerge not found, did you bootstrap stage1?" return 1 @@ -1776,7 +1817,7 @@ bootstrap_stage2() { # bison's configure checks for perl, but doesn't use it, # except for tests. Since we don't want to pull in perl at this # stage, fake it - export PERL=$(which touch) + PERL="$(which touch)" ; export PERL # GCC sometimes decides that it needs to run makeinfo to update some # info pages from .texi files. Obviously we don't care at this # stage and rather have it continue instead of abort the build @@ -1824,8 +1865,9 @@ bootstrap_stage2() { # Disable RAP directory hacks of binutils and gcc. If libc.so # linker script provides no hint of ld-linux*.so*, ld should - # look into its default library path. Prefix library pathes + # look into its default library path. Prefix library paths # are taken care of by LDFLAGS in configure_cflags(). + # see profiles/features/prefix/standalone/profile.bashrc export BOOTSTRAP_RAP_STAGE2=yes # Build a basic compiler and portage dependencies in $ROOT/tmp. @@ -1833,14 +1875,12 @@ bootstrap_stage2() { sys-devel/gnuconfig sys-apps/gentoo-functions app-portage/elt-patches - $([[ ${CHOST} == *-cygwin* ]] && echo dev-libs/libiconv ) # bash dependency sys-libs/ncurses sys-libs/readline app-shells/bash app-arch/xz-utils sys-apps/sed sys-apps/baselayout - dev-libs/libffi sys-devel/m4 sys-devel/flex sys-apps/diffutils # needed by bison-3 build system @@ -1849,30 +1889,45 @@ bootstrap_stage2() { sys-devel/binutils-config ) - # Old versions of gcc has been masked. We need gcc-4.7 to bootstrap - # on systems without a c++ compiler. - echo '<sys-devel/gcc-4.8' >> "${ROOT}"/tmp/etc/portage/package.unmask - - # libffi-3.0_rc0 has broken Solaris ld support, which we still - # use at this stage (host compiler) - [[ ${CHOST} == *-solaris* ]] && echo "=dev-libs/libffi-3.3_rc0" \ - >> "${ROOT}"/tmp/etc/portage/package.mask - # provide active SDK link on Darwin if [[ ${CHOST} == *-darwin* ]] ; then rm -f "${ROOT}"/tmp/MacOSX.sdk - ( cd "${ROOT}"/tmp && ln -s ../MacOSX.sdk ) + ( cd "${ROOT}"/tmp && ln -s ../MacOSX.sdk MacOSX.sdk ) fi # cmake has some external dependencies which require autoconf, etc. # unless we only build the buildtool, bug #603012 - echo "dev-util/cmake -server" >> "${ROOT}"/tmp/etc/portage/package.use + echo "dev-build/cmake -server" >> "${ROOT}"/tmp/etc/portage/package.use emerge_pkgs --nodeps "${pkgs[@]}" || return 1 # Debian multiarch supported by RAP needs ld to support sysroot. - EXTRA_ECONF=$(rapx --with-sysroot=/) \ - emerge_pkgs --nodeps ${linker} || return 1 + for pkg in ${linker} ; do + EXTRA_ECONF=$(rapx --with-sysroot=/) \ + emerge_pkgs --nodeps "${pkg}" || return 1 + done + + # During Gentoo prefix bootstrap stage2, GCC is built with + # "--disable-bootstrap". For Darwin, it means that rather than letting + # GCC to eventually build itself using multiple passes, we're forcing + # it to build with the host LLVM/clang toolchain in a single pass. + # It's not officially supported, but practically it worked. However, + # since >=gcc-12.2.0, in order to support the new embedded rpath + # feature on Darwin, two incompatible options, "-nodefaultrpaths" and + # "-nodefaultexport" are introduced. This causes linking failures, + # since these options are only recognized by GCC and are unknown to + # LLVM/clang (hypothetically, using an older GCC possibly causes the + # same problem as well). + # + # Thus, embedded rpath should be disabled during prefix bootstrap stage2 + # and passed into EXTRA_ECONF. + # https://bugs.gentoo.org/895334 + if [[ ${CHOST} == *-darwin* ]] ; + then + local disable_darwin_rpath="--disable-darwin-at-rpath" + else + local disable_darwin_rpath="" + fi for pkg in ${compiler_stage1} ; do # <glibc-2.5 does not understand .gnu.hash, use @@ -1880,13 +1935,15 @@ bootstrap_stage2() { # GCC apparently drops CPPFLAGS at some point, which makes it # not find things like gmp which we just installed, so force it # to find our prefix - EXTRA_ECONF="--disable-bootstrap $(rapx --with-linker-hash-style=both) --with-local-prefix=${ROOT}" \ + # For >=gcc-12.2.0, rpath needs to be disabled in stage2 on + # Darwin, see above. + EXTRA_ECONF="--disable-bootstrap $(rapx --with-linker-hash-style=both) --with-local-prefix=${ROOT} ${disable_darwin_rpath}" \ MYCMAKEARGS="-DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=OFF" \ GCC_MAKE_TARGET=all \ - OVERRIDE_CXXFLAGS="${CPPFLAGS} -O2 -pipe" \ + OVERRIDE_CXXFLAGS="${CPPFLAGS} ${OVERRIDE_CXXFLAGS}" \ TPREFIX="${ROOT}" \ - PYTHON_COMPAT_OVERRIDE=python${PYTHONMAJMIN} \ - emerge_pkgs --nodeps ${pkg} || return 1 + PYTHON_COMPAT_OVERRIDE=python$(python_ver) \ + emerge_pkgs --nodeps "${pkg}" || return 1 if [[ "${pkg}" == *sys-devel/llvm* || ${pkg} == *sys-devel/clang* ]] ; then @@ -1917,12 +1974,14 @@ bootstrap_stage2() { # multilib.eclass -- can't blame it at this point really) # do it ourselves here to make the bootstrap continue if [[ -x "${ROOT}"/tmp/usr/bin/${CHOST}-clang ]] ; then - ( cd "${ROOT}"/tmp/usr/bin && ln -s clang ${CHOST}-clang && ln -s clang++ ${CHOST}-clang++ ) + ( cd "${ROOT}"/tmp/usr/bin && \ + ln -s clang "${CHOST}-clang" && \ + ln -s clang++ "${CHOST}-clang++" ) fi elif ! is-rap ; then # make sure the EPREFIX gcc shared libraries are there - mkdir -p "${ROOT}"/usr/${CHOST}/lib/gcc - cp "${ROOT}"/tmp/usr/${CHOST}/lib/gcc/* "${ROOT}"/usr/${CHOST}/lib/gcc + mkdir -p "${ROOT}/usr/${CHOST}/lib/gcc" + cp "${ROOT}/tmp/usr/${CHOST}/lib/gcc"/* "${ROOT}/usr/${CHOST}/lib/gcc" fi estatus "stage2 finished" @@ -1930,18 +1989,41 @@ bootstrap_stage2() { } bootstrap_stage2_log() { - bootstrap_stage2 ${@} 2>&1 | tee -a ${ROOT}/stage2.log + { + echo "===== stage 2 -- $(date -u +%Y-%m-%dT%H:%M:%SZ) =====" + echo "CHOST: ${CHOST}" + echo "IDENT: ${CHOST_IDENTIFY}" + echo "===========================================" + } >> "${ROOT}"/stage2.log + bootstrap_stage2 "${@}" 2>&1 | tee -a "${ROOT}"/stage2.log local ret=${PIPESTATUS[0]} [[ ${ret} == 0 ]] && touch "${ROOT}/.stage2-finished" - return ${ret} + return "${ret}" } bootstrap_stage3() { + export PORTAGE_CONFIGROOT="${ROOT}" + + # We need the stage2 in PATH for bootstrapping. We rely on + # emerge running on some benign package before running anything + # that would rely on 98stage2 coming before 99host + mkdir -p "${ROOT}"/etc/env.d/ + cat > "${ROOT}"/etc/env.d/98stage2 <<-EOF + PATH="$(unset PATH; + source "${ROOT}"/tmp/etc/profile.env; + echo "$PATH")" + EOF + if ! type -P emerge > /dev/null ; then eerror "emerge not found, did you bootstrap stage1?" return 1 fi + # At this point, we should have a proper GCC, and don't need to + # rely on the system wrappers. Let's get rid of them, so that + # they stop mucking up builds. + rm -f "${ROOT}"/tmp/usr/local/bin/* + configure_toolchain || return 1 if [[ ${compiler_type} == clang ]] ; then @@ -1960,29 +2042,34 @@ bootstrap_stage3() { # tmp, we basically made the system unusable, so remove python-exec # here so we can use the python in tmp for pef in python{,3} python{,3}-config ; do - rm -f "${ROOT}"/tmp/usr/bin/${pef} + rm -f "${ROOT}/tmp/usr/bin/${pef}" [[ ${pef} == *-config ]] && ppf=-config || ppf= - ( cd "${ROOT}"/tmp/usr/bin && ln -s python${PYTHONMAJMIN}${ppf} ${pef} ) + ( cd "${ROOT}"/tmp/usr/bin && \ + ln -s "python$(python_ver)${ppf}" "${pef}" ) done get_libdir() { - local l=$(portageq envvar LIBDIR_$(portageq envvar ABI) 2>/dev/null) + local l + l="$(portageq envvar "LIBDIR_$(portageq envvar ABI)" 2>/dev/null)" [[ -z ${l} ]] && l=lib - echo ${l} + echo "${l}" } + # Remember: binutils-config and gcc were built in ROOT/tmp, so they + # are looking for includes and libraries under ROOT/tmp, *NOT* ROOT, + # therefore we need to export search paths for ROOT (the final + # destination Prefix) here until we've installed the toolchain export CONFIG_SHELL="${ROOT}"/tmp/bin/bash [[ ${compiler_type} == gcc ]] && \ export CPPFLAGS="-isystem ${ROOT}/usr/include" - export LDFLAGS="-L${ROOT}/usr/$(get_libdir)" + LDFLAGS="-L${ROOT}/usr/$(get_libdir)" ; export LDFLAGS [[ ${CHOST} == *-darwin* ]] || \ LDFLAGS+=" -Wl,-rpath=${ROOT}/usr/$(get_libdir)" unset CC CXX emerge_pkgs() { # stage3 tools should be used first. - # PORTAGE_TMPDIR, EMERGE_LOG_DIR, FEATURES=force-prefix are - # needed with host portage. + # PORTAGE_TMPDIR, EMERGE_LOG_DIR are needed with host portage. # # After the introduction of EAPI-7, eclasses now # strictly distinguish between build dependencies that @@ -1992,32 +2079,30 @@ bootstrap_stage3() { # PORTAGE_OVERRIDE_EPREFIX as BROOT is needed. PREROOTPATH="${ROOT}"$(echo /{,tmp/}{usr/,}{,lib/llvm/{12,11,10}/}{s,}bin | sed "s, ,:${ROOT},g") \ EPREFIX="${ROOT}" PORTAGE_TMPDIR="${PORTAGE_TMPDIR}" \ - FEATURES="${FEATURES} force-prefix" \ EMERGE_LOG_DIR="${ROOT}"/var/log \ STAGE=stage3 \ do_emerge_pkgs "$@" } - with_stack_emerge_pkgs() { - # keep FEATURES=stacked-prefix until we bump portage in stage1 - FEATURES="${FEATURES} stacked-prefix" \ - USE="${USE} prefix-stack" \ - PORTAGE_OVERRIDE_EPREFIX="${ROOT}/tmp" \ - emerge_pkgs "$@" - } - - without_stack_emerge_pkgs() { + # retained in case we *do* need this, but using this will cause + # packages installed end up in ROOT/tmp, which means we keep using + # stage2 area and config which breaks things like binutils-config' + # path search, so don't use this + #with_stack_emerge_pkgs() { + # # keep FEATURES=stacked-prefix until we bump portage in stage1 + # FEATURES="${FEATURES} stacked-prefix" \ + # USE="${USE} prefix-stack" \ + # PORTAGE_OVERRIDE_EPREFIX="${ROOT}/tmp" \ + # emerge_pkgs "$@" + #} + + # pre_emerge_pkgs relies on stage 2 portage, but installs into the + # final destination Prefix + pre_emerge_pkgs() { PORTAGE_OVERRIDE_EPREFIX="${ROOT}" \ emerge_pkgs "$@" } - # pre_emerge_pkgs relies on stage 2 portage. - pre_emerge_pkgs() { - is-rap \ - && without_stack_emerge_pkgs "$@" \ - || with_stack_emerge_pkgs "$@" - } - # Some packages fail to properly depend on sys-apps/texinfo. # We don't really need that package, so we fake it instead, # explicitly emerging it later on will overwrite the fakes. @@ -2035,6 +2120,10 @@ bootstrap_stage3() { cp -a "${ROOT}"{/tmp,}/usr/share/portage fi + local -a linker_pkgs compiler_pkgs + read -r -a linker_pkgs <<< "${linker}" + read -r -a compiler_pkgs <<< "${compiler}" + if is-rap ; then # We need ${ROOT}/usr/bin/perl to merge glibc. if [[ ! -x "${ROOT}"/usr/bin/perl ]]; then @@ -2064,11 +2153,12 @@ bootstrap_stage3() { # Tell dynamic loader the path of libgcc_s.so of stage2 if [[ ! -f "${ROOT}"/etc/ld.so.conf.d/stage2.conf ]]; then mkdir -p "${ROOT}"/etc/ld.so.conf.d - dirname $(gcc -print-libgcc-file-name) \ + dirname "$(gcc -print-libgcc-file-name)" \ > "${ROOT}"/etc/ld.so.conf.d/stage2.conf fi pkgs=( + sys-devel/gnuconfig sys-apps/baselayout sys-apps/gentoo-functions app-portage/elt-patches @@ -2083,20 +2173,30 @@ bootstrap_stage3() { grep -q 'esac' "${ROOT}"/usr/bin/rsync && \ rm "${ROOT}"/usr/bin/rsync + # sys-apps/baselayout will install a dummy openrc-run wrapper + # for any package that installs an init.d script, like rsync and + # python will need openrc-run to exist, else we'll die with a QA + # error, bug #858596. However it only does this for + # prefix-guest, so NOT For RAP, which results in bug #913856. + if [[ ! -x "${ROOT}"/sbin/openrc-run ]]; then + [[ -e "${ROOT}"/sbin ]] || mkdir -p "${ROOT}"/sbin + echo "We need openrc-run at ${ROOT}/sbin to merge some packages." \ + > "${ROOT}"/sbin/openrc-run + chmod +x "${ROOT}"/sbin/openrc-run + fi + pkgs=( sys-devel/binutils-config sys-libs/zlib - ${linker} + "${linker_pkgs[@]}" ) # use the new dynamic linker in place of rpath from now on. - RAP_DLINKER=$(echo "${ROOT}"/$(get_libdir)/ld*.so.[0-9] | sed s"!${ROOT}/$(get_libdir)/ld-lsb.*!!") - export LDFLAGS="-L${ROOT}/usr/$(get_libdir) -Wl,--dynamic-linker=${RAP_DLINKER}" - if [[ ${compiler_type} == gcc ]] ; then - # make sure these flags are used even in places that ignore/strip CPPFLAGS/LDFLAGS - export LDFLAGS="-B${ROOT}/usr/$(get_libdir) ${LDFLAGS}" - export CC="gcc ${CPPFLAGS} ${LDFLAGS}" - export CXX="g++ ${CPPFLAGS} ${LDFLAGS}" - fi + RAP_DLINKER=$(echo "${ROOT}/$(get_libdir)"/ld*.so.[0-9] | sed s"!${ROOT}/$(get_libdir)/ld-lsb.*!!") + export CPPFLAGS="--sysroot=${ROOT}" + export LDFLAGS="-Wl,--dynamic-linker=${RAP_DLINKER}" + # make sure these flags are used even in places that ignore/strip CPPFLAGS/LDFLAGS + export CC="gcc ${CPPFLAGS} ${LDFLAGS}" + export CXX="g++ ${CPPFLAGS} ${LDFLAGS}" BOOTSTRAP_RAP=yes \ pre_emerge_pkgs --nodeps "${pkgs[@]}" || return 1 @@ -2111,6 +2211,7 @@ bootstrap_stage3() { pre_emerge_pkgs --nodeps "${pkgs[@]}" || return 1 else pkgs=( + sys-devel/gnuconfig sys-apps/gentoo-functions app-portage/elt-patches app-arch/xz-utils @@ -2120,14 +2221,14 @@ bootstrap_stage3() { sys-devel/flex sys-devel/binutils-config sys-libs/zlib - ${linker} + "${linker_pkgs[@]}" ) pre_emerge_pkgs --nodeps "${pkgs[@]}" || return 1 fi # remove stage2 ld so that stage3 ld is used by stage2 gcc. is-rap && [[ -f ${ROOT}/tmp/usr/${CHOST}/bin/ld ]] && \ - mv ${ROOT}/tmp/usr/${CHOST}/bin/ld{,.stage2} + mv "${ROOT}/tmp/usr/${CHOST}/bin"/ld{,.stage2} # On some hosts, gcc gets confused now when it uses the new linker, # see for instance bug #575480. While we would like to hide that @@ -2140,16 +2241,16 @@ bootstrap_stage3() { # setup for a scenario where python doesn't live in the target # prefix and no helpers are available ( cd "${ROOT}"/usr/bin && test ! -e python && \ - ln -s "${ROOT}"/tmp/usr/bin/python${PYTHONMAJMIN} ) + ln -s "${ROOT}/tmp/usr/bin/python$(python_ver)" "python$(python_ver)" ) # in addition, avoid collisions - rm -Rf "${ROOT}"/tmp/usr/lib/python${PYTHONMAJMIN}/site-packages/clang + rm -Rf "${ROOT}/tmp/usr/lib/python$(python_ver)/site-packages/clang" # Try to get ourself out of the mud, bug #575324 EXTRA_ECONF="--disable-compiler-version-checks $(rapx '--disable-lto --disable-bootstrap')" \ - GCC_MAKE_TARGET=$(rapx all) \ + GCC_MAKE_TARGET="$(rapx all)" \ MYCMAKEARGS="-DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=OFF" \ - PYTHON_COMPAT_OVERRIDE=python${PYTHONMAJMIN} \ - pre_emerge_pkgs --nodeps ${compiler} || return 1 + PYTHON_COMPAT_OVERRIDE="python$(python_ver)" \ + pre_emerge_pkgs --nodeps "${compiler_pkgs[@]}" || return 1 # Undo libgcc_s.so path of stage2 # Now we have the compiler right there @@ -2160,14 +2261,14 @@ bootstrap_stage3() { # need special care, it depends on texinfo, #717786 pre_emerge_pkgs --nodeps sys-apps/gawk || return 1 - ( cd "${ROOT}"/usr/bin && test ! -e python && rm -f python${PYTHONMAJMIN} ) + ( cd "${ROOT}"/usr/bin && test ! -e python && rm -f "python$(python_ver)" ) # Use $ROOT tools where possible from now on. if [[ $(readlink "${ROOT}"/bin/sh) == "${ROOT}/tmp/"* ]] ; then rm -f "${ROOT}"/bin/sh ln -s bash "${ROOT}"/bin/sh fi - # Start using apps from new target + # Start using apps from the final destination Prefix export PREROOTPATH="${ROOT}/usr/bin:${ROOT}/bin" # Get a sane bash, overwriting tmp symlinks @@ -2183,10 +2284,9 @@ bootstrap_stage3() { app-arch/gzip app-arch/tar sys-apps/grep - sys-devel/make + dev-build/make sys-apps/file app-admin/eselect - $( [[ ${CHOST} == *-cygwin* ]] && echo sys-libs/cygwin-crypt ) ) # For grep we need to do a little workaround as we might use llvm-3.4 @@ -2196,19 +2296,13 @@ bootstrap_stage3() { TIME_T_32_BIT_OK=yes \ pre_emerge_pkgs "" "${pkgs[@]}" || return 1 - if [[ ! -x "${ROOT}"/sbin/openrc-run ]]; then - echo "We need openrc-run at ${ROOT}/sbin to merge rsync." \ - > "${ROOT}"/sbin/openrc-run - chmod +x "${ROOT}"/sbin/openrc-run - fi - pkgs=( virtual/os-headers sys-devel/gettext sys-apps/portage ) - without_stack_emerge_pkgs "" "${pkgs[@]}" || return 1 + pre_emerge_pkgs "" "${pkgs[@]}" || return 1 # Switch to the proper portage. hash -r @@ -2228,13 +2322,14 @@ bootstrap_stage3() { fi # Avoid installing git or encryption just for fun while completing @system - export USE="-git -crypt" + # e.g. bug #901101 + export USE="-git -crypt -http2" # Portage should figure out itself what it needs to do, if anything. - einfo "running emerge -uDNv system" - estatus "stage3: emerge -uDNv system" - unset CFLAGS CXXFLAGS CPPFLAGS - emerge --color n -uDNv system || return 1 + local eflags=( "--deep" "--update" "--changed-use" "@system" ) + einfo "running emerge ${eflags[*]}" + estatus "stage3: emerge ${eflags[*]}" + emerge --color n -v "${eflags[@]}" || return 1 # Remove anything that we don't need (compilers most likely) einfo "running emerge --depclean" @@ -2245,15 +2340,25 @@ bootstrap_stage3() { # (--depclean may fail, which is ok) sed -i -e 's/resume/cleared/' "${ROOT}"/var/cache/edb/mtimedb + # Remove the stage2 hack from above. A future emerge run will + # get env-update to happen. + rm "${ROOT}"/etc/env.d/98stage2 + estatus "stage3 finished" einfo "stage3 successfully finished" } bootstrap_stage3_log() { - bootstrap_stage3 ${@} 2>&1 | tee -a ${ROOT}/stage3.log + { + echo "===== stage 3 -- $(date -u +%Y-%m-%dT%H:%M:%SZ) =====" + echo "CHOST: ${CHOST}" + echo "IDENT: ${CHOST_IDENTIFY}" + echo "===========================================" + } >> "${ROOT}"/stage3.log + bootstrap_stage3 "${@}" 2>&1 | tee -a "${ROOT}"/stage3.log local ret=${PIPESTATUS[0]} [[ ${ret} == 0 ]] && touch "${ROOT}/.stage3-finished" - return ${ret} + return "${ret}" } set_helper_vars() { @@ -2267,9 +2372,8 @@ set_helper_vars() { DISTFILES_G_O="http://distfiles.prefix.bitzolder.nl" DISTFILES_PFX="http://distfiles.prefix.bitzolder.nl/prefix" GENTOO_MIRRORS=${GENTOO_MIRRORS:="http://distfiles.gentoo.org"} - SNAPSHOT_HOST=$(rapx ${DISTFILES_G_O} http://rsync.prefix.bitzolder.nl) + SNAPSHOT_HOST=$(rapx http://distfiles.gentoo.org http://rsync.prefix.bitzolder.nl) SNAPSHOT_URL=${SNAPSHOT_URL:-"${SNAPSHOT_HOST}/snapshots"} - GCC_APPLE_URL="http://www.opensource.apple.com/darwinsource/tarballs/other" export MAKE CONFIG_SHELL } @@ -2305,7 +2409,7 @@ bootstrap_interactive() { EOF [[ ${TODO} == 'noninteractive' ]] && ans=yes || - read -p "Do you want me to start off now? [Yn] " ans + read -r -p "Do you want me to start off now? [Yn] " ans case "${ans}" in [Yy][Ee][Ss]|[Yy]|"") : ;; @@ -2315,63 +2419,6 @@ EOF ;; esac - if [[ ${CHOST} == *-cygwin* ]]; then - if [[ -r /var/run/cygfork/. ]]; then - cat << EOF - -Whoah there, I've found the /var/run/cygfork/ directory. This makes -me believe you have a working fork() in your Cygwin instance, which -seems you really know what I can do for you when you help me out! -EOF - else - echo - [[ ${TODO} == 'noninteractive' ]] && ans="yes" || - read -p "Are you really, really sure what you want me to do for you? [no] " ans - case "${ans}" in - [Yy][Ee][Ss]) ;; - *) - cat << EOF - -Puh, I'm glad you agree with me here, thanks! -EOF - exit 1 - ;; - esac - - cat << EOF - -Well... -EOF - [[ ${TODO} == 'noninteractive' ]] || sleep 1 - cat << EOF - -Nope, seems you aren't: This is Windows after all, -which I'm traditionally incompatible with! -EOF - [[ ${TODO} == 'noninteractive' ]] || sleep 1 - cat << EOF - -But wait, there might be help! -EOF - [[ ${TODO} == 'noninteractive' ]] || sleep 1 - cat << EOF - -Once upon a time there was a guy, probably as freaky as you, my master. -And whether you believe or not, he has been able to do something useful -to Windows, in that he completed a piece of code to support myself. - -Although you already use that piece of code - yes, it's called Cygwin, -you seem to not use this freaky guy's completions yet. - -To help me out of the incompatibility hole, please read and follow -https://wiki.gentoo.org/wiki/Prefix/Cygwin first. - -But remember that you won't get support from upstream Cygwin now. -EOF - exit 1 - fi - fi - if [[ ${UID} == 0 ]] ; then cat << EOF @@ -2415,10 +2462,10 @@ EOF # note that this code is so complex because it handles both # C-shell as well as *sh dvar="echo \"((${flag}=\${${flag}}))\"" - dvar="$(echo "${dvar}" | env -i HOME=$HOME $SHELL -l 2>/dev/null)" + dvar="$(echo "${dvar}" | env -i HOME="${HOME}" "$SHELL" -l 2>/dev/null)" if [[ ${dvar} == *"((${flag}="?*"))" ]] ; then badflags="${badflags} ${flag}" - dvar=${dvar#*((${flag}=} + dvar=${dvar#*"((${flag}="} dvar=${dvar%%))*} echo " uh oh, ${flag}=${dvar} :(" else @@ -2500,10 +2547,6 @@ EOF [[ -e /Library/Developer/CommandLineTools/usr/bin/clang ]] \ && PATH="/Library/Developer/CommandLineTools/usr/bin:${PATH}" ;; - *-cygwin*) - # Keep some Windows - PATH+=":$(cygpath -S):$(cygpath -W)" - ;; esac # TODO: should we better use cc here? or check both? @@ -2573,7 +2616,7 @@ necessary to add to PATH for me to find a compiler. I start off with PATH=${PATH} and will add anything you give me here. EOF [[ ${TODO} == 'noninteractive' ]] && ans="${usergcc%/gcc}" || - read -p "Where can I find your compiler? [] " ans + read -r -p "Where can I find your compiler? [] " ans case "${ans}" in "") : ;; @@ -2602,7 +2645,7 @@ EOF if type -P xcode-select > /dev/null ; then if [[ -d /usr/include ]] ; then # if we have /usr/include we're on an older system - if [[ ${CHOST} == powerpc* ]]; then + if [[ ${CHOST} == *-darwin[89] ]]; then # ancient Xcode (3.0/3.1) cat << EOF @@ -2637,8 +2680,6 @@ EOF echo local ncpu= case "${CHOST}" in - *-cygwin*) - ncpu=$(cmd /D /Q /C 'echo %NUMBER_OF_PROCESSORS%' | tr -d "\\r") ;; *-darwin*) ncpu=$(/usr/sbin/sysctl -n hw.ncpu) ;; *-freebsd* | *-openbsd*) @@ -2646,18 +2687,15 @@ EOF *-solaris*) ncpu=$(/usr/sbin/psrinfo | wc -l) ;; *-linux-gnu*) - ncpu=$(cat /proc/cpuinfo | grep processor | wc -l) ;; + ncpu=$(grep -c processor /proc/cpuinfo) ;; *) ncpu=1 ;; esac # get rid of excess spaces (at least Solaris wc does) ncpu=$((ncpu + 0)) - # Suggest usage of 100% to 60% of the available CPUs in the range - # from 1 to 14. We limit to no more than 8, since we easily flood - # the bus on those heavy-core systems and only slow down in that - # case anyway. - local tcpu=$((ncpu / 2 + 1)) - [[ ${tcpu} -gt 8 ]] && tcpu=8 + # Suggest usage of 50% to 75% of the available CPUs + [[ ${tcpu} -eq 0 ]] && tcpu=1 + local tcpu=$((((ncpu * 3) + 1) / 4)) [[ -n ${USE_CPU_CORES} ]] && tcpu=${USE_CPU_CORES} cat << EOF @@ -2669,7 +2707,7 @@ clue what this means, you should go with my excellent default I've chosen below, really! EOF [[ ${TODO} == 'noninteractive' ]] && ans="" || - read -p "How many parallel make jobs do you want? [${tcpu}] " ans + read -r -p "How many parallel make jobs do you want? [${tcpu}] " ans case "${ans}" in "") MAKEOPTS="-j${tcpu}" @@ -2706,9 +2744,11 @@ EOF local candomultilib=no local t64 t32 case "${CHOST}" in - *86*-darwin9|*86*-darwin1[012345]) + *86*-darwin1[012345]) # PPC/Darwin only works in 32-bits mode, so this is Intel - # only, and only starting from Leopard (10.5, darwin9) + # only, and officially starting from Leopard (10.5, darwin9) + # but this is broken, so stick to 32-bits there, and use it + # from Snow Lepard (10.6). # with Big Sur (11.0, darwin20) we have x64 or arm64 only candomultilib=yes t64=x86_64-${CHOST#*-} @@ -2754,11 +2794,11 @@ EOF case "${CHOST}" in x86_64-*|sparcv9-*) # others can't do multilib, so don't bother # 64-bits native - read -p "How many bits do you want your Prefix to target? [64] " ans + read -r -p "How many bits do you want your Prefix to target? [64] " ans ;; *) # 32-bits native - read -p "How many bits do you want your Prefix to target? [32] " ans + read -r -p "How many bits do you want your Prefix to target? [32] " ans ;; esac case "${ans}" in @@ -2783,7 +2823,8 @@ EOF # Figure out if we are bootstrapping from an existing Gentoo # It can be forced by setting HOST_GENTOO_EROOT manually - local t_GENTOO_EROOT=$(env -u EPREFIX portageq envvar EROOT 2> /dev/null) + local t_GENTOO_EROOT + t_GENTOO_EROOT=$(env -u EPREFIX portageq envvar EROOT 2> /dev/null) if [[ ! -d ${HOST_GENTOO_EROOT} && -d ${t_GENTOO_EROOT} ]]; then cat <<EOF @@ -2792,7 +2833,7 @@ really a Gentoo lover, aren't you? Me too! By leveraging the existing portage, we can save a lot of time." EOF [[ ${TODO} == 'noninteractive' ]] && ans=no || - read -p " Do you want me to take the shortcut? [yN] " ans + read -r -p " Do you want me to take the shortcut? [yN] " ans case "${ans}" in [Yy][Ee][Ss]|[Yy]) echo "Good!" @@ -2823,7 +2864,7 @@ by default. Of course, you can still enable testing ~amd64 for the packages you want, when the need arises. EOF [[ ${TODO} == 'noninteractive' ]] && ans=yes || - read -p " Do you want to use stable Prefix? [Yn] " ans + read -r -p " Do you want to use stable Prefix? [Yn] " ans case "${ans}" in [Yy][Ee][Ss]|[Yy]|"") echo "Okay, I'll disable ~amd64 by default." @@ -2860,7 +2901,7 @@ EOF fi echo [[ ${TODO} == 'noninteractive' ]] && ans= || - read -p "What do you want EPREFIX to be? [$EPREFIX] " ans + read -r -p "What do you want EPREFIX to be? [$EPREFIX] " ans case "${ans}" in "") : ;; @@ -2884,8 +2925,10 @@ EOF continue fi #readlink -f would not work on darwin, so use bash builtins - local realEPREFIX="$(cd "$EPREFIX"; pwd -P)" - if [[ -z ${I_KNOW_MY_GCC_WORKS_FINE_WITH_SYMLINKS} && ${EPREFIX} != ${realEPREFIX} ]]; then + local realEPREFIX + realEPREFIX=$(cd "${EPREFIX}" && pwd -P) + if [[ -z ${I_KNOW_MY_GCC_WORKS_FINE_WITH_SYMLINKS} && \ + ${EPREFIX} != "${realEPREFIX}" ]]; then echo echo "$EPREFIX contains a symlink, which will make the merge of gcc" echo "imposible, use '${realEPREFIX}' instead or" @@ -2938,20 +2981,30 @@ OK! I'm going to give it a try, this is what I have collected sofar: I'm now going to make an awful lot of noise going through a sequence of stages to make your box as groovy as I am myself, setting up your Prefix. In short, I'm going to run stage1, stage2, stage3, followed by -emerge -e system. If any of these stages fail, both you and me are in -deep trouble. So let's hope that doesn't happen. +an emerge to do a final update to your system. If any of these stages +fail, both you and me are in deep trouble. So let's hope that doesn't +happen. EOF echo [[ ${TODO} == 'noninteractive' ]] && ans="" || - read -p "Type here what you want to wish me [luck] " ans + read -r -p "Type here what you want to wish me [luck] " ans if [[ -n ${ans} && ${ans} != "luck" ]] ; then echo "Huh? You're not serious, are you?" sleep 3 fi echo + # because we unset ROOT from environment above, and we didn't set + # ROOT as argument in the script, we set ROOT here to the EPREFIX we + # just harvested + ROOT="${EPREFIX}" + set_helper_vars + + # stop here if all we wanted was the env to be setup correctly + [[ -n ${SETUP_ENV_ONLY} ]] && return 0 + if [[ -d ${HOST_GENTOO_EROOT} ]]; then - if ! [[ -x ${EPREFIX}/tmp/usr/lib/portage/bin/emerge ]] && ! ${BASH} ${BASH_SOURCE[0]} "${EPREFIX}" stage_host_gentoo ; then + if ! [[ -x ${EPREFIX}/tmp/usr/lib/portage/bin/emerge ]] && ! ${BASH} "${BASH_SOURCE[0]}" "${EPREFIX}" stage_host_gentoo ; then # stage host gentoo fail cat << EOF @@ -2961,17 +3014,14 @@ but that failed :( I have no clue, really. Please find friendly folks in #gentoo-prefix on irc.gentoo.org, gentoo-alt@lists.gentoo.org mailing list, or file a bug at bugs.gentoo.org under Gentoo/Alt, Prefix Support. Sorry that I have failed you master. I shall now return to my humble cave. + + CHOST: ${CHOST} + IDENT: ${CHOST_IDENTIFY} EOF exit 1 fi fi - # because we unset ROOT from environment above, and we didn't set - # ROOT as argument in the script, we set ROOT here to the EPREFIX we - # just harvested - ROOT="${EPREFIX}" - set_helper_vars - if ! [[ -e ${EPREFIX}/.stage1-finished ]] && ! bootstrap_stage1_log ; then # stage 1 fail cat << EOF @@ -2983,6 +3033,9 @@ in #gentoo-prefix on irc.gentoo.org, gentoo-alt@lists.gentoo.org mailing list, or file a bug at bugs.gentoo.org under Gentoo/Alt, Prefix Support. Sorry that I have failed you master. I shall now return to my humble cave. You can find a log of what happened in ${EPREFIX}/stage1.log + + CHOST: ${CHOST} + IDENT: ${CHOST_IDENTIFY} EOF exit 1 fi @@ -2997,7 +3050,8 @@ EOF # This happens at least on 32-bits Darwin, with i386 and i686. # https://bugs.gentoo.org/show_bug.cgi?id=433948 unset CHOST - export CHOST=$(portageq envvar CHOST) + CHOST=$(portageq envvar CHOST) + export CHOST # after stage1 and stage2 we should have a bash of our own, which # is preferable over the host-provided one, because we know it can @@ -3006,7 +3060,7 @@ EOF local https_needed=no if ! [[ -e ${EPREFIX}/.stage2-finished ]] \ - && ! ${BASH} ${BASH_SOURCE[0]} "${EPREFIX}" stage2_log ; then + && ! ${BASH} "${BASH_SOURCE[0]}" "${EPREFIX}" stage2_log ; then # stage 2 fail cat << EOF @@ -3034,6 +3088,9 @@ I have no clue, really. Please find friendly folks in #gentoo-prefix on irc.gentoo.org, gentoo-alt@lists.gentoo.org mailing list, or file a bug at bugs.gentoo.org under Gentoo/Alt, Prefix Support. Remember you might find some clues in ${EPREFIX}/stage2.log + + CHOST: ${CHOST} + IDENT: ${CHOST_IDENTIFY} EOF exit 1 fi @@ -3044,7 +3101,7 @@ EOF hash -r if ! [[ -e ${EPREFIX}/.stage3-finished ]] \ - && ! bash ${BASH_SOURCE[0]} "${EPREFIX}" stage3_log ; then + && ! bash "${BASH_SOURCE[0]}" "${EPREFIX}" stage3_log ; then # stage 3 fail hash -r # previous cat (tmp/usr/bin/cat) may have been removed cat << EOF @@ -3074,13 +3131,16 @@ irc.gentoo.org, gentoo-alt@lists.gentoo.org mailing list, or file a bug at bugs.gentoo.org under Gentoo/Alt, Prefix Support. This is most inconvenient, and it crushed my ego. Sorry, I give up. Should you want to give it a try, there is ${EPREFIX}/stage3.log + + CHOST: ${CHOST} + IDENT: ${CHOST_IDENTIFY} EOF exit 1 fi [[ ${STOP_BOOTSTRAP_AFTER} == stage3 ]] && exit 0 - local cmd="emerge -v -e system" + local cmd="emerge -v --deep --update --changed-use @world" if [[ -e ${EPREFIX}/var/cache/edb/mtimedb ]] && \ grep -q resume "${EPREFIX}"/var/cache/edb/mtimedb ; then @@ -3088,7 +3148,7 @@ EOF fi einfo "running ${cmd}" if ${cmd} ; then - # Now, after 'emerge -e system', we can get rid of the temporary tools. + # Now, we've got everything in $ROOT, we can get rid of /tmp if [[ -d ${EPREFIX}/tmp/var/tmp ]] ; then rm -Rf "${EPREFIX}"/tmp || return 1 mkdir -p "${EPREFIX}"/tmp || return 1 @@ -3096,7 +3156,7 @@ EOF hash -r # tmp/* stuff is removed in stage3 else - # emerge -e system fail + # emerge @world fail cat << EOF Oh yeah, I thought I was almost there, and then this! I did @@ -3114,11 +3174,14 @@ irc.gentoo.org, gentoo-alt@lists.gentoo.org mailing list, or file a bug at bugs.gentoo.org under Gentoo/Alt, Prefix Support. You know, I got the feeling you just started to like me, but I guess that's all gone now. I'll bother you no longer. + + CHOST: ${CHOST} + IDENT: ${CHOST_IDENTIFY} EOF exit 1 fi - if ! bash ${BASH_SOURCE[0]} "${EPREFIX}" startscript ; then + if ! bash "${BASH_SOURCE[0]}" "${EPREFIX}" startscript ; then # startscript fail? cat << EOF @@ -3126,7 +3189,7 @@ Ok, let's be honest towards each other. If $(type -P bash) ${BASH_SOURCE[0]} "${EPREFIX}" startscript fails, then who cheated on who? Either you use an obscure shell, or your PATH isn't really sane afterall. Despite, I can't really -congratulate you here, you basically made it to the end. +congratulate you here, but you basically made it to the end. Please find friendly folks in #gentoo-prefix on irc.gentoo.org, gentoo-alt@lists.gentoo.org mailing list, or file a bug at bugs.gentoo.org under Gentoo/Alt, Prefix Support. @@ -3154,26 +3217,36 @@ unset TMP TMPDIR TEMP # Try to guess the CHOST if not set. We currently only support guessing # on a very sloppy base. if [[ -z ${CHOST} ]]; then - if [[ x$(type -t uname) == "xfile" ]]; then - case `uname -s` in + if [[ $(type -t uname) == "file" ]]; then + case $(uname -s) in Linux) - plt="gnu" - [[ -e /lib/ld-musl-*.so.1 ]] && plt="musl" - sfx="unknown-linux-${plt}" - case `uname -m` in - ppc*) - CHOST="`uname -m | sed -e 's/^ppc/powerpc/'`-${sfx}" - ;; - powerpc*|aarch64*) - CHOST="`uname -m`-${sfx}" - ;; + CHOST=$(uname -m) + CHOST=${CHOST/#ppc/powerpc} + case "${CHOST}" in + x86_64|i*86) + CHOST+=-pc ;; *) - CHOST="`uname -m`-${sfx/unknown/pc}" + CHOST+=-unknown ;; + esac + plt=gnu + for f in /lib/ld-musl-*.so.1; do + [[ -e $f ]] && plt=musl + done + CHOST+=-linux-${plt} + case "${CHOST}" in + arm*) + CHOST+=eabi + for f in /lib/ld-*hf.so.*; do + if [[ -e $f ]]; then + CHOST+=hf + break + fi + done ;; esac ;; Darwin) - rev="`uname -r | cut -d'.' -f 1`" + rev=$(uname -r | cut -d'.' -f 1) if [[ ${rev} -ge 11 && ${rev} -le 19 ]] ; then # Lion and up are 64-bits default (and 64-bits CPUs) CHOST="x86_64-apple-darwin$rev" @@ -3181,40 +3254,40 @@ if [[ -z ${CHOST} ]]; then # uname -p returns arm, -m returns arm64 on this # release while on Darwin 9 -m returns something # like "PowerPC Machine", hence the distinction - CHOST="`uname -m`-apple-darwin$rev" + CHOST="$(uname -m)-apple-darwin$rev" else - CHOST="`uname -p`-apple-darwin$rev" + CHOST="$(uname -p)-apple-darwin$rev" fi ;; SunOS) - case `uname -p` in + case $(uname -p) in i386) - CHOST="i386-pc-solaris`uname -r | sed 's|5|2|'`" + CHOST="i386-pc-solaris$(uname -r | sed 's|5|2|')" ;; sparc) - CHOST="sparc-sun-solaris`uname -r | sed 's|5|2|'`" + CHOST="sparc-sun-solaris$(uname -r | sed 's|5|2|')" ;; esac ;; CYGWIN*) - CHOST="`uname -m`-pc-cygwin" + CHOST="$(uname -m)-pc-cygwin" ;; FreeBSD) - case `uname -m` in + case $(uname -m) in amd64) - CHOST="x86_64-pc-freebsd`uname -r | sed 's|-.*$||'`" + CHOST="x86_64-pc-freebsd$(uname -r | sed 's|-.*$||')" ;; esac ;; OpenBSD) - case `uname -m` in + case $(uname -m) in amd64) - CHOST="x86_64-pc-openbsd`uname -r | sed 's|-.*$||'`" + CHOST="x86_64-pc-openbsd$(uname -r | sed 's|-.*$||')" ;; esac ;; *) - eerror "Nothing known about platform `uname -s`." + eerror "Nothing known about platform $(uname -s)." eerror "Please set CHOST appropriately for your system" eerror "and rerun $0" exit 1 @@ -3223,19 +3296,53 @@ if [[ -z ${CHOST} ]]; then fi fi +CHOST_IDENTIFY=${CHOST} +# massage CHOST on Linux systems +if [[ ${CHOST} == *-linux-* ]] ; then + # two choices here: x86_64_ubuntu16-linux-gnu + # x86_64-pc-linux-ubuntu16 + # I choose the latter because it is compatible with most + # UNIX vendors and it allows to fit RAP into platform + dist=$(lsb_release -si) + rel=$(lsb_release -sr) + if [[ -z ${dist} ]] || [[ -z ${rel} ]] ; then + source /etc/os-release # this may fail if the file isn't there + [[ -z ${dist} ]] && dist=${ID} + [[ -z ${dist} ]] && dist=${NAME} + [[ -z ${rel} ]] && rel=${VERSION_ID} + fi + [[ -z ${dist} ]] && dist=linux + + # Gentoo's versioning isn't really relevant, since it is + # a rolling distro + if [[ ${dist,,} == "gentoo" ]] ; then + rel= + [[ ${CHOST##*-} == "musl" ]] && rel="musl" + fi + + # leave rel unset/empty if we don't know about it + while [[ ${rel} == *.*.* ]] ; do + rel=${rel%.*} + done + + platform=${CHOST#*-}; platform=${platform%%-*} + platform=$(rapx rap "${platform}") + CHOST_IDENTIFY=${CHOST%%-*}-${platform}-linux-${dist,,}${rel} +fi + # Now based on the CHOST set some required variables. Doing it here # allows for user set CHOST still to result in the appropriate variables # being set. case ${CHOST} in *-*-solaris*) if type -P gmake > /dev/null ; then - MAKE=gmake + MAKE="gmake" else - MAKE=make + MAKE="make" fi ;; *) - MAKE=make + MAKE="make" ;; esac @@ -3310,7 +3417,15 @@ case $ROOT in chost.guess) # undocumented feature that sort of is our own config.guess, if # CHOST was unset, it now contains the guessed CHOST - echo "$CHOST" + echo "${CHOST}" + exit 0 + ;; + chost.identify) + # another undocumented feature, produces a pseudo CHOST that + # identifies the system for bootstraps, currently only Linux is + # different from CHOST + + echo "${CHOST_IDENTIFY}" exit 0 ;; /*) ;; @@ -3323,10 +3438,11 @@ esac einfo "Bootstrapping Gentoo prefixed portage installation using" einfo "host: ${CHOST}" +einfo "ident: ${CHOST_IDENTIFY}" einfo "prefix: ${ROOT}" TODO=${2} -if [[ ${TODO} != "noninteractive" && $(type -t bootstrap_${TODO}) != "function" ]]; +if [[ ${TODO} != "noninteractive" && $(type -t "bootstrap_${TODO}") != "function" ]]; then eerror "bootstrap target ${TODO} unknown" exit 1 @@ -3347,11 +3463,25 @@ if [[ -n ${PKG_CONFIG_PATH} ]] ; then fi einfo "ready to bootstrap ${TODO}" -# bootstrap_interactive proceeds with guessed defaults when TODO=noninteractive -bootstrap_${TODO#non} || exit 1 + +# When we call individual stages separately (e.g. not from +# bootstrap_interactive) we might need some env to be setup in order to +# function properly. Basically do a non-interactive call for each stage +# that will only set whatever needs to be set. +if [[ ${TODO} != "interactive" && ${TODO} != "noninteractive" ]] ; then + # squelch the output, we've seen it already when running from + # interactive proper + SETUP_ENV_ONLY=true TODO=noninteractive \ + bootstrap_interactive > /dev/null || exit 1 +fi + +# call the appropriate function, +# beware noninteractive is just a mode of interactive +bootstrap_"${TODO#non}" || exit 1 # Local Variables: -# sh-indentation: 8 -# sh-basic-offset: 8 +# sh-indentation: 4 +# sh-basic-offset: 4 # indent-tabs-mode: t # End: +# vim: set ts=4 sw=4 noexpandtab: diff --git a/scripts/rsync-generation/mksnapshot.sh b/scripts/rsync-generation/mksnapshot.sh index 5c13154cf2..4d45ef2727 100755 --- a/scripts/rsync-generation/mksnapshot.sh +++ b/scripts/rsync-generation/mksnapshot.sh @@ -4,78 +4,98 @@ SCRIPTLOC="$(readlink -f "${BASH_SOURCE[0]%/*}")" # for gpg's keys export HOME="${SCRIPTLOC}/misc" -cd /export/scratch/home/gentoo/snapshots +cd /export/gentoo-rsync/rsync0-prefix-tree/snapshots || exit 1 TODAY=$(date +%s) YESTERDAY=$((TODAY - 86400)) -RSYNCTREE=${PWD%/*}/prefix-rsync-tree +RSYNCTREE=${PWD%/*} SNAME=${PWD}/portage-$(date +%Y%m%d -d @${YESTERDAY}).tar -TMPDIR=${PWD%/*}/tmp-prefix-snapshot +TMPDIR=${PWD}/tmp-prefix-snapshot # clean up -find . -maxdepth 2 -daystart -ctime +4 -type f | xargs --no-run-if-empty rm +find . -maxdepth 2 -daystart -ctime +4 -type f -exec rm '{}' + -rm -Rf ${TMPDIR} -mkdir -p ${TMPDIR} +# pull in active snapshot +BOOTSTRAP_SNAPSHOT=$( \ + grep -A1 MKSNAPSHOT-ANCHOR "${RSYNCTREE}"/scripts/bootstrap-prefix.sh | \ + sed -n 's/^.*PV="\([0-9]\+\)"\s*$/portage-\1.tar.bz2/p' \ +) +if [[ ! -s "${BOOTSTRAP_SNAPSHOT}" ]] ; then + curl -s -L "https://distfiles.prefix.bitzolder.nl/prefix/distfiles/${BOOTSTRAP_SNAPSHOT}" > "${BOOTSTRAP_SNAPSHOT}" +fi + +rm -Rf "${TMPDIR}" +mkdir -p "${TMPDIR}" # quickly take a snapshot, such that we get a consistent image -pushd ${RSYNCTREE} > /dev/null -tar -cf ${SNAME} * -popd > /dev/null +pushd "${RSYNCTREE}" > /dev/null || exit 1 +tar -cf "${SNAME}" --exclude=snapshots -- * || exit 1 +popd > /dev/null || exit 1 # now revamp it such that it's in a directory "portage" -pushd ${TMPDIR} > /dev/null +rm -Rf "${TMPDIR}" +mkdir -p "${TMPDIR}" +pushd "${TMPDIR}" > /dev/null || exit 1 mkdir portage -tar -xf ${SNAME} -C portage/ -tar -cf ${SNAME} portage/ -popd > /dev/null +tar -xf "${SNAME}" -C portage/ +tar --numeric-owner --format=posix --hard-dereference -cf "${SNAME}" portage/ +popd > /dev/null || exit 1 + +rm -Rf "${TMPDIR}" + +# The differences in size (57/52/47MB) for bz2,zstd,lz are not really that +# big considering gzip's size (75MB) but the bootstrap-prefix script and +# the logic above rely on .bz2 snapshot, so in reality no other format +# than bzip2-compressed is necessary. Since bzip2 is available +# everywhere, or bootstrapped just fine for a long long time, stick with +# it, for it is good enough for its purpose here +COMPRS=( + "bz2:bzip2 -c -9" +# "lz:lzip -c -9" +# "zst:zstd -c -19" +) + +# produce compressed variants, use as much cpu as left on the system, do +# all in parallel +for compr in "${COMPRS[@]}" ; do + read -r -a args <<< "${compr#*:}" + nice -n19 "${args[@]}" "${SNAME}" > "${SNAME}.${compr%%:*}" & +done +wait -rm -Rf ${TMPDIR} +# generate accompanying meta files +for compr in "${COMPRS[@]}" ; do + compr=${compr%%:*} + md5sum "${SNAME##*/}" > "${SNAME}.${compr}.umd5sum" + md5sum "${SNAME##*/}.${compr}" > "${SNAME}.${compr}.md5sum" +done -# be nice, and this machine only has one CPU (so can't parallelise) -nice -n19 bzip2 -c -9 ${SNAME} > ${SNAME}.bz2 -nice -n19 xz -c -9 ${SNAME} > ${SNAME}.xz -nice -n19 gzip -c -9 ${SNAME} > ${SNAME}.gz +# create GPG detached signature, use passphrase-fd to pass password +gpgopts=( + "--quiet" + "--batch" + "--no-tty" + "--passphrase-fd" 0 + "--pinentry-mode" "loopback" + "--default-key" "C6317B3C" + "--detach-sign" + "--armor" +) +for compr in "${COMPRS[@]}" ; do + compr=${compr%%:*} + gpg "${gpgopts[@]}" -o "${SNAME}.${compr}.gpgsig" "${SNAME}.${compr}" \ + < "${SCRIPTLOC}"/autosigner.pwd +done -# generate accompanying meta files -md5sum ${SNAME##*/} > ${SNAME}.xz.umd5sum -md5sum ${SNAME##*/}.xz > ${SNAME}.xz.md5sum -md5sum ${SNAME##*/} > ${SNAME}.bz2.umd5sum -md5sum ${SNAME##*/}.bz2 > ${SNAME}.bz2.md5sum -md5sum ${SNAME##*/} > ${SNAME}.gz.umd5sum -md5sum ${SNAME##*/}.bz2 > ${SNAME}.gz.md5sum -# gpg is really stupid, or I am too stupid to find the right option -gpg --batch --no-tty --passphrase-fd 0 --default-key C6317B3C --detach-sign --armor -o ${SNAME}.xz.gpgsig ${SNAME}.xz < ${SCRIPTLOC}/autosigner.pwd -gpg --batch --no-tty --passphrase-fd 0 --default-key C6317B3C --detach-sign --armor -o ${SNAME}.bz2.gpgsig ${SNAME}.bz2 < ${SCRIPTLOC}/autosigner.pwd -gpg --batch --no-tty --passphrase-fd 0 --default-key C6317B3C --detach-sign --armor -o ${SNAME}.gz.gpgsig ${SNAME}.gz < ${SCRIPTLOC}/autosigner.pwd - -# we no longer need the tar -rm ${SNAME} +# we no longer need the (original/uncompressed) tar +rm "${SNAME}" # make convenience symlinks -for f in {xz,bz2,gz}{,.gpgsig,.md5sum,.umd5sum} ; do - rm portage-latest.tar.$f - ln -s ${SNAME##*/}.$f portage-latest.tar.$f +for compr in "${COMPRS[@]}" ; do + compr=${compr%%:*} + for f in "${compr}"{,.gpgsig,.md5sum,.umd5sum} ; do + rm "portage-latest.tar.${f}" + ln -s "${SNAME##*/}.${f}" "portage-latest.tar.${f}" + done done - -# darkside's delta code - -# FAILS and nobody cares! - -#YESTERDAY=$(date +%Y%m%d -d @${YESTERDAY}) -#TODAY=$(date +%Y%m%d -d @${TODAY}) -#cp portage-{${YESTERDAY},${TODAY}}.tar.bz2 /dev/shm/ -#SNAP_DIR=${PWD} -# -#cd /dev/shm -#bunzip2 portage* -# -#differ -f bdelta portage-{${YESTERDAY},${TODAY}}.tar \ -# ${SNAP_DIR}/deltas/snapshot-${YESTERDAY}-${TODAY}.patch -# -#bzip2 "${SNAP_DIR}/deltas/snapshot-${YESTERDAY}-${TODAY}.patch" -# -#rm -f portage* snapshot* - -# FAILS and nobody cares diff --git a/scripts/rsync-generation/push-rsync1.sh b/scripts/rsync-generation/push-rsync1.sh index fc15894ecd..c9df9a379d 100755 --- a/scripts/rsync-generation/push-rsync1.sh +++ b/scripts/rsync-generation/push-rsync1.sh @@ -1,25 +1,23 @@ #!/usr/bin/env bash -TRGDIR="rsync1.domain::rsync-push_module" +TRGDIR="/path/to/rsync0-prefix-tree" LOCALDIR="/path/to/master-rsync-tree" -# figure out what's currently the active rsync1 mirror -#active=$(ssh $TRGHOST "readlink $TRGDIR/rsync1") -#echo "($(date +"%F %R")) current active snapshot on rsync1: ${active}" - -#case $active in -# rsync1a) target=rsync1b ;; -# rsync1b) target=rsync1a ;; -# *) -# echo "don't know what the active rsync1 mirror is: '$active'" > /dev/stderr -# exit 1 -# ;; -#esac -echo "($(date +"%F %R")) will refresh and activate snapshot: ${target}" +echo "($(date +"%F %R")) will refresh snapshot" # synchronise the target -rsync -va --delete "${LOCALDIR}"/ ${TRGDIR}/ > /var/tmp/rsync-updates.log || exit 1 +rsync -vca --delete --exclude=snapshots/ \ + "${LOCALDIR}"/ ${TRGDIR}/ > /var/tmp/rsync-updates.log || exit 1 +PUBLICDIR= +case $(hostname) in + disabled) + PUBLICDIR="somehost::gentoo-portage-prefix-push" + ;; +esac # switch the active rsync1 mirror -echo "($(date +"%F %R")) rsync done, switching target now" -#ssh $TRGHOST "cd ${TRGDIR} && rm rsync1 && ln -s ${target} rsync1" +if [[ -n ${PUBLICDIR} ]] ; then + rsync -vca --delete "${TRGDIR}"/ "${PUBLICDIR}"/ +fi + +echo "($(date +"%F %R")) rsync done" diff --git a/scripts/rsync-generation/refresh-mirror.sh b/scripts/rsync-generation/refresh-mirror.sh index 072c82e171..cbcb677266 100755 --- a/scripts/rsync-generation/refresh-mirror.sh +++ b/scripts/rsync-generation/refresh-mirror.sh @@ -1,4 +1,8 @@ #!/bin/bash -l +#shellcheck disable=SC2009,SC2030,SC2031 +#SC2009: consider using pgrep instead of grepping ps output +#SC2030: modification of FD is local (to subshell) +#SC2031: FD was modified in subshell # invocation script meant to be launched from cron @@ -10,7 +14,7 @@ if [[ -f /tmp/rsync-master-busy ]] ; then # allow one run to be skipped quietly if [[ $((laststart + (40 * 60))) -lt ${now} ]] ; then echo "another rsync-master generation process is still busy" - type pstree > /dev/null && pstree -A -l -p $(head -n1 ${LOGFILE}) + type pstree > /dev/null && pstree -A -l -p "$(head -n1 ${LOGFILE})" ps -ef | grep '[r]efresh-mirror' tail ${LOGFILE} else @@ -22,16 +26,16 @@ if [[ -f /tmp/rsync-master-busy ]] ; then pid=$(head -n1 ${LOGFILE}) if [[ ${pid} -gt 0 ]] ; then echo "Killing stray/stuck processes" - pstree -A -l -c -p ${pid} | grep -o '[0-9]\+' | xargs kill + pstree -A -l -c -p "${pid}" | grep -o '[0-9]\+' | xargs kill rm /tmp/rsync-master-busy fi fi else - mv ${LOGFILE} ${LOGFILE%.log}-prev.log - cd "$(readlink -f "${BASH_SOURCE[0]%/*}")" + mv "${LOGFILE}" "${LOGFILE%.log}"-prev.log + cd "$(readlink -f "${BASH_SOURCE[0]%/*}")" || exit 1 touch /tmp/rsync-master-busy - echo $$ > ${LOGFILE} - echo "starting generation $(date)" >> ${LOGFILE} + echo $$ > "${LOGFILE}" + echo "starting generation $(date)" >> "${LOGFILE}" genandpush() { ./update-rsync-master.sh \ && ./push-rsync1.sh @@ -41,7 +45,7 @@ else } # get a free filedescriptor in FD exec {FD}>/tmp/rsync-master-busy - (((genandpush | tee -a "${LOGFILE}") {FD}>&1 1>&2 2>&${FD} \ + ( ( (genandpush | tee -a "${LOGFILE}") {FD}>&1 1>&2 2>&${FD} \ | tee -a "${LOGFILE}") 2> /dev/null) echo "generation done $(date)" >> ${LOGFILE} exec {FD}>&- diff --git a/scripts/rsync-generation/update-rsync-master.sh b/scripts/rsync-generation/update-rsync-master.sh index d2e72ffec6..b169a4a3f2 100755 --- a/scripts/rsync-generation/update-rsync-master.sh +++ b/scripts/rsync-generation/update-rsync-master.sh @@ -1,9 +1,12 @@ #!/usr/bin/env bash +#shellcheck disable=SC2016,SC2086 +#SC2016: expressions don't expand in single quotes -> purposely in sed +#SC2086: double quote to prevent word splitting -> exactly what we need w/ set SCRIPTSTARTTIME=$(date +%s) # get keys for ssh and signing -eval $(env SHELL=/bin/bash keychain -q --noask --eval) +eval "$(env SHELL=/bin/bash keychain -q --noask --eval)" BASE_PATH="$(readlink -f "${BASH_SOURCE[0]%/*}")" @@ -20,7 +23,6 @@ PORTAGE_BASE_PATH="${BASE_PATH}/prefix/usr/lib/portage/" PYTHONPATH="${PORTAGE_BASE_PATH}/pym" PORTAGE_CONFIGROOT="${BASE_PATH}/misc/config_root" PORTAGE_DEPCACHEDIR="${BASE_PATH}/depcache" -MANIFEST_CACHE="${BASE_PATH}/manifests" # for .cvsps and gnupg cache mainly HOME="${BASE_PATH}/misc" @@ -34,13 +36,24 @@ echo "(init) PATH=$PATH" #### ---- egencache settings ---- #### -EGENCACHE_OPTS="--jobs=$(nproc) --load-average=$(nproc) --tolerant --update-use-local-desc" +EGENCACHE_OPTS=( + "--jobs=$(nproc)" + "--load-average=$(nproc)" + "--tolerant" + "--update-use-local-desc" +) export PYTHONPATH PORTDIR PORTAGE_BASE_PATH PORTAGE_CONFIGROOT \ ROOT PORTAGE_TMPFS FEATURES HOME #### ---- git mtime helper ---- #### +update_git_tree() { + git reset -q --hard HEAD + git clean -dfq + git pull -q +} + apply_git_mtimes() { local from=$1 local to=$2 @@ -60,8 +73,8 @@ apply_git_mtimes() { git log --pretty=%ct --name-status --reverse "${from}..${to}" echo 999 # end marker to trigger the last block to be done } | \ - while read line ; do - case ${line} in + while read -r line ; do + case "${line}" in [0-9][0-9][0-9]*) if [[ ${ts} -gt 0 ]] ; then [[ ${#files[@]} == 0 ]] || \ @@ -72,11 +85,11 @@ apply_git_mtimes() { ;; [ACMT]*) set -- ${line} - files+=( $2 ) + files+=( "$2" ) ;; [R]*) set -- ${line} - files+=( $3 ) + files+=( "$3" ) ;; [D]*) set -- ${line} @@ -89,8 +102,8 @@ apply_git_mtimes() { # if the entire package was removed, touch the # category level metadata [[ -f ${f%/*}/metadata.xml ]] \ - && files+=( ${f%/*}/metadata.xml ) \ - || files+=( ${f%/*/*}/metadata.xml ) + && files+=( "${f%/*}"/metadata.xml ) \ + || files+=( "${f%/*/*}"/metadata.xml ) fi ;; esac @@ -106,9 +119,7 @@ GLOBALSTART=${START} echo "($(date +"%F %R")) updating DTDs" pushd "$DTDDIR" || exit 1 fromcommit=$(git log --pretty=format:'%H' -n1) -git checkout -q . -git clean -dfq -git pull -q +update_git_tree tocommit=$(git log --pretty=format:'%H' -n1) apply_git_mtimes "${fromcommit}" "${tocommit}" popd || exit 1 @@ -121,9 +132,7 @@ echo "($(date +"%F %R")) set date to $(< "${RSYNCDIR}"/metadata/dtd/timestamp.ch echo "($(date +"%F %R")) updating GLSAs" pushd "$GLSADIR" || exit 1 fromcommit=$(git log --pretty=format:'%H' -n1) -git checkout -q . -git clean -dfq -git pull -q +update_git_tree tocommit=$(git log --pretty=format:'%H' -n1) apply_git_mtimes "${fromcommit}" "${tocommit}" popd || exit 1 @@ -136,9 +145,7 @@ echo "($(date +"%F %R")) set date to $(< "${RSYNCDIR}"/metadata/glsa/timestamp.c echo "($(date +"%F %R")) updating news" pushd "$NEWSDIR" || exit 1 fromcommit=$(git log --pretty=format:'%H' -n1) -git checkout -q . -git clean -dfq -git pull -q +update_git_tree tocommit=$(git log --pretty=format:'%H' -n1) apply_git_mtimes "${fromcommit}" "${tocommit}" popd || exit 1 @@ -165,9 +172,7 @@ START=$(date +%s) echo "($(date +"%F %R")) updating the gx86 tree" pushd "${GENTOOX86DIR}" || exit 1 fromcommit=$(git log --pretty=format:'%H' -n1) -git checkout -q . -git clean -dfq -git pull -q +update_git_tree tocommit=$(git log --pretty=format:'%H' -n1) gx86tscommit=$(git log --pretty=format:'%H %ct %cI' -n1 "${tocommit}") apply_git_mtimes "${fromcommit}" "${tocommit}" @@ -193,9 +198,7 @@ START=$(date +%s) echo "($(date +"%F %R")) updating Prefix tree (Git image)" pushd "$PREFIXTREEDIR" || exit 1 fromcommit=$(git log --pretty=format:'%H' -n1) -git checkout -q . -git clean -dfq -git pull -q +update_git_tree tocommit=$(git log --pretty=format:'%H' -n1) pfxtscommit=$(git log --pretty=format:'%H %ct %cI' -n1 "${tocommit}") apply_git_mtimes "${fromcommit}" "${tocommit}" @@ -205,8 +208,8 @@ echo "($(date +"%F %R")) git image updated" echo "($(date +"%F %R")) rsync Prefix tree to rsync-master" for entry in scripts *-*/* ; do # copy it over - [[ -e ${RSYNCDIR}/${entry} ]] || mkdir -p "${RSYNCDIR}"/${entry} - rsync -v --delete -aC "${PREFIXTREEDIR}"/${entry}/ "${RSYNCDIR}"/${entry}/ + [[ -e ${RSYNCDIR}/${entry} ]] || mkdir -p "${RSYNCDIR}/${entry}" + rsync -v --delete -aC "${PREFIXTREEDIR}/${entry}"/ "${RSYNCDIR}/${entry}"/ done # we excluded the eclasses above, because we "overlay" them from gx86 @@ -234,7 +237,7 @@ START=$(date +%s) # generate the metadata echo "($(date +"%F %R")) generating metadata" dolog() { - echo $* + echo "$*" "$@" } dolog "${PORTAGE_BASE_PATH}/bin/egencache" --update --rsync \ @@ -251,7 +254,7 @@ sync-type = rsync sync-uri = rsync://dont-sync auto-sync = no ' \ - ${EGENCACHE_OPTS} \ + "${EGENCACHE_OPTS[@]}" \ || exit 5 STOP=$(date +%s) @@ -275,15 +278,18 @@ START=$(date +%s) echo "($(date +"%F %R")) signing Manifest" -# we will generate thick manifests, so ensure Portage knows that -sed -i -e '/^thin-manifests/s/true/false/' "${RSYNCDIR}"/metadata/layout.conf +# we will generate thick manifests, so ensure Portage knows that. +# add a "gentoo" alias for compatibility, bug #911543. +sed -e '/^thin-manifests/s/true/false/' \ + -e '$arepo-name = gentoo_prefix\naliases = gentoo' \ + -i "${RSYNCDIR}"/metadata/layout.conf # generate Thick Manifests # Signing is done with our snapshot signing key, and only on the top # level Manifest, for it covers indirectly the entire tree # remember, HOME is set to misc/ so .gnupg keychain lives there -cat "${BASE_PATH}"/autosigner.pwd | \ - qmanifest -g -p -s "0xC6317B3C" "${RSYNCDIR}" || \ +qmanifest -g -p -s "0xC6317B3C" "${RSYNCDIR}" \ + < "${BASE_PATH}"/autosigner.pwd || \ echo "Manifest generation and/or signing failed!" >> /dev/stderr echo "($(date +"%F %R")) Manifest signed" diff --git a/sys-apps/coreutils/Manifest b/sys-apps/coreutils/Manifest index b0fcebe2bb..ed372cdb6a 100644 --- a/sys-apps/coreutils/Manifest +++ b/sys-apps/coreutils/Manifest @@ -1,4 +1,5 @@ -DIST coreutils-8.28-cygwin-8.26-3.patch 36792 BLAKE2B f494be97595ff9532f57ca3d5386d185d813647fb07480dc1b22434fa5eecfa22acb6940b82cc733ae4448757e5f69cf2c7c746a5752409fe4aa11dd47482e63 SHA512 53d05262118a0063a0b3992b80dcda28256516da4d077a691117384ea808e5468488443d9c4b0e38a4d5148e5e721e733dcb0562dcf23a1370d4090251458951 -DIST coreutils-8.30-patches-01.tar.xz 5788 BLAKE2B a41511ce39ac570cb14b7f12d125eebef92217469a9490808719fa0665f5e5c0adb96fbd02c4bac4d280d1502295669575790a81dbc01afe2ca3a9d384cbefb0 SHA512 b1e1933637de4581d5f8c6ede4e80a012435d13f0cf5550a76ab5bbe9441e3c15ce19ef3f78a7ea3b8368d5e9a3bb17c1207c471d26171b59786f38adeba0454 -DIST coreutils-8.32.tar.xz 5547836 BLAKE2B 0ad99c176c19ec214fcfd0845523e5362f0151827707c759bd46c0fe8d2501c6ad1c29c5b71266f6525857bc0d56c472db0d7fe29953b6c65e2e6c76bdf3c515 SHA512 1c8f3584efd61b4b02e7ac5db8e103b63cfb2063432caaf1e64cb2dcc56d8c657d1133bbf10bd41468d6a1f31142e6caa81d16ae68fa3e6e84075c253613a145 -DIST coreutils-9.0.tar.xz 5612752 BLAKE2B 59617cd25fd4c70f51bfbef851bd83e73f9c9ba5c11eb539f7f75c0184d55832e004b28e9268fb8064db145cb071ead2b9c0c3346bc35a11934ffe1b15bf17ac SHA512 9be08212891dbf48e5b22e7689dc27dac50df4631ebf29313470b72b7921f0b2aa5242917d05587785358495ca56e3b21f5b3ca81043d53cab92354da6c53a03 +DIST coreutils-9.0_p20220409-patches-01.tar.xz 6244 BLAKE2B 8ca9855680719660782931467ec70095c826e66b9850890b8cf456963f8114f63940707386b97c766172d01e55e17b7db2aa1c329208a873a76e2293b29f565f SHA512 4b43c25832122d241f33e6b4eff24bc1fa045b9ca5af45a49d22ecb1fa282986c4e4a045ef24c34b3d94fd9a2247247c42c344261e3f464d881969e6f3351d3f +DIST coreutils-9.1.tar.xz 5712104 BLAKE2B f5654e4935535275615d44a56c071d1c0746af36cf4615fcc0a5a0d387af9c9023adac31f31a52e16b3d1105b9d4c0fb7ebff9b2862498849f867a866049dd6e SHA512 a6ee2c549140b189e8c1b35e119d4289ec27244ec0ed9da0ac55202f365a7e33778b1dc7c4e64d1669599ff81a8297fe4f5adbcc8a3a2f75c919a43cd4b9bdfa +DIST coreutils-9.1.tar.xz.sig 833 BLAKE2B e9627a066f3c67596feaa8d43d5785076230f440bacea84d8b5736e51a22787c2d5df1f3e2cd8523d01fb7b468933d3c17fce3cb1fbefef322a0e0d820b81842 SHA512 9f0766531afd4faa3e2c337730f61db55605cf06729e9c61f644594883732c2e0b1ddb0005b492be309c53e6f45b8ff875398163a48699d52517ea49e9bdbc91 +DIST coreutils-9.3.tar.xz 5808696 BLAKE2B 11502cd2dbeef150d0d4cece2546bf6b835941b94456c258f6058338f0477f22e68e88934d075b08fe51ee4d1c0c50cb23d8084ac06a457d6e8975f01643b1cd SHA512 242271f212a6860bdc6c8d7e5c4f85ce66c1b48ef781aca9daa56e0fe7c2b7809ef72b4392120219fe5b687637c83ce89ceef8bb35f6274f43f8f968a6901694 +DIST coreutils-9.3.tar.xz.sig 833 BLAKE2B c45ae10ff706907ae65d31228e432f7d6f34acbdb733bf521437d9e2fc75828a59da9d432d894a1ed8b7341f7e15d0e8d4e816e209c799b75c14d0ec055bfdf2 SHA512 522a2072f8ef940228ccdd856a4041c3c16b98e309168ccf2066fe7c1013685ba6cdea8a7317dfa1f4507b37ca016ecedaf54438d4a5007927b0e1a8fd223eb5 diff --git a/sys-apps/coreutils/coreutils-8.32.ebuild b/sys-apps/coreutils/coreutils-8.32.ebuild deleted file mode 100644 index 2e794c6590..0000000000 --- a/sys-apps/coreutils/coreutils-8.32.ebuild +++ /dev/null @@ -1,251 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI="6" - -PYTHON_COMPAT=( python3_{6,7,8,9} ) - -inherit eutils flag-o-matic python-any-r1 toolchain-funcs - -PATCH="${PN}-8.30-patches-01" -DESCRIPTION="Standard GNU utilities (chmod, cp, dd, ls, sort, tr, head, wc, who,...)" -HOMEPAGE="https://www.gnu.org/software/coreutils/" -SRC_URI="mirror://gnu/${PN}/${P}.tar.xz - !vanilla? ( - mirror://gentoo/${PATCH}.tar.xz - https://dev.gentoo.org/~polynomial-c/dist/${PATCH}.tar.xz - ) - elibc_Cygwin? ( - https://dev.gentoo.org/~grobian/distfiles/${PN}-8.28-cygwin-8.26-3.patch - ) -" - -LICENSE="GPL-3" -SLOT="0" -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" -IUSE="acl caps gmp hostname kill multicall nls selinux +split-usr static test userland_BSD vanilla xattr" -RESTRICT="!test? ( test )" - -LIB_DEPEND="acl? ( sys-apps/acl[static-libs] ) - caps? ( sys-libs/libcap ) - gmp? ( dev-libs/gmp:=[static-libs] ) - xattr? ( !userland_BSD? ( sys-apps/attr[static-libs] ) )" -RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs]} ) - selinux? ( sys-libs/libselinux ) - nls? ( virtual/libintl )" -DEPEND="${RDEPEND} - static? ( ${LIB_DEPEND} ) - app-arch/xz-utils - test? ( - dev-lang/perl - dev-perl/Expect - !userland_BSD? ( - dev-util/strace - ) - ${PYTHON_DEPS} - $(python_gen_any_dep 'dev-python/pyinotify[${PYTHON_USEDEP}]') - )" -RDEPEND+=" - hostname? ( !sys-apps/net-tools[hostname] ) - kill? ( - !sys-apps/util-linux[kill] - !sys-process/procps[kill] - ) - !app-misc/realpath - !<sys-apps/util-linux-2.13 - !<sys-apps/sandbox-2.10-r4 - !sys-apps/stat - !net-mail/base64 - !sys-apps/mktemp - !<app-forensics/tct-1.18-r1 - !<net-fs/netatalk-2.0.3-r4" - -pkg_setup() { - if use test ; then - python-any-r1_pkg_setup - fi -} - -src_prepare() { - local PATCHES=( - "${FILESDIR}"/coreutils-8.32-ls-restore-8.31-behavior.patch - ) - - if ! use vanilla ; then - PATCHES+=( "${WORKDIR}"/patch ) - PATCHES+=( "${FILESDIR}"/${PN}-8.32-sandbox-env-test.patch ) - fi - - if use elibc_Cygwin ; then - PATCHES+=( "${DISTDIR}"/${PN}-8.28-cygwin-8.26-3.patch ) - fi - - default - - # fixup libstdbuf non-libtool stuff - if [[ ${CHOST} == *-darwin* ]] ; then - if [[ ${CHOST} == *-darwin9* ]] ; then - # we need replacement libs from libcoreutils.a here in order - # to finish the linking - sed -i \ - -e "/src_libstdbuf_so_LDADD/s:$: lib/libcoreutils.a:" \ - Makefile.in \ - || die - # and we need serial building :( - export MAKEOPTS+=" -j1" - fi - sed -i \ - -e "/src_libstdbuf_so_LDFLAGS = -shared/s:-shared:-dynamiclib -install_name ${EPREFIX}/usr/libexec/coreutils/libstdbuf.dylib:" \ - Makefile.in \ - || die - elif use elibc_Cygwin ; then - sed -i -e 's|\(libstdbuf\.so\)$(EXEEXT)|\1|g' Makefile.in || die - fi - sed -i \ - -e "s/libstdbuf\\.so/libstdbuf$(get_libname)/" \ - src/stdbuf.c \ - Makefile.in \ - configure \ - || die - - # Since we've patched many .c files, the make process will try to - # re-build the manpages by running `./bin --help`. When doing a - # cross-compile, we can't do that since 'bin' isn't a native bin. - # Also, it's not like we changed the usage on any of these things, - # so let's just update the timestamps and skip the help2man step. - set -- man/*.x - touch ${@/%x/1} - - # Avoid perl dep for compiled in dircolors default #348642 - if ! has_version dev-lang/perl ; then - touch src/dircolors.h - touch ${@/%x/1} - fi -} - -src_configure() { - local myconf=( - --with-packager="Gentoo" - --with-packager-version="${PVR} (p${PATCH_VER:-0})" - --with-packager-bug-reports="https://bugs.gentoo.org/" - --enable-install-program="arch,$(usev hostname),$(usev kill)" - --enable-no-install-program="groups,$(usev !hostname),$(usev !kill),su,uptime" - --enable-largefile - $(usex caps '' --disable-libcap) - $(use_enable nls) - $(use_enable acl) - $(use_enable multicall single-binary) - $(use_enable xattr) - $(use_with gmp) - ) - if tc-is-cross-compiler && [[ ${CHOST} == *linux* ]] ; then - export fu_cv_sys_stat_statfs2_bsize=yes #311569 - export gl_cv_func_realpath_works=yes #416629 - fi - - export gl_cv_func_mknod_works=yes #409919 - use static && append-ldflags -static && sed -i '/elf_sys=yes/s:yes:no:' configure #321821 - use selinux || export ac_cv_{header_selinux_{context,flash,selinux}_h,search_setfilecon}=no #301782 - use userland_BSD && myconf+=( -program-prefix=g --program-transform-name=s/stat/nustat/ ) - # kill/uptime - procps - # groups/su - shadow - # hostname - net-tools - econf "${myconf[@]}" -} - -src_test() { - # Known to fail with FEATURES=usersandbox (bug #439574): - # - tests/du/long-from-unreadable.sh} (bug #413621) - # - tests/rm/deep-2.sh (bug #413621) - # - tests/dd/no-allocate.sh (bug #629660) - if has usersandbox ${FEATURES} ; then - ewarn "You are emerging ${P} with 'usersandbox' enabled." \ - "Expect some test failures or emerge with 'FEATURES=-usersandbox'!" - fi - - # Non-root tests will fail if the full path isn't - # accessible to non-root users - chmod -R go-w "${WORKDIR}" - chmod a+rx "${WORKDIR}" - - # coreutils tests like to do `mount` and such with temp dirs - # so make sure /etc/mtab is writable #265725 - # make sure /dev/loop* can be mounted #269758 - mkdir -p "${T}"/mount-wrappers || die - mkwrap() { - local w ww - for w in "${@}" ; do - ww="${T}/mount-wrappers/${w}" - cat <<-EOF > "${ww}" - #!${EPREFIX}/bin/sh - exec env SANDBOX_WRITE="\${SANDBOX_WRITE}:/etc/mtab:/dev/loop" $(type -P ${w}) "\$@" - EOF - chmod a+rx "${ww}" - done - } - mkwrap mount umount - - addwrite /dev/full - #export RUN_EXPENSIVE_TESTS="yes" - #export FETISH_GROUPS="portage wheel" - env PATH="${T}/mount-wrappers:${PATH}" \ - emake -j1 -k check -} - -src_install() { - default - - insinto /etc - newins src/dircolors.hin DIR_COLORS - - if [[ ${USERLAND} == "GNU" ]] ; then - cd "${ED%/}"/usr/bin || die - dodir /bin - # move critical binaries into /bin (required by FHS) - local fhs="cat chgrp chmod chown cp date dd df echo false ln ls - mkdir mknod mv pwd rm rmdir stty sync true uname" - mv ${fhs} ../../bin/ || die "could not move fhs bins" - if use hostname; then - mv hostname ../../bin/ || die - fi - if use kill; then - mv kill ../../bin/ || die - fi - if use split-usr ; then - # move critical binaries into /bin (common scripts) - local com="basename chroot cut dir dirname du env expr head mkfifo - mktemp readlink seq sleep sort tail touch tr tty vdir wc yes" - mv ${com} ../../bin/ || die "could not move common bins" - # create a symlink for uname in /usr/bin/ since autotools require it - local x - for x in ${com} uname ; do - dosym ../../bin/${x} /usr/bin/${x} - done - fi - else - # For now, drop the man pages, collides with the ones of the system. - rm -rf "${ED%/}"/usr/share/man - fi - - if use elibc_Cygwin ; then - ! use kill || mv "${ED}"/bin/{,g}kill || die - mv "${ED}"/usr/libexec/${PN}/libstdbuf$(get_libname){.exe,} || die - fi -} - -pkg_postinst() { - ewarn "Make sure you run 'hash -r' in your active shells." - ewarn "You should also re-source your shell settings for LS_COLORS" - ewarn " changes, such as: source /etc/profile" - - # Help out users using experimental filesystems - if grep -qs btrfs "${EROOT%/}"/etc/fstab /proc/mounts ; then - case $(uname -r) in - 2.6.[12][0-9]|2.6.3[0-7]*) - ewarn "You are running a system with a buggy btrfs driver." - ewarn "Please upgrade your kernel to avoid silent corruption." - ewarn "See: https://bugs.gentoo.org/353907" - ;; - esac - fi -} diff --git a/sys-apps/coreutils/coreutils-9.0-r2.ebuild b/sys-apps/coreutils/coreutils-9.1-r2.ebuild index 1774109986..cee3a316af 100644 --- a/sys-apps/coreutils/coreutils-9.0-r2.ebuild +++ b/sys-apps/coreutils/coreutils-9.1-r2.ebuild @@ -1,50 +1,64 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 -PYTHON_COMPAT=( python3_{8,9,10} ) +# Try to keep an eye on Fedora's packaging: https://src.fedoraproject.org/rpms/coreutils +# The upstream coreutils maintainers also maintain the package in Fedora and may +# backport fixes which we want to pick up. -inherit eutils flag-o-matic python-any-r1 toolchain-funcs +PYTHON_COMPAT=( python3_{9..11} ) +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/coreutils.asc +inherit flag-o-matic python-any-r1 toolchain-funcs verify-sig -PATCH="${PN}-8.30-patches-01" +MY_PATCH="${PN}-9.0_p20220409-patches-01" DESCRIPTION="Standard GNU utilities (chmod, cp, dd, ls, sort, tr, head, wc, who,...)" HOMEPAGE="https://www.gnu.org/software/coreutils/" -SRC_URI="mirror://gnu/${PN}/${P}.tar.xz - !vanilla? ( - mirror://gentoo/${PATCH}.tar.xz - https://dev.gentoo.org/~polynomial-c/dist/${PATCH}.tar.xz - ) - elibc_Cygwin? ( - https://dev.gentoo.org/~grobian/distfiles/${PN}-8.28-cygwin-8.26-3.patch - ) -" -LICENSE="GPL-3" +if [[ ${PV} == *_p* ]] ; then + # Note: could put this in devspace, but if it's gone, we don't want + # it in tree anyway. It's just for testing. + MY_SNAPSHOT="$(ver_cut 1-2).193-54bec" + SRC_URI="https://www.pixelbeat.org/cu/coreutils-${MY_SNAPSHOT}.tar.xz -> ${P}.tar.xz" + SRC_URI+=" verify-sig? ( https://www.pixelbeat.org/cu/coreutils-${MY_SNAPSHOT}.tar.xz.sig -> ${P}.tar.xz.sig )" + S="${WORKDIR}"/${PN}-${MY_SNAPSHOT} +else + SRC_URI="mirror://gnu/${PN}/${P}.tar.xz + verify-sig? ( mirror://gnu/${PN}/${P}.tar.xz.sig )" + + KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" +fi + +SRC_URI+=" !vanilla? ( https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${MY_PATCH}.tar.xz )" + +LICENSE="GPL-3+" SLOT="0" -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" -IUSE="acl caps gmp hostname kill multicall nls selinux +split-usr static test userland_BSD vanilla xattr" +IUSE="acl caps gmp hostname kill multicall nls +openssl selinux +split-usr static test vanilla xattr" RESTRICT="!test? ( test )" LIB_DEPEND="acl? ( sys-apps/acl[static-libs] ) caps? ( sys-libs/libcap ) gmp? ( dev-libs/gmp:=[static-libs] ) - xattr? ( !userland_BSD? ( sys-apps/attr[static-libs] ) )" + openssl? ( dev-libs/openssl:=[static-libs] ) + xattr? ( sys-apps/attr[static-libs] )" RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs]} ) selinux? ( sys-libs/libselinux ) nls? ( virtual/libintl )" -DEPEND="${RDEPEND} +DEPEND=" + ${RDEPEND} static? ( ${LIB_DEPEND} ) +" +BDEPEND=" app-arch/xz-utils + dev-lang/perl test? ( dev-lang/perl dev-perl/Expect - !userland_BSD? ( - dev-util/strace - ) + dev-util/strace ${PYTHON_DEPS} - $(python_gen_any_dep 'dev-python/pyinotify[${PYTHON_USEDEP}]') - )" + ) + verify-sig? ( sec-keys/openpgp-keys-coreutils ) +" RDEPEND+=" hostname? ( !sys-apps/net-tools[hostname] ) kill? ( @@ -66,18 +80,23 @@ pkg_setup() { fi } +src_unpack() { + if use verify-sig ; then + # Needed for downloaded patch (which is unsigned, which is fine) + verify-sig_verify_detached "${DISTDIR}"/${P}.tar.xz{,.sig} + fi + + default +} + src_prepare() { local PATCHES=( - "${FILESDIR}"/${P}-fix-chmod-symlink-exit.patch + # Upstream patches + "${FILESDIR}"/${P}-fix-rename-simple-backups.patch ) if ! use vanilla ; then PATCHES+=( "${WORKDIR}"/patch ) - PATCHES+=( "${FILESDIR}"/${PN}-8.32-sandbox-env-test.patch ) - fi - - if use elibc_Cygwin ; then - PATCHES+=( "${DISTDIR}"/${PN}-8.28-cygwin-8.26-3.patch ) fi default @@ -98,28 +117,28 @@ src_prepare() { -e "/src_libstdbuf_so_LDFLAGS = -shared/s:-shared:-dynamiclib -install_name ${EPREFIX}/usr/libexec/coreutils/libstdbuf.dylib:" \ Makefile.in \ || die - elif use elibc_Cygwin ; then - sed -i -e 's|\(libstdbuf\.so\)$(EXEEXT)|\1|g' Makefile.in || die + + sed -i \ + -e "s/libstdbuf\\.so/libstdbuf$(get_libname)/" \ + src/stdbuf.c \ + Makefile.in \ + configure \ + || die fi - sed -i \ - -e "s/libstdbuf\\.so/libstdbuf$(get_libname)/" \ - src/stdbuf.c \ - Makefile.in \ - configure \ - || die # Since we've patched many .c files, the make process will try to # re-build the manpages by running `./bin --help`. When doing a # cross-compile, we can't do that since 'bin' isn't a native bin. + # # Also, it's not like we changed the usage on any of these things, # so let's just update the timestamps and skip the help2man step. set -- man/*.x - touch ${@/%x/1} + touch ${@/%x/1} || die - # Avoid perl dep for compiled in dircolors default #348642 + # Avoid perl dep for compiled in dircolors default (bug #348642) if ! has_version dev-lang/perl ; then - touch src/dircolors.h - touch ${@/%x/1} + touch src/dircolors.h || die + touch ${@/%x/1} || die fi } @@ -128,6 +147,9 @@ src_configure() { --with-packager="Gentoo" --with-packager-version="${PVR} (p${PATCH_VER:-0})" --with-packager-bug-reports="https://bugs.gentoo.org/" + # kill/uptime - procps + # groups/su - shadow + # hostname - net-tools --enable-install-program="arch,$(usev hostname),$(usev kill)" --enable-no-install-program="groups,$(usev !hostname),$(usev !kill),su,uptime" --enable-largefile @@ -137,19 +159,34 @@ src_configure() { $(use_enable multicall single-binary) $(use_enable xattr) $(use_with gmp libgmp) + $(use_with openssl) ) + + if use gmp ; then + myconf+=( --with-libgmp-prefix="${ESYSROOT}"/usr ) + fi + if tc-is-cross-compiler && [[ ${CHOST} == *linux* ]] ; then - export fu_cv_sys_stat_statfs2_bsize=yes #311569 - export gl_cv_func_realpath_works=yes #416629 + # bug #311569 + export fu_cv_sys_stat_statfs2_bsize=yes + # bug #416629 + export gl_cv_func_realpath_works=yes + fi + + # bug #409919 + export gl_cv_func_mknod_works=yes + + if use static ; then + append-ldflags -static + # bug #321821 + sed -i '/elf_sys=yes/s:yes:no:' configure || die + fi + + if ! use selinux ; then + # bug #301782 + export ac_cv_{header_selinux_{context,flash,selinux}_h,search_setfilecon}=no fi - export gl_cv_func_mknod_works=yes #409919 - use static && append-ldflags -static && sed -i '/elf_sys=yes/s:yes:no:' configure #321821 - use selinux || export ac_cv_{header_selinux_{context,flash,selinux}_h,search_setfilecon}=no #301782 - use userland_BSD && myconf+=( -program-prefix=g --program-transform-name=s/stat/nustat/ ) - # kill/uptime - procps - # groups/su - shadow - # hostname - net-tools econf "${myconf[@]}" } @@ -165,12 +202,13 @@ src_test() { # Non-root tests will fail if the full path isn't # accessible to non-root users - chmod -R go-w "${WORKDIR}" - chmod a+rx "${WORKDIR}" + chmod -R go-w "${WORKDIR}" || die + chmod a+rx "${WORKDIR}" || die - # coreutils tests like to do `mount` and such with temp dirs - # so make sure /etc/mtab is writable #265725 - # make sure /dev/loop* can be mounted #269758 + # coreutils tests like to do `mount` and such with temp dirs, + # so make sure: + # - /etc/mtab is writable (bug #265725) + # - /dev/loop* can be mounted (bug #269758) mkdir -p "${T}"/mount-wrappers || die mkwrap() { local w ww @@ -180,7 +218,7 @@ src_test() { #!${EPREFIX}/bin/sh exec env SANDBOX_WRITE="\${SANDBOX_WRITE}:/etc/mtab:/dev/loop" $(type -P ${w}) "\$@" EOF - chmod a+rx "${ww}" + chmod a+rx "${ww}" || die done } mkwrap mount umount @@ -188,8 +226,7 @@ src_test() { addwrite /dev/full #export RUN_EXPENSIVE_TESTS="yes" #export FETISH_GROUPS="portage wheel" - env PATH="${T}/mount-wrappers:${PATH}" \ - emake -j1 -k check + env PATH="${T}/mount-wrappers:${PATH}" emake -k check VERBOSE=yes } src_install() { @@ -198,38 +235,37 @@ src_install() { insinto /etc newins src/dircolors.hin DIR_COLORS - if [[ ${USERLAND} == "GNU" ]] ; then - cd "${ED%/}"/usr/bin || die + if use split-usr ; then + cd "${ED}"/usr/bin || die dodir /bin - # move critical binaries into /bin (required by FHS) + + # Move critical binaries into /bin (required by FHS) local fhs="cat chgrp chmod chown cp date dd df echo false ln ls mkdir mknod mv pwd rm rmdir stty sync true uname" - mv ${fhs} ../../bin/ || die "could not move fhs bins" - if use hostname; then + mv ${fhs} ../../bin/ || die "Could not move FHS bins!" + + if use hostname ; then mv hostname ../../bin/ || die fi - if use kill; then + + if use kill ; then mv kill ../../bin/ || die fi - if use split-usr ; then - # move critical binaries into /bin (common scripts) - local com="basename chroot cut dir dirname du env expr head mkfifo - mktemp readlink seq sleep sort tail touch tr tty vdir wc yes" - mv ${com} ../../bin/ || die "could not move common bins" - # create a symlink for uname in /usr/bin/ since autotools require it - local x - for x in ${com} uname ; do - dosym ../../bin/${x} /usr/bin/${x} - done - fi - else - # For now, drop the man pages, collides with the ones of the system. - rm -rf "${ED%/}"/usr/share/man - fi - if use elibc_Cygwin ; then - ! use kill || mv "${ED}"/bin/{,g}kill || die - mv "${ED}"/usr/libexec/${PN}/libstdbuf$(get_libname){.exe,} || die + # Move critical binaries into /bin (common scripts) + # (Why are these required for booting?) + local com="basename chroot cut dir dirname du env expr head mkfifo + mktemp readlink seq sleep sort tail touch tr tty vdir wc yes" + mv ${com} ../../bin/ || die "Could not move common bins!" + + # Create a symlink for uname in /usr/bin/ since autotools require it. + # (Other than uname, we need to figure out why we are + # creating symlinks for these in /usr/bin instead of leaving + # the files there in the first place...) + local x + for x in ${com} uname ; do + dosym ../../bin/${x} /usr/bin/${x} + done fi } @@ -237,15 +273,4 @@ pkg_postinst() { ewarn "Make sure you run 'hash -r' in your active shells." ewarn "You should also re-source your shell settings for LS_COLORS" ewarn " changes, such as: source /etc/profile" - - # Help out users using experimental filesystems - if grep -qs btrfs "${EROOT%/}"/etc/fstab /proc/mounts ; then - case $(uname -r) in - 2.6.[12][0-9]|2.6.3[0-7]*) - ewarn "You are running a system with a buggy btrfs driver." - ewarn "Please upgrade your kernel to avoid silent corruption." - ewarn "See: https://bugs.gentoo.org/353907" - ;; - esac - fi } diff --git a/sys-apps/coreutils/coreutils-9.3-r1.ebuild b/sys-apps/coreutils/coreutils-9.3-r1.ebuild new file mode 100644 index 0000000000..5d5a7adc57 --- /dev/null +++ b/sys-apps/coreutils/coreutils-9.3-r1.ebuild @@ -0,0 +1,294 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +# Try to keep an eye on Fedora's packaging: https://src.fedoraproject.org/rpms/coreutils +# The upstream coreutils maintainers also maintain the package in Fedora and may +# backport fixes which we want to pick up. +# +# Also recommend subscribing to the coreutils and bug-coreutils MLs. + +PYTHON_COMPAT=( python3_{9..11} ) +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/coreutils.asc +inherit flag-o-matic python-any-r1 toolchain-funcs verify-sig + +MY_PATCH="${PN}-9.0_p20220409-patches-01" +DESCRIPTION="Standard GNU utilities (chmod, cp, dd, ls, sort, tr, head, wc, who,...)" +HOMEPAGE="https://www.gnu.org/software/coreutils/" + +if [[ ${PV} == 9999 ]] ; then + EGIT_REPO_URI="https://git.savannah.gnu.org/git/coreutils.git" + inherit git-r3 +elif [[ ${PV} == *_p* ]] ; then + # Note: could put this in devspace, but if it's gone, we don't want + # it in tree anyway. It's just for testing. + MY_SNAPSHOT="$(ver_cut 1-2).18-ffd62" + SRC_URI="https://www.pixelbeat.org/cu/coreutils-${MY_SNAPSHOT}.tar.xz -> ${P}.tar.xz" + SRC_URI+=" verify-sig? ( https://www.pixelbeat.org/cu/coreutils-${MY_SNAPSHOT}.tar.xz.sig -> ${P}.tar.xz.sig )" + S="${WORKDIR}"/${PN}-${MY_SNAPSHOT} +else + SRC_URI=" + mirror://gnu/${PN}/${P}.tar.xz + verify-sig? ( mirror://gnu/${PN}/${P}.tar.xz.sig ) + " + + KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" +fi + +SRC_URI+=" !vanilla? ( https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${MY_PATCH}.tar.xz )" + +LICENSE="GPL-3+" +SLOT="0" +IUSE="acl caps gmp hostname kill multicall nls +openssl selinux +split-usr static test vanilla xattr" +RESTRICT="!test? ( test )" + +LIB_DEPEND=" + acl? ( sys-apps/acl[static-libs] ) + caps? ( sys-libs/libcap ) + gmp? ( dev-libs/gmp:=[static-libs] ) + openssl? ( dev-libs/openssl:=[static-libs] ) + xattr? ( sys-apps/attr[static-libs] ) +" +RDEPEND=" + !static? ( ${LIB_DEPEND//\[static-libs]} ) + selinux? ( sys-libs/libselinux ) + nls? ( virtual/libintl ) +" +DEPEND=" + ${RDEPEND} + static? ( ${LIB_DEPEND} ) +" +BDEPEND=" + app-arch/xz-utils + dev-lang/perl + test? ( + dev-lang/perl + dev-perl/Expect + dev-util/strace + ${PYTHON_DEPS} + ) + verify-sig? ( sec-keys/openpgp-keys-coreutils ) +" +RDEPEND+=" + hostname? ( !sys-apps/net-tools[hostname] ) + kill? ( + !sys-apps/util-linux[kill] + !sys-process/procps[kill] + ) + !app-misc/realpath + !<sys-apps/util-linux-2.13 + !<sys-apps/sandbox-2.10-r4 + !sys-apps/stat + !net-mail/base64 + !sys-apps/mktemp + !<app-forensics/tct-1.18-r1 + !<net-fs/netatalk-2.0.3-r4" + +pkg_setup() { + if use test ; then + python-any-r1_pkg_setup + fi +} + +src_unpack() { + if [[ ${PV} == 9999 ]] ; then + git-r3_src_unpack + + cd "${S}" || die + ./bootstrap || die + + sed -i -e "s:submodule-checks ?= no-submodule-changes public-submodule-commit:submodule-checks ?= no-submodule-changes:" gnulib/top/maint.mk || die + elif use verify-sig ; then + # Needed for downloaded patch (which is unsigned, which is fine) + verify-sig_verify_detached "${DISTDIR}"/${P}.tar.xz{,.sig} + fi + + default +} + +src_prepare() { + local PATCHES=( + # Upstream patches + "${FILESDIR}"/${P}-cp-parents-preserve-permissions.patch + ) + + if ! use vanilla && [[ -d "${WORKDIR}"/patch ]] ; then + PATCHES+=( "${WORKDIR}"/patch ) + fi + + default + + # fixup libstdbuf non-libtool stuff + if [[ ${CHOST} == *-darwin* ]] ; then + # we need replacement libs from libcoreutils.a here in order + # to finish the linking (they try to avoid this, but it doesn't + # during bootstrap, a re-install is fine though) + sed -i \ + -e "/src_libstdbuf_so_LDADD/s:$: lib/libcoreutils.a:" \ + Makefile.in \ + || die + # and we need serial building :( + export MAKEOPTS+=" -j1" + # set a proper install_name + sed -i \ + -e "/src_libstdbuf_so_LDFLAGS = -shared/s:-shared:-dynamiclib -install_name ${EPREFIX}/usr/libexec/coreutils/libstdbuf.dylib:" \ + Makefile.in \ + || die + + sed -i \ + -e "s/libstdbuf\\.so/libstdbuf$(get_libname)/" \ + src/stdbuf.c \ + Makefile.in \ + configure \ + || die + fi + + # Since we've patched many .c files, the make process will try to + # re-build the manpages by running `./bin --help`. When doing a + # cross-compile, we can't do that since 'bin' isn't a native bin. + # + # Also, it's not like we changed the usage on any of these things, + # so let's just update the timestamps and skip the help2man step. + set -- man/*.x + touch ${@/%x/1} || die + + # Avoid perl dep for compiled in dircolors default (bug #348642) + if ! has_version dev-lang/perl ; then + touch src/dircolors.h || die + touch ${@/%x/1} || die + fi +} + +src_configure() { + local myconf=( + --with-packager="Gentoo" + --with-packager-version="${PVR} (p${PATCH_VER:-0})" + --with-packager-bug-reports="https://bugs.gentoo.org/" + # kill/uptime - procps + # groups/su - shadow + # hostname - net-tools + --enable-install-program="arch,$(usev hostname),$(usev kill)" + --enable-no-install-program="groups,$(usev !hostname),$(usev !kill),su,uptime" + $(usex caps '' --disable-libcap) + $(use_enable nls) + $(use_enable acl) + $(use_enable multicall single-binary) + $(use_enable xattr) + $(use_with gmp libgmp) + $(use_with openssl) + ) + + if use gmp ; then + myconf+=( --with-libgmp-prefix="${ESYSROOT}"/usr ) + fi + + if tc-is-cross-compiler && [[ ${CHOST} == *linux* ]] ; then + # bug #311569 + export fu_cv_sys_stat_statfs2_bsize=yes + # bug #416629 + export gl_cv_func_realpath_works=yes + fi + + # bug #409919 + export gl_cv_func_mknod_works=yes + + if use static ; then + append-ldflags -static + # bug #321821 + sed -i '/elf_sys=yes/s:yes:no:' configure || die + fi + + if ! use selinux ; then + # bug #301782 + export ac_cv_{header_selinux_{context,flash,selinux}_h,search_setfilecon}=no + fi + + econf "${myconf[@]}" +} + +src_test() { + # Known to fail with FEATURES=usersandbox (bug #439574): + # - tests/du/long-from-unreadable.sh} (bug #413621) + # - tests/rm/deep-2.sh (bug #413621) + # - tests/dd/no-allocate.sh (bug #629660) + if has usersandbox ${FEATURES} ; then + ewarn "You are emerging ${P} with 'usersandbox' enabled." \ + "Expect some test failures or emerge with 'FEATURES=-usersandbox'!" + fi + + # Non-root tests will fail if the full path isn't + # accessible to non-root users + chmod -R go-w "${WORKDIR}" || die + chmod a+rx "${WORKDIR}" || die + + # coreutils tests like to do `mount` and such with temp dirs, + # so make sure: + # - /etc/mtab is writable (bug #265725) + # - /dev/loop* can be mounted (bug #269758) + mkdir -p "${T}"/mount-wrappers || die + mkwrap() { + local w ww + for w in "${@}" ; do + ww="${T}/mount-wrappers/${w}" + cat <<-EOF > "${ww}" + #!${EPREFIX}/bin/sh + exec env SANDBOX_WRITE="\${SANDBOX_WRITE}:/etc/mtab:/dev/loop" $(type -P ${w}) "\$@" + EOF + chmod a+rx "${ww}" || die + done + } + mkwrap mount umount + + addwrite /dev/full + #export RUN_EXPENSIVE_TESTS="yes" + #export FETISH_GROUPS="portage wheel" + env PATH="${T}/mount-wrappers:${PATH}" gl_public_submodule_commit= \ + emake -k check VERBOSE=yes +} + +src_install() { + default + + insinto /etc + newins src/dircolors.hin DIR_COLORS + + if use split-usr ; then + cd "${ED}"/usr/bin || die + dodir /bin + + # Move critical binaries into /bin (required by FHS) + local fhs="cat chgrp chmod chown cp date dd df echo false ln ls + mkdir mknod mv pwd rm rmdir stty sync true uname" + mv ${fhs} ../../bin/ || die "Could not move FHS bins!" + + if use hostname ; then + mv hostname ../../bin/ || die + fi + + if use kill ; then + mv kill ../../bin/ || die + fi + + # Move critical binaries into /bin (common scripts) + # (Why are these required for booting?) + local com="basename chroot cut dir dirname du env expr head mkfifo + mktemp readlink seq sleep sort tail touch tr tty vdir wc yes" + mv ${com} ../../bin/ || die "Could not move common bins!" + + # Create a symlink for uname in /usr/bin/ since autotools require it. + # (Other than uname, we need to figure out why we are + # creating symlinks for these in /usr/bin instead of leaving + # the files there in the first place...) + local x + for x in ${com} uname ; do + dosym ../../bin/${x} /usr/bin/${x} + done + fi +} + +pkg_postinst() { + ewarn "Make sure you run 'hash -r' in your active shells." + ewarn "You should also re-source your shell settings for LS_COLORS" + ewarn " changes, such as: source /etc/profile" +} diff --git a/sys-apps/coreutils/files/coreutils-8.32-ls-restore-8.31-behavior.patch b/sys-apps/coreutils/files/coreutils-8.32-ls-restore-8.31-behavior.patch deleted file mode 100644 index 62a35cd85a..0000000000 --- a/sys-apps/coreutils/files/coreutils-8.32-ls-restore-8.31-behavior.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 10fcb97bd728f09d4a027eddf8ad2900f0819b0a Mon Sep 17 00:00:00 2001 -From: Paul Eggert <eggert@cs.ucla.edu> -Date: Thu, 5 Mar 2020 17:25:29 -0800 -Subject: ls: restore 8.31 behavior on removed directories - -* src/ls.c: Do not include <sys/sycall.h> -(print_dir): Don't worry about whether the directory is removed. -* tests/ls/removed-directory.sh: Adjust to match new (i.e., old) -behavior. - -diff --git a/src/ls.c b/src/ls.c -index 24b983287..4acf5f44d 100644 ---- a/src/ls.c -+++ b/src/ls.c -@@ -49,10 +49,6 @@ - # include <sys/ptem.h> - #endif - --#ifdef __linux__ --# include <sys/syscall.h> --#endif -- - #include <stdio.h> - #include <assert.h> - #include <setjmp.h> -@@ -2896,7 +2892,6 @@ print_dir (char const *name, char const *realname, bool command_line_arg) - struct dirent *next; - uintmax_t total_blocks = 0; - static bool first = true; -- bool found_any_entries = false; - - errno = 0; - dirp = opendir (name); -@@ -2972,7 +2967,6 @@ print_dir (char const *name, char const *realname, bool command_line_arg) - next = readdir (dirp); - if (next) - { -- found_any_entries = true; - if (! file_ignored (next->d_name)) - { - enum filetype type = unknown; -@@ -3018,22 +3012,6 @@ print_dir (char const *name, char const *realname, bool command_line_arg) - if (errno != EOVERFLOW) - break; - } --#ifdef __linux__ -- else if (! found_any_entries) -- { -- /* If readdir finds no directory entries at all, not even "." or -- "..", then double check that the directory exists. */ -- if (syscall (SYS_getdents, dirfd (dirp), NULL, 0) == -1 -- && errno != EINVAL) -- { -- /* We exclude EINVAL as that pertains to buffer handling, -- and we've passed NULL as the buffer for simplicity. -- ENOENT is returned if appropriate before buffer handling. */ -- file_failure (command_line_arg, _("reading directory %s"), name); -- } -- break; -- } --#endif - else - break; - -diff --git a/tests/ls/removed-directory.sh b/tests/ls/removed-directory.sh -index e8c835dab..fe8f929a1 100755 ---- a/tests/ls/removed-directory.sh -+++ b/tests/ls/removed-directory.sh -@@ -26,20 +26,14 @@ case $host_triplet in - *) skip_ 'non linux kernel' ;; - esac - --LS_FAILURE=2 -- --cat <<\EOF >exp-err || framework_failure_ --ls: reading directory '.': No such file or directory --EOF -- - cwd=$(pwd) - mkdir d || framework_failure_ - cd d || framework_failure_ - rmdir ../d || framework_failure_ - --returns_ $LS_FAILURE ls >../out 2>../err || fail=1 -+ls >../out 2>../err || fail=1 - cd "$cwd" || framework_failure_ - compare /dev/null out || fail=1 --compare exp-err err || fail=1 -+compare /dev/null err || fail=1 - - Exit $fail --- -cgit v1.2.1 - diff --git a/sys-apps/coreutils/files/coreutils-8.32-sandbox-env-test.patch b/sys-apps/coreutils/files/coreutils-8.32-sandbox-env-test.patch deleted file mode 100644 index 40b1554d94..0000000000 --- a/sys-apps/coreutils/files/coreutils-8.32-sandbox-env-test.patch +++ /dev/null @@ -1,64 +0,0 @@ -Skip tests known to fail when running under Gentoo sandbox. - ---- a/tests/du/long-from-unreadable.sh -+++ b/tests/du/long-from-unreadable.sh -@@ -29,6 +29,9 @@ - # unnecessarily to using FTS_NOCHDIR mode in this corner case. - - . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src -+# Avoid #413621 until #548250 is resolved -+test -n "$SANDBOX_ACTIVE" && skip_ "Gentoo: Test known bad under sandbox (#413621)" -+ - print_ver_ du - - require_perl_ ---- a/tests/ls/removed-directory.sh -+++ b/tests/ls/removed-directory.sh -@@ -19,6 +19,9 @@ - # along with this program. If not, see <https://www.gnu.org/licenses/>. - - . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src -+# Avoid #413621 until #548250 is resolved -+test -n "$SANDBOX_ACTIVE" && skip_ "Gentoo: Test known bad under sandbox (#413621)" -+ - print_ver_ ls - - case $host_triplet in ---- a/tests/ls/stat-free-symlinks.sh -+++ b/tests/ls/stat-free-symlinks.sh -@@ -17,6 +17,9 @@ - # along with this program. If not, see <https://www.gnu.org/licenses/>. - - . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src -+# Avoid #413621 until #548250 is resolved -+test -n "$SANDBOX_ACTIVE" && skip_ "Gentoo: Test known bad under sandbox (#413621)" -+ - print_ver_ ls - require_strace_ stat - ---- a/tests/misc/env-S.pl -+++ b/tests/misc/env-S.pl -@@ -30,6 +30,11 @@ $env = $1; - # Turn off localization of executable's output. - @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; - -+# Skip if sandbox is enabled -+if ($ENV{SANDBOX_ACTIVE}) { -+ CuSkip::skip "Gentoo: Test known bad under sandbox (#675802)\n"; -+} -+ - my @Tests = - ( - # Test combination of -S and regular arguments ---- a/tests/rm/deep-2.sh -+++ b/tests/rm/deep-2.sh -@@ -17,6 +17,9 @@ - # along with this program. If not, see <https://www.gnu.org/licenses/>. - - . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src -+# Avoid #413621 until #548250 is resolved -+test -n "$SANDBOX_ACTIVE" && skip_ "Gentoo: Test known bad under sandbox (#413621)" -+ - print_ver_ rm - require_perl_ - diff --git a/sys-apps/coreutils/files/coreutils-9.0-fix-chmod-symlink-exit.patch b/sys-apps/coreutils/files/coreutils-9.0-fix-chmod-symlink-exit.patch deleted file mode 100644 index 25b2b72bcb..0000000000 --- a/sys-apps/coreutils/files/coreutils-9.0-fix-chmod-symlink-exit.patch +++ /dev/null @@ -1,35 +0,0 @@ -https://git.savannah.gnu.org/cgit/coreutils.git/patch/?id=e8b56ebd536e82b15542a00c888109471936bfda -https://lists.gnu.org/archive/html/bug-coreutils/2021-09/msg00031.html -(and https://lists.gnu.org/archive/html/bug-coreutils/2021-09/msg00035.html) - -From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com> -Date: Fri, 24 Sep 2021 20:57:41 +0100 -Subject: chmod: fix exit status when ignoring symlinks - -* src/chmod.c: Reorder enum so CH_NOT_APPLIED -can be treated as a non error. -* tests/chmod/ignore-symlink.sh: A new test. -* tests/local.mk: Reference the new test. -* NEWS: Mention the bug fix. -Fixes https://bugs.gnu.org/50784 ---- a/src/chmod.c -+++ b/src/chmod.c -@@ -44,8 +44,8 @@ struct change_status - enum - { - CH_NO_STAT, -- CH_NOT_APPLIED, - CH_FAILED, -+ CH_NOT_APPLIED, - CH_NO_CHANGE_REQUESTED, - CH_SUCCEEDED - } -@@ -322,7 +322,7 @@ process_file (FTS *fts, FTSENT *ent) - if ( ! recurse) - fts_set (fts, ent, FTS_SKIP); - -- return CH_NO_CHANGE_REQUESTED <= ch.status; -+ return CH_NOT_APPLIED <= ch.status; - } - - /* Recursively change the modes of the specified FILES (the last entry diff --git a/sys-apps/coreutils/files/coreutils-9.1-fix-rename-simple-backups.patch b/sys-apps/coreutils/files/coreutils-9.1-fix-rename-simple-backups.patch new file mode 100644 index 0000000000..33b5f391ab --- /dev/null +++ b/sys-apps/coreutils/files/coreutils-9.1-fix-rename-simple-backups.patch @@ -0,0 +1,38 @@ +https://src.fedoraproject.org/rpms/coreutils/raw/f672fec4364e71c6e5a30d4026d6bdb7cf332eed/f/gnulib-simple-backup-fix.patch +https://bugs.gnu.org/55029 + +commit 7347caeb9d902d3fca2c11f69a55a3e578d93bfe +Author: Paul Eggert <eggert@cs.ucla.edu> +Date: Wed Apr 20 19:34:57 2022 -0700 + + backupfile: fix bug when renaming simple backups + + * lib/backupfile.c (backupfile_internal): Fix bug when RENAME + and when doing simple backups. Problem reported by Steve Ward in: + https://bugs.gnu.org/55029 + +--- a/lib/backupfile.c ++++ b/lib/backupfile.c +@@ -332,7 +332,7 @@ backupfile_internal (int dir_fd, char const *file, + return s; + + DIR *dirp = NULL; +- int sdir = AT_FDCWD; ++ int sdir = dir_fd; + idx_t base_max = 0; + while (true) + { +@@ -371,10 +371,9 @@ backupfile_internal (int dir_fd, char const *file, + if (! rename) + break; + +- int olddirfd = sdir < 0 ? dir_fd : sdir; +- idx_t offset = sdir < 0 ? 0 : base_offset; ++ idx_t offset = backup_type == simple_backups ? 0 : base_offset; + unsigned flags = backup_type == simple_backups ? 0 : RENAME_NOREPLACE; +- if (renameatu (olddirfd, file + offset, sdir, s + offset, flags) == 0) ++ if (renameatu (sdir, file + offset, sdir, s + offset, flags) == 0) + break; + int e = errno; + if (! (e == EEXIST && extended)) + diff --git a/sys-apps/coreutils/files/coreutils-9.3-cp-parents-preserve-permissions.patch b/sys-apps/coreutils/files/coreutils-9.3-cp-parents-preserve-permissions.patch new file mode 100644 index 0000000000..c8f2a9bb49 --- /dev/null +++ b/sys-apps/coreutils/files/coreutils-9.3-cp-parents-preserve-permissions.patch @@ -0,0 +1,86 @@ +https://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=c6b1fe43474b48a6bf5793e11cc1d0d6e895fdf4 + +From c6b1fe43474b48a6bf5793e11cc1d0d6e895fdf4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com> +Date: Wed, 3 May 2023 17:01:37 +0100 +Subject: cp: -p --parents: fix failure to preserve permissions for absolute + paths + +* src/cp.c (re_protect): Ensure copy_acl() is passed an absolute path. +* tests/cp/cp-parents.sh: Add a test case. +* NEWS: Mention the bug. +Fixes https://bugs.gnu.org/63245 +--- a/src/cp.c ++++ b/src/cp.c +@@ -296,15 +296,19 @@ regular file.\n\ + when done. */ + + static bool +-re_protect (char const *const_dst_name, int dst_dirfd, char const *dst_relname, ++re_protect (char const *const_dst_name, int dst_dirfd, char const *dst_fullname, + struct dir_attr *attr_list, const struct cp_options *x) + { + struct dir_attr *p; + char *dst_name; /* A copy of CONST_DST_NAME we can change. */ +- char *src_name; /* The source name in 'dst_name'. */ ++ char *src_name; /* The relative source name in 'dst_name'. */ ++ char *full_src_name; /* The full source name in 'dst_name'. */ + + ASSIGN_STRDUPA (dst_name, const_dst_name); +- src_name = dst_name + (dst_relname - const_dst_name); ++ full_src_name = dst_name + (dst_fullname - const_dst_name); ++ src_name = full_src_name; ++ while (*src_name == '/') ++ src_name++; + + for (p = attr_list; p; p = p->next) + { +@@ -347,7 +351,7 @@ re_protect (char const *const_dst_name, int dst_dirfd, char const *dst_relname, + + if (x->preserve_mode) + { +- if (copy_acl (src_name, -1, dst_name, -1, p->st.st_mode) != 0) ++ if (copy_acl (full_src_name, -1, dst_name, -1, p->st.st_mode) != 0) + return false; + } + else if (p->restore_mode) +@@ -687,6 +691,7 @@ do_copy (int n_files, char **file, char const *target_directory, + bool parent_exists = true; /* True if dir_name (dst_name) exists. */ + struct dir_attr *attr_list; + char *arg_in_concat = NULL; ++ char *full_arg_in_concat = NULL; + char *arg = file[i]; + + /* Trailing slashes are meaningful (i.e., maybe worth preserving) +@@ -719,6 +724,7 @@ do_copy (int n_files, char **file, char const *target_directory, + (x->verbose ? "%s -> %s\n" : NULL), + &attr_list, &new_dst, x)); + ++ full_arg_in_concat = arg_in_concat; + while (*arg_in_concat == '/') + arg_in_concat++; + } +@@ -747,7 +753,7 @@ do_copy (int n_files, char **file, char const *target_directory, + new_dst, x, ©_into_self, NULL); + + if (parents_option) +- ok &= re_protect (dst_name, target_dirfd, arg_in_concat, ++ ok &= re_protect (dst_name, target_dirfd, full_arg_in_concat, + attr_list, x); + } + +--- a/tests/cp/cp-parents.sh ++++ b/tests/cp/cp-parents.sh +@@ -66,4 +66,10 @@ p=$(ls -ld g/sym/b/c|cut -b-10); case $p in drwxr-xr-x);; *) fail=1;; esac + cp --parents --no-preserve=mode np/b/file np_dest/ || fail=1 + p=$(ls -ld np_dest/np|cut -b-10); case $p in drwxr-xr-x);; *) fail=1;; esac + ++# coreutils 9.1-9.3 inclusive would fail to copy acls for absolute dirs ++mkdir dest || framework_failure_ ++if test -f /bin/ls; then ++ cp -t dest --parents -p /bin/ls || fail=1 ++fi ++ + Exit $fail +-- +cgit v1.1 diff --git a/sys-apps/debianutils/debianutils-4.11.2.ebuild b/sys-apps/debianutils/debianutils-4.11.2.ebuild index 48ca55e9f4..4402e3b858 100644 --- a/sys-apps/debianutils/debianutils-4.11.2.ebuild +++ b/sys-apps/debianutils/debianutils-4.11.2.ebuild @@ -12,7 +12,7 @@ SRC_URI="mirror://debian/pool/main/d/${PN}/${PN}_${PV}.tar.xz LICENSE="BSD GPL-2 SMAIL" SLOT="0" -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" IUSE="+installkernel static" PDEPEND=" diff --git a/sys-apps/help2man/Manifest b/sys-apps/help2man/Manifest deleted file mode 100644 index 591e813c6c..0000000000 --- a/sys-apps/help2man/Manifest +++ /dev/null @@ -1,2 +0,0 @@ -DIST help2man-1.47.16.tar.xz 203036 BLAKE2B 8e06c2c2e90adfc2ab8345908516b15ae50b02a7a9554d5d9beee4373b71c131aeaa0c148b9a988c531bbfe2149c25069af56a79101a4248b6c1adfeb734a132 SHA512 b427e60a9e3d2e805caf1ae84c337b09c7ca6f92b7ff14771f946c4a1bf7adf177df99b9c1c223ad76df99756005ababf5b548ff8e08d4746702ff7f8150b544 -DIST help2man-1.48.5.tar.xz 204672 BLAKE2B 6d96f5f65f8c637d524e5c373f2b89f114adf544c1d3508a9cb51115279b9bf6399c8ebb0a8d831de12ef8cdaca40b6e75412a221efc5d2dd1794e9c9643196f SHA512 800eb0daa9daef8e423d52ede55eee2960122ea0269865295afada4cf4fcc1c6791da8429c3a57c0fc1bf0a14c8a77953952325413a8faa5dd07b1bc5bc0edd1 diff --git a/sys-apps/help2man/files/help2man-1.46.1-linguas.patch b/sys-apps/help2man/files/help2man-1.46.1-linguas.patch deleted file mode 100644 index b4631bfa7c..0000000000 --- a/sys-apps/help2man/files/help2man-1.46.1-linguas.patch +++ /dev/null @@ -1,67 +0,0 @@ -respect user LINGUAS - ---- help2man-1.46.1/Makefile.in -+++ help2man-1.46.1/Makefile.in -@@ -27,8 +27,15 @@ - export VPATH = .:$(srcdir) - - DESTDIR = --LINGUAS = $(basename $(notdir $(wildcard $(srcdir)/po/*.po))) --LINGUAS_TEXI = $(basename $(notdir $(wildcard $(srcdir)/po-texi/*.po))) -+ALL_LINGUAS = $(basename $(notdir $(wildcard $(srcdir)/po/*.po))) -+ALL_LINGUAS_TEXI = $(basename $(notdir $(wildcard $(srcdir)/po-texi/*.po))) -+ifeq ($(LINGUAS),) -+INSTALL_LINGUAS = $(ALL_LINGUAS) -+INSTALL_LINGUAS_TEXI = $(ALL_LINGUAS_TEXI) -+else -+INSTALL_LINGUAS = $(filter $(LINGUAS),$(ALL_LINGUAS)) -+INSTALL_LINGUAS_TEXI = $(filter $(LINGUAS),$(ALL_LINGUAS_TEXI)) -+endif - - CC = @CC@ - PERL = @PERL@ -@@ -80,7 +87,7 @@ - - install_l10n: install_dirs msg_l10n man_l10n info_l10n - set -e; \ -- for lang in $(LINGUAS); \ -+ for lang in $(INSTALL_LINGUAS); \ - do \ - $(MKINSTALLDIRS) $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES; \ - $(INSTALL_DATA) $$($(FIND_VPATH) po/$$lang.gmo) \ -@@ -89,7 +96,7 @@ - $(INSTALL_DATA) $$($(FIND_VPATH) $(target).$$lang.1) \ - $(DESTDIR)$(mandir)/$$lang/man1/$(target).1; \ - done; \ -- for lang in $(LINGUAS_TEXI); \ -+ for lang in $(INSTALL_LINGUAS_TEXI); \ - do \ - $(INSTALL_DATA) $$($(FIND_VPATH) $(target)-$$lang.info) \ - $(DESTDIR)$(infodir)/$(target)-$$lang.info; \ -@@ -151,7 +158,7 @@ - $(MAKE) $(target) $(target).h2m - ./$(target) --include=$(target).h2m --output=$@ ./$(target) - --msg_l10n: $(addprefix po/,$(addsuffix .gmo,$(LINGUAS))) -+msg_l10n: $(addprefix po/,$(addsuffix .gmo,$(ALL_LINGUAS))) - po/%.gmo: $(srcdir)/po/%.po - test -d po || mkdir po - $(MSGFMT) -o $@ $? -@@ -161,7 +168,7 @@ - $(MKINSTALLDIRS) localetmp/$$lang/LC_MESSAGES && \ - $(INSTALL_DATA) po/$$lang.gmo localetmp/$$lang/LC_MESSAGES/$(target).mo - --man_l10n: $(addprefix $(target).,$(addsuffix .1,$(LINGUAS))) -+man_l10n: $(addprefix $(target).,$(addsuffix .1,$(ALL_LINGUAS))) - $(target).%.1: $(srcdir)/$(target).PL $(srcdir)/$(target).h2m.PL \ - $(srcdir)/po/%.po - lang=$(patsubst $(target).%.1,%,$@); \ -@@ -184,7 +191,7 @@ - $(target).info: $(srcdir)/$(target).texi - $(MAKEINFO) $? -o $@ - --info_l10n: $(addprefix $(target)-,$(addsuffix .info,$(LINGUAS_TEXI))) -+info_l10n: $(addprefix $(target)-,$(addsuffix .info,$(ALL_LINGUAS_TEXI))) - $(target)-%.info: $(target)-%.texi - $(MAKEINFO) $? -o $@.tmp - $(FIXUP_TEXI_TRANS) -o $@ $@.tmp diff --git a/sys-apps/help2man/files/help2man-1.47.16-cygwin.patch b/sys-apps/help2man/files/help2man-1.47.16-cygwin.patch deleted file mode 100644 index e1dd22b8b1..0000000000 --- a/sys-apps/help2man/files/help2man-1.47.16-cygwin.patch +++ /dev/null @@ -1,165 +0,0 @@ -LD_PRELOAD by itself only works with Cygwin builtin functions, but -textdomain() and friends come from libintl. In order to override -those functions, we have to "replace" cygintl-?.dll since functions are -bound to a DLL name at link time. Our replacement will be used since -it is loaded first by LD_PRELOAD. - -But as we are making this *the* libintl, we need to provide -pass-throughs for the other functions which we're not overriding, -otherwise Locale::gettext won't load (not to mention the program -that we're trying to help2man). - ---- origsrc/help2man-1.40.4/bindtextdomain.c 2009-11-13 00:01:34.000000000 -0600 -+++ src/help2man-1.40.4/bindtextdomain.c 2011-12-29 00:24:33.608078600 -0600 -@@ -27,12 +27,34 @@ static char *(*r_textdomain)(char const - static char *(*r_bindtextdomain)(char const *, char const *) = 0; - static char *(*r_bind_textdomain_codeset)(char const *, char const *) = 0; - -+#ifdef __CYGWIN__ -+static void *RTLD_NEXT = 0; -+static char *(*r_gettext)(const char *) = 0; -+static char *(*r_dgettext)(const char *, const char *) = 0; -+static char *(*r_dcgettext)(const char *, const char *, int) = 0; -+static char *(*r_ngettext)(const char *, const char *, unsigned long int) = 0; -+static char *(*r_dngettext)(const char *, const char *, const char *, -+ unsigned long int) = 0; -+static char *(*r_dcngettext)(const char *, const char *, const char *, -+ unsigned long int, int) = 0; -+static char *(*r_setlocale)(int, const char *) = 0; -+ -+#define SYM(sym) libintl_ ## sym -+#else -+#define SYM(sym) sym -+#endif -+ - void setup() - { - static int done = 0; - if (done++) - return; - -+#ifdef __CYGWIN__ -+ if (!(RTLD_NEXT = dlopen("/usr/bin/cygintl-8.dll", RTLD_LAZY))) -+ die("libintl8 not found"); -+#endif -+ - if (!(e_textdomain = getenv("TEXTDOMAIN"))) - die("TEXTDOMAIN not set"); - -@@ -48,9 +70,19 @@ void setup() - if (!(r_bind_textdomain_codeset = dlsym(RTLD_NEXT, - "bind_textdomain_codeset"))) - die("can't find symbol \"bind_textdomain_codeset\""); -+ -+#ifdef __CYGWIN__ -+ r_gettext = dlsym(RTLD_NEXT, "libintl_gettext"); -+ r_dgettext = dlsym(RTLD_NEXT, "libintl_dgettext"); -+ r_dcgettext = dlsym(RTLD_NEXT, "libintl_dcgettext"); -+ r_ngettext = dlsym(RTLD_NEXT, "libintl_ngettext"); -+ r_dngettext = dlsym(RTLD_NEXT, "libintl_dngettext"); -+ r_dcngettext = dlsym(RTLD_NEXT, "libintl_dcngettext"); -+ r_setlocale = dlsym(RTLD_NEXT, "libintl_setlocale"); -+#endif - } - --char *textdomain(char const *domainname) -+char *SYM(textdomain)(char const *domainname) - { - char *r; - setup(); -@@ -61,7 +93,7 @@ char *textdomain(char const *domainname) - return r; - } - --char *bindtextdomain(char const *domainname, char const *dirname) -+char *SYM(bindtextdomain)(char const *domainname, char const *dirname) - { - char const *dir = dirname; - setup(); -@@ -71,7 +103,7 @@ char *bindtextdomain(char const *domainn - return r_bindtextdomain(domainname, dir); - } - --char *bind_textdomain_codeset(char const *domainname, char const *codeset) -+char *SYM(bind_textdomain_codeset)(char const *domainname, char const *codeset) - { - char *r; - setup(); -@@ -81,3 +113,54 @@ char *bind_textdomain_codeset(char const - - return r; - } -+ -+#ifdef __CYGWIN__ -+ -+char *libintl_gettext(const char *msgid) -+{ -+ setup(); -+ return r_gettext(msgid); -+} -+ -+char *libintl_dgettext (const char *domainname, const char *msgid) -+{ -+ setup(); -+ return r_dgettext(domainname, msgid); -+} -+ -+char *libintl_dcgettext (const char *domainname, const char *msgid, -+ int category) -+{ -+ setup(); -+ return r_dcgettext (domainname, msgid, category); -+} -+ -+char *libintl_ngettext (const char *msgid1, const char *msgid2, -+ unsigned long int n) -+{ -+ setup(); -+ return r_ngettext (msgid1, msgid2, n); -+} -+ -+char *libintl_dngettext (const char *domainname, const char *msgid1, -+ const char *msgid2, unsigned long int n) -+{ -+ setup(); -+ return r_dngettext (domainname, msgid1, msgid2, n); -+} -+ -+char *libintl_dcngettext (const char *domainname, -+ const char *msgid1, const char *msgid2, -+ unsigned long int n, int category) -+{ -+ setup(); -+ return r_dcngettext (domainname, msgid1, msgid2, n, category); -+} -+ -+char *libintl_setlocale (int i, const char *s) -+{ -+ setup(); -+ return r_setlocale (i, s); -+} -+ -+#endif ---- src/help2man-1.47.16/Makefile.in -+++ src/help2man-1.47.16/Makefile.in -@@ -83,7 +83,8 @@ install_base: - - install_preload: preload - $(MKINSTALLDIRS) $(DESTDIR)$(pkglibdir) -- $(INSTALL_PROGRAM) $(preload).so $(DESTDIR)$(pkglibdir) -+ $(INSTALL_PROGRAM) lib/cygintl-8.dll $(DESTDIR)$(pkglibdir) -+ ln -sf cygintl-8.dll $(DESTDIR)$(pkglibdir)/$(preload).so - - install_l10n: msg_l10n man_l10n info_l10n - set -e; \ -@@ -152,7 +153,9 @@ $(target).h2m: $(srcdir)/$(target).h2m.PL - - preload: $(preload).so - $(preload).so: $(srcdir)/$(preload).c -- $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ -fPIC -shared $? $(LIBS) -+ mkdir -p lib -+ $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o lib/cygintl-8.dll -shared $? $(LIBS) -+ ln -sf lib/cygintl-8.dll $@ - - man: $(target).1 - $(target).1: $(srcdir)/$(target).PL $(srcdir)/$(target).h2m.PL diff --git a/sys-apps/help2man/files/help2man-1.48.5-cygwin.patch b/sys-apps/help2man/files/help2man-1.48.5-cygwin.patch deleted file mode 100644 index aa75d10e38..0000000000 --- a/sys-apps/help2man/files/help2man-1.48.5-cygwin.patch +++ /dev/null @@ -1,167 +0,0 @@ -https://cygwin.com/git-cygwin-packages/?p=git/cygwin-packages/help2man.git;a=blob;f=help2man-preload-intl.patch;h=2fbc34bbc6bc7a36414257a29fee13944f5c087c;hb=b47c3b0de257e3cda4455e16e196e629c69d28e7 - -LD_PRELOAD by itself only works with Cygwin builtin functions, but -textdomain() and friends come from libintl. In order to override -those functions, we have to "replace" cygintl-?.dll since functions are -bound to a DLL name at link time. Our replacement will be used since -it is loaded first by LD_PRELOAD. - -But as we are making this *the* libintl, we need to provide -pass-throughs for the other functions which we're not overriding, -otherwise Locale::gettext won't load (not to mention the program -that we're trying to help2man). - ---- origsrc/help2man-1.48.5/Makefile.in 2020-03-15 04:52:00.000000000 -0600 -+++ src/help2man-1.48.5/Makefile.in 2021-09-07 03:10:00.000000000 -0600 -@@ -76,7 +76,8 @@ install_base: - - install_preload: preload - $(MKINSTALLDIRS) $(DESTDIR)$(pkglibdir) -- $(INSTALL_PROGRAM) $(preload).so $(DESTDIR)$(pkglibdir) -+ $(INSTALL_PROGRAM) lib/cygintl-8.dll $(DESTDIR)$(pkglibdir) -+ ln -sf cygintl-8.dll $(DESTDIR)$(pkglibdir)/$(preload).so - - install_l10n: msg_l10n man_l10n info_l10n - set -e; \ -@@ -145,7 +146,9 @@ $(target).h2m: $(srcdir)/$(target).h2m.PL - - preload: $(preload).so - $(preload).so: $(srcdir)/$(preload).c -- $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ -fPIC -shared $? $(LIBS) -+ mkdir -p lib -+ $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o lib/cygintl-8.dll -shared $? $(LIBS) -+ ln -sf lib/cygintl-8.dll $@ - - man: $(target).1 - $(target).1: $(srcdir)/$(target).PL $(srcdir)/$(target).h2m.PL ---- origsrc/help2man-1.48.5/bindtextdomain.c 2009-11-13 00:01:34.000000000 -0600 -+++ src/help2man-1.48.5/bindtextdomain.c 2011-12-29 00:24:33.608078600 -0600 -@@ -36,12 +36,34 @@ static char *(*r_textdomain)(char const *) = 0; - static char *(*r_bindtextdomain)(char const *, char const *) = 0; - static char *(*r_bind_textdomain_codeset)(char const *, char const *) = 0; - -+#ifdef __CYGWIN__ -+static void *RTLD_NEXT = 0; -+static char *(*r_gettext)(const char *) = 0; -+static char *(*r_dgettext)(const char *, const char *) = 0; -+static char *(*r_dcgettext)(const char *, const char *, int) = 0; -+static char *(*r_ngettext)(const char *, const char *, unsigned long int) = 0; -+static char *(*r_dngettext)(const char *, const char *, const char *, -+ unsigned long int) = 0; -+static char *(*r_dcngettext)(const char *, const char *, const char *, -+ unsigned long int, int) = 0; -+static char *(*r_setlocale)(int, const char *) = 0; -+ -+#define SYM(sym) libintl_ ## sym -+#else -+#define SYM(sym) sym -+#endif -+ - void setup() - { - static int done = 0; - if (done++) - return; - -+#ifdef __CYGWIN__ -+ if (!(RTLD_NEXT = dlopen("/usr/bin/cygintl-8.dll", RTLD_LAZY))) -+ die("libintl8 not found"); -+#endif -+ - if (!(e_textdomain = getenv("TEXTDOMAIN"))) - die("TEXTDOMAIN not set"); - -@@ -57,9 +79,19 @@ void setup() - if (!(r_bind_textdomain_codeset = dlsym(RTLD_NEXT, - "bind_textdomain_codeset"))) - die("can't find symbol \"bind_textdomain_codeset\""); -+ -+#ifdef __CYGWIN__ -+ r_gettext = dlsym(RTLD_NEXT, "libintl_gettext"); -+ r_dgettext = dlsym(RTLD_NEXT, "libintl_dgettext"); -+ r_dcgettext = dlsym(RTLD_NEXT, "libintl_dcgettext"); -+ r_ngettext = dlsym(RTLD_NEXT, "libintl_ngettext"); -+ r_dngettext = dlsym(RTLD_NEXT, "libintl_dngettext"); -+ r_dcngettext = dlsym(RTLD_NEXT, "libintl_dcngettext"); -+ r_setlocale = dlsym(RTLD_NEXT, "libintl_setlocale"); -+#endif - } - --char *textdomain(char const *domainname) -+char *SYM(textdomain)(char const *domainname) - { - char *r; - setup(); -@@ -70,7 +102,7 @@ char *textdomain(char const *domainname) - return r; - } - --char *bindtextdomain(char const *domainname, char const *dirname) -+char *SYM(bindtextdomain)(char const *domainname, char const *dirname) - { - char const *dir = dirname; - setup(); -@@ -80,7 +112,7 @@ char *bindtextdomain(char const *domainname, - return r_bindtextdomain(domainname, dir); - } - --char *bind_textdomain_codeset(char const *domainname, char const *codeset) -+char *SYM(bind_textdomain_codeset)(char const *domainname, char const *codeset) - { - char *r; - setup(); -@@ -90,3 +122,54 @@ char *bind_textdomain_codeset(char const - - return r; - } -+ -+#ifdef __CYGWIN__ -+ -+char *libintl_gettext(const char *msgid) -+{ -+ setup(); -+ return r_gettext(msgid); -+} -+ -+char *libintl_dgettext (const char *domainname, const char *msgid) -+{ -+ setup(); -+ return r_dgettext(domainname, msgid); -+} -+ -+char *libintl_dcgettext (const char *domainname, const char *msgid, -+ int category) -+{ -+ setup(); -+ return r_dcgettext (domainname, msgid, category); -+} -+ -+char *libintl_ngettext (const char *msgid1, const char *msgid2, -+ unsigned long int n) -+{ -+ setup(); -+ return r_ngettext (msgid1, msgid2, n); -+} -+ -+char *libintl_dngettext (const char *domainname, const char *msgid1, -+ const char *msgid2, unsigned long int n) -+{ -+ setup(); -+ return r_dngettext (domainname, msgid1, msgid2, n); -+} -+ -+char *libintl_dcngettext (const char *domainname, -+ const char *msgid1, const char *msgid2, -+ unsigned long int n, int category) -+{ -+ setup(); -+ return r_dcngettext (domainname, msgid1, msgid2, n, category); -+} -+ -+char *libintl_setlocale (int i, const char *s) -+{ -+ setup(); -+ return r_setlocale (i, s); -+} -+ -+#endif diff --git a/sys-apps/help2man/help2man-1.47.16.ebuild b/sys-apps/help2man/help2man-1.47.16.ebuild deleted file mode 100644 index 91dba1b599..0000000000 --- a/sys-apps/help2man/help2man-1.47.16.ebuild +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -DESCRIPTION="GNU utility to convert program --help output to a man page" -HOMEPAGE="https://www.gnu.org/software/help2man/" -SRC_URI="mirror://gnu/${PN}/${P}.tar.xz" - -LICENSE="GPL-3" -SLOT="0" -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" -IUSE="nls" - -RDEPEND="dev-lang/perl - nls? ( dev-perl/Locale-gettext )" -DEPEND="${RDEPEND}" - -DOCS=( debian/changelog NEWS README THANKS ) #385753 - -PATCHES=( - "${FILESDIR}"/${PN}-1.46.1-linguas.patch -) - -src_prepare() { - default - - if [[ ${CHOST} == *-darwin* ]] ; then - sed -i \ - -e 's/-shared/-bundle/' \ - Makefile.in || die - fi - - use elibc_Cygwin && eapply -p2 "${FILESDIR}"/${PN}-1.47.16-cygwin.patch -} - -src_configure() { - # Disable gettext requirement as the release includes the gmo files #555018 - local myeconfargs=( - ac_cv_path_MSGFMT=$(type -P false) - $(use_enable nls) - ) - econf "${myeconfargs[@]}" -} diff --git a/sys-apps/help2man/help2man-1.48.5.ebuild b/sys-apps/help2man/help2man-1.48.5.ebuild deleted file mode 100644 index 6f98d5da46..0000000000 --- a/sys-apps/help2man/help2man-1.48.5.ebuild +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -DESCRIPTION="GNU utility to convert program --help output to a man page" -HOMEPAGE="https://www.gnu.org/software/help2man/" -SRC_URI="mirror://gnu/${PN}/${P}.tar.xz" - -LICENSE="GPL-3" -SLOT="0" -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" -IUSE="nls" - -RDEPEND="dev-lang/perl - nls? ( dev-perl/Locale-gettext )" -DEPEND="${RDEPEND}" - -DOCS=( debian/changelog NEWS README THANKS ) #385753 - -PATCHES=( - "${FILESDIR}"/${PN}-1.46.1-linguas.patch -) - -src_prepare() { - default - - if [[ ${CHOST} == *-darwin* ]] ; then - sed -i \ - -e 's/-shared/-bundle/' \ - Makefile.in || die - fi - - use elibc_Cygwin && eapply -p2 "${FILESDIR}"/${PN}-1.48.5-cygwin.patch -} - -src_configure() { - # Disable gettext requirement as the release includes the gmo files #555018 - local myeconfargs=( - ac_cv_path_MSGFMT=$(type -P false) - $(use_enable nls) - ) - econf "${myeconfargs[@]}" -} diff --git a/sys-apps/help2man/metadata.xml b/sys-apps/help2man/metadata.xml deleted file mode 100644 index 73dda144f9..0000000000 --- a/sys-apps/help2man/metadata.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> -<pkgmetadata> -<maintainer type="project"> - <email>base-system@gentoo.org</email> - <name>Gentoo Base System</name> -</maintainer> -</pkgmetadata> diff --git a/sys-apps/portage/Manifest b/sys-apps/portage/Manifest index f00a43e3af..60de4ca8f3 100644 --- a/sys-apps/portage/Manifest +++ b/sys-apps/portage/Manifest @@ -1,3 +1,3 @@ -DIST prefix-portage-3.0.21.tar.bz2 1339211 BLAKE2B 019cf0f3d2d1c45e7849221fc40b49e2c84949b74c8a8c74fbd2ca451a2dd075fb7b8bfec121a173ca0848c57a5a57a62d465b2957c4eb4d87f6a180299da91e SHA512 0aff5004ae80e2cd9dce740c56c3c2643ef390510c3b3821d893e5c76733d3a8d4e7648963febb29479b9ee155868ec11526a393beb3b383e741451178f39e5a -DIST prefix-portage-3.0.30.1.tar.bz2 1476396 BLAKE2B 955db5832b1d7d19e25c4ee644f7daa0dbfc7a259ea7018f207865aa8cf5eb8e1e8e2a31c90578162e181af6c043590f239b042e652c3eb2cba9f442bbfc0476 SHA512 1ff8afbee4b204488eb0ecb4bdd216bf754ae015a3bcd298d7b6fb0dd7a671ccbf31d9a4a49be8e3182708641abe008f25df5319e135aa25363b979d49517506 -DIST prefix-portage-3.0.34.2.tar.bz2 1498499 BLAKE2B 47f53e4917bdf204eb23dadd9dc821c06da07d2e5c68cf0a3de908089e4121d45542e2120e57744db1c808a156595624915956e77f547ab671b1584b2c67cf0b SHA512 121dd885a73153e780e28c2e514d4b3babc44368aa6915b2009ed0b205051c2f6c37dd3ccfe8be5ea567e7bab2f9f9b0c5c5b81c49990fbac7360261721a5bb7 +DIST prefix-portage-3.0.56.tar.bz2 1461156 BLAKE2B 2b654c65c5b1e358789774f21e6ee0c6e0dfba0d3d7ca6159f89a6c3d99686f52bbcbace08456d679a4dce62e16547f8b3f85723924e41f0270c644fed16d32c SHA512 10fcf17813dcdf216ac2d31aac9097ca53f4b31a01440c48d53b6d46908fa1c47a31237988b5e583cb7cc26bb8689340f5cf7dc3db0f10e463ed8f6ab375de61 +DIST prefix-portage-3.0.62.tar.bz2 1540010 BLAKE2B 5228459672b9928881fcce58b01c30af4974cf56c5227f6b9a83ae14579821a65b5914a2c538ce3a2e6805a2abde226fb4a9c6b8fb4c8035a5b8a931e813e5b9 SHA512 07bb343c243ada777dd606318b49fb76b436c189d02f086ce069d6a1dbb4ce9fe5539b26c8bb0bb223ea981acaa92397ec43b21a669a8fcea89b4f4fc94d0b1d +DIST prefix-portage-3.0.63.tar.bz2 1501121 BLAKE2B 4d9ec570e958dca53b8adf7057d2f2b88083bfd7570b75594d54513e7bb3a4641b7d1f4b87689a863e092215f764f8609d53bc8becdbdb91108b9801a8ccc1ca SHA512 df63d040d91912d81dbc15373618e6b2c043641bd93afd035c3739999c38d2616d3dcc87591e45eceeed17095ccddef90502684460e20f73ee451aa65bdac761 diff --git a/sys-apps/portage/files/portage-2.3.45-ebuildshell.patch b/sys-apps/portage/files/portage-2.3.45-ebuildshell.patch deleted file mode 100644 index e495ee4c24..0000000000 --- a/sys-apps/portage/files/portage-2.3.45-ebuildshell.patch +++ /dev/null @@ -1,354 +0,0 @@ -From 8c6b115fa0325b5bed2e1a9c4c8e8af45cdecc2e Mon Sep 17 00:00:00 2001 -From: Michael Haubenwallner <michael.haubenwallner@salomon.at> -Date: Wed, 6 Nov 2013 12:40:05 +0100 -Subject: [PATCH 1/2] Add ebuildshell feature, bug#155161. - ---- - bin/ebuild.sh | 146 ++++++++++++++++++++++++++++++++++- - bin/filter-bash-environment.py | 55 +++++++++---- - bin/save-ebuild-env.sh | 2 +- - man/make.conf.5 | 6 ++ - lib/_emerge/AbstractEbuildProcess.py | 1 + - lib/portage/const.py | 1 + - 6 files changed, 194 insertions(+), 17 deletions(-) - -diff --git a/bin/ebuild.sh b/bin/ebuild.sh -index f76a48d8e..683a4e9c1 100755 ---- a/bin/ebuild.sh -+++ b/bin/ebuild.sh -@@ -121,7 +121,7 @@ __qa_source() { - __qa_call() { - local shopts=$(shopt) OLDIFS="$IFS" - local retval -- "$@" -+ __call-ebuildshell "$@" - retval=$? - set +e - [[ $shopts != $(shopt) ]] && -@@ -547,6 +547,150 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then - unset BIN_PATH BIN BODY FUNC_SRC - fi - -+__call-ebuildshell() { -+ if ! has ebuildshell ${FEATURES}; then -+ "$@" -+ return $? -+ fi -+ local __ebuildshell_args=( "$@" ) -+ # These are the variables I have seen 'bash -i' maintaining the values for: -+ local __ebuildshell_bash_i_vars="__ebuildshell_.* -+ _ BASH_ARGC BASH_ARGV BASH_COMMAND BASH_LINENO BASH_SOURCE -+ BASH_VERSINFO BASH_SUBSHELL BASHOPTS BASHPID COMP_WORDBREAKS -+ DIRSTACK EUID FUNCNAME GROUPS HISTCMD HISTFILE LINENO PIPESTATUS -+ PPID PS1 PS2 PS3 PS4 PWD RANDOM SECONDS SHELLOPTS UID" -+ # Allow recursive ebuildshell, for use in multibuild.eclass and similar: -+ local __ebuildshell_pid=${BASHPID:-$(__bashpid)} -+ local __ebuildshell_tmpf="${T}/ebuildshell.${__ebuildshell_pid}" -+ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars} -+ ( -+ cat <<-EOE -+ # local variables of functions using recursive ebuildshell are -+ # visible to the EXIT trap of that recursive ebuildshell. To -+ # keep them local, we have to filter them from that recursive -+ # ebuildshell's return-env. As 'declare -p' is unable to tell -+ # local-ity of variables, we abuse the trace attribute for local -+ # variables to filter them from the return-env. So we need the -+ # local alias active before declaring any functions. -+ # On a sidehand, this allows for copy&paste of function body -+ # lines including the local keyword. -+ alias local='declare -t' -+ shopt -s expand_aliases -+ EOE -+ ( -+ declare -p -+ declare -fp -+ shopt -p -+ [[ ${BASH_VERSINFO[0]} == 3 ]] && export -+ ) | -+ ( -+ # we need everything but the bash vars after 'env -i' -+ 2>"${__ebuildshell_tmpf}.ebuild-rovars" \ -+ "${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}" \ -+ "${PORTAGE_BIN_PATH}"/filter-bash-environment.py \ -+ --report-readonly-variables \ -+ --preserve-readonly-attribute \ -+ "${__ebuildshell_bash_i_vars}" \ -+ || die "filter-bash-environment.py failed" -+ ) -+ # 'declare -g' is available since bash-4.2, -+ # https://bugs.gentoo.org/show_bug.cgi?id=155161#c35 -+ if (( ${BASH_VERSINFO[0]} > 4 )) || -+ (( ${BASH_VERSINFO[0]} == 4 && ${BASH_VERSINFO[1]} >= 2 )) -+ then -+ __ebuildshell_bash42_true= -+ __ebuildshell_bash42_false='#bash-4.2#' -+ else -+ __ebuildshell_bash42_true='#bash-4.2#' -+ __ebuildshell_bash42_false= -+ fi -+ # The already readonly variables, without bash maintained ones: -+ __ebuildshell_ro_ebuild_vars=$(<"${__ebuildshell_tmpf}.ebuild-rovars") -+ cat <<-EOE -+ # properly quote the function arguments -+ $(declare -p __ebuildshell_args) -+ set -- "\${__ebuildshell_args[@]}" -+ unset __ebuildshell_args -+ # be informative about what to do -+ PS1="EBUILD ${PN} $1 \$ " -+ type $1 -+ ${__ebuildshell_bash42_false}echo 'warning: preserving variables across phases requires bash-4.2' -+ echo "WANTED: \$@" -+ echo "or use: \"\\\$@\"" -+ # use bash history, but not the 'user's real one -+ HISTFILE=~/.bash_history -+ # but do not use history-expansion with '!', -+ # for copy&paste of function body lines containing: ! -+ set +H -+ # this is a debugging shell already -+ shopt -u extdebug -+ trap - DEBUG -+ # at exit, dump the current environment -+ trap " -+ unalias local -+ unset -f __call-ebuildshell -+ rm -f '${__ebuildshell_tmpf}.return-'* -+ ( -+ ( -+ # declare -p does not tell the -g flag, -+ # so we add it by aliasing declare. -+ ${__ebuildshell_bash42_true}echo \"alias declare='declare -g'\" -+ declare -p -+ ${__ebuildshell_bash42_true}echo \"unalias declare\" -+ declare -fp -+ shopt -p | grep -v '\\(expand_aliases\\|extdebug\\)$' -+ $([[ ${BASH_VERSINFO[0]} == 3 ]] && echo export) -+ ) | -+ ( -+ # We may have more readonly variables now, yet we -+ # need to filter variables that were readonly before. -+ # And filter local variables by their trace attribute. -+ 2>'${__ebuildshell_tmpf}.return-rovars' \\ -+ '${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}' \\ -+ '${PORTAGE_BIN_PATH}'/filter-bash-environment.py \\ -+ --report-readonly-variables \\ -+ --preserve-readonly-attribute \\ -+ --filter-traced-variables \\ -+ '${__ebuildshell_bash_i_vars} \ -+ ${__ebuildshell_ro_ebuild_vars}' \\ -+ || die 'filter-bash-environment.py failed' -+ ) -+ ) > '${__ebuildshell_tmpf}.return-env' -+ " EXIT -+ # can do some cleanup right now -+ rm -f '${__ebuildshell_tmpf}.ebuild-'* -+ EOE -+ ) > "${__ebuildshell_tmpf}.ebuild-env" -+ -+ # pre-fill the history with "$@" -+ echo '"$@"' >> ~/.bash_history -+ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} ~/.bash_history &>/dev/null -+ -+ env -i HOME=~ ${BASH} --rcfile "${__ebuildshell_tmpf}.ebuild-env" -i -+ -+ # The environment- and exit-status handling after leaving the ebuildshell -+ # prompt is expected to be identical as without the ebuildshell prompt. -+ local __ebuildshell_status=$? -+ -+ # We might be in a recursive ebuildshell, but do not want -+ # any aliases being active while sourcing the return-env. -+ local __ebuildshell_orig_aliases=$(alias) -+ unalias -a -+ source "${__ebuildshell_tmpf}.return-env" -+ unalias -a -+ eval "${__ebuildshell_orig_aliases}" -+ -+ # Portage has a whitelist of readonly variables: If an ebuild defines -+ # additional readonly variables, their readonly attribute is removed -+ # across ebuild phases. If we ever want to preserve the readonly -+ # attribute of additional ebuild-defined variables across phases, -+ # when returning from the ebuildshell their names are in -+ # "${__ebuildshell_tmpf}.return-rovars" -+ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars} -+ -+ return ${__ebuildshell_status} -+} -+ - # Subshell/helper die support (must export for the die helper). - export EBUILD_MASTER_PID=${BASHPID:-$(__bashpid)} - trap 'exit 1' SIGTERM -diff --git a/bin/filter-bash-environment.py b/bin/filter-bash-environment.py -index 06cac7214..5590dbfc4 100755 ---- a/bin/filter-bash-environment.py -+++ b/bin/filter-bash-environment.py -@@ -12,7 +12,8 @@ func_end_re = re.compile(br'^\}$') - - var_assign_re = re.compile(br'(^|^declare\s+-\S+\s+|^declare\s+|^export\s+)([^=\s]+)=("|\')?.*$') - close_quote_re = re.compile(br'(\\"|"|\')\s*$') --readonly_re = re.compile(br'^declare\s+-(\S*)r(\S*)\s+') -+readonly_re = re.compile(br'^declare\s+-(\S*)r(\S*)\s+([^=\s]+)') -+trace_re = re.compile(br'^declare\s+-\S*t\S*\s+') - # declare without assignment - var_declare_re = re.compile(br'^declare(\s+-\S+)?\s+([^=\s]+)\s*$') - -@@ -27,7 +28,7 @@ def have_end_quote(quote, line): - return close_quote_match is not None and \ - close_quote_match.group(1) == quote - --def filter_declare_readonly_opt(line): -+def filter_declare_readonly_opt(line, options): - readonly_match = readonly_re.match(line) - if readonly_match is not None: - declare_opts = b'' -@@ -35,14 +36,19 @@ def filter_declare_readonly_opt(line): - group = readonly_match.group(i) - if group is not None: - declare_opts += group -+ var = readonly_match.group(3) -+ if '--report-readonly-variables' in options: -+ getattr(sys.stderr, 'buffer', sys.stderr).write(var + b'\n') -+ if '--preserve-readonly-attribute' in options: -+ declare_opts += b'r' - if declare_opts: - line = b'declare -' + declare_opts + \ -- b' ' + line[readonly_match.end():] -+ b' ' + var + line[readonly_match.end():] - else: -- line = b'declare ' + line[readonly_match.end():] -+ line = b'declare ' + var + line[readonly_match.end():] - return line - --def filter_bash_environment(pattern, file_in, file_out): -+def filter_bash_environment(pattern, file_in, file_out, options): - # Filter out any instances of the \1 character from variable values - # since this character multiplies each time that the environment - # is saved (strange bash behavior). This can eventually result in -@@ -66,6 +72,8 @@ def filter_bash_environment(pattern, file_in, file_out): - quote = var_assign_match.group(3) - filter_this = pattern.match(var_assign_match.group(2)) \ - is not None -+ if not filter_this and '--filter-traced-variables' in options: -+ filter_this = trace_re.match(line) is not None - # Exclude the start quote when searching for the end quote, - # to ensure that the start quote is not misidentified as the - # end quote (happens if there is a newline immediately after -@@ -75,7 +83,7 @@ def filter_bash_environment(pattern, file_in, file_out): - multi_line_quote = quote - multi_line_quote_filter = filter_this - if not filter_this: -- line = filter_declare_readonly_opt(line) -+ line = filter_declare_readonly_opt(line, options) - file_out.write(line.replace(b"\1", b"")) - continue - else: -@@ -84,8 +92,10 @@ def filter_bash_environment(pattern, file_in, file_out): - # declare without assignment - filter_this = pattern.match(declare_match.group(2)) \ - is not None -+ if not filter_this and '--filter-traced-variables' in options: -+ filter_this = trace_re.match(line) is not None - if not filter_this: -- line = filter_declare_readonly_opt(line) -+ line = filter_declare_readonly_opt(line, options) - file_out.write(line) - continue - -@@ -122,13 +132,28 @@ if __name__ == "__main__": - "while leaving bash function definitions and here-documents " + \ - "intact. The PATTERN is a space separated list of variable names" + \ - " and it supports python regular expression syntax." -- usage = "usage: %s PATTERN" % os.path.basename(sys.argv[0]) -- args = sys.argv[1:] -- -- if '-h' in args or '--help' in args: -- sys.stdout.write(usage + "\n") -- sys.stdout.flush() -- sys.exit(os.EX_OK) -+ usage = "usage: %s [-h|<options>] PATTERN" % os.path.basename(sys.argv[0]) -+ args = [] -+ known_options = { -+ '--report-readonly-variables': -+ "Write names of readonly variables to stderr.", -+ '--preserve-readonly-attribute': -+ "Preserve the '-r' flag in 'declare -r'.", -+ '--filter-traced-variables': -+ "Filter out variables declared with '-t' attribute." -+ } -+ options = {} -+ for arg in sys.argv[1:]: -+ if arg in known_options.keys(): -+ options[arg] = True -+ continue -+ if '-h' == arg or '--help' == arg: -+ sys.stdout.write(usage + "\n\nKnown <options>:\n\n") -+ for option, descr in known_options.items(): -+ sys.stdout.write(" " + option + "\t" + descr + "\n") -+ sys.stdout.flush() -+ sys.exit(os.EX_OK) -+ args.append(arg) - - if len(args) != 1: - sys.stderr.write(usage + "\n") -@@ -151,5 +176,5 @@ if __name__ == "__main__": - - var_pattern = b'^(' + b'|'.join(var_pattern) + b')$' - filter_bash_environment( -- re.compile(var_pattern), file_in, file_out) -+ re.compile(var_pattern), file_in, file_out, options) - file_out.flush() -diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh -index bb17382d4..af35a3327 100755 ---- a/bin/save-ebuild-env.sh -+++ b/bin/save-ebuild-env.sh -@@ -53,7 +53,7 @@ __save_ebuild_env() { - einfo einfon ewarn eerror ebegin __eend eend KV_major \ - KV_minor KV_micro KV_to_int get_KV has \ - __has_phase_defined_up_to \ -- hasv hasq __qa_source __qa_call \ -+ hasv hasq __qa_source __qa_call __call-ebuildshell \ - addread addwrite adddeny addpredict __sb_append_var \ - use usev useq has_version portageq \ - best_version use_with use_enable register_die_hook \ -diff --git a/man/make.conf.5 b/man/make.conf.5 -index b0c1aa4f2..568f350a0 100644 ---- a/man/make.conf.5 -+++ b/man/make.conf.5 -@@ -408,6 +408,12 @@ exist). Also see the related \fIunmerge\-backup\fR feature. - Use locks to ensure that unsandboxed ebuild phases never execute - concurrently. Also see \fIparallel\-install\fR. - .TP -+.B ebuildshell -+Drop into an interactive shell for each phase function, meant for -+debugging. Because the shell would normally be used to execute the -+phase function, commands like src_unpack or epatch are available in the -+interactive shell. Use `die` to terminate the merge. -+.TP - .B fail\-clean - Clean up temporary files after a build failure. This is particularly useful - if you have \fBPORTAGE_TMPDIR\fR on tmpfs. If this feature is enabled, you -diff --git a/lib/_emerge/AbstractEbuildProcess.py b/lib/_emerge/AbstractEbuildProcess.py -index 370cac529..a521596e5 100644 ---- a/lib/_emerge/AbstractEbuildProcess.py -+++ b/lib/_emerge/AbstractEbuildProcess.py -@@ -181,6 +181,7 @@ class AbstractEbuildProcess(SpawnProcess): - self.fd_pipes = {} - null_fd = None - if 0 not in self.fd_pipes and \ -+ "ebuildshell" not in self.settings.features and \ - self.phase not in self._phases_interactive_whitelist and \ - "interactive" not in self.settings.get("PROPERTIES", "").split(): - null_fd = os.open('/dev/null', os.O_RDONLY) -diff --git a/lib/portage/const.py b/lib/portage/const.py -index 3c23c85ed..d9c57f300 100644 ---- a/lib/portage/const.py -+++ b/lib/portage/const.py -@@ -161,6 +161,7 @@ SUPPORTED_FEATURES = frozenset([ - "distlocks", - "downgrade-backup", - "ebuild-locks", -+ "ebuildshell", - "fail-clean", - "fakeroot", - "fixlafiles", --- -2.16.1 - diff --git a/sys-apps/portage/files/portage-2.3.62-prefix-stack.patch b/sys-apps/portage/files/portage-2.3.62-prefix-stack.patch deleted file mode 100644 index b0bdf2a20e..0000000000 --- a/sys-apps/portage/files/portage-2.3.62-prefix-stack.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 1fe30e79c368ce71e024d70c3ec07a6aed3ef262 Mon Sep 17 00:00:00 2001 -From: Michael Haubenwallner <haubi@gentoo.org> -Date: Fri, 22 Mar 2019 17:52:05 +0100 -Subject: [PATCH] from FEATURES=stacked-prefix to USE=prefix-stack - -Rather than telling the base prefix' portage to support stacked prefix, -be explicit in the stacked prefix about to USE that feature. -Bug: https://bugs.gentoo.org/658572 ---- - bin/install-qa-check.d/05prefix | 10 +++------- - bin/phase-helpers.sh | 12 ++++-------- - lib/portage/const.py | 1 - - 3 files changed, 7 insertions(+), 16 deletions(-) - -diff --git a/bin/install-qa-check.d/05prefix b/bin/install-qa-check.d/05prefix -index 03da3bbce..4f48e4216 100644 ---- a/bin/install-qa-check.d/05prefix -+++ b/bin/install-qa-check.d/05prefix -@@ -36,16 +36,12 @@ install_qa_check_prefix() { - local WHITELIST=" /usr/bin/env " - # shebang can be an absolutised path, bug #342929 - local eprefix=$(canonicalize ${EPREFIX}) -- # Without the stacked-prefix feature, tests using BPREFIX -- # are redundant to EPREFIX, but run only if we will fail. -+ # Without USE=prefix-stack, tests using BPREFIX are -+ # redundant to EPREFIX, but run only if we will fail. - # Otherways, BPREFIX really is BROOT (the EAPI 7 one). - local BPREFIX=${EPREFIX} - local bprefix=${eprefix} -- if has stacked-prefix ${FEATURES} && -- [[ -z ${ROOT%/} ]] && -- [[ ${CBUILD} == ${CHOST} ]] && -- [[ ${EPREFIX} != ${BROOT-${PORTAGE_OVERRIDE_EPREFIX}} ]] && -- :; then -+ if has prefix-stack ${USE} ; then - BPREFIX=${BROOT-${PORTAGE_OVERRIDE_EPREFIX}} - bprefix=$(canonicalize ${BPREFIX}) - fi -diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh -index 606b1cdfd..c64f1106b 100644 ---- a/bin/phase-helpers.sh -+++ b/bin/phase-helpers.sh -@@ -932,18 +932,14 @@ ___best_version_and_has_version_common() { - fi ;; - esac - -- # PREFIX LOCAL: stacked-prefix feature -+ # PREFIX LOCAL: prefix-stack feature - if ___eapi_has_prefix_variables && - has "${root_arg}" '--host-root' '-b' && -- has stacked-prefix ${FEATURES} && -+ has prefix-stack ${USE} && - [[ -z ${ROOT%/} ]] && -- [[ ${CBUILD} == ${CHOST} ]] && -- [[ ${EPREFIX} != ${BROOT-${PORTAGE_OVERRIDE_EPREFIX}} ]] && - :; then -- # When we merge into another EPREFIX, but not into some ROOT, -- # and CHOST is equal to CBUILD, build tools found in EPREFIX -- # perfectly work for the current build environment. -- # In a "stacked prefix" we explicitly utilize this situation. -+ # When we merge into "stacked" EPREFIX, but not into some ROOT, build -+ # tools found in EPREFIX perfectly work for current build environment. - "${FUNCNAME[1]}" "${atom}" && return 0 - fi - # END PREFIX LOCAL -diff --git a/lib/portage/const.py b/lib/portage/const.py -index eddce377d..db02cbc56 100644 ---- a/lib/portage/const.py -+++ b/lib/portage/const.py -@@ -207,7 +207,6 @@ SUPPORTED_FEATURES = frozenset([ - "splitdebug", - "split-elog", - "split-log", -- "stacked-prefix", # PREFIX LOCAL - "strict", - "strict-keepdir", - "stricter", --- -2.19.2 - diff --git a/sys-apps/portage/files/portage-3.0.30-interrevisions.patch b/sys-apps/portage/files/portage-3.0.55.1-interrevisions.patch index e53fbd233a..7a3e777924 100644 --- a/sys-apps/portage/files/portage-3.0.30-interrevisions.patch +++ b/sys-apps/portage/files/portage-3.0.55.1-interrevisions.patch @@ -1,11 +1,11 @@ -https://bugs.gentoo.org/832062 +https://bugs.gentoo.org/918717 -add (back) inter-revision support for Prefix Portage +allow r0X.Y revision numbers in prefix --- a/lib/portage/versions.py +++ b/lib/portage/versions.py @@ -53,7 +53,9 @@ - } + _pkg = r"[\w+][\w+-]*?" _v = r"(\d+)((\.\d+)*)([a-z]?)((_(pre|p|beta|alpha|rc)\d*)*)" -_rev = r"\d+" @@ -14,8 +14,8 @@ add (back) inter-revision support for Prefix Portage +# END_PREFIX_LOCAL _vr = _v + "(-r(" + _rev + "))?" - _cp = { -@@ -287,15 +289,47 @@ + _cp = "(" + _cat + "/" + _pkg + "(-" + _vr + ")?)" +@@ -252,15 +254,47 @@ if rval: return rval diff --git a/sys-apps/portage/files/portage-tmpdir.conf b/sys-apps/portage/files/portage-tmpdir.conf new file mode 100644 index 0000000000..4f6e20ccb5 --- /dev/null +++ b/sys-apps/portage/files/portage-tmpdir.conf @@ -0,0 +1,2 @@ +d /var/tmp/portage 0775 portage portage +d /tmp/portage 0775 portage portage diff --git a/sys-apps/portage/portage-3.0.21.ebuild b/sys-apps/portage/portage-3.0.21.ebuild deleted file mode 100644 index 6505c08858..0000000000 --- a/sys-apps/portage/portage-3.0.21.ebuild +++ /dev/null @@ -1,307 +0,0 @@ -# Copyright 1999-2022 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -DISTUTILS_USE_SETUPTOOLS=no -PYTHON_COMPAT=( pypy3 python3_{7..9} ) -PYTHON_REQ_USE='bzip2(+),threads(+)' - -inherit distutils-r1 linux-info systemd prefix - -DESCRIPTION="Portage package manager used in Gentoo Prefix" -HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage" - -LICENSE="GPL-2" -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" -SLOT="0" -IUSE="apidoc build doc gentoo-dev +ipc +native-extensions rsync-verify selinux test xattr" -RESTRICT="!test? ( test )" - -BDEPEND=" - app-arch/xz-utils - test? ( dev-vcs/git )" -DEPEND="!build? ( $(python_gen_impl_dep 'ssl(+)') ) - >=app-arch/tar-1.27 - dev-lang/python-exec:2 - >=sys-apps/sed-4.0.5 sys-devel/patch - doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 ) - apidoc? ( - dev-python/sphinx - dev-python/sphinx-epytext - )" -# Require sandbox-2.2 for bug #288863. -# For whirlpool hash, require python[ssl] (bug #425046). -# For compgen, require bash[readline] (bug #445576). -# app-portage/gemato goes without PYTHON_USEDEP since we're calling -# the executable. -RDEPEND=" - !prefix? ( acct-user/portage ) - app-arch/zstd - >=app-arch/tar-1.27 - dev-lang/python-exec:2 - >=sys-apps/findutils-4.4 - !build? ( - >=sys-apps/sed-4.0.5 - >=app-shells/bash-5.0:0[readline] - >=app-admin/eselect-1.2 - rsync-verify? ( - >=app-portage/gemato-14.5[${PYTHON_USEDEP}] - >=sec-keys/openpgp-keys-gentoo-release-20180706 - >=app-crypt/gnupg-2.2.4-r2[ssl(-)] - ) - ) - elibc_glibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) ) - elibc_musl? ( >=sys-apps/sandbox-2.2 ) - kernel_linux? ( sys-apps/util-linux ) - >=app-misc/pax-utils-0.1.18 - selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] ) - xattr? ( kernel_linux? ( - >=sys-apps/install-xattr-0.3 - ) ) - !<app-admin/logrotate-3.8.0 - !<app-portage/gentoolkit-0.4.6 - !<app-portage/repoman-2.3.10 - !~app-portage/repoman-3.0.0" -PDEPEND=" - !build? ( - >=net-misc/rsync-2.6.4 - >=sys-apps/file-5.41 - >=sys-apps/coreutils-6.4 - )" -# coreutils-6.4 rdep is for date format in emerge-webrsync #164532 -# NOTE: FEATURES=installsources requires debugedit and rsync - -SRC_ARCHIVES="https://dev.gentoo.org/~zmedico/portage/archives https://dev.gentoo.org/~grobian/distfiles" - -prefix_src_archives() { - local x y - for x in ${@}; do - for y in ${SRC_ARCHIVES}; do - echo ${y}/${x} - done - done -} - -TARBALL_PV=${PV} -SRC_URI="mirror://gentoo/prefix-${PN}-${TARBALL_PV}.tar.bz2 - $(prefix_src_archives prefix-${PN}-${TARBALL_PV}.tar.bz2)" - -S="${WORKDIR}"/prefix-${PN}-${TARBALL_PV} - -pkg_pretend() { - local CONFIG_CHECK="~IPC_NS ~PID_NS ~NET_NS ~UTS_NS" - - check_extra_config -} - -python_prepare_all() { - distutils-r1_python_prepare_all - - eapply "${FILESDIR}"/${PN}-2.3.62-prefix-stack.patch # 658572 - eapply "${FILESDIR}"/${PN}-2.3.45-ebuildshell.patch # 155161 - if use gentoo-dev; then - einfo "Disabling --dynamic-deps by default for gentoo-dev..." - sed -e 's:\("--dynamic-deps", \)\("y"\):\1"n":' \ - -i lib/_emerge/create_depgraph_params.py || \ - die "failed to patch create_depgraph_params.py" - - einfo "Enabling additional FEATURES for gentoo-dev..." - echo 'FEATURES="${FEATURES} strict-keepdir"' \ - >> cnf/make.globals || die - fi - - if use native-extensions; then - printf "[build_ext]\nportage_ext_modules=true\n" >> \ - setup.cfg || die - fi - - if ! use ipc ; then - einfo "Disabling ipc..." - sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \ - -i lib/_emerge/AbstractEbuildProcess.py || \ - die "failed to patch AbstractEbuildProcess.py" - fi - - if use xattr && use kernel_linux ; then - einfo "Adding FEATURES=xattr to make.globals ..." - echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \ - || die "failed to append to make.globals" - fi - - if use build || ! use rsync-verify; then - sed -e '/^sync-rsync-verify-metamanifest/s|yes|no|' \ - -e '/^sync-webrsync-verify-signature/s|yes|no|' \ - -i cnf/repos.conf || die "sed failed" - fi - - if [[ -n ${EPREFIX} ]] ; then - # PREFIX LOCAL: only hack const_autotool - local extrapath="/usr/sbin:/usr/bin:/sbin:/bin" - # ok, we can't rely on PORTAGE_ROOT_USER being there yet, as people - # tend not to update that often, as long as we are a separate ebuild - # we can assume when unset, it's time for some older trick - if [[ -z ${PORTAGE_ROOT_USER} ]] ; then - PORTAGE_ROOT_USER=$(python -c 'from portage.const import rootuser; print rootuser') - fi - # We need to probe for bash in the Prefix, because it may not - # exist, in which case we fall back to the currently in use - # bash. This logic is necessary in particular during bootstrap, - # where we pull ourselves out of a temporary place with tools - local bash="${EPREFIX}/bin/bash" - [[ ! -x ${bash} ]] && bash=${BASH} - - einfo "Adjusting sources for ${EPREFIX}" - find . -type f -exec \ - sed -e "s|@PORTAGE_EPREFIX@|${EPREFIX}|" \ - -e "s|@PORTAGE_MV@|$(type -P mv)|" \ - -e "s|@PORTAGE_BASH@|${bash}|" \ - -e "s|@PREFIX_PORTAGE_PYTHON@|$(type -P python)|" \ - -e "s|@EXTRA_PATH@|${extrapath}|" \ - -e "s|@portagegroup@|${PORTAGE_GROUP:-portage}|" \ - -e "s|@portageuser@|${PORTAGE_USER:-portage}|" \ - -e "s|@rootuser@|${PORTAGE_ROOT_USER:-root}|" \ - -e "s|@rootuid@|$(id -u ${PORTAGE_ROOT_USER:-root})|" \ - -e "s|@rootgid@|$(id -g ${PORTAGE_ROOT_USER:-root})|" \ - -e "s|@sysconfdir@|${EPREFIX}/etc|" \ - -i '{}' + || \ - die "Failed to patch sources" - # We don't need the below, since setup.py deals with this (and - # more) so we don't have to make this correct - # -e "s|@PORTAGE_BASE@|${EPREFIX}/usr/lib/portage/${EPYTHON}|" \ - - # remove Makefiles, or else they will get installed - find . -name "Makefile.*" -delete - - einfo "Prefixing shebangs ..." - while read -r -d $'\0' ; do - local shebang=$(head -n1 "$REPLY") - if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then - sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \ - die "sed failed" - fi - done < <(find . -type f ! -name etc-update -print0) - - einfo "Setting gentoo_prefix as reponame for emerge-webrsync" - sed -i -e 's/repo_name=gentoo/repo_name=gentoo_prefix/' \ - bin/emerge-webrsync || die - - einfo "Making absent gemato non-fatal" - sed -i -e '/exitcode = 127/d' \ - lib/portage/sync/modules/rsync/rsync.py || die - # END PREFIX LOCAL - fi - - # PREFIX LOCAL: make.conf is written by bootstrap-prefix.sh - if use !prefix ; then - cd "${S}/cnf" || die - if [ -f "make.conf.example.${ARCH}".diff ]; then - patch make.conf.example "make.conf.example.${ARCH}".diff || \ - die "Failed to patch make.conf.example" - else - eerror "" - eerror "Portage does not have an arch-specific configuration for this arch." - eerror "Please notify the arch maintainer about this issue. Using generic." - eerror "" - fi - fi -} - -python_compile_all() { - local targets=() - use doc && targets+=( docbook ) - use apidoc && targets+=( apidoc ) - - if [[ ${targets[@]} ]]; then - esetup.py "${targets[@]}" - fi -} - -python_test() { - esetup.py test -} - -python_install() { - # Install sbin scripts to bindir for python-exec linking - # they will be relocated in pkg_preinst() - distutils-r1_python_install \ - --system-prefix="${EPREFIX}/usr" \ - --bindir="$(python_get_scriptdir)" \ - --docdir="${EPREFIX}/usr/share/doc/${PF}" \ - --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \ - --portage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}" \ - --sbindir="$(python_get_scriptdir)" \ - --sysconfdir="${EPREFIX}/etc" \ - "${@}" -} - -python_install_all() { - distutils-r1_python_install_all - - local targets=() - use doc && targets+=( - install_docbook - --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" - ) - use apidoc && targets+=( - install_apidoc - --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" - ) - - # install docs - if [[ ${targets[@]} ]]; then - esetup.py "${targets[@]}" - fi - - dotmpfiles "${FILESDIR}"/portage-ccache.conf - - # Due to distutils/python-exec limitations - # these must be installed to /usr/bin. - local sbin_relocations='archive-conf dispatch-conf emaint env-update etc-update fixpackages regenworld' - einfo "Moving admin scripts to the correct directory" - dodir /usr/sbin - for target in ${sbin_relocations}; do - einfo "Moving /usr/bin/${target} to /usr/sbin/${target}" - mv "${ED}/usr/bin/${target}" "${ED}/usr/sbin/${target}" || die "sbin scripts move failed!" - done -} - -pkg_preinst() { - python_setup - local sitedir=$(python_get_sitedir) - [[ -d ${D}${sitedir} ]] || die "${D}${sitedir}: No such directory" - env -u DISTDIR \ - -u PORTAGE_OVERRIDE_EPREFIX \ - -u PORTAGE_REPOSITORIES \ - -u PORTDIR \ - -u PORTDIR_OVERLAY \ - PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ - "${PYTHON}" -m portage._compat_upgrade.default_locations || die - - env -u BINPKG_COMPRESS -u PORTAGE_REPOSITORIES \ - PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ - "${PYTHON}" -m portage._compat_upgrade.binpkg_compression || die - - env -u FEATURES -u PORTAGE_REPOSITORIES \ - PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ - "${PYTHON}" -m portage._compat_upgrade.binpkg_multi_instance || die - - # elog dir must exist to avoid logrotate error for bug #415911. - # This code runs in preinst in order to bypass the mapping of - # portage:portage to root:root which happens after src_install. - keepdir /var/log/portage/elog - # This is allowed to fail if the user/group are invalid for prefix users. - if chown ${PORTAGE_USER}:${PORTAGE_GROUP} "${ED}"/var/log/portage{,/elog} 2>/dev/null ; then - chmod g+s,ug+rwx "${ED}"/var/log/portage{,/elog} - fi - - if has_version "<${CATEGORY}/${PN}-2.3.77"; then - elog "The emerge --autounmask option is now disabled by default, except for" - elog "portions of behavior which are controlled by the --autounmask-use and" - elog "--autounmask-license options. For backward compatibility, previous" - elog "behavior of --autounmask=y and --autounmask=n is entirely preserved." - elog "Users can get the old behavior simply by adding --autounmask to the" - elog "make.conf EMERGE_DEFAULT_OPTS variable. For the rationale for this" - elog "change, see https://bugs.gentoo.org/658648." - fi -} diff --git a/sys-apps/portage/portage-3.0.30.1-r1.ebuild b/sys-apps/portage/portage-3.0.30.1-r1.ebuild deleted file mode 100644 index f3986eb874..0000000000 --- a/sys-apps/portage/portage-3.0.30.1-r1.ebuild +++ /dev/null @@ -1,305 +0,0 @@ -# Copyright 1999-2022 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -PYTHON_COMPAT=( pypy3 python3_{8..11} ) -PYTHON_REQ_USE='bzip2(+),threads(+)' -TMPFILES_OPTIONAL=1 - -inherit distutils-r1 linux-info toolchain-funcs tmpfiles prefix - -DESCRIPTION="Portage package manager used in Gentoo Prefix" -HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage" -SRC_URI="https://dev.gentoo.org/~grobian/distfiles/prefix-${P}.tar.bz2" - -LICENSE="GPL-2" -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" -SLOT="0" -IUSE="apidoc build doc gentoo-dev +ipc +native-extensions rsync-verify selinux test xattr" -RESTRICT="!test? ( test )" - -BDEPEND=" - app-arch/xz-utils - test? ( dev-vcs/git )" -DEPEND="!build? ( $(python_gen_impl_dep 'ssl(+)') ) - >=app-arch/tar-1.27 - dev-lang/python-exec:2 - >=sys-apps/sed-4.0.5 sys-devel/patch - doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 ) - apidoc? ( - dev-python/sphinx[${PYTHON_USEDEP}] - dev-python/sphinx-epytext[${PYTHON_USEDEP}] - )" -# Require sandbox-2.2 for bug #288863. -# For whirlpool hash, require python[ssl] (bug #425046). -# For compgen, require bash[readline] (bug #445576). -# app-portage/gemato goes without PYTHON_USEDEP since we're calling -# the executable. -RDEPEND=" - !prefix? ( acct-user/portage ) - app-arch/zstd - >=app-arch/tar-1.27 - dev-lang/python-exec:2 - >=sys-apps/findutils-4.4 - !build? ( - >=sys-apps/sed-4.0.5 - >=app-shells/bash-5.0:0[readline] - >=app-admin/eselect-1.2 - rsync-verify? ( - >=app-portage/gemato-14.5[${PYTHON_USEDEP}] - >=sec-keys/openpgp-keys-gentoo-release-20180706 - >=app-crypt/gnupg-2.2.4-r2[ssl(-)] - ) - ) - elibc_glibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) ) - elibc_musl? ( >=sys-apps/sandbox-2.2 ) - kernel_linux? ( sys-apps/util-linux ) - >=app-misc/pax-utils-0.1.18 - selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] ) - xattr? ( kernel_linux? ( - >=sys-apps/install-xattr-0.3 - ) ) - !<app-admin/logrotate-3.8.0 - !<app-portage/gentoolkit-0.4.6 - !<app-portage/repoman-2.3.10 - !~app-portage/repoman-3.0.0" -PDEPEND=" - !build? ( - >=net-misc/rsync-2.6.4 - >=sys-apps/file-5.41 - >=sys-apps/coreutils-6.4 - )" -# coreutils-6.4 rdep is for date format in emerge-webrsync #164532 -# NOTE: FEATURES=installsources requires debugedit and rsync - -S="${WORKDIR}"/prefix-${P} - -pkg_pretend() { - local CONFIG_CHECK="~IPC_NS ~PID_NS ~NET_NS ~UTS_NS" - - if use native-extensions && tc-is-cross-compiler; then - einfo "Disabling USE=native-extensions for cross-compilation (bug #612158)" - fi - - check_extra_config -} - -python_prepare_all() { - local PATCHES=( - "${FILESDIR}"/${PN}-3.0.30-prefix-stack.patch # 658572 - "${FILESDIR}"/${PN}-3.0.30-ebuildshell.patch # 155161 - "${FILESDIR}"/${PN}-3.0.30-interrevisions.patch # 832062 - ) - - distutils-r1_python_prepare_all - - sed -e "s:^VERSION = \"HEAD\"$:VERSION = \"${PV}\":" -i lib/portage/__init__.py || die - - if use gentoo-dev; then - einfo "Disabling --dynamic-deps by default for gentoo-dev..." - sed -e 's:\("--dynamic-deps", \)\("y"\):\1"n":' \ - -i lib/_emerge/create_depgraph_params.py || \ - die "failed to patch create_depgraph_params.py" - - einfo "Enabling additional FEATURES for gentoo-dev..." - echo 'FEATURES="${FEATURES} ipc-sandbox network-sandbox strict-keepdir"' \ - >> cnf/make.globals || die - fi - - if use native-extensions && ! tc-is-cross-compiler; then - printf "[build_ext]\nportage_ext_modules=true\n" >> \ - setup.cfg || die - fi - - if ! use ipc ; then - einfo "Disabling ipc..." - sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \ - -i lib/_emerge/AbstractEbuildProcess.py || \ - die "failed to patch AbstractEbuildProcess.py" - fi - - if use xattr && use kernel_linux ; then - einfo "Adding FEATURES=xattr to make.globals ..." - echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \ - || die "failed to append to make.globals" - fi - - if use build || ! use rsync-verify; then - sed -e '/^sync-rsync-verify-metamanifest/s|yes|no|' \ - -e '/^sync-webrsync-verify-signature/s|yes|no|' \ - -i cnf/repos.conf || die "sed failed" - fi - - if [[ -n ${EPREFIX} ]] ; then - # PREFIX LOCAL: only hack const_autotool - local extrapath="/usr/sbin:/usr/bin:/sbin:/bin" - # ok, we can't rely on PORTAGE_ROOT_USER being there yet, as people - # tend not to update that often, as long as we are a separate ebuild - # we can assume when unset, it's time for some older trick - if [[ -z ${PORTAGE_ROOT_USER} ]] ; then - PORTAGE_ROOT_USER=$(python -c 'from portage.const import rootuser; print rootuser') - fi - # We need to probe for bash in the Prefix, because it may not - # exist, in which case we fall back to the currently in use - # bash. This logic is necessary in particular during bootstrap, - # where we pull ourselves out of a temporary place with tools - local bash="${EPREFIX}/bin/bash" - [[ ! -x ${bash} ]] && bash=${BASH} - - einfo "Adjusting sources for ${EPREFIX}" - find . -type f -exec \ - sed -e "s|@PORTAGE_EPREFIX@|${EPREFIX}|" \ - -e "s|@PORTAGE_MV@|$(type -P mv)|" \ - -e "s|@PORTAGE_BASH@|${bash}|" \ - -e "s|@PREFIX_PORTAGE_PYTHON@|$(type -P python)|" \ - -e "s|@EXTRA_PATH@|${extrapath}|" \ - -e "s|@portagegroup@|${PORTAGE_GROUP:-portage}|" \ - -e "s|@portageuser@|${PORTAGE_USER:-portage}|" \ - -e "s|@rootuser@|${PORTAGE_ROOT_USER:-root}|" \ - -e "s|@rootuid@|$(id -u ${PORTAGE_ROOT_USER:-root})|" \ - -e "s|@rootgid@|$(id -g ${PORTAGE_ROOT_USER:-root})|" \ - -e "s|@sysconfdir@|${EPREFIX}/etc|" \ - -i '{}' + || \ - die "Failed to patch sources" - # We don't need the below, since setup.py deals with this (and - # more) so we don't have to make this correct - # -e "s|@PORTAGE_BASE@|${EPREFIX}/usr/lib/portage/${EPYTHON}|" \ - - # remove Makefiles, or else they will get installed - find . -name "Makefile.*" -delete - - einfo "Prefixing shebangs ..." - while read -r -d $'\0' ; do - local shebang=$(head -n1 "$REPLY") - if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then - sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \ - die "sed failed" - fi - done < <(find . -type f ! -name etc-update -print0) - - einfo "Setting gentoo_prefix as reponame for emerge-webrsync" - sed -i -e 's/repo_name=gentoo/repo_name=gentoo_prefix/' \ - bin/emerge-webrsync || die - - einfo "Making absent gemato non-fatal" - sed -i -e '/exitcode = 127/d' \ - lib/portage/sync/modules/rsync/rsync.py || die - # END PREFIX LOCAL - fi - - # PREFIX LOCAL: make.conf is written by bootstrap-prefix.sh - if use !prefix ; then - cd "${S}/cnf" || die - if [ -f "make.conf.example.${ARCH}".diff ]; then - patch make.conf.example "make.conf.example.${ARCH}".diff || \ - die "Failed to patch make.conf.example" - else - eerror "" - eerror "Portage does not have an arch-specific configuration for this arch." - eerror "Please notify the arch maintainer about this issue. Using generic." - eerror "" - fi - fi -} - -python_compile_all() { - local targets=() - use doc && targets+=( docbook ) - use apidoc && targets+=( apidoc ) - - if [[ ${targets[@]} ]]; then - esetup.py "${targets[@]}" - fi -} - -python_test() { - esetup.py test -} - -python_install() { - # Install sbin scripts to bindir for python-exec linking - # they will be relocated in pkg_preinst() - distutils-r1_python_install \ - --system-prefix="${EPREFIX}/usr" \ - --bindir="$(python_get_scriptdir)" \ - --docdir="${EPREFIX}/usr/share/doc/${PF}" \ - --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \ - --portage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}" \ - --sbindir="$(python_get_scriptdir)" \ - --sysconfdir="${EPREFIX}/etc" \ - "${@}" -} - -python_install_all() { - distutils-r1_python_install_all - - local targets=() - use doc && targets+=( - install_docbook - --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" - ) - use apidoc && targets+=( - install_apidoc - --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" - ) - - # install docs - if [[ ${targets[@]} ]]; then - esetup.py "${targets[@]}" - fi - - dotmpfiles "${FILESDIR}"/portage-ccache.conf - - # Due to distutils/python-exec limitations - # these must be installed to /usr/bin. - local sbin_relocations='archive-conf dispatch-conf emaint env-update etc-update fixpackages regenworld' - einfo "Moving admin scripts to the correct directory" - dodir /usr/sbin - for target in ${sbin_relocations}; do - einfo "Moving /usr/bin/${target} to /usr/sbin/${target}" - mv "${ED}/usr/bin/${target}" "${ED}/usr/sbin/${target}" || die "sbin scripts move failed!" - done -} - -pkg_preinst() { - if ! use build; then - python_setup - local sitedir=$(python_get_sitedir) - [[ -d ${D}${sitedir} ]] || die "${D}${sitedir}: No such directory" - env -u DISTDIR \ - -u PORTAGE_OVERRIDE_EPREFIX \ - -u PORTAGE_REPOSITORIES \ - -u PORTDIR \ - -u PORTDIR_OVERLAY \ - PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ - "${PYTHON}" -m portage._compat_upgrade.default_locations || die - - env -u BINPKG_COMPRESS -u PORTAGE_REPOSITORIES \ - PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ - "${PYTHON}" -m portage._compat_upgrade.binpkg_compression || die - - env -u FEATURES -u PORTAGE_REPOSITORIES \ - PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ - "${PYTHON}" -m portage._compat_upgrade.binpkg_multi_instance || die - fi - - # elog dir must exist to avoid logrotate error for bug #415911. - # This code runs in preinst in order to bypass the mapping of - # portage:portage to root:root which happens after src_install. - keepdir /var/log/portage/elog - # This is allowed to fail if the user/group are invalid for prefix users. - if chown ${PORTAGE_USER}:${PORTAGE_GROUP} "${ED}"/var/log/portage{,/elog} 2>/dev/null ; then - chmod g+s,ug+rwx "${ED}"/var/log/portage{,/elog} - fi - - if has_version "<${CATEGORY}/${PN}-2.3.77"; then - elog "The emerge --autounmask option is now disabled by default, except for" - elog "portions of behavior which are controlled by the --autounmask-use and" - elog "--autounmask-license options. For backward compatibility, previous" - elog "behavior of --autounmask=y and --autounmask=n is entirely preserved." - elog "Users can get the old behavior simply by adding --autounmask to the" - elog "make.conf EMERGE_DEFAULT_OPTS variable. For the rationale for this" - elog "change, see https://bugs.gentoo.org/658648." - fi -} diff --git a/sys-apps/portage/portage-3.0.30.1.ebuild b/sys-apps/portage/portage-3.0.30.1.ebuild deleted file mode 100644 index 90eda9f188..0000000000 --- a/sys-apps/portage/portage-3.0.30.1.ebuild +++ /dev/null @@ -1,308 +0,0 @@ -# Copyright 1999-2022 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -DISTUTILS_USE_SETUPTOOLS=no -PYTHON_COMPAT=( pypy3 python3_{7..9} ) -PYTHON_REQ_USE='bzip2(+),threads(+)' - -inherit distutils-r1 linux-info systemd prefix - -DESCRIPTION="Portage package manager used in Gentoo Prefix" -HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage" - -LICENSE="GPL-2" -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" -SLOT="0" -IUSE="apidoc build doc gentoo-dev +ipc +native-extensions rsync-verify selinux test xattr" -RESTRICT="!test? ( test )" - -BDEPEND=" - app-arch/xz-utils - test? ( dev-vcs/git )" -DEPEND="!build? ( $(python_gen_impl_dep 'ssl(+)') ) - >=app-arch/tar-1.27 - dev-lang/python-exec:2 - >=sys-apps/sed-4.0.5 sys-devel/patch - doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 ) - apidoc? ( - dev-python/sphinx - dev-python/sphinx-epytext - )" -# Require sandbox-2.2 for bug #288863. -# For whirlpool hash, require python[ssl] (bug #425046). -# For compgen, require bash[readline] (bug #445576). -# app-portage/gemato goes without PYTHON_USEDEP since we're calling -# the executable. -RDEPEND=" - !prefix? ( acct-user/portage ) - app-arch/zstd - >=app-arch/tar-1.27 - dev-lang/python-exec:2 - >=sys-apps/findutils-4.4 - !build? ( - >=sys-apps/sed-4.0.5 - >=app-shells/bash-5.0:0[readline] - >=app-admin/eselect-1.2 - rsync-verify? ( - >=app-portage/gemato-14.5[${PYTHON_USEDEP}] - >=sec-keys/openpgp-keys-gentoo-release-20180706 - >=app-crypt/gnupg-2.2.4-r2[ssl(-)] - ) - ) - elibc_glibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) ) - elibc_musl? ( >=sys-apps/sandbox-2.2 ) - kernel_linux? ( sys-apps/util-linux ) - >=app-misc/pax-utils-0.1.18 - selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] ) - xattr? ( kernel_linux? ( - >=sys-apps/install-xattr-0.3 - ) ) - !<app-admin/logrotate-3.8.0 - !<app-portage/gentoolkit-0.4.6 - !<app-portage/repoman-2.3.10 - !~app-portage/repoman-3.0.0" -PDEPEND=" - !build? ( - >=net-misc/rsync-2.6.4 - >=sys-apps/file-5.41 - >=sys-apps/coreutils-6.4 - )" -# coreutils-6.4 rdep is for date format in emerge-webrsync #164532 -# NOTE: FEATURES=installsources requires debugedit and rsync - -SRC_ARCHIVES="https://dev.gentoo.org/~zmedico/portage/archives https://dev.gentoo.org/~grobian/distfiles" - -prefix_src_archives() { - local x y - for x in ${@}; do - for y in ${SRC_ARCHIVES}; do - echo ${y}/${x} - done - done -} - -TARBALL_PV=${PV} -SRC_URI="mirror://gentoo/prefix-${PN}-${TARBALL_PV}.tar.bz2 - $(prefix_src_archives prefix-${PN}-${TARBALL_PV}.tar.bz2)" - -S="${WORKDIR}"/prefix-${PN}-${TARBALL_PV} - -pkg_pretend() { - local CONFIG_CHECK="~IPC_NS ~PID_NS ~NET_NS ~UTS_NS" - - check_extra_config -} - -python_prepare_all() { - distutils-r1_python_prepare_all - - eapply "${FILESDIR}"/${PN}-3.0.30-prefix-stack.patch # 658572 - eapply "${FILESDIR}"/${PN}-3.0.30-ebuildshell.patch # 155161 - eapply "${FILESDIR}"/${PN}-3.0.30-interrevisions.patch # 832062 - if use gentoo-dev; then - einfo "Disabling --dynamic-deps by default for gentoo-dev..." - sed -e 's:\("--dynamic-deps", \)\("y"\):\1"n":' \ - -i lib/_emerge/create_depgraph_params.py || \ - die "failed to patch create_depgraph_params.py" - - einfo "Enabling additional FEATURES for gentoo-dev..." - echo 'FEATURES="${FEATURES} strict-keepdir"' \ - >> cnf/make.globals || die - fi - - if use native-extensions; then - printf "[build_ext]\nportage_ext_modules=true\n" >> \ - setup.cfg || die - fi - - if ! use ipc ; then - einfo "Disabling ipc..." - sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \ - -i lib/_emerge/AbstractEbuildProcess.py || \ - die "failed to patch AbstractEbuildProcess.py" - fi - - if use xattr && use kernel_linux ; then - einfo "Adding FEATURES=xattr to make.globals ..." - echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \ - || die "failed to append to make.globals" - fi - - if use build || ! use rsync-verify; then - sed -e '/^sync-rsync-verify-metamanifest/s|yes|no|' \ - -e '/^sync-webrsync-verify-signature/s|yes|no|' \ - -i cnf/repos.conf || die "sed failed" - fi - - if [[ -n ${EPREFIX} ]] ; then - # PREFIX LOCAL: only hack const_autotool - local extrapath="/usr/sbin:/usr/bin:/sbin:/bin" - # ok, we can't rely on PORTAGE_ROOT_USER being there yet, as people - # tend not to update that often, as long as we are a separate ebuild - # we can assume when unset, it's time for some older trick - if [[ -z ${PORTAGE_ROOT_USER} ]] ; then - PORTAGE_ROOT_USER=$(python -c 'from portage.const import rootuser; print rootuser') - fi - # We need to probe for bash in the Prefix, because it may not - # exist, in which case we fall back to the currently in use - # bash. This logic is necessary in particular during bootstrap, - # where we pull ourselves out of a temporary place with tools - local bash="${EPREFIX}/bin/bash" - [[ ! -x ${bash} ]] && bash=${BASH} - - einfo "Adjusting sources for ${EPREFIX}" - find . -type f -exec \ - sed -e "s|@PORTAGE_EPREFIX@|${EPREFIX}|" \ - -e "s|@PORTAGE_MV@|$(type -P mv)|" \ - -e "s|@PORTAGE_BASH@|${bash}|" \ - -e "s|@PREFIX_PORTAGE_PYTHON@|$(type -P python)|" \ - -e "s|@EXTRA_PATH@|${extrapath}|" \ - -e "s|@portagegroup@|${PORTAGE_GROUP:-portage}|" \ - -e "s|@portageuser@|${PORTAGE_USER:-portage}|" \ - -e "s|@rootuser@|${PORTAGE_ROOT_USER:-root}|" \ - -e "s|@rootuid@|$(id -u ${PORTAGE_ROOT_USER:-root})|" \ - -e "s|@rootgid@|$(id -g ${PORTAGE_ROOT_USER:-root})|" \ - -e "s|@sysconfdir@|${EPREFIX}/etc|" \ - -i '{}' + || \ - die "Failed to patch sources" - # We don't need the below, since setup.py deals with this (and - # more) so we don't have to make this correct - # -e "s|@PORTAGE_BASE@|${EPREFIX}/usr/lib/portage/${EPYTHON}|" \ - - # remove Makefiles, or else they will get installed - find . -name "Makefile.*" -delete - - einfo "Prefixing shebangs ..." - while read -r -d $'\0' ; do - local shebang=$(head -n1 "$REPLY") - if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then - sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \ - die "sed failed" - fi - done < <(find . -type f ! -name etc-update -print0) - - einfo "Setting gentoo_prefix as reponame for emerge-webrsync" - sed -i -e 's/repo_name=gentoo/repo_name=gentoo_prefix/' \ - bin/emerge-webrsync || die - - einfo "Making absent gemato non-fatal" - sed -i -e '/exitcode = 127/d' \ - lib/portage/sync/modules/rsync/rsync.py || die - # END PREFIX LOCAL - fi - - # PREFIX LOCAL: make.conf is written by bootstrap-prefix.sh - if use !prefix ; then - cd "${S}/cnf" || die - if [ -f "make.conf.example.${ARCH}".diff ]; then - patch make.conf.example "make.conf.example.${ARCH}".diff || \ - die "Failed to patch make.conf.example" - else - eerror "" - eerror "Portage does not have an arch-specific configuration for this arch." - eerror "Please notify the arch maintainer about this issue. Using generic." - eerror "" - fi - fi -} - -python_compile_all() { - local targets=() - use doc && targets+=( docbook ) - use apidoc && targets+=( apidoc ) - - if [[ ${targets[@]} ]]; then - esetup.py "${targets[@]}" - fi -} - -python_test() { - esetup.py test -} - -python_install() { - # Install sbin scripts to bindir for python-exec linking - # they will be relocated in pkg_preinst() - distutils-r1_python_install \ - --system-prefix="${EPREFIX}/usr" \ - --bindir="$(python_get_scriptdir)" \ - --docdir="${EPREFIX}/usr/share/doc/${PF}" \ - --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \ - --portage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}" \ - --sbindir="$(python_get_scriptdir)" \ - --sysconfdir="${EPREFIX}/etc" \ - "${@}" -} - -python_install_all() { - distutils-r1_python_install_all - - local targets=() - use doc && targets+=( - install_docbook - --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" - ) - use apidoc && targets+=( - install_apidoc - --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" - ) - - # install docs - if [[ ${targets[@]} ]]; then - esetup.py "${targets[@]}" - fi - - dotmpfiles "${FILESDIR}"/portage-ccache.conf - - # Due to distutils/python-exec limitations - # these must be installed to /usr/bin. - local sbin_relocations='archive-conf dispatch-conf emaint env-update etc-update fixpackages regenworld' - einfo "Moving admin scripts to the correct directory" - dodir /usr/sbin - for target in ${sbin_relocations}; do - einfo "Moving /usr/bin/${target} to /usr/sbin/${target}" - mv "${ED}/usr/bin/${target}" "${ED}/usr/sbin/${target}" || die "sbin scripts move failed!" - done -} - -pkg_preinst() { - python_setup - local sitedir=$(python_get_sitedir) - [[ -d ${D}${sitedir} ]] || die "${D}${sitedir}: No such directory" - env -u DISTDIR \ - -u PORTAGE_OVERRIDE_EPREFIX \ - -u PORTAGE_REPOSITORIES \ - -u PORTDIR \ - -u PORTDIR_OVERLAY \ - PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ - "${PYTHON}" -m portage._compat_upgrade.default_locations || die - - env -u BINPKG_COMPRESS -u PORTAGE_REPOSITORIES \ - PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ - "${PYTHON}" -m portage._compat_upgrade.binpkg_compression || die - - env -u FEATURES -u PORTAGE_REPOSITORIES \ - PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ - "${PYTHON}" -m portage._compat_upgrade.binpkg_multi_instance || die - - # elog dir must exist to avoid logrotate error for bug #415911. - # This code runs in preinst in order to bypass the mapping of - # portage:portage to root:root which happens after src_install. - keepdir /var/log/portage/elog - # This is allowed to fail if the user/group are invalid for prefix users. - if chown ${PORTAGE_USER}:${PORTAGE_GROUP} "${ED}"/var/log/portage{,/elog} 2>/dev/null ; then - chmod g+s,ug+rwx "${ED}"/var/log/portage{,/elog} - fi - - if has_version "<${CATEGORY}/${PN}-2.3.77"; then - elog "The emerge --autounmask option is now disabled by default, except for" - elog "portions of behavior which are controlled by the --autounmask-use and" - elog "--autounmask-license options. For backward compatibility, previous" - elog "behavior of --autounmask=y and --autounmask=n is entirely preserved." - elog "Users can get the old behavior simply by adding --autounmask to the" - elog "make.conf EMERGE_DEFAULT_OPTS variable. For the rationale for this" - elog "change, see https://bugs.gentoo.org/658648." - fi -} diff --git a/sys-apps/portage/portage-3.0.34.2.ebuild b/sys-apps/portage/portage-3.0.34.2.ebuild deleted file mode 100644 index bce3173afc..0000000000 --- a/sys-apps/portage/portage-3.0.34.2.ebuild +++ /dev/null @@ -1,311 +0,0 @@ -# Copyright 1999-2022 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -PYTHON_COMPAT=( pypy3 python3_{8..11} ) -PYTHON_REQ_USE='bzip2(+),threads(+)' -TMPFILES_OPTIONAL=1 - -inherit distutils-r1 linux-info toolchain-funcs tmpfiles prefix - -DESCRIPTION="The package management system for Gentoo Prefix" -HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage" -SRC_URI="https://dev.gentoo.org/~grobian/distfiles/prefix-${P}.tar.bz2" - -LICENSE="GPL-2" -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" -SLOT="0" -IUSE="apidoc build doc gentoo-dev +ipc +native-extensions rsync-verify selinux test xattr" -RESTRICT="!test? ( test )" - -BDEPEND=" - app-arch/xz-utils - test? ( dev-vcs/git )" -DEPEND="!build? ( $(python_gen_impl_dep 'ssl(+)') ) - >=app-arch/tar-1.27 - dev-lang/python-exec:2 - >=sys-apps/sed-4.0.5 sys-devel/patch - doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 ) - apidoc? ( - dev-python/sphinx[${PYTHON_USEDEP}] - dev-python/sphinx-epytext[${PYTHON_USEDEP}] - )" -# Require sandbox-2.2 for bug #288863. -# For whirlpool hash, require python[ssl] (bug #425046). -# For compgen, require bash[readline] (bug #445576). -# app-portage/gemato goes without PYTHON_USEDEP since we're calling -# the executable. -RDEPEND=" - !prefix? ( acct-user/portage ) - app-arch/zstd - >=app-arch/tar-1.27 - dev-lang/python-exec:2 - >=sys-apps/findutils-4.4 - !build? ( - >=sys-apps/sed-4.0.5 - >=app-shells/bash-5.0:0[readline] - >=app-admin/eselect-1.2 - rsync-verify? ( - >=app-portage/gemato-14.5[${PYTHON_USEDEP}] - >=sec-keys/openpgp-keys-gentoo-release-20180706 - >=app-crypt/gnupg-2.2.4-r2[ssl(-)] - ) - ) - elibc_glibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) ) - elibc_musl? ( >=sys-apps/sandbox-2.2 ) - kernel_linux? ( sys-apps/util-linux ) - >=app-misc/pax-utils-0.1.18 - selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] ) - xattr? ( kernel_linux? ( - >=sys-apps/install-xattr-0.3 - ) ) - !<app-admin/logrotate-3.8.0 - !<app-portage/gentoolkit-0.4.6 - !<app-portage/repoman-2.3.10 - !~app-portage/repoman-3.0.0" -PDEPEND=" - !build? ( - >=net-misc/rsync-2.6.4 - >=sys-apps/file-5.41 - >=sys-apps/coreutils-6.4 - )" -# coreutils-6.4 rdep is for date format in emerge-webrsync #164532 -# NOTE: FEATURES=installsources requires debugedit and rsync - -S="${WORKDIR}"/prefix-${P} - -pkg_pretend() { - local CONFIG_CHECK="~IPC_NS ~PID_NS ~NET_NS ~UTS_NS" - - if use native-extensions && tc-is-cross-compiler; then - einfo "Disabling USE=native-extensions for cross-compilation (bug #612158)" - fi - - check_extra_config -} - -python_prepare_all() { - local PATCHES=( - # dropped in 3.0.34: is there anyone but haubi using this? - # "${FILESDIR}"/${PN}-3.0.30-prefix-stack.patch # 658572 - # disabled in 3.0.24: does not apply, while useful, rarely used if ever - # "${FILESDIR}"/${PN}-3.0.30-ebuildshell.patch # 155161 - "${FILESDIR}"/${PN}-3.0.30-interrevisions.patch # 832062 - ) - - distutils-r1_python_prepare_all - - sed -e "s:^VERSION = \"HEAD\"$:VERSION = \"${PV}\":" -i lib/portage/__init__.py || die - - if use gentoo-dev; then - einfo "Disabling --dynamic-deps by default for gentoo-dev..." - sed -e 's:\("--dynamic-deps", \)\("y"\):\1"n":' \ - -i lib/_emerge/create_depgraph_params.py || \ - die "failed to patch create_depgraph_params.py" - - einfo "Enabling additional FEATURES for gentoo-dev..." - echo 'FEATURES="${FEATURES} ipc-sandbox network-sandbox strict-keepdir"' \ - >> cnf/make.globals || die - fi - - if use native-extensions && ! tc-is-cross-compiler; then - printf "[build_ext]\nportage_ext_modules=true\n" >> \ - setup.cfg || die - fi - - if ! use ipc ; then - einfo "Disabling ipc..." - sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \ - -i lib/_emerge/AbstractEbuildProcess.py || \ - die "failed to patch AbstractEbuildProcess.py" - fi - - if use xattr && use kernel_linux ; then - einfo "Adding FEATURES=xattr to make.globals ..." - echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \ - || die "failed to append to make.globals" - fi - - if use build || ! use rsync-verify; then - sed -e '/^sync-rsync-verify-metamanifest/s|yes|no|' \ - -e '/^sync-webrsync-verify-signature/s|yes|no|' \ - -i cnf/repos.conf || die "sed failed" - fi - - if [[ -n ${EPREFIX} ]] ; then - # PREFIX LOCAL: only hack const_autotool - local extrapath="/usr/sbin:/usr/bin:/sbin:/bin" - # ok, we can't rely on PORTAGE_ROOT_USER being there yet, as people - # tend not to update that often, as long as we are a separate ebuild - # we can assume when unset, it's time for some older trick - if [[ -z ${PORTAGE_ROOT_USER} ]] ; then - PORTAGE_ROOT_USER=$(python -c 'from portage.const import rootuser; print rootuser') - fi - # We need to probe for bash in the Prefix, because it may not - # exist, in which case we fall back to the currently in use - # bash. This logic is necessary in particular during bootstrap, - # where we pull ourselves out of a temporary place with tools - local bash="${EPREFIX}/bin/bash" - [[ ! -x ${bash} ]] && bash=${BASH} - - einfo "Adjusting sources for ${EPREFIX}" - find . -type f -exec \ - sed -e "s|@PORTAGE_EPREFIX@|${EPREFIX}|" \ - -e "s|@PORTAGE_MV@|$(type -P mv)|" \ - -e "s|@PORTAGE_BASH@|${bash}|" \ - -e "s|@PREFIX_PORTAGE_PYTHON@|$(type -P python)|" \ - -e "s|@EXTRA_PATH@|${extrapath}|" \ - -e "s|@portagegroup@|${PORTAGE_GROUP:-portage}|" \ - -e "s|@portageuser@|${PORTAGE_USER:-portage}|" \ - -e "s|@rootuser@|${PORTAGE_ROOT_USER:-root}|" \ - -e "s|@rootuid@|$(id -u ${PORTAGE_ROOT_USER:-root})|" \ - -e "s|@rootgid@|$(id -g ${PORTAGE_ROOT_USER:-root})|" \ - -e "s|@sysconfdir@|${EPREFIX}/etc|" \ - -e "1s|/usr/bin/env |${EPREFIX}/usr/bin/|" \ - -i '{}' + || \ - die "Failed to patch sources" - # We don't need the below, since setup.py deals with this (and - # more) so we don't have to make this correct - # -e "s|@PORTAGE_BASE@|${EPREFIX}/usr/lib/portage/${EPYTHON}|" \ - - # remove Makefiles, or else they will get installed - find . -name "Makefile.*" -delete - - einfo "Prefixing shebangs ..." - find . -type f ! -name etc-update | \ - while read -r line; do - [[ -x ${line} || ${line} == *".py" ]] || continue; - local shebang=$(head -n1 "${line}") - if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; - then - sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "${line}" || \ - die "sed failed" - fi - done - - einfo "Setting gentoo_prefix as reponame for emerge-webrsync" - sed -i -e 's/repo_name=gentoo/repo_name=gentoo_prefix/' \ - bin/emerge-webrsync || die - - einfo "Making absent gemato non-fatal" - sed -i -e '/exitcode = 127/d' \ - lib/portage/sync/modules/rsync/rsync.py || die - # END PREFIX LOCAL - fi - - # PREFIX LOCAL: make.conf is written by bootstrap-prefix.sh - if use !prefix ; then - cd "${S}/cnf" || die - if [ -f "make.conf.example.${ARCH}".diff ]; then - patch make.conf.example "make.conf.example.${ARCH}".diff || \ - die "Failed to patch make.conf.example" - else - eerror "" - eerror "Portage does not have an arch-specific configuration for this arch." - eerror "Please notify the arch maintainer about this issue. Using generic." - eerror "" - fi - fi -} - -python_compile_all() { - local targets=() - use doc && targets+=( docbook ) - use apidoc && targets+=( apidoc ) - - if [[ ${targets[@]} ]]; then - esetup.py "${targets[@]}" - fi -} - -python_test() { - esetup.py test -} - -python_install() { - # Install sbin scripts to bindir for python-exec linking - # they will be relocated in pkg_preinst() - distutils-r1_python_install \ - --system-prefix="${EPREFIX}/usr" \ - --bindir="$(python_get_scriptdir)" \ - --docdir="${EPREFIX}/usr/share/doc/${PF}" \ - --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \ - --portage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}" \ - --sbindir="$(python_get_scriptdir)" \ - --sysconfdir="${EPREFIX}/etc" \ - "${@}" -} - -python_install_all() { - distutils-r1_python_install_all - - local targets=() - use doc && targets+=( - install_docbook - --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" - ) - use apidoc && targets+=( - install_apidoc - --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" - ) - - # install docs - if [[ ${targets[@]} ]]; then - esetup.py "${targets[@]}" - fi - - dotmpfiles "${FILESDIR}"/portage-ccache.conf - - # Due to distutils/python-exec limitations - # these must be installed to /usr/bin. - local sbin_relocations='archive-conf dispatch-conf emaint env-update etc-update fixpackages regenworld' - einfo "Moving admin scripts to the correct directory" - dodir /usr/sbin - for target in ${sbin_relocations}; do - einfo "Moving /usr/bin/${target} to /usr/sbin/${target}" - mv "${ED}/usr/bin/${target}" "${ED}/usr/sbin/${target}" || die "sbin scripts move failed!" - done -} - -pkg_preinst() { - if ! use build; then - python_setup - local sitedir=$(python_get_sitedir) - [[ -d ${D}${sitedir} ]] || die "${D}${sitedir}: No such directory" - env -u DISTDIR \ - -u PORTAGE_OVERRIDE_EPREFIX \ - -u PORTAGE_REPOSITORIES \ - -u PORTDIR \ - -u PORTDIR_OVERLAY \ - PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ - "${PYTHON}" -m portage._compat_upgrade.default_locations || die - - env -u BINPKG_COMPRESS -u PORTAGE_REPOSITORIES \ - PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ - "${PYTHON}" -m portage._compat_upgrade.binpkg_compression || die - - env -u FEATURES -u PORTAGE_REPOSITORIES \ - PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ - "${PYTHON}" -m portage._compat_upgrade.binpkg_multi_instance || die - fi - - # elog dir must exist to avoid logrotate error for bug #415911. - # This code runs in preinst in order to bypass the mapping of - # portage:portage to root:root which happens after src_install. - keepdir /var/log/portage/elog - # This is allowed to fail if the user/group are invalid for prefix users. - if chown ${PORTAGE_USER}:${PORTAGE_GROUP} "${ED}"/var/log/portage{,/elog} 2>/dev/null ; then - chmod g+s,ug+rwx "${ED}"/var/log/portage{,/elog} - fi - - if has_version "<${CATEGORY}/${PN}-2.3.77"; then - elog "The emerge --autounmask option is now disabled by default, except for" - elog "portions of behavior which are controlled by the --autounmask-use and" - elog "--autounmask-license options. For backward compatibility, previous" - elog "behavior of --autounmask=y and --autounmask=n is entirely preserved." - elog "Users can get the old behavior simply by adding --autounmask to the" - elog "make.conf EMERGE_DEFAULT_OPTS variable. For the rationale for this" - elog "change, see https://bugs.gentoo.org/658648." - fi -} diff --git a/sys-apps/portage/portage-3.0.56.ebuild b/sys-apps/portage/portage-3.0.56.ebuild new file mode 100644 index 0000000000..7f20a5531f --- /dev/null +++ b/sys-apps/portage/portage-3.0.56.ebuild @@ -0,0 +1,302 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( pypy3 python3_{10..12} ) +PYTHON_REQ_USE='bzip2(+),threads(+)' +TMPFILES_OPTIONAL=1 + +inherit meson linux-info multiprocessing python-r1 tmpfiles + +DESCRIPTION="The package management and distribution system for Gentoo Prefix" +HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage" + +if [[ ${PV} == 9999 ]] ; then + EGIT_REPO_URI=" + https://anongit.gentoo.org/git/proj/portage.git + https://github.com/gentoo/portage.git + " + inherit git-r3 +else + SRC_URI="https://dev.gentoo.org/~grobian/distfiles/prefix-${P}.tar.bz2" + KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" +fi + +LICENSE="GPL-2" +SLOT="0" +IUSE="apidoc build doc gentoo-dev +ipc +native-extensions +rsync-verify selinux test xattr" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" +RESTRICT="!test? ( test )" + +# setuptools is still needed as a workaround for Python 3.12+ for now. +# https://github.com/mesonbuild/meson/issues/7702 +# +# >=meson-1.2.1-r1 for bug #912051 +BDEPEND=" + ${PYTHON_DEPS} + >=dev-build/meson-1.2.1-r1 + $(python_gen_cond_dep ' + dev-python/setuptools[${PYTHON_USEDEP}] + ' python3_12) + test? ( + dev-python/pytest-xdist[${PYTHON_USEDEP}] + dev-vcs/git + ) +" +DEPEND=" + ${PYTHON_DEPS} + >=app-arch/tar-1.27 + dev-lang/python-exec:2 + >=sys-apps/sed-4.0.5 + sys-devel/patch + !build? ( $(python_gen_impl_dep 'ssl(+)') ) + apidoc? ( + dev-python/sphinx[${PYTHON_USEDEP}] + dev-python/sphinx-epytext[${PYTHON_USEDEP}] + ) + doc? ( + ~app-text/docbook-xml-dtd-4.4 + app-text/xmlto + ) +" +# Require sandbox-2.2 for bug #288863. +# For whirlpool hash, require python[ssl] (bug #425046). +RDEPEND=" + ${PYTHON_DEPS} + !prefix? ( acct-user/portage ) + >=app-arch/tar-1.27 + app-arch/zstd + >=app-misc/pax-utils-0.1.17 + dev-lang/python-exec:2 + >=sys-apps/baselayout-2.9 + >=sys-apps/findutils-4.9 + !build? ( + >=app-admin/eselect-1.2 + !prefix? ( app-portage/getuto ) + >=app-shells/bash-5.0:0 + >=sec-keys/openpgp-keys-gentoo-release-20230329 + >=sys-apps/sed-4.0.5 + rsync-verify? ( + >=app-crypt/gnupg-2.2.4-r2[ssl(-)] + >=app-portage/gemato-14.5[${PYTHON_USEDEP}] + ) + ) + elibc_glibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) ) + elibc_musl? ( !prefix? ( >=sys-apps/sandbox-2.2 ) ) + kernel_linux? ( sys-apps/util-linux ) + selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] ) + xattr? ( kernel_linux? ( + >=sys-apps/install-xattr-0.3 + ) ) + !<app-admin/logrotate-3.8.0 + !<app-portage/gentoolkit-0.4.6 + !<app-portage/repoman-2.3.10 + !~app-portage/repoman-3.0.0 +" +# coreutils-6.4 rdep is for date format in emerge-webrsync #164532 +# NOTE: FEATURES=installsources requires debugedit and rsync +PDEPEND=" + !build? ( + >=net-misc/rsync-2.6.4 + >=sys-apps/coreutils-6.4 + >=sys-apps/file-5.44-r3 + ) +" + +S="${WORKDIR}"/prefix-${P} + +PATCHES=( + "${FILESDIR}"/${PN}-3.0.55.1-interrevisions.patch +) + +pkg_pretend() { + local CONFIG_CHECK="~IPC_NS ~PID_NS ~NET_NS ~UTS_NS" + + check_extra_config +} + +src_prepare() { + default + + if use prefix-guest; then + sed -e "s|^\(main-repo = \).*|\\1gentoo_prefix|" \ + -e "s|^\\[gentoo\\]|[gentoo_prefix]|" \ + -e "s|^\(sync-uri = \).*|\\1rsync://rsync.prefix.bitzolder.nl/gentoo-portage-prefix|" \ + -i cnf/repos.conf || die "sed failed" + + # PREFIX LOCAL: only hack const_autotool + # ok, we can't rely on PORTAGE_ROOT_USER being there yet, as people + # tend not to update that often, as long as we are a separate ebuild + # we can assume when unset, it's time for some older trick + if [[ -z ${PORTAGE_ROOT_USER} ]] ; then + PORTAGE_ROOT_USER=$(python -c 'from portage.const import rootuser; print rootuser') + fi + # We need to probe for bash in the Prefix, because it may not + # exist, in which case we fall back to the currently in use + # bash. This logic is necessary in particular during bootstrap, + # where we pull ourselves out of a temporary place with tools + local bash="${EPREFIX}/bin/bash" + [[ ! -x ${bash} ]] && bash=${BASH} + + einfo "Adjusting sources for ${EPREFIX}" + sed -e "s|@PORTAGE_EPREFIX@|${EPREFIX}|" \ + -e "s|@PORTAGE_MV@|$(type -P mv)|" \ + -e "s|@PORTAGE_BASH@|${bash}|" \ + -e "s|@portagegroup@|${PORTAGE_GROUP:-portage}|" \ + -e "s|@portageuser@|${PORTAGE_USER:-portage}|" \ + -e "s|@rootuser@|${PORTAGE_ROOT_USER:-root}|" \ + -e "s|@rootuid@|$(id -u ${PORTAGE_ROOT_USER:-root})|" \ + -e "s|@rootgid@|$(id -g ${PORTAGE_ROOT_USER:-root})|" \ + -e "s|@sysconfdir@|${EPREFIX}/etc|" \ + -i \ + lib/portage/const_autotool.py cnf/make.globals \ + || die "Failed to patch sources" + + sed -e "s|@PREFIX_PORTAGE_PYTHON@|$(type -P python)|" \ + -i \ + bin/ebuild-helpers/dohtml bin/ebuild-pyhelper \ + bin/misc-functions.sh bin/phase-functions.sh \ + || die "Failed to patch sources" + + # remove Makefiles, or else they will get installed + #find . -name "Makefile.*" -delete + +# einfo "Prefixing shebangs ..." +# find . -type f ! -name etc-update | \ +# while read -r line; do +# [[ -x ${line} || ${line} == *".py" ]] || continue; +# local shebang=$(head -n1 "${line}") +# if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; +# then +# sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "${line}" || \ +# die "sed failed" +# fi +# done + + einfo "Setting gentoo_prefix as reponame for emerge-webrsync" + sed -i -e 's/repo_name=gentoo/repo_name=gentoo_prefix/' \ + bin/emerge-webrsync || die + + einfo "Making absent gemato non-fatal" + sed -i -e '/exitcode = 127/d' \ + lib/portage/sync/modules/rsync/rsync.py || die + # END PREFIX LOCAL + fi +} + +src_configure() { + local code_only=false + python_foreach_impl my_src_configure +} + +my_src_configure() { + local emesonargs=( + -Dcode-only=${code_only} + -Deprefix="${EPREFIX}" + -Dportage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}" + -Ddocdir="${EPREFIX}/usr/share/doc/${PF}" + $(meson_use doc) + $(meson_use apidoc) + $(meson_use gentoo-dev) + $(meson_use ipc) + $(meson_use xattr) + ) + + if use native-extensions && [[ "${EPYTHON}" != "pypy3" ]] ; then + emesonargs+=( -Dnative-extensions=true ) + else + emesonargs+=( -Dnative-extensions=false ) + fi + + if use build; then + emesonargs+=( -Drsync-verify=false ) + else + emesonargs+=( $(meson_use rsync-verify) ) + fi + + meson_src_configure + code_only=true +} + +src_compile() { + python_foreach_impl meson_src_compile +} + +src_test() { + local -x PYTEST_ADDOPTS="-vv -ra -l -o console_output_style=count -n $(makeopts_jobs) --dist=worksteal" + + python_foreach_impl meson_src_test --no-rebuild --verbose +} + +src_install() { + python_foreach_impl my_src_install + dotmpfiles "${FILESDIR}"/portage-{ccache,tmpdir}.conf + + local scripts + mapfile -t scripts < <(awk '/^#!.*python/ {print FILENAME} {nextfile}' "${ED}"/usr/{bin,sbin}/* || die) + python_replicate_script "${scripts[@]}" +} + +my_src_install() { + local pydirs=( + "${D}$(python_get_sitedir)" + "${ED}/usr/lib/portage/${EPYTHON}" + ) + + meson_src_install + python_optimize "${pydirs[@]}" + python_fix_shebang "${pydirs[@]}" +} + +pkg_preinst() { + if ! use build && [[ -z ${ROOT} ]]; then + python_setup + local sitedir=$(python_get_sitedir) + [[ -d ${D}${sitedir} ]] || die "${D}${sitedir}: No such directory" + env -u DISTDIR \ + -u PORTAGE_OVERRIDE_EPREFIX \ + -u PORTAGE_REPOSITORIES \ + -u PORTDIR \ + -u PORTDIR_OVERLAY \ + PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ + "${PYTHON}" -m portage._compat_upgrade.default_locations || die + + env -u BINPKG_COMPRESS -u PORTAGE_REPOSITORIES \ + PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ + "${PYTHON}" -m portage._compat_upgrade.binpkg_compression || die + + env -u FEATURES -u PORTAGE_REPOSITORIES \ + PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ + "${PYTHON}" -m portage._compat_upgrade.binpkg_multi_instance || die + fi + + # elog dir must exist to avoid logrotate error for bug #415911. + # This code runs in preinst in order to bypass the mapping of + # portage:portage to root:root which happens after src_install. + keepdir /var/log/portage/elog + # This is allowed to fail if the user/group are invalid for prefix users. + if chown portage:portage "${ED}"/var/log/portage{,/elog} 2>/dev/null ; then + chmod g+s,ug+rwx "${ED}"/var/log/portage{,/elog} + fi + + if has_version "<${CATEGORY}/${PN}-2.3.77"; then + elog "The emerge --autounmask option is now disabled by default, except for" + elog "portions of behavior which are controlled by the --autounmask-use and" + elog "--autounmask-license options. For backward compatibility, previous" + elog "behavior of --autounmask=y and --autounmask=n is entirely preserved." + elog "Users can get the old behavior simply by adding --autounmask to the" + elog "make.conf EMERGE_DEFAULT_OPTS variable. For the rationale for this" + elog "change, see https://bugs.gentoo.org/658648." + fi +} + +pkg_postinst() { + # Warn about obsolete "enotice" script, bug #867010 + local bashrc=${EROOT}/etc/portage/profile/profile.bashrc + if [[ -e ${bashrc} ]] && grep -q enotice "${bashrc}"; then + eerror "Obsolete 'enotice' script detected!" + eerror "Please remove this from ${bashrc} to avoid problems." + eerror "See bug 867010 for more details." + fi +} diff --git a/sys-apps/portage/portage-3.0.62.ebuild b/sys-apps/portage/portage-3.0.62.ebuild new file mode 100644 index 0000000000..7f20a5531f --- /dev/null +++ b/sys-apps/portage/portage-3.0.62.ebuild @@ -0,0 +1,302 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( pypy3 python3_{10..12} ) +PYTHON_REQ_USE='bzip2(+),threads(+)' +TMPFILES_OPTIONAL=1 + +inherit meson linux-info multiprocessing python-r1 tmpfiles + +DESCRIPTION="The package management and distribution system for Gentoo Prefix" +HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage" + +if [[ ${PV} == 9999 ]] ; then + EGIT_REPO_URI=" + https://anongit.gentoo.org/git/proj/portage.git + https://github.com/gentoo/portage.git + " + inherit git-r3 +else + SRC_URI="https://dev.gentoo.org/~grobian/distfiles/prefix-${P}.tar.bz2" + KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" +fi + +LICENSE="GPL-2" +SLOT="0" +IUSE="apidoc build doc gentoo-dev +ipc +native-extensions +rsync-verify selinux test xattr" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" +RESTRICT="!test? ( test )" + +# setuptools is still needed as a workaround for Python 3.12+ for now. +# https://github.com/mesonbuild/meson/issues/7702 +# +# >=meson-1.2.1-r1 for bug #912051 +BDEPEND=" + ${PYTHON_DEPS} + >=dev-build/meson-1.2.1-r1 + $(python_gen_cond_dep ' + dev-python/setuptools[${PYTHON_USEDEP}] + ' python3_12) + test? ( + dev-python/pytest-xdist[${PYTHON_USEDEP}] + dev-vcs/git + ) +" +DEPEND=" + ${PYTHON_DEPS} + >=app-arch/tar-1.27 + dev-lang/python-exec:2 + >=sys-apps/sed-4.0.5 + sys-devel/patch + !build? ( $(python_gen_impl_dep 'ssl(+)') ) + apidoc? ( + dev-python/sphinx[${PYTHON_USEDEP}] + dev-python/sphinx-epytext[${PYTHON_USEDEP}] + ) + doc? ( + ~app-text/docbook-xml-dtd-4.4 + app-text/xmlto + ) +" +# Require sandbox-2.2 for bug #288863. +# For whirlpool hash, require python[ssl] (bug #425046). +RDEPEND=" + ${PYTHON_DEPS} + !prefix? ( acct-user/portage ) + >=app-arch/tar-1.27 + app-arch/zstd + >=app-misc/pax-utils-0.1.17 + dev-lang/python-exec:2 + >=sys-apps/baselayout-2.9 + >=sys-apps/findutils-4.9 + !build? ( + >=app-admin/eselect-1.2 + !prefix? ( app-portage/getuto ) + >=app-shells/bash-5.0:0 + >=sec-keys/openpgp-keys-gentoo-release-20230329 + >=sys-apps/sed-4.0.5 + rsync-verify? ( + >=app-crypt/gnupg-2.2.4-r2[ssl(-)] + >=app-portage/gemato-14.5[${PYTHON_USEDEP}] + ) + ) + elibc_glibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) ) + elibc_musl? ( !prefix? ( >=sys-apps/sandbox-2.2 ) ) + kernel_linux? ( sys-apps/util-linux ) + selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] ) + xattr? ( kernel_linux? ( + >=sys-apps/install-xattr-0.3 + ) ) + !<app-admin/logrotate-3.8.0 + !<app-portage/gentoolkit-0.4.6 + !<app-portage/repoman-2.3.10 + !~app-portage/repoman-3.0.0 +" +# coreutils-6.4 rdep is for date format in emerge-webrsync #164532 +# NOTE: FEATURES=installsources requires debugedit and rsync +PDEPEND=" + !build? ( + >=net-misc/rsync-2.6.4 + >=sys-apps/coreutils-6.4 + >=sys-apps/file-5.44-r3 + ) +" + +S="${WORKDIR}"/prefix-${P} + +PATCHES=( + "${FILESDIR}"/${PN}-3.0.55.1-interrevisions.patch +) + +pkg_pretend() { + local CONFIG_CHECK="~IPC_NS ~PID_NS ~NET_NS ~UTS_NS" + + check_extra_config +} + +src_prepare() { + default + + if use prefix-guest; then + sed -e "s|^\(main-repo = \).*|\\1gentoo_prefix|" \ + -e "s|^\\[gentoo\\]|[gentoo_prefix]|" \ + -e "s|^\(sync-uri = \).*|\\1rsync://rsync.prefix.bitzolder.nl/gentoo-portage-prefix|" \ + -i cnf/repos.conf || die "sed failed" + + # PREFIX LOCAL: only hack const_autotool + # ok, we can't rely on PORTAGE_ROOT_USER being there yet, as people + # tend not to update that often, as long as we are a separate ebuild + # we can assume when unset, it's time for some older trick + if [[ -z ${PORTAGE_ROOT_USER} ]] ; then + PORTAGE_ROOT_USER=$(python -c 'from portage.const import rootuser; print rootuser') + fi + # We need to probe for bash in the Prefix, because it may not + # exist, in which case we fall back to the currently in use + # bash. This logic is necessary in particular during bootstrap, + # where we pull ourselves out of a temporary place with tools + local bash="${EPREFIX}/bin/bash" + [[ ! -x ${bash} ]] && bash=${BASH} + + einfo "Adjusting sources for ${EPREFIX}" + sed -e "s|@PORTAGE_EPREFIX@|${EPREFIX}|" \ + -e "s|@PORTAGE_MV@|$(type -P mv)|" \ + -e "s|@PORTAGE_BASH@|${bash}|" \ + -e "s|@portagegroup@|${PORTAGE_GROUP:-portage}|" \ + -e "s|@portageuser@|${PORTAGE_USER:-portage}|" \ + -e "s|@rootuser@|${PORTAGE_ROOT_USER:-root}|" \ + -e "s|@rootuid@|$(id -u ${PORTAGE_ROOT_USER:-root})|" \ + -e "s|@rootgid@|$(id -g ${PORTAGE_ROOT_USER:-root})|" \ + -e "s|@sysconfdir@|${EPREFIX}/etc|" \ + -i \ + lib/portage/const_autotool.py cnf/make.globals \ + || die "Failed to patch sources" + + sed -e "s|@PREFIX_PORTAGE_PYTHON@|$(type -P python)|" \ + -i \ + bin/ebuild-helpers/dohtml bin/ebuild-pyhelper \ + bin/misc-functions.sh bin/phase-functions.sh \ + || die "Failed to patch sources" + + # remove Makefiles, or else they will get installed + #find . -name "Makefile.*" -delete + +# einfo "Prefixing shebangs ..." +# find . -type f ! -name etc-update | \ +# while read -r line; do +# [[ -x ${line} || ${line} == *".py" ]] || continue; +# local shebang=$(head -n1 "${line}") +# if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; +# then +# sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "${line}" || \ +# die "sed failed" +# fi +# done + + einfo "Setting gentoo_prefix as reponame for emerge-webrsync" + sed -i -e 's/repo_name=gentoo/repo_name=gentoo_prefix/' \ + bin/emerge-webrsync || die + + einfo "Making absent gemato non-fatal" + sed -i -e '/exitcode = 127/d' \ + lib/portage/sync/modules/rsync/rsync.py || die + # END PREFIX LOCAL + fi +} + +src_configure() { + local code_only=false + python_foreach_impl my_src_configure +} + +my_src_configure() { + local emesonargs=( + -Dcode-only=${code_only} + -Deprefix="${EPREFIX}" + -Dportage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}" + -Ddocdir="${EPREFIX}/usr/share/doc/${PF}" + $(meson_use doc) + $(meson_use apidoc) + $(meson_use gentoo-dev) + $(meson_use ipc) + $(meson_use xattr) + ) + + if use native-extensions && [[ "${EPYTHON}" != "pypy3" ]] ; then + emesonargs+=( -Dnative-extensions=true ) + else + emesonargs+=( -Dnative-extensions=false ) + fi + + if use build; then + emesonargs+=( -Drsync-verify=false ) + else + emesonargs+=( $(meson_use rsync-verify) ) + fi + + meson_src_configure + code_only=true +} + +src_compile() { + python_foreach_impl meson_src_compile +} + +src_test() { + local -x PYTEST_ADDOPTS="-vv -ra -l -o console_output_style=count -n $(makeopts_jobs) --dist=worksteal" + + python_foreach_impl meson_src_test --no-rebuild --verbose +} + +src_install() { + python_foreach_impl my_src_install + dotmpfiles "${FILESDIR}"/portage-{ccache,tmpdir}.conf + + local scripts + mapfile -t scripts < <(awk '/^#!.*python/ {print FILENAME} {nextfile}' "${ED}"/usr/{bin,sbin}/* || die) + python_replicate_script "${scripts[@]}" +} + +my_src_install() { + local pydirs=( + "${D}$(python_get_sitedir)" + "${ED}/usr/lib/portage/${EPYTHON}" + ) + + meson_src_install + python_optimize "${pydirs[@]}" + python_fix_shebang "${pydirs[@]}" +} + +pkg_preinst() { + if ! use build && [[ -z ${ROOT} ]]; then + python_setup + local sitedir=$(python_get_sitedir) + [[ -d ${D}${sitedir} ]] || die "${D}${sitedir}: No such directory" + env -u DISTDIR \ + -u PORTAGE_OVERRIDE_EPREFIX \ + -u PORTAGE_REPOSITORIES \ + -u PORTDIR \ + -u PORTDIR_OVERLAY \ + PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ + "${PYTHON}" -m portage._compat_upgrade.default_locations || die + + env -u BINPKG_COMPRESS -u PORTAGE_REPOSITORIES \ + PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ + "${PYTHON}" -m portage._compat_upgrade.binpkg_compression || die + + env -u FEATURES -u PORTAGE_REPOSITORIES \ + PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ + "${PYTHON}" -m portage._compat_upgrade.binpkg_multi_instance || die + fi + + # elog dir must exist to avoid logrotate error for bug #415911. + # This code runs in preinst in order to bypass the mapping of + # portage:portage to root:root which happens after src_install. + keepdir /var/log/portage/elog + # This is allowed to fail if the user/group are invalid for prefix users. + if chown portage:portage "${ED}"/var/log/portage{,/elog} 2>/dev/null ; then + chmod g+s,ug+rwx "${ED}"/var/log/portage{,/elog} + fi + + if has_version "<${CATEGORY}/${PN}-2.3.77"; then + elog "The emerge --autounmask option is now disabled by default, except for" + elog "portions of behavior which are controlled by the --autounmask-use and" + elog "--autounmask-license options. For backward compatibility, previous" + elog "behavior of --autounmask=y and --autounmask=n is entirely preserved." + elog "Users can get the old behavior simply by adding --autounmask to the" + elog "make.conf EMERGE_DEFAULT_OPTS variable. For the rationale for this" + elog "change, see https://bugs.gentoo.org/658648." + fi +} + +pkg_postinst() { + # Warn about obsolete "enotice" script, bug #867010 + local bashrc=${EROOT}/etc/portage/profile/profile.bashrc + if [[ -e ${bashrc} ]] && grep -q enotice "${bashrc}"; then + eerror "Obsolete 'enotice' script detected!" + eerror "Please remove this from ${bashrc} to avoid problems." + eerror "See bug 867010 for more details." + fi +} diff --git a/sys-apps/portage/portage-3.0.63.ebuild b/sys-apps/portage/portage-3.0.63.ebuild new file mode 100644 index 0000000000..7f20a5531f --- /dev/null +++ b/sys-apps/portage/portage-3.0.63.ebuild @@ -0,0 +1,302 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( pypy3 python3_{10..12} ) +PYTHON_REQ_USE='bzip2(+),threads(+)' +TMPFILES_OPTIONAL=1 + +inherit meson linux-info multiprocessing python-r1 tmpfiles + +DESCRIPTION="The package management and distribution system for Gentoo Prefix" +HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage" + +if [[ ${PV} == 9999 ]] ; then + EGIT_REPO_URI=" + https://anongit.gentoo.org/git/proj/portage.git + https://github.com/gentoo/portage.git + " + inherit git-r3 +else + SRC_URI="https://dev.gentoo.org/~grobian/distfiles/prefix-${P}.tar.bz2" + KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" +fi + +LICENSE="GPL-2" +SLOT="0" +IUSE="apidoc build doc gentoo-dev +ipc +native-extensions +rsync-verify selinux test xattr" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" +RESTRICT="!test? ( test )" + +# setuptools is still needed as a workaround for Python 3.12+ for now. +# https://github.com/mesonbuild/meson/issues/7702 +# +# >=meson-1.2.1-r1 for bug #912051 +BDEPEND=" + ${PYTHON_DEPS} + >=dev-build/meson-1.2.1-r1 + $(python_gen_cond_dep ' + dev-python/setuptools[${PYTHON_USEDEP}] + ' python3_12) + test? ( + dev-python/pytest-xdist[${PYTHON_USEDEP}] + dev-vcs/git + ) +" +DEPEND=" + ${PYTHON_DEPS} + >=app-arch/tar-1.27 + dev-lang/python-exec:2 + >=sys-apps/sed-4.0.5 + sys-devel/patch + !build? ( $(python_gen_impl_dep 'ssl(+)') ) + apidoc? ( + dev-python/sphinx[${PYTHON_USEDEP}] + dev-python/sphinx-epytext[${PYTHON_USEDEP}] + ) + doc? ( + ~app-text/docbook-xml-dtd-4.4 + app-text/xmlto + ) +" +# Require sandbox-2.2 for bug #288863. +# For whirlpool hash, require python[ssl] (bug #425046). +RDEPEND=" + ${PYTHON_DEPS} + !prefix? ( acct-user/portage ) + >=app-arch/tar-1.27 + app-arch/zstd + >=app-misc/pax-utils-0.1.17 + dev-lang/python-exec:2 + >=sys-apps/baselayout-2.9 + >=sys-apps/findutils-4.9 + !build? ( + >=app-admin/eselect-1.2 + !prefix? ( app-portage/getuto ) + >=app-shells/bash-5.0:0 + >=sec-keys/openpgp-keys-gentoo-release-20230329 + >=sys-apps/sed-4.0.5 + rsync-verify? ( + >=app-crypt/gnupg-2.2.4-r2[ssl(-)] + >=app-portage/gemato-14.5[${PYTHON_USEDEP}] + ) + ) + elibc_glibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) ) + elibc_musl? ( !prefix? ( >=sys-apps/sandbox-2.2 ) ) + kernel_linux? ( sys-apps/util-linux ) + selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] ) + xattr? ( kernel_linux? ( + >=sys-apps/install-xattr-0.3 + ) ) + !<app-admin/logrotate-3.8.0 + !<app-portage/gentoolkit-0.4.6 + !<app-portage/repoman-2.3.10 + !~app-portage/repoman-3.0.0 +" +# coreutils-6.4 rdep is for date format in emerge-webrsync #164532 +# NOTE: FEATURES=installsources requires debugedit and rsync +PDEPEND=" + !build? ( + >=net-misc/rsync-2.6.4 + >=sys-apps/coreutils-6.4 + >=sys-apps/file-5.44-r3 + ) +" + +S="${WORKDIR}"/prefix-${P} + +PATCHES=( + "${FILESDIR}"/${PN}-3.0.55.1-interrevisions.patch +) + +pkg_pretend() { + local CONFIG_CHECK="~IPC_NS ~PID_NS ~NET_NS ~UTS_NS" + + check_extra_config +} + +src_prepare() { + default + + if use prefix-guest; then + sed -e "s|^\(main-repo = \).*|\\1gentoo_prefix|" \ + -e "s|^\\[gentoo\\]|[gentoo_prefix]|" \ + -e "s|^\(sync-uri = \).*|\\1rsync://rsync.prefix.bitzolder.nl/gentoo-portage-prefix|" \ + -i cnf/repos.conf || die "sed failed" + + # PREFIX LOCAL: only hack const_autotool + # ok, we can't rely on PORTAGE_ROOT_USER being there yet, as people + # tend not to update that often, as long as we are a separate ebuild + # we can assume when unset, it's time for some older trick + if [[ -z ${PORTAGE_ROOT_USER} ]] ; then + PORTAGE_ROOT_USER=$(python -c 'from portage.const import rootuser; print rootuser') + fi + # We need to probe for bash in the Prefix, because it may not + # exist, in which case we fall back to the currently in use + # bash. This logic is necessary in particular during bootstrap, + # where we pull ourselves out of a temporary place with tools + local bash="${EPREFIX}/bin/bash" + [[ ! -x ${bash} ]] && bash=${BASH} + + einfo "Adjusting sources for ${EPREFIX}" + sed -e "s|@PORTAGE_EPREFIX@|${EPREFIX}|" \ + -e "s|@PORTAGE_MV@|$(type -P mv)|" \ + -e "s|@PORTAGE_BASH@|${bash}|" \ + -e "s|@portagegroup@|${PORTAGE_GROUP:-portage}|" \ + -e "s|@portageuser@|${PORTAGE_USER:-portage}|" \ + -e "s|@rootuser@|${PORTAGE_ROOT_USER:-root}|" \ + -e "s|@rootuid@|$(id -u ${PORTAGE_ROOT_USER:-root})|" \ + -e "s|@rootgid@|$(id -g ${PORTAGE_ROOT_USER:-root})|" \ + -e "s|@sysconfdir@|${EPREFIX}/etc|" \ + -i \ + lib/portage/const_autotool.py cnf/make.globals \ + || die "Failed to patch sources" + + sed -e "s|@PREFIX_PORTAGE_PYTHON@|$(type -P python)|" \ + -i \ + bin/ebuild-helpers/dohtml bin/ebuild-pyhelper \ + bin/misc-functions.sh bin/phase-functions.sh \ + || die "Failed to patch sources" + + # remove Makefiles, or else they will get installed + #find . -name "Makefile.*" -delete + +# einfo "Prefixing shebangs ..." +# find . -type f ! -name etc-update | \ +# while read -r line; do +# [[ -x ${line} || ${line} == *".py" ]] || continue; +# local shebang=$(head -n1 "${line}") +# if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; +# then +# sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "${line}" || \ +# die "sed failed" +# fi +# done + + einfo "Setting gentoo_prefix as reponame for emerge-webrsync" + sed -i -e 's/repo_name=gentoo/repo_name=gentoo_prefix/' \ + bin/emerge-webrsync || die + + einfo "Making absent gemato non-fatal" + sed -i -e '/exitcode = 127/d' \ + lib/portage/sync/modules/rsync/rsync.py || die + # END PREFIX LOCAL + fi +} + +src_configure() { + local code_only=false + python_foreach_impl my_src_configure +} + +my_src_configure() { + local emesonargs=( + -Dcode-only=${code_only} + -Deprefix="${EPREFIX}" + -Dportage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}" + -Ddocdir="${EPREFIX}/usr/share/doc/${PF}" + $(meson_use doc) + $(meson_use apidoc) + $(meson_use gentoo-dev) + $(meson_use ipc) + $(meson_use xattr) + ) + + if use native-extensions && [[ "${EPYTHON}" != "pypy3" ]] ; then + emesonargs+=( -Dnative-extensions=true ) + else + emesonargs+=( -Dnative-extensions=false ) + fi + + if use build; then + emesonargs+=( -Drsync-verify=false ) + else + emesonargs+=( $(meson_use rsync-verify) ) + fi + + meson_src_configure + code_only=true +} + +src_compile() { + python_foreach_impl meson_src_compile +} + +src_test() { + local -x PYTEST_ADDOPTS="-vv -ra -l -o console_output_style=count -n $(makeopts_jobs) --dist=worksteal" + + python_foreach_impl meson_src_test --no-rebuild --verbose +} + +src_install() { + python_foreach_impl my_src_install + dotmpfiles "${FILESDIR}"/portage-{ccache,tmpdir}.conf + + local scripts + mapfile -t scripts < <(awk '/^#!.*python/ {print FILENAME} {nextfile}' "${ED}"/usr/{bin,sbin}/* || die) + python_replicate_script "${scripts[@]}" +} + +my_src_install() { + local pydirs=( + "${D}$(python_get_sitedir)" + "${ED}/usr/lib/portage/${EPYTHON}" + ) + + meson_src_install + python_optimize "${pydirs[@]}" + python_fix_shebang "${pydirs[@]}" +} + +pkg_preinst() { + if ! use build && [[ -z ${ROOT} ]]; then + python_setup + local sitedir=$(python_get_sitedir) + [[ -d ${D}${sitedir} ]] || die "${D}${sitedir}: No such directory" + env -u DISTDIR \ + -u PORTAGE_OVERRIDE_EPREFIX \ + -u PORTAGE_REPOSITORIES \ + -u PORTDIR \ + -u PORTDIR_OVERLAY \ + PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ + "${PYTHON}" -m portage._compat_upgrade.default_locations || die + + env -u BINPKG_COMPRESS -u PORTAGE_REPOSITORIES \ + PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ + "${PYTHON}" -m portage._compat_upgrade.binpkg_compression || die + + env -u FEATURES -u PORTAGE_REPOSITORIES \ + PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \ + "${PYTHON}" -m portage._compat_upgrade.binpkg_multi_instance || die + fi + + # elog dir must exist to avoid logrotate error for bug #415911. + # This code runs in preinst in order to bypass the mapping of + # portage:portage to root:root which happens after src_install. + keepdir /var/log/portage/elog + # This is allowed to fail if the user/group are invalid for prefix users. + if chown portage:portage "${ED}"/var/log/portage{,/elog} 2>/dev/null ; then + chmod g+s,ug+rwx "${ED}"/var/log/portage{,/elog} + fi + + if has_version "<${CATEGORY}/${PN}-2.3.77"; then + elog "The emerge --autounmask option is now disabled by default, except for" + elog "portions of behavior which are controlled by the --autounmask-use and" + elog "--autounmask-license options. For backward compatibility, previous" + elog "behavior of --autounmask=y and --autounmask=n is entirely preserved." + elog "Users can get the old behavior simply by adding --autounmask to the" + elog "make.conf EMERGE_DEFAULT_OPTS variable. For the rationale for this" + elog "change, see https://bugs.gentoo.org/658648." + fi +} + +pkg_postinst() { + # Warn about obsolete "enotice" script, bug #867010 + local bashrc=${EROOT}/etc/portage/profile/profile.bashrc + if [[ -e ${bashrc} ]] && grep -q enotice "${bashrc}"; then + eerror "Obsolete 'enotice' script detected!" + eerror "Please remove this from ${bashrc} to avoid problems." + eerror "See bug 867010 for more details." + fi +} diff --git a/sys-apps/sed/Manifest b/sys-apps/sed/Manifest index 526fe0062a..adc5a58b94 100644 --- a/sys-apps/sed/Manifest +++ b/sys-apps/sed/Manifest @@ -1 +1,3 @@ DIST sed-4.8.tar.xz 1348048 BLAKE2B 62f6b6500cc9a20a35cafc2b09b12bb7da67fa0afb0b1b26153babc0023424b3126f44d29eba14c25fc4490996c90738b191c9440c66da6c120bbb9bc6f6df65 SHA512 7de25d9bc2981c63321c2223f3fbcab61d7b0df4fcf7d4394b72400b91993e1288d8bf53948ed5fffcf5a98c75265726a68ad4fb98e1d571bf768603a108c1c8 +DIST sed-4.9.tar.xz 1397092 BLAKE2B 6c7c7dc782b87c3bd0b5e826ba46c2f1dc7bd8c1159945fcf14b394711742964628774cf9f27d844b672721d7849e6c31992d82fafb9ed4118b7feb60406d1e1 SHA512 36157a4b4a2430cf421b7bd07f1675d680d9f1616be96cf6ad6ee74a9ec0fe695f8d0b1e1f0b008bbb33cc7fcde5e1c456359bbbc63f8aebdd4fedc3982cf6dc +DIST sed-4.9.tar.xz.sig 833 BLAKE2B 256bb112aa3aec1a8d40544ef1b0a7570f35d66369047ed3d261c57f938042dcb4a169137eaed6639bcfb472e4a6fc6ebec2de243b2c4d4c0ba0e9081f92556d SHA512 ceb235850184b99017783486e182ade9db38313d20b2b34d23f54d8affe180f7a191139b993e8ec7718ca33eff732f547ca4b3b59aaf865feaae611dfeae5c46 diff --git a/sys-apps/sed/sed-4.8.ebuild b/sys-apps/sed/sed-4.8.ebuild index dbdacab155..dde39ac29c 100644 --- a/sys-apps/sed/sed-4.8.ebuild +++ b/sys-apps/sed/sed-4.8.ebuild @@ -11,7 +11,7 @@ SRC_URI="mirror://gnu/sed/${P}.tar.xz" LICENSE="GPL-3" SLOT="0" -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" IUSE="acl forced-sandbox nls selinux static" RDEPEND=" diff --git a/sys-apps/sed/sed-4.9.ebuild b/sys-apps/sed/sed-4.9.ebuild new file mode 100644 index 0000000000..c1c7e41d8f --- /dev/null +++ b/sys-apps/sed/sed-4.9.ebuild @@ -0,0 +1,65 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/sed.asc +inherit flag-o-matic verify-sig + +DESCRIPTION="Super-useful stream editor" +HOMEPAGE="https://www.gnu.org/software/sed/" +SRC_URI="mirror://gnu/sed/${P}.tar.xz" +SRC_URI+=" verify-sig? ( mirror://gnu/sed/${P}.tar.xz.sig )" + +LICENSE="GPL-3+" +SLOT="0" +KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" +IUSE="acl nls selinux static" + +RDEPEND=" + !static? ( + acl? ( virtual/acl ) + nls? ( virtual/libintl ) + selinux? ( sys-libs/libselinux ) + ) +" +DEPEND="${RDEPEND} + static? ( + acl? ( virtual/acl[static-libs(+)] ) + nls? ( virtual/libintl[static-libs(+)] ) + selinux? ( sys-libs/libselinux[static-libs(+)] ) + ) +" +BDEPEND="nls? ( sys-devel/gettext ) + verify-sig? ( sec-keys/openpgp-keys-sed )" + +src_configure() { + use static && append-ldflags -static + + local myconf=( + --exec-prefix="${EPREFIX}" + $(use_enable acl) + $(use_enable nls) + $(use_with selinux) + # rename to gsed for better BSD compatibility + --program-prefix=g + ) + econf "${myconf[@]}" +} + +src_test() { + # We don't want to automagically use Valgrind for tests. + sed -i -e 's:valgrind --error-exitcode=1:false:' init.cfg || die + + emake VERBOSE=yes check +} + +src_install() { + default + # don't want charset.alias, installed by libiconv + rm -f "${ED}"/lib/charset.alias + + # symlink to the standard name + dosym gsed /bin/sed + dosym gsed.1 /usr/share/man/man1/sed.1 +} diff --git a/sys-devel/binutils-config/binutils-config-5.1-r5.ebuild b/sys-devel/binutils-config/binutils-config-5.1-r12.ebuild index 36bc85a317..38f82d40b5 100644 --- a/sys-devel/binutils-config/binutils-config-5.1-r5.ebuild +++ b/sys-devel/binutils-config/binutils-config-5.1-r12.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=6 @@ -7,13 +7,12 @@ inherit eutils prefix DESCRIPTION="Utility to change the binutils version being used" HOMEPAGE="https://www.gentoo.org/" -GIT_REV="edc0d44f70c27daebcc080ac5d08e8e191bccd95" WRAPPER_REV="${PV%%.*}.3.4" #SRC_URI="https://gitweb.gentoo.org/repo/proj/prefix.git/plain/sys-devel/binutils-config/files/ldwrapper.c?id=${GIT_REV} -> ${PN}-ldwrapper-${WRAPPER_REV}.c" LICENSE="GPL-2" SLOT="0" -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" IUSE="" # We also RDEPEND on sys-apps/findutils which is in base @system @@ -40,12 +39,8 @@ src_configure() { src_compile() { use prefix-guest || return local extraargs=( ) - if [[ ${CHOST} == *-darwin* && ${CHOST##*-darwin} -ge 20 ]] ; then - # macOS Big Sur has an empty /usr/lib, so the linker really has - # to look into the SDK, for which it needs to be told where it - # is (symlinked right into our EPREFIX root as MacOSX.sdk) + if [[ ${CHOST} == *-darwin* ]] ; then extraargs+=( - -DDARWIN_LD_SYSLIBROOT=1 -DDARWIN_LD_DEFAULT_TARGET='"'${MACOSX_DEPLOYMENT_TARGET}'"' ) fi @@ -53,6 +48,7 @@ src_compile() { $(tc-getCC) ${CPPFLAGS} ${CFLAGS} + -Wall -o ldwrapper ${PN}-ldwrapper-${WRAPPER_REV}.c -DEPREFIX=\"${EPREFIX}\" -DCHOST=\"${CHOST}\" diff --git a/sys-devel/binutils-config/files/ldwrapper.c b/sys-devel/binutils-config/files/ldwrapper.c index 1b5fa19ad3..1aa96537d0 100644 --- a/sys-devel/binutils-config/files/ldwrapper.c +++ b/sys-devel/binutils-config/files/ldwrapper.c @@ -1,5 +1,5 @@ /* - * Copyright 1999-2021 Gentoo Authors + * Copyright 1999-2024 Gentoo Authors * Distributed under the terms of the GNU General Public License v2 * Authors: Fabian Groffen <grobian@gentoo.org> * Michael Haubenwallner <haubi@gentoo.org> @@ -18,7 +18,7 @@ /** * ldwrapper: Prefix helper to inject -L and -R flags to the invocation - * of ld. + * of ld, and many more necessary linker flags/tweaks. * * On Darwin it adds -search_paths_first to make sure the given paths are * searched before the default search path, and sets -syslibroot @@ -50,7 +50,6 @@ find_real_ld(char **ld, size_t ldlen, const char verbose, const char is_cross, FILE *f = NULL; char *ldoverride; char *path; - char *ret; struct stat lde; char config[ESIZ]; size_t len; @@ -198,15 +197,19 @@ int main(int argc, char *argv[]) { int newargc = 0; + int rpathcnt = 0; char **newargv = NULL; + char **rpaths = NULL; + char **lpaths = NULL; char *wrapper = argv[0]; char *wrapperctarget = NULL; char verbose = getenv("BINUTILS_CONFIG_VERBOSE") != NULL; char *builddir = getenv("PORTAGE_BUILDDIR"); - char ldbuf[ESIZ]; + char ldbuf[ESIZ * 2]; char *ld = ldbuf; char ctarget[128]; char *darwin_dt = getenv("MACOSX_DEPLOYMENT_TARGET"); + int darwin_dt_ver = 0; char is_cross = 0; char is_darwin = 0; char darwin_use_rpath = 1; @@ -214,7 +217,6 @@ main(int argc, char *argv[]) size_t len; int i; int j; - int k; DIR *dirp; struct dirent *dp; @@ -287,14 +289,20 @@ main(int argc, char *argv[]) /* walk over the arguments to see if there's anything interesting * for us and calculate the final number of arguments */ for (i = 1; i < argc; i++) { - /* -L: account space for the matching -R */ if (argv[i][0] == '-') { + /* -L: account space for the matching -R */ if (argv[i][1] == 'L') newargc++; + if (argv[i][1] == 'R' || strcmp(argv[i], "-rpath") == 0) + rpathcnt++; if (argv[i][1] == 'v' || argv[i][1] == 'V') verbose = 1; - if (strcmp(argv[i], "-macosx_version_min") == 0 && i < argc - 1) + if ((strcmp(argv[i], "-macosx_version_min") == 0 || + strcmp(argv[i], "-macos_version_min") == 0) && i < argc - 1) darwin_dt = argv[i + 1]; + if (strcmp(argv[i], "-platform_version") == 0 && + i < argc - 3 && strcmp(argv[i + 1], "macos") == 0) + darwin_dt = argv[i + 2]; /* ld64 will refuse to accept -rpath if any of the * following options are given */ if (strcmp(argv[i], "-static") == 0 || @@ -306,14 +314,16 @@ main(int argc, char *argv[]) } } - /* Note: Code below assumes that newargc is the count of -L arguments. */ + if (is_darwin && darwin_dt != NULL) { + darwin_dt_ver = (int)strtol(darwin_dt, &p, 10) * 100; + if (*p == '.') + darwin_dt_ver += (int)strtol(p + 1, &p, 10); + } /* If a package being cross-compiled injects standard directories, it's * non-cross-compilable on any platform, prefix or no prefix. So no * need to add PREFIX- or CTARGET-aware libdirs. */ if (!is_cross) { - struct stat st; - if (is_darwin) { /* check deployment target if nothing prevents us from * using -rpath as of yet @@ -325,10 +335,7 @@ main(int argc, char *argv[]) * parsing at dots. darwin_dt != NULL isn't * just for safety: ld64 also refuses -rpath * when not given a deployment target at all */ - darwin_use_rpath = darwin_dt != NULL && - (atoi(darwin_dt) > 10 || - (strncmp(darwin_dt, "10.", 3) == 0 && - atoi(darwin_dt + 3) >= 5)); + darwin_use_rpath = darwin_dt_ver >= 1005; } if (darwin_use_rpath) { @@ -336,24 +343,45 @@ main(int argc, char *argv[]) * -rpath and the path itself */ newargc *= 2; - /* and we will be adding two for the each of - * the two system paths as well */ - newargc += 4; + /* PREFIX rpaths */ + newargc += 2 * 2; } - /* add the 2 prefix paths (-L) and -search_paths_first */ - newargc += 2 + 1; + /* PREFIX paths */ + newargc += 3; -#ifdef DARWIN_LD_SYSLIBROOT - /* add -syslibroot <path> -sdk_version <ver> */ - newargc += 4; -#endif + /* add -search_paths_first */ + newargc += 1; + + /* add -syslibroot <path> -platform_version macos <ver> 0.0 */ + newargc += 6; } else { /* add the 4 paths we want (-L + -R) */ newargc += 8; } } + /* Note: Code below assumes that newargc is the count of -L arguments. */ + + /* allocate space for -L lookups/uniqueifying */ + lpaths = malloc(sizeof(lpaths[0]) * (newargc + 1)); + if (lpaths == NULL) { + fprintf(stderr, "%s: failed to allocate memory for new arguments\n", + wrapper); + exit(1); + } + lpaths[0] = NULL; + + if (!is_darwin || darwin_use_rpath) { + rpaths = malloc(sizeof(rpaths[0]) * (rpathcnt + 1)); + if (rpaths == NULL) { + fprintf(stderr, "%s: failed to allocate memory for new arguments\n", + wrapper); + exit(1); + } + rpaths[0] = NULL; + } + /* account the original arguments */ newargc += argc; /* we always add a sentinel */ @@ -383,37 +411,126 @@ main(int argc, char *argv[]) newargv[j++] = ld; if (!is_cross && is_darwin) { - char target[ESIZ]; - ssize_t trglen; - - /* ld64 will try to infer sdk version when -syslibroot is used - * from the path given, unfortunately this searches for the - * first numbers it finds, which means anything random in - * EPREFIX, causing errors. Explicitly set the deployment - * version here, for the sdk link can be versionless when set to - * CommandLineTools */ -#ifdef DARWIN_LD_SYSLIBROOT - newargv[j++] = "-sdk_version"; - newargv[j++] = darwin_dt; + char target[(2 * ESIZ) + 16]; + FILE *ld64out; + int ld64ver = 0; + + /* call the linker to figure out what options we can use :( + * some Developer Tools ld64 versions: + * Xcode ld64 dyld + * 3.1.1: 85.2.1 Leopard 10.5, sdk_version unknown, + * need macosx_version_min + * 8.2.1: 274.2 xtools-2.2.4, sdk_version plus + * macosx_version_min + * 10.0: 409.12 High Sierra 10.13 like above + * 12.0: 609 Big Sur 11, sdk_version only + * 13.0: 711 + * 13.3.1: 762 + * 14.0: 819.6 + * 14.2: 820.1 + * 14.3.1: 857.1 + * 15.0: 907 1022.1 Sanoma 23, platform_version iso sdk_version + * 15.3 1053.12 called ld + * all to be found from the PROJECT:ld64-650.9 or + * PROJECT:dyld-1022.1 or PROJECT:ld-1053.12 bit from the first line + * NOTE: e.g. my Sanoma mac with CommandLineTools has 650.9 + * which is not a version from any Developer Tools ?!? + * Currently we need to distinguish XCode 15 according to + * bug #910277, so we look for 907 and old targets before 12 */ +#define LD64_3_1 8500 +#define LD64_8_2 27400 +#define LD64_10_0 40900 +#define LD64_12_0 60900 +#define LD64_15_0 90700 + snprintf(target, sizeof(target), "%s -v 2>&1", ld); + ld64out = popen(target, "r"); + if (ld64out != NULL) { + char *proj; + long comp; + if (fgets(target, sizeof(target), ld64out) != 0 && + ((proj = strstr(target, "PROJECT:ld64-")) != NULL || + (proj = strstr(target, "PROJECT:dyld-")) != NULL || + (proj = strstr(target, "PROJECT:ld-")) != NULL)) + { + /* we don't distinguish between ld64 and dyld here, for + * now it seems the numbers line up for our logic */ + proj += sizeof("PROJECT:ld") - 1; + proj += *proj == '-' ? 1 : 3; + comp = strtol(proj, &proj, 10); + /* we currently have no need to parse fractions, the + * major version is significant enough, so just stop */ + ld64ver = (int)comp * 100; + } + pclose(ld64out); + } + + /* macOS Big Sur (Darwin 20) has an empty /usr/lib, so the + * linker really has to look into the SDK, for which it needs to + * be told where it is (symlinked right into our EPREFIX root as + * MacOSX.sdk) via the -syslibroot argument, older targets also + * get this SDK path setup, old bootstraps would break, but that + * would be easy to resolve -- there's unlikely to be many old + * bootstraps out there that don't have the SDK path symlink */ newargv[j++] = "-syslibroot"; newargv[j++] = EPREFIX "/MacOSX.sdk"; -#endif - /* inject this first to make the intention clear */ + + /* ld64 will try to infer sdk version when -syslibroot is + * used from the path given, unfortunately this searches for + * the first numbers it finds, which means anything random + * in EPREFIX, causing errors. Explicitly set the + * deployment version here, for the sdk link can be + * versionless when set to CommandLineTools + * macOS Sanoma however needs a new way to set this version, + * so do the right thing */ + if (ld64ver >= LD64_15_0) { + newargv[j++] = "-platform_version"; + newargv[j++] = "macos"; + newargv[j++] = darwin_dt; + newargv[j++] = "0.0"; + } else if (ld64ver >= LD64_8_2) { + newargv[j++] = "-sdk_version"; + newargv[j++] = darwin_dt; + } + + if (ld64ver < LD64_12_0) { + newargv[j++] = "-macosx_version_min"; + newargv[j++] = darwin_dt; + } + + /* inject this before -L args to make the intention clear */ newargv[j++] = "-search_paths_first"; } - /* position k right after the original arguments */ - k = j - 1 + argc; for (i = 1; i < argc; i++, j++) { + if (is_darwin) { + /* skip platform version stuff, we already pushed it out */ + if ((strcmp(argv[i], "-macosx_version_min") == 0 || + strcmp(argv[i], "-macos_version_min") == 0) && i < argc - 1) + { + i++; + j--; + continue; + } + if (strcmp(argv[i], "-platform_version") == 0 && + i < argc - 3 && strcmp(argv[i + 1], "macos") == 0) + { + i += 3; + j--; + continue; + } + } + newargv[j] = argv[i]; if (is_cross || (is_darwin && !darwin_use_rpath)) continue; - /* on ELF targets we add runpaths for all found search paths */ - if (argv[i][0] == '-' && argv[i][1] == 'L') { + /* on ELF/Mach-O targets we add runpaths for all found search paths */ + if (argv[i][0] == '-' && (argv[i][1] == 'L' || argv[i][1] == 'R')) { char *path; - size_t sze; + int pth; + char duplicate; + int nexti = i; /* arguments can be in many ways here: * -L<path> @@ -424,10 +541,11 @@ main(int argc, char *argv[]) while (*path != '\0' && isspace(*path)) path++; if (*path == '\0') { + nexti++; /* no more arguments?!? skip */ - if (i + 1 >= argc) + if (nexti >= argc) continue; - path = argv[i + 1]; + path = argv[nexti]; while (*path != '\0' && isspace(*path)) path++; } @@ -439,55 +557,144 @@ main(int argc, char *argv[]) if (builddir != NULL && strncmp(builddir, path, len) == 0) continue; - if (is_darwin) { - newargv[k] = "-rpath"; - newargv[++k] = path; - } else { - sze = 2 + strlen(path) + 1; - newargv[k] = malloc(sizeof(char) * sze); - if (newargv[k] == NULL) { - fprintf(stderr, "%s: failed to allocate memory for " - "'%s' -R argument\n", wrapper, argv[i]); - exit(1); + /* loop-search for this path, if it was emitted already, + * suppress it -- this is not just some fancy beautification! + * CLT15.3 on macOS warns about duplicate paths, and + * any project that triggers on these warnings causes + * problems, such as Ruby claiming the linker is broken */ + duplicate = 0; + if (argv[i][1] == 'L') { + for (pth = 0; lpaths[pth] != NULL; pth++) { + if (strcmp(lpaths[pth], path) == 0) { + duplicate = 1; + break; + } } - - snprintf(newargv[k], sze, "-R%s", path); + if (duplicate) { + i = nexti; + j--; + continue; + } + /* record path */ + lpaths[pth++] = path; + lpaths[pth] = NULL; + } else if (!is_darwin || darwin_use_rpath) { + for (pth = 0; rpaths[pth] != NULL; pth++) { + if (strcmp(rpaths[pth], path) == 0) { + duplicate = 1; + break; + } + } + if (duplicate) { + i = nexti; + j--; + continue; + } + /* record path */ + rpaths[pth++] = path; + rpaths[pth] = NULL; } + } else if ((!is_darwin || darwin_use_rpath) && + strcmp(argv[i], "-rpath") == 0) + { + char *path; + int pth; + char duplicate; + int nexti = i + 1; + + /* no more arguments?!? skip */ + if (nexti >= argc) + continue; + path = argv[nexti]; + while (*path != '\0' && isspace(*path)) + path++; + /* not absolute (or empty)?!? skip */ + if (*path != '/') + continue; + + /* does it refer to the build directory? skip */ + if (builddir != NULL && strncmp(builddir, path, len) == 0) + continue; - k++; + duplicate = 0; + for (pth = 0; rpaths[pth] != NULL; pth++) { + if (strcmp(rpaths[pth], path) == 0) { + duplicate = 1; + break; + } + } + if (duplicate) { + j--; + i = nexti; + continue; + } + /* record path */ + rpaths[pth++] = path; + rpaths[pth] = NULL; } } /* add the custom paths */ if (!is_cross) { + int pth; +#define path_not_exists(W,P) \ + for (pth = 0; W[pth] != NULL; pth++) { \ + if (strcmp(W[pth], P) == 0) \ + break; \ + } \ + if (W[pth] == NULL) +#define add_path(P) \ + path_not_exists(lpaths, P) newargv[j++] = "-L" P +#define add_path_rpath(P) \ + path_not_exists(lpaths, P) { \ + lpaths[pth++] = P; \ + lpaths[pth] = NULL; \ + newargv[j++] = "-L" P; \ + } + if (is_darwin) { /* FIXME: no support for cross-compiling *to* Darwin */ - newargv[k++] = "-L" EPREFIX "/usr/" CHOST "/lib/gcc"; - newargv[k++] = "-L" EPREFIX "/usr/lib"; - newargv[k++] = "-L" EPREFIX "/lib"; - - if (darwin_use_rpath) { - newargv[k++] = "-rpath"; - newargv[k++] = EPREFIX "/usr/lib"; - newargv[k++] = "-rpath"; - newargv[k++] = EPREFIX "/lib"; - } + add_path(EPREFIX "/usr/" CHOST "/lib/gcc"); + add_path_rpath(EPREFIX "/usr/lib"); + add_path_rpath(EPREFIX "/lib"); } else { - newargv[k++] = "-L" EPREFIX "/usr/" CHOST "/lib/gcc"; - newargv[k++] = "-R" EPREFIX "/usr/" CHOST "/lib/gcc"; - newargv[k++] = "-L" EPREFIX "/usr/" CHOST "/lib"; - newargv[k++] = "-R" EPREFIX "/usr/" CHOST "/lib"; - newargv[k++] = "-L" EPREFIX "/usr/lib"; - newargv[k++] = "-R" EPREFIX "/usr/lib"; - newargv[k++] = "-L" EPREFIX "/lib"; - newargv[k++] = "-R" EPREFIX "/lib"; + add_path_rpath(EPREFIX "/usr/" CHOST "/lib/gcc"); + add_path_rpath(EPREFIX "/usr/" CHOST "/lib"); + add_path_rpath(EPREFIX "/usr/lib"); + add_path_rpath(EPREFIX "/lib"); + } + } + /* add rpaths for -L entries */ + if (!is_darwin || darwin_use_rpath) { + for (i = 0; lpaths[i] != NULL; i++) { + int pth; + path_not_exists(rpaths, lpaths[i]) { + size_t sze; + if (is_darwin && darwin_use_rpath) { + newargv[j++] = "-rpath"; + newargv[j++] = lpaths[i]; + } else if (!is_darwin) { + sze = 2 + strlen(lpaths[i]) + 1; + newargv[j] = malloc(sizeof(char) * sze); + if (newargv[j] == NULL) { + fprintf(stderr, "%s: failed to allocate memory for " + "'%s' -R argument\n", wrapper, argv[i]); + exit(1); + } + + snprintf(newargv[j++], sze, "-R%s", lpaths[i]); + } + } } } - newargv[k] = NULL; + newargv[j] = NULL; if (verbose) { fprintf(stderr, "%s: invoking %s with arguments:\n", wrapper, ld); for (j = 0; newargv[j] != NULL; j++) - fprintf(stderr, " %s\n", newargv[j]); + fprintf(stderr, " %s%s", + newargv[j], + newargv[j + 1] != NULL && newargv[j + 1][0] != '-' + ? "" : "\n"); } /* finally, execute the real ld */ diff --git a/sys-devel/binutils/Manifest b/sys-devel/binutils/Manifest index 3969b00779..b6c1313f33 100644 --- a/sys-devel/binutils/Manifest +++ b/sys-devel/binutils/Manifest @@ -1,5 +1,2 @@ -DIST binutils-2.34-patches-4.tar.xz 95232 BLAKE2B 0a355120ecaf447d863f6d0837028061968166c9024da36212ce7d172ee2060e4027be1fca0089e38ab9073b5332307ff1dc05b868603bd2aa0ec8e88af7cd0a SHA512 e593edbeddaf97ef23fa8eb25c5714c7f2dd2500d11422bd9dba42e119884fe71593adc98862f74c7d391ceb298556ed049eee3c504733c634faef236045876b -DIST binutils-2.34.tar.xz 21637796 BLAKE2B 07dd23916a7d27f71c3f160c8c16abe2bd4fce294c738c665a012a3be6a87dbe8160d0c38740524f9025e01d438e99b2a94bcf9f9f79ee214f5dd033de8aad3d SHA512 2c7976939dcf5e8c5b7374cccd39bfe803b1bec73c6abfa0eb17c24e1942574c6bdb874c66a092a82adc443182eacd8a5a8001c19a76101f0c7ba40c27de0bbd -DIST binutils-2.39-patches-4.tar.xz 62880 BLAKE2B 5cc335769d9c88417583ce059c61d0d7655f3ab9ac69647e6e2f65bd3a9dd143fe34c50bb68ab81d4226ddd0e4ef405d7102f67375a672eedc3d01b92b8ef497 SHA512 ef81350979af64cf35800b39982c84657a5c01362c01d221164a43d8f0dd80276c9f052c55d24516fad457e6671a58d467d71b5edd6c1f53fddbdb31172a21ee -DIST binutils-2.39-patches-5.tar.xz 82924 BLAKE2B 2cf75f661989f22270d6afe5f3c543814eb6a331be4493016fa2871e1f10a84a123c1c51e77a19b35e46680b9fe77390cb1532ca40d470a6041fa768fed3ccd7 SHA512 4b5811b4822b3a06f590fc7d082dc0ddf18a6058ac23887254e2ee9bd63c7f06f1636e446152115c7e0b01a6c5298a0d9df6904bd1582e66504ccde80dd1ecbd -DIST binutils-2.39.tar.xz 25167756 BLAKE2B ac6a5296c6586d53eaadcbffc5c399a6d79edf72450b9bb8b3525ce525129cef3d2eb90c85ef3bb3270b5a03b0e1ffb8f0b705f028158726f9777ebb8685066f SHA512 68e038f339a8c21faa19a57bbc447a51c817f47c2e06d740847c6e9cc3396c025d35d5369fa8c3f8b70414757c89f0e577939ddc0d70f283182504920f53b0a3 +DIST binutils-2.40-patches-7.tar.xz 299188 BLAKE2B 170cd2432e0458889b240c3603461d0b4bfa62d5314634b101a629db455d87235ac14ad44c63920b713d5235fa8b73902960df1019153873ef06a33aa7050b4b SHA512 a60da163caee68fe1fa355385d404e8998ebed0e390d50e0713e95334733a8b4e37bc63d522817284c027953e43848dbc98042461a47131fb53bc69203b4ee87 +DIST binutils-2.40.tar.xz 25241484 BLAKE2B 8d799f7c595f878b9af5b17a490021dd8b8300ac2fe0ed8574c012929d22d2d0493e003a3e631a9436e8e712da801779b777c566167fe42b0bde119ffa5ad1c2 SHA512 a37e042523bc46494d99d5637c3f3d8f9956d9477b748b3b1f6d7dfbb8d968ed52c932e88a4e946c6f77b8f48f1e1b360ca54c3d298f17193f3b4963472f6925 diff --git a/sys-devel/binutils/binutils-2.34-r1.ebuild b/sys-devel/binutils/binutils-2.34-r1.ebuild deleted file mode 100644 index 2dd1d18118..0000000000 --- a/sys-devel/binutils/binutils-2.34-r1.ebuild +++ /dev/null @@ -1,445 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -inherit eutils libtool flag-o-matic gnuconfig multilib toolchain-funcs - -DESCRIPTION="Tools necessary to build programs" -HOMEPAGE="https://sourceware.org/binutils/" -LICENSE="GPL-3+" -IUSE="default-gold doc +gold multitarget +nls +plugins static-libs test" -REQUIRED_USE="default-gold? ( gold )" - -# Variables that can be set here: -# PATCH_VER - the patchset version -# Default: empty, no patching -# PATCH_BINUTILS_VER - the binutils version in the patchset name -# - Default: PV -# PATCH_DEV - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/... -# for the patchsets - -PATCH_VER=4 -PATCH_DEV=dilfridge - -case ${PV} in - 9999) - EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git" - inherit git-r3 - S=${WORKDIR}/binutils - EGIT_CHECKOUT_DIR=${S} - SLOT=${PV} - ;; - *.9999) - EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git" - inherit git-r3 - S=${WORKDIR}/binutils - EGIT_CHECKOUT_DIR=${S} - EGIT_BRANCH=$(ver_cut 1-2) - EGIT_BRANCH="binutils-${EGIT_BRANCH/./_}-branch" - SLOT=$(ver_cut 1-2) - ;; - *) - SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz" - SLOT=$(ver_cut 1-2) - KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" - ;; -esac - -# -# The Gentoo patchset -# -PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}} -PATCH_DEV=${PATCH_DEV:-sam} - -[[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI} - https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz" - -# -# The cross-compile logic -# -export CTARGET=${CTARGET:-${CHOST}} -if [[ ${CTARGET} == ${CHOST} ]] ; then - if [[ ${CATEGORY} == cross-* ]] ; then - export CTARGET=${CATEGORY#cross-} - fi -fi -is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; } - -# -# The dependencies -# -RDEPEND=" - >=sys-devel/binutils-config-3 - sys-libs/zlib -" -DEPEND="${RDEPEND}" -BDEPEND=" - doc? ( sys-apps/texinfo ) - test? ( dev-util/dejagnu ) - nls? ( sys-devel/gettext ) - sys-devel/flex - virtual/yacc -" - -RESTRICT="!test? ( test )" - -PATCHES=( - "${FILESDIR}"/${PN}-2.33-gcc-10.patch - "${FILESDIR}"/${PN}-2.34-riscv-SEGV.patch - "${FILESDIR}"/${PN}-2.22-solaris-anonymous-version-script-fix.patch -) - -MY_BUILDDIR=${WORKDIR}/build - -src_unpack() { - case ${PV} in - *9999) - git-r3_src_unpack - ;; - *) - ;; - esac - default - mkdir -p "${MY_BUILDDIR}" -} - -src_prepare() { - if [[ ! -z ${PATCH_VER} ]] ; then - # Use upstream patch to enable development mode - rm -v "${WORKDIR}/patch"/0000-Gentoo-Git-is-development.patch || die - - einfo "Applying binutils-${PATCH_BINUTILS_VER} patchset ${PATCH_VER}" - eapply "${WORKDIR}/patch"/*.patch - fi - - # This check should probably go somewhere else, like pkg_pretend. - if [[ ${CTARGET} == *-uclibc* ]] ; then - if grep -qs 'linux-gnu' "${S}"/ltconfig ; then - die "sorry, but this binutils doesn't yet support uClibc :(" - fi - fi - - # Make sure our explicit libdir paths don't get clobbered. #562460 - sed -i \ - -e 's:@bfdlibdir@:@libdir@:g' \ - -e 's:@bfdincludedir@:@includedir@:g' \ - {bfd,opcodes}/Makefile.in || die - - # Fix locale issues if possible #122216 - if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then - einfo "Fixing misc issues in configure files" - for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do - ebegin " Updating ${f/${S}\/}" - patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \ - || eerror "Please file a bug about this" - eend $? - done - fi - - # Fix conflicts with newer glibc #272594 - if [[ -e libiberty/testsuite/test-demangle.c ]] ; then - sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c - fi - - # Apply things from PATCHES and user dirs - default - - # Run misc portage update scripts - gnuconfig_update - elibtoolize --portage --no-uclibc -} - -toolchain-binutils_bugurl() { - printf "https://bugs.gentoo.org/" -} -toolchain-binutils_pkgversion() { - printf "Gentoo ${PV}" - [[ -n ${PATCH_VER} ]] && printf " p${PATCH_VER}" -} - -src_configure() { - # Setup some paths - LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV} - INCPATH=${LIBPATH}/include - DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV} - if is_cross ; then - TOOLPATH=/usr/${CHOST}/${CTARGET} - else - TOOLPATH=/usr/${CTARGET} - fi - BINPATH=${TOOLPATH}/binutils-bin/${PV} - - # Make sure we filter $LINGUAS so that only ones that - # actually work make it through #42033 - strip-linguas -u */po - - # Keep things sane - strip-flags - - local x - echo - for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do - einfo "$(printf '%10s' ${x}:) ${!x}" - done - echo - - cd "${MY_BUILDDIR}" - local myconf=() - - if use plugins ; then - myconf+=( --enable-plugins ) - fi - # enable gold (installed as ld.gold) and ld's plugin architecture - if use gold ; then - myconf+=( --enable-gold ) - if use default-gold; then - myconf+=( --enable-gold=default ) - fi - fi - - if use nls ; then - myconf+=( --without-included-gettext ) - [[ ${CHOST} == *"-solaris"* ]] && append-libs -lintl - else - myconf+=( --disable-nls ) - fi - - myconf+=( --with-system-zlib ) - - # For bi-arch systems, enable a 64bit bfd. This matches - # the bi-arch logic in toolchain.eclass. #446946 - # We used to do it for everyone, but it's slow on 32bit arches. #438522 - case $(tc-arch) in - ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;; - esac - - use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd ) - - [[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} ) - - is_cross && myconf+=( - --with-sysroot="${EPREFIX}"/usr/${CTARGET} - --enable-poison-system-directories - ) - - # glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+ - # on everyone in alpha (for now), we'll just enable it when possible - has_version ">=${CATEGORY}/glibc-2.5" && myconf+=( --enable-secureplt ) - has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt ) - - # mips can't do hash-style=gnu ... - # let's not do this on Solaris either - if [[ $(tc-arch) != mips && ${CHOST} != *-solaris* ]] ; then - myconf+=( --enable-default-hash-style=gnu ) - fi - - myconf+=( - --prefix="${EPREFIX}"/usr - --host=${CHOST} - --target=${CTARGET} - --datadir="${EPREFIX}"${DATAPATH} - --datarootdir="${EPREFIX}"${DATAPATH} - --infodir="${EPREFIX}"${DATAPATH}/info - --mandir="${EPREFIX}"${DATAPATH}/man - --bindir="${EPREFIX}"${BINPATH} - --libdir="${EPREFIX}"${LIBPATH} - --libexecdir="${EPREFIX}"${LIBPATH} - --includedir="${EPREFIX}"${INCPATH} - --enable-obsolete - --enable-shared - --enable-threads - # Newer versions (>=2.27) offer a configure flag now. - --enable-relro - # Newer versions (>=2.24) make this an explicit option. #497268 - --enable-install-libiberty - --disable-werror - --with-bugurl="$(toolchain-binutils_bugurl)" - --with-pkgversion="$(toolchain-binutils_pkgversion)" - $(use_enable static-libs static) - ${EXTRA_ECONF} - # Disable modules that are in a combined binutils/gdb tree. #490566 - --disable-{gdb,libdecnumber,readline,sim} - # Strip out broken static link flags. - # https://gcc.gnu.org/PR56750 - --without-stage1-ldflags - # Change SONAME to avoid conflict across - # {native,cross}/binutils, binutils-libs. #666100 - --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st) - ) - echo ./configure "${myconf[@]}" - "${S}"/configure "${myconf[@]}" || die - - # Prevent makeinfo from running if doc is unset. - if ! use doc ; then - sed -i \ - -e '/^MAKEINFO/s:=.*:= true:' \ - Makefile || die - fi -} - -src_compile() { - cd "${MY_BUILDDIR}" - # see Note [tooldir hack for ldscripts] - emake tooldir="${EPREFIX}${TOOLPATH}" all - - # only build info pages if the user wants them - if use doc ; then - emake info - fi - - # we nuke the manpages when we're left with junk - # (like when we bootstrap, no perl -> no manpages) - find . -name '*.1' -a -size 0 -delete -} - -src_test() { - cd "${MY_BUILDDIR}" - - # bug 637066 - filter-flags -Wall -Wreturn-type - - emake -k check -} - -src_install() { - local x d - - cd "${MY_BUILDDIR}" - # see Note [tooldir hack for ldscripts] - emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install - rm -rf "${ED}"/${LIBPATH}/bin - use static-libs || find "${ED}" -name '*.la' -delete - - # Newer versions of binutils get fancy with ${LIBPATH} #171905 - cd "${ED}"/${LIBPATH} - for d in ../* ; do - [[ ${d} == ../${PV} ]] && continue - mv ${d}/* . || die - rmdir ${d} || die - done - - # Now we collect everything intp the proper SLOT-ed dirs - # When something is built to cross-compile, it installs into - # /usr/$CHOST/ by default ... we have to 'fix' that :) - if is_cross ; then - cd "${ED}"/${BINPATH} - for x in * ; do - mv ${x} ${x/${CTARGET}-} - done - - if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then - mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH} - mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/ - rm -r "${ED}"/usr/${CHOST}/{include,lib} - fi - fi - insinto ${INCPATH} - local libiberty_headers=( - # Not all the libiberty headers. See libiberty/Makefile.in:install_to_libdir. - demangle.h - dyn-string.h - fibheap.h - hashtab.h - libiberty.h - objalloc.h - splay-tree.h - ) - doins "${libiberty_headers[@]/#/${S}/include/}" - if [[ -d ${ED}/${LIBPATH}/lib ]] ; then - mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/ - rm -r "${ED}"/${LIBPATH}/lib - fi - - # Generate an env.d entry for this binutils - insinto /etc/env.d/binutils - cat <<-EOF > "${T}"/env.d - TARGET="${CTARGET}" - VER="${PV}" - LIBPATH="${EPREFIX}${LIBPATH}" - EOF - newins "${T}"/env.d ${CTARGET}-${PV} - - # Handle documentation - if ! is_cross ; then - cd "${S}" - dodoc README - docinto bfd - dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO - docinto binutils - dodoc binutils/ChangeLog binutils/NEWS binutils/README - docinto gas - dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README* - docinto gprof - dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl - docinto ld - dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO - docinto libiberty - dodoc libiberty/ChangeLog* libiberty/README - docinto opcodes - dodoc opcodes/ChangeLog* - fi - - # Remove shared info pages - rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info} - - # Trim all empty dirs - find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null -} - -pkg_postinst() { - # Make sure this ${CTARGET} has a binutils version selected - [[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0 - binutils-config ${CTARGET}-${PV} -} - -pkg_postrm() { - local current_profile=$(binutils-config -c ${CTARGET}) - - # If no other versions exist, then uninstall for this - # target ... otherwise, switch to the newest version - # Note: only do this if this version is unmerged. We - # rerun binutils-config if this is a remerge, as - # we want the mtimes on the symlinks updated (if - # it is the same as the current selected profile) - if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${PV} ]] ; then - local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}') - choice=${choice//$'\n'/ } - choice=${choice/* } - if [[ -z ${choice} ]] ; then - env -i ROOT="${ROOT}" binutils-config -u ${CTARGET} - else - binutils-config ${choice} - fi - elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${PV} ]] ; then - binutils-config ${CTARGET}-${PV} - fi -} - -# Note [slotting support] -# ----------------------- -# Gentoo's layout for binutils files is non-standard as Gentoo -# supports slotted installation for binutils. Many tools -# still expect binutils to reside in known locations. -# binutils-config package restores symlinks into known locations, -# like: -# /usr/bin/${CTARGET}-<tool> -# /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips -# /usr/include/ -# -# Note [tooldir hack for ldscripts] -# --------------------------------- -# Build system does not allow ./configure to tweak every location -# we need for slotting binutils hence all the shuffling in -# src_install(). This note is about SCRIPTDIR define handling. -# -# SCRIPTDIR defines 'ldscripts/' directory location. SCRIPTDIR value -# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib' -# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time. -# Thus we can't just move files around after compilation finished. -# -# Our goal is the following: -# - at build-time set scriptdir to point to symlinked location: -# ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case) -# - at install-time set scriptdir to point to slotted location: -# ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV} diff --git a/sys-devel/binutils/binutils-2.39-r2.ebuild b/sys-devel/binutils/binutils-2.39-r2.ebuild deleted file mode 100644 index 41f01bb583..0000000000 --- a/sys-devel/binutils/binutils-2.39-r2.ebuild +++ /dev/null @@ -1,498 +0,0 @@ -# Copyright 1999-2022 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -inherit libtool flag-o-matic gnuconfig strip-linguas toolchain-funcs - -DESCRIPTION="Tools necessary to build programs" -HOMEPAGE="https://sourceware.org/binutils/" - -LICENSE="GPL-3+" -IUSE="cet default-gold doc gold gprofng multitarget +nls pgo +plugins static-libs test vanilla" -REQUIRED_USE="default-gold? ( gold )" - -# Variables that can be set here (ignored for live ebuilds) -# PATCH_VER - the patchset version -# Default: empty, no patching -# PATCH_BINUTILS_VER - the binutils version in the patchset name -# - Default: PV -# PATCH_DEV - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/... -# for the patchsets - -PATCH_VER=4 -PATCH_DEV=dilfridge - -if [[ ${PV} == 9999* ]]; then - inherit git-r3 - SLOT=${PV} -else - PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}} - PATCH_DEV=${PATCH_DEV:-dilfridge} - SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PV}.tar.xz" - [[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI} - https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz" - SLOT=$(ver_cut 1-2) - KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" -fi - -# -# The cross-compile logic -# -export CTARGET=${CTARGET:-${CHOST}} -if [[ ${CTARGET} == ${CHOST} ]] ; then - if [[ ${CATEGORY} == cross-* ]] ; then - export CTARGET=${CATEGORY#cross-} - fi -fi -is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; } - -# -# The dependencies -# -RDEPEND=" - >=sys-devel/binutils-config-3 - sys-libs/zlib -" -DEPEND="${RDEPEND}" -BDEPEND=" - doc? ( sys-apps/texinfo ) - test? ( - dev-util/dejagnu - sys-devel/bc - ) - nls? ( sys-devel/gettext ) - sys-devel/flex - virtual/yacc -" - -RESTRICT="!test? ( test )" - -PATCHES=( - "${FILESDIR}"/${PN}-2.22-solaris-anonymous-version-script-fix.patch -) - -MY_BUILDDIR=${WORKDIR}/build - -src_unpack() { - if [[ ${PV} == 9999* ]] ; then - EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/binutils-patches.git" - EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git - git-r3_src_unpack - mv patches-git/9999 patch || die - - EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git" - S=${WORKDIR}/binutils - EGIT_CHECKOUT_DIR=${S} - git-r3_src_unpack - else - unpack ${P/-hppa64/}.tar.xz - - cd "${WORKDIR}" || die - unpack binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz - - # _p patch versions are Gentoo specific tarballs ... - local dir=${P%_p?} - dir=${dir/-hppa64/} - - S=${WORKDIR}/${dir} - fi - - cd "${WORKDIR}" || die - mkdir -p "${MY_BUILDDIR}" || die -} - -src_prepare() { - local patchsetname - if [[ ${PV} == 9999* ]] ; then - patchsetname="from git master" - else - patchsetname="${PATCH_BINUTILS_VER}-${PATCH_VER}" - fi - - if [[ -n ${PATCH_VER} ]] || [[ ${PV} == 9999* ]] ; then - if ! use vanilla; then - einfo "Applying binutils patchset ${patchsetname}" - eapply "${WORKDIR}/patch" - einfo "Done." - fi - fi - - # Make sure our explicit libdir paths don't get clobbered, bug #562460 - sed -i \ - -e 's:@bfdlibdir@:@libdir@:g' \ - -e 's:@bfdincludedir@:@includedir@:g' \ - {bfd,opcodes}/Makefile.in || die - - # Fix locale issues if possible, bug #122216 - if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then - einfo "Fixing misc issues in configure files" - for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do - ebegin " Updating ${f/${S}\/}" - patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \ - || eerror "Please file a bug about this" - eend $? - done - fi - - # Apply things from PATCHES and user dirs - default - - # Run misc portage update scripts - gnuconfig_update - elibtoolize --portage --no-uclibc -} - -toolchain-binutils_bugurl() { - printf "https://bugs.gentoo.org/" -} -toolchain-binutils_pkgversion() { - printf "Gentoo ${PV}" - [[ -n ${PATCH_VER} ]] && printf " p${PATCH_VER}" -} - -src_configure() { - # See https://www.gnu.org/software/make/manual/html_node/Parallel-Output.html - # Avoid really confusing logs from subconfigure spam, makes logs far - # more legible. - MAKEOPTS="--output-sync=line ${MAKEOPTS}" - - # Setup some paths - LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV} - INCPATH=${LIBPATH}/include - DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV} - if is_cross ; then - TOOLPATH=/usr/${CHOST}/${CTARGET} - else - TOOLPATH=/usr/${CTARGET} - fi - BINPATH=${TOOLPATH}/binutils-bin/${PV} - - # Make sure we filter $LINGUAS so that only ones that - # actually work make it through, bug #42033 - strip-linguas -u */po - - # Keep things sane - strip-flags - - use elibc_musl && append-ldflags -Wl,-z,stack-size=2097152 - - local x - echo - for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do - einfo "$(printf '%10s' ${x}:) ${!x}" - done - echo - - cd "${MY_BUILDDIR}" || die - local myconf=() - - if use plugins ; then - myconf+=( --enable-plugins ) - fi - # enable gold (installed as ld.gold) and ld's plugin architecture - if use gold ; then - myconf+=( --enable-gold ) - if use default-gold; then - myconf+=( --enable-gold=default ) - fi - fi - - if use nls ; then - myconf+=( --without-included-gettext ) - [[ ${CHOST} == *"-solaris"* ]] && append-libs -lintl - else - myconf+=( --disable-nls ) - fi - - myconf+=( --with-system-zlib ) - - # For bi-arch systems, enable a 64bit bfd. This matches the bi-arch - # logic in toolchain.eclass. bug #446946 - # - # We used to do it for everyone, but it's slow on 32bit arches. bug #438522 - case $(tc-arch) in - ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;; - esac - - use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd ) - - [[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} ) - - is_cross && myconf+=( - --with-sysroot="${EPREFIX}"/usr/${CTARGET} - --enable-poison-system-directories - ) - - myconf+=( --enable-secureplt ) - - # mips can't do hash-style=gnu ... - # let's not do this on Solaris either - if [[ $(tc-arch) != mips && ${CHOST} != *-solaris* ]] ; then - myconf+=( --enable-default-hash-style=gnu ) - fi - - myconf+=( - --prefix="${EPREFIX}"/usr - --host=${CHOST} - --target=${CTARGET} - --datadir="${EPREFIX}"${DATAPATH} - --datarootdir="${EPREFIX}"${DATAPATH} - --infodir="${EPREFIX}"${DATAPATH}/info - --mandir="${EPREFIX}"${DATAPATH}/man - --bindir="${EPREFIX}"${BINPATH} - --libdir="${EPREFIX}"${LIBPATH} - --libexecdir="${EPREFIX}"${LIBPATH} - --includedir="${EPREFIX}"${INCPATH} - --enable-obsolete - --enable-shared - --enable-threads - # Newer versions (>=2.27) offer a configure flag now. - --enable-relro - # Newer versions (>=2.24) make this an explicit option, bug #497268 - --enable-install-libiberty - # Available from 2.35 on - --enable-textrel-check=warning - - # Available from 2.39 on - --enable-warn-execstack - --enable-warn-rwx-segments - # TODO: Available from 2.39+ on but let's try the warning on for a bit - # first... (--enable-warn-execstack) - # Could put it under USE=hardened? - #--disable-default-execstack (or is it --enable-default-execstack=no? docs are confusing) - - # Things to think about - #--enable-deterministic-archives - - # Works better than vapier's patch, bug #808787 - --enable-new-dtags - - --disable-jansson - --disable-werror - --with-bugurl="$(toolchain-binutils_bugurl)" - --with-pkgversion="$(toolchain-binutils_pkgversion)" - $(use_enable static-libs static) - # Disable modules that are in a combined binutils/gdb tree, bug #490566 - --disable-{gdb,libdecnumber,readline,sim} - # Strip out broken static link flags. - # https://gcc.gnu.org/PR56750 - --without-stage1-ldflags - # Change SONAME to avoid conflict across - # {native,cross}/binutils, binutils-libs. bug #666100 - --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st) - - # Avoid automagic dependency on (currently prefix) systems - # systems with debuginfod library, bug #754753 - --without-debuginfod - - # Avoid automagic dev-libs/msgpack dep, bug #865875 - --without-msgpack - - # Allow user to opt into CET for host libraries. - # Ideally we would like automagic-or-disabled here. - # But the check does not quite work on i686: bug #760926. - $(use_enable cet) - - # We can enable this by default in future, but it's brand new - # in 2.39 with several bugs: - # - Doesn't build on musl (https://sourceware.org/bugzilla/show_bug.cgi?id=29477) - # - No man pages (https://sourceware.org/bugzilla/show_bug.cgi?id=29521) - # - Broken at runtime without Java (https://sourceware.org/bugzilla/show_bug.cgi?id=29479) - # - binutils-config (and this ebuild?) needs adaptation first (https://bugs.gentoo.org/865113) - $(use_enable gprofng) - ) - - if ! is_cross ; then - myconf+=( $(use_enable pgo pgo-build lto) ) - - if use pgo ; then - export BUILD_CFLAGS="${CFLAGS}" - fi - fi - - ECONF_SOURCE="${S}" econf "${myconf[@]}" || die - - # Prevent makeinfo from running if doc is unset. - if ! use doc ; then - sed -i \ - -e '/^MAKEINFO/s:=.*:= true:' \ - Makefile || die - fi -} - -src_compile() { - cd "${MY_BUILDDIR}" || die - - # see Note [tooldir hack for ldscripts] - emake V=1 tooldir="${EPREFIX}${TOOLPATH}" all - - # only build info pages if the user wants them - if use doc ; then - emake V=1 info - fi - - # we nuke the manpages when we're left with junk - # (like when we bootstrap, no perl -> no manpages) - find . -name '*.1' -a -size 0 -delete -} - -src_test() { - cd "${MY_BUILDDIR}" || die - - # bug #637066 - filter-flags -Wall -Wreturn-type - - emake -k V=1 check -} - -src_install() { - local x d - - cd "${MY_BUILDDIR}" || die - - # see Note [tooldir hack for ldscripts] - emake V=1 DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install - rm -rf "${ED}"/${LIBPATH}/bin || die - use static-libs || find "${ED}" -name '*.la' -delete - - # Newer versions of binutils get fancy with ${LIBPATH}, bug #171905 - cd "${ED}"/${LIBPATH} || die - for d in ../* ; do - [[ ${d} == ../${PV} ]] && continue - mv ${d}/* . || die - rmdir ${d} || die - done - - # Now we collect everything intp the proper SLOT-ed dirs - # When something is built to cross-compile, it installs into - # /usr/$CHOST/ by default ... we have to 'fix' that :) - if is_cross ; then - cd "${ED}"/${BINPATH} || die - for x in * ; do - mv ${x} ${x/${CTARGET}-} || die - done - - if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then - mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH} - mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/ - rm -r "${ED}"/usr/${CHOST}/{include,lib} - fi - fi - - insinto ${INCPATH} - local libiberty_headers=( - # Not all the libiberty headers. See libiberty/Makefile.in:install_to_libdir. - demangle.h - dyn-string.h - fibheap.h - hashtab.h - libiberty.h - objalloc.h - splay-tree.h - ) - doins "${libiberty_headers[@]/#/${S}/include/}" - if [[ -d ${ED}/${LIBPATH}/lib ]] ; then - mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/ || die - rm -r "${ED}"/${LIBPATH}/lib || die - fi - - # Generate an env.d entry for this binutils - insinto /etc/env.d/binutils - cat <<-EOF > "${T}"/env.d - TARGET="${CTARGET}" - VER="${PV}" - LIBPATH="${EPREFIX}${LIBPATH}" - EOF - newins "${T}"/env.d ${CTARGET}-${PV} - - # Handle documentation - if ! is_cross ; then - cd "${S}" || die - dodoc README - - docinto bfd - dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO - - docinto binutils - dodoc binutils/ChangeLog binutils/NEWS binutils/README - - docinto gas - dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README* - - docinto gprof - dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl - - docinto ld - dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO - - docinto libiberty - dodoc libiberty/ChangeLog* libiberty/README - - docinto opcodes - dodoc opcodes/ChangeLog* - fi - - # Remove shared info pages - rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info} - - # Trim all empty dirs - find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null -} - -pkg_postinst() { - # Make sure this ${CTARGET} has a binutils version selected - [[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0 - binutils-config ${CTARGET}-${PV} -} - -pkg_postrm() { - local current_profile=$(binutils-config -c ${CTARGET}) - - # If no other versions exist, then uninstall for this - # target ... otherwise, switch to the newest version - # Note: only do this if this version is unmerged. We - # rerun binutils-config if this is a remerge, as - # we want the mtimes on the symlinks updated (if - # it is the same as the current selected profile) - if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${PV} ]] ; then - local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}') - choice=${choice//$'\n'/ } - choice=${choice/* } - if [[ -z ${choice} ]] ; then - env -i ROOT="${ROOT}" binutils-config -u ${CTARGET} - else - binutils-config ${choice} - fi - elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${PV} ]] ; then - binutils-config ${CTARGET}-${PV} - fi -} - -# Note [slotting support] -# ----------------------- -# Gentoo's layout for binutils files is non-standard as Gentoo -# supports slotted installation for binutils. Many tools -# still expect binutils to reside in known locations. -# binutils-config package restores symlinks into known locations, -# like: -# /usr/bin/${CTARGET}-<tool> -# /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips -# /usr/include/ -# -# Note [tooldir hack for ldscripts] -# --------------------------------- -# Build system does not allow ./configure to tweak every location -# we need for slotting binutils hence all the shuffling in -# src_install(). This note is about SCRIPTDIR define handling. -# -# SCRIPTDIR defines 'ldscripts/' directory location. SCRIPTDIR value -# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib' -# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time. -# Thus we can't just move files around after compilation finished. -# -# Our goal is the following: -# - at build-time set scriptdir to point to symlinked location: -# ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case) -# - at install-time set scriptdir to point to slotted location: -# ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV} diff --git a/sys-devel/binutils/binutils-2.39-r4.ebuild b/sys-devel/binutils/binutils-2.40-r8.ebuild index 8f34b15b0e..5f1cfd4510 100644 --- a/sys-devel/binutils/binutils-2.39-r4.ebuild +++ b/sys-devel/binutils/binutils-2.40-r8.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2022 Gentoo Authors +# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 @@ -9,8 +9,7 @@ DESCRIPTION="Tools necessary to build programs" HOMEPAGE="https://sourceware.org/binutils/" LICENSE="GPL-3+" -IUSE="cet default-gold doc gold gprofng multitarget +nls pgo +plugins static-libs test vanilla" -REQUIRED_USE="default-gold? ( gold )" +IUSE="cet debuginfod doc gold gprofng multitarget +nls pgo +plugins static-libs test vanilla zstd" # Variables that can be set here (ignored for live ebuilds) # PATCH_VER - the patchset version @@ -20,7 +19,7 @@ REQUIRED_USE="default-gold? ( gold )" # PATCH_DEV - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/... # for the patchsets -PATCH_VER=5 +PATCH_VER=7 PATCH_DEV=dilfridge if [[ ${PV} == 9999* ]]; then @@ -29,11 +28,11 @@ if [[ ${PV} == 9999* ]]; then else PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}} PATCH_DEV=${PATCH_DEV:-dilfridge} - SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PV}.tar.xz" + SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz https://sourceware.org/pub/binutils/releases/binutils-${PV}.tar.xz https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PV}.tar.xz" [[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI} https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz" SLOT=$(ver_cut 1-2) - KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" + KEYWORDS="~amd64-linux ~x86-linux ~x64-solaris" fi # @@ -53,6 +52,10 @@ is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; } RDEPEND=" >=sys-devel/binutils-config-3 sys-libs/zlib + debuginfod? ( + dev-libs/elfutils[debuginfod(-)] + ) + zstd? ( app-arch/zstd:= ) " DEPEND="${RDEPEND}" BDEPEND=" @@ -62,15 +65,15 @@ BDEPEND=" sys-devel/bc ) nls? ( sys-devel/gettext ) + zstd? ( virtual/pkgconfig ) sys-devel/flex - virtual/yacc + app-alternatives/yacc " RESTRICT="!test? ( test )" PATCHES=( "${FILESDIR}"/${PN}-2.22-solaris-anonymous-version-script-fix.patch - "${FILESDIR}"/${PN}-2.39-protected-visibility-solaris.patch ) MY_BUILDDIR=${WORKDIR}/build @@ -116,6 +119,10 @@ src_prepare() { einfo "Applying binutils patchset ${patchsetname}" eapply "${WORKDIR}/patch" einfo "Done." + + # This is applied conditionally for now just out of caution. + # It should be okay on non-prefix systems though. See bug #892549. + use prefix && eapply "${FILESDIR}"/binutils-2.40-linker-search-path.patch fi fi @@ -175,9 +182,16 @@ src_configure() { # Keep things sane strip-flags - + use cet && filter-flags -mindirect-branch -mindirect-branch=* use elibc_musl && append-ldflags -Wl,-z,stack-size=2097152 + # ideally we want !tc-ld-is-bfd for best future-proofing, but it needs + # https://github.com/gentoo/gentoo/pull/28355 + # mold needs this too but right now tc-ld-is-mold is also not available + if tc-ld-is-lld; then + append-ldflags -Wl,--undefined-version + fi + local x echo for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do @@ -194,9 +208,6 @@ src_configure() { # enable gold (installed as ld.gold) and ld's plugin architecture if use gold ; then myconf+=( --enable-gold ) - if use default-gold; then - myconf+=( --enable-gold=default ) - fi fi if use nls ; then @@ -245,6 +256,11 @@ src_configure() { --libdir="${EPREFIX}"${LIBPATH} --libexecdir="${EPREFIX}"${LIBPATH} --includedir="${EPREFIX}"${INCPATH} + # portage's econf() does not detect presence of --d-d-t + # because it greps only top-level ./configure. But not + # libiberty's or bfd's configure. + --disable-dependency-tracking + --disable-silent-rules --enable-obsolete --enable-shared --enable-threads @@ -274,6 +290,8 @@ src_configure() { --with-bugurl="$(toolchain-binutils_bugurl)" --with-pkgversion="$(toolchain-binutils_pkgversion)" $(use_enable static-libs static) + $(use_with zstd) + # Disable modules that are in a combined binutils/gdb tree, bug #490566 --disable-{gdb,libdecnumber,readline,sim} # Strip out broken static link flags. @@ -326,11 +344,11 @@ src_compile() { cd "${MY_BUILDDIR}" || die # see Note [tooldir hack for ldscripts] - emake V=1 tooldir="${EPREFIX}${TOOLPATH}" all + emake tooldir="${EPREFIX}${TOOLPATH}" all # only build info pages if the user wants them if use doc ; then - emake V=1 info + emake info fi # we nuke the manpages when we're left with junk @@ -344,7 +362,7 @@ src_test() { # bug #637066 filter-flags -Wall -Wreturn-type - emake -k V=1 check + emake -k check } src_install() { @@ -353,7 +371,7 @@ src_install() { cd "${MY_BUILDDIR}" || die # see Note [tooldir hack for ldscripts] - emake V=1 DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install + emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install rm -rf "${ED}"/${LIBPATH}/bin || die use static-libs || find "${ED}" -name '*.la' -delete diff --git a/sys-devel/binutils/files/binutils-2.24-cygwin-nointl.patch b/sys-devel/binutils/files/binutils-2.24-cygwin-nointl.patch deleted file mode 100644 index 753996335b..0000000000 --- a/sys-devel/binutils/files/binutils-2.24-cygwin-nointl.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/bfd/configure b/bfd/configure -index eeeb89a..6b7c5b8 100755 ---- a/bfd/configure -+++ b/bfd/configure -@@ -15105,7 +15105,7 @@ if test "$enable_shared" = "yes"; then - case "${host}" in - *-*-cygwin*) - SHARED_LDFLAGS="-no-undefined" -- SHARED_LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin -lkernel32" -+ SHARED_LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl \$(LIBINTL) -lcygwin -lkernel32" - ;; - - # Hack to build or1k-src on OSX -diff --git a/opcodes/configure b/opcodes/configure -index e5048e2..1e9ca69 100755 ---- a/opcodes/configure -+++ b/opcodes/configure -@@ -12456,7 +12456,7 @@ if test "$enable_shared" = "yes"; then - case "${host}" in - *-*-cygwin*) - SHARED_LDFLAGS="-no-undefined" -- SHARED_LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin" -+ SHARED_LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty -L`pwd`/../intl \$(LIBINTL) -lcygwin" - ;; - *-*-darwin*) - SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.dylib ${SHARED_LIBADD}" diff --git a/sys-devel/binutils/files/binutils-2.29.1-nogoldtest.patch b/sys-devel/binutils/files/binutils-2.29.1-nogoldtest.patch deleted file mode 100644 index 8e0669922d..0000000000 --- a/sys-devel/binutils/files/binutils-2.29.1-nogoldtest.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 40f6e93e5078f16897f23856886566fe3b546206 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org> -Date: Fri, 3 Nov 2017 21:51:35 +0100 -Subject: [PATCH] Gentoo: Disable gold testsuite for users since it fails - upstream - -https://bugs.gentoo.org/634348 -https://sourceware.org/bugzilla/show_bug.cgi?id=21090 ---- - Makefile.in | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/Makefile.in b/Makefile.in -index 3acb83b8de..49de829bfa 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -2340,7 +2340,6 @@ check-host: \ - maybe-check-mpc \ - maybe-check-isl \ - maybe-check-libelf \ -- maybe-check-gold \ - maybe-check-gprof \ - maybe-check-intl \ - maybe-check-tcl \ --- -2.15.0 - diff --git a/sys-devel/binutils/files/binutils-2.33-gcc-10.patch b/sys-devel/binutils/files/binutils-2.33-gcc-10.patch deleted file mode 100644 index 9e1a999be9..0000000000 --- a/sys-devel/binutils/files/binutils-2.33-gcc-10.patch +++ /dev/null @@ -1,39 +0,0 @@ -binutils: drop redundant 'program_name' definition - -https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=0b398d69acde3377dfbbeb8a4cfe87ae8c8562fa ---- a/binutils/coffdump.c -+++ b/binutils/coffdump.c -@@ -456,8 +456,6 @@ coff_dump (struct coff_ofile *ptr) - dump_coff_section (ptr->sections + i); - } - --char * program_name; -- - static void - show_usage (FILE *file, int status) - { ---- a/binutils/srconv.c -+++ b/binutils/srconv.c -@@ -1687,8 +1687,6 @@ prescan (struct coff_ofile *otree) - } - } - --char *program_name; -- - ATTRIBUTE_NORETURN static void - show_usage (FILE *ffile, int status) - { ---- a/binutils/sysdump.c -+++ b/binutils/sysdump.c -@@ -633,8 +633,6 @@ module (void) - } - } - --char *program_name; -- - ATTRIBUTE_NORETURN static void - show_usage (FILE *ffile, int status) - { --- -2.25.0 - diff --git a/sys-devel/binutils/files/binutils-2.34-riscv-SEGV.patch b/sys-devel/binutils/files/binutils-2.34-riscv-SEGV.patch deleted file mode 100644 index ac70e50491..0000000000 --- a/sys-devel/binutils/files/binutils-2.34-riscv-SEGV.patch +++ /dev/null @@ -1,40 +0,0 @@ -https://sourceware.org/PR25900 -https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=a2714d6cca1f1c7695f8dc84b49a4a51d1db86c8 - -From a2714d6cca1f1c7695f8dc84b49a4a51d1db86c8 Mon Sep 17 00:00:00 2001 -From: Alan Modra <amodra@gmail.com> -Date: Fri, 1 May 2020 15:32:00 +0930 -Subject: [PATCH] PR25900, RISC-V: null pointer dereference - - PR 25900 - * elfnn-riscv.c (_bfd_riscv_relax_section): Check root.type before - accessing root.u.def of symbols. Also check root.u.def.section - is non-NULL. Reverse tests so as to make the logic positive. - ---- a/bfd/elfnn-riscv.c -+++ b/bfd/elfnn-riscv.c -@@ -4161,15 +4161,16 @@ _bfd_riscv_relax_section (bfd *abfd, asection *sec, - symval = 0; - sym_sec = bfd_und_section_ptr; - } -- else if (h->root.u.def.section->output_section == NULL -- || (h->root.type != bfd_link_hash_defined -- && h->root.type != bfd_link_hash_defweak)) -- continue; -- else -+ else if ((h->root.type == bfd_link_hash_defined -+ || h->root.type == bfd_link_hash_defweak) -+ && h->root.u.def.section != NULL -+ && h->root.u.def.section->output_section != NULL) - { - symval = h->root.u.def.value; - sym_sec = h->root.u.def.section; - } -+ else -+ continue; - - if (h->type != STT_FUNC) - reserve_size = --- -2.18.2 - diff --git a/sys-devel/binutils/files/binutils-2.39-protected-visibility-solaris.patch b/sys-devel/binutils/files/binutils-2.39-protected-visibility-solaris.patch deleted file mode 100644 index 2e83e74b8d..0000000000 --- a/sys-devel/binutils/files/binutils-2.39-protected-visibility-solaris.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 2c43d202aefb2b6f202a44bbb8a0baf251aae845 Mon Sep 17 00:00:00 2001 -From: "H.J. Lu" <hjl.tools@gmail.com> -Date: Mon, 22 Aug 2022 10:26:17 -0700 -Subject: [PATCH] x86: Ignore protected visibility in shared libraries on - Solaris - -On x86, the PLT entry in executable may be used as function address for -functions in shared libraries. If functions are protected, the function -address used in executable can be different from the function address -used in shared library. This will lead to incorrect run-time behavior -if function pointer equality is needed. By default, x86 linker issues -an error in this case. - -On Solaris, linker issued an error for - -struct tm *tb = (kind == CPP_time_kind::FIXED ? gmtime : localtime) (&tt); - -where gmtime is a protected function in libc.so. Use gmtime's PLT entry -in executable as function address is safe since function pointer equality -isn't needed. Ignore protected visibility in shared libraries on Solaris -to disable linker error. If function pointer equality is needed, linker -will silently generate executable with incorrect run-time behavior on -Solaris. - - PR ld/29512 - * elf32-i386.c (elf_i386_scan_relocs): Ignore protected - visibility in shared libraries on Solaris. - * elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise. ---- - bfd/elf32-i386.c | 3 ++- - bfd/elf64-x86-64.c | 3 ++- - 2 files changed, 4 insertions(+), 2 deletions(-) - -diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c -index 52b1db44546..9717e2c5ed6 100644 ---- a/bfd/elf32-i386.c -+++ b/bfd/elf32-i386.c -@@ -1808,7 +1808,8 @@ elf_i386_scan_relocs (bfd *abfd, - || (sec->flags & (SEC_CODE | SEC_READONLY)) != 0) - h->plt.refcount = 1; - -- if (h->pointer_equality_needed -+ if (htab->elf.target_os != is_solaris -+ && h->pointer_equality_needed - && h->type == STT_FUNC - && eh->def_protected - && !SYMBOL_DEFINED_NON_SHARED_P (h) -diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c -index 62a9a22317a..f3b54400013 100644 ---- a/bfd/elf64-x86-64.c -+++ b/bfd/elf64-x86-64.c -@@ -2251,7 +2251,8 @@ elf_x86_64_scan_relocs (bfd *abfd, struct bfd_link_info *info, - || (sec->flags & (SEC_CODE | SEC_READONLY)) != 0) - h->plt.refcount = 1; - -- if (h->pointer_equality_needed -+ if (htab->elf.target_os != is_solaris -+ && h->pointer_equality_needed - && h->type == STT_FUNC - && eh->def_protected - && !SYMBOL_DEFINED_NON_SHARED_P (h) --- -2.31.1 - diff --git a/sys-devel/binutils/files/binutils-2.40-linker-search-path.patch b/sys-devel/binutils/files/binutils-2.40-linker-search-path.patch new file mode 100644 index 0000000000..7423f8d705 --- /dev/null +++ b/sys-devel/binutils/files/binutils-2.40-linker-search-path.patch @@ -0,0 +1,74 @@ +https://bugs.gentoo.org/892549 +https://github.com/gentoo/binutils-gdb/pull/4 + +From 1601840f9f2397edd56177871527a198a14277bd Mon Sep 17 00:00:00 2001 +From: James Le Cuirot <chewi@gentoo.org> +Date: Sat, 11 Feb 2023 15:15:20 +0000 +Subject: [PATCH 1/2] ldelf.c: Always consider -L arguments when handling + DT_NEEDED + +This is for consistency with other linkers, including gold. Without +this, we typically rely on ld.so.conf to find libraries such as +libstdc++.so.6, while other linkers do not use this file at all. +--- a/ld/ldelf.c ++++ b/ld/ldelf.c +@@ -1090,8 +1090,8 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab, + linker will search. That means that we want to use + rpath_link, rpath, then the environment variable + LD_LIBRARY_PATH (native only), then the DT_RPATH/DT_RUNPATH +- entries (native only), then the linker script LIB_SEARCH_DIRS. +- We do not search using the -L arguments. ++ entries (native only), then the linker script LIB_SEARCH_DIRS, ++ then the -L arguments. + + We search twice. The first time, we skip objects which may + introduce version mismatches. The second time, we force +@@ -1165,11 +1165,7 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab, + len = strlen (l->name); + for (search = search_head; search != NULL; search = search->next) + { +- char *filename; +- +- if (search->cmdline) +- continue; +- filename = (char *) xmalloc (strlen (search->name) + len + 2); ++ char *filename = (char *) xmalloc (strlen (search->name) + len + 2); + sprintf (filename, "%s/%s", search->name, l->name); + nn.name = filename; + if (ldelf_try_needed (&nn, force, is_linux)) + +From 8afc65c8d8c0fff2f686ddd8eb9023c7ebabcca9 Mon Sep 17 00:00:00 2001 +From: James Le Cuirot <chewi@gentoo.org> +Date: Sat, 11 Feb 2023 15:18:58 +0000 +Subject: [PATCH 2/2] ldelf.c: Do not search for libraries using ld.so.conf + +Other linkers do not do this. It is problematic for Gentoo Linux, +because crossdev installs libraries such as libstdc++.so.6 outside of +the sysroot. +--- a/ld/ld.texi ++++ b/ld/ld.texi +@@ -2355,7 +2355,9 @@ For a linker for a Linux system, if the file @file{/etc/ld.so.conf} + exists, the list of directories found in that file. Note: the path + to this file is prefixed with the @code{sysroot} value, if that is + defined, and then any @code{prefix} string if the linker was +-configured with the @command{--prefix=<path>} option. ++configured with the @command{--prefix=<path>} option. This has feature has ++been disabled on Gentoo Linux to make it consistent with the other ++linkers, which do not do this. + @item + For a native linker on a FreeBSD system, any directories specified by + the @code{_PATH_ELF_HINTS} macro defined in the @file{elf-hints.h} +--- a/ld/ldelf.c ++++ b/ld/ldelf.c +@@ -1156,10 +1156,6 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab, + if (is_freebsd + && ldelf_check_ld_elf_hints (l, force, elfsize)) + break; +- +- if (is_linux +- && ldelf_check_ld_so_conf (l, force, elfsize, prefix)) +- break; + } + + len = strlen (l->name); + diff --git a/sys-devel/binutils/files/binutils-configure-LANG.patch b/sys-devel/binutils/files/binutils-configure-LANG.patch new file mode 100644 index 0000000000..5521d196cf --- /dev/null +++ b/sys-devel/binutils/files/binutils-configure-LANG.patch @@ -0,0 +1,65 @@ +The LANG vars aren't reset early enough so when sed tries to use [a-zA-Z] in +option parsing, it may break. + +http://bugs.gentoo.org/103483 +http://bugs.gentoo.org/122216 + +--- configure ++++ configure +@@ -54,6 +54,19 @@ + infodir='${prefix}/info' + mandir='${prefix}/man' + ++# NLS nuisances. ++for as_var in \ ++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ ++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ ++ LC_TELEPHONE LC_TIME ++do ++ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then ++ eval $as_var=C; export $as_var ++ else ++ unset $as_var ++ fi ++done ++ + # Initialize some other variables. + subdirs= + MFLAGS= MAKEFLAGS= +@@ -452,16 +463,6 @@ + esac + done + +-# NLS nuisances. +-# Only set these to C if already set. These must not be set unconditionally +-# because not all systems understand e.g. LANG=C (notably SCO). +-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +-# Non-C LC_CTYPE values break the ctype check. +-if test "${LANG+set}" = set; then LANG=C; export LANG; fi +-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi +- + # confdefs.h avoids OS command line length limits that DEFS can exceed. + rm -rf conftest* confdefs.h + # AIX cpp loses on an empty file, so make sure it contains at least a newline. +@@ -1850,6 +1850,19 @@ + # Compiler output produced by configure, useful for debugging + # configure, is in ./config.log if it exists. + ++# NLS nuisances. ++for as_var in \ ++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ ++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ ++ LC_TELEPHONE LC_TIME ++do ++ if (set +x; test -z "`(eval \$as_var=C; export \$as_var) 2>&1`"); then ++ eval \$as_var=C; export \$as_var ++ else ++ unset \$as_var ++ fi ++done ++ + ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" + for ac_option + do diff --git a/sys-devel/gcc-config/gcc-config-1.9.1.ebuild b/sys-devel/gcc-config/gcc-config-1.9.1.ebuild index a68eabd9da..3746c85755 100644 --- a/sys-devel/gcc-config/gcc-config-1.9.1.ebuild +++ b/sys-devel/gcc-config/gcc-config-1.9.1.ebuild @@ -11,7 +11,7 @@ if [[ ${PV} == 9999 ]]; then else SRC_URI="mirror://gentoo/${P}.tar.xz https://dev.gentoo.org/~dilfridge/distfiles/${P}.tar.xz" - KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt" + KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" fi DESCRIPTION="Utility to manage compilers" diff --git a/sys-devel/gcc-config/gcc-config-2.7-r1.ebuild b/sys-devel/gcc-config/gcc-config-2.7-r1.ebuild index 94cc8b75cf..64422c4e79 100644 --- a/sys-devel/gcc-config/gcc-config-2.7-r1.ebuild +++ b/sys-devel/gcc-config/gcc-config-2.7-r1.ebuild @@ -8,7 +8,7 @@ if [[ ${PV} == 9999 ]]; then inherit git-r3 else SRC_URI="https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}.tar.xz" - KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt" + KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" fi DESCRIPTION="Utility to manage compilers" diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest index 2b4ecba53e..cdd006894a 100644 --- a/sys-devel/gcc/Manifest +++ b/sys-devel/gcc/Manifest @@ -1,9 +1,3 @@ -DIST gcc-10.2.0-patches-6.tar.bz2 24103 BLAKE2B f719012f86136ad9c4ea1397548caca6e69687534599a88cc25fe0e4f83dd7fd34c07375fa6e612e2b430e078c1a59913160cce07312e94fa1ce575a33e5457b SHA512 61d97dba29024c7a22806689ebf33f5cb9ce099230bcc344f2865b976c3fdfd8ebec5962eaffd0156de75eca58499ba785867bd4a4ac92c6f799ab1bee8844a1 -DIST gcc-10.2.0.tar.xz 75004144 BLAKE2B 1d79397330354e61439283cac96a109bf78ffc726265442e6d3ec131f107589ab7349d6612836edd8c8512f7bcc1d901a65a0d5d925d28a5bf3ef5cc3f9787ee SHA512 42ae38928bd2e8183af445da34220964eb690b675b1892bbeb7cd5bb62be499011ec9a93397dba5e2fb681afadfc6f2767d03b9035b44ba9be807187ae6dc65e -DIST gcc-10.3.0-patches-3.tar.bz2 18935 BLAKE2B 13eaf1e055b5b63069aed1575ed93f6bc822b5e3f2181ddfc88f4e7ff801f58997cd131b2efd79b90469b1f861db994feb2adcaecacf165442078f76e233fd9a SHA512 c3d6a6f32863cc0ff7c877314ff0c00a892e473f64d16b82d46b4a77aa97c3e7a575492d27f0d423acb2621c86c9a49bca0e26e45bda9e697495444fcac85084 -DIST gcc-10.3.0.tar.xz 76692288 BLAKE2B ac7898f5eb8a7c5f151a526d1bb38913a68b50a65e4d010ac09fa20b6c801c671c790d780f23ccb8e4ecdfc686f4aa588082ccc9eb5c80c7b0e30788f824c1eb SHA512 2b2dd7453d48a398c29eaebd1422b70341001b8c90a62aee51e83344e7fdd8a8e45f82a4a9165bd7edc76dada912c932f4b6632c5636760fec4c5d7e402b3f86 -DIST gcc-11.2.0-patches-1.tar.bz2 11537 BLAKE2B 9dd791ada244c9b70b8b99f9f305a688c248134715ed1b26d406e53b114983faae6873cdc521497164388d24d5f61c199e98df146bc02f5578e877295bcf5c82 SHA512 6539efc60c656d0798a5896dc1b944ed69914b815102c7a1c10bdba4ef935abd326b01309f38316e121f1ed90ceb2abcaf65df6af116892daad829ac2623cefc -DIST gcc-11.2.0.tar.xz 80888824 BLAKE2B 69b61234ac436edfea2933df68c434a2ce7aa4454ef4da573e82587e1a42dc420189e949cfdadaf4cb37fc0de9674822210a95b77ff03aca0dbedfe67df19cc6 SHA512 d53a0a966230895c54f01aea38696f818817b505f1e2bfa65e508753fcd01b2aedb4a61434f41f3a2ddbbd9f41384b96153c684ded3f0fa97c82758d9de5c7cf DIST gcc-12.1-darwin-r0.tar.gz 131006433 BLAKE2B fe94275821772586b90d003e5179a72c5662216d216db6b7fd066df8873744d5edff25521f3f30cb08d45f59545fa03e44364bdf831998a0285c0ba5df0c1547 SHA512 8bfae411e8f6f853ad50cda4f7bd672217883b305893c8dda9f630d712d8ef0857e89c8f4ce6c446340041d8da2ec98e6dfcc99861e844eb99c6f837e4f47dbb DIST gcc-12.1.0-musl-patches-4.tar.xz 4448 BLAKE2B ddad7bccea7474a0552e069df25e66b4af68470da655aaf7669c2ceca7d0588cebb171e8a949c8935eeadff23af4d3de41d44245c06d48044cfc1d1fadc6540a SHA512 bb3b9e4a81efd2d0ceb405220a9c15453d780d8bc01ed5ebf4837a318e0f8ad8cc36d6ad3f2eed5051bb6dc82f223d8b61321b8f602890a770eefd69c0c144b9 DIST gcc-12.1.0-patches-7.tar.xz 11584 BLAKE2B 4487726f8225d6bb2fde91fce8343c34ebece8cca08b258115a55b0f0c594e3a205efe26738c2b06cb8c6ea9d13b451514e073bb3a94d664a56120d9826515df SHA512 4882754d2f55c8144a5af4bcfbc1ee7802f08fc5acca96151cc6323a98e94b9246a69e067bcbf92dcdb8021499b8e1197cd7bd682876aca3e6f1f63a405c1dae @@ -12,8 +6,14 @@ DIST gcc-12.2-darwin-r0.tar.gz 131069986 BLAKE2B 42de71c9f0802f1a43e675d3fae7341 DIST gcc-12.2.0-musl-patches-1.tar.xz 3844 BLAKE2B 004432806696f7d0a32366270ac45695e858abee73a255e44dc6e0a225339e4cad40aab0d51dfe9a55d5aa4b4001f5726064bb2eea3212a0874b2d27e229abd7 SHA512 c354edcd641a9dfaf902a0ff4c44c75065d0cf1c36bbf6c3c35c2e23bff22b8f70bcf4458a5a0ef86371e9f2fafca8a54ca822e35820ff442c9458a2819c3606 DIST gcc-12.2.0-patches-1.tar.xz 12864 BLAKE2B a5ae0a85dfc1b6f0bd968f0d5262ebed14ec9cdb3249e3a4c571578c54eda0e53708ee7fe8e03e506366c7f3cf7926eced9b390d9dee948c1249298c0fabd9fb SHA512 f3d793b89a2a0385d596162fb0c653d4acdf21ae418cb792c1786a01fde0391bd0719715dbf07d53636f127168f5cd99108a1dc11cf6cea889b7d82385bcc258 DIST gcc-12.2.0.tar.xz 84645292 BLAKE2B 715574af9ad678f9dc8cfd19c866bf910c7edfd479e7e9681337feaa9b54e5d304ddb85483816b8d89754d502405823ae2eff0d1e444538763f40be8e428d8da SHA512 e9e857bd81bf7a370307d6848c81b2f5403db8c7b5207f54bce3f3faac3bde63445684092c2bc1a2427cddb6f7746496d9fbbef05fbbd77f2810b2998f1f9173 -DIST gcc-8.3.0-patches-1.0.tar.bz2 12278 BLAKE2B 793465c5de0af850c7f3017b3011e68f3bd1664e6ce3500a3dc3003d37c03fe81857698957770a135eadd395a7767fa804d354ecdcdeb1d83623280ca569d4ec SHA512 0efadd2481713992807fed2683666f1094b3757674754601c079569f3ef70cd7aed3cefc9f815f4e59a21d37e4e940c122df714e16f3878a5f966450c4273669 -DIST gcc-8.3.0.tar.xz 63694700 BLAKE2B 71df2ff5bd6874d57519c2e9af6b22152c8c4d7fab906a5f427b41bc4e8e742127592a8684120d9d3c9ce6241439531850be08ec0a4f29dbfdee95435655fdca SHA512 1811337ae3add9680cec64968a2509d085b6dc5b6783fc1e8c295e3e47416196fd1a3ad8dfe7e10be2276b4f62c357659ce2902f239f60a8648548231b4b5802 -DIST gcc-9.2.0-patches-4.tar.bz2 21655 BLAKE2B 2acf6d83ec934a65e77d2079a024b42622e1234f0516f12839f7d03c2f3e1bb275037b020e35ba847d6809d5577ba966619c78345b75355df0a754d02ccf9819 SHA512 114e01a7b08ecb1feab24ef3cfc72c8953748f1526722b80c18602025eef132e2b4c05db59c7a23eb2e7f42ed48eb02d92bcd73b1ca932374d6bedaf89cc66d0 -DIST gcc-9.2.0.tar.xz 70607648 BLAKE2B 41a5e148f9a6857d6599679964c203533f76f330ad527fbe7c5e746d78f6f6f6d6d0f330a67cb1e794e155be8d1cd6e986bcc8a116d620dca410b78f0bcdd453 SHA512 a12dff52af876aee0fd89a8d09cdc455f35ec46845e154023202392adc164848faf8ee881b59b681b696e27c69fd143a214014db4214db62f9891a1c8365c040 -DIST gcc-cygwinports-0de6b2ae6b6577eb0891a7ca8d551bdfa79bf5e8.tar.gz 20183 BLAKE2B dc9a4c78f98851ed77720d4c06d3fbf9f2d7d0e81a825cc89026994060fd29214f111fd3a52cec6518417cab2be89caf4a844a0869136287f174147ca7a6ebf3 SHA512 d01ee85a1327e7f6f16b3c2de6659699764f365215bd3e58247c5c65594153b9232bdc43ff89420cac75ad908ed39c7ff9fa4006818f5dd209b792d34d9ae7de +DIST gcc-13-20240323.tar.xz 84414636 BLAKE2B cd95fc9d83d9e2477597543af5ec4e9ac82029eca6deb8cd8f82b71132e3a54e5a770be201c9e596c48f936a169f60e19979128527f41086a9a12deebbfebb26 SHA512 b25fb0efbe7346f72407ad1102d877f2ed5b40a8bff88018db4541d15cd47a849d7aeb8706be3c2ca6256fc073fe6881c8ba74db220c80b01666195d3be038d4 +DIST gcc-13.2-darwin-r0.tar.gz 137958605 BLAKE2B b6777b76baf2dc007c4080c0b7a6d448223747f0cf832e493e3b903b3bdb7f87a0e2e9cf41f9355769b178a72409b1e2866b3e73b1cc33ed0aba837f3a9e66c1 SHA512 a33177bd55d228d1df93e2a029e8af5d215ad8b2ebc84a0c90df629d6f69c5de0ed1ec9dd27bc21a62362522d83bad9a8f34407b89b13321b65f513fa2202dd2 +DIST gcc-13.2.0-arm64-darwin.patch 470156 BLAKE2B 5ba9c380d488c1ceda2f4ece68701a51d1de3d82f6aa9c96f33c4f2066e7053356c00158eec524298c16c916ff1d14bb3560eedb90f09bade44970156e86c604 SHA512 4428340c79cad8f4324bb4f5962640805f45e4a2a2be165abb0386e283f863fad9dbff8eefa508ee30ba966691f604fdadfb4d42bc9cc4c29536feaae5c1f55a +DIST gcc-13.2.0-musl-patches-2.tar.xz 5292 BLAKE2B c057d6574d03c05854edaa9f3fd40e9149662b04f3ac7a7db3eb078d73a7b535726d1bf52e5b12736dedb2f9898ad731f2e48a6421fcfbf7b90f929dee072fcb SHA512 a691da0c87c443a5e9d23731f4005f27871c5b12bc9102873ffa24d374aa7b9fbd187c4f5635d23fa9ffb17e351e76173c2d3fdf40646e355c4cb314b538de69 +DIST gcc-13.2.0-patches-14.tar.xz 46928 BLAKE2B fce23bc5315f35b04a4976550c4b44578944a1b17e40c7553351eeb8a1ef0f3a2538da5a5e1ae6f37b784ff11bbd8a44b8f6eec542be63e34d984dee69e1cd81 SHA512 d7d52bb2915fd89c06b0134bede8db939cadbb1f2dcddf923bee2c3f9f577ff9e5e986b60420d892539edf82867a0d1bd635807814bc618b06a2b37cdaca893a +DIST gcc-13.2.0-patches-7.tar.xz 37064 BLAKE2B 4a8700a8d44bfaa84926f8bfd0da4c5b0c0377f47fc0679456e909f7c9029b9cf1b72c0ba0bc505d9035d5c38e27f7e5b029727eaf2bc7aca417a6be966b2f43 SHA512 f440c97e6782ecb8581d41608e31a648ac426e2d870bc1d171da7794cdeff2fd0546cae0c7214e72fd3a00ead8a5c66f3f633b670b74553a2f3a40378b51f20c +DIST gcc-13.2.0.tar.xz 87858592 BLAKE2B 0034b29d3d6cc05821f0c4253ce077805943aff7b370729dd203bda57d89c107edd657eeddc2fb1e69ea15c7b0323b961f46516c7f4af89a3ccf7fea84701be2 SHA512 d99e4826a70db04504467e349e9fbaedaa5870766cda7c5cab50cdebedc4be755ebca5b789e1232a34a20be1a0b60097de9280efe47bdb71c73251e30b0862a2 +DIST gcc-14-20240225.tar.xz 87651536 BLAKE2B 01283581b8684e0dce73b2d9a586e473f3c87753435d905e193816911edc06f9bd2a8d542a95d69f47f1c884124349520f410925b13b7bb51b913e603000d32f SHA512 f424b0935d8fdcf9ff55067467eac20a518a11c2cb14928a47e1a218cde1f4238091f25861daf417d1125c5d5d5465d32fc1b3cb04504b3ca99fe27a7a7d5792 +DIST gcc-14.0.0-musl-patches-1.tar.xz 3576 BLAKE2B 692baee8a7709905d53aeb150d73a3721c4ba47ee5f397cfb1b5be905cf003ca02b60c94ee294d90ac39645cd5cdf186c7a3aa950c47d8cf680c128ed705b807 SHA512 0592ab98a7142e404623a6511c67dff61e9ade32c3fb2c0e75b456306e0af3799ad13252b50b3d2fdd31e5815d7f0b16b0ad63ab8386fe4d78729fc9c182d617 +DIST gcc-14.0.0-patches-24.tar.xz 14280 BLAKE2B f5594e07f91a7871fc4470d84ecbf6576f53620c92f60821d2fdcf140869827d27a323d535af11b74f4b671ee7308e501f24841ceb0607ca3ebc032bd97d85b4 SHA512 d887b53a0849246bc79ee2510d7deffabc58fe7598e9e147e4a97fc3714341017627df3dae9a39ae5d3185946cb6e11d01a28aa1287958c401e641fa4312f48b +DIST gcc-darwin-arm64-14.0.1_pre20240225.tar.gz 143722125 BLAKE2B 23bc15e1243d10e897c6bd78cc0459c4163e767867d29a354aa51335703d3cee669b550816f2dad3becbade5a604a269bb52c8518e0f58338a61433d378d0a3c SHA512 a83c9764a7525a0768c871ef75915ad8dd5169873b29dc7c7b2413f2e7ab03c8c64888df4dbd74d0e82163cc760c01cec750e729b6df4ead03f23d6065b114d6 diff --git a/sys-devel/gcc/files/4.0.2/gcc-4.0.2-softfloat.patch b/sys-devel/gcc/files/4.0.2/gcc-4.0.2-softfloat.patch deleted file mode 100644 index e49fea61a1..0000000000 --- a/sys-devel/gcc/files/4.0.2/gcc-4.0.2-softfloat.patch +++ /dev/null @@ -1,84 +0,0 @@ -The hunk for gcc/config/arm/t-linux comes from: -http://gcc.gnu.org/PR14352 - -The rest is a custom job by Yuri Vasilevski. - -The idea here is that we add soft float support into the spec file -so that we don't have to worry about packages stripping out softfloat -flags from CFLAGS/CXXFLAGS. - -http://bugs.gentoo.org/75585 - ---- gcc-4.0.2/gcc/config/arm/elf.h -+++ gcc-4.0.2/gcc/config/arm/elf.h -@@ -45,8 +45,9 @@ - #endif - - #ifndef SUBTARGET_ASM_FLOAT_SPEC --#define SUBTARGET_ASM_FLOAT_SPEC "\ --%{mapcs-float:-mfloat}" -+#define SUBTARGET_ASM_FLOAT_SPEC "%{mapcs-float:-mfloat} \ -+ %{mhard-float:-mfpu=fpa} \ -+ %{!mhard-float: %{msoft-float:-mfpu=softfpa;:-mfpu=softvfp}}" - #endif - - #ifndef ASM_SPEC -@@ -58,8 +59,6 @@ - %{mapcs-*:-mapcs-%*} \ - %(subtarget_asm_float_spec) \ - %{mthumb-interwork:-mthumb-interwork} \ --%{msoft-float:-mfloat-abi=soft} %{mhard-float:-mfloat-abi=hard} \ --%{mfloat-abi=*} %{mfpu=*} \ - %(subtarget_extra_asm_spec)" - #endif - ---- gcc-4.0.2/gcc/config/arm/linux-elf.h -+++ gcc-4.0.2/gcc/config/arm/linux-elf.h -@@ -32,18 +32,22 @@ - #endif - - #undef TARGET_DEFAULT_FLOAT_ABI --#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD -+#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT - - #undef TARGET_DEFAULT - #define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT) - -+#undef SUBTARGET_EXTRA_ASM_SPEC -+#define SUBTARGET_EXTRA_ASM_SPEC "%{mhard-float:-mfpu=fpa} \ -+ %{!mhard-float: %{msoft-float:-mfpu=softfpa;:-mfpu=softvfp}}" -+ - #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 - - #define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" - - #undef MULTILIB_DEFAULTS - #define MULTILIB_DEFAULTS \ -- { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" } -+ { "marm", TARGET_ENDIAN_OPTION, "msoft-float", "mno-thumb-interwork" } - - /* The GNU C++ standard library requires that these macros be defined. */ - #undef CPLUSPLUS_CPP_SPEC -@@ -56,7 +60,7 @@ - %{shared:-lc} \ - %{!shared:%{profile:-lc_p}%{!profile:-lc}}" - --#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" -+#define LIBGCC_SPEC "-lgcc" - - /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add - the GNU/Linux magical crtbegin.o file (see crtstuff.c) which ---- gcc-4.0.2/gcc/config/arm/t-linux -+++ gcc-4.0.2/gcc/config/arm/t-linux -@@ -4,7 +4,10 @@ TARGET_LIBGCC2_CFLAGS = -fomit-frame-poi - LIBGCC2_DEBUG_CFLAGS = -g0 - - LIB1ASMSRC = arm/lib1funcs.asm --LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx -+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \ -+ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ -+ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ -+ _fixsfsi _fixunssfsi _floatdidf _floatdisf - - # MULTILIB_OPTIONS = mhard-float/msoft-float - # MULTILIB_DIRNAMES = hard-float soft-float diff --git a/sys-devel/gcc/files/4.1.0/gcc-4.1.0-cross-compile.patch b/sys-devel/gcc/files/4.1.0/gcc-4.1.0-cross-compile.patch deleted file mode 100644 index 523caa48a3..0000000000 --- a/sys-devel/gcc/files/4.1.0/gcc-4.1.0-cross-compile.patch +++ /dev/null @@ -1,40 +0,0 @@ -Some notes on the 'bootstrap with or without libc headers' debate: -http://linuxfromscratch.org/pipermail/lfs-dev/2005-July/052409.html -http://gcc.gnu.org/ml/gcc/2005-07/msg01195.html - ---- gcc/unwind-dw2.c -+++ gcc/unwind-dw2.c -@@ -253,9 +253,11 @@ - } - #endif - -+#ifndef inhibit_libc - #ifdef MD_UNWIND_SUPPORT - #include MD_UNWIND_SUPPORT - #endif -+#endif - - /* Extract any interesting information from the CIE for the translation - unit F belongs to. Return a pointer to the byte after the augmentation, ---- gcc/configure -+++ gcc/configure -@@ -12857,7 +12857,7 @@ then - | powerpc*-*-*,powerpc64*-*-*) - CROSS="$CROSS -DNATIVE_CROSS" ;; - esac --elif test "x$TARGET_SYSTEM_ROOT" != x; then -+elif test "x$TARGET_SYSTEM_ROOT" != x -o $build != $host; then - SYSTEM_HEADER_DIR=$build_system_header_dir - fi - ---- gcc/configure.ac -+++ gcc/configure.ac -@@ -1717,7 +1717,7 @@ then - | powerpc*-*-*,powerpc64*-*-*) - CROSS="$CROSS -DNATIVE_CROSS" ;; - esac --elif test "x$TARGET_SYSTEM_ROOT" != x; then -+elif test "x$TARGET_SYSTEM_ROOT" != x -o $build != $host; then - SYSTEM_HEADER_DIR=$build_system_header_dir - fi - diff --git a/sys-devel/gcc/files/4.1.0/gcc-4.1.0-fast-math-i386-Os-workaround.patch b/sys-devel/gcc/files/4.1.0/gcc-4.1.0-fast-math-i386-Os-workaround.patch deleted file mode 100644 index 6090d66d13..0000000000 --- a/sys-devel/gcc/files/4.1.0/gcc-4.1.0-fast-math-i386-Os-workaround.patch +++ /dev/null @@ -1,64 +0,0 @@ -workaround for lame stack packing on i386 ... - - - build gcc with -Os (crtfastmath.o to be specific) - - crtfastmath.o is installed into gcc libdir - - run gcc with -ffast-math and get crtfastmath.o linked in - - resulting compiled app segfaults due to init code in - crtfastmath.o that has mis-aligned structure on stack - -http://bugs.gentoo.org/147020 -http://gcc.gnu.org/PR28621 - -this is supposed to be fixed in current 4.1 branch, but i'm unable to get -the fix to work so until i can figure out what i'm doing wrong, we'll use -this workaround for now. - ---- gcc-4.1.1/gcc/config/i386/crtfastmath.c -+++ gcc-4.1.1/gcc/config/i386/crtfastmath.c -@@ -37,6 +37,23 @@ - #define FXSAVE (1 << 24) - #define SSE (1 << 25) - -+struct -+{ -+ unsigned short int cwd; -+ unsigned short int swd; -+ unsigned short int twd; -+ unsigned short int fop; -+ long int fip; -+ long int fcs; -+ long int foo; -+ long int fos; -+ long int mxcsr; -+ long int mxcsr_mask; -+ long int st_space[32]; -+ long int xmm_space[32]; -+ long int padding[56]; -+} __attribute__ ((aligned (16))) fxsave; -+ - static void __attribute__((constructor)) - set_fast_math (void) - { -@@ -75,22 +92,6 @@ - if (edx & FXSAVE) - { - /* Check if DAZ is available. */ -- struct -- { -- unsigned short int cwd; -- unsigned short int swd; -- unsigned short int twd; -- unsigned short int fop; -- long int fip; -- long int fcs; -- long int foo; -- long int fos; -- long int mxcsr; -- long int mxcsr_mask; -- long int st_space[32]; -- long int xmm_space[32]; -- long int padding[56]; -- } __attribute__ ((aligned (16))) fxsave; - - __builtin_memset (&fxsave, 0, sizeof (fxsave)); - diff --git a/sys-devel/gcc/files/4.2.2/aix-bnoerok.patch b/sys-devel/gcc/files/4.2.2/aix-bnoerok.patch deleted file mode 100644 index acd6fd3d5f..0000000000 --- a/sys-devel/gcc/files/4.2.2/aix-bnoerok.patch +++ /dev/null @@ -1,26 +0,0 @@ -http://gcc.gnu.org/PR46887 -Fix a typo in gcc-local copy of libtool files. -This is triggered in Prefix only, as elibtoolize enables aix_runtime_linking. - ---- ltcf-cxx.sh.orig 2010-04-24 15:32:36.894202675 +0200 -+++ ltcf-cxx.sh 2010-04-24 15:33:08.070885742 +0200 -@@ -204,7 +204,7 @@ - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' - # Warning - without using the other run time loading flags, -berok will - # link without error, but may produce a broken library. -- no_undefined_flag=' ${wl}-bnoerok' -+ no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols=yes ---- libjava/classpath/ltcf-cxx.sh.orig 2010-04-24 15:32:46.967555111 +0200 -+++ libjava/classpath/ltcf-cxx.sh 2010-04-24 15:33:12.627573175 +0200 -@@ -204,7 +204,7 @@ - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' - # Warning - without using the other run time loading flags, -berok will - # link without error, but may produce a broken library. -- no_undefined_flag=' ${wl}-bnoerok' -+ no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols=yes diff --git a/sys-devel/gcc/files/4.2.2/aix-force-pthread-r1.patch b/sys-devel/gcc/files/4.2.2/aix-force-pthread-r1.patch deleted file mode 100644 index 0451a91f17..0000000000 --- a/sys-devel/gcc/files/4.2.2/aix-force-pthread-r1.patch +++ /dev/null @@ -1,42 +0,0 @@ -diff -ru gcc/config/rs6000.orig/t-aix43 gcc/config/rs6000/t-aix43 ---- gcc/config/rs6000.orig/t-aix43 2009-04-17 17:06:51 +0200 -+++ gcc/config/rs6000/t-aix43 2009-04-17 17:13:15 +0200 -@@ -46,7 +46,7 @@ - SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \ - -Wl,-bE:@shlib_map_file@ -o @multilib_dir@/shr.o \ - @multilib_flags@ @shlib_objs@ -lc \ -- `case @multilib_dir@ in \ -+ `case pthread@multilib_dir@ in \ - *pthread*) echo -L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a ;; \ - *) echo -lc ;; esac` ; \ - rm -f @multilib_dir@/tmp-@shlib_base_name@.a ; \ -@@ -61,7 +61,7 @@ - $$(mkinstalldirs) $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@; \ - $(INSTALL_DATA) @multilib_dir@/@shlib_base_name@.a \ - $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/ --SHLIB_LIBS = -lc `case @multilib_dir@ in *pthread*) echo -lpthread ;; esac` -+SHLIB_LIBS = -lc `case pthread@multilib_dir@ in *pthread*) echo -lpthread ;; esac` - SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk - SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver $(srcdir)/config/rs6000/libgcc-ppc64.ver - SHLIB_NM_FLAGS = -Bpg -X32_64 -diff -ru gcc/config/rs6000.orig/t-aix52 gcc/config/rs6000/t-aix52 ---- gcc/config/rs6000.orig/t-aix52 2009-04-17 17:06:50 +0200 -+++ gcc/config/rs6000/t-aix52 2009-04-17 17:13:32 +0200 -@@ -27,7 +27,7 @@ - SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \ - -Wl,-bE:@shlib_map_file@ -o @multilib_dir@/shr.o \ - @multilib_flags@ @shlib_objs@ -lc \ -- `case @multilib_dir@ in \ -+ `case pthread@multilib_dir@ in \ - *pthread*) echo -L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a ;; \ - *) echo -lc ;; esac` ; \ - rm -f @multilib_dir@/tmp-@shlib_base_name@.a ; \ -@@ -42,7 +42,7 @@ - $$(mkinstalldirs) $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@; \ - $(INSTALL_DATA) @multilib_dir@/@shlib_base_name@.a \ - $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/ --SHLIB_LIBS = -lc `case @multilib_dir@ in *pthread*) echo -lpthread ;; esac` -+SHLIB_LIBS = -lc `case pthread@multilib_dir@ in *pthread*) echo -lpthread ;; esac` - SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk - SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver $(srcdir)/config/rs6000/libgcc-ppc64.ver - SHLIB_NM_FLAGS = -Bpg -X32_64 diff --git a/sys-devel/gcc/files/4.2.2/aix-force-pthread.patch b/sys-devel/gcc/files/4.2.2/aix-force-pthread.patch deleted file mode 100644 index fbd3abb62e..0000000000 --- a/sys-devel/gcc/files/4.2.2/aix-force-pthread.patch +++ /dev/null @@ -1,275 +0,0 @@ -diff -ru gcc/config/rs6000.orig/aix41.h gcc/config/rs6000/aix41.h ---- gcc/config/rs6000.orig/aix41.h 2009-04-17 17:06:51 +0200 -+++ gcc/config/rs6000/aix41.h 2009-04-17 17:10:00 +0200 -@@ -39,7 +39,7 @@ - #define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\ - %{ansi: -D_ANSI_C_SOURCE}\ - %{mpe: -I/usr/lpp/ppe.poe/include}\ -- %{pthread: -D_THREAD_SAFE}" -+ %{pthread:} -D_THREAD_SAFE" - - #undef TARGET_DEFAULT - #define TARGET_DEFAULT MASK_NEW_MNEMONICS -@@ -63,8 +63,8 @@ - #define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\ - %{p:-L/lib/profiled -L/usr/lib/profiled} %{!shared:%{g*:-lg}}\ - %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\ -- %{pthread: -L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a}\ -- %{!pthread: -lc}" -+ %{pthread:} -L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a\ -+ " - - #undef LINK_SPEC - #define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ -@@ -77,8 +77,8 @@ - %{!pg:%{p:/usr/lpp/ppe.poe/lib/mcrt0.o}\ - %{!p:/usr/lpp/ppe.poe/lib/crt0.o}}}\ - %{!mpe:\ -- %{pthread:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\ -- %{!pthread:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}" -+ %{pthread:}%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}\ -+ }}" - - /* AIX 4 uses PowerPC nop (ori 0,0,0) instruction as call glue for PowerPC - and "cror 31,31,31" for POWER architecture. */ -diff -ru gcc/config/rs6000.orig/aix43.h gcc/config/rs6000/aix43.h ---- gcc/config/rs6000.orig/aix43.h 2009-04-17 17:06:51 +0200 -+++ gcc/config/rs6000/aix43.h 2009-04-17 17:10:34 +0200 -@@ -105,7 +105,7 @@ - %{ansi: -D_ANSI_C_SOURCE}\ - %{maix64: -D__64BIT__}\ - %{mpe: -I/usr/lpp/ppe.poe/include}\ -- %{pthread: -D_THREAD_SAFE}" -+ %{pthread:} -D_THREAD_SAFE" - - /* The GNU C++ standard library requires that these macros be - defined. */ -@@ -114,7 +114,7 @@ - "-D_ALL_SOURCE \ - %{maix64: -D__64BIT__} \ - %{mpe: -I/usr/lpp/ppe.poe/include} \ -- %{pthread: -D_THREAD_SAFE}" -+ %{pthread:} -D_THREAD_SAFE" - - #undef TARGET_DEFAULT - #define TARGET_DEFAULT MASK_NEW_MNEMONICS -@@ -139,8 +139,8 @@ - %{p:-L/lib/profiled -L/usr/lib/profiled}\ - %{!maix64:%{!shared:%{g*:-lg}}}\ - %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\ -- %{pthread:-L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a}\ -- %{!pthread:-lc}" -+ %{pthread:}-L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a\ -+ " - - #undef LINK_SPEC - #define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ -@@ -152,8 +152,8 @@ - #define STARTFILE_SPEC "%{!shared:\ - %{maix64:%{pg:gcrt0_64%O%s}%{!pg:%{p:mcrt0_64%O%s}%{!p:crt0_64%O%s}}}\ - %{!maix64:\ -- %{pthread:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\ -- %{!pthread:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}" -+ %{pthread:}%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}\ -+ }}" - - /* AIX 4.3 typedefs ptrdiff_t as "long" while earlier releases used "int". */ - -diff -ru gcc/config/rs6000.orig/aix51.h gcc/config/rs6000/aix51.h ---- gcc/config/rs6000.orig/aix51.h 2009-04-17 17:06:51 +0200 -+++ gcc/config/rs6000/aix51.h 2009-04-17 17:10:56 +0200 -@@ -101,7 +101,7 @@ - %{ansi: -D_ANSI_C_SOURCE} \ - %{maix64: -D__64BIT__} \ - %{mpe: -I/usr/lpp/ppe.poe/include} \ -- %{pthread: -D_THREAD_SAFE}" -+ %{pthread:} -D_THREAD_SAFE" - - /* The GNU C++ standard library requires that these macros be - defined. */ -@@ -110,7 +110,7 @@ - "-D_ALL_SOURCE \ - %{maix64: -D__64BIT__} \ - %{mpe: -I/usr/lpp/ppe.poe/include} \ -- %{pthread: -D_THREAD_SAFE}" -+ %{pthread:} -D_THREAD_SAFE" - - #undef TARGET_DEFAULT - #define TARGET_DEFAULT MASK_NEW_MNEMONICS -@@ -135,7 +135,7 @@ - %{p:-L/lib/profiled -L/usr/lib/profiled}\ - %{!maix64:%{!shared:%{g*:-lg}}}\ - %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\ -- %{pthread:-lpthreads} -lc" -+ %{pthread:}-lpthreads -lc" - - #undef LINK_SPEC - #define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ -@@ -147,8 +147,8 @@ - #define STARTFILE_SPEC "%{!shared:\ - %{maix64:%{pg:gcrt0_64%O%s}%{!pg:%{p:mcrt0_64%O%s}%{!p:crt0_64%O%s}}}\ - %{!maix64:\ -- %{pthread:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\ -- %{!pthread:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}" -+ %{pthread:}%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}\ -+ }}" - - /* AIX V5 typedefs ptrdiff_t as "long" while earlier releases used "int". */ - -diff -ru gcc/config/rs6000.orig/aix52.h gcc/config/rs6000/aix52.h ---- gcc/config/rs6000.orig/aix52.h 2009-04-17 17:06:50 +0200 -+++ gcc/config/rs6000/aix52.h 2009-04-17 17:11:15 +0200 -@@ -99,7 +99,7 @@ - %{ansi: -D_ANSI_C_SOURCE} \ - %{maix64: -D__64BIT__} \ - %{mpe: -I/usr/lpp/ppe.poe/include} \ -- %{pthread: -D_THREAD_SAFE}" -+ %{pthread:} -D_THREAD_SAFE" - - /* The GNU C++ standard library requires that these macros be - defined. Synchronize with libstdc++ os_defines.h. */ -@@ -108,7 +108,7 @@ - "-D_ALL_SOURCE \ - %{maix64: -D__64BIT__} \ - %{mpe: -I/usr/lpp/ppe.poe/include} \ -- %{pthread: -D_THREAD_SAFE}" -+ %{pthread:} -D_THREAD_SAFE" - - #undef TARGET_DEFAULT - #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS) -@@ -137,7 +137,7 @@ - %{p:-L/lib/profiled -L/usr/lib/profiled}\ - %{!maix64:%{!shared:%{g*:-lg}}}\ - %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\ -- %{pthread:-lpthreads} -lc" -+ %{pthread:}-lpthreads -lc" - - #undef LINK_SPEC - #define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ -@@ -149,8 +149,8 @@ - #define STARTFILE_SPEC "%{!shared:\ - %{maix64:%{pg:gcrt0_64%O%s}%{!pg:%{p:mcrt0_64%O%s}%{!p:crt0_64%O%s}}}\ - %{!maix64:\ -- %{pthread:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\ -- %{!pthread:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}" -+ %{pthread:}%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}\ -+ }}" - - /* AIX V5 typedefs ptrdiff_t as "long" while earlier releases used "int". */ - -diff -ru gcc/config/rs6000.orig/aix61.h gcc/config/rs6000/aix61.h ---- gcc/config/rs6000.orig/aix61.h 2009-04-17 17:06:51 +0200 -+++ gcc/config/rs6000/aix61.h 2009-04-17 17:11:32 +0200 -@@ -102,7 +102,7 @@ - %{ansi: -D_ANSI_C_SOURCE} \ - %{maix64: -D__64BIT__} \ - %{mpe: -I/usr/lpp/ppe.poe/include} \ -- %{pthread: -D_THREAD_SAFE}" -+ %{pthread:} -D_THREAD_SAFE" - - /* The GNU C++ standard library requires that these macros be - defined. Synchronize with libstdc++ os_defines.h. */ -@@ -111,7 +111,7 @@ - "-D_ALL_SOURCE -D__COMPATMATH__ \ - %{maix64: -D__64BIT__} \ - %{mpe: -I/usr/lpp/ppe.poe/include} \ -- %{pthread: -D_THREAD_SAFE}" -+ %{pthread:} -D_THREAD_SAFE" - - #undef TARGET_DEFAULT - #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS) -@@ -140,7 +140,7 @@ - %{p:-L/lib/profiled -L/usr/lib/profiled}\ - %{!maix64:%{!shared:%{g*:-lg}}}\ - %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\ -- %{pthread:-lpthreads} -lc" -+ %{pthread:}-lpthreads -lc" - - #undef LINK_SPEC - #define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ -@@ -152,8 +152,8 @@ - #define STARTFILE_SPEC "%{!shared:\ - %{maix64:%{pg:gcrt0_64%O%s}%{!pg:%{p:mcrt0_64%O%s}%{!p:crt0_64%O%s}}}\ - %{!maix64:\ -- %{pthread:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\ -- %{!pthread:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}" -+ %{pthread:}%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}\ -+ }}" - - /* AIX V5 typedefs ptrdiff_t as "long" while earlier releases used "int". */ - -diff -ru gcc/config/rs6000.orig/t-aix43 gcc/config/rs6000/t-aix43 ---- gcc/config/rs6000.orig/t-aix43 2009-04-17 17:06:51 +0200 -+++ gcc/config/rs6000/t-aix43 2009-04-17 17:13:15 +0200 -@@ -10,13 +10,13 @@ - echo '#define FLOAT' > fp-bit.c - cat $(srcdir)/config/fp-bit.c >> fp-bit.c - --# Build the libraries for pthread and all of the -+# Build the libraries for all of the - # different processor models - --MULTILIB_OPTIONS = pthread \ -+MULTILIB_OPTIONS = \ - mcpu=common/mcpu=power/mcpu=powerpc/maix64 - --MULTILIB_DIRNAMES = pthread \ -+MULTILIB_DIRNAMES = \ - common power powerpc ppc64 - - MULTILIB_MATCHES = mcpu?power=mcpu?power \ -@@ -46,7 +46,7 @@ - SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \ - -Wl,-bE:@shlib_map_file@ -o @multilib_dir@/shr.o \ - @multilib_flags@ @shlib_objs@ -lc \ -- `case @multilib_dir@ in \ -+ `case pthread@multilib_dir@ in \ - *pthread*) echo -L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a ;; \ - *) echo -lc ;; esac` ; \ - rm -f @multilib_dir@/tmp-@shlib_base_name@.a ; \ -@@ -61,7 +61,7 @@ - $$(mkinstalldirs) $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@; \ - $(INSTALL_DATA) @multilib_dir@/@shlib_base_name@.a \ - $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/ --SHLIB_LIBS = -lc `case @multilib_dir@ in *pthread*) echo -lpthread ;; esac` -+SHLIB_LIBS = -lc `case pthread@multilib_dir@ in *pthread*) echo -lpthread ;; esac` - SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk - SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver $(srcdir)/config/rs6000/libgcc-ppc64.ver - SHLIB_NM_FLAGS = -Bpg -X32_64 -diff -ru gcc/config/rs6000.orig/t-aix52 gcc/config/rs6000/t-aix52 ---- gcc/config/rs6000.orig/t-aix52 2009-04-17 17:06:50 +0200 -+++ gcc/config/rs6000/t-aix52 2009-04-17 17:13:32 +0200 -@@ -10,12 +10,12 @@ - echo '#define FLOAT' > fp-bit.c - cat $(srcdir)/config/fp-bit.c >> fp-bit.c - --# Build the libraries for pthread and all of the -+# Build the libraries for all of the - # different processor models - --MULTILIB_OPTIONS = pthread maix64 -+MULTILIB_OPTIONS = maix64 - --MULTILIB_DIRNAMES = pthread ppc64 -+MULTILIB_DIRNAMES = ppc64 - - MULTILIB_MATCHES = - -@@ -27,7 +27,7 @@ - SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \ - -Wl,-bE:@shlib_map_file@ -o @multilib_dir@/shr.o \ - @multilib_flags@ @shlib_objs@ -lc \ -- `case @multilib_dir@ in \ -+ `case pthread@multilib_dir@ in \ - *pthread*) echo -L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a ;; \ - *) echo -lc ;; esac` ; \ - rm -f @multilib_dir@/tmp-@shlib_base_name@.a ; \ -@@ -42,7 +42,7 @@ - $$(mkinstalldirs) $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@; \ - $(INSTALL_DATA) @multilib_dir@/@shlib_base_name@.a \ - $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/ --SHLIB_LIBS = -lc `case @multilib_dir@ in *pthread*) echo -lpthread ;; esac` -+SHLIB_LIBS = -lc `case pthread@multilib_dir@ in *pthread*) echo -lpthread ;; esac` - SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk - SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver $(srcdir)/config/rs6000/libgcc-ppc64.ver - SHLIB_NM_FLAGS = -Bpg -X32_64 diff --git a/sys-devel/gcc/files/4.2.2/aix-libssp.patch b/sys-devel/gcc/files/4.2.2/aix-libssp.patch deleted file mode 100644 index df8bfafda9..0000000000 --- a/sys-devel/gcc/files/4.2.2/aix-libssp.patch +++ /dev/null @@ -1,24 +0,0 @@ -When locked to GCC, Stack Smashing Protector works well on AIX. - ---- gcc-4.2.4/configure.in -+++ gcc-4.2.4/configure.in -@@ -686,7 +686,7 @@ - ;; - powerpc-*-aix*) - # copied from rs6000-*-* entry -- noconfigdirs="$noconfigdirs gprof target-libgloss target-libssp ${libgcj}" -+ noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}" - ;; - powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe) - target_configdirs="$target_configdirs target-winsup" ---- gcc-4.2.4/configure -+++ gcc-4.2.4/configure -@@ -1529,7 +1529,7 @@ - ;; - powerpc-*-aix*) - # copied from rs6000-*-* entry -- noconfigdirs="$noconfigdirs gprof target-libgloss target-libssp ${libgcj}" -+ noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}" - ;; - powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe) - target_configdirs="$target_configdirs target-winsup" diff --git a/sys-devel/gcc/files/4.2.2/aix-lineno.patch b/sys-devel/gcc/files/4.2.2/aix-lineno.patch deleted file mode 100644 index 9697bc575d..0000000000 --- a/sys-devel/gcc/files/4.2.2/aix-lineno.patch +++ /dev/null @@ -1,29 +0,0 @@ -2010-11-30 Olivier Hainque <hainque@adacore.com> - Michael Haubenwallner <michael.haubenwallner@salomon.at> - - PR target/46655 - * xcoffout.c (ASM_OUTPUT_LINE): Output line as unsigned, - when line > 0, and line <= USHRT_MAX in 32bit mode. - ---- gcc/xcoffout.c.orig 2010-11-30 14:46:44 +0100 -+++ gcc/xcoffout.c 2010-11-30 15:04:21 +0100 -@@ -80,8 +80,18 @@ - #define ASM_OUTPUT_LINE(FILE,LINENUM) \ - do \ - { \ -+ /* Make sure we're in a function and prevent output of .line 0, as \ -+ line # 0 is meant for symbol addresses in Xcoff. We could get \ -+ this for insns which inherited BUILTINS_LOCATION or the function \ -+ decl location somehow, typically created post-gimplification for \ -+ statements inserted by some optimizers. \ -+ Additionally, line numbers are 'unsigned short' in 32bit mode. */ \ - if (xcoff_begin_function_line >= 0) \ -- fprintf (FILE, "\t.line\t%d\n", ABS_OR_RELATIVE_LINENO (LINENUM)); \ -+ { \ -+ unsigned int lno = ABS_OR_RELATIVE_LINENO (LINENUM); \ -+ if (lno > 0 && (TARGET_64BIT || lno <= USHRT_MAX)) \ -+ fprintf (FILE, "\t.line\t%u\n", lno); \ -+ } \ - } \ - while (0) - diff --git a/sys-devel/gcc/files/4.2.2/aix-minimal-toc.patch b/sys-devel/gcc/files/4.2.2/aix-minimal-toc.patch deleted file mode 100644 index 251fa6ec95..0000000000 --- a/sys-devel/gcc/files/4.2.2/aix-minimal-toc.patch +++ /dev/null @@ -1,20 +0,0 @@ -gdb breaks when -bbigtoc linker flag is necessary. -C++ exception handling breaks when libstdc++ and/or libgcc_s -is built with -mminimal-toc. - -http://bugs.gentoo.org/show_bug.cgi?id=266483 -So reduce TOC size, but avoid -mminimal-toc. - ---- gcc-4.2.4/gcc/config/rs6000/rs6000.c.orig 2011-06-20 16:01:28 +0200 -+++ gcc-4.2.4/gcc/config/rs6000/rs6000.c 2011-06-20 16:04:53 +0200 -@@ -1229,6 +1229,10 @@ - | MASK_DLMZB) - }; - -+ /* gdb breaks when -bbigtoc linker flag is necessary */ -+ TARGET_NO_FP_IN_TOC = 1; -+ TARGET_NO_SUM_IN_TOC = 1; -+ - rs6000_init_hard_regno_mode_ok (); - - set_masks = POWER_MASKS | POWERPC_MASKS | MASK_SOFT_FLOAT; diff --git a/sys-devel/gcc/files/4.2.2/aix-pr46072.patch b/sys-devel/gcc/files/4.2.2/aix-pr46072.patch deleted file mode 100644 index a58b3a54e2..0000000000 --- a/sys-devel/gcc/files/4.2.2/aix-pr46072.patch +++ /dev/null @@ -1,25 +0,0 @@ -http://gcc.gnu.org/PR46072 is necessary to support AIX5.3 TL12 - -*** gcc-4.2.4/gcc/xcoffout.h.orig Tue Jan 25 21:17:54 2011 ---- gcc-4.2.4/gcc/xcoffout.h Tue Jan 25 21:18:16 2011 -*************** -*** 42,51 **** - - #define DBX_STATIC_BLOCK_START(ASMFILE,CODE) \ - { \ -! if ((CODE) == N_STSYM) \ - fprintf ((ASMFILE), "\t.bs\t%s[RW]\n", xcoff_private_data_section_name);\ -- else if ((CODE) == N_LCSYM) \ -- fprintf ((ASMFILE), "\t.bs\t%s\n", xcoff_bss_section_name); \ - } - - /* For static variables, output code to define the end of a static block. */ ---- 42,49 ---- - - #define DBX_STATIC_BLOCK_START(ASMFILE,CODE) \ - { \ -! if ((CODE) == N_STSYM || (CODE) == N_LCSYM) \ - fprintf ((ASMFILE), "\t.bs\t%s[RW]\n", xcoff_private_data_section_name);\ - } - - /* For static variables, output code to define the end of a static block. */ diff --git a/sys-devel/gcc/files/4.2.2/aix-runtimelinking-r1.patch b/sys-devel/gcc/files/4.2.2/aix-runtimelinking-r1.patch deleted file mode 100644 index 21c07a7136..0000000000 --- a/sys-devel/gcc/files/4.2.2/aix-runtimelinking-r1.patch +++ /dev/null @@ -1,46 +0,0 @@ -For collect2, take -G and -bsvr4 to change library-extension search order to -what -brtl does. Also, take -bnortl to disable -brtl mode. Upstream report is -https://gcc.gnu.org/ml/gcc-patches/2013-02/msg00104.html - -For collect2, ignore shared archive members with the F_LOADONLY flag. - -diff -ruN gcc-4.2.4/gcc/collect2.c /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/collect2.c ---- gcc-4.2.4/gcc/collect2.c 2007-12-31 17:04:26 +0100 -+++ /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/collect2.c 2014-06-30 15:51:22 +0200 -@@ -1068,8 +1068,15 @@ - export_flag = 1; - else if (arg[2] == '6' && arg[3] == '4') - aix64_flag = 1; -- else if (arg[2] == 'r' && arg[3] == 't' && arg[4] == 'l') -- aixrtl_flag = 1; -+ else if (arg[2] == 'r' && arg[3] == 't' && arg[4] == 'l' && arg[5] == '\0') -+ aixrtl_flag = 1; /* -brtl enables (but not -brtllib) */ -+ else if (arg[2] == 'n' && arg[3] == 'o' && arg[4] == 'r' && arg[5] == 't' && arg[6] == 'l' && arg[7] == '\0') -+ aixrtl_flag = 0; /* -bnortl disables (but not -bnortllib) */ -+ else if (arg[2] == 's' && arg[3] == 'v' && arg[4] == 'r' && arg[5] == '4') -+ aixrtl_flag = 1; /* -bsvr4 enables -brtl too */ -+ break; -+ case 'G': -+ aixrtl_flag = 1; /* -G enables -brtl too */ - break; - #endif - -@@ -2322,12 +2329,14 @@ - /* 0757 = U803XTOCMAGIC (AIX 4.3) and 0767 = U64_TOCMAGIC (AIX V5) */ - #ifdef _AIX51 - # define GCC_CHECK_HDR(X) \ -- ((HEADER (X).f_magic == U802TOCMAGIC && ! aix64_flag) \ -- || (HEADER (X).f_magic == 0767 && aix64_flag)) -+ (((HEADER (X).f_magic == U802TOCMAGIC && ! aix64_flag) \ -+ || (HEADER (X).f_magic == 0767 && aix64_flag)) \ -+ && !(HEADER (X).f_flags & F_LOADONLY)) - #else - # define GCC_CHECK_HDR(X) \ -- ((HEADER (X).f_magic == U802TOCMAGIC && ! aix64_flag) \ -- || (HEADER (X).f_magic == 0757 && aix64_flag)) -+ (((HEADER (X).f_magic == U802TOCMAGIC && ! aix64_flag) \ -+ || (HEADER (X).f_magic == 0757 && aix64_flag)) \ -+ && !(HEADER (X).f_flags & F_LOADONLY)) - #endif - - #endif diff --git a/sys-devel/gcc/files/4.2.2/aix-runtimelinking.patch b/sys-devel/gcc/files/4.2.2/aix-runtimelinking.patch deleted file mode 100644 index 499c85c5e3..0000000000 --- a/sys-devel/gcc/files/4.2.2/aix-runtimelinking.patch +++ /dev/null @@ -1,113 +0,0 @@ -Set '-brtl' for executables, to allow overriding shared library symbol -definitions with local symbol definitions - this is called runtime-linking. -Even if that usually is a hack, it is the only option with SVR4/ELF/Linux. -This requires shared libraries to be linked with '-bnosymbolic': -Using -G is recommended to mimic SVR4 behaviour as good as possible. - -Better not use '-bexpfull', may trigger this AIX 7.1 kernel problem: -https://www-304.ibm.com/support/docview.wss?uid=isg1IV39558 -Use '-bexpall' instead, even if that won't export symbol names with leading _. -Actually, '-bexpall' is more similar to SVR4/ELF except for the leading _. - -For collect2, take -G and -bsvr4 to change library-extension search order to -what -brtl does. Also, take -bnortl to disable -brtl mode. Upstream report is -https://gcc.gnu.org/ml/gcc-patches/2013-02/msg00104.html - -For collect2, ignore shared archive members with the F_LOADONLY flag. - -diff -ruN gcc-4.2.4/gcc/config/rs6000/aix43.h /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/config/rs6000/aix43.h ---- gcc-4.2.4/gcc/config/rs6000/aix43.h 2014-07-01 09:07:24 +0200 -+++ /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/config/rs6000/aix43.h 2014-06-30 15:51:22 +0200 -@@ -143,8 +143,8 @@ - " - - #undef LINK_SPEC --#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ -- %{static:-bnso %(link_syscalls) } %{shared:-bM:SRE %{!e:-bnoentry}}\ -+#define LINK_SPEC "%{!shared:-brtl -bexpall} -bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ -+ %{static:-bnso %(link_syscalls) } %{shared:-G -bernotok %{!e:-bnoentry}}\ - %{!maix64:%{!shared:%{g*: %(link_libg) }}} %{maix64:-b64}\ - %{mpe:-binitfini:poe_remote_main}" - -diff -ruN gcc-4.2.4/gcc/config/rs6000/aix51.h /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/config/rs6000/aix51.h ---- gcc-4.2.4/gcc/config/rs6000/aix51.h 2014-07-01 09:07:24 +0200 -+++ /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/config/rs6000/aix51.h 2014-06-30 15:51:22 +0200 -@@ -138,8 +138,8 @@ - %{pthread:}-lpthreads -lc" - - #undef LINK_SPEC --#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ -- %{static:-bnso %(link_syscalls) } %{shared:-bM:SRE %{!e:-bnoentry}}\ -+#define LINK_SPEC "%{!shared:-brtl -bexpall} -bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ -+ %{static:-bnso %(link_syscalls) } %{shared:-G -bernotok %{!e:-bnoentry}}\ - %{!maix64:%{!shared:%{g*: %(link_libg) }}} %{maix64:-b64}\ - %{mpe:-binitfini:poe_remote_main}" - -diff -ruN gcc-4.2.4/gcc/config/rs6000/aix52.h /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/config/rs6000/aix52.h ---- gcc-4.2.4/gcc/config/rs6000/aix52.h 2014-07-01 09:07:24 +0200 -+++ /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/config/rs6000/aix52.h 2014-06-30 15:51:22 +0200 -@@ -140,8 +140,8 @@ - %{pthread:}-lpthreads -lc" - - #undef LINK_SPEC --#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ -- %{static:-bnso %(link_syscalls) } %{shared:-bM:SRE %{!e:-bnoentry}}\ -+#define LINK_SPEC "%{!shared:-brtl -bexpall} -bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ -+ %{static:-bnso %(link_syscalls) } %{shared:-G -bernotok %{!e:-bnoentry}}\ - %{!maix64:%{!shared:%{g*: %(link_libg) }}} %{maix64:-b64}\ - %{mpe:-binitfini:poe_remote_main}" - -diff -ruN gcc-4.2.4/gcc/config/rs6000/aix61.h /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/config/rs6000/aix61.h ---- gcc-4.2.4/gcc/config/rs6000/aix61.h 2014-07-01 09:07:24 +0200 -+++ /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/config/rs6000/aix61.h 2014-06-30 15:51:24 +0200 -@@ -143,8 +143,8 @@ - %{pthread:}-lpthreads -lc" - - #undef LINK_SPEC --#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ -- %{static:-bnso %(link_syscalls) } %{shared:-bM:SRE %{!e:-bnoentry}}\ -+#define LINK_SPEC "%{!shared:-brtl -bexpall} -bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ -+ %{static:-bnso %(link_syscalls) } %{shared:-G -bernotok %{!e:-bnoentry}}\ - %{!maix64:%{!shared:%{g*: %(link_libg) }}} %{maix64:-b64}\ - %{mpe:-binitfini:poe_remote_main}" - -diff -ruN gcc-4.2.4/gcc/collect2.c /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/collect2.c ---- gcc-4.2.4/gcc/collect2.c 2007-12-31 17:04:26 +0100 -+++ /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/collect2.c 2014-06-30 15:51:22 +0200 -@@ -1068,8 +1068,15 @@ - export_flag = 1; - else if (arg[2] == '6' && arg[3] == '4') - aix64_flag = 1; -- else if (arg[2] == 'r' && arg[3] == 't' && arg[4] == 'l') -- aixrtl_flag = 1; -+ else if (arg[2] == 'r' && arg[3] == 't' && arg[4] == 'l' && arg[5] == '\0') -+ aixrtl_flag = 1; /* -brtl enables (but not -brtllib) */ -+ else if (arg[2] == 'n' && arg[3] == 'o' && arg[4] == 'r' && arg[5] == 't' && arg[6] == 'l' && arg[7] == '\0') -+ aixrtl_flag = 0; /* -bnortl disables (but not -bnortllib) */ -+ else if (arg[2] == 's' && arg[3] == 'v' && arg[4] == 'r' && arg[5] == '4') -+ aixrtl_flag = 1; /* -bsvr4 enables -brtl too */ -+ break; -+ case 'G': -+ aixrtl_flag = 1; /* -G enables -brtl too */ - break; - #endif - -@@ -2322,12 +2329,14 @@ - /* 0757 = U803XTOCMAGIC (AIX 4.3) and 0767 = U64_TOCMAGIC (AIX V5) */ - #ifdef _AIX51 - # define GCC_CHECK_HDR(X) \ -- ((HEADER (X).f_magic == U802TOCMAGIC && ! aix64_flag) \ -- || (HEADER (X).f_magic == 0767 && aix64_flag)) -+ (((HEADER (X).f_magic == U802TOCMAGIC && ! aix64_flag) \ -+ || (HEADER (X).f_magic == 0767 && aix64_flag)) \ -+ && !(HEADER (X).f_flags & F_LOADONLY)) - #else - # define GCC_CHECK_HDR(X) \ -- ((HEADER (X).f_magic == U802TOCMAGIC && ! aix64_flag) \ -- || (HEADER (X).f_magic == 0757 && aix64_flag)) -+ (((HEADER (X).f_magic == U802TOCMAGIC && ! aix64_flag) \ -+ || (HEADER (X).f_magic == 0757 && aix64_flag)) \ -+ && !(HEADER (X).f_flags & F_LOADONLY)) - #endif - - #endif diff --git a/sys-devel/gcc/files/4.2.2/aix-soname.patch b/sys-devel/gcc/files/4.2.2/aix-soname.patch deleted file mode 100644 index 237959a9d6..0000000000 --- a/sys-devel/gcc/files/4.2.2/aix-soname.patch +++ /dev/null @@ -1,132 +0,0 @@ -Create gcc libraries with full "soname" support on AIX, -utilizing the ld-wrapper handling the '-soname' flag. - -http://bugs.gentoo.org/show_bug.cgi?id=213277 - ---- gcc-4.2.4/config.rpath -+++ gcc-4.2.4/config.rpath -@@ -204,7 +204,7 @@ - # have to do anything special. - aix_use_runtimelinking=no - else -- aix_use_runtimelinking=no -+ aix_use_runtimelinking=yes - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. ---- gcc-4.2.4/ltcf-c.sh -+++ gcc-4.2.4/ltcf-c.sh -@@ -325,7 +325,7 @@ - else - # Test if we are trying to use run time linking, or normal AIX style linking. - # If -brtl is somewhere in LDFLAGS, we need to do run time linking. -- aix_use_runtimelinking=no -+ aix_use_runtimelinking=yes - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then - aix_use_runtimelinking=yes -@@ -342,7 +342,7 @@ - # link without error, but may produce a broken library. - allow_undefined_flag=' ${wl}-berok' - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' -- archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" -+ archive_expsym_cmds="\$CC \${wl}-brtl $shared_flag"' -o $output_objdir/$realname ${wl}-soname "${wl}$soname" $libobjs $deplibs $compiler_flags ${allow_undefined_flag} ${wl}-bernotok '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - if test "$host_cpu" = ia64; then - if test $with_gnu_ld = no; then ---- gcc-4.2.4/ltcf-cxx.sh -+++ gcc-4.2.4/ltcf-cxx.sh -@@ -176,7 +176,7 @@ - else - # Test if we are trying to use run time linking, or normal AIX style linking. - # If -brtl is somewhere in LDFLAGS, we need to do run time linking. -- aix_use_runtimelinking=no -+ aix_use_runtimelinking=yes - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then - aix_use_runtimelinking=yes -@@ -192,7 +192,7 @@ - if test "$aix_use_runtimelinking" = yes; then - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' - allow_undefined_flag=' -Wl,-G' -- archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}-brtl \${wl}$exp_sym_flag:\$export_symbols" -+ archive_expsym_cmds="\$CC \${wl}-brtl $shared_flag"' -o $output_objdir/$realname ${wl}-soname "${wl}$soname" $libobjs $deplibs $compiler_flags ${allow_undefined_flag} ${wl}-bernotok '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - if test "$host_cpu" = ia64; then - if test $with_gnu_ld = no; then ---- gcc-4.2.4/ltcf-gcj.sh -+++ gcc-4.2.4/ltcf-gcj.sh -@@ -324,7 +324,7 @@ - else - # Test if we are trying to use run time linking, or normal AIX style linking. - # If -brtl is somewhere in LDFLAGS, we need to do run time linking. -- aix_use_runtimelinking=no -+ aix_use_runtimelinking=yes - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then - aix_use_runtimelinking=yes -@@ -341,7 +341,7 @@ - # link without error, but may produce a broken library. - allow_undefined_flag=' ${wl}-berok' - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' -- archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" -+ archive_expsym_cmds="\$CC \${wl}-brtl $shared_flag"' -o $output_objdir/$realname ${wl}-soname "${wl}$soname" $libobjs $deplibs $compiler_flags ${allow_undefined_flag} ${wl}-bernotok '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - if test "$host_cpu" = ia64; then - if test $with_gnu_ld = no; then ---- gcc-4.2.4/ltconfig -+++ gcc-4.2.4/ltconfig -@@ -1005,6 +1005,7 @@ - # If using run time linking (on AIX 4.2 or later) use lib<name>.so instead of - # lib<name>.a to let people know that these are not typical AIX shared libraries. - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' -+ soname_spec='${libname}${release}${shared_ext}$major(shr.o)' - else - # We preserve .a as extension for shared libraries though AIX4.2 - # and later when we are not doing run time linking. ---- gcc-4.2.4/gcc/config/rs6000/t-aix52 -+++ gcc-4.2.4/gcc/config/rs6000/t-aix52 -@@ -23,25 +23,32 @@ - INSTALL_LIBGCC = install-multilib - - # Build a shared libgcc library. --SHLIB_EXT = .a -+SHLIB_EXT = .so -+SHLIB_SOLINK = @shlib_base_name@.so -+SHLIB_SOVERSION = 1 -+SHLIB_SONAME = @shlib_base_name@.so.$(SHLIB_SOVERSION) - SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \ -- -Wl,-bE:@shlib_map_file@ -o @multilib_dir@/shr.o \ -+ -Wl,-bE:@shlib_map_file@ -o @multilib_dir@/$(SHLIB_SONAME).tmp "-Wl,-soname=$(SHLIB_SONAME)(shr.o)" -Wl,-bernotok \ - @multilib_flags@ @shlib_objs@ -lc \ - `case pthread@multilib_dir@ in \ - *pthread*) echo -L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a ;; \ -- *) echo -lc ;; esac` ; \ -- rm -f @multilib_dir@/tmp-@shlib_base_name@.a ; \ -- $(AR_CREATE_FOR_TARGET) @multilib_dir@/tmp-@shlib_base_name@.a \ -- @multilib_dir@/shr.o ; \ -- mv @multilib_dir@/tmp-@shlib_base_name@.a \ -- @multilib_dir@/@shlib_base_name@.a ; \ -- rm -f @multilib_dir@/shr.o -+ *) echo -lc ;; esac` && \ -+ rm -f @multilib_dir@/$(SHLIB_SOLINK) && \ -+ if [ -f @multilib_dir@/$(SHLIB_SONAME) ]; then \ -+ mv -f @multilib_dir@/$(SHLIB_SONAME) \ -+ @multilib_dir@/$(SHLIB_SONAME).backup; \ -+ else true; fi && \ -+ mv @multilib_dir@/$(SHLIB_SONAME).tmp @multilib_dir@/$(SHLIB_SONAME) && \ -+ $(LN_S) $(SHLIB_SONAME) @multilib_dir@/$(SHLIB_SOLINK) - # $(slibdir) double quoted to protect it from expansion while building - # libgcc.mk. We want this delayed until actual install time. - SHLIB_INSTALL = \ - $$(mkinstalldirs) $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@; \ -- $(INSTALL_DATA) @multilib_dir@/@shlib_base_name@.a \ -- $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/ -+ $(INSTALL_DATA) @multilib_dir@/$(SHLIB_SONAME) \ -+ $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/$(SHLIB_SONAME); \ -+ rm -f $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/$(SHLIB_SOLINK); \ -+ $(LN_S) $(SHLIB_SONAME) \ -+ $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/$(SHLIB_SOLINK) - SHLIB_LIBS = -lc `case pthread@multilib_dir@ in *pthread*) echo -lpthread ;; esac` - SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk - SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver $(srcdir)/config/rs6000/libgcc-ppc64.ver diff --git a/sys-devel/gcc/files/4.2.2/aix61-longdouble64.patch b/sys-devel/gcc/files/4.2.2/aix61-longdouble64.patch deleted file mode 100644 index a082e8f36b..0000000000 --- a/sys-devel/gcc/files/4.2.2/aix61-longdouble64.patch +++ /dev/null @@ -1,14 +0,0 @@ -Switching long double from 64 to 128 bit with aix6.1 was based on an old bug -in AIX libc, which can not really be fixed due to backwards compatibility, -just worked around in math.h. The default for long double still is 64bit. -http://gcc.gnu.org/PR46481 - ---- gcc/config/rs6000/aix61.h.orig 2010-11-15 12:59:04.008438153 +0100 -+++ gcc/config/rs6000/aix61.h 2010-11-15 12:59:43.801763387 +0100 -@@ -193,4 +193,5 @@ - /* This target uses the aix64.opt file. */ - #define TARGET_USES_AIX64_OPT 1 - --#define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128 -+/* keep default 64bit for 'long double': PR46481 */ -+#define RS6000_DEFAULT_LONG_DOUBLE_SIZE 64 diff --git a/sys-devel/gcc/files/4.2.2/gentoo-fixincludes.patch b/sys-devel/gcc/files/4.2.2/gentoo-fixincludes.patch deleted file mode 100644 index c1a43032a6..0000000000 --- a/sys-devel/gcc/files/4.2.2/gentoo-fixincludes.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- fixincludes/fixfixes.c.orig 2007-12-17 11:58:31.577356750 +0100 -+++ fixincludes/fixfixes.c 2007-12-17 12:02:51.077574500 +0100 -@@ -586,18 +586,25 @@ - { - tSCC z_no_wrap_pat[] = "^#if.*__need_"; - static regex_t no_wrapping_re; /* assume zeroed data */ -+ tSCC z_no_wrap_pat_gentoo[] = "^ *# *include *<gentoo-multilib/"; -+ static regex_t no_wrapping_re_gentoo; /* assume zeroed data */ - - tCC* pz_name = NULL; - - if (no_wrapping_re.allocated == 0) - compile_re( z_no_wrap_pat, &no_wrapping_re, 0, "no-wrap pattern", - "wrap-fix" ); -+ if (no_wrapping_re_gentoo.allocated == 0) -+ compile_re( z_no_wrap_pat_gentoo, &no_wrapping_re_gentoo, 0, "no-wrap pattern (gentoo)", -+ "wrap-fix (gentoo)" ); - - /* - * IF we do *not* match the no-wrap re, then we have a double negative. - * A double negative means YES. - */ -- if (xregexec( &no_wrapping_re, text, 0, NULL, 0 ) != 0) -+ if (xregexec( &no_wrapping_re, text, 0, NULL, 0 ) != 0 -+ && xregexec( &no_wrapping_re_gentoo, text, 0, NULL, 0) != 0 -+ ) - { - /* - * A single file can get wrapped more than once by different fixes. diff --git a/sys-devel/gcc/files/4.2.2/interix-3.5-x86.patch b/sys-devel/gcc/files/4.2.2/interix-3.5-x86.patch deleted file mode 100644 index 1b73b33ae7..0000000000 --- a/sys-devel/gcc/files/4.2.2/interix-3.5-x86.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- gcc-4.2.2.orig/gcc/config/x-interix Thu Jan 24 15:42:18 2008 -+++ gcc-4.2.2/gcc/config/x-interix Thu Jan 24 15:46:03 2008 -@@ -1,3 +1,7 @@ - # Existing CC/GCC may not define -D__INTERIX, so need this here. - # Since we want to configure with _ALL_SOURCE, we need to build that way too --X_CFLAGS= -D__INTERIX -D_ALL_SOURCE -+ -+# this is commented out now, since it makes gcc 4.2.2 fail bootstrap on -+# interix 3.5 (x-interix is only added on 3.5, but not on any newer one). -+# this assumes gcc is built using another gcc (3.3 on interix), not cc! -+# X_CFLAGS= -D__INTERIX -D_ALL_SOURCE diff --git a/sys-devel/gcc/files/4.2.2/interix-x86.patch.bz2 b/sys-devel/gcc/files/4.2.2/interix-x86.patch.bz2 Binary files differdeleted file mode 100644 index 93c2a64025..0000000000 --- a/sys-devel/gcc/files/4.2.2/interix-x86.patch.bz2 +++ /dev/null diff --git a/sys-devel/gcc/files/4.2.2/pr26189-pa.patch b/sys-devel/gcc/files/4.2.2/pr26189-pa.patch deleted file mode 100644 index 406c4d9cf4..0000000000 --- a/sys-devel/gcc/files/4.2.2/pr26189-pa.patch +++ /dev/null @@ -1,24 +0,0 @@ -http://gcc.gnu.org/PR26198 applies for hppa-hpux too, not just ia64-hpux. ---- gcc-4.2.4/fixincludes/inclhack.def.orig 2009-12-15 14:55:53.768807045 +0100 -+++ gcc-4.2.4/fixincludes/inclhack.def 2009-12-15 14:56:07.565551263 +0100 -@@ -1770,7 +1770,8 @@ - fix = { - hackname = hpux_spu_info; - mach = "*-hp-hpux*"; -- files = ia64/sys/getppdp.h; -+ files = "ia64/sys/getppdp.h"; -+ files = "pa/sys/getppdp.h"; - select = "^.*extern.*spu_info.*"; - - c_fix = format; ---- gcc-4.2.4/fixincludes/fixincl.x.orig 2009-12-15 14:55:50.232151517 +0100 -+++ gcc-4.2.4/fixincludes/fixincl.x 2009-12-15 14:56:09.000000000 +0100 -@@ -3002,7 +3002,7 @@ - * File name selection pattern - */ - tSCC zHpux_Spu_InfoList[] = -- "|ia64/sys/getppdp.h|"; -+ "|ia64/sys/getppdp.h|pa/sys/getppdp.h|"; - /* - * Machine/OS name selection pattern - */ diff --git a/sys-devel/gcc/files/4.2.2/pr31899.patch b/sys-devel/gcc/files/4.2.2/pr31899.patch deleted file mode 100644 index 9cbdfa2c1e..0000000000 --- a/sys-devel/gcc/files/4.2.2/pr31899.patch +++ /dev/null @@ -1,66 +0,0 @@ -2007-10-01 Richard Guenther <rguenther@suse.de> - - * dwarf2out.c (reference_to_unused): Disable sanity checking. - - * g++.dg/debug/using3.C: New testcase. - -Index: gcc/dwarf2out.c -=================================================================== -*** gcc/dwarf2out.c.orig Mon Sep 24 11:17:10 2007 ---- gcc/dwarf2out.c Mon Jan 14 11:02:28 2008 -*************** -*** 10005,10020 **** - return *tp; - else if (!flag_unit_at_a_time) - return NULL_TREE; - else if (!cgraph_global_info_ready - && (TREE_CODE (*tp) == VAR_DECL || TREE_CODE (*tp) == FUNCTION_DECL)) - gcc_unreachable (); -! else if (DECL_P (*tp) && TREE_CODE (*tp) == VAR_DECL) - { - struct cgraph_varpool_node *node = cgraph_varpool_node (*tp); - if (!node->needed) - return *tp; - } -! else if (DECL_P (*tp) && TREE_CODE (*tp) == FUNCTION_DECL - && (!DECL_EXTERNAL (*tp) || DECL_DECLARED_INLINE_P (*tp))) - { - struct cgraph_node *node = cgraph_node (*tp); ---- 10005,10026 ---- - return *tp; - else if (!flag_unit_at_a_time) - return NULL_TREE; -+ /* ??? The C++ FE emits debug information for using decls, so this -+ sanity check falls over. See PR31899. */ -+ #if 0 - else if (!cgraph_global_info_ready - && (TREE_CODE (*tp) == VAR_DECL || TREE_CODE (*tp) == FUNCTION_DECL)) - gcc_unreachable (); -! #endif -! else if (cgraph_global_info_ready -! && DECL_P (*tp) && TREE_CODE (*tp) == VAR_DECL) - { - struct cgraph_varpool_node *node = cgraph_varpool_node (*tp); - if (!node->needed) - return *tp; - } -! else if (cgraph_global_info_ready -! && DECL_P (*tp) && TREE_CODE (*tp) == FUNCTION_DECL - && (!DECL_EXTERNAL (*tp) || DECL_DECLARED_INLINE_P (*tp))) - { - struct cgraph_node *node = cgraph_node (*tp); -Index: gcc/testsuite/g++.dg/debug/using3.C -=================================================================== -*** gcc/testsuite/g++.dg/debug/using3.C (revision 0) ---- gcc/testsuite/g++.dg/debug/using3.C (revision 0) -*************** -*** 0 **** ---- 1,8 ---- -+ // PR debug/31899 -+ -+ namespace NS { -+ int x = 0; -+ int &ref = x; -+ } -+ -+ using NS::ref; diff --git a/sys-devel/gcc/files/4.2.2/prefix-search-dirs.patch b/sys-devel/gcc/files/4.2.2/prefix-search-dirs.patch deleted file mode 100644 index 74e05ea194..0000000000 --- a/sys-devel/gcc/files/4.2.2/prefix-search-dirs.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- gcc/gcc.c.orig 2009-03-25 19:20:50 +0100 -+++ gcc/gcc.c 2009-03-26 00:37:23 +0100 -@@ -1525,8 +1525,8 @@ static const char *gcc_libexec_prefix; - #endif - - static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX; --static const char *const standard_exec_prefix_1 = "/usr/libexec/gcc/"; --static const char *const standard_exec_prefix_2 = "/usr/lib/gcc/"; -+static const char *const standard_exec_prefix_1 = "@GENTOO_PORTAGE_EPREFIX@/usr/libexec/gcc/"; -+static const char *const standard_exec_prefix_2 = "@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/"; - static const char *md_exec_prefix = MD_EXEC_PREFIX; - - static const char *md_startfile_prefix = MD_STARTFILE_PREFIX; -@@ -2584,6 +2584,34 @@ add_to_obstack (char *path, void *data) - { - struct add_to_obstack_info *info = data; - -+#if DISABLE_MULTILIB -+ /* -+ * Fix multilib paths for our prefix, that is alter lib64 and lib32 to lib. -+ * No allocation needed, since the path won't grow but only shrink by two -+ * chars. We should not modify host multilib dirs, otherwise libs might not -+ * be found in /lib64 or /usr/lib64 -+ */ -+ int elen = strlen("@GENTOO_PORTAGE_EPREFIX@"); -+ if (strncmp(path, "@GENTOO_PORTAGE_EPREFIX@", elen) == 0) { -+ /* multilib dirs are put at the end like ../lib32/ ../lib64/ */ -+ static char const *mdirs[] = { "../lib64/", "../lib32/" }; -+ int plen = strlen(path); -+ unsigned int idx; -+ int mlen; -+ -+ /* For each path replace the multilib dir at the end of the path. */ -+ for (idx = 0; idx < (sizeof(mdirs) / sizeof(mdirs[0])); idx++) { -+ mlen = strlen(mdirs[idx]); -+ if (strncmp(path + plen - mlen, mdirs[idx], mlen) == 0) { -+ /* Overwrite the part with null-termination. In prefix the only multilib -+ occurence is the one added by gcc so we can end here. */ -+ strcpy(path + plen - mlen, "../lib/"); -+ break; -+ } -+ } -+ } -+#endif -+ - if (info->check_dir && !is_directory (path, false)) - return NULL; - diff --git a/sys-devel/gcc/files/4.2.2/ro-string.patch b/sys-devel/gcc/files/4.2.2/ro-string.patch deleted file mode 100644 index 1541e152ef..0000000000 --- a/sys-devel/gcc/files/4.2.2/ro-string.patch +++ /dev/null @@ -1,109 +0,0 @@ -https://gcc.gnu.org/ml/gcc-patches/2012-08/msg01938.html - -diff -ruN gcc-4.2.4/libstdc++-v3/include/bits/basic_string.h /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/libstdc++-v3/include/bits/basic_string.h ---- gcc-4.2.4/libstdc++-v3/include/bits/basic_string.h 2007-10-14 20:22:22 +0200 -+++ /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/libstdc++-v3/include/bits/basic_string.h 2014-06-30 15:51:25 +0200 -@@ -174,7 +174,7 @@ - - // The following storage is init'd to 0 by the linker, resulting - // (carefully) in an empty string with one reference. -- static size_type _S_empty_rep_storage[]; -+ static size_type const _S_empty_rep_storage[]; - - static _Rep& - _S_empty_rep() -@@ -182,7 +182,7 @@ - // NB: Mild hack to avoid strict-aliasing warnings. Note that - // _S_empty_rep_storage is never modified and the punning should - // be reasonably safe in this case. -- void* __p = reinterpret_cast<void*>(&_S_empty_rep_storage); -+ void* __p = const_cast<void*>(reinterpret_cast<void const*>(&_S_empty_rep_storage)); - return *reinterpret_cast<_Rep*>(__p); - } - -@@ -204,12 +204,17 @@ - - void - _M_set_length_and_sharable(size_type __n) -- { -- this->_M_set_sharable(); // One reference. -- this->_M_length = __n; -- traits_type::assign(this->_M_refdata()[__n], _S_terminal); -- // grrr. (per 21.3.4) -- // You cannot leave those LWG people alone for a second. -+ { -+#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING -+ if (__builtin_expect(this != &_S_empty_rep(), false)) -+#endif -+ { -+ this->_M_set_sharable(); // One reference. -+ this->_M_length = __n; -+ traits_type::assign(this->_M_refdata()[__n], _S_terminal); -+ // grrr. (per 21.3.4) -+ // You cannot leave those LWG people alone for a second. -+ } - } - - _CharT* -@@ -1153,16 +1158,8 @@ - * The value of the string doesn't change if an error is thrown. - */ - iterator -- erase(iterator __first, iterator __last) -- { -- _GLIBCXX_DEBUG_PEDASSERT(__first >= _M_ibegin() && __first <= __last -- && __last <= _M_iend()); -- const size_type __pos = __first - _M_ibegin(); -- _M_mutate(__pos, __last - __first, size_type(0)); -- _M_rep()->_M_set_leaked(); -- return iterator(_M_data() + __pos); -- } -- -+ erase(iterator __first, iterator __last); -+ - /** - * @brief Replace characters with value from another string. - * @param pos Index of first character to replace. -diff -ruN gcc-4.2.4/libstdc++-v3/include/bits/basic_string.tcc /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/libstdc++-v3/include/bits/basic_string.tcc ---- gcc-4.2.4/libstdc++-v3/include/bits/basic_string.tcc 2007-03-30 19:11:22 +0200 -+++ /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/libstdc++-v3/include/bits/basic_string.tcc 2014-06-30 15:51:25 +0200 -@@ -75,10 +75,10 @@ - // Linker sets _S_empty_rep_storage to all 0s (one reference, empty string) - // at static init time (before static ctors are run). - template<typename _CharT, typename _Traits, typename _Alloc> -- typename basic_string<_CharT, _Traits, _Alloc>::size_type -+ typename basic_string<_CharT, _Traits, _Alloc>::size_type const - basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_empty_rep_storage[ - (sizeof(_Rep_base) + sizeof(_CharT) + sizeof(size_type) - 1) / -- sizeof(size_type)]; -+ sizeof(size_type)] = {}; - - // NB: This is the special case for Input Iterators, used in - // istreambuf_iterators, etc. -@@ -391,6 +391,26 @@ - } - - template<typename _CharT, typename _Traits, typename _Alloc> -+ typename basic_string<_CharT, _Traits, _Alloc>::iterator -+ basic_string<_CharT, _Traits, _Alloc>:: -+ erase(iterator __first, iterator __last) -+ { -+ _GLIBCXX_DEBUG_PEDASSERT(__first >= _M_ibegin() && __first <= __last -+ && __last <= _M_iend()); -+ -+ const size_type __size = __last - __first; -+ if (__size) -+ { -+ const size_type __pos = __first - _M_ibegin(); -+ _M_mutate(__pos, __size, size_type(0)); -+ _M_rep()->_M_set_leaked(); -+ return iterator(_M_data() + __pos); -+ } -+ else -+ return __first; -+ } -+ -+ template<typename _CharT, typename _Traits, typename _Alloc> - basic_string<_CharT, _Traits, _Alloc>& - basic_string<_CharT, _Traits, _Alloc>:: - replace(size_type __pos, size_type __n1, const _CharT* __s, diff --git a/sys-devel/gcc/files/4.2.2/solarisx86.patch b/sys-devel/gcc/files/4.2.2/solarisx86.patch deleted file mode 100644 index 89dbc7ff81..0000000000 --- a/sys-devel/gcc/files/4.2.2/solarisx86.patch +++ /dev/null @@ -1,15 +0,0 @@ -work around a weird shell quirk, it doesn't fall in the X) case if -with_cpu is unset/empty, but in the *) case instead, causing an abort, -bug #416577 - ---- gcc-4.2.4/gcc/config.gcc -+++ gcc-4.2.4/gcc/config.gcc -@@ -1216,7 +1216,7 @@ - need_64bit_hwint=yes - # FIXME: -m64 for i[34567]86-*-* should be allowed just - # like -m32 for x86_64-*-*. -- case X"${with_cpu}" in -+ case X"${with_cpu:-generic}" in - Xgeneric|Xnocona|Xx86-64|Xk8|Xopteron|Xathlon64|Xathlon-fx) - ;; - X) diff --git a/sys-devel/gcc/files/4.2.2/solarisx86_64.patch b/sys-devel/gcc/files/4.2.2/solarisx86_64.patch deleted file mode 100644 index 719f0c2b77..0000000000 --- a/sys-devel/gcc/files/4.2.2/solarisx86_64.patch +++ /dev/null @@ -1,89 +0,0 @@ ---- gcc/config.orig/i386/sol2-64.h -+++ gcc/config/i386/sol2-64.h -@@ -0,0 +1,5 @@ -+/* Definitions of target machine for GCC, for bi-arch i386 -+ running Solaris 2, defaulting to 64-bit code generation. */ -+ -+#undef MULTILIB_DEFAULTS -+#define MULTILIB_DEFAULTS { "m64" } ---- gcc/config.gcc -+++ gcc/config.gcc -@@ -1251,6 +1246,78 @@ - ;; - esac - ;; -+x86_64-*-solaris2*) -+ tm_file="i386/biarch64.h ${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h i386/sysv4.h sol2.h" -+ case ${target} in -+ *-*-solaris2.1[0-9]*) -+ tm_file="${tm_file} sol2-10.h" -+ ;; -+ esac -+ tm_file="${tm_file} i386/sol2.h" -+ tmake_file="t-sol2 i386/t-sol2 t-svr4" -+ c_target_objs="sol2-c.o" -+ cxx_target_objs="sol2-c.o" -+ extra_objs="sol2.o" -+ tm_p_file="${tm_p_file} sol2-protos.h" -+ if test x$gnu_ld = xyes; then -+ tmake_file="$tmake_file t-slibgcc-elf-ver" -+ tm_defines="${tm_defines} TARGET_GNU_LD=1" -+ else -+ tmake_file="$tmake_file t-slibgcc-sld" -+ fi -+ if test x$gas = xyes; then -+ tm_file="usegas.h ${tm_file}" -+ fi -+ case ${target} in -+ *-*-solaris2.[789] | *-*-solaris2.1[0-9]*) -+ tm_file="$tm_file tm-dwarf2.h" -+ ;; -+ esac -+ case ${target} in -+ *-*-solaris2.1[0-9]*) -+ tm_file="${tm_file} i386/x86-64.h i386/sol2-10.h i386/sol2-64.h" -+ tm_defines="${tm_defines} TARGET_BI_ARCH=1" -+ tmake_file="$tmake_file i386/t-crtstuff i386/t-sol2-10" -+ need_64bit_hwint=yes -+ # FIXME: -m64 for i[34567]86-*-* should be allowed just -+ # like -m32 for x86_64-*-*. -+ case X"${with_cpu:-generic}" in -+ Xgeneric|Xnocona|Xx86-64|Xk8|Xopteron|Xathlon64|Xathlon-fx) -+ ;; -+ X) -+ with_cpu=generic -+ ;; -+ *) -+ echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2 -+ echo "generic nocona x86-64 k8 opteron athlon64 athlon-fx" 1>&2 -+ exit 1 -+ ;; -+ esac -+ # Solaris 2.10 provides crt1.o, crti.o, crtn.o, and gcrt1.o as -+ # part of the base system. -+ extra_parts="gmon.o crtbegin.o crtend.o" -+ ;; -+ *) -+ extra_parts="crt1.o crti.o crtn.o gcrt1.o gmon.o crtbegin.o crtend.o" -+ ;; -+ esac -+ case ${enable_threads}:${have_pthread_h}:${have_thread_h} in -+ "":yes:* | yes:yes:* ) -+ case ${target} in -+ *-*-solaris2.[0-6] | *-*-solaris2.[0-6].*) -+ thread_file=posix95 -+ ;; -+ *) -+ thread_file=posix -+ ;; -+ esac -+ ;; -+ "":*:yes | yes:*:yes ) -+ thread_file=solaris -+ ;; -+ esac -+ extra_headers="mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h pmmintrin.h" -+ ;; - i[34567]86-*-sysv5*) # Intel x86 on System V Release 5 - tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h i386/sysv4.h i386/sysv5.h" - if test x$stabs = xyes diff --git a/sys-devel/gcc/files/4.2.2/targettools-checks.patch b/sys-devel/gcc/files/4.2.2/targettools-checks.patch deleted file mode 100644 index ab8dd9b761..0000000000 --- a/sys-devel/gcc/files/4.2.2/targettools-checks.patch +++ /dev/null @@ -1,108 +0,0 @@ -# Since http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33637 lacks -# a real fix, this is just an ugly workaround required for AIX. - ---- gcc/configure.ac.orig 2007-10-08 16:18:43 +0200 -+++ gcc/configure.ac 2007-10-08 16:22:22 +0200 -@@ -1877,7 +1877,7 @@ - elif test -x as$build_exeext; then - # Build using assembler in the current directory. - gcc_cv_as=./as$build_exeext --elif test -x $AS_FOR_TARGET; then -+elif ( set dummy $AS_FOR_TARGET; test -x $[2] ); then - gcc_cv_as="$AS_FOR_TARGET" - else - AC_PATH_PROG(gcc_cv_as, $AS_FOR_TARGET) -@@ -1928,7 +1928,7 @@ - elif test -x collect-ld$build_exeext; then - # Build using linker in the current directory. - gcc_cv_ld=./collect-ld$build_exeext --elif test -x $LD_FOR_TARGET; then -+elif ( set dummy $LD_FOR_TARGET; test -x $[2] ); then - gcc_cv_ld="$LD_FOR_TARGET" - else - AC_PATH_PROG(gcc_cv_ld, $LD_FOR_TARGET) -@@ -1975,7 +1975,7 @@ - gcc_cv_nm=../binutils/nm-new$build_exeext - elif test -x nm$build_exeext; then - gcc_cv_nm=./nm$build_exeext --elif test -x $NM_FOR_TARGET; then -+elif ( set dummy $NM_FOR_TARGET; test -x $[2] ); then - gcc_cv_nm="$NM_FOR_TARGET" - else - AC_PATH_PROG(gcc_cv_nm, $NM_FOR_TARGET) -@@ -2003,7 +2003,7 @@ - gcc_cv_objdump=../binutils/objdump$build_exeext - elif test -x objdump$build_exeext; then - gcc_cv_objdump=./objdump$build_exeext --elif test -x $OBJDUMP_FOR_TARGET; then -+elif ( set dummy $OBJDUMP_FOR_TARGET; test -x $[2] ); then - gcc_cv_objdump="$OBJDUMP_FOR_TARGET" - else - AC_PATH_PROG(gcc_cv_objdump, $OBJDUMP_FOR_TARGET) ---- gcc/configure.orig 2007-10-08 16:18:46 +0200 -+++ gcc/configure 2007-10-08 16:23:26 +0200 -@@ -13303,7 +13303,7 @@ - elif test -x as$build_exeext; then - # Build using assembler in the current directory. - gcc_cv_as=./as$build_exeext --elif test -x $AS_FOR_TARGET; then -+elif ( set dummy $AS_FOR_TARGET; test -x $2 ); then - gcc_cv_as="$AS_FOR_TARGET" - else - # Extract the first word of "$AS_FOR_TARGET", so it can be a program name with args. -@@ -13419,7 +13419,7 @@ - elif test -x collect-ld$build_exeext; then - # Build using linker in the current directory. - gcc_cv_ld=./collect-ld$build_exeext --elif test -x $LD_FOR_TARGET; then -+elif ( set dummy $LD_FOR_TARGET; test -x $2 ); then - gcc_cv_ld="$LD_FOR_TARGET" - else - # Extract the first word of "$LD_FOR_TARGET", so it can be a program name with args. -@@ -13510,7 +13510,7 @@ - gcc_cv_nm=../binutils/nm-new$build_exeext - elif test -x nm$build_exeext; then - gcc_cv_nm=./nm$build_exeext --elif test -x $NM_FOR_TARGET; then -+elif ( set dummy $NM_FOR_TARGET; test -x $2 ); then - gcc_cv_nm="$NM_FOR_TARGET" - else - # Extract the first word of "$NM_FOR_TARGET", so it can be a program name with args. -@@ -13584,7 +13584,7 @@ - gcc_cv_objdump=../binutils/objdump$build_exeext - elif test -x objdump$build_exeext; then - gcc_cv_objdump=./objdump$build_exeext --elif test -x $OBJDUMP_FOR_TARGET; then -+elif ( set dummy $OBJDUMP_FOR_TARGET; test -x $2 ); then - gcc_cv_objdump="$OBJDUMP_FOR_TARGET" - else - # Extract the first word of "$OBJDUMP_FOR_TARGET", so it can be a program name with args. ---- gcc/Makefile.in.orig 2007-10-10 18:02:25 +0200 -+++ gcc/Makefile.in 2007-10-10 18:07:12 +0200 -@@ -1328,7 +1328,7 @@ - # Go through an additional indirection, because the file we create - # can be either `sometool' (if it is a script) or `sometool$(exeext)' - # (if it is a hard link). --stamp-as: $(ORIGINAL_AS_FOR_TARGET) -+stamp-as: $(firstword $(ORIGINAL_AS_FOR_TARGET)) - @echo creating as; \ - case "$(ORIGINAL_AS_FOR_TARGET)" in \ - ./as) ;; \ -@@ -1344,7 +1344,7 @@ - esac - echo timestamp > $@ - --stamp-collect-ld: $(ORIGINAL_LD_FOR_TARGET) -+stamp-collect-ld: $(firstword $(ORIGINAL_LD_FOR_TARGET)) - @echo creating collect-ld; \ - case "$(ORIGINAL_LD_FOR_TARGET)" in \ - ./collect-ld) ;; \ -@@ -1360,7 +1360,7 @@ - esac - echo timestamp > $@ - --stamp-nm: $(ORIGINAL_NM_FOR_TARGET) -+stamp-nm: $(firstword $(ORIGINAL_NM_FOR_TARGET)) - @echo creating nm; \ - case "$(ORIGINAL_NM_FOR_TARGET)" in \ - ./nm) ;; \ diff --git a/sys-devel/gcc/files/4.2.2/treelang-nomakeinfo.patch b/sys-devel/gcc/files/4.2.2/treelang-nomakeinfo.patch deleted file mode 100644 index 006f4ebb9c..0000000000 --- a/sys-devel/gcc/files/4.2.2/treelang-nomakeinfo.patch +++ /dev/null @@ -1,12 +0,0 @@ -http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27516 ---- gcc/Makefile.in.orig 2007-12-11 14:52:20.000000000 +0100 -+++ gcc/Makefile.in 2007-12-11 14:53:37.000000000 +0100 -@@ -3656,7 +3656,7 @@ - # Install the driver last so that the window when things are - # broken is small. - install: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \ -- install-cpp install-man install-info install-@POSUB@ \ -+ install-cpp install-man install-$(BUILD_INFO) install-@POSUB@ \ - install-driver - - # Handle cpp installation. diff --git a/sys-devel/gcc/files/4.3.2/gcc-4.3.2-softfloat.patch b/sys-devel/gcc/files/4.3.2/gcc-4.3.2-softfloat.patch deleted file mode 100644 index f530b6af1d..0000000000 --- a/sys-devel/gcc/files/4.3.2/gcc-4.3.2-softfloat.patch +++ /dev/null @@ -1,88 +0,0 @@ -The hunk for gcc/config/arm/t-linux comes from: -http://gcc.gnu.org/PR14352 - -The rest is a custom job by Yuri Vasilevski. - -The idea here is that we add soft float support into the spec file -so that we don't have to worry about packages stripping out softfloat -flags from CFLAGS/CXXFLAGS. - -http://bugs.gentoo.org/75585 - ---- gcc-4.0.2/gcc/config/arm/elf.h -+++ gcc-4.0.2/gcc/config/arm/elf.h -@@ -45,8 +45,9 @@ - #endif - - #ifndef SUBTARGET_ASM_FLOAT_SPEC --#define SUBTARGET_ASM_FLOAT_SPEC "\ --%{mapcs-float:-mfloat}" -+#define SUBTARGET_ASM_FLOAT_SPEC "%{mapcs-float:-mfloat} \ -+ %{mhard-float:-mfpu=fpa} \ -+ %{!mhard-float: %{msoft-float:-mfpu=softfpa;:-mfpu=softvfp}}" - #endif - - #ifndef ASM_SPEC -@@ -58,8 +59,6 @@ - %{mapcs-*:-mapcs-%*} \ - %(subtarget_asm_float_spec) \ - %{mthumb-interwork:-mthumb-interwork} \ --%{msoft-float:-mfloat-abi=soft} %{mhard-float:-mfloat-abi=hard} \ --%{mfloat-abi=*} %{mfpu=*} \ - %(subtarget_extra_asm_spec)" - #endif - ---- gcc-4.0.2/gcc/config/arm/linux-elf.h -+++ gcc-4.0.2/gcc/config/arm/linux-elf.h -@@ -28,7 +28,7 @@ - #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr); - - #undef TARGET_DEFAULT_FLOAT_ABI --#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD -+#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT - - /* TARGET_BIG_ENDIAN_DEFAULT is set in - config.gcc for big endian configurations. */ -@@ -44,6 +44,10 @@ - - #undef TARGET_DEFAULT - #define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT) -+#undef SUBTARGET_EXTRA_ASM_SPEC -+#define SUBTARGET_EXTRA_ASM_SPEC "%{mhard-float:-mfpu=fpa} \ -+ %{!mhard-float: %{msoft-float:-mfpu=softfpa;:-mfpu=softvfp}}" -+ - - #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 - -@@ -51,7 +55,7 @@ - - #undef MULTILIB_DEFAULTS - #define MULTILIB_DEFAULTS \ -- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" } -+ { "marm", TARGET_ENDIAN_OPTION, "msoft-float", "mno-thumb-interwork" } - - /* Now we define the strings used to build the spec file. */ - #undef LIB_SPEC -@@ -60,7 +64,7 @@ - %{shared:-lc} \ - %{!shared:%{profile:-lc_p}%{!profile:-lc}}" - --#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" -+#define LIBGCC_SPEC "-lgcc" - - #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" - ---- gcc-4.0.2/gcc/config/arm/t-linux -+++ gcc-4.0.2/gcc/config/arm/t-linux -@@ -4,7 +4,10 @@ TARGET_LIBGCC2_CFLAGS = -fomit-frame-poi - LIBGCC2_DEBUG_CFLAGS = -g0 - - LIB1ASMSRC = arm/lib1funcs.asm --LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx -+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \ -+ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ -+ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ -+ _fixsfsi _fixunssfsi _floatdidf _floatdisf - - # MULTILIB_OPTIONS = mhard-float/msoft-float - # MULTILIB_DIRNAMES = hard-float soft-float diff --git a/sys-devel/gcc/files/4.3.3/aix-force-pthread.patch b/sys-devel/gcc/files/4.3.3/aix-force-pthread.patch deleted file mode 100644 index b38cc2fcd3..0000000000 --- a/sys-devel/gcc/files/4.3.3/aix-force-pthread.patch +++ /dev/null @@ -1,316 +0,0 @@ -diff -ru gcc/config/rs6000.orig/aix41.h gcc/config/rs6000/aix41.h ---- gcc/config/rs6000.orig/aix41.h 2009-07-31 14:24:20 +0200 -+++ gcc/config/rs6000/aix41.h 2009-07-31 14:25:19 +0200 -@@ -39,7 +39,7 @@ - #define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\ - %{ansi: -D_ANSI_C_SOURCE}\ - %{mpe: -I/usr/lpp/ppe.poe/include}\ -- %{pthread: -D_THREAD_SAFE}" -+ %{pthread:} -D_THREAD_SAFE" - - #undef TARGET_DEFAULT - #define TARGET_DEFAULT MASK_NEW_MNEMONICS -@@ -69,8 +69,8 @@ - #define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\ - %{p:-L/lib/profiled -L/usr/lib/profiled} %{!shared:%{g*:-lg}}\ - %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\ -- %{pthread: -L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a}\ -- %{!pthread: -lc}" -+ %{pthread:} -L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a\ -+ " - - #undef LINK_SPEC - #define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ -@@ -83,8 +83,8 @@ - %{!pg:%{p:/usr/lpp/ppe.poe/lib/mcrt0.o}\ - %{!p:/usr/lpp/ppe.poe/lib/crt0.o}}}\ - %{!mpe:\ -- %{pthread:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\ -- %{!pthread:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}" -+ %{pthread:}%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}\ -+ }}" - - /* AIX 4 uses PowerPC nop (ori 0,0,0) instruction as call glue for PowerPC - and "cror 31,31,31" for POWER architecture. */ -diff -ru gcc/config/rs6000.orig/aix43.h gcc/config/rs6000/aix43.h ---- gcc/config/rs6000.orig/aix43.h 2009-07-31 14:24:20 +0200 -+++ gcc/config/rs6000/aix43.h 2009-07-31 14:25:50 +0200 -@@ -105,7 +105,7 @@ - %{ansi: -D_ANSI_C_SOURCE}\ - %{maix64: -D__64BIT__}\ - %{mpe: -I/usr/lpp/ppe.poe/include}\ -- %{pthread: -D_THREAD_SAFE}" -+ %{pthread:} -D_THREAD_SAFE" - - /* The GNU C++ standard library requires that these macros be - defined. */ -@@ -114,7 +114,7 @@ - "-D_ALL_SOURCE \ - %{maix64: -D__64BIT__} \ - %{mpe: -I/usr/lpp/ppe.poe/include} \ -- %{pthread: -D_THREAD_SAFE}" -+ %{pthread:} -D_THREAD_SAFE" - - #undef TARGET_DEFAULT - #define TARGET_DEFAULT MASK_NEW_MNEMONICS -@@ -145,8 +145,8 @@ - %{p:-L/lib/profiled -L/usr/lib/profiled}\ - %{!maix64:%{!shared:%{g*:-lg}}}\ - %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\ -- %{pthread:-L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a}\ -- %{!pthread:-lc}" -+ %{pthread:}-L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a\ -+ " - - #undef LINK_SPEC - #define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ -@@ -158,8 +158,8 @@ - #define STARTFILE_SPEC "%{!shared:\ - %{maix64:%{pg:gcrt0_64%O%s}%{!pg:%{p:mcrt0_64%O%s}%{!p:crt0_64%O%s}}}\ - %{!maix64:\ -- %{pthread:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\ -- %{!pthread:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}" -+ %{pthread:}%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}\ -+ }}" - - /* AIX 4.3 typedefs ptrdiff_t as "long" while earlier releases used "int". */ - -diff -ru gcc/config/rs6000.orig/aix51.h gcc/config/rs6000/aix51.h ---- gcc/config/rs6000.orig/aix51.h 2009-07-31 14:24:20 +0200 -+++ gcc/config/rs6000/aix51.h 2009-07-31 14:26:13 +0200 -@@ -101,7 +101,7 @@ - %{ansi: -D_ANSI_C_SOURCE} \ - %{maix64: -D__64BIT__} \ - %{mpe: -I/usr/lpp/ppe.poe/include} \ -- %{pthread: -D_THREAD_SAFE}" -+ %{pthread:} -D_THREAD_SAFE" - - /* The GNU C++ standard library requires that these macros be - defined. */ -@@ -110,7 +110,7 @@ - "-D_ALL_SOURCE \ - %{maix64: -D__64BIT__} \ - %{mpe: -I/usr/lpp/ppe.poe/include} \ -- %{pthread: -D_THREAD_SAFE}" -+ %{pthread:} -D_THREAD_SAFE" - - #undef TARGET_DEFAULT - #define TARGET_DEFAULT MASK_NEW_MNEMONICS -@@ -141,7 +141,7 @@ - %{p:-L/lib/profiled -L/usr/lib/profiled}\ - %{!maix64:%{!shared:%{g*:-lg}}}\ - %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\ -- %{pthread:-lpthreads} -lc" -+ %{pthread:}-lpthreads -lc" - - #undef LINK_SPEC - #define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ -@@ -153,8 +153,8 @@ - #define STARTFILE_SPEC "%{!shared:\ - %{maix64:%{pg:gcrt0_64%O%s}%{!pg:%{p:mcrt0_64%O%s}%{!p:crt0_64%O%s}}}\ - %{!maix64:\ -- %{pthread:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\ -- %{!pthread:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}" -+ %{pthread:}%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}\ -+ }}" - - /* AIX V5 typedefs ptrdiff_t as "long" while earlier releases used "int". */ - -diff -ru gcc/config/rs6000.orig/aix52.h gcc/config/rs6000/aix52.h ---- gcc/config/rs6000.orig/aix52.h 2009-07-31 14:24:20 +0200 -+++ gcc/config/rs6000/aix52.h 2009-07-31 14:26:31 +0200 -@@ -100,7 +100,7 @@ - %{ansi: -D_ANSI_C_SOURCE} \ - %{maix64: -D__64BIT__} \ - %{mpe: -I/usr/lpp/ppe.poe/include} \ -- %{pthread: -D_THREAD_SAFE}" -+ %{pthread:} -D_THREAD_SAFE" - - /* The GNU C++ standard library requires that these macros be - defined. Synchronize with libstdc++ os_defines.h. */ -@@ -109,7 +109,7 @@ - "-D_ALL_SOURCE \ - %{maix64: -D__64BIT__} \ - %{mpe: -I/usr/lpp/ppe.poe/include} \ -- %{pthread: -D_THREAD_SAFE}" -+ %{pthread:} -D_THREAD_SAFE" - - #undef TARGET_DEFAULT - #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS) -@@ -144,7 +144,7 @@ - %{p:-L/lib/profiled -L/usr/lib/profiled}\ - %{!maix64:%{!shared:%{g*:-lg}}}\ - %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\ -- %{pthread:-lpthreads} -lc" -+ %{pthread:}-lpthreads -lc" - - #undef LINK_SPEC - #define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ -@@ -156,8 +156,8 @@ - #define STARTFILE_SPEC "%{!shared:\ - %{maix64:%{pg:gcrt0_64%O%s}%{!pg:%{p:mcrt0_64%O%s}%{!p:crt0_64%O%s}}}\ - %{!maix64:\ -- %{pthread:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\ -- %{!pthread:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}" -+ %{pthread:}%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}\ -+ }}" - - /* AIX V5 typedefs ptrdiff_t as "long" while earlier releases used "int". */ - -diff -ru gcc/config/rs6000.orig/aix53.h gcc/config/rs6000/aix53.h ---- gcc/config/rs6000.orig/aix53.h 2009-07-31 14:24:20 +0200 -+++ gcc/config/rs6000/aix53.h 2009-07-31 14:26:47 +0200 -@@ -102,7 +102,7 @@ - %{ansi: -D_ANSI_C_SOURCE} \ - %{maix64: -D__64BIT__} \ - %{mpe: -I/usr/lpp/ppe.poe/include} \ -- %{pthread: -D_THREAD_SAFE}" -+ %{pthread:} -D_THREAD_SAFE" - - /* The GNU C++ standard library requires that these macros be - defined. Synchronize with libstdc++ os_defines.h. */ -@@ -111,7 +111,7 @@ - "-D_ALL_SOURCE \ - %{maix64: -D__64BIT__} \ - %{mpe: -I/usr/lpp/ppe.poe/include} \ -- %{pthread: -D_THREAD_SAFE}" -+ %{pthread:} -D_THREAD_SAFE" - - #undef TARGET_DEFAULT - #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS) -@@ -140,7 +140,7 @@ - %{p:-L/lib/profiled -L/usr/lib/profiled}\ - %{!maix64:%{!shared:%{g*:-lg}}}\ - %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\ -- %{pthread:-lpthreads} -lc" -+ %{pthread:}-lpthreads -lc" - - #undef LINK_SPEC - #define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ -@@ -152,8 +152,8 @@ - #define STARTFILE_SPEC "%{!shared:\ - %{maix64:%{pg:gcrt0_64%O%s}%{!pg:%{p:mcrt0_64%O%s}%{!p:crt0_64%O%s}}}\ - %{!maix64:\ -- %{pthread:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\ -- %{!pthread:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}" -+ %{pthread:}%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}\ -+ }}" - - /* AIX V5 typedefs ptrdiff_t as "long" while earlier releases used "int". */ - -diff -ru gcc/config/rs6000.orig/aix61.h gcc/config/rs6000/aix61.h ---- gcc/config/rs6000.orig/aix61.h 2009-07-31 14:24:20 +0200 -+++ gcc/config/rs6000/aix61.h 2009-07-31 14:27:02 +0200 -@@ -103,7 +103,7 @@ - %{ansi: -D_ANSI_C_SOURCE} \ - %{maix64: -D__64BIT__} \ - %{mpe: -I/usr/lpp/ppe.poe/include} \ -- %{pthread: -D_THREAD_SAFE}" -+ %{pthread:} -D_THREAD_SAFE" - - /* The GNU C++ standard library requires that these macros be - defined. Synchronize with libstdc++ os_defines.h. */ -@@ -112,7 +112,7 @@ - "-D_ALL_SOURCE -D__COMPATMATH__ \ - %{maix64: -D__64BIT__} \ - %{mpe: -I/usr/lpp/ppe.poe/include} \ -- %{pthread: -D_THREAD_SAFE}" -+ %{pthread:} -D_THREAD_SAFE" - - #undef TARGET_DEFAULT - #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS) -@@ -141,7 +141,7 @@ - %{p:-L/lib/profiled -L/usr/lib/profiled}\ - %{!maix64:%{!shared:%{g*:-lg}}}\ - %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\ -- %{pthread:-lpthreads} -lc" -+ %{pthread:}-lpthreads -lc" - - #undef LINK_SPEC - #define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ -@@ -153,8 +153,8 @@ - #define STARTFILE_SPEC "%{!shared:\ - %{maix64:%{pg:gcrt0_64%O%s}%{!pg:%{p:mcrt0_64%O%s}%{!p:crt0_64%O%s}}}\ - %{!maix64:\ -- %{pthread:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\ -- %{!pthread:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}" -+ %{pthread:}%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}\ -+ }}" - - /* AIX V5 typedefs ptrdiff_t as "long" while earlier releases used "int". */ - -diff -ru gcc/config/rs6000.orig/t-aix43 gcc/config/rs6000/t-aix43 ---- gcc/config/rs6000.orig/t-aix43 2009-07-31 14:24:20 +0200 -+++ gcc/config/rs6000/t-aix43 2009-07-31 14:29:20 +0200 -@@ -10,13 +10,13 @@ - echo '#define FLOAT' > fp-bit.c - cat $(srcdir)/config/fp-bit.c >> fp-bit.c - --# Build the libraries for pthread and all of the -+# Build the libraries for all of the - # different processor models - --MULTILIB_OPTIONS = pthread \ -+MULTILIB_OPTIONS = \ - mcpu=common/mcpu=power/mcpu=powerpc/maix64 - --MULTILIB_DIRNAMES = pthread \ -+MULTILIB_DIRNAMES = \ - common power powerpc ppc64 - - MULTILIB_MATCHES = mcpu?power=mcpu?power \ -@@ -46,7 +46,7 @@ - SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \ - -Wl,-bE:@shlib_map_file@ -o @multilib_dir@/shr.o \ - @multilib_flags@ @shlib_objs@ -lc \ -- `case @multilib_dir@ in \ -+ `case pthread@multilib_dir@ in \ - *pthread*) echo -L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a ;; \ - *) echo -lc ;; esac` ; \ - rm -f @multilib_dir@/tmp-@shlib_base_name@.a ; \ -@@ -61,7 +61,7 @@ - $$(mkinstalldirs) $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@; \ - $(INSTALL_DATA) @multilib_dir@/@shlib_base_name@.a \ - $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/ --SHLIB_LIBS = -lc `case @multilib_dir@ in *pthread*) echo -lpthread ;; esac` -+SHLIB_LIBS = -lc `case pthread@multilib_dir@ in *pthread*) echo -lpthread ;; esac` - SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk - SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver $(srcdir)/config/rs6000/libgcc-ppc64.ver - SHLIB_NM_FLAGS = -Bpg -X32_64 -diff -ru gcc/config/rs6000.orig/t-aix52 gcc/config/rs6000/t-aix52 ---- gcc/config/rs6000.orig/t-aix52 2009-07-31 14:24:20 +0200 -+++ gcc/config/rs6000/t-aix52 2009-07-31 14:29:38 +0200 -@@ -10,12 +10,12 @@ - echo '#define FLOAT' > fp-bit.c - cat $(srcdir)/config/fp-bit.c >> fp-bit.c - --# Build the libraries for pthread and all of the -+# Build the libraries for all of the - # different processor models - --MULTILIB_OPTIONS = pthread maix64 -+MULTILIB_OPTIONS = maix64 - --MULTILIB_DIRNAMES = pthread ppc64 -+MULTILIB_DIRNAMES = ppc64 - - MULTILIB_MATCHES = - -@@ -27,7 +27,7 @@ - SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \ - -Wl,-bE:@shlib_map_file@ -o @multilib_dir@/shr.o \ - @multilib_flags@ @shlib_objs@ -lc \ -- `case @multilib_dir@ in \ -+ `case pthread@multilib_dir@ in \ - *pthread*) echo -L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a ;; \ - *) echo -lc ;; esac` ; \ - rm -f @multilib_dir@/tmp-@shlib_base_name@.a ; \ -@@ -42,7 +42,7 @@ - $$(mkinstalldirs) $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@; \ - $(INSTALL_DATA) @multilib_dir@/@shlib_base_name@.a \ - $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/ --SHLIB_LIBS = -lc `case @multilib_dir@ in *pthread*) echo -lpthread ;; esac` -+SHLIB_LIBS = -lc `case pthread@multilib_dir@ in *pthread*) echo -lpthread ;; esac` - SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk - SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver $(srcdir)/config/rs6000/libgcc-ppc64.ver - SHLIB_NM_FLAGS = -Bpg -X32_64 diff --git a/sys-devel/gcc/files/4.3.3/gcc-4.3.3-redundant-linkage.patch b/sys-devel/gcc/files/4.3.3/gcc-4.3.3-redundant-linkage.patch deleted file mode 100644 index 6f79830ca4..0000000000 --- a/sys-devel/gcc/files/4.3.3/gcc-4.3.3-redundant-linkage.patch +++ /dev/null @@ -1,18 +0,0 @@ -Patch for bug #318283 based on -http://gcc.gnu.org/viewcvs/branches/gcc-4_4-branch/gcc/cp/Make-lang.in?r1=145122&r2=151555&pathrev=151555 -http://gcc.gnu.org/viewcvs/branches/gcc-4_4-branch/gcc/cp/Make-lang.in?view=log&pathrev=151555 - - ---- gcc/cp/Make-lang.in.orig 2010-05-13 20:58:33.000000000 +0200 -+++ gcc/cp/Make-lang.in 2010-05-13 20:59:05.000000000 +0200 -@@ -72,8 +72,8 @@ - # Shared with C front end: - CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \ - c-dump.o $(CXX_TARGET_OBJS) c-pretty-print.o c-opts.o c-pch.o \ -- c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o \ -- c-gimplify.o c-omp.o tree-inline.o -+ c-incpath.o c-ppoutput.o c-cppbuiltin.o prefix.o \ -+ c-gimplify.o c-omp.o - - # Language-specific object files for C++ and Objective C++. - CXX_AND_OBJCXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \ diff --git a/sys-devel/gcc/files/4.3.3/prefix-search-dirs.patch b/sys-devel/gcc/files/4.3.3/prefix-search-dirs.patch deleted file mode 100644 index c10eef5e39..0000000000 --- a/sys-devel/gcc/files/4.3.3/prefix-search-dirs.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- gcc/gcc.c.orig 2009-03-25 19:20:50 +0100 -+++ gcc/gcc.c 2009-03-26 00:37:23 +0100 -@@ -1515,8 +1515,8 @@ static const char *const standard_startf - /* For native compilers, these are well-known paths containing - components that may be provided by the system. For cross - compilers, these paths are not used. */ --static const char *const standard_exec_prefix_1 = "/usr/libexec/gcc/"; --static const char *const standard_exec_prefix_2 = "/usr/lib/gcc/"; -+static const char *const standard_exec_prefix_1 = "@GENTOO_PORTAGE_EPREFIX@/usr/libexec/gcc/"; -+static const char *const standard_exec_prefix_2 = "@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/"; - static const char *md_exec_prefix = MD_EXEC_PREFIX; - static const char *md_startfile_prefix = MD_STARTFILE_PREFIX; - static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1; -@@ -2584,6 +2584,34 @@ add_to_obstack (char *path, void *data) - { - struct add_to_obstack_info *info = data; - -+#if DISABLE_MULTILIB -+ /* -+ * Fix multilib paths for our prefix, that is alter lib64 and lib32 to lib. -+ * No allocation needed, since the path won't grow but only shrink by two -+ * chars. We should not modify host multilib dirs, otherwise libs might not -+ * be found in /lib64 or /usr/lib64 -+ */ -+ int elen = strlen("@GENTOO_PORTAGE_EPREFIX@"); -+ if (strncmp(path, "@GENTOO_PORTAGE_EPREFIX@", elen) == 0) { -+ /* multilib dirs are put at the end like ../lib32/ ../lib64/ */ -+ static char const *mdirs[] = { "../lib64/", "../lib32/" }; -+ int plen = strlen(path); -+ unsigned int idx; -+ int mlen; -+ -+ /* For each path replace the multilib dir at the end of the path. */ -+ for (idx = 0; idx < (sizeof(mdirs) / sizeof(mdirs[0])); idx++) { -+ mlen = strlen(mdirs[idx]); -+ if (strncmp(path + plen - mlen, mdirs[idx], mlen) == 0) { -+ /* Overwrite the part with null-termination. In prefix the only multilib -+ occurence is the one added by gcc so we can end here. */ -+ strcpy(path + plen - mlen, "../lib/"); -+ break; -+ } -+ } -+ } -+#endif -+ - if (info->check_dir && !is_directory (path, false)) - return NULL; - diff --git a/sys-devel/gcc/files/4.3.3/solarisx86_64.patch b/sys-devel/gcc/files/4.3.3/solarisx86_64.patch deleted file mode 100644 index fb93c5a2a7..0000000000 --- a/sys-devel/gcc/files/4.3.3/solarisx86_64.patch +++ /dev/null @@ -1,118 +0,0 @@ ---- gcc/config.gcc -+++ gcc/config.gcc -@@ -1330,6 +1330,74 @@ - ;; - esac - ;; -+x86_64-*-solaris2*) -+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h i386/sysv4.h sol2.h" -+ case ${target} in -+ *-*-solaris2.1[0-9]*) -+ tm_file="${tm_file} sol2-10.h" -+ ;; -+ esac -+ tm_file="${tm_file} i386/sol2.h" -+ tmake_file="t-sol2 i386/t-sol2" -+ c_target_objs="sol2-c.o" -+ cxx_target_objs="sol2-c.o" -+ extra_objs="sol2.o" -+ tm_p_file="${tm_p_file} sol2-protos.h" -+ if test x$gnu_ld = xyes; then -+ tmake_file="$tmake_file t-slibgcc-elf-ver" -+ tm_defines="${tm_defines} TARGET_GNU_LD=1" -+ else -+ tmake_file="$tmake_file t-slibgcc-sld" -+ fi -+ if test x$gas = xyes; then -+ tm_file="usegas.h ${tm_file}" -+ fi -+ case ${target} in -+ *-*-solaris2.[789] | *-*-solaris2.1[0-9]*) -+ tm_file="$tm_file tm-dwarf2.h" -+ ;; -+ esac -+ case ${target} in -+ *-*-solaris2.1[0-9]*) -+ tm_file="${tm_file} i386/x86-64.h i386/sol2-10.h i386/sol2-64.h" -+ tm_defines="${tm_defines} TARGET_BI_ARCH=1" -+ tmake_file="$tmake_file i386/t-sol2-10" -+ # i386/t-crtstuff only affects libgcc. Its inclusion -+ # depends on a runtime test and is thus performed in -+ # libgcc/configure.ac instead. -+ need_64bit_hwint=yes -+ # FIXME: -m64 for i[34567]86-*-* should be allowed just -+ # like -m32 for x86_64-*-*. -+ case X"${with_cpu}" in -+ Xgeneric|Xcore2|Xnocona|Xx86-64|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx) -+ ;; -+ X) -+ with_cpu=generic -+ ;; -+ *) -+ echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2 -+ echo "generic core2 nocona x86-64 amdfam10 barcelona k8 opteron athlon64 athlon-fx" 1>&2 -+ exit 1 -+ ;; -+ esac -+ ;; -+ esac -+ case ${enable_threads}:${have_pthread_h}:${have_thread_h} in -+ "":yes:* | yes:yes:* ) -+ case ${target} in -+ *-*-solaris2.[0-6] | *-*-solaris2.[0-6].*) -+ thread_file=posix95 -+ ;; -+ *) -+ thread_file=posix -+ ;; -+ esac -+ ;; -+ "":*:yes | yes:*:yes ) -+ thread_file=solaris -+ ;; -+ esac -+ ;; - i[34567]86-*-sysv5*) # Intel x86 on System V Release 5 - tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h i386/sysv4.h i386/sysv5.h" - if test x$stabs = xyes ---- libgcc/configure.ac -+++ libgcc/configure.ac -@@ -160,7 +160,7 @@ - # Link with -nostartfiles -nodefaultlibs since neither are present while - # building libgcc. - case ${host} in --i?86-*-solaris2.1[[0-9]]*) -+i?86-*-solaris2.1[[0-9]]*|x86_64-*-solaris2.1[[0-9]]*) - cat > conftest.s <<EOF - .section .eh_frame,"a",@unwind - .zero 4 ---- libgcc/configure -+++ libgcc/configure -@@ -3383,7 +3383,7 @@ - # Link with -nostartfiles -nodefaultlibs since neither are present while - # building libgcc. - case ${host} in --i?86-*-solaris2.1[0-9]*) -+i?86-*-solaris2.1[0-9]*|x86_64-*-solaris2.1[0-9]*) - cat > conftest.s <<EOF - .section .eh_frame,"a",@unwind - .zero 4 ---- libgcc/config.host -+++ libgcc/config.host -@@ -352,7 +352,7 @@ - ;; - i[34567]86-*-sco3.2v5*) # 80386 running SCO Open Server 5 - ;; --i[34567]86-*-solaris2*) -+i[34567]86-*-solaris2*|x86_64-*-solaris2*) - tmake_file="${tmake_file} i386/t-sol2" - case ${host} in - *-*-solaris2.1[0-9]*) ---- gcc/config/i386/sol2-64.h -+++ gcc/config/i386/sol2-64.h -@@ -0,0 +1,5 @@ -+/* Definitions of target machine for GCC, for bi-arch i386 -+ running Solaris 2, defaulting to 64-bit code generation. */ -+ -+#undef MULTILIB_DEFAULTS -+#define MULTILIB_DEFAULTS { "m64" } diff --git a/sys-devel/gcc/files/4.5.2/m68k-coldfire.patch b/sys-devel/gcc/files/4.5.2/m68k-coldfire.patch deleted file mode 100644 index 0fc1dbe798..0000000000 --- a/sys-devel/gcc/files/4.5.2/m68k-coldfire.patch +++ /dev/null @@ -1,52 +0,0 @@ -gcc/ - -2011-07-29 Mikael Pettersson <mikpe@it.uu.se> - - PR target/47908 - * config/m68k/m68k-protos.h (optimization_options): Declare. - * config/m68k/m68k.c (optimization_options): New function. - Disable instruction scheduling for non-ColdFire targets. - * config/m68k/m68k.h (OPTIMIZATION_OPTIONS): Define. - ---- gcc-4.5.3/gcc/config/m68k/m68k-protos.h.~1~ 2009-05-18 09:54:44.000000000 +0200 -+++ gcc-4.5.3/gcc/config/m68k/m68k-protos.h 2011-07-29 13:31:33.000000000 +0200 -@@ -95,6 +95,7 @@ extern void m68k_expand_prologue (void); - extern bool m68k_use_return_insn (void); - extern void m68k_expand_epilogue (bool); - extern void override_options (void); -+extern void optimization_options (int, int); - extern const char *m68k_cpp_cpu_ident (const char *); - extern const char *m68k_cpp_cpu_family (const char *); - extern void init_68881_table (void); ---- gcc-4.5.3/gcc/config/m68k/m68k.c.~1~ 2010-06-14 22:01:39.000000000 +0200 -+++ gcc-4.5.3/gcc/config/m68k/m68k.c 2011-07-29 13:31:33.000000000 +0200 -@@ -742,6 +742,17 @@ override_options (void) - } - } - -+void -+optimization_options (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED) -+{ -+ if (m68k_sched_cpu == CPU_UNKNOWN) -+ { -+ flag_schedule_insns = 0; -+ flag_schedule_insns_after_reload = 0; -+ flag_modulo_sched = 0; -+ } -+} -+ - /* Generate a macro of the form __mPREFIX_cpu_NAME, where PREFIX is the - given argument and NAME is the argument passed to -mcpu. Return NULL - if -mcpu was not passed. */ ---- gcc-4.5.3/gcc/config/m68k/m68k.h.~1~ 2009-09-22 17:49:54.000000000 +0200 -+++ gcc-4.5.3/gcc/config/m68k/m68k.h 2011-07-29 13:31:33.000000000 +0200 -@@ -276,6 +276,9 @@ along with GCC; see the file COPYING3. - - #define OVERRIDE_OPTIONS override_options() - -+#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \ -+ optimization_options ((LEVEL), (SIZE)) -+ - /* These are meant to be redefined in the host dependent files */ - #define SUBTARGET_OVERRIDE_OPTIONS - diff --git a/sys-devel/gcc/files/4.5.2/prefix-search-dirs.patch b/sys-devel/gcc/files/4.5.2/prefix-search-dirs.patch deleted file mode 100644 index 88efc287c7..0000000000 --- a/sys-devel/gcc/files/4.5.2/prefix-search-dirs.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- gcc/gcc.c.orig 2011-03-05 16:27:49.000000000 +0100 -+++ gcc/gcc.c 2011-03-05 16:42:54.000000000 +0100 -@@ -2691,6 +2691,34 @@ - { - struct add_to_obstack_info *info = (struct add_to_obstack_info *) data; - -+#if DISABLE_MULTILIB -+ /* -+ * Fix multilib paths for our prefix, that is alter lib64 and lib32 to lib. -+ * No allocation needed, since the path won't grow but only shrink by two -+ * chars. We should not modify host multilib dirs, otherwise libs might not -+ * be found in /lib64 or /usr/lib64 -+ */ -+ int elen = strlen(STANDARD_EXEC_PREFIX); -+ if (elen && strncmp(path, STANDARD_EXEC_PREFIX, elen) == 0) { -+ /* multilib dirs are put at the end like ../lib32/ ../lib64/ */ -+ static char const *mdirs[] = { "../lib64/", "../lib32/" }; -+ int plen = strlen(path); -+ unsigned int idx; -+ int mlen; -+ -+ /* For each path replace the multilib dir at the end of the path. */ -+ for (idx = 0; idx < (sizeof(mdirs) / sizeof(mdirs[0])); idx++) { -+ mlen = strlen(mdirs[idx]); -+ if (strncmp(path + plen - mlen, mdirs[idx], mlen) == 0) { -+ /* Overwrite the part with null-termination. In prefix the only multilib -+ occurence is the one added by gcc so we can end here. */ -+ strcpy(path + plen - mlen, "../lib/"); -+ break; -+ } -+ } -+ } -+#endif -+ - if (info->check_dir && !is_directory (path, false)) - return NULL; - diff --git a/sys-devel/gcc/files/4.5.2/solaris-pthread.patch b/sys-devel/gcc/files/4.5.2/solaris-pthread.patch deleted file mode 100644 index 86728eed41..0000000000 --- a/sys-devel/gcc/files/4.5.2/solaris-pthread.patch +++ /dev/null @@ -1,32 +0,0 @@ -Fix compiling java/gcj on Solaris - -ChÃ-Thanh Christopher Nguyá»…n - -https://bugs.gentoo.org/show_bug.cgi?id=380369 - ---- a/libjava/configure.ac -+++ b/libjava/configure.ac -@@ -1064,6 +1064,10 @@ - THREADLIBS='-lpthread -lrt' - THREADSPEC='-lpthread -lrt' - ;; -+ *-*-solaris*) -+ THREADCXXFLAGS=-pthread -+ THREADSPEC=-lpthread -+ ;; - *) - THREADLIBS=-lpthread - THREADSPEC=-lpthread ---- a/libjava/configure -+++ b/libjava/configure -@@ -20702,6 +20702,10 @@ - THREADLIBS='-lpthread -lrt' - THREADSPEC='-lpthread -lrt' - ;; -+ *-*-solaris*) -+ THREADCXXFLAGS=-pthread -+ THREADSPEC=-lpthread -+ ;; - *) - THREADLIBS=-lpthread - THREADSPEC=-lpthread diff --git a/sys-devel/gcc/files/4.5.2/solaris-searchpath.patch b/sys-devel/gcc/files/4.5.2/solaris-searchpath.patch deleted file mode 100644 index d51c86e6c7..0000000000 --- a/sys-devel/gcc/files/4.5.2/solaris-searchpath.patch +++ /dev/null @@ -1,89 +0,0 @@ -* don't inject /usr/lib{/64,} and /lib{/64,} before any other thing in the - call to the linker, that breaks the entire idea of Prefix -* -rpath-link overrides the entire search path, so don't use it - ---- gcc/config/i386/sol2-10.h -+++ gcc/config/i386/sol2-10.h -@@ -109,12 +109,12 @@ - %{YP,*} \ - %{R*} \ - %{compat-bsd: \ -- %{!YP,*:%{p|pg:-Y P,/usr/ucblib/64:/usr/lib/libp/64:/lib/64:/usr/lib/64} \ -- %{!p:%{!pg:-Y P,/usr/ucblib/64:/lib:/usr/lib/64}}} \ -+ %{!YP,*:%{p|pg:-Y P,/usr/ucblib/64:/usr/lib/libp/64} \ -+ %{!p:%{!pg:-Y P,/usr/ucblib/64}}} \ - -R /usr/ucblib/64} \ - %{!compat-bsd: \ -- %{!YP,*:%{p|pg:-Y P,/usr/lib/libp/64:/lib/64:/usr/lib/64} \ -- %{!p:%{!pg:-Y P,/lib/64:/usr/lib/64}}}}" -+ %{!YP,*:%{p|pg:-Y P,/usr/lib/libp/64} \ -+ }}" - - #undef LINK_ARCH64_SPEC - #define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE ---- gcc/config/sol2.h -+++ gcc/config/sol2.h -@@ -156,12 +156,12 @@ - %{YP,*} \ - %{R*} \ - %{compat-bsd: \ -- %{!YP,*:%{p|pg:-Y P,%R/usr/ucblib:%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/usr/lib} \ -- %{!p:%{!pg:-Y P,%R/usr/ucblib:%R/usr/ccs/lib:%R/usr/lib}}} \ -+ %{!YP,*:%{p|pg:-Y P,%R/usr/ucblib:%R/usr/lib/libp} \ -+ %{!p:%{!pg:-Y P,%R/usr/ucblib}}} \ - -R %R/usr/ucblib} \ - %{!compat-bsd: \ -- %{!YP,*:%{p|pg:-Y P,%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/usr/lib} \ -- %{!p:%{!pg:-Y P,%R/usr/ccs/lib:%R/usr/lib}}}}" -+ %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp} \ -+ }}" - - #undef LINK_ARCH32_SPEC - #define LINK_ARCH32_SPEC LINK_ARCH32_SPEC_BASE ---- gcc/config/sparc/sol2-bi.h -+++ gcc/config/sparc/sol2-bi.h -@@ -195,12 +195,12 @@ - %{YP,*} \ - %{R*} \ - %{compat-bsd: \ -- %{!YP,*:%{p|pg:-Y P,%R/usr/ucblib/sparcv9:%R/usr/lib/libp/sparcv9:%R/usr/lib/sparcv9} \ -- %{!p:%{!pg:-Y P,%R/usr/ucblib/sparcv9:%R/usr/lib/sparcv9}}} \ -+ %{!YP,*:%{p|pg:-Y P,%R/usr/ucblib/sparcv9:%R/usr/lib/libp/sparcv9} \ -+ %{!p:%{!pg:-Y P,%R/usr/ucblib/sparcv9}}} \ - -R %R/usr/ucblib/sparcv9} \ - %{!compat-bsd: \ -- %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp/sparcv9:%R/usr/lib/sparcv9} \ -- %{!p:%{!pg:-Y P,%R/usr/lib/sparcv9}}}}" -+ %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp/sparcv9} \ -+ }}" - - #define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE - ---- gcc/config/sparc/sol2-gld-bi.h -+++ gcc/config/sparc/sol2-gld-bi.h -@@ -26,11 +26,11 @@ - - #undef LINK_ARCH32_SPEC - #define LINK_ARCH32_SPEC \ -- LINK_ARCH32_SPEC_BASE "%{!static: -rpath-link %R/usr/lib}" -+ LINK_ARCH32_SPEC_BASE "" - - #undef LINK_ARCH64_SPEC - #define LINK_ARCH64_SPEC \ -- LINK_ARCH64_SPEC_BASE "%{!static: -rpath-link %R/usr/lib/sparcv9}" -+ LINK_ARCH64_SPEC_BASE "" - - /* Since binutils 2.21, GNU ld supports new *_sol2 emulations to strictly - follow the Solaris 2 ABI. Prefer them if present. */ ---- gcc/config/sparc/sol2.h -+++ gcc/config/sparc/sol2.h -@@ -60,6 +60,9 @@ - %{!mcpu*:%(asm_cpu_default)} \ - " - -+/* We do not need to search a special directory for startup files. */ -+#undef MD_STARTFILE_PREFIX -+ - #undef SUBTARGET_EXTRA_SPECS - #define SUBTARGET_EXTRA_SPECS \ - { "startfile_arch", STARTFILE_ARCH_SPEC }, \ diff --git a/sys-devel/gcc/files/4.7.1/solaris-searchpath.patch b/sys-devel/gcc/files/4.7.1/solaris-searchpath.patch deleted file mode 100644 index 7e4bbd6ebf..0000000000 --- a/sys-devel/gcc/files/4.7.1/solaris-searchpath.patch +++ /dev/null @@ -1,38 +0,0 @@ -* don't inject /usr/lib{/64,} and /lib{/64,} before any other thing in - the call to the linker, that breaks the entire idea of Prefix - ---- gcc/config/sol2.h -+++ gcc/config/sol2.h -@@ -115,10 +115,8 @@ - - #ifndef CROSS_DIRECTORY_STRUCTURE - #undef MD_EXEC_PREFIX --#define MD_EXEC_PREFIX "/usr/ccs/bin/" - - #undef MD_STARTFILE_PREFIX --#define MD_STARTFILE_PREFIX "/usr/ccs/lib/" - #endif - - #undef STARTFILE_ARCH32_SPEC -@@ -149,8 +147,7 @@ - "%{G:-G} \ - %{YP,*} \ - %{R*} \ -- %{!YP,*:%{p|pg:-Y P,%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/lib:%R/usr/lib} \ -- %{!p:%{!pg:-Y P,%R/usr/ccs/lib:%R/lib:%R/usr/lib}}}" -+ %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp}}" - - #undef LINK_ARCH32_SPEC - #define LINK_ARCH32_SPEC LINK_ARCH32_SPEC_BASE ---- gcc/config/sol2-bi.h.orig 2012-07-30 18:54:25.888541283 +0200 -+++ gcc/config/sol2-bi.h 2012-07-30 18:55:25.186888194 +0200 -@@ -74,8 +74,7 @@ - "%{G:-G} \ - %{YP,*} \ - %{R*} \ -- %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp/" ARCH64_SUBDIR ":%R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR "} \ -- %{!p:%{!pg:-Y P,%R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR "}}}" -+ %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp/" ARCH64_SUBDIR "}}" - - #undef LINK_ARCH64_SPEC - #ifndef USE_GLD diff --git a/sys-devel/gcc/files/4.7.2/solaris-x64-tls-gnu-as.patch b/sys-devel/gcc/files/4.7.2/solaris-x64-tls-gnu-as.patch deleted file mode 100644 index 03b63f6425..0000000000 --- a/sys-devel/gcc/files/4.7.2/solaris-x64-tls-gnu-as.patch +++ /dev/null @@ -1,135 +0,0 @@ -diff -ur gcc-4.7.2-orig/gcc/configure gcc-4.7.2/gcc/configure ---- gcc-4.7.2-orig/gcc/configure 2014-04-11 21:54:51.000000000 +0200 -+++ gcc-4.7.2/gcc/configure 2014-04-11 22:01:49.000000000 +0200 -@@ -23323,16 +23323,12 @@ - tls_first_major=2 - tls_first_minor=17 - ;; -- i[34567]86-*-* | x86_64-*-solaris2.1[0-9]*) -+ i[34567]86-*-*) - case "$target" in - i[34567]86-*-solaris2.*) - on_solaris=yes - tga_func=___tls_get_addr - ;; -- x86_64-*-solaris2.1[0-9]*) -- on_solaris=yes -- tga_func=__tls_get_addr -- ;; - *) - on_solaris=no - ;; -@@ -23368,8 +23364,31 @@ - leal foo@ntpoff(%ecx), %eax" - ;; - x86_64-*-*) -- conftest_s=' -- .section ".tdata","awT",@progbits -+ case "$target" in -+ x86_64-*-solaris2.1[0-9]*) -+ on_solaris=yes -+ tga_func=__tls_get_addr -+ ;; -+ *) -+ on_solaris=no -+ ;; -+ esac -+ if test x$on_solaris = xyes && test x$gas_flag = xno; then -+ conftest_s=' -+ .section .tdata,"awt",@progbits' -+ tls_first_major=0 -+ tls_first_minor=0 -+ -+$as_echo "#define TLS_SECTION_ASM_FLAG 't'" >>confdefs.h -+ -+ else -+ conftest_s=' -+ .section ".tdata","awT",@progbits' -+ tls_first_major=2 -+ tls_first_minor=14 -+ tls_as_opt="--fatal-warnings" -+ fi -+ conftest_s="$conftest_s - foo: .long 25 - .text - movq %fs:0, %rax -@@ -23377,10 +23396,7 @@ - leaq foo@TLSLD(%rip), %rdi - leaq foo@DTPOFF(%rax), %rdx - movq foo@GOTTPOFF(%rip), %rax -- movq $foo@TPOFF, %rax' -- tls_first_major=2 -- tls_first_minor=14 -- tls_as_opt=--fatal-warnings -+ movq \$foo@TPOFF, %rax" - ;; - ia64-*-*) - conftest_s=' -diff -ur gcc-4.7.2-orig/gcc/configure.ac gcc-4.7.2/gcc/configure.ac ---- gcc-4.7.2-orig/gcc/configure.ac 2014-04-11 21:54:51.000000000 +0200 -+++ gcc-4.7.2/gcc/configure.ac 2014-04-11 21:56:27.000000000 +0200 -@@ -2871,16 +2871,12 @@ - tls_first_major=2 - tls_first_minor=17 - ;; -- i[34567]86-*-* | x86_64-*-solaris2.1[0-9]*) -+ i[34567]86-*-*) - case "$target" in - i[34567]86-*-solaris2.*) - on_solaris=yes - tga_func=___tls_get_addr - ;; -- x86_64-*-solaris2.1[0-9]*) -- on_solaris=yes -- tga_func=__tls_get_addr -- ;; - *) - on_solaris=no - ;; -@@ -2917,8 +2913,32 @@ - leal foo@ntpoff(%ecx), %eax" - ;; - x86_64-*-*) -- conftest_s=' -- .section ".tdata","awT",@progbits -+ case "$target" in -+ x86_64-*-solaris2.1[0-9]*) -+ on_solaris=yes -+ tga_func=__tls_get_addr -+ ;; -+ *) -+ on_solaris=no -+ ;; -+ esac -+ if test x$on_solaris = xyes && test x$gas_flag = xno; then -+ conftest_s=' -+ .section .tdata,"awt",@progbits' -+ tls_first_major=0 -+ tls_first_minor=0 -+changequote([,])dnl -+ AC_DEFINE(TLS_SECTION_ASM_FLAG, 't', -+[Define to the flag used to mark TLS sections if the default (`T') doesn't work.]) -+changequote(,)dnl -+ else -+ conftest_s=' -+ .section ".tdata","awT",@progbits' -+ tls_first_major=2 -+ tls_first_minor=14 -+ tls_as_opt="--fatal-warnings" -+ fi -+ conftest_s="$conftest_s - foo: .long 25 - .text - movq %fs:0, %rax -@@ -2926,10 +2946,7 @@ - leaq foo@TLSLD(%rip), %rdi - leaq foo@DTPOFF(%rax), %rdx - movq foo@GOTTPOFF(%rip), %rax -- movq $foo@TPOFF, %rax' -- tls_first_major=2 -- tls_first_minor=14 -- tls_as_opt=--fatal-warnings -+ movq \$foo@TPOFF, %rax" - ;; - ia64-*-*) - conftest_s=' diff --git a/sys-devel/gcc/files/gcc-12.1.0-avoid-null-terminated-name-collision-with-macos-13-sdk.patch b/sys-devel/gcc/files/gcc-12.1.0-avoid-null-terminated-name-collision-with-macos-13-sdk.patch new file mode 100644 index 0000000000..1abfae345c --- /dev/null +++ b/sys-devel/gcc/files/gcc-12.1.0-avoid-null-terminated-name-collision-with-macos-13-sdk.patch @@ -0,0 +1,85 @@ +https://bugs.gentoo.org/886491 +https://bugs.gentoo.org/895332 +https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d1201dbf55a11d391030914985ba6b443e59baa5 + +From d1201dbf55a11d391030914985ba6b443e59baa5 Mon Sep 17 00:00:00 2001 +From: Mark Mentovai <mark@mentovai.com> +Date: Mon, 13 Jun 2022 16:40:19 +0100 +Subject: [PATCH] libstdc++: Rename __null_terminated to avoid collision with + Apple SDK + +The macOS 13 SDK (and equivalent-version iOS and other Apple OS SDKs) +contain this definition in <sys/cdefs.h>: + +863 #define __null_terminated + +This collides with the use of __null_terminated in libstdc++'s +experimental fs_path.h. + +As libstdc++'s use of this token is entirely internal to fs_path.h, the +simplest workaround, renaming it, is most appropriate. Here, it's +renamed to __nul_terminated, referencing the NUL ('\0') value that is +used to terminate the strings in the context in which this tag structure +is used. + +libstdc++-v3/ChangeLog: + + * include/experimental/bits/fs_path.h (__detail::__null_terminated): + Rename to __nul_terminated to avoid colliding with a macro in + Apple's SDK. + +Signed-off-by: Mark Mentovai <mark@mentovai.com> +(cherry picked from commit 254e88b3d7e8abcc236be3451609834371cf4d5d) +--- + libstdc++-v3/include/experimental/bits/fs_path.h | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/libstdc++-v3/include/experimental/bits/fs_path.h b/libstdc++-v3/include/experimental/bits/fs_path.h +index b0825ba76e80..19d246100cb5 100644 +--- a/libstdc++-v3/include/experimental/bits/fs_path.h ++++ b/libstdc++-v3/include/experimental/bits/fs_path.h +@@ -140,10 +140,10 @@ namespace __detail + inline _Source + _S_range_begin(_Source __begin) { return __begin; } + +- struct __null_terminated { }; ++ struct __nul_terminated { }; + + template<typename _Source> +- inline __null_terminated ++ inline __nul_terminated + _S_range_end(_Source) { return {}; } + + template<typename _CharT, typename _Traits, typename _Alloc> +@@ -459,11 +459,11 @@ namespace __detail + struct _Cvt; + + static string_type +- _S_convert(value_type* __src, __detail::__null_terminated) ++ _S_convert(value_type* __src, __detail::__nul_terminated) + { return string_type(__src); } + + static string_type +- _S_convert(const value_type* __src, __detail::__null_terminated) ++ _S_convert(const value_type* __src, __detail::__nul_terminated) + { return string_type(__src); } + + template<typename _Iter> +@@ -477,7 +477,7 @@ namespace __detail + + template<typename _InputIterator> + static string_type +- _S_convert(_InputIterator __src, __detail::__null_terminated) ++ _S_convert(_InputIterator __src, __detail::__nul_terminated) + { + auto __s = _S_string_from_iter(__src); + return _S_convert(__s.c_str(), __s.c_str() + __s.size()); +@@ -504,7 +504,7 @@ namespace __detail + + template<typename _InputIterator> + static string_type +- _S_convert_loc(_InputIterator __src, __detail::__null_terminated, ++ _S_convert_loc(_InputIterator __src, __detail::__nul_terminated, + const std::locale& __loc) + { + const std::string __s = _S_string_from_iter(__src); diff --git a/sys-devel/gcc/files/gcc-12.1.0-recognize-mmacosx-version-min-13.0-and-newer.patch b/sys-devel/gcc/files/gcc-12.1.0-recognize-mmacosx-version-min-13.0-and-newer.patch new file mode 100644 index 0000000000..f5c32d886c --- /dev/null +++ b/sys-devel/gcc/files/gcc-12.1.0-recognize-mmacosx-version-min-13.0-and-newer.patch @@ -0,0 +1,54 @@ +https://bugs.gentoo.org/886491 +https://bugs.gentoo.org/895332 +https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=6725f186cb70d48338f69456864bf469a12ee5be + +From 6725f186cb70d48338f69456864bf469a12ee5be Mon Sep 17 00:00:00 2001 +From: Mark Mentovai <mark@mentovai.com> +Date: Fri, 10 Jun 2022 15:56:42 +0100 +Subject: [PATCH] Darwin: Future-proof -mmacosx-version-min + +f18cbc1ee1f4 (2021-12-18) updated various parts of gcc to not impose a +Darwin or macOS version maximum of the current known release. Different +parts of gcc accept, variously, Darwin version numbers matching +darwin2*, and macOS major version numbers up to 99. The current released +version is Darwin 21 and macOS 12, with Darwin 22 and macOS 13 expected +for public release later this year. With one major OS release per year, +this strategy is expected to provide another 8 years of headroom. + +However, f18cbc1ee1f4 missed config/darwin-c.c (now .cc), which +continued to impose a maximum of macOS 12 on the -mmacosx-version-min +compiler driver argument. This was last updated from 11 to 12 in +11b967577483 (2021-10-27), but kicking the can down the road one year at +a time is not a viable strategy, and is not in line with the more recent +technique from f18cbc1ee1f4. + +Prior to 556ab5125912 (2020-11-06), config/darwin-c.c did not impose a +maximum that needed annual maintenance, as at that point, all macOS +releases had used a major version of 10. The stricter approach imposed +since then was valuable for a time until the particulars of the new +versioning scheme were established and understood, but now that they +are, it's prudent to restore a more permissive approach. + +gcc/ChangeLog: + + * config/darwin-c.cc: Make -mmacosx-version-min more future-proof. + +Signed-off-by: Mark Mentovai <mark@mentovai.com> +--- + gcc/config/darwin-c.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/gcc/config/darwin-c.cc b/gcc/config/darwin-c.cc +index 9203c84d2c26c..1f82b36d2de10 100644 +--- a/gcc/config/darwin-c.cc ++++ b/gcc/config/darwin-c.cc +@@ -691,7 +691,8 @@ macosx_version_as_macro (void) + if (!version_array) + goto fail; + +- if (version_array[MAJOR] < 10 || version_array[MAJOR] > 12) ++ /* System tools accept up to 99 as a major version. */ ++ if (version_array[MAJOR] < 10 || version_array[MAJOR] > 99) + goto fail; + + if (version_array[MAJOR] == 10 && version_array[MINOR] < 10) diff --git a/sys-devel/gcc/files/gcc-12.2.0-disable-stdlib-option-on-darwin.patch b/sys-devel/gcc/files/gcc-12.2.0-disable-stdlib-option-on-darwin.patch new file mode 100644 index 0000000000..785c5b4bf9 --- /dev/null +++ b/sys-devel/gcc/files/gcc-12.2.0-disable-stdlib-option-on-darwin.patch @@ -0,0 +1,151 @@ +https://bugs.gentoo.org/905152 +https://github.com/iains/gcc-12-branch/issues/21 + +Historically, Darwin included two C++ libraries, an outdated +GCC and its libstdc++, and a new libc++ (from clang). The old +library was the default. Thus, when building a modern C++ +program using clang, the flag "stdlib=libc++" must be supplied +to clang. On the other hand, when an updated GCC is used, it +links to an updated GCC libstdc++ by default, no flag is needed. +In fact, since "stdlib=libc++" cannot be recognized by GCC, +it should not be used. + +As a result, many build scripts and build systems on macOS check +if the flag "stdlib=libc++" is supported. If it's the case, the +flag is used. If it's not, no flag is added. Practically, it +creates the de-facto behavior of: If the program is built with +clang, it's linked to clang's libc++. If the program is built +with GCC, it's linked to GCC's native libstdc++. So far so good. +This is also the most reasonable behavior, as expected by most +users. + +As time passes, it was realized that using GCC and clang on the +same system may create tricky conflicts, it's useful to be able +to link against clang's libc++ even if GCC is used (this is useful +beyond Darwin, e.g. for FreeBSD). Therefore, GCC now supports +"stdlib=libc++ as well. + +The first immediate (but trivial) problem is a path problem. +GCC's Darwin fork (maintained by Ian) enables stdlib= support +by default (unlike upstream GCC that only conditionally enables +it when an include path "gcc_gxx_libcxx_include_dir" is passed +to GCC during build time). However, the default include path +is invalid. Building a program with "stdlib=libc++" would fail +since GCC cannot find basic C++ headers, like <vector> or +<algorithm>. For example: + + main.cpp:1:10: fatal error: algorithm: No such file or directory + 1 | #include <algorithm> + | ^~~~~~~~ + compilation terminated. + +In principle, setting the correct clang libc++ path on macOS would +fix this problem, but it's far from our only trouble here. + +Unfortunately, this consequences of this change can be far-reaching +and unexpected. In the past, if a program is compiled on clang, it's +always linked to libc++, if a program is compiled with gcc, it's +always linked to GCC's native libstdc++. But now this assumption has +been broken when GCC starts supporting "stdlib=libc++". It means that +now programs compiled by GCC will sometimes be linked to libc++, and +sometimes be linked to libstdc++, depending on two factors: + +1. If a program's build system does not make any attempt to +detect the existence of "stdlib=libc++" when it's built with +GCC, it will be linked to GCC's native libstdc++. This situation +happens if the program was not ported to macOS in the past, or +if the program is designed for macOS 10.9.x and newer systems +(in which libc++ became clang's default). + +2. If a program's build system attempts to detect the existence +of "stdlib=libc++", it's now linked to clang's libc++ when it's +built by GCC - when previously it would link to GCC's native +libstdc++. + +Thus, when GCC is used, some programs would be linked to libstdc++, +but others may suddenly be linked to clang's libc++. depending on +the build system of the program. This would create surprising +and somewhat unpredictable situations. + +The solution requires careful thought. There are four possibilities: + +1. Disable stdlib= support, so the existing behavior is maintained +(more importantly, maintained without the need to patch the build +system of countless programs). The disadvantage is that end-users +would lose the ability to use stdlib=libc++ to build their own +programs when they found it's necessary. + +2. Enable stdlib= support. This allows users to enjoy the +interoperability benefits of "stdlib=libc++" should it be necessary. +But now some programs would suddenly be linked to clang's libc++ +when GCC is used, while others would still use GCC. This is +unexpected and would be surprising to end-users. And Since Gentoo +Prefix currently assumes a consistent GCC environment, it may +potentially create compatibility problems as well. To maintain the +historical behavior (programs built by GCC always links to GCC's +libstdc++), we need to patch the "stdlib=libc++" out of the build +system of countless programs... On the other hand, perhaps it's still +doable, since many programs are moving away from "stdlib=libc++" as +modern macOS defaults to libc++. + +3. Enable stdlib= support, and pass stdlib=libstdc++ in the global +CXXFLAGS of Portage. + +4. Enable stdlib= support, and pass stdlib=libc++ in the global +CXXFLAGS of Portage. + +The last two options sound more reasonable, perhaps in the future, +it can be Portage's responsibility to decide which libc++ is used, +just like how it currently can decide when to use GCC or clang. +Since in GCC, new compiler flags can override previous flag, we can +force a "stdlib=" choice to allow well-defined, predictable selection +of C++ libraries. Option 2 or 1 is also imaginable, depending on +the circumstances. But we clearly need further considerations. + +For now, we choose the simplest solution, disable support for "stdlib=" +to maintain the existing behavior, at least as a stop-gap solution. +This may change in the future. + +diff -upr gcc-12-branch-gcc-12.2-darwin-r0/gcc/configure gcc-12-branch-gcc-12.2-darwin-r0.patched/gcc/configure +--- gcc-12-branch-gcc-12.2-darwin-r0/gcc/configure 2023-04-27 17:31:51.356395000 +0000 ++++ gcc-12-branch-gcc-12.2-darwin-r0.patched/gcc/configure 2023-04-27 18:40:22.670655408 +0000 +@@ -3781,17 +3781,9 @@ if test x${gcc_gxx_libcxx_include_dir} ! + $as_echo "#define ENABLE_STDLIB_OPTION 1" >>confdefs.h + + else +- case $target in +- *-darwin1[1-9]* | *-darwin2*) +- # Default this on for Darwin versions which default to libcxx. +- $as_echo "#define ENABLE_STDLIB_OPTION 1" >>confdefs.h + +- ;; +- *) +- $as_echo "#define ENABLE_STDLIB_OPTION 0" >>confdefs.h +- +- ;; +- esac ++$as_echo "#define ENABLE_STDLIB_OPTION 0" >>confdefs.h ++ + fi + + if test x${gcc_gxx_libcxx_include_dir} = x; then +diff -upr gcc-12-branch-gcc-12.2-darwin-r0/gcc/configure.ac gcc-12-branch-gcc-12.2-darwin-r0.patched/gcc/configure.ac +--- gcc-12-branch-gcc-12.2-darwin-r0/gcc/configure.ac 2023-04-27 17:31:47.337475138 +0000 ++++ gcc-12-branch-gcc-12.2-darwin-r0.patched/gcc/configure.ac 2023-04-27 18:38:50.537799195 +0000 +@@ -249,15 +249,7 @@ if test x${gcc_gxx_libcxx_include_dir} ! + AC_DEFINE(ENABLE_STDLIB_OPTION, 1, + [Define if the -stdlib= option should be enabled.]) + else +- case $target in +- *-darwin1[[1-9]]* | *-darwin2*) +- # Default this on for Darwin versions which default to libcxx. +- AC_DEFINE(ENABLE_STDLIB_OPTION, 1) +- ;; +- *) +- AC_DEFINE(ENABLE_STDLIB_OPTION, 0) +- ;; +- esac ++ AC_DEFINE(ENABLE_STDLIB_OPTION, 0) + fi + + if test x${gcc_gxx_libcxx_include_dir} = x; then diff --git a/sys-devel/gcc/files/gcc-13-darwin14-bootstrap.patch b/sys-devel/gcc/files/gcc-13-darwin14-bootstrap.patch new file mode 100644 index 0000000000..98a92c103e --- /dev/null +++ b/sys-devel/gcc/files/gcc-13-darwin14-bootstrap.patch @@ -0,0 +1,40 @@ +disable some code-sanity checks/hacks because while bootstapping we use +a compiler and its c++ library that does not necessarily comply + +This is an issue since macOS Sonoma 14.4 and/or CLT 15.3. + +--- a/include/safe-ctype.h ++++ b/include/safe-ctype.h +@@ -120,6 +120,7 @@ + So we include ctype.h here and then immediately redefine its macros. */ + + #include <ctype.h> ++#if 0 + #undef isalpha + #define isalpha(c) do_not_use_isalpha_with_safe_ctype + #undef isalnum +@@ -146,5 +147,6 @@ + #define toupper(c) do_not_use_toupper_with_safe_ctype + #undef tolower + #define tolower(c) do_not_use_tolower_with_safe_ctype ++#endif + + #endif /* SAFE_CTYPE_H */ +--- a/gcc/system.h ++++ b/gcc/system.h +@@ -917,6 +917,7 @@ + + #if (GCC_VERSION >= 3000) + ++#if 0 + /* Note autoconf checks for prototype declarations and includes + system.h while doing so. Only poison these tokens if actually + compiling gcc, so that the autoconf declaration tests for malloc +@@ -933,6 +934,7 @@ + #undef realloc + #pragma GCC poison malloc realloc + #endif ++#endif + + /* The %m format should be used when GCC's main diagnostic functions + supporting %m are available, and xstrerror from libiberty diff --git a/sys-devel/gcc/files/gcc-13-darwin14-fix-duplicate-libs.patch b/sys-devel/gcc/files/gcc-13-darwin14-fix-duplicate-libs.patch new file mode 100644 index 0000000000..06eee94341 --- /dev/null +++ b/sys-devel/gcc/files/gcc-13-darwin14-fix-duplicate-libs.patch @@ -0,0 +1,28 @@ +https://raw.githubusercontent.com/Homebrew/formula-patches/e923a0cd6c0e60bb388e8a5b8cd1dcf9c3bf7758/gcc/gcc-xcode15-warnings.diff +https://github.com/iains/gcc-13-branch/issues/11 + +diff --git a/gcc/config/aarch64/darwin.h b/gcc/config/aarch64/darwin.h +index 5609c569dc1..9fcbfa3d777 100644 +--- a/gcc/config/aarch64/darwin.h ++++ b/gcc/config/aarch64/darwin.h +@@ -65,10 +65,6 @@ along with GCC; see the file COPYING3. If not see + #define DARWIN_NOPIE_SPEC \ + " %<no-pie %<fno-pie %<fno-PIE " + +-/* Hack alert - we want the exported cas etc. */ +-#undef LIB_SPEC +-#define LIB_SPEC "%{!static:-lSystem} -lgcc" +- + /* Force the default endianness and ABI flags onto the command line + in order to make the other specs easier to write. Match clang in + silently ignoring mdynamic-no-pic */ +diff --git a/libgfortran/libgfortran.spec.in b/libgfortran/libgfortran.spec.in +index 367d485c230..058ee5775bf 100644 +--- a/libgfortran/libgfortran.spec.in ++++ b/libgfortran/libgfortran.spec.in +@@ -5,4 +5,4 @@ + # + + %rename lib liborig +-*lib: @LIBQUADSPEC@ @LIBM@ %(libgcc) %(liborig) ++*lib: @LIBQUADSPEC@ @LIBM@ %(liborig) diff --git a/sys-devel/gcc/files/gcc-13-darwin14-math_h.patch b/sys-devel/gcc/files/gcc-13-darwin14-math_h.patch new file mode 100644 index 0000000000..124dccf518 --- /dev/null +++ b/sys-devel/gcc/files/gcc-13-darwin14-math_h.patch @@ -0,0 +1,96 @@ +From 93f803d53b5ccaabded9d7b4512b54da81c1c616 Mon Sep 17 00:00:00 2001 +From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> +Date: Thu, 17 Aug 2023 10:16:57 +0200 +Subject: [PATCH] fixincludes: Update darwin_flt_eval_method for macOS 14 + +On macOS 14, a guard in <math.h> changed: + +@@ -43 +44 @@ +-#if __FLT_EVAL_METHOD__ == 0 ++#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == -1 +@@ -49 +50 @@ +-#elif __FLT_EVAL_METHOD__ == 2 || __FLT_EVAL_METHOD__ == -1 ++#elif __FLT_EVAL_METHOD__ == 2 + +Therefore the darwin_flt_eval_method fixincludes fix doesn't match any +longer, leading to a large number of testsuite failures like + +/private/var/gcc/regression/master/14-gcc/build/gcc/include-fixed/math.h:69:5: +error: #error "Unsupported value of __FLT_EVAL_METHOD__." + +where __FLT_EVAL_METHOD__ = 16. + +This patch adjusts the fix to allow for both forms. + +Tested with make check in fixincludes on x86_64-apple-darwin23.0.0 and +verifying that <math.h> has indeed been fixed as expected. + +2023-08-16 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + fixincludes: + * inclhack.def (darwin_flt_eval_method): Handle macOS 14 guard + variant. + * fixincl.x: Regenerate. + * tests/base/math.h [DARWIN_FLT_EVAL_METHOD_CHECK]: Update test. +--- + fixincludes/fixincl.x | 8 ++++---- + fixincludes/inclhack.def | 7 ++++--- + fixincludes/tests/base/math.h | 1 + + 3 files changed, 9 insertions(+), 7 deletions(-) + +diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x +index 416d2c2e3a4..e52f11d8460 100644 +--- a/fixincludes/fixincl.x ++++ b/fixincludes/fixincl.x +@@ -3674,7 +3674,7 @@ tSCC* apzDarwin_Flt_Eval_MethodMachs[] = { + * content selection pattern - do fix if pattern found + */ + tSCC zDarwin_Flt_Eval_MethodSelect0[] = +- "^#if __FLT_EVAL_METHOD__ == 0$"; ++ "^#if __FLT_EVAL_METHOD__ == 0( \\|\\| __FLT_EVAL_METHOD__ == -1)?$"; + + #define DARWIN_FLT_EVAL_METHOD_TEST_CT 1 + static tTestDesc aDarwin_Flt_Eval_MethodTests[] = { +@@ -3685,7 +3685,7 @@ static tTestDesc aDarwin_Flt_Eval_MethodTests[] = { + */ + static const char* apzDarwin_Flt_Eval_MethodPatch[] = { + "format", +- "#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 16", ++ "%0 || __FLT_EVAL_METHOD__ == 16", + (char*)NULL }; + + /* * * * * * * * * * * * * * * * * * * * * * * * * * +diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def +index 45e0cbc0c10..19e0ea2df66 100644 +--- a/fixincludes/inclhack.def ++++ b/fixincludes/inclhack.def +@@ -1819,10 +1819,11 @@ fix = { + hackname = darwin_flt_eval_method; + mach = "*-*-darwin*"; + files = math.h; +- select = "^#if __FLT_EVAL_METHOD__ == 0$"; ++ select = "^#if __FLT_EVAL_METHOD__ == 0( \\|\\| __FLT_EVAL_METHOD__ == -1)?$"; + c_fix = format; +- c_fix_arg = "#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 16"; +- test_text = "#if __FLT_EVAL_METHOD__ == 0"; ++ c_fix_arg = "%0 || __FLT_EVAL_METHOD__ == 16"; ++ test_text = "#if __FLT_EVAL_METHOD__ == 0\n" ++ "#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == -1"; + }; + + /* +diff --git a/fixincludes/tests/base/math.h b/fixincludes/tests/base/math.h +index 29b67579748..7b92f29a409 100644 +--- a/fixincludes/tests/base/math.h ++++ b/fixincludes/tests/base/math.h +@@ -32,6 +32,7 @@ + + #if defined( DARWIN_FLT_EVAL_METHOD_CHECK ) + #if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 16 ++#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == -1 || __FLT_EVAL_METHOD__ == 16 + #endif /* DARWIN_FLT_EVAL_METHOD_CHECK */ + + +-- +2.39.3 + diff --git a/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch b/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch new file mode 100644 index 0000000000..e4abe01a08 --- /dev/null +++ b/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch @@ -0,0 +1,19 @@ +Revert of https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=59e4c98173a79fcaa2c33253261409f38856c384 +for now to fix cross fixincludes builds. + +https://bugs.gentoo.org/905118 +--- a/gcc/Makefile.in ++++ b/gcc/Makefile.in +@@ -532,11 +532,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h + # Default native SYSTEM_HEADER_DIR, to be overridden by targets. + NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@ + # Default cross SYSTEM_HEADER_DIR, to be overridden by targets. +-ifeq (@includedir@,$(prefix)/include) +- CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ +-else +- CROSS_SYSTEM_HEADER_DIR = @includedir@ +-endif ++CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ + + # autoconf sets SYSTEM_HEADER_DIR to one of the above. + # Purge it of unnecessary internal relative paths diff --git a/sys-devel/gcc/gcc-10.2.0-r5.ebuild b/sys-devel/gcc/gcc-10.2.0-r5.ebuild deleted file mode 100644 index 9baac7c2d6..0000000000 --- a/sys-devel/gcc/gcc-10.2.0-r5.ebuild +++ /dev/null @@ -1,111 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI="7" - -PATCH_VER="6" - -inherit toolchain - -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" - -RDEPEND="" -BDEPEND=" - kernel_linux? ( ${CATEGORY}/binutils ) - kernel_Darwin? ( - || ( ${CATEGORY}/binutils-apple ${CATEGORY}/native-cctools ) - )" - -src_prepare() { - has_version '>=sys-libs/glibc-2.32-r1' && rm -v "${WORKDIR}/patch/23_all_disable-riscv32-ABIs.patch" - toolchain_src_prepare - - if use elibc_Cygwin; then - sed -e '/0001-share-mingw-fset-stack-executable-with-cygwin.patch/d' \ - -i "${WORKDIR}/gcc-${CYGWINPORTS_GITREV}/gcc.cygport" || die - fi - - # make sure 64-bits native targets don't screw up the linker paths - eapply -p0 "${FILESDIR}"/no-libs-for-startfile.patch - if use prefix; then - eapply -p0 "${FILESDIR}"/4.5.2/prefix-search-dirs.patch - # try /usr/lib32 in 32bit profile on x86_64-linux (needs - # --enable-multilib), but this does make sense in prefix only - eapply -p0 "${FILESDIR}"/${PN}-4.8.3-linux-x86-on-amd64.patch - fi - - # make it have correct install_names on Darwin - eapply -p1 "${FILESDIR}"/4.3.3/darwin-libgcc_s-installname.patch - - if [[ ${CHOST} == powerpc*-darwin* ]] ; then - # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44107 - sed -i -e 's|^ifeq (/usr/lib,|ifneq (/usr/lib,|' \ - libgcc/config/t-slibgcc-darwin || die - fi - - # up macosx-version-min from 10.4 to 10.6 on Catalina, bug #767415 - if [[ ${CHOST} == *-darwin19 ]] ; then - sed -i -e 's/=10.4/=10.6/' libgcc/config/t-darwin || die - fi - - # fix for Big Sur versioning, remove with 11 - eapply -p1 "${FILESDIR}"/${PN}-10.1.0-macos-bigsur.patch - find . -name "configure" | xargs \ - sed -i -e '/^\s*10\.\*)/N' \ - -e '/^\s*10\.\*)\s*_lt_dar_allow_undefined/s/10\.\*/10.*|11.*/' || die - - # fix interoperation with Xcode 12.5, bug #799170 - eapply -p1 "${FILESDIR}"/${PN}-10.2.0-xcode-12.5.patch -} - -src_configure() { - local myconf=() - case ${CTARGET}:" ${USE} " in - powerpc*-darwin*) - # bug #381179 - filter-flags "-mcpu=*" "-mtune=*" - # bug #657522 - # A bug in configure checks whether -no-pie works, but the - # compiler doesn't pass -no-pie onto the linker if -fno-PIE - # isn't passed, so the configure check always finds -no-pie - # is accepted. (Likewise, when -fno-PIE is passed, the - # compiler passes -no_pie onto the linker.) - # Since our linker doesn't grok this, avoid above checks to - # be run - # NOTE: later ld64 does grok -no_pie, not -no-pie (as checked) - export gcc_cv_c_no_fpie=no - export gcc_cv_no_pie=no - ;; - *-darwin20) - # use sysroot with the linker, #756160 - export gcc_cv_ld_sysroot=yes - ;; - *-solaris*) - # todo: some magic for native vs. GNU linking? - myconf+=( --with-gnu-ld --with-gnu-as --enable-largefile ) - # Solaris 11 defines this in its headers, but that causes a - # mismatch whilst compiling, bug #657514 - export ac_cv_func_aligned_alloc=no - export ac_cv_func_memalign=no - export ac_cv_func_posix_memalign=no - ;; - i[34567]86-*-linux*:*" prefix "*) - # to allow the linux-x86-on-amd64.patch become useful, we need - # to enable multilib, even if there is just one multilib option. - myconf+=( --enable-multilib ) - if [[ ${CBUILD:-${CHOST}} == "${CHOST}" ]]; then - # we might be on x86_64-linux, but don't do cross-compile, so - # tell the host-compiler to really create 32bits (for stage1) - # (real x86-linux-gcc also accept -m32). - append-flags -m32 - fi - ;; - esac - - # Since GCC 4.1.2 some non-posix (?) /bin/sh compatible code is used, at - # least on Solaris, and AIX /bin/sh is way too slow, - # so force it to use $BASH (that portage uses) - it can't be EPREFIX - # in case that doesn't exist yet - export CONFIG_SHELL="${CONFIG_SHELL:-${BASH}}" - toolchain_src_configure "${myconf[@]}" -} diff --git a/sys-devel/gcc/gcc-10.3.0-r2.ebuild b/sys-devel/gcc/gcc-10.3.0-r2.ebuild deleted file mode 100644 index 3b0eecc0a4..0000000000 --- a/sys-devel/gcc/gcc-10.3.0-r2.ebuild +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI="7" - -PATCH_VER="3" - -inherit toolchain - -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" - -RDEPEND="" -BDEPEND=" - kernel_linux? ( ${CATEGORY}/binutils ) - kernel_Darwin? ( - || ( ${CATEGORY}/binutils-apple ${CATEGORY}/native-cctools ) - )" - -src_prepare() { - has_version '>=sys-libs/glibc-2.32-r1' && rm -v "${WORKDIR}/patch/23_all_disable-riscv32-ABIs.patch" - toolchain_src_prepare - - if use elibc_Cygwin; then - sed -e '/0001-share-mingw-fset-stack-executable-with-cygwin.patch/d' \ - -i "${WORKDIR}/gcc-${CYGWINPORTS_GITREV}/gcc.cygport" || die - fi - - # make sure 64-bits native targets don't screw up the linker paths - eapply -p0 "${FILESDIR}"/no-libs-for-startfile.patch - if use prefix; then - eapply -p0 "${FILESDIR}"/4.5.2/prefix-search-dirs.patch - # try /usr/lib32 in 32bit profile on x86_64-linux (needs - # --enable-multilib), but this does make sense in prefix only - eapply -p0 "${FILESDIR}"/${PN}-4.8.3-linux-x86-on-amd64.patch - fi - - # make it have correct install_names on Darwin - eapply -p1 "${FILESDIR}"/4.3.3/darwin-libgcc_s-installname.patch - - if [[ ${CHOST} == *-darwin* ]] ; then - # Backport another bootstrapping fix when building with Clang - eapply -p1 "${FILESDIR}"/gcc-10.3.0-clang-bootstrap.patch - fi - - if [[ ${CHOST} == powerpc*-darwin* ]] ; then - # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44107 - sed -i -e 's|^ifeq (/usr/lib,|ifneq (/usr/lib,|' \ - libgcc/config/t-slibgcc-darwin || die - fi - - # up macosx-version-min from 10.4 to 10.6 on Catalina, bug #767415 - if [[ ${CHOST} == *-darwin19 ]] ; then - sed -i -e 's/=10.4/=10.6/' libgcc/config/t-darwin || die - fi - - find . -name "configure" | xargs \ - sed -i -e '/^\s*10\.\*)/N' \ - -e '/^\s*10\.\*)\s*_lt_dar_allow_undefined/s/10\.\*/10.*|11.*/' || die - - # fix interoperation with Xcode 12.5, bug #799170 - eapply -p1 "${FILESDIR}"/${PN}-10.2.0-xcode-12.5.patch - # allow building with macOS 12 - eapply -p1 "${FILESDIR}"/${PN}-10.3.0-monterey.patch -} - -src_configure() { - local myconf=() - case ${CTARGET}:" ${USE} " in - powerpc*-darwin*) - # bug #381179 - filter-flags "-mcpu=*" "-mtune=*" - # bug #657522 - # A bug in configure checks whether -no-pie works, but the - # compiler doesn't pass -no-pie onto the linker if -fno-PIE - # isn't passed, so the configure check always finds -no-pie - # is accepted. (Likewise, when -fno-PIE is passed, the - # compiler passes -no_pie onto the linker.) - # Since our linker doesn't grok this, avoid above checks to - # be run - # NOTE: later ld64 does grok -no_pie, not -no-pie (as checked) - export gcc_cv_c_no_fpie=no - export gcc_cv_no_pie=no - ;; - *-darwin20) - # use sysroot with the linker, #756160 - export gcc_cv_ld_sysroot=yes - ;; - *-solaris*) - # todo: some magic for native vs. GNU linking? - myconf+=( --with-gnu-ld --with-gnu-as --enable-largefile ) - # Solaris 11 defines this in its headers, but that causes a - # mismatch whilst compiling, bug #657514 - export ac_cv_func_aligned_alloc=no - export ac_cv_func_memalign=no - export ac_cv_func_posix_memalign=no - ;; - i[34567]86-*-linux*:*" prefix "*) - # to allow the linux-x86-on-amd64.patch become useful, we need - # to enable multilib, even if there is just one multilib option. - myconf+=( --enable-multilib ) - if [[ ${CBUILD:-${CHOST}} == "${CHOST}" ]]; then - # we might be on x86_64-linux, but don't do cross-compile, so - # tell the host-compiler to really create 32bits (for stage1) - # (real x86-linux-gcc also accept -m32). - append-flags -m32 - fi - ;; - esac - - # Since GCC 4.1.2 some non-posix (?) /bin/sh compatible code is used, at - # least on Solaris, and AIX /bin/sh is way too slow, - # so force it to use $BASH (that portage uses) - it can't be EPREFIX - # in case that doesn't exist yet - export CONFIG_SHELL="${CONFIG_SHELL:-${BASH}}" - toolchain_src_configure "${myconf[@]}" -} diff --git a/sys-devel/gcc/gcc-11.2.0.ebuild b/sys-devel/gcc/gcc-11.2.0.ebuild deleted file mode 100644 index 7a6f5581fe..0000000000 --- a/sys-devel/gcc/gcc-11.2.0.ebuild +++ /dev/null @@ -1,118 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI="7" - -PATCH_VER="1" - -inherit toolchain - -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" - -RDEPEND="" -BDEPEND=" - kernel_linux? ( ${CATEGORY}/binutils ) - kernel_Darwin? ( - || ( ${CATEGORY}/binutils-apple ${CATEGORY}/native-cctools ) - )" - -src_prepare() { - has_version '>=sys-libs/glibc-2.32-r1' && rm -v "${WORKDIR}/patch/23_all_disable-riscv32-ABIs.patch" - toolchain_src_prepare - - if use elibc_Cygwin; then - sed -e '/0001-share-mingw-fset-stack-executable-with-cygwin.patch/d' \ - -i "${WORKDIR}/gcc-${CYGWINPORTS_GITREV}/gcc.cygport" || die - fi - - # make sure 64-bits native targets don't screw up the linker paths - eapply -p0 "${FILESDIR}"/no-libs-for-startfile.patch - if use prefix; then - eapply -p0 "${FILESDIR}"/4.5.2/prefix-search-dirs.patch - # try /usr/lib32 in 32bit profile on x86_64-linux (needs - # --enable-multilib), but this does make sense in prefix only - eapply -p0 "${FILESDIR}"/${PN}-4.8.3-linux-x86-on-amd64.patch - fi - - # make it have correct install_names on Darwin - eapply -p1 "${FILESDIR}"/4.3.3/darwin-libgcc_s-installname.patch - - if [[ ${CHOST} == *-darwin* ]] ; then - # Backport another bootstrapping fix when building with Clang - eapply -p1 "${FILESDIR}"/gcc-10.3.0-clang-bootstrap.patch - fi - - if [[ ${CHOST} == powerpc*-darwin* ]] ; then - # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44107 - sed -i -e 's|^ifeq (/usr/lib,|ifneq (/usr/lib,|' \ - libgcc/config/t-slibgcc-darwin || die - fi - - # up macosx-version-min from 10.4 to 10.6 on Catalina, bug #767415 - if [[ ${CHOST} == *-darwin19 ]] ; then - sed -i -e 's/=10.4/=10.6/' libgcc/config/t-darwin || die - fi - - find . -name "configure" | xargs \ - sed -i -e '/^\s*10\.\*)/N' \ - -e '/^\s*10\.\*)\s*_lt_dar_allow_undefined/s/10\.\*/10.*|11.*/' || die - - # fix interoperation with Xcode 12.5, bug #799170 - eapply -p1 "${FILESDIR}"/${PN}-10.2.0-xcode-12.5.patch - # allow building with macOS 12 - eapply -p1 "${FILESDIR}"/${PN}-10.3.0-monterey.patch - # allow building on Solaris derivatives - eapply "${FILESDIR}"/${PN}-11-illumnos-o_directory.patch -} - -src_configure() { - local myconf=() - case ${CTARGET}:" ${USE} " in - powerpc*-darwin*) - # bug #381179 - filter-flags "-mcpu=*" "-mtune=*" - # bug #657522 - # A bug in configure checks whether -no-pie works, but the - # compiler doesn't pass -no-pie onto the linker if -fno-PIE - # isn't passed, so the configure check always finds -no-pie - # is accepted. (Likewise, when -fno-PIE is passed, the - # compiler passes -no_pie onto the linker.) - # Since our linker doesn't grok this, avoid above checks to - # be run - # NOTE: later ld64 does grok -no_pie, not -no-pie (as checked) - export gcc_cv_c_no_fpie=no - export gcc_cv_no_pie=no - ;; - *-darwin20) - # use sysroot with the linker, #756160 - export gcc_cv_ld_sysroot=yes - ;; - *-solaris*) - # todo: some magic for native vs. GNU linking? - myconf+=( --with-gnu-ld --with-gnu-as --enable-largefile ) - # Solaris 11 defines this in its headers, but that causes a - # mismatch whilst compiling, bug #657514 - export ac_cv_func_aligned_alloc=no - export ac_cv_func_memalign=no - export ac_cv_func_posix_memalign=no - ;; - i[34567]86-*-linux*:*" prefix "*) - # to allow the linux-x86-on-amd64.patch become useful, we need - # to enable multilib, even if there is just one multilib option. - myconf+=( --enable-multilib ) - if [[ ${CBUILD:-${CHOST}} == "${CHOST}" ]]; then - # we might be on x86_64-linux, but don't do cross-compile, so - # tell the host-compiler to really create 32bits (for stage1) - # (real x86-linux-gcc also accept -m32). - append-flags -m32 - fi - ;; - esac - - # Since GCC 4.1.2 some non-posix (?) /bin/sh compatible code is used, at - # least on Solaris, and AIX /bin/sh is way too slow, - # so force it to use $BASH (that portage uses) - it can't be EPREFIX - # in case that doesn't exist yet - export CONFIG_SHELL="${CONFIG_SHELL:-${BASH}}" - toolchain_src_configure "${myconf[@]}" -} diff --git a/sys-devel/gcc/gcc-12.1.0.ebuild b/sys-devel/gcc/gcc-12.1.0.ebuild index 590c202d8c..3d03a8fdbc 100644 --- a/sys-devel/gcc/gcc-12.1.0.ebuild +++ b/sys-devel/gcc/gcc-12.1.0.ebuild @@ -13,7 +13,7 @@ inherit toolchain # Don't keyword live ebuilds if ! tc_is_live && [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then - KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" + KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" fi # use alternate source for Apple M1 (also works for x86_64) @@ -41,10 +41,20 @@ src_unpack() { } src_prepare() { + if [[ ${CHOST} == *-darwin* ]] ; then + # https://bugs.gentoo.org/898610#c17 + # kill no_pie patch, it breaks things here + rm "${WORKDIR}"/patch/09_all_nopie-all-flags.patch || die + fi + toolchain_src_prepare eapply_user + # fix build for macOS 13 Ventura + eapply "${FILESDIR}"/gcc-12.1.0-recognize-mmacosx-version-min-13.0-and-newer.patch + eapply "${FILESDIR}"/gcc-12.1.0-avoid-null-terminated-name-collision-with-macos-13-sdk.patch + # make sure 64-bits native targets don't screw up the linker paths eapply "${FILESDIR}"/gcc-12-no-libs-for-startfile.patch if use prefix; then diff --git a/sys-devel/gcc/gcc-12.2.0.ebuild b/sys-devel/gcc/gcc-12.2.0-r2.ebuild index 59b639d041..d7932fa7ae 100644 --- a/sys-devel/gcc/gcc-12.2.0.ebuild +++ b/sys-devel/gcc/gcc-12.2.0-r2.ebuild @@ -14,8 +14,8 @@ inherit toolchain # Don't keyword live ebuilds if ! tc_is_live && [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then # fails to compile on Solaris and macOS, need to check why - : KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" - KEYWORDS="~x64-macos" + : KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" + KEYWORDS="~arm64-macos ~x64-macos ~x64-solaris" fi # use alternate source for Apple M1 (also works for x86_64) @@ -43,6 +43,12 @@ src_unpack() { } src_prepare() { + if [[ ${CHOST} == *-darwin* ]] ; then + # https://bugs.gentoo.org/898610#c17 + # kill no_pie patch, it breaks things here + rm "${WORKDIR}"/patch/09_all_nopie-all-flags.patch || die + fi + toolchain_src_prepare eapply_user @@ -70,6 +76,21 @@ src_prepare() { # posix_madvise however, is sed -i -e 's/madvise/posix_madvise/' gcc/cp/module.cc || die fi + + if [[ ${CHOST} == *-darwin* ]] ; then + # GCC' Darwin fork enables support for "-stdlib=libc++" + # unconditionally, and its default include path is invalid, + # causing package build failures due to missing header. + # But more importantly, it breaks the assumption of many build + # scripts and changes their CFLAGS and linking behaviors. The + # situation is tricky and needs careful considerations. + # For now, just disable support for "-stdlib=libc++". + eapply "${FILESDIR}"/gcc-12.2.0-disable-stdlib-option-on-darwin.patch + + # our ld64 is a slight bit different, so tweak expression to not + # get confused and break the build + sed -i -e 's/grep ld64/grep :ld64/' gcc/configure || die + fi } src_configure() { @@ -94,13 +115,6 @@ src_configure() { # use sysroot with the linker, #756160 export gcc_cv_ld_sysroot=yes ;; - arm64-*-darwin*) - # only supported from darwin21, so no conflict with above - # case switch - # for the time being use system flex, for our doesn't work - # here (while it does fine elsewhere), #778014 - export ac_cv_prog_FLEX=/usr/bin/flex - ;; *-solaris*) # todo: some magic for native vs. GNU linking? myconf+=( --with-gnu-ld --with-gnu-as --enable-largefile ) diff --git a/sys-devel/gcc/gcc-13.2.0-r1.ebuild b/sys-devel/gcc/gcc-13.2.0-r1.ebuild new file mode 100644 index 0000000000..f04c867110 --- /dev/null +++ b/sys-devel/gcc/gcc-13.2.0-r1.ebuild @@ -0,0 +1,149 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +TOOLCHAIN_PATCH_DEV="sam" +PATCH_GCC_VER="13.2.0" +PATCH_VER="7" +MUSL_VER="2" +MUSL_GCC_VER="13.2.0" + +inherit toolchain + +# Don't keyword live ebuilds +if ! tc_is_live && [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then + KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" +fi + +# use alternate source for Apple M1 (also works for x86_64) +SRC_URI+=" elibc_Darwin? ( https://raw.githubusercontent.com/Homebrew/formula-patches/3c5cbc8e9cf444a1967786af48e430588e1eb481/gcc/gcc-13.2.0.diff -> gcc-13.2.0-arm64-darwin.patch )" +IUSE+=" bootstrap" + +# Technically only if USE=hardened *too* right now, but no point in complicating it further. +# If GCC is enabling CET by default, we need glibc to be built with support for it. +# bug #830454 +RDEPEND="!prefix-guest? ( elibc_glibc? ( sys-libs/glibc[cet(-)?] ) )" +DEPEND="${RDEPEND}" +BDEPEND=" + amd64? ( >=${CATEGORY}/binutils-2.30[cet(-)?] ) + kernel_Darwin? ( + || ( ${CATEGORY}/binutils-apple ${CATEGORY}/native-cctools ) + )" + +src_prepare() { + # apply big arm64-darwin patch first thing + use elibc_Darwin && eapply "${DISTDIR}"/gcc-13.2.0-arm64-darwin.patch + + # make sure 64-bits native targets don't screw up the linker paths + eapply "${FILESDIR}"/gcc-12-no-libs-for-startfile.patch + + if [[ ${CHOST} == *-darwin* ]] ; then + # https://bugs.gentoo.org/898610#c17 + # kill no_pie patch, it breaks things here + rm "${WORKDIR}"/patch/09_all_nopie-all-flags.patch || die + # fails on Darwin's sources + rm "${WORKDIR}"/patch/81_all_match.p*.patch + fi + # doesn't apply on official and Darwin sources + rm "${WORKDIR}"/patch/31_all_gm2_make_P_var.patch + + toolchain_src_prepare + + # make it have correct install_names on Darwin + eapply -p1 "${FILESDIR}"/4.3.3/darwin-libgcc_s-installname.patch + + if [[ ${CHOST} == powerpc*-darwin* ]] ; then + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44107 + sed -i -e 's|^ifeq (/usr/lib,|ifneq (/usr/lib,|' \ + libgcc/config/t-slibgcc-darwin || die + fi + + if [[ ${CHOST} == *-solaris* ]] ; then + # madvise is not available in the compatibility mode GCC uses, + # posix_madvise however, is + sed -i -e 's/madvise/posix_madvise/' gcc/cp/module.cc || die + fi + + if [[ ${CHOST} == *-darwin* ]] ; then + use bootstrap && eapply "${FILESDIR}"/${PN}-13-darwin14-bootstrap.patch + eapply "${FILESDIR}"/${PN}-13-darwin14-fix-duplicate-libs.patch + eapply "${FILESDIR}"/${PN}-13-darwin14-math_h.patch + + # our ld64 is a slight bit different, so tweak expression to not + # get confused and break the build + sed -i -e 's/grep ld64/grep :ld64/' gcc/configure || die + + # rip out specific macos version min + sed -i -e 's/-mmacosx-version-min=11.0//' \ + libgcc/config/aarch64/t-darwin \ + libgcc/config/aarch64/t-heap-trampoline \ + || die + fi + + eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch + eapply_user +} + +src_configure() { + local myconf=() + case ${CTARGET}:" ${USE} " in + powerpc*-darwin*) + # bug #381179 + filter-flags "-mcpu=*" "-mtune=*" + # bug #657522 + # A bug in configure checks whether -no-pie works, but the + # compiler doesn't pass -no-pie onto the linker if -fno-PIE + # isn't passed, so the configure check always finds -no-pie + # is accepted. (Likewise, when -fno-PIE is passed, the + # compiler passes -no_pie onto the linker.) + # Since our linker doesn't grok this, avoid above checks to + # be run + # NOTE: later ld64 does grok -no_pie, not -no-pie (as checked) + export gcc_cv_c_no_fpie=no + export gcc_cv_no_pie=no + ;; + *-darwin20) + # use sysroot with the linker, #756160 + export gcc_cv_ld_sysroot=yes + ;; + *-solaris*) + # todo: some magic for native vs. GNU linking? + myconf+=( --with-gnu-ld --with-gnu-as --enable-largefile ) + # Solaris 11 defines this in its headers, but that causes a + # mismatch whilst compiling, bug #657514 + #export ac_cv_func_aligned_alloc=no + #export ac_cv_func_memalign=no + #export ac_cv_func_posix_memalign=no + ;; + i[34567]86-*-linux*:*" prefix "*) + # to allow the linux-x86-on-amd64.patch become useful, we need + # to enable multilib, even if there is just one multilib option. + myconf+=( --enable-multilib ) + if [[ ${CBUILD:-${CHOST}} == "${CHOST}" ]]; then + # we might be on x86_64-linux, but don't do cross-compile, so + # tell the host-compiler to really create 32bits (for stage1) + # (real x86-linux-gcc also accept -m32). + append-flags -m32 + fi + ;; + esac + + if [[ ${CHOST} == *-darwin ]] ; then + # GCC' Darwin fork enables support for "-stdlib=libc++" + # unconditionally, and its default include path is invalid, + # causing package build failures due to missing header. + # But more importantly, it breaks the assumption of many build + # scripts and changes their CFLAGS and linking behaviors. The + # situation is tricky and needs careful considerations. + # For now, just disable support for "-stdlib=libc++". + myconf+=( --with-gxx-libcxx-include-dir=no ) + fi + + # Since GCC 4.1.2 some non-posix (?) /bin/sh compatible code is used, at + # least on Solaris, and AIX /bin/sh is way too slow, + # so force it to use $BASH (that portage uses) - it can't be EPREFIX + # in case that doesn't exist yet + export CONFIG_SHELL="${CONFIG_SHELL:-${BASH}}" + toolchain_src_configure "${myconf[@]}" +} diff --git a/sys-devel/gcc/gcc-13.2.0.ebuild b/sys-devel/gcc/gcc-13.2.0.ebuild new file mode 100644 index 0000000000..41160a6ef9 --- /dev/null +++ b/sys-devel/gcc/gcc-13.2.0.ebuild @@ -0,0 +1,156 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +TOOLCHAIN_PATCH_DEV="sam" +PATCH_GCC_VER="13.2.0" +PATCH_VER="7" +MUSL_VER="2" +MUSL_GCC_VER="13.2.0" + +inherit toolchain + +# Don't keyword live ebuilds +if ! tc_is_live && [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then + KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" +fi + +# use alternate source for Apple M1 (also works for x86_64) +IANSGCCVER="gcc-13.2-darwin-r0" +SRC_URI+=" elibc_Darwin? ( +https://github.com/iains/gcc-13-branch/archive/refs/tags/${IANSGCCVER}.tar.gz )" + +IUSE+="bootstrap" + +# Technically only if USE=hardened *too* right now, but no point in complicating it further. +# If GCC is enabling CET by default, we need glibc to be built with support for it. +# bug #830454 +RDEPEND="!prefix-guest? ( elibc_glibc? ( sys-libs/glibc[cet(-)?] ) )" +DEPEND="${RDEPEND}" +BDEPEND=" + kernel_linux? ( >=${CATEGORY}/binutils-2.30[cet(-)?] ) + kernel_Darwin? ( + || ( ${CATEGORY}/binutils-apple ${CATEGORY}/native-cctools ) + )" + +src_unpack() { + if use elibc_Darwin ; then + # just use Ian's source, not the main one + S="${WORKDIR}/gcc-13-branch-${IANSGCCVER}" + fi + default +} + +src_prepare() { + # make sure 64-bits native targets don't screw up the linker paths + eapply "${FILESDIR}"/gcc-12-no-libs-for-startfile.patch + + if [[ ${CHOST} == *-darwin* ]] ; then + # https://bugs.gentoo.org/898610#c17 + # kill no_pie patch, it breaks things here + rm "${WORKDIR}"/patch/09_all_nopie-all-flags.patch || die + # fails on Darwin's sources + rm "${WORKDIR}"/patch/81_all_match.p*.patch + fi + # doesn't apply on official and Darwin sources + rm "${WORKDIR}"/patch/31_all_gm2_make_P_var.patch + + toolchain_src_prepare + + eapply_user + + eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch + + # make it have correct install_names on Darwin + eapply -p1 "${FILESDIR}"/4.3.3/darwin-libgcc_s-installname.patch + + if [[ ${CHOST} == powerpc*-darwin* ]] ; then + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44107 + sed -i -e 's|^ifeq (/usr/lib,|ifneq (/usr/lib,|' \ + libgcc/config/t-slibgcc-darwin || die + fi + + if [[ ${CHOST} == *-solaris* ]] ; then + # madvise is not available in the compatibility mode GCC uses, + # posix_madvise however, is + sed -i -e 's/madvise/posix_madvise/' gcc/cp/module.cc || die + fi + + if [[ ${CHOST} == *-darwin* ]] ; then + use bootstrap && eapply "${FILESDIR}"/${PN}-13-darwin14-bootstrap.patch + + # our ld64 is a slight bit different, so tweak expression to not + # get confused and break the build + sed -i -e 's/grep ld64/grep :ld64/' gcc/configure || die + + # rip out specific macos version min + sed -i -e 's/-mmacosx-version-min=11.0//' \ + libgcc/config/aarch64/t-darwin \ + libgcc/config/aarch64/t-heap-trampoline \ + || die + fi +} + +src_configure() { + local myconf=() + case ${CTARGET}:" ${USE} " in + powerpc*-darwin*) + # bug #381179 + filter-flags "-mcpu=*" "-mtune=*" + # bug #657522 + # A bug in configure checks whether -no-pie works, but the + # compiler doesn't pass -no-pie onto the linker if -fno-PIE + # isn't passed, so the configure check always finds -no-pie + # is accepted. (Likewise, when -fno-PIE is passed, the + # compiler passes -no_pie onto the linker.) + # Since our linker doesn't grok this, avoid above checks to + # be run + # NOTE: later ld64 does grok -no_pie, not -no-pie (as checked) + export gcc_cv_c_no_fpie=no + export gcc_cv_no_pie=no + ;; + *-darwin20) + # use sysroot with the linker, #756160 + export gcc_cv_ld_sysroot=yes + ;; + *-solaris*) + # todo: some magic for native vs. GNU linking? + myconf+=( --with-gnu-ld --with-gnu-as --enable-largefile ) + # Solaris 11 defines this in its headers, but that causes a + # mismatch whilst compiling, bug #657514 + #export ac_cv_func_aligned_alloc=no + #export ac_cv_func_memalign=no + #export ac_cv_func_posix_memalign=no + ;; + i[34567]86-*-linux*:*" prefix "*) + # to allow the linux-x86-on-amd64.patch become useful, we need + # to enable multilib, even if there is just one multilib option. + myconf+=( --enable-multilib ) + if [[ ${CBUILD:-${CHOST}} == "${CHOST}" ]]; then + # we might be on x86_64-linux, but don't do cross-compile, so + # tell the host-compiler to really create 32bits (for stage1) + # (real x86-linux-gcc also accept -m32). + append-flags -m32 + fi + ;; + esac + + if [[ ${CHOST} == *-darwin ]] ; then + # GCC' Darwin fork enables support for "-stdlib=libc++" + # unconditionally, and its default include path is invalid, + # causing package build failures due to missing header. + # But more importantly, it breaks the assumption of many build + # scripts and changes their CFLAGS and linking behaviors. The + # situation is tricky and needs careful considerations. + # For now, just disable support for "-stdlib=libc++". + myconf+=( --with-gxx-libcxx-include-dir=no ) + fi + + # Since GCC 4.1.2 some non-posix (?) /bin/sh compatible code is used, at + # least on Solaris, and AIX /bin/sh is way too slow, + # so force it to use $BASH (that portage uses) - it can't be EPREFIX + # in case that doesn't exist yet + export CONFIG_SHELL="${CONFIG_SHELL:-${BASH}}" + toolchain_src_configure "${myconf[@]}" +} diff --git a/sys-devel/gcc/gcc-14.0.1_pre20240225.ebuild b/sys-devel/gcc/gcc-14.0.1_pre20240225.ebuild new file mode 100644 index 0000000000..a1b9fee8c4 --- /dev/null +++ b/sys-devel/gcc/gcc-14.0.1_pre20240225.ebuild @@ -0,0 +1,150 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +TOOLCHAIN_PATCH_DEV="sam" +PATCH_GCC_VER="14.0.0" +PATCH_VER="24" +MUSL_VER="1" +MUSL_GCC_VER="14.0.0" + +inherit toolchain + +# Don't keyword live ebuilds +if ! tc_is_live && [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then + #KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" + # can't bootstrap from this using clang's libc++, better not use it + KEYWORDS="" +fi + +# use alternate source for Apple M1 (also works for x86_64) +IANSGCCVER="9bc66f9b11baf1c291b2afac429cb12bf8461f91" +SRC_URI+=" elibc_Darwin? ( https://github.com/iains/gcc-darwin-arm64/archive/${IANSGCCVER}.tar.gz -> gcc-darwin-arm64-${PV}.tar.gz )" + +# Technically only if USE=hardened *too* right now, but no point in complicating it further. +# If GCC is enabling CET by default, we need glibc to be built with support for it. +# bug #830454 +RDEPEND="!prefix-guest? ( elibc_glibc? ( sys-libs/glibc[cet(-)?] ) )" +DEPEND="${RDEPEND}" +BDEPEND=" + kernel_linux? ( >=${CATEGORY}/binutils-2.30[cet(-)?] ) + kernel_Darwin? ( + || ( ${CATEGORY}/binutils-apple ${CATEGORY}/native-cctools ) + )" + +src_unpack() { + if use elibc_Darwin ; then + # just use Ian's source, not the main one + S="${WORKDIR}/gcc-darwin-arm64-${IANSGCCVER}" + fi + default +} + +src_prepare() { + # make sure 64-bits native targets don't screw up the linker paths + eapply "${FILESDIR}"/gcc-12-no-libs-for-startfile.patch + + # doesn't apply on official and Darwin sources + rm "${WORKDIR}"/patch/31_all_gm2_make_P_var.patch + + toolchain_src_prepare + + eapply_user + + eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch + + # make it have correct install_names on Darwin + eapply -p1 "${FILESDIR}"/4.3.3/darwin-libgcc_s-installname.patch + + if [[ ${CHOST} == powerpc*-darwin* ]] ; then + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44107 + sed -i -e 's|^ifeq (/usr/lib,|ifneq (/usr/lib,|' \ + libgcc/config/t-slibgcc-darwin || die + fi + + if [[ ${CHOST} == *-solaris* ]] ; then + # madvise is not available in the compatibility mode GCC uses, + # posix_madvise however, is + sed -i -e 's/madvise/posix_madvise/' gcc/cp/module.cc || die + fi + + if [[ ${CHOST} == *-darwin* ]] ; then + # our ld64 is a slight bit different, so tweak expression to not + # get confused and break the build + sed -i -e 's/grep ld64/grep :ld64/' gcc/configure || die + + # rip out specific macos version min + sed -i -e 's/-mmacosx-version-min=11.0//' \ + libgcc/config/aarch64/t-darwin \ + libgcc/config/aarch64/t-heap-trampoline \ + || die + + # weird, because we call --disable-host-bind-now but the check + # interprets that as as using -Wl,-z,now + sed -i -e 's/-Wl,-z,now//' c++tools/configure{.ac,} || die + fi +} + +src_configure() { + local myconf=() + case ${CTARGET}:" ${USE} " in + powerpc*-darwin*) + # bug #381179 + filter-flags "-mcpu=*" "-mtune=*" + # bug #657522 + # A bug in configure checks whether -no-pie works, but the + # compiler doesn't pass -no-pie onto the linker if -fno-PIE + # isn't passed, so the configure check always finds -no-pie + # is accepted. (Likewise, when -fno-PIE is passed, the + # compiler passes -no_pie onto the linker.) + # Since our linker doesn't grok this, avoid above checks to + # be run + # NOTE: later ld64 does grok -no_pie, not -no-pie (as checked) + export gcc_cv_c_no_fpie=no + export gcc_cv_no_pie=no + ;; + *-darwin20) + # use sysroot with the linker, #756160 + export gcc_cv_ld_sysroot=yes + ;; + *-solaris*) + # todo: some magic for native vs. GNU linking? + myconf+=( --with-gnu-ld --with-gnu-as --enable-largefile ) + # Solaris 11 defines this in its headers, but that causes a + # mismatch whilst compiling, bug #657514 + #export ac_cv_func_aligned_alloc=no + #export ac_cv_func_memalign=no + #export ac_cv_func_posix_memalign=no + ;; + i[34567]86-*-linux*:*" prefix "*) + # to allow the linux-x86-on-amd64.patch become useful, we need + # to enable multilib, even if there is just one multilib option. + myconf+=( --enable-multilib ) + if [[ ${CBUILD:-${CHOST}} == "${CHOST}" ]]; then + # we might be on x86_64-linux, but don't do cross-compile, so + # tell the host-compiler to really create 32bits (for stage1) + # (real x86-linux-gcc also accept -m32). + append-flags -m32 + fi + ;; + esac + + if [[ ${CHOST} == *-darwin ]] ; then + # GCC' Darwin fork enables support for "-stdlib=libc++" + # unconditionally, and its default include path is invalid, + # causing package build failures due to missing header. + # But more importantly, it breaks the assumption of many build + # scripts and changes their CFLAGS and linking behaviors. The + # situation is tricky and needs careful considerations. + # For now, just disable support for "-stdlib=libc++". + myconf+=( --with-gxx-libcxx-include-dir=no ) + fi + + # Since GCC 4.1.2 some non-posix (?) /bin/sh compatible code is used, at + # least on Solaris, and AIX /bin/sh is way too slow, + # so force it to use $BASH (that portage uses) - it can't be EPREFIX + # in case that doesn't exist yet + export CONFIG_SHELL="${CONFIG_SHELL:-${BASH}}" + toolchain_src_configure "${myconf[@]}" +} diff --git a/sys-devel/gcc/gcc-8.3.0.ebuild b/sys-devel/gcc/gcc-8.3.0.ebuild deleted file mode 100644 index a721f4aef0..0000000000 --- a/sys-devel/gcc/gcc-8.3.0.ebuild +++ /dev/null @@ -1,97 +0,0 @@ -# Copyright 1999-2022 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI="7" - -PATCH_VER="1.0" -CYGWINPORTS_GITREV="0de6b2ae6b6577eb0891a7ca8d551bdfa79bf5e8" # gcc-8.3.0-1 - -inherit eutils toolchain flag-o-matic - -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" - -RDEPEND="" -DEPEND="${RDEPEND} - !prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.13 ) ) - kernel_linux? ( >=${CATEGORY}/binutils-2.20 ) - kernel_Darwin? ( ${CATEGORY}/binutils-apple )" - -if [[ ${CATEGORY} != cross-* ]] ; then - PDEPEND="${PDEPEND} !prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.13 ) )" -fi - -src_prepare() { - if use elibc_Cygwin; then - sed -e '/0001-share-mingw-fset-stack-executable-with-cygwin.patch/d' \ - -i "${WORKDIR}/gcc-${CYGWINPORTS_GITREV}/gcc.cygport" || die - fi - toolchain_src_prepare - - use vanilla && return 0 - - # make sure 64-bits native targets don't screw up the linker paths - epatch "${FILESDIR}"/no-libs-for-startfile.patch - if use prefix; then - epatch "${FILESDIR}"/4.5.2/prefix-search-dirs.patch - # try /usr/lib32 in 32bit profile on x86_64-linux (needs - # --enable-multilib), but this does make sense in prefix only - epatch "${FILESDIR}"/${PN}-4.8.3-linux-x86-on-amd64.patch - fi - - # make it have correct install_names on Darwin - epatch "${FILESDIR}"/4.3.3/darwin-libgcc_s-installname.patch - - if [[ ${CHOST} == powerpc*-darwin* ]] ; then - # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44107 - sed -i -e 's|^ifeq (/usr/lib,|ifneq (/usr/lib,|' \ - libgcc/config/t-slibgcc-darwin || die - fi -} - -src_configure() { - local myconf=() - case ${CTARGET}:" ${USE} " in - powerpc*-darwin*) - # bug #381179 - filter-flags "-mcpu=*" "-mtune=*" - # bug #657522 - # A bug in configure checks whether -no-pie works, but the - # compiler doesn't pass -no-pie onto the linker if -fno-PIE - # isn't passed, so the configure check always finds -no-pie - # is accepted. (Likewise, when -fno-PIE is passed, the - # compiler passes -no_pie onto the linker.) - # Since our linker doesn't grok this, avoid above checks to - # be run - # NOTE: later ld64 does grok -no_pie, not -no-pie (as checked) - export gcc_cv_c_no_fpie=no - export gcc_cv_no_pie=no - ;; - *-solaris*) - # todo: some magic for native vs. GNU linking? - myconf+=( --with-gnu-ld --with-gnu-as --enable-largefile ) - # Solaris 11 defines this in its headers, but that causes a - # mismatch whilst compiling, bug #657514 - export ac_cv_func_aligned_alloc=no - export ac_cv_func_memalign=no - export ac_cv_func_posix_memalign=no - ;; - i[34567]86-*-linux*:*" prefix "*) - # to allow the linux-x86-on-amd64.patch become useful, we need - # to enable multilib, even if there is just one multilib option. - myconf+=( --enable-multilib ) - if [[ ${CBUILD:-${CHOST}} == "${CHOST}" ]]; then - # we might be on x86_64-linux, but don't do cross-compile, so - # tell the host-compiler to really create 32bits (for stage1) - # (real x86-linux-gcc also accept -m32). - append-flags -m32 - fi - ;; - esac - - # Since GCC 4.1.2 some non-posix (?) /bin/sh compatible code is used, at - # least on Solaris, and AIX /bin/sh is way too slow, - # so force it to use $BASH (that portage uses) - it can't be EPREFIX - # in case that doesn't exist yet - export CONFIG_SHELL="${CONFIG_SHELL:-${BASH}}" - toolchain_src_configure "${myconf[@]}" -} diff --git a/sys-devel/gcc/gcc-9.2.0-r3.ebuild b/sys-devel/gcc/gcc-9.2.0-r3.ebuild deleted file mode 100644 index 11485cf4fe..0000000000 --- a/sys-devel/gcc/gcc-9.2.0-r3.ebuild +++ /dev/null @@ -1,98 +0,0 @@ -# Copyright 1999-2022 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI="7" - -PATCH_VER="4" - -inherit toolchain - -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" - -RDEPEND="" -DEPEND="${RDEPEND} - !prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.13 ) ) - kernel_linux? ( >=${CATEGORY}/binutils-2.20 ) - kernel_Darwin? ( ${CATEGORY}/binutils-apple )" - -if [[ ${CATEGORY} != cross-* ]] ; then - PDEPEND="${PDEPEND} !prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.13 ) )" -fi - -src_prepare() { - if use elibc_Cygwin; then - sed -e '/0001-share-mingw-fset-stack-executable-with-cygwin.patch/d' \ - -i "${WORKDIR}/gcc-${CYGWINPORTS_GITREV}/gcc.cygport" || die - fi - toolchain_src_prepare - - use vanilla && return 0 - - # make sure 64-bits native targets don't screw up the linker paths - eapply -p0 "${FILESDIR}"/no-libs-for-startfile.patch - if use prefix; then - eapply -p0 "${FILESDIR}"/4.5.2/prefix-search-dirs.patch - # try /usr/lib32 in 32bit profile on x86_64-linux (needs - # --enable-multilib), but this does make sense in prefix only - eapply -p0 "${FILESDIR}"/${PN}-4.8.3-linux-x86-on-amd64.patch - fi - - # make it have correct install_names on Darwin - eapply -p1 "${FILESDIR}"/4.3.3/darwin-libgcc_s-installname.patch - - if [[ ${CHOST} == powerpc*-darwin* ]] ; then - # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44107 - sed -i -e 's|^ifeq (/usr/lib,|ifneq (/usr/lib,|' \ - libgcc/config/t-slibgcc-darwin || die - fi - - eapply_user -} - -src_configure() { - local myconf=() - case ${CTARGET}:" ${USE} " in - powerpc*-darwin*) - # bug #381179 - filter-flags "-mcpu=*" "-mtune=*" - # bug #657522 - # A bug in configure checks whether -no-pie works, but the - # compiler doesn't pass -no-pie onto the linker if -fno-PIE - # isn't passed, so the configure check always finds -no-pie - # is accepted. (Likewise, when -fno-PIE is passed, the - # compiler passes -no_pie onto the linker.) - # Since our linker doesn't grok this, avoid above checks to - # be run - # NOTE: later ld64 does grok -no_pie, not -no-pie (as checked) - export gcc_cv_c_no_fpie=no - export gcc_cv_no_pie=no - ;; - *-solaris*) - # todo: some magic for native vs. GNU linking? - myconf+=( --with-gnu-ld --with-gnu-as --enable-largefile ) - # Solaris 11 defines this in its headers, but that causes a - # mismatch whilst compiling, bug #657514 - export ac_cv_func_aligned_alloc=no - export ac_cv_func_memalign=no - export ac_cv_func_posix_memalign=no - ;; - i[34567]86-*-linux*:*" prefix "*) - # to allow the linux-x86-on-amd64.patch become useful, we need - # to enable multilib, even if there is just one multilib option. - myconf+=( --enable-multilib ) - if [[ ${CBUILD:-${CHOST}} == "${CHOST}" ]]; then - # we might be on x86_64-linux, but don't do cross-compile, so - # tell the host-compiler to really create 32bits (for stage1) - # (real x86-linux-gcc also accept -m32). - append-flags -m32 - fi - ;; - esac - - # Since GCC 4.1.2 some non-posix (?) /bin/sh compatible code is used, at - # least on Solaris, and AIX /bin/sh is way too slow, - # so force it to use $BASH (that portage uses) - it can't be EPREFIX - # in case that doesn't exist yet - export CONFIG_SHELL="${CONFIG_SHELL:-${BASH}}" - toolchain_src_configure "${myconf[@]}" -} diff --git a/sys-libs/newlib/newlib-9999.ebuild b/sys-libs/newlib/newlib-9999.ebuild index f50b2de6ce..6c5e40f34d 100644 --- a/sys-libs/newlib/newlib-9999.ebuild +++ b/sys-libs/newlib/newlib-9999.ebuild @@ -11,7 +11,7 @@ if [[ ${PV} == "9999" ]] ; then else SRC_URI="ftp://sourceware.org/pub/newlib/${P}.tar.gz" if [[ ${PV} != *.201[5-9]???? ]] ; then - KEYWORDS="-* ~arm ~hppa ~m68k ~mips ~ppc ~ppc64 ~sparc ~x86 ~x64-cygwin" + KEYWORDS="-* ~arm ~hppa ~m68k ~mips ~ppc ~ppc64 ~sparc ~x86" fi fi |