Skip to content

Commit 8ccde24

Browse files
authored
Use system build variables when building liblua52.so (#517)
Related to #515, liblua52.so can be built using the system CFLAGS variable. I noticed when building/modifying the AUR package that running the build script only included `-fPIC`, and built using only `-O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX -fPIC`. This didn't compile using the debug options set by makepkg. Adding `${CFLAGS}` to MYCFLAGS in the build script allowed the library to compile with those symbols, as well as other security mitigations. SYSCFLAGS is set explicitly in Lua's Makefile, so it's safer to change MYCFLAGS and MYLDFLAGS instead without patching.
2 parents f4c51fc + 354abdd commit 8ccde24

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Date:
3131
- Don't draw table intermediates as <1μ ingredients/products.
3232
Internal changes:
3333
- Enable mod-fixes for the data, data-updates, and data-final-fixes files.
34+
- Recompile the lua lib for linux (PR 515). The script now uses CFLAGS and LDFLAGS.
3435
----------------------------------------------------------------------------------------------------------------------
3536
Version: 2.14.0
3637
Date: June 15th 2025

lua/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Compiling liblua52.so
22

3-
Simply run `./build-linux.sh` to (re)build liblua52.so and copy it over to Yafc.
3+
Simply run `./build-linux.sh` to (re)build liblua52.so and copy it over to Yafc. The script will compile
4+
lua with your CFLAGS and LDFLAGS, so feel free to use them if you need debug symbols or security tweaks, for instance.
45

56
It will take the following steps
67
1. Download the source, if not available (from https://www.lua.org/ftp/)

lua/build-linux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ patch -p0 -i "liblua.so.patch" || exit 1
2828
patch -d "lua-5.2.1/src" -p1 -i "../../lua-5.2.1.patch" || exit 1
2929

3030
echo "Compiling Lua 5.2.1"
31-
make -C "lua-5.2.1" linux MYCFLAGS="-fPIC"
31+
make -C "lua-5.2.1" linux MYCFLAGS="-fPIC ${CFLAGS}" MYLDFLAGS="${LDFLAGS}"
3232

3333
echo "Copying liblua.so to Yafc"
3434
cp "lua-5.2.1/src/liblua.so.5.2.1" ../Yafc/lib/linux/liblua52.so

0 commit comments

Comments
 (0)