Skip to content

Commit

Permalink
bundle: OSX use -rpath for bundled libevent
Browse files Browse the repository at this point in the history
  • Loading branch information
mdavidsaver committed Apr 10, 2023
1 parent 6b63e14 commit c8f28f3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/ci-scripts-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ jobs:
run: |
sudo apt-get -y install doxygen python-is-python3 python3-breathe
make -C documentation
- name: otool
if: runner.os == 'macOS'
run: otool -D -L bundle/usr/*/lib/*.dylib lib/*/*.dylib bin/*/pvxinfo
- name: Host info
run: python .ci/cue.py --add-path "{TOP}/bin/{EPICS_HOST_ARCH}" --add-path "{TOP}/bundle/usr/{EPICS_HOST_ARCH}/lib" exec pvxinfo -D
- name: Run main module tests
Expand Down
4 changes: 3 additions & 1 deletion bundle/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ CMAKEFLAGS += -DEVENT__DISABLE_SAMPLES=ON
CMAKEFLAGS += -DEVENT__DISABLE_TESTS=ON
CMAKEFLAGS += -DEVENT__DISABLE_BENCHMARK=ON

CMAKEFLAGS += -DCMAKE_MACOSX_RPATH=ON -DCMAKE_SKIP_INSTALL_RPATH=OFF

# searched for toolchain files
CMAKEFLAGS += -DCMAKE_MODULE_PATH:DIR="$(abspath $(TOP)/bundle/cmake)"

Expand Down Expand Up @@ -120,7 +122,7 @@ ifneq (,$(filter %mingw,$(T_A)))
ifeq (NO,$(SHARED_LIBRARIES))
$(CP) $(LIBEVENT_$(T_A))/lib/libevent_core.a $(LIBEVENT_$(T_A))/lib/event_core.lib
# HACK: when STATIC_BUILD=YES we (in configure/RULES_PVXS_MODULE) inject the event_core
# dependency via <target>_LIBS += event_core which requires end existance of
# dependency via <target>_LIBS += event_core which requires the existance of
# $(event_core_DIR)/event_core.lib however, cmake outputs the *nix style name
# libevent_core.a (probably because it can coexist with the dll import library
# named libevent_core.dll.a).
Expand Down
3 changes: 3 additions & 0 deletions configure/CONFIG_PVXS_MODULE
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ LIBEVENT_BUNDLE_LIBS += $(LIBEVENT_BUNDLE_LIBS_POSIX_$(POSIX))
LIBEVENT_SYS_LIBS_WIN32 = bcrypt iphlpapi netapi32 ws2_32
LIBEVENT_SYS_LIBS += $(LIBEVENT_SYS_LIBS_$(OS_CLASS))

LIBEVENT_BUNDLE_LDFLAGS_Darwin_NO = -Wl,-rpath,$(LIBEVENT)/lib
LIBEVENT_BUNDLE_LDFLAGS += $(LIBEVENT_BUNDLE_LDFLAGS_$(OS_CLASS)_$(STATIC_BUILD))

event_core_DIR = $(LIBEVENT)/lib
event_pthreads_DIR = $(LIBEVENT)/lib

Expand Down
3 changes: 3 additions & 0 deletions configure/RULES_PVXS_MODULE
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ endif
_PVXS_CHECK_VARS := PROD TESTPROD LIB $(PROD) $(TESTPROD) $(LIBRARY)

ifeq (,$(LIBEVENT))
# libevent in default search path

# $(1) is PROD or LIBRARY name
define _PVXS_ADD_LIBEVENT
Expand All @@ -20,11 +21,13 @@ $(1)_SYS_LIBS := $$($(1)_SYS_LIBS) $$(if $$(filter pvxs,$$($(1)_LIBS)),$$(LIBEVE
endef

else
# libevent in specific location

# $(1) is PROD or LIBRARY name
define _PVXS_ADD_LIBEVENT
$(1)_LIBS := $$($(1)_LIBS) $$(if $$(filter pvxs,$$($(1)_LIBS)),$$(LIBEVENT_BUNDLE_LIBS))
$(1)_SYS_LIBS := $$($(1)_SYS_LIBS) $$(if $$(filter pvxs,$$($(1)_LIBS)),$$(LIBEVENT_SYS_LIBS))
$(1)_LDFLAGS := $$($(1)_LDFLAGS) $$(if $$(filter pvxs,$$($(1)_LIBS)),$$(LIBEVENT_BUNDLE_LDFLAGS))
endef

endif
Expand Down

0 comments on commit c8f28f3

Please sign in to comment.