Skip to content

Commit

Permalink
Merge pull request #388 from r-lib/fix/strip-linux
Browse files Browse the repository at this point in the history
Strip shared lib on Linux, if $_R_SHLIB_STRIP_=true
  • Loading branch information
gaborcsardi authored Aug 23, 2024
2 parents d6a81d9 + b0a2a3e commit 3cbce84
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Makevars
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ OBJECTS = init.o poll.o errors.o processx-connection.o \
unix/processx.o unix/sigchld.o unix/utils.o \
unix/named_pipe.o cleancall.o

.PHONY: all clean
all: tools/px tools/sock supervisor/supervisor client$(SHLIB_EXT) $(SHLIB) strip

all: tools/px tools/sock supervisor/supervisor client$(SHLIB_EXT) $(SHLIB)
strip: $(SHLIB) tools/px tools/sock supervisor/supervisor client$(SHLIB_EXT)
@if which strip >/dev/null && which uname >/dev/null && test "`uname`" = "Linux" && test "$$_R_SHLIB_STRIP_" = "true" && test -n "$$R_STRIP_SHARED_LIB"; then \
echo stripping $(SHLIB) tools/px tools/sock supervisor/supervisor client$(SHLIB_EXT); \
echo $$R_STRIP_SHARED_LIB $(SHLIB) tools/px tools/sock supervisor/supervisor client$(SHLIB_EXT); \
$$R_STRIP_SHARED_LIB $(SHLIB) tools/px tools/sock supervisor/supervisor client$(SHLIB_EXT); \
fi

.PHONY: all clean strip

tools/px: tools/px.c
$(CC) $(CFLAGS) $(LDFLAGS) -Wall tools/px.c -o tools/px
Expand All @@ -25,7 +32,7 @@ CLIENT_OBJECTS = base64.o client.o errors.o
client$(SHLIB_EXT): $(CLIENT_OBJECTS)
$(SHLIB_LINK) -o client$(SHLIB_EXT) $(CLIENT_OBJECTS) $(PKG_LIBS) \
$(SHLIB_LIBADD) $(LIBR)
if [ -n "${PROCESSX_UNLINK_R}" ]; then \
@if [ -n "${PROCESSX_UNLINK_R}" ]; then \
echo Removing libR.so dependency from client.so; \
patchelf --remove-needed libR.so client$(SHLIB_EXT); \
fi
Expand Down

0 comments on commit 3cbce84

Please sign in to comment.