abuild: detect precompiled lua files

Precompiled lua files aren't portable between word sizes and byte order.
This commit is contained in:
Sertonix 2024-04-26 16:42:47 +02:00 committed by Natanael Copa
parent 2ea6d3c734
commit 88fab9f624
1 changed files with 4 additions and 0 deletions

View File

@ -1351,6 +1351,10 @@ dir_has_arch_binaries() {
# look for static *.a # look for static *.a
[ -n "$(find "$dir" -type f -name '*.a' | head -n 1)" ] && return 0 [ -n "$(find "$dir" -type f -name '*.a' | head -n 1)" ] && return 0
# look for precompiled lua files (luac: 0x1b Lua; luajit: 0x1b LJ)
find "$dir" -type f \( -name '*.lua' -o -name '*.luac' \) -exec od -N 4 -A n -t x4 -- {} \; |
grep -q -E -e '(6175|4a)4c1b$' && return 0
return 1 return 1
} }