Skip to content

Commit 7b9d582

Browse files
committed
try this cursed lua fuckery
1 parent 9d347c9 commit 7b9d582

File tree

2 files changed

+9
-19
lines changed

2 files changed

+9
-19
lines changed

.github/workflows/build-lua.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,20 @@ jobs:
4646
4747
# Build the object files with PIC
4848
cd src
49-
# Exclude lua.c and luac.c which contain main()
49+
# First compile the library objects (exclude executables)
5050
for f in l*.c; do
5151
if [ "$f" != "lua.c" ] && [ "$f" != "luac.c" ]; then
52-
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX -fPIC -c "$f"
52+
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX -fPIC -DLUA_BUILD_AS_DLL -c "$f"
5353
fi
5454
done
5555
56-
# Create shared library directly (without lua.o and luac.o)
57-
gcc -shared -o liblua5.4.so l*.o -lm -ldl
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
59+
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!"
5863
5964
# Verify build output
6065
if [ ! -f liblua5.4.so ]; then

tools/build.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -88,25 +88,10 @@
8888
elif CI and sys.platform.startswith('linux'):
8989
# For CI Linux builds, Lua library should already be in dist/unzipped
9090
lua_library = f"{library_prefix}lua5.4{library_extension}"
91-
print(f"Working directory: {working_dir}")
92-
print(f"Looking for Lua library: {lua_library}")
93-
94-
# List contents of working directory
95-
print("Contents of working directory:")
96-
for item in os.listdir(working_dir):
97-
print(f" {item}")
9891

9992
# Check to-copy directory
10093
to_copy_path = os.path.join(working_dir, "to-copy")
10194
lua_path = os.path.join(to_copy_path, lua_library)
102-
print(f"Checking for Lua at: {lua_path}")
103-
104-
if os.path.exists(to_copy_path):
105-
print("Contents of to-copy directory:")
106-
for item in os.listdir(to_copy_path):
107-
print(f" {item}")
108-
else:
109-
print("to-copy directory does not exist!")
11095

11196
if not os.path.exists(lua_path):
11297
print("Error: Steam Runtime Lua library not found")

0 commit comments

Comments
 (0)