commit: fafb2b8c26e00fe1f9cce04812db2bf018651e63 Author: Alfred Wingate <parona <AT> protonmail <DOT> com> AuthorDate: Sat Oct 25 11:38:46 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Tue Nov 4 12:26:35 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fafb2b8c
gnustep-base/gnustep-make: work with libobcj2[libdispatch] Signed-off-by: Alfred Wingate <parona <AT> protonmail.com> Part-of: https://github.com/gentoo/gentoo/pull/44330 Signed-off-by: Sam James <sam <AT> gentoo.org> ...ake-2.9.3-support-libdispatch-in-libobjc2.patch | 370 +++++++++++++++++++++ .../gnustep-make/gnustep-make-2.9.3-r1.ebuild | 150 +++++++++ 2 files changed, 520 insertions(+) diff --git a/gnustep-base/gnustep-make/files/gnustep-make-2.9.3-support-libdispatch-in-libobjc2.patch b/gnustep-base/gnustep-make/files/gnustep-make-2.9.3-support-libdispatch-in-libobjc2.patch new file mode 100644 index 000000000000..a8a348834808 --- /dev/null +++ b/gnustep-base/gnustep-make/files/gnustep-make-2.9.3-support-libdispatch-in-libobjc2.patch @@ -0,0 +1,370 @@ +https://github.com/gnustep/tools-make/pull/56 + +From 4b67844896e3d51bbd1b432eac443434a083dccf Mon Sep 17 00:00:00 2001 +From: Niels Grewe <[email protected]> +Date: Tue, 2 Sep 2025 07:23:29 +0200 +Subject: [PATCH] feat: Support Swift's libBlocksRuntime + +--- a/aclocal.m4 ++++ b/aclocal.m4 +@@ -294,3 +294,4 @@ m4_include([m4/gs_gcc_version.m4]) + m4_include([m4/gs_library_combo.m4]) + m4_include([m4/gs_objc_runtime.m4]) + m4_include([m4/gs_runtime_abi.m4]) ++m4_include([m4/gs_blocks_support.m4]) +--- a/config.make.in ++++ b/config.make.in +@@ -67,6 +67,7 @@ CLANG_CC = @CLANG_CC@ + OPTFLAG = @CFLAGS@ + OBJCFLAGS= @OBJCFLAGS@ + OBJC_LIB_FLAG = @OBJC_LIB_FLAG@ ++BLOCKS_LIB_FLAG = @BLOCKS_LIBS@ + CPPFLAGS = @CPPFLAGS@ + CPP = @CPP@ + CCFLAGS = @CXXFLAGS@ +old mode 100755 +new mode 100644 +--- a/configure ++++ b/configure +@@ -645,6 +645,7 @@ OBJ_MERGE_CMD_FLAG + USE_ARC + ac_cv_objc_threaded + objc_threaded ++BLOCKS_LIBS + libobjc_LIBS + libobjc_CFLAGS + PKG_CONFIG_LIBDIR +@@ -5824,53 +5825,7 @@ fi + + + else +- if test "$OBJC_RUNTIME_LIB" = ng; then +- # +- # Detect compiler support for Blocks; perhaps someday -fblocks won't be +- # required, in which case we'll need to change this. +- # +- saveCFLAGS="$CFLAGS" +- CFLAGS="$CFLAGS -fblocks" +- ac_ext=c +-ac_cpp='$CPP $CPPFLAGS' +-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +-ac_compiler_gnu=$ac_cv_c_compiler_gnu +- +- +-cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +- +-int +-main (void) +-{ +-(void)^{int i; i = 0; }(); +- ; +- return 0; +-} +-_ACEOF +-if ac_fn_c_try_compile "$LINENO" +-then : +- +- ac_cv_blocks="yes" +- +-else $as_nop +- +- ac_cv_blocks="no" + +-fi +-rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +- CFLAGS="$saveCFLAGS" +- ac_ext=c +-ac_cpp='$CPP $CPPFLAGS' +-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +-ac_compiler_gnu=$ac_cv_c_compiler_gnu +- +- if test "$ac_cv_blocks" = no; then +- as_fn_error $? "Your compiler doesn't appear to support blocks. To fix this use the CC environment varibale to specify a different compiler (or use a different library-combo)" "$LINENO" 5; +- fi +- fi + # Extract the first word of "ar", so it can be a program name with args. + set dummy ar; ac_word=$2 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +@@ -8152,7 +8107,7 @@ printf "%s\n" "$gs_cv_libobjc_domain_ng" >&6; } + + if test ! x"$libobjc_LIBS" = x""; then + OBJC_CPPFLAGS=$libobjc_CFLAGS +- OBCJ_LDFLAGS="" ++ OBJC_LDFLAGS="" + OBJC_FINAL_LIB_FLAG=$libobjc_LIBS + elif test ! x"$gs_cv_libobjc_domain_ng" = x""; then + if test x"$gs_cv_libobjc_domain_ng" = x"SYSTEM"; then +@@ -8219,7 +8174,8 @@ printf "%s\n" "$gs_cv_libobjc_domain_ng" >&6; } + + + +- ac_fn_c_check_func "$LINENO" "objc_test_capability" "ac_cv_func_objc_test_capability" ++ ++ac_fn_c_check_func "$LINENO" "objc_test_capability" "ac_cv_func_objc_test_capability" + if test "x$ac_cv_func_objc_test_capability" = xyes + then : + +@@ -8666,7 +8622,7 @@ printf "%s\n" "$gs_cv_libobjc_domain_dflt" >&6; } + + if test ! x"$libobjc_LIBS" = x""; then + OBJC_CPPFLAGS=$libobjc_CFLAGS +- OBCJ_LDFLAGS="" ++ OBJC_LDFLAGS="" + OBJC_FINAL_LIB_FLAG=$libobjc_LIBS + elif test ! x"$gs_cv_libobjc_domain_dflt" = x""; then + if test x"$gs_cv_libobjc_domain_dflt" = x"SYSTEM"; then +@@ -8730,6 +8686,122 @@ printf "%s\n" "$gs_cv_libobjc_domain_dflt" >&6; } + + + ++ ++ ++ BLOCKS_LIBS="" ++ if test "$OBJC_RUNTIME_LIB" = ng; then ++ # ++ # Detect compiler support for Blocks; perhaps someday -fblocks won't be ++ # required, in which case we'll need to change this. ++ # ++ saveCFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS -fblocks" ++ ++ ac_ext=c ++ac_cpp='$CPP $CPPFLAGS' ++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ++ac_compiler_gnu=$ac_cv_c_compiler_gnu ++ ++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for blocks support in compiler" >&5 ++printf %s "checking for blocks support in compiler... " >&6; } ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++int ++main (void) ++{ ++(void)^{int i; i = 0; }(); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_compile "$LINENO" ++then : ++ ++ ac_cv_blocks="yes" ++ ++else $as_nop ++ ++ ac_cv_blocks="no" ++ ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_blocks" >&5 ++printf "%s\n" "$ac_cv_blocks" >&6; } ++ CFLAGS="$saveCFLAGS" ++ if test "$ac_cv_blocks" = yes; then ++ saveLIBS="$LIBS" ++ LIBS="$LIBS $OBJC_FINAL_LIB_FLAG" ++ ac_fn_c_check_func "$LINENO" "_Block_copy" "ac_cv_func__Block_copy" ++if test "x$ac_cv_func__Block_copy" = xyes ++then : ++ ++fi ++ ++ LIBS="$saveLIBS" ++ if test "$ac_cv_func__Block_copy" = no; then ++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _Block_copy in -lBlocksRuntime" >&5 ++printf %s "checking for _Block_copy in -lBlocksRuntime... " >&6; } ++if test ${ac_cv_lib_BlocksRuntime__Block_copy+y} ++then : ++ printf %s "(cached) " >&6 ++else $as_nop ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-lBlocksRuntime $LIBS" ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++char _Block_copy (); ++int ++main (void) ++{ ++return _Block_copy (); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_link "$LINENO" ++then : ++ ac_cv_lib_BlocksRuntime__Block_copy=yes ++else $as_nop ++ ac_cv_lib_BlocksRuntime__Block_copy=no ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.beam \ ++ conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_BlocksRuntime__Block_copy" >&5 ++printf "%s\n" "$ac_cv_lib_BlocksRuntime__Block_copy" >&6; } ++if test "x$ac_cv_lib_BlocksRuntime__Block_copy" = xyes ++then : ++ printf "%s\n" "#define HAVE_LIBBLOCKSRUNTIME 1" >>confdefs.h ++ ++ LIBS="-lBlocksRuntime $LIBS" ++ ++fi ++ ++ if test "$ac_cv_lib_BlocksRuntime__Block_copy" = yes; then ++ BLOCKS_LIBS="-lBlocksRuntime" ++ else ++ as_fn_error $? "Your compiler supports blocks, but the symbols required for blocks support are found neither in libobjc nor in libBlocksRuntime. To fix this, recompile libobjc2 with an embedded blocks runtime, or install libBlocksRuntime/libdispatch with private headers." "$LINENO" 5 ++ fi ++ fi ++ else ++ as_fn_error $? "Your compiler doesn't appear to support blocks. To fix this use the CC environment varibale to specify a different compiler (or use a different library-combo)" "$LINENO" 5; ++ fi ++ ac_ext=c ++ac_cpp='$CPP $CPPFLAGS' ++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ++ac_compiler_gnu=$ac_cv_c_compiler_gnu ++ ++ fi ++ ++ + #-------------------------------------------------------------------- + # Check if libobjc was compiled with thread support. + #-------------------------------------------------------------------- +--- a/configure.ac ++++ b/configure.ac +@@ -228,25 +228,7 @@ if test "x$target" != "x$host"; then + AC_CHECK_PROG(DLLTOOL, "${targetArgument}-dlltool", dnl + "${targetArgument}-dlltool", dlltool) + else +- if test "$OBJC_RUNTIME_LIB" = ng; then +- # +- # Detect compiler support for Blocks; perhaps someday -fblocks won't be +- # required, in which case we'll need to change this. +- # +- saveCFLAGS="$CFLAGS" +- CFLAGS="$CFLAGS -fblocks" +- AC_LANG_PUSH(C) +- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[(void)^{int i; i = 0; }();])], [ +- ac_cv_blocks="yes" +- ], [ +- ac_cv_blocks="no" +- ]) +- CFLAGS="$saveCFLAGS" +- AC_LANG_POP(C) +- if test "$ac_cv_blocks" = no; then +- AC_MSG_ERROR([Your compiler doesn't appear to support blocks. To fix this use the CC environment varibale to specify a different compiler (or use a different library-combo)]); +- fi +- fi ++ + AC_CHECK_PROG(AR, ar, ar) + AC_CHECK_PROG(DLLTOOL, dlltool, dlltool) + AC_PROG_RANLIB +@@ -1147,7 +1129,7 @@ fi + + + GS_CHECK_OBJC_RUNTIME() +- ++GS_BLOCKS_SUPPORT() + #-------------------------------------------------------------------- + # Check if libobjc was compiled with thread support. + #-------------------------------------------------------------------- +--- a/library-combo.make ++++ b/library-combo.make +@@ -42,7 +42,7 @@ endif + ifeq ($(OBJC_RUNTIME_LIB), ng) + OBJC_LDFLAGS = + OBJC_LIB_DIR = +- OBJC_LIBS = $(OBJC_LIB_FLAG) ++ OBJC_LIBS = $(OBJC_LIB_FLAG) $(BLOCKS_LIB_FLAG) + ifeq ($(RUNTIME_VERSION),) + ifneq ($(DEFAULT_OBJC_RUNTIME_ABI),) + RUNTIME_VERSION=$(DEFAULT_OBJC_RUNTIME_ABI) +--- /dev/null ++++ b/m4/gs_blocks_support.m4 +@@ -0,0 +1,50 @@ ++# SYNOPSIS ++# ++# GS_BLOCKS_SUPPORT() ++# ++# DESCRIPTION ++# ++# This macro determines whether and how blocks are used ++# ++AC_DEFUN([GS_BLOCKS_SUPPORT],dnl ++ [ ++ AC_REQUIRE([GS_LIBRARY_COMBO]) ++ AC_REQUIRE([GS_CHECK_OBJC_RUNTIME]) ++ BLOCKS_LIBS="" ++ if test "$OBJC_RUNTIME_LIB" = ng; then ++ # ++ # Detect compiler support for Blocks; perhaps someday -fblocks won't be ++ # required, in which case we'll need to change this. ++ # ++ saveCFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS -fblocks" ++ ++ AC_LANG_PUSH(C) ++ AC_MSG_CHECKING([for blocks support in compiler]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[(void)^{int i; i = 0; }();])], [ ++ ac_cv_blocks="yes" ++ ], [ ++ ac_cv_blocks="no" ++ ]) ++ AC_MSG_RESULT([$ac_cv_blocks]) ++ CFLAGS="$saveCFLAGS" ++ if test "$ac_cv_blocks" = yes; then ++ saveLIBS="$LIBS" ++ LIBS="$LIBS $OBJC_FINAL_LIB_FLAG" ++ AC_CHECK_FUNC([_Block_copy]) ++ LIBS="$saveLIBS" ++ if test "$ac_cv_func__Block_copy" = no; then ++ AC_CHECK_LIB([BlocksRuntime], [_Block_copy]) ++ if test "$ac_cv_lib_BlocksRuntime__Block_copy" = yes; then ++ BLOCKS_LIBS="-lBlocksRuntime" ++ else ++ AC_MSG_ERROR([Your compiler supports blocks, but the symbols required for blocks support are found neither in libobjc nor in libBlocksRuntime. To fix this, recompile libobjc2 with an embedded blocks runtime, or install libBlocksRuntime/libdispatch with private headers.]) ++ fi ++ fi ++ else ++ AC_MSG_ERROR([Your compiler doesn't appear to support blocks. To fix this use the CC environment varibale to specify a different compiler (or use a different library-combo)]); ++ fi ++ AC_LANG_POP(C) ++ fi ++ AC_SUBST(BLOCKS_LIBS) ++]) +--- a/m4/gs_objc_runtime.m4 ++++ b/m4/gs_objc_runtime.m4 +@@ -164,7 +164,7 @@ AC_DEFUN([GS_OBJC_LIB_FLAG], [ + # Configure the installed Objective-C runtime, if it is installed. This sets up CFLAGS/LDFLAGS/LD_LIBRARY_PATH + # as required. Additionally, following variables are set after execution of this macro: + # * OBJC_CPPFLAGS +-# * OBCJ_LDFLAGS ++# * OBJC_LDFLAGS + # * OBJC_FINAL_LIB_FLAG + # * OBJCRT + # +@@ -185,7 +185,7 @@ AC_DEFUN([GS_CHECK_OBJC_RUNTIME], [ + dnl pkg-config makes it easy for us to configure the flags + if test ! x"$libobjc_LIBS" = x""; then + OBJC_CPPFLAGS=$libobjc_CFLAGS +- OBCJ_LDFLAGS="" ++ OBJC_LDFLAGS="" + OBJC_FINAL_LIB_FLAG=$libobjc_LIBS + dnl we need to invest more smarts if + elif test ! x"$gs_cv_libobjc_domain" = x""; then +@@ -279,4 +279,4 @@ AC_DEFUN([GS_CHECK_RUNTIME_ABI20_SUPPORT], [ + fi + ]) + AS_VAR_SET([libobjc_SUPPORTS_ABI20], [${gs_cv_libobjc_abi_20}]) +-]) +\ No newline at end of file ++]) diff --git a/gnustep-base/gnustep-make/gnustep-make-2.9.3-r1.ebuild b/gnustep-base/gnustep-make/gnustep-make-2.9.3-r1.ebuild new file mode 100644 index 000000000000..6d3138a972a0 --- /dev/null +++ b/gnustep-base/gnustep-make/gnustep-make-2.9.3-r1.ebuild @@ -0,0 +1,150 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +inherit flag-o-matic gnustep-base prefix toolchain-funcs + +DESCRIPTION="GNUstep Makefile Package" +HOMEPAGE="https://gnustep.github.io" +SRC_URI="https://ftp.gnustep.org/pub/gnustep/core/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux" +IUSE="custom-cflags libobjc2 native-exceptions" + +DEPEND="${GNUSTEP_CORE_DEPEND} + >=dev-build/make-3.75 + libobjc2? ( gnustep-base/libobjc2 + llvm-core/clang:* ) + !libobjc2? ( !!gnustep-base/libobjc2 + || ( + sys-devel/gcc:*[objc] + llvm-core/clang:* + ) )" +RDEPEND="${DEPEND}" + +PATCHES=( + "${FILESDIR}"/${PN}-2.9.0-no_compress_man_pages.patch + "${FILESDIR}"/${PN}-2.9.3-support-libdispatch-in-libobjc2.patch +) + +pkg_setup() { + # Determine libobjc.so to use + if use libobjc2; then + libobjc_version=libobjc.so + else + # Find version in active gcc + for ver in {2..5}; + do + if $(tc-getCC) -Werror -Wl,-l:libobjc.so.${ver} -x objective-c \ + - <<<$'int main() {}' -o /dev/null 2> /dev/null; + then + libobjc_version=libobjc.so.${ver} + fi + done + fi + + # Stop if we could not get libobjc.so + if [[ -z ${libobjc_version} ]]; then + eerror "${P} requires a working Objective-C runtime and a compiler with" + eerror "Objective-C support. Your current settings lack these requirements" + if ! use libobjc2; + then + eerror "Please switch your active compiler to gcc with USE=objc, or clang" + fi + die "Could not find Objective-C runtime" + fi + + # For existing installations, determine if we will use another libobjc.so + if has_version gnustep-base/gnustep-make; then + local current_libobjc="$(awk -F: '/^OBJC_LIB_FLAG/ {print $2}' "${EPREFIX}"/usr/share/GNUstep/Makefiles/config.make)" + # Old installations did not set this explicitely + : ${current_libobjc:=libobjc.so.2} + + if [[ ${current_libobjc} != ${libobjc_version} ]]; then + ewarn "Warning: changed libobjc.so version!!" + ewarn "The libobjc.so version used for gnustep-make has changed" + ewarn "(either by the libojbc2 use-flag or a GCC upgrade)" + ewarn "You must rebuild all gnustep packages installed." + ewarn "" + ewarn "To do so, please emerge gnustep-base/gnustep-updater and run:" + ewarn "# gnustep-updater -l" + fi + fi +} + +src_prepare() { + # Multilib-strict + sed -e "s#/@libdir@#/$(get_libdir)#" -i FilesystemLayouts/fhs-system || die "sed failed" + cp "${FILESDIR}"/gnustep-5.{csh,sh} "${T}"/ + eprefixify "${T}"/gnustep-5.{csh,sh} + + default +} + +src_configure() { + if use libobjc2 && tc-is-gcc; then + einfo "Forcing clang" + export CC="${CHOST}-clang" + export CXX="${CHOST}-clang++" + + # Strip unsupported flags for clang + # bug #949599 + strip-unsupported-flags + fi + + # gnustep-make has sticky flags that affect other gnustep packages + # https://bugs.gentoo.org/950346 + if ! use custom-cflags; then + strip-flags + filter-lto + fi + + econf \ + INSTALL="${EPREFIX}"/usr/bin/install \ + --with-layout=fhs-system \ + --with-config-file="${EPREFIX}"/etc/GNUstep/GNUstep.conf \ + --with-objc-lib-flag=-l:${libobjc_version} \ + $(use_enable native-exceptions native-objc-exceptions) +} + +src_compile() { + emake + if use doc ; then + emake -C Documentation + fi +} + +src_install() { + # Get GNUSTEP_* variables + . ./GNUstep.conf + + local make_eval + use debug || make_eval="${make_eval} debug=no" + make_eval="${make_eval} verbose=yes" + + emake ${make_eval} DESTDIR="${D}" install + + # Copy the documentation + if use doc ; then + emake -C Documentation ${make_eval} DESTDIR="${D}" GNUSTEP_INSTALLATION_DOMAIN=SYSTEM install + fi + + dodoc FAQ README RELEASENOTES + + exeinto /etc/profile.d + doexe "${T}"/gnustep-?.sh + doexe "${T}"/gnustep-?.csh +} + +pkg_postinst() { + # Warn about new layout if old GNUstep directory is still here + if [ -e /usr/GNUstep/System ]; then + ewarn "Old layout directory detected (/usr/GNUstep/System)" + ewarn "Gentoo has switched to FHS layout for GNUstep packages" + ewarn "You must first update the configuration files from this package," + ewarn "then remerge all packages still installed with the old layout" + ewarn "You can use gnustep-base/gnustep-updater for this task" + fi +}
