Skip to content

Commit d695bab

Browse files
committed
fix: Makefile for hidden symbols of dependency libraries
1 parent 29e5981 commit d695bab

File tree

3 files changed

+18
-26
lines changed

3 files changed

+18
-26
lines changed

Makefile

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ GRAPH_LUA_SRC = init.lua contour.lua
3535

3636
LUA_PATH = $(DEST_PREFIX)/share/lua/$(LUA_VERSION)
3737
LUA_DLLPATH = $(DEST_PREFIX)/lib/lua/$(LUA_VERSION)
38-
WIN_INSTALL_DIR = windows_build
3938

4039
all:
4140
$(MAKE) -C src
@@ -47,24 +46,7 @@ install:
4746
$(MAKE) -C src
4847
mkdir -p $(LUA_PATH)/graph
4948
mkdir -p $(LUA_DLLPATH)
50-
cp src/libgraphcore.so $(LUA_DLLPATH)/graphcore.so
49+
cp src/graphcore.so $(LUA_DLLPATH)/graphcore.so
5150
cp $(GRAPH_LUA_SRC) $(LUA_PATH)/graph
5251

53-
arch:
54-
@mkdir -p ${LUA_PATH}/graph
55-
@install -m 755 -d ${LUA_PATH}/graph
56-
@install -m 755 ${GRAPH_LUA_SRC} ${LUA_PATH}/graph
57-
@mkdir -p ${LUA_DLLPATH}
58-
@install -m 755 -d ${LUA_DLLPATH}
59-
@install -m 755 src/libgraphcore.so ${LUA_DLLPATH}/graphcore.so
60-
61-
win_install:
62-
$(MAKE) -C src
63-
mkdir -p $(WIN_INSTALL_DIR)
64-
mkdir -p $(WIN_INSTALL_DIR)/lua
65-
mkdir -p $(WIN_INSTALL_DIR)/lua/graph
66-
cp src/graphcore.dll $(WIN_INSTALL_DIR)
67-
cp $(GRAPH_LUA_SRC) $(WIN_INSTALL_DIR)/lua/graph
68-
cp -r examples $(WIN_INSTALL_DIR)
69-
70-
.PHONY: clean all install win_install
52+
.PHONY: clean all install

src/Makefile

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ PTHREAD_DEFS += -pthread
7171
PTHREAD_LIBS = -lpthread
7272

7373
INCLUDES += $(LUA_INCLUDES) $(FREETYPE_INCLUDES) $(AGG_INCLUDES)
74-
LIBS += $(FREETYPE_LIBS) $(AGG_LIBS) $(LUA_LIBS) $(PTHREAD_LIBS)
74+
LIBS += $(FREETYPE_LIBS) $(AGG_LIBS) $(LUA_LIBS) $(PTHREAD_LIBS) $(CPP_SUP_LIBS)
7575
DEFS += $(PTHREAD_DEFS)
7676

7777
ifeq ($(strip $(LUA)),lua5.4)
@@ -81,7 +81,8 @@ endif
8181
ifeq ($(HOST_SYS),Windows)
8282
DYNCC = $(CC)
8383
DYNCXX = $(CXX)
84-
DLLINK = $(CC) -shared -fvisibility=hidden
84+
DLLINK = $(CC) -shared
85+
LDFLAGS += -fvisibility=hidden
8586

8687
DISPLAY_SUFFIX = win32
8788
LIBGRAPH_SO = graphcore.dll
@@ -94,10 +95,17 @@ else
9495

9596
DYNCC = $(CC) -fPIC
9697
DYNCXX = $(CXX) -fPIC
97-
DLLINK = $(CC) -shared -fvisibility=hidden
98+
DLLINK = $(CC) -shared
99+
LDFLAGS += -fvisibility=hidden
100+
101+
ifeq ($(HOST_SYS),Linux)
102+
# See: https://stackoverflow.com/questions/2222162/how-to-apply-fvisibility-option-to-symbols-in-static-libraries
103+
# The following flag is to consider hidden all the symbols defined in static libraries we use
104+
# to link the shared library.
105+
LDFLAGS += -Wl,--exclude-libs,ALL
106+
endif
98107

99108
ifeq ($(HOST_SYS),Darwin)
100-
LINK_EXE = $(CXX) $(LDFLAGS)
101109
LDFLAGS += -Wl,-E
102110
endif
103111

@@ -145,7 +153,7 @@ endif
145153
all: $(TARGETS)
146154

147155
$(LIBGRAPH_SO): $(PLOT_OBJ_FILES)
148-
$(DLLINK) $(PLOT_OBJ_FILES) -o $@ $(LIBS) -lsupc++
156+
$(DLLINK) $(LDFLAGS) $(PLOT_OBJ_FILES) -o $@ $(LIBS)
149157
strip --strip-unneeded $@
150158

151159
$(LIBGRAPH_A): $(PLOT_OBJ_FILES)

src/makeconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ DISABLE_GAMMA_CORR = no
44
# set this to "yes" if you want to disable subpixel LCD antialiasing
55
DISABLE_SUBPIXEL_LCD = no
66

7-
# Can be "luajit" or "lua5.1" to use a specific Lua implementation.
7+
# Can be "luajit", "lua5.4" "lua5.1" to use a specific Lua implementation.
88
LUA = lua5.4
9+
10+
# vill me used to decide where to install the modules under share/lua
911
LUA_VERSION = 5.4
1012

1113
DEBUG = no

0 commit comments

Comments
 (0)