Skip to content

libjpeg: relocatable shared lib on macOS #9067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions recipes/libjpeg/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
10 changes: 10 additions & 0 deletions recipes/libjpeg/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down