MINGW-packages/mingw-w64-libobjc2/0001-Windows-Support-building-with-strict-compatibility.patch
Frederik Carlier 38fdcf5ba0
libobjc2: Build with strict Apple compatibility (#22538)
By default, Objective C's `BOOL` type is an `(un)signed char`. libobjc2 would define BOOL as `int` on the Windows platform, to avoid a clash with the Windows `BOOL` type.

However, MSYS2 uses `WINBOOL` instead of `BOOL` to avoid this clash.

Hence:
- Align the libobjc2 configuration with the Apple and use libobjc2 with the `STRICT_APPLE_COMPATIBILITY=1` flag set.  This aligns with the behavior of the GCC libobjc runtime.
- Configure `gnustep-make` with `CFLAGS=-DSTRICT_APPLE_COMPATIBILITY=1` to make sure GNUstep picks up this configuration
- Rebuild the other GNUstep packages
- Rebuild libpreferencepanes
2025-01-23 23:13:36 +01:00

83 lines
3.4 KiB
Diff

From 18ced3b5c6b2ae5c512d18e3cfddc477a7fe7763 Mon Sep 17 00:00:00 2001
From: Frederik Carlier <frederik.carlier@keysight.com>
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