Skip to content

Commit

Permalink
Backport fix
Browse files Browse the repository at this point in the history
  • Loading branch information
qmfrederik committed Nov 18, 2024
1 parent 242908f commit 5ee1c99
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
From 18ced3b5c6b2ae5c512d18e3cfddc477a7fe7763 Mon Sep 17 00:00:00 2001
From: Frederik Carlier <[email protected]>
Date: Mon, 18 Nov 2024 11:01:52 +0100
Subject: [PATCH] Windows: Support building with strict compatibility

---
.github/workflows/main.yml | 7 ++++---
CMakeLists.txt | 5 +++--
2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 4ed8230..862c914 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -199,6 +199,7 @@ jobs:
os: [ windows-2019 ]
msystem: [ ucrt64, mingw64, clang64 ]
build-type: [ Release, Debug ]
+ strict-apple-compatibility: [ ON, OFF ]
include:
- msystem: ucrt64
package-prefix: ucrt-x86_64
@@ -213,7 +214,7 @@ jobs:
# Don't abort runners if a single one fails
fail-fast: false
runs-on: ${{ matrix.os }}
- name: ${{ matrix.os }} ${{ matrix.msystem }} ${{ matrix.build-type}}
+ name: ${{ matrix.os }} ${{ matrix.msystem }} ${{ matrix.build-type}} (Strict Apple compatibility ${{ matrix.strict-apple-compatibility }})
defaults:
run:
shell: msys2 {0}
@@ -228,7 +229,7 @@ jobs:
run: |
mkdir build
cd build
- ${{ matrix.cmake-flags }} cmake .. -DTESTS=ON -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
+ ${{ matrix.cmake-flags }} cmake .. -DTESTS=ON -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DSTRICT_APPLE_COMPATIBILITY=${{ matrix.strict-apple-compatibility }}
- name: Build
working-directory: build
run: |
@@ -243,7 +244,7 @@ jobs:
cmake --install . --prefix=../dist
- uses: actions/upload-artifact@v4
with:
- name: ${{ matrix.msystem }}-${{ matrix.build-type }}
+ name: ${{ matrix.msystem }}-${{ matrix.build-type }}-compat-${{ matrix.strict-apple-compatibility }}
path: dist/

# Fake check that can be used as a branch-protection rule.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4d7e41b..945da02 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,7 +44,7 @@ endif()
message(STATUS "Architecture as detected by CMake: ${CMAKE_SYSTEM_PROCESSOR}")

# Build configuration
-add_compile_definitions(GNUSTEP __OBJC_RUNTIME_INTERNAL__=1)
+add_compile_definitions(GNUSTEP __OBJC_RUNTIME_INTERNAL__=1 __OBJC_BOOL)

set(CMAKE_CXX_STANDARD 17)

@@ -143,7 +143,7 @@ option(DEBUG_ARC_COMPAT
"Log warnings for classes that don't hit ARC fast paths" OFF)
option(ENABLE_OBJCXX "Enable support for Objective-C++" ON)
option(TESTS "Enable building the tests")
-
+option(STRICT_APPLE_COMPATIBILITY "Use strict Apple compatibility, always defining BOOL as signed char" OFF)

# For release builds, we disable spamming the terminal with warnings about
# selector type mismatches
@@ -151,6 +151,7 @@ add_compile_definitions($<$<CONFIG:Release>:NO_SELECTOR_MISMATCH_WARNINGS>)
add_compile_definitions($<$<BOOL:${TYPE_DEPENDENT_DISPATCH}>:TYPE_DEPENDENT_DISPATCH>)
add_compile_definitions($<$<BOOL:${ENABLE_TRACING}>:WITH_TRACING=1>)
add_compile_definitions($<$<BOOL:${DEBUG_ARC_COMPAT}>:DEBUG_ARC_COMPAT>)
+add_compile_definitions($<$<BOOL:${STRICT_APPLE_COMPATIBILITY}>:STRICT_APPLE_COMPATIBILITY>)

if (OLDABI_COMPAT)
list(APPEND libobjc_C_SRCS legacy.c abi_version.c statics_loader.c)
--
2.47.0.windows.1

12 changes: 8 additions & 4 deletions mingw-w64-libobjc2/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,19 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-cmake"
"${MINGW_PACKAGE_PREFIX}-lld"
'git')
source=("https://github.com/gnustep/${_realname}/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz"
# Windows: Support building with strict compatibility
"https://github.com/gnustep/libobjc2/commit/2466c57c59d827b0ff199aaa6748739da99f8bbb.patch")
# Windows: Support building with strict compatibility, backport of https://github.com/gnustep/libobjc2/commit/2466c57c59d827b0ff199aaa6748739da99f8bbb.patch
"0001-Windows-Support-building-with-strict-compatibility.patch"
# Fix selector forwarding on x64 Windows - https://github.com/gnustep/libobjc2/pull/313
"https://github.com/gnustep/libobjc2/commit/47d02a8898777c681d263259b0e70d296813f5ff.patch")
sha256sums=('768ea8c5bd0999a29b5d15781125494f986456c1dc5c51d370fb31852cd31ea1'
'a56318326f564f84729a9e598968553299ddbdda2f36650a0e694a18fffb23d0')
'7ef5b80e2b33317cac280ed24b3fdef746f17af056f70ce267af646c776a03ec'
'e78cc419a4300739f6e874ba5eb480e2ec5c216be4da51897537d0f213bea8f0')

prepare() {
cd "${srcdir}/${_realname}-${pkgver}"

patch -p1 -i ${srcdir}/2466c57c59d827b0ff199aaa6748739da99f8bbb.patch
patch -p1 -i ${srcdir}/0001-Windows-Support-building-with-strict-compatibility.patch
patch -p1 -i ${srcdir}/47d02a8898777c681d263259b0e70d296813f5ff.patch
}

build() {
Expand Down

0 comments on commit 5ee1c99

Please sign in to comment.