1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
Description: Using Debian packaged liblua instead of embedded one
This patch deactivate the usage of locally hosted liblua sources
and use the Debian packaged one instead.
Author: Philippe Thierry
Forwarded: not-needed
Last-Update: 2025-10-06
--- a/src/wsh/Makefile
+++ b/src/wsh/Makefile
@@ -7,21 +7,22 @@
# This file is licensed under MIT License.
#
-OBJLIB := ./lua/src/liblua.a ./openlibm/libopenlibm.a
-
#CFLAGS := -rdynamic -W -Wall -Wextra -O0 -mpreferred-stack-boundary=12 -mstackrealign -ggdb -g3 -Wno-unused-but-set-variable -Wno-unused-parameter -I./include -rdynamic -I../../include/ -I./luajit-2.0/src/ -Wl,-E -Wl,-z,now
#OBJLIB := ./luajit-2.0/src/libluajit.a ./openlibm/libopenlibm.a
+LUA_CFLAGS := $(shell pkg-config lua5.3 --cflags)
+LUA_LINK_FLAGS := $(shell pkg-config lua5.3 --libs)
+
+CFLAGS += $(LUA_CFLAGS)
+
all::
- cd openlibm && make CFLAGS="-fpie -fPIC"
- cd lua && make linux CFLAGS="-fpie -fPIC"
$(CC) $(CFLAGS) wsh.c -o wsh.o -c -fpie -fPIC -ldl -lreadline
$(CC) $(CFLAGS) wshmain.c -o wshmain.o -c -fpie -fPIC -ldl -lreadline
$(CC) $(CFLAGS) helper.c -o helper.o -c -fpie -fPIC
$(CC) $(CFLAGS) linenoise/linenoise.c -o linenoise.o -c -fpie -fPIC
$(CC) $(CFLAGS) wsh.o helper.o linenoise.o -shared -fPIC -o libwitch.so
ar cr libwitch.a wsh.o helper.o linenoise.o
- $(CC) $(CFLAGS) wsh.o helper.o linenoise.o wshmain.o -o wsh -Wl,-T -Wl,script.lds -liberty $(OBJLIB) -ldl
+ $(CC) $(CFLAGS) wsh.o helper.o linenoise.o wshmain.o -o wsh -Wl,-T -Wl,script.lds -liberty -lm -ldl $(LUA_LINK_FLAGS)
cp wsh ../../bin/
@@ -30,13 +31,9 @@
clean::
rm wsh helper.o wsh.o wshmain.o libwitch.so libwitch.a linenoise.o learnwitch.log -f
- cd openlibm && make clean
- cd lua && make clean
cd tests && make clean
deepclean:
- cd openlibm && make clean
- cd lua && make clean
make clean
install::
|