You've already forked macports-ports
mirror of
https://github.com/macports/macports-ports.git
synced 2026-07-12 18:20:25 -07:00
9cebc9fc44
The upstream Makefiles do not support shared libraries.
Most package manages patch in support for shared libraries.
Also, many package managers support legacy versions of Lua.
Unfortunately, there is not consensus on what the naming conventions
of these components should be.
For example, FreeBSD installs
include/lua51 and
lib/liblua-5.1.so, while
Ubuntu installs
include/lua5.1 and
lib/liblua5.1.so.
See https://repology.org/project/lua/versions
We choose the Ubuntu convention in part because it simplifies code
such as `lau${...}`, where the variable can be an empty string.
For the time being, links maintain the old structure to
maintain compatibility.
38 lines
1.1 KiB
Diff
38 lines
1.1 KiB
Diff
--- src/Makefile.orig 2023-02-10 19:14:10
|
|
+++ src/Makefile 2023-02-11 01:27:02
|
|
@@ -44,7 +44,7 @@
|
|
LUAC_O= luac.o
|
|
|
|
ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
|
|
-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
|
|
+ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(MACPORTS_SHARED_LIB)
|
|
ALL_A= $(LUA_A)
|
|
|
|
# Targets start here.
|
|
@@ -56,15 +56,21 @@
|
|
|
|
a: $(ALL_A)
|
|
|
|
+%.dylib: $(BASE_O)
|
|
+ $(CC) -o $@ -dynamiclib $(LDFLAGS) $^ -install_name $(MACPORTS_PREFIX)/lib/$(MACPORTS_SHARED_LIB) -compatibility_version $(MACPORTS_BRANCH) -current_version $(MACPORTS_VERSION)
|
|
+
|
|
+%.so: $(BASE_O)
|
|
+ $(CC) -o $@ -shared $(LDFLAGS) $^ -ldl -lm -Wl,-soname,$(MACPORTS_SHARED_LIB)
|
|
+
|
|
$(LUA_A): $(BASE_O)
|
|
$(AR) $@ $(BASE_O)
|
|
$(RANLIB) $@
|
|
|
|
-$(LUA_T): $(LUA_O) $(LUA_A)
|
|
- $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
|
|
+$(LUA_T): $(LUA_O) $(MACPORTS_SHARED_LIB)
|
|
+ $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(MACPORTS_SHARED_LIB) $(LIBS)
|
|
|
|
-$(LUAC_T): $(LUAC_O) $(LUA_A)
|
|
- $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
|
|
+$(LUAC_T): $(LUAC_O) $(MACPORTS_SHARED_LIB)
|
|
+ $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(MACPORTS_SHARED_LIB) $(LIBS)
|
|
|
|
test:
|
|
./$(LUA_T) -v
|