Skip to content

Commit 1d1c15f

Browse files
committed
Use blocks runtime from libdispatch
libobjc2 has [support for using an external blocks runtime](gnustep/libobjc2#199), and [only ships with its own copy of a blocks runtime because that was the only option at the time](gnustep/libobjc2#199 (comment))
1 parent 4bdf7a3 commit 1d1c15f

5 files changed

Lines changed: 8 additions & 62 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ jobs:
4646
if: ${{ github.ref != 'refs/heads/main' }}
4747
- name: Install gnustep-helpers
4848
run: conan create gnustep-helpers --profile:a=${{ github.workspace }}/profiles/windows-clang
49+
- name: Install libdispatch
50+
run: conan create libdispatch --profile:a=${{ github.workspace }}/profiles/windows-clang
4951
- name: Install libobjc2
5052
run: conan create libobjc2 --profile:a=${{ github.workspace }}/profiles/windows-clang
5153
- name: Install gnustep-make
5254
run: conan create gnustep-make --profile:a=${{ github.workspace }}/profiles/windows-clang
53-
- name: Install libdispatch
54-
run: conan create libdispatch --profile:a=${{ github.workspace }}/profiles/windows-clang
5555
- name: Install gnustep-base
5656
run: conan create gnustep-base --profile:a=${{ github.workspace }}/profiles/windows-clang -c tools.build:skip_test=True
5757
- name: Install gnustep-gui
@@ -141,12 +141,12 @@ jobs:
141141
if: ${{ github.ref != 'refs/heads/main' }}
142142
- name: Install gnustep-helpers
143143
run: .python3/bin/conan create gnustep-helpers --profile:a=profiles/linux-clang
144+
- name: Install libdispatch
145+
run: .python3/bin/conan create libdispatch --profile:a=profiles/linux-clang
144146
- name: Install libobjc2
145147
run: .python3/bin/conan create libobjc2 --profile:a=profiles/linux-clang
146148
- name: Install gnustep-make
147149
run: .python3/bin/conan create gnustep-make --profile:a=profiles/linux-clang
148-
- name: Install libdispatch
149-
run: .python3/bin/conan create libdispatch --profile:a=profiles/linux-clang
150150
- name: Install gnustep-base dependencies (Ubuntu)
151151
run: |
152152
apt-get update

libdispatch/0003-Use-external-BlocksRuntime.patch

Lines changed: 0 additions & 37 deletions
This file was deleted.

libdispatch/conandata.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ sources:
77
patches:
88
- patch_file: "0001-Use-CMAKE_C_COMPILER_FRONTEND_VARIANT-to-detect-msvc.patch"
99
- patch_file: "0002-Fix-Windows-compatibility.patch"
10-
- patch_file: "0003-Use-external-BlocksRuntime.patch"

libdispatch/conanfile.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ def source(self):
2525
get(self, **sorted(self.conan_data["sources"].values())[0])
2626
apply_conandata_patches(self)
2727

28-
def requirements(self):
29-
self.requires("libobjc2/[^2.2.1]")
30-
3128
def config_options(self):
3229
if self.settings.os == "Windows":
3330
self.options.rm_safe("fPIC")
@@ -44,23 +41,6 @@ def generate(self):
4441
deps.generate()
4542
tc = CMakeToolchain(self)
4643

47-
# Use shared blocks runtime
48-
libobjc2_package_folder = self.dependencies["libobjc2"].package_folder
49-
libobjc_library_name = "libobjc.so"
50-
51-
if self.settings.os == "Windows":
52-
libobjc_library_name = "objc.lib"
53-
54-
libobjc_include_dir = os.path.join(libobjc2_package_folder, "include")
55-
libobjc_library = os.path.join(libobjc2_package_folder, "lib", libobjc_library_name)
56-
57-
# There should be a more elegant way to handle these backwards slashes
58-
if self.settings.os == "Windows":
59-
libobjc_include_dir = libobjc_include_dir.replace('\\','/')
60-
libobjc_library = libobjc_library.replace('\\','/')
61-
62-
tc.variables["BlocksRuntime_INCLUDE_DIR"] = libobjc_include_dir
63-
tc.variables["BlocksRuntime_LIBRARIES"] = libobjc_library
6444
tc.variables["BUILD_TESTING"] = "NO"
6545
tc.generate()
6646

libobjc2/conanfile.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ def source(self):
2727
def requirements(self):
2828
self.requires("tsl-robin-map/1.3.0")
2929

30+
# Use the blocks runtime which ships with libdispatch
31+
self.requires("libdispatch/[^6.1.1]")
32+
3033
def config_options(self):
3134
if self.settings.os == "Windows":
3235
self.options.rm_safe("fPIC")
@@ -47,6 +50,7 @@ def yes_no(opt): return "yes" if opt else "no"
4750
# Prevent picking up a default install location through gnustep-config
4851
tc.variables["GNUSTEP_INSTALL_TYPE"] = "NONE"
4952
tc.variables["TESTS"] = yes_no(not self.conf.get("tools.build:skip_test", default=False))
53+
tc.variables["EMBEDDED_BLOCKS_RUNTIME"] = "OFF"
5054
tc.generate()
5155

5256
def build(self):

0 commit comments

Comments
 (0)