1
1
mirror of https://github.com/rui314/mold.git synced 2024-11-09 16:05:58 +03:00

Do not install mold-wrapper.so for macOS

mold-wrapper.so works only on ELF-based systems, so we should not
install that file with `make install`.

https://github.com/rui314/mold/issues/621
This commit is contained in:
Rui Ueyama 2022-08-17 16:17:50 +08:00
parent bbae3116e4
commit a65d1a58be
2 changed files with 13 additions and 8 deletions

View File

@ -134,14 +134,6 @@ if(WIN32)
elf/lto-win32.cc elf/lto-win32.cc
macho/lto-win32.cc) macho/lto-win32.cc)
else() else()
add_library(mold-wrapper SHARED)
install(TARGETS mold-wrapper DESTINATION ${CMAKE_INSTALL_LIBDIR}/mold)
# Remove the default `lib` prefix
set_target_properties(mold-wrapper PROPERTIES PREFIX "")
target_link_libraries(mold-wrapper PRIVATE ${CMAKE_DL_LIBS})
target_sources(mold-wrapper PRIVATE elf/mold-wrapper.c)
include(CheckLibraryExists) include(CheckLibraryExists)
check_library_exists(m pow "" LIBM_FOUND) check_library_exists(m pow "" LIBM_FOUND)
if(LIBM_FOUND) if(LIBM_FOUND)
@ -154,6 +146,16 @@ else()
macho/lto-unix.cc) macho/lto-unix.cc)
endif() endif()
if(NOT APPLE AND NOT WIN32)
add_library(mold-wrapper SHARED)
install(TARGETS mold-wrapper DESTINATION ${CMAKE_INSTALL_LIBDIR}/mold)
# Remove the default `lib` prefix
set_target_properties(mold-wrapper PROPERTIES PREFIX "")
target_link_libraries(mold-wrapper PRIVATE ${CMAKE_DL_LIBS})
target_sources(mold-wrapper PRIVATE elf/mold-wrapper.c)
endif()
if(NOT APPLE AND NOT MOLD_MOSTLY_STATIC AND NOT WIN32) if(NOT APPLE AND NOT MOLD_MOSTLY_STATIC AND NOT WIN32)
find_package(OpenSSL REQUIRED COMPONENTS Crypto) find_package(OpenSSL REQUIRED COMPONENTS Crypto)
target_link_libraries(mold PRIVATE OpenSSL::Crypto) target_link_libraries(mold PRIVATE OpenSSL::Crypto)

View File

@ -213,8 +213,11 @@ install: all
$(STRIP) $D$(BINDIR)/mold $(STRIP) $D$(BINDIR)/mold
$(INSTALL) -d $D$(LIBDIR)/mold $(INSTALL) -d $D$(LIBDIR)/mold
ifneq ($(OS), Darwin)
$(INSTALL_DATA) mold-wrapper.so $D$(LIBDIR)/mold $(INSTALL_DATA) mold-wrapper.so $D$(LIBDIR)/mold
$(STRIP) $D$(LIBDIR)/mold/mold-wrapper.so $(STRIP) $D$(LIBDIR)/mold/mold-wrapper.so
endif
$(INSTALL) -d $D$(LIBEXECDIR)/mold $(INSTALL) -d $D$(LIBEXECDIR)/mold