@@ -42,31 +42,42 @@ jobs:
4242 fi
4343
4444 cd "lua-5.4.6"
45- make clean
4645
47- # Build the object files with PIC
48- cd src
49- # First compile the library objects (exclude executables)
50- for f in l*.c; do
51- if [ "$f" != "lua.c" ] && [ "$f" != "luac.c" ]; then
52- gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX -fPIC -DLUA_BUILD_AS_DLL -c "$f"
53- fi
54- done
46+ # Create custom config
47+ cat > src/luaconf.h.new << 'EOF'
48+ #include "luaconf.h"
49+ #undef LUAI_FUNC
50+ #undef LUAI_DDEC
51+ #undef LUAI_DDEF
52+ #define LUAI_FUNC extern
53+ #define LUAI_DDEC(def) def
54+ #define LUAI_DDEF(def) def
55+ EOF
5556
56- # Create shared library with proper version script
57- echo "{ global: lua*; luaL*; luaopen*; local: *; };" > version.script
58- gcc -shared -o liblua5.4.so l*.o -lm -ldl -Wl,--version-script=version.script -Wl,-soname,liblua5.4.so
57+ # Backup original and replace with our version
58+ mv src/luaconf.h src/luaconf.h.orig
59+ mv src/luaconf.h.new src/luaconf.h
5960
60- # Test the library
61- nm -D liblua5.4.so | grep ' T ' || echo "No exported symbols found!"
62- ldd liblua5.4.so || echo "Library dependencies not found!"
61+ # Modify Makefile for shared library
62+ sed -i 's/MYCFLAGS=/MYCFLAGS=-fPIC /' src/Makefile
63+ sed -i 's/MYLDFLAGS=/MYLDFLAGS=-shared /' src/Makefile
64+ sed -i 's/ALL_T=/ALL_T= $(LUA_SO)/' src/Makefile
65+ sed -i 's/TO_BIN= lua luac/TO_BIN= liblua5.4.so/' src/Makefile
66+
67+ # Build
68+ make linux
6369
64- # Verify build output
70+ # Verify and copy
71+ cd src
6572 if [ ! -f liblua5.4.so ]; then
6673 echo "Build failed - library not found"
6774 exit 1
6875 fi
6976
77+ # Test the library
78+ nm -D liblua5.4.so | grep ' T ' || echo "No exported symbols found!"
79+ ldd liblua5.4.so || echo "Library dependencies not found!"
80+
7081 mkdir -p /work/artifacts
7182 cp liblua5.4.so /work/artifacts/
7283
0 commit comments