1
0
Fork 0
mirror of https://git.freebsd.org/ports.git synced 2025-07-09 05:19:16 -04:00
ports/lang/lua/files/patch-src-Makefile
Matthias Andree 03b1cffca7 Link lua .so + program with pthread to prevent hangs in extensions that
use pthreads.

Bump PORTREVISION to pull this in.

PR:		ports/181052
Submitted by:	Vitaly Magerya <vmagerya@gmail.com>
Approved by:	mandree@ on behalf of lua@
2013-08-05 20:37:35 +00:00

44 lines
888 B
Text

--- Makefile.orig 2012-02-13 22:41:22.000000000 +0200
+++ Makefile 2013-08-05 15:56:32.000000000 +0300
@@ -9,10 +9,11 @@
CC= gcc
CFLAGS= -O2 -Wall $(MYCFLAGS)
-AR= ar rcu
+ARFLAGS= rcu
+AR= ar
RANLIB= ranlib
RM= rm -f
-LIBS= -lm $(MYLIBS)
+LIBS= -lm -pthread $(MYLIBS)
MYCFLAGS=
MYLDFLAGS=
@@ -31,12 +32,13 @@
LUA_T= lua
LUA_O= lua.o
+LUA_SO= liblua.so
LUAC_T= luac
LUAC_O= luac.o print.o
ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
+ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
ALL_A= $(LUA_A)
default: $(PLAT)
@@ -47,8 +49,11 @@
a: $(ALL_A)
+$(LUA_SO): $(CORE_O) $(LIB_O)
+ $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(MYLDFLAGS) -shared -Wl,-soname=$(LUA_SONAME) $?
+
$(LUA_A): $(CORE_O) $(LIB_O)
- $(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files
+ $(AR) $(ARFLAGS) $@ $?
$(RANLIB) $@
$(LUA_T): $(LUA_O) $(LUA_A)