diff options
author | Sam James <sam@gentoo.org> | 2023-12-16 07:40:31 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-12-16 07:44:23 +0000 |
commit | 24e0dd5fff14aee16dab340be37fd345b804c0c4 (patch) | |
tree | 2e5316970526d80df81c9548f958857a0fd9b0f5 | |
parent | media-video/yle-dl: add 20231214 (diff) | |
download | gentoo-24e0dd5fff14aee16dab340be37fd345b804c0c4.tar.gz gentoo-24e0dd5fff14aee16dab340be37fd345b804c0c4.tar.bz2 gentoo-24e0dd5fff14aee16dab340be37fd345b804c0c4.zip |
app-shells/zsh: fix modern C configure issue, fix relro plugin issue
* Fix configure issue with stricter C compilers which leads to build failure later
on in the build
* Fix plugin use w/ relro
Closes: https://bugs.gentoo.org/919001
Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r-- | app-shells/zsh/files/zsh-5.9-c99.patch | 45 | ||||
-rw-r--r-- | app-shells/zsh/files/zsh-5.9-relro.patch | 71 | ||||
-rw-r--r-- | app-shells/zsh/zsh-5.9-r5.ebuild | 245 |
3 files changed, 361 insertions, 0 deletions
diff --git a/app-shells/zsh/files/zsh-5.9-c99.patch b/app-shells/zsh/files/zsh-5.9-c99.patch new file mode 100644 index 000000000000..fad71a6a6c2b --- /dev/null +++ b/app-shells/zsh/files/zsh-5.9-c99.patch @@ -0,0 +1,45 @@ +https://github.com/zsh-users/zsh/commit/4c89849c98172c951a9def3690e8647dae76308f +https://bugs.gentoo.org/919001 + +Avoid incompatible pointer types in terminfo global variable checks. +Some compilers reject these incompatible pointer types, causing the +checks to always fail, when these variables are in fact available. + +Submitted upstream: <https://www.zsh.org/mla/workers/2023/msg01112.html> + +--- a/configure.ac ++++ b/configure.ac +@@ -1769,27 +1769,27 @@ if test x$zsh_cv_path_term_header != xnone; then + fi + + AC_MSG_CHECKING(if boolcodes is available) +- AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = boolcodes; puts(*test);]])],[AC_DEFINE(HAVE_BOOLCODES) boolcodes=yes],[boolcodes=no]) ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = (char **)boolcodes; puts(*test);]])],[AC_DEFINE(HAVE_BOOLCODES) boolcodes=yes],[boolcodes=no]) + AC_MSG_RESULT($boolcodes) + + AC_MSG_CHECKING(if numcodes is available) +- AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = numcodes; puts(*test);]])],[AC_DEFINE(HAVE_NUMCODES) numcodes=yes],[numcodes=no]) ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = (char **)numcodes; puts(*test);]])],[AC_DEFINE(HAVE_NUMCODES) numcodes=yes],[numcodes=no]) + AC_MSG_RESULT($numcodes) + + AC_MSG_CHECKING(if strcodes is available) +- AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = strcodes; puts(*test);]])],[AC_DEFINE(HAVE_STRCODES) strcodes=yes],[strcodes=no]) ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = (char **)strcodes; puts(*test);]])],[AC_DEFINE(HAVE_STRCODES) strcodes=yes],[strcodes=no]) + AC_MSG_RESULT($strcodes) + + AC_MSG_CHECKING(if boolnames is available) +- AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = boolnames; puts(*test);]])],[AC_DEFINE(HAVE_BOOLNAMES) boolnames=yes],[boolnames=no]) ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = (char **)boolnames; puts(*test);]])],[AC_DEFINE(HAVE_BOOLNAMES) boolnames=yes],[boolnames=no]) + AC_MSG_RESULT($boolnames) + + AC_MSG_CHECKING(if numnames is available) +- AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = numnames; puts(*test);]])],[AC_DEFINE(HAVE_NUMNAMES) numnames=yes],[numnames=no]) ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = (char **)numnames; puts(*test);]])],[AC_DEFINE(HAVE_NUMNAMES) numnames=yes],[numnames=no]) + AC_MSG_RESULT($numnames) + + AC_MSG_CHECKING(if strnames is available) +- AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = strnames; puts(*test);]])],[AC_DEFINE(HAVE_STRNAMES) strnames=yes],[strnames=no]) ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = (char **)strnames; puts(*test);]])],[AC_DEFINE(HAVE_STRNAMES) strnames=yes],[strnames=no]) + AC_MSG_RESULT($strnames) + + dnl There are apparently defective terminal library headers on some diff --git a/app-shells/zsh/files/zsh-5.9-relro.patch b/app-shells/zsh/files/zsh-5.9-relro.patch new file mode 100644 index 000000000000..7475c7cb85a6 --- /dev/null +++ b/app-shells/zsh/files/zsh-5.9-relro.patch @@ -0,0 +1,71 @@ +https://src.fedoraproject.org/rpms/zsh/blob/rawhide/f/0003-zsh-fix-module-loading-problem-with-full-RELRO.patch +https://github.com/zsh-users/zsh/commit/a84fdd7c8f77935ecce99ff2b0bdba738821ed79 + +From a84fdd7c8f77935ecce99ff2b0bdba738821ed79 Mon Sep 17 00:00:00 2001 +From: Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> +Date: Mon, 26 Jun 2023 17:13:04 +0900 +Subject: [PATCH] 51889: fix module loading problem with full RELRO + +If full RELRO (relocation read-only, one of the security enhancement +methods for ELF-based systems) is used when building zsh (as in binary +packages of most Linuxes), loading a module (e.g. zsh/zftp) fails unless +all the modules it depends on are already loaded. With this patch the +necessary modules are automatically loaded. + +Upstream-commit: a84fdd7c8f77935ecce99ff2b0bdba738821ed79 +Signed-off-by: Lukáš Zaoral <lzaoral@redhat.com> +--- + Src/Modules/zftp.c | 2 +- + Src/mkbltnmlst.sh | 24 ++++++++++++++++++++++++ + 2 files changed, 25 insertions(+), 1 deletion(-) + +diff --git a/Src/Modules/zftp.c b/Src/Modules/zftp.c +index 49b3ffa89..47a5e9de9 100644 +--- a/Src/Modules/zftp.c ++++ b/Src/Modules/zftp.c +@@ -3172,7 +3172,7 @@ static struct features module_features = { + int + setup_(UNUSED(Module m)) + { +- return (require_module("zsh/net/tcp", NULL, 0) == 1); ++ return 0; + } + + /**/ +diff --git a/Src/mkbltnmlst.sh b/Src/mkbltnmlst.sh +index c4611d8b3..067ecdaf9 100644 +--- a/Src/mkbltnmlst.sh ++++ b/Src/mkbltnmlst.sh +@@ -76,6 +76,30 @@ for x_mod in $x_mods; do + test "x$linked" = xno && echo "#endif" + done + ++# if dynamic module 'mod' with load=no has moddeps in its .mdd, ++# then output add_dep(mod, dep) for each 'dep' in moddeps. ++dyn_mods="`grep ' link=dynamic .* load=no ' $CFMOD | \ ++ sed -e '/^#/d' -e 's/ .*/ /' -e 's/^name=/ /'`" ++ ++for mod in $dyn_mods; do ++ modfile="`grep '^name='$mod' ' $CFMOD | \ ++ sed -e 's/^.* modfile=//' -e 's/ .*//'`" ++ if test "x$modfile" = x; then ++ echo >&2 "WARNING: no name for \`$mod' in $CFMOD (ignored)" ++ continue ++ fi ++ unset moddeps ++ . $srcdir/../$modfile ++ if test -n "$moddeps"; then ++ echo '#ifdef DYNAMIC' ++ echo "/* non-linked-in known module \`$mod' */" ++ for dep in $moddeps; do ++ echo " add_dep(\"$mod\", \"$dep\");" ++ done ++ echo '#endif' ++ fi ++done ++ + echo + done_mods=" " + for bin_mod in $bin_mods; do +-- +2.41.0 diff --git a/app-shells/zsh/zsh-5.9-r5.ebuild b/app-shells/zsh/zsh-5.9-r5.ebuild new file mode 100644 index 000000000000..d81b45f6a42d --- /dev/null +++ b/app-shells/zsh/zsh-5.9-r5.ebuild @@ -0,0 +1,245 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools flag-o-matic prefix + +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" + +SRC_URI="https://www.zsh.org/pub/${P}.tar.xz + https://www.zsh.org/pub/old/${P}.tar.xz + mirror://sourceforge/${PN}/${P}.tar.xz + doc? ( + https://www.zsh.org/pub/${P}-doc.tar.xz + mirror://sourceforge/${PN}/${P}-doc.tar.xz + )" + +DESCRIPTION="UNIX Shell similar to the Korn shell" +HOMEPAGE="https://www.zsh.org/" + +LICENSE="ZSH gdbm? ( GPL-2 )" +SLOT="0" +IUSE="caps debug doc examples gdbm maildir pcre static valgrind" + +# Next release should use pcre2: https://github.com/zsh-users/zsh/commit/b62e911341c8ec7446378b477c47da4256053dc0 +RDEPEND=" + >=sys-libs/ncurses-5.1:0= + static? ( >=sys-libs/ncurses-5.7-r4:0=[static-libs] ) + caps? ( sys-libs/libcap ) + pcre? ( + >=dev-libs/libpcre-3.9 + static? ( >=dev-libs/libpcre-3.9[static-libs] ) + ) + gdbm? ( + sys-libs/gdbm:= + static? ( sys-libs/gdbm:=[static-libs] ) + ) +" +DEPEND="sys-apps/groff + valgrind? ( dev-util/valgrind ) + ${RDEPEND}" +PDEPEND=" + examples? ( app-doc/zsh-lovers ) +" +if [[ ${PV} == *9999 ]] ; then + DEPEND+=" app-text/yodl + doc? ( + sys-apps/texinfo + app-text/texi2html + virtual/latex-base + )" +fi + +PATCHES=( + # Add openrc specific options for init.d completion + "${FILESDIR}"/${PN}-5.3-init.d-gentoo.diff + # Please refer gentoo bug #833981 + "${FILESDIR}"/${PN}-5.9-musl-V09datetime-test-fix.patch + # bug #869539 + "${FILESDIR}"/${PN}-5.9-clang-15-configure.patch + "${FILESDIR}"/${PN}-5.9-do-not-use-egrep-in-tests.patch + # bug #919001 + "${FILESDIR}"/${PN}-5.9-c99.patch + "${FILESDIR}"/${PN}-5.9-relro.patch +) + +src_prepare() { + if [[ ${PV} != *9999 ]]; then + # fix zshall problem with soelim + ln -s Doc man1 || die + mv Doc/zshall.1 Doc/zshall.1.soelim || die + soelim Doc/zshall.1.soelim > Doc/zshall.1 || die + fi + + default + + hprefixify configure.ac + if [[ ${PV} == *9999 ]] ; then + sed -i "/^VERSION=/s@=.*@=${PV}@" Config/version.mk || die + fi + eautoreconf +} + +src_configure() { + local myconf=( + --bindir="${EPREFIX}"/bin + --libdir="${EPREFIX}"/usr/$(get_libdir) + --enable-etcdir="${EPREFIX}"/etc/zsh + --enable-runhelpdir="${EPREFIX}"/usr/share/zsh/${PV%_*}/help + --enable-fndir="${EPREFIX}"/usr/share/zsh/${PV%_*}/functions + --enable-site-fndir="${EPREFIX}"/usr/share/zsh/site-functions + --enable-function-subdirs + --with-tcsetpgrp + --enable-multibyte + --with-term-lib='tinfow ncursesw' + $(use_enable maildir maildir-support) + $(use_enable pcre) + $(use_enable caps cap) + $(use_enable gdbm) + $(use_enable valgrind zsh-valgrind) + ) + + if use static ; then + myconf+=( --disable-dynamic ) + append-ldflags -static + fi + if use debug ; then + myconf+=( + --enable-zsh-debug + --enable-zsh-mem-debug + --enable-zsh-mem-warning + --enable-zsh-secure-free + --enable-zsh-hash-debug + ) + fi + + if [[ ${CHOST} == *-darwin* ]]; then + myconf+=( --enable-libs=-liconv ) + append-ldflags -Wl,-x + fi + + econf "${myconf[@]}" + + if use static ; then + # compile all modules statically, see Bug #27392 + # removed cap and curses because linking failes + sed -e "s,link=no,link=static,g" \ + -e "/^name=zsh\/cap/s,link=static,link=no," \ + -e "/^name=zsh\/curses/s,link=static,link=no," \ + -i "${S}"/config.modules || die + if ! use gdbm ; then + sed -i '/^name=zsh\/db\/gdbm/s,link=static,link=no,' \ + "${S}"/config.modules || die + fi + fi +} + +src_compile() { + default + + if [[ ${PV} == *9999 ]] && use doc ; then + emake -C Doc everything + fi +} + +src_test() { + # Fixes tests A03quoting.ztst B03print.ztst on musl + # Please refer: + # https://www.zsh.org/mla/workers/2021/msg00805.html + # Test E02xtrace fails on musl, so we are removing it. + # Closes: https://bugs.gentoo.org/833981 + if use elibc_musl ; then + unset LC_ALL + unset LC_COLLATE + unset LC_NUMERIC + unset LC_MESSAGES + unset LANG + rm "${S}"/Test/E02xtrace.ztst || die + fi + + # Breaks tests if inherited from environment. + unset TMPPREFIX + + addpredict /dev/ptmx + local i + for i in C02cond.ztst V08zpty.ztst X02zlevi.ztst Y01completion.ztst Y02compmatch.ztst Y03arguments.ztst ; do + rm "${S}"/Test/${i} || die + done + emake check +} + +src_install() { + emake DESTDIR="${D}" install $(usex doc "install.info" "") + + insinto /etc/zsh + export PREFIX_QUOTE_CHAR='"' PREFIX_EXTRA_REGEX="/EUID/s,0,${EUID}," + newins "$(prefixify_ro "${FILESDIR}"/zprofile-4)" zprofile + + keepdir /usr/share/zsh/site-functions + insinto /usr/share/zsh/${PV%_*}/functions/Prompts + newins "${FILESDIR}"/prompt_gentoo_setup-1 prompt_gentoo_setup + + local i + + # install miscellaneous scripts (bug #54520) + sed -e "s:/usr/local/bin/perl:${EPREFIX}/usr/bin/perl:g" \ + -e "s:/usr/local/bin/zsh:${EPREFIX}/bin/zsh:g" \ + -i {Util,Misc}/* || die + for i in Util Misc ; do + insinto /usr/share/zsh/${PV%_*}/${i} + doins ${i}/* + done + + # install header files (bug #538684) + insinto /usr/include/zsh + doins config.h Src/*.epro + for i in Src/{zsh.mdh,*.h} ; do + sed -e 's@\.\./config\.h@config.h@' \ + -e 's@#\(\s*\)include "\([^"]\+\)"@#\1include <zsh/\2>@' \ + -i "${i}" + doins "${i}" + done + + dodoc ChangeLog* META-FAQ NEWS README config.modules + + if use doc ; then + pushd "${WORKDIR}/${PN}-${PV%_*}" >/dev/null + dodoc Doc/zsh.{dvi,pdf} + docinto html + dodoc Doc/*.html + popd >/dev/null + fi + + docinto StartupFiles + dodoc StartupFiles/z* +} + +pkg_postinst() { + if [[ -z ${REPLACING_VERSIONS} ]] ; then + echo + elog "If you want to enable Portage completions and Gentoo prompt," + elog "emerge app-shells/gentoo-zsh-completions and add" + elog " autoload -U compinit promptinit" + elog " compinit" + elog " promptinit; prompt gentoo" + elog "to your ~/.zshrc" + echo + elog "Also, if you want to enable cache for the completions, add" + elog " zstyle ':completion::complete:*' use-cache 1" + elog "to your ~/.zshrc" + echo + elog "Note that a system zprofile startup file is installed. This will override" + elog "PATH and possibly other variables that a user may set in ~/.zshenv." + elog "Custom PATH settings and similar overridden variables can be moved to ~/.zprofile" + elog "or other user startup files that are sourced after the system zprofile." + echo + elog "If PATH must be set in ~/.zshenv to affect things like non-login ssh shells," + elog "one method is to use a separate path-setting file that is conditionally sourced" + elog "in ~/.zshenv and also sourced from ~/.zprofile. For more information, see the" + elog "zshenv example in ${EROOT}/usr/share/doc/${PF}/StartupFiles/." + echo + elog "See https://wiki.gentoo.org/wiki/Zsh/HOWTO for more introduction documentation." + echo + fi +} |