diff --git a/recipes/libjpeg/all/conanfile.py b/recipes/libjpeg/all/conanfile.py index 29906064a9e4a..27cdfd265c661 100644 --- a/recipes/libjpeg/all/conanfile.py +++ b/recipes/libjpeg/all/conanfile.py @@ -100,6 +100,13 @@ def _configure_autotools(self): def _patch_sources(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) + # Fix rpath in LC_ID_DYLIB of installed shared libs on macOS + if tools.is_apple_os(self.settings.os): + tools.replace_in_file( + os.path.join(self._source_subfolder, "configure"), + "-install_name \\$rpath/", + "-install_name @rpath/", + ) def build(self): self._patch_sources() diff --git a/recipes/libjpeg/all/test_package/conanfile.py b/recipes/libjpeg/all/test_package/conanfile.py index a3966de4748fd..5d40f08406b63 100644 --- a/recipes/libjpeg/all/test_package/conanfile.py +++ b/recipes/libjpeg/all/test_package/conanfile.py @@ -11,6 +11,16 @@ def _test_transupp(self): # 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. return not (self.options["libjpeg"].shared and self.settings.compiler == "Visual Studio" and "MT" in self.settings.compiler.runtime) + def build_requirements(self): + if hasattr(self, "settings_build") and tools.cross_building(self) and \ + self.settings.os == "Macos" and self.settings.arch == "armv8": + # Workaround for CMake bug with error message: + # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being + # set. This could be because you are using a Mac OS X version less than 10.5 + # or because CMake's platform configuration is corrupt. + # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. + self.build_requires("cmake/3.22.0") + def build(self): cmake = CMake(self) cmake.configure()