Skip to content

Commit a893f4e

Browse files
authored
(#9067) libjpeg: relocatable shared lib on macOS
* relocatable shared lib on macOS * use recent CMake for macos armv8 avoid error "Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being set."
1 parent 028e662 commit a893f4e

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

recipes/libjpeg/all/conanfile.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ def _configure_autotools(self):
100100
def _patch_sources(self):
101101
for patch in self.conan_data.get("patches", {}).get(self.version, []):
102102
tools.patch(**patch)
103+
# Fix rpath in LC_ID_DYLIB of installed shared libs on macOS
104+
if tools.is_apple_os(self.settings.os):
105+
tools.replace_in_file(
106+
os.path.join(self._source_subfolder, "configure"),
107+
"-install_name \\$rpath/",
108+
"-install_name @rpath/",
109+
)
103110

104111
def build(self):
105112
self._patch_sources()

recipes/libjpeg/all/test_package/conanfile.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ def _test_transupp(self):
1111
# transupp+libjpeg makes use of stdio of the C library. This cannot be used when using a dll libjpeg, built with a static c library.
1212
return not (self.options["libjpeg"].shared and self.settings.compiler == "Visual Studio" and "MT" in self.settings.compiler.runtime)
1313

14+
def build_requirements(self):
15+
if hasattr(self, "settings_build") and tools.cross_building(self) and \
16+
self.settings.os == "Macos" and self.settings.arch == "armv8":
17+
# Workaround for CMake bug with error message:
18+
# Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being
19+
# set. This could be because you are using a Mac OS X version less than 10.5
20+
# or because CMake's platform configuration is corrupt.
21+
# FIXME: Remove once CMake on macOS/M1 CI runners is upgraded.
22+
self.build_requires("cmake/3.22.0")
23+
1424
def build(self):
1525
cmake = CMake(self)
1626
cmake.configure()

0 commit comments

Comments
 (0)