Saturday, January 31, 2026

Re: MAINTAINER UPDATE: x11/gnustep/libobjc2 to 2.3 and enable libdispatch

Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/gnustep/libobjc2/Makefile,v
diff -u -r1.40 Makefile
--- Makefile 10 Sep 2025 17:04:13 -0000 1.40
+++ Makefile 31 Jan 2026 10:52:42 -0000
@@ -3,22 +3,23 @@
COMMENT = GNUstep libobjc2 objective-c runtime

# note: this port does not use the gnustep module
-VERSION = 2.2.1
+VERSION = 2.3
GH_ACCOUNT = gnustep
GH_PROJECT = libobjc2
GH_TAGNAME = v${VERSION}
DISTNAME = libobjc2-${VERSION:S/_//}
PKGNAME = gnustep-${DISTNAME}
-REVISION = 0

-SHARED_LIBS += objc2 3.0
-SHARED_LIBS += objcxx 2.0
+SHARED_LIBS += objc2 4.0
+SHARED_LIBS += objcxx 3.0

CATEGORIES = x11/gnustep devel

HOMEPAGE = http://www.gnustep.org/

-WANTLIB += ${COMPILER_LIBCXX} m
+WANTLIB += ${COMPILER_LIBCXX} m BlocksRuntime
+
+LIB_DEPENDS += devel/libdispatch

COMPILER = base-clang
MODULES = devel/cmake
@@ -30,24 +31,53 @@
.endif

BUILD_DEPENDS += devel/robin-map
+BUILD_DEPENDS += devel/libdispatch:patch
MAKE_FLAGS += LIBOBJCLIBNAME=objc2 \
LIBOBJC=libobjc2 \
HEADER_DIR=${DESTDIR}${PREFIX}/include/gnustep \
VERSION=${LIBobjc2_VERSION} \
SILENT=""

-CONFIGURE_ARGS += -DLIBOBJC_NAME=objc2 -DINCLUDE_DIRECTORY=gnustep/objc \
+CONFIGURE_ARGS += -DLIBOBJC_NAME=objc2 -DINCLUDE_DIRECTORY=gnustep/objc \
-DCMAKE_MODULE_PATH=${PREFIX}/share/llvm/cmake \
- -DBUILD_STATIC_LIBOBJC=On \
- -DLLVM_OPTS=Off \
- -DTESTS=Off \
- -DCMAKE_CXX_FLAGS="-I${LOCALBASE}/include"
-
-MAKE_FLAGS += LIBOBJCLIBNAME=objc2 \
- LIBOBJC=libobjc2
-
-# The Block.h would conflict with devel/libdispatch
-post-install:
- mv ${PREFIX}/include/Block* ${PREFIX}/include/gnustep/
+ -DBUILD_STATIC_LIBOBJC=On \
+ -DEMBEDDED_BLOCKS_RUNTIME=Off \
+ -DOLDABI_COMPAT=Off \
+ -DLLVM_OPTS=Off \
+ -DTESTS=Off \
+ -DHAVE_BLOCK_USE_RR2=1 \
+ -DCMAKE_C_FLAGS="${CFLAGS} -I${WRKSRC}/libdispatch/BlocksRuntime -I${LOCALBASE}/include" \
+ -DCMAKE_CXX_FLAGS="${CXXFLAGS} -I${WRKSRC}/libdispatch/BlocksRuntime -I${LOCALBASE}/include" \
+ -DCMAKE_OBJC_FLAGS="${OBJCFLAGS} -I${WRKSRC}/libdispatch/BlocksRuntime -I${LOCALBASE}/include" \
+ -DCMAKE_OBJCXX_FLAGS="${OBJCXXFLAGS} -I${WRKSRC}/libdispatch/BlocksRuntime -I${LOCALBASE}/include"
+
+post-extract:
+ ln -s ${WRKDIR}/devel/libdispatch/swift-*/src/ ${WRKSRC}/libdispatch
+
+# 95% tests passed, 5 tests failed out of 98
+TEST_WRKBUILD = ${WRKDIR}/tests-${ARCH}
+test:
+ mkdir -p ${TEST_WRKBUILD}
+ cd ${TEST_WRKBUILD} && ${SETENV} ${MAKE_ENV} \
+ cmake \
+ -DLIBOBJC_NAME=objc2 \
+ -DINCLUDE_DIRECTORY=gnustep/objc \
+ -DCMAKE_MODULE_PATH=${PREFIX}/share/llvm/cmake \
+ -DBUILD_STATIC_LIBOBJC=On \
+ -DEMBEDDED_BLOCKS_RUNTIME=Off \
+ -DOLDABI_COMPAT=Off \
+ -DLLVM_OPTS=Off \
+ -DTESTS=On \
+ -DHAVE_BLOCK_USE_RR2=1 \
+ -DCMAKE_C_FLAGS="${CFLAGS} -I${WRKSRC}/libdispatch/BlocksRuntime -I${LOCALBASE}/include" \
+ -DCMAKE_CXX_FLAGS="${CXXFLAGS} -I${WRKSRC}/libdispatch/BlocksRuntime -I${LOCALBASE}/include" \
+ -DCMAKE_OBJC_FLAGS="${OBJCFLAGS} -I${WRKSRC}/libdispatch/BlocksRuntime -I${LOCALBASE}/include" \
+ -DCMAKE_OBJCXX_FLAGS="${OBJCXXFLAGS} -I${WRKSRC}/libdispatch/BlocksRuntime -I${LOCALBASE}/include" \
+ -DCMAKE_EXE_LINKER_FLAGS="-L${WRKBUILD} -lobjc2 -L/usr/local/lib -lBlocksRuntime -lpthread -lc++abi" \
+ ${WRKSRC}
+ cd ${TEST_WRKBUILD} && ${SETENV} ${MAKE_ENV} \
+ cmake --build . ${_MAKE_VERBOSE} -j ${MAKE_JOBS} && \
+ cd ${TEST_WRKBUILD} && ${SETENV} ${MAKE_ENV} \
+ ctest --output-on-failure

.include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/x11/gnustep/libobjc2/distinfo,v
diff -u -r1.6 distinfo
--- distinfo 22 Apr 2024 06:47:57 -0000 1.6
+++ distinfo 31 Jan 2026 10:52:42 -0000
@@ -1,2 +1,2 @@
-SHA256 (gnustep/libobjc2-2.2.1.tar.gz) = do6oxb0JmaKbXRV4ESVJT5hkVsHcXFHTcPsxhSzTHqE=
-SIZE (gnustep/libobjc2-2.2.1.tar.gz) = 205087
+SHA256 (gnustep/libobjc2-2.3.tar.gz) = Xq0idrQqU0rEBDfOU7IjEyC5hVOdwyVFPZOHS+jZKGk=
+SIZE (gnustep/libobjc2-2.3.tar.gz) = 213139
Index: patches/patch-CMakeLists_txt
===================================================================
RCS file: patches/patch-CMakeLists_txt
diff -N patches/patch-CMakeLists_txt
--- patches/patch-CMakeLists_txt 10 Sep 2025 17:04:13 -0000 1.10
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,14 +0,0 @@
-Enable objc_method_cache_version on powerpc.
-
-Index: CMakeLists.txt
---- CMakeLists.txt.orig
-+++ CMakeLists.txt
-@@ -188,7 +188,7 @@ add_compile_options($<$<STREQUAL:${CMAKE_SYSTEM_PROCES
- # which is used in safe caching.
- # You must also update the guard in objc/runtime.h, when updating
- # this macro.
--if (ARCHITECTURE STREQUAL "powerpc")
-+if (OFF AND ARCHITECTURE STREQUAL "powerpc")
- add_definitions(-DNO_SAFE_CACHING)
- endif()
-
Index: patches/patch-Test_CMakeLists_txt
===================================================================
RCS file: patches/patch-Test_CMakeLists_txt
diff -N patches/patch-Test_CMakeLists_txt
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-Test_CMakeLists_txt 31 Jan 2026 10:52:42 -0000
@@ -0,0 +1,76 @@
+Index: Test/CMakeLists.txt
+--- Test/CMakeLists.txt.orig
++++ Test/CMakeLists.txt
+@@ -2,7 +2,15 @@
+ # Clear the LD_LIBRARY_PATH if GNUstep set it so that we don't accidentally use
+ # the installed version
+
++# Default-Werte
++if(NOT DEFINED LEGACY)
++ set(LEGACY OFF)
++endif()
++if(NOT DEFINED OLDABI_COMPAT)
++ set(OLDABI_COMPAT OFF)
++endif()
+
++
+ set(INCREMENTAL " ")
+ if (MSVC)
+ set(CMAKE_EXE_LINKER_FLAGS "/DEBUG /INCREMENTAL:NO ${CMAKE_EXE_LINKER_FLAGS}")
+@@ -135,7 +143,7 @@ function(addtest_flags TEST_NAME FLAGS TEST_SOURCE)
+ if(WIN32)
+ set_property(TEST ${TEST_NAME} PROPERTY ENVIRONMENT_MODIFICATION "PATH=path_list_append:${CMAKE_BINARY_DIR}")
+ endif()
+- target_link_libraries(${TEST_NAME} objc)
++ target_link_libraries(${TEST_NAME} objc2)
+ endfunction(addtest_flags)
+
+ function(addtest_variants TEST TEST_SOURCE LEGACY)
+@@ -164,19 +172,35 @@ foreach(TEST_SOURCE ${NEW_TESTS})
+ endforeach()
+
+ # Tests that are more than a single file.
+-addtest_variants("CXXExceptions" "CXXException.m;CXXException.cc" true)
++#addtest_variants("CXXExceptions" "CXXException.m;CXXException.cc" true)
+ addtest_variants("ForwardDeclareProtocolAccess" "ForwardDeclareProtocolAccess.m;ForwardDeclareProtocol.m" true)
+-if (ENABLE_OBJCXX)
+- addtest_variants(ObjCXXEHInterop "ObjCXXEHInterop.mm;ObjCXXEHInterop.m" true)
+- addtest_variants(ObjCXXEHInteropTwice "ObjCXXEHInteropTwice.mm" true)
+- if (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL Clang)
+- if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0.0)
+- addtest_variants(ObjCXXEHInterop_arc "ObjCXXEHInterop_arc.mm;ObjCXXEHInterop_arc.m" true)
+- endif()
+- else()
+- addtest_variants(ObjCXXEHInterop_arc "ObjCXXEHInterop_arc.mm;ObjCXXEHInterop_arc.m" true)
+- endif()
+-endif()
++#if (ENABLE_OBJCXX)
++# addtest_variants(ObjCXXEHInterop "ObjCXXEHInterop.mm;ObjCXXEHInterop.m" true)
++# addtest_variants(ObjCXXEHInteropTwice "ObjCXXEHInteropTwice.mm" true)
++# if (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL Clang)
++# if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0.0)
++# addtest_variants(ObjCXXEHInterop_arc "ObjCXXEHInterop_arc.mm;ObjCXXEHInterop_arc.m" true)
++# endif()
++# else()
++# addtest_variants(ObjCXXEHInterop_arc "ObjCXXEHInterop_arc.mm;ObjCXXEHInterop_arc.m" true)
++# endif()
++#endif()
++
++# CXXExceptions needs C++ linker
++#add_executable(CXXExceptions CXXException.m CXXException.cc)
++#set_target_properties(CXXExceptions PROPERTIES
++# LINKER_LANGUAGE CXX
++#)
++#target_link_libraries(CXXExceptions
++# objc2
++# c++abi
++# c++
++# BlocksRuntime
++# dispatch
++# pthread
++# m
++#)
++
+
+ # Some tests use enough memory that they fail on CI intermittently if they
+ # happen to run in parallel with each other.
Index: patches/patch-block_trampolines_S
===================================================================
RCS file: /cvs/ports/x11/gnustep/libobjc2/patches/patch-block_trampolines_S,v
diff -u -r1.2 patch-block_trampolines_S
--- patches/patch-block_trampolines_S 22 Apr 2024 06:47:57 -0000 1.2
+++ patches/patch-block_trampolines_S 31 Jan 2026 10:52:42 -0000
@@ -14,6 +14,6 @@
////////////////////////////////////////////////////////////////////////////////
.macro trampoline arg0, arg1
+ bti c
- adr x17, #-4096
+ adr x17, #-0x1000
mov \arg1, \arg0
ldp \arg0, x17, [x17]
Index: patches/patch-objc_msgSend_x86-64_S
===================================================================
RCS file: /cvs/ports/x11/gnustep/libobjc2/patches/patch-objc_msgSend_x86-64_S,v
diff -u -r1.1 patch-objc_msgSend_x86-64_S
--- patches/patch-objc_msgSend_x86-64_S 7 Mar 2024 12:22:50 -0000 1.1
+++ patches/patch-objc_msgSend_x86-64_S 31 Jan 2026 10:52:42 -0000
@@ -1,9 +1,9 @@
Index: objc_msgSend.x86-64.S
--- objc_msgSend.x86-64.S.orig
+++ objc_msgSend.x86-64.S
-@@ -8,7 +8,7 @@
- # define SECOND_ARGUMENT %rdx
+@@ -9,7 +9,7 @@
# define THIRD_ARGUMENT %r8
+ # define FOURTH_ARGUMENT %r9
#else
-# define START_PROC(x) .cfi_startproc
+# define START_PROC(x) .cfi_startproc; endbr64
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/x11/gnustep/libobjc2/pkg/PLIST,v
diff -u -r1.7 PLIST
--- pkg/PLIST 5 Mar 2024 13:28:56 -0000 1.7
+++ pkg/PLIST 31 Jan 2026 10:52:42 -0000
@@ -1,12 +1,8 @@
include/gnustep/
-include/gnustep/Block.h
-include/gnustep/Block_private.h
include/gnustep/objc/
include/gnustep/objc/Availability.h
include/gnustep/objc/Object.h
include/gnustep/objc/Protocol.h
-include/gnustep/objc/blocks_private.h
-include/gnustep/objc/blocks_runtime.h
include/gnustep/objc/capabilities.h
include/gnustep/objc/developer.h
include/gnustep/objc/encoding.h
@@ -16,6 +12,7 @@
include/gnustep/objc/objc-arc.h
include/gnustep/objc/objc-auto.h
include/gnustep/objc/objc-class.h
+include/gnustep/objc/objc-config.h
include/gnustep/objc/objc-exception.h
include/gnustep/objc/objc-runtime.h
include/gnustep/objc/objc-visibility.h
@@ -23,6 +20,12 @@
include/gnustep/objc/runtime-deprecated.h
include/gnustep/objc/runtime.h
include/gnustep/objc/slot.h
+lib/cmake/
+lib/cmake/libobjc/
+lib/cmake/libobjc/libobjcConfig.cmake
+lib/cmake/libobjc/libobjcConfigVersion.cmake
+lib/cmake/libobjc/libobjcTargets${MODCMAKE_BUILD_SUFFIX}
+lib/cmake/libobjc/libobjcTargets.cmake
@static-lib lib/libobjc2.a
@lib lib/libobjc2.so.${LIBobjc2_VERSION}
lib/pkgconfig/libobjc.pc
Hi,

On Fri, Jan 30, 2026 at 3:55 PM Stuart Henderson <stu@spacehopper.org> wrote:
On 2026/01/27 15:59, Sebastian Reitenbach wrote:
> Hi,
>
> just pinging for feedback. Patches reattached.

the newly added "test" target is problematic. firstly, as it doesn't
do what "make test" is expected to do, it should probably not override
that. if the normal upstream build infrastructure can't be used (i.e.
-DTESTS=On and fix whatever is causing it to fail) then it should use
a different name ("build-tests" or something?) with a comment explaining
it. or convert to do-test and have it also run the tests. also it needs
to use ${WRKBUILD} rather than just whatever that happens to expand to
on your system.


as you mentioned the -DTESTS=On I got the idea to mimic what configure and build stage do
in the test stage, and enable the tests. It finally built them, but still didn't ran them. But then
I stumbled upon ctest, calling this at the end of test stage, was the missing piece.
5 out of 98 tests fail. I used same approach with older version, but there all test fail (subprocess aborted).

I run this since weeks, but didn't experience any trouble yet, even with those 5 filed tests.

Updated diff attached. 

Sebastian

 

> thank you,
> Sebastian
>
> On Mon, Jan 19, 2026 at 9:50 AM Sebastian Reitenbach <sebastia@l00-bugdead-prods.de> wrote:
>
>     Hi,
>
>     this updates libobjc2 to 2.3. This version allows, to not use internal libdispatch, but
>     build/link against external libdispatch. To build, it requires private headers, therefore
>     the BUILD_DEPENDS on the :patch target, as sthen@ suggested.
>
>     Being finally able to use libdispatch in objective-c is kind of the last missing modern
>     objective-c feature.
>
>     Getting the tests to work, caused me some grief, but I got most of then to build now.
>     However, it would still need to run them.I left it in that state now, as they can be run
>     manually. Some are failing, but up to now, I haven't seen any issues yet.
>     It may well be that they would have failed with the previous versions as well.
>
>     See attached libobjc2.diff
>
>     Additionally, updated gnustep.port.mk accordingly, and took the opportunity to clean
>     WANTLIB on a number of depending ports.
>
>     See attached gnustep.diff
>
>     Works for me on amd64 for about 2 months now.
>
>
>     cheers,
>     Sebastian
>
>



No comments:

Post a Comment