macos: tcc searches for libtcc.dyln in the same directory as its executable

This commit is contained in:
Christian Jullien 2020-07-09 12:04:57 +02:00
parent 1ea425811a
commit b5a89c8c93
2 changed files with 11 additions and 3 deletions

View file

@ -42,7 +42,11 @@ else
LIBTCC=libtcc$(DLLSUF)
export LD_LIBRARY_PATH := $(CURDIR)/$(TOP)
ifneq ($(CONFIG_rpath),no)
LINK_LIBTCC += -Wl,-rpath,"$(libdir)"
ifndef CONFIG_OSX
LINK_LIBTCC += -Wl,-rpath,"$(libdir)"
else
LINK_LIBTCC += -Wl,-rpath,"@executable_path/$(TOP)"
endif
endif
endif
NATIVE_TARGET = $(ARCH)
@ -52,7 +56,6 @@ else
LDFLAGS += -flat_namespace -undefined warning
endif
export MACOSX_DEPLOYMENT_TARGET := 10.6
export DYLD_LIBRARY_PATH := $(CURDIR)/$(TOP)
endif
endif
@ -240,7 +243,7 @@ libtcc.so: LDFLAGS+=-fPIC
# OSX dynamic libtcc library
libtcc.dylib: $(LIBTCC_OBJ)
$S$(CC) -shared -o $@ $^ $(LDFLAGS)
$S$(CC) -shared -install_name @rpath/$@ -o $@ $^ $(LDFLAGS)
# windows dynamic libtcc library
libtcc.dll : $(LIBTCC_OBJ)

View file

@ -62,6 +62,11 @@ ifeq ($(OS),Windows_NT) # for libtcc_test to find libtcc.dll
PATH := $(CURDIR)/$(TOP)$(if $(findstring ;,$(PATH)),;,:)$(PATH)
endif
ifdef CONFIG_OSX
LIBS += $(LINK_LIBTCC)
endif
ifeq ($(ARCH),arm)
# tcctest refers to the alignment of functions, and with thumb mode
# the low bit of code addresses selects the mode, so the "alignment"