File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
src/main/c/cext-trampoline Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -11,23 +11,32 @@ endif
11
11
# If that is the case and fails the build, it might be better to use instead:
12
12
# CC := $(GRAALVM_TOOLCHAIN_CC)
13
13
14
- # Same values as in RbConfig
14
+ # Similar values as in RbConfig
15
15
ifeq ($(OS ) ,Darwin)
16
- CC := clang -fdeclspec
16
+ CC := clang
17
+ CFLAGS := -fdeclspec -Wall -Werror -fPIC -std=c99 -g
17
18
else
18
19
CC := gcc
20
+ CFLAGS := -Wall -Werror -fPIC -std=c99 -g
19
21
endif
20
22
21
- CFLAGS := -Wall -Werror -fPIC -std=c99 -g
22
23
LDFLAGS :=
23
24
25
+ ifeq ($(OS ) ,Darwin)
26
+ # Set the install_name of libtrufflerubytrampoline on macOS, so mkmf executables linking to it
27
+ # will know they need to look at the rpath to find it.
28
+ LIBS := -Wl,-install_name,@rpath/libtrufflerubytrampoline.$(SOEXT )
29
+ else
30
+ LIBS :=
31
+ endif
32
+
24
33
ROOT := $(realpath ../../../..)
25
34
RUBY_HDR_DIR := $(ROOT ) /lib/cext/include
26
35
27
36
OBJECT_FILES := trampoline.o st.o strlcpy.o cext_constants.o
28
37
29
38
libtrufflerubytrampoline.$(SOEXT ) : $(OBJECT_FILES ) Makefile
30
- $(Q ) $(CC ) -shared $(LDFLAGS ) -o $@ $(OBJECT_FILES )
39
+ $(Q ) $(CC ) -shared $(LDFLAGS ) -o $@ $(OBJECT_FILES ) $( LIBS )
31
40
32
41
% .o : % .c Makefile
33
42
$(Q ) $(CC ) -o $@ -c $(CFLAGS ) $(LDFLAGS ) -I$(RUBY_HDR_DIR ) -I$(ROOT ) /lib/cext/include/stubs -I$(TRUFFLE_NFI_NATIVE_INCLUDE ) $<
You can’t perform that action at this time.
0 commit comments