Skip to content

Commit

Permalink
[mac] Fix resolution of libhl.dylib when globally installed. (HaxeFou…
Browse files Browse the repository at this point in the history
  • Loading branch information
Apprentice-Alchemist authored Jan 31, 2024
1 parent 24184f4 commit c25d8a7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,12 @@ jobs:
haxe -hl src/_main.c -cp other/tests -main HelloWorld
make hlc
./hlc
# ensure the executable still works when installed globally
cp hello.hl /tmp
pushd /tmp
hl hello.hl
popd
;;
esac
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ HLFLAGS = -ldl
LIBEXT = so
LIBTURBOJPEG = -lturbojpeg

LHL_LINK_FLAGS =

PCRE_FLAGS = -I include/pcre -D HAVE_CONFIG_H -D PCRE2_CODE_UNIT_WIDTH=16

PCRE = include/pcre/pcre2_auto_possess.o include/pcre/pcre2_chartables.o include/pcre/pcre2_compile.o \
Expand Down Expand Up @@ -136,6 +138,9 @@ endif
CFLAGS += -arch $(ARCH)
LFLAGS += -arch $(ARCH)

LFLAGS += -rpath @executable_path -rpath $(INSTALL_LIB_DIR)
LIBFLAGS += -rpath @executable_path -rpath $(INSTALL_LIB_DIR)
LHL_LINK_FLAGS += -install_name @rpath/libhl.dylib
else

# Linux
Expand Down Expand Up @@ -189,7 +194,7 @@ src/std/regexp.o: src/std/regexp.c
${CC} ${CFLAGS} -o $@ -c $< ${PCRE_FLAGS}

libhl: ${LIB}
${CC} ${CFLAGS} -o libhl.$(LIBEXT) -m${MARCH} ${LIBFLAGS} -shared ${LIB} -lpthread -lm
${CC} ${CFLAGS} -o libhl.$(LIBEXT) -m${MARCH} ${LIBFLAGS} ${LHL_LINK_FLAGS} -shared ${LIB} -lpthread -lm

hlc: ${BOOT}
${CC} ${CFLAGS} -o hlc ${BOOT} ${LFLAGS} ${EXTRA_LFLAGS}
Expand Down

0 comments on commit c25d8a7

Please sign in to comment.