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
parent a45d12d4c3
commit 1151a217b5
1 changed files with 4 additions and 0 deletions

View File

@ -1361,6 +1361,10 @@ dir_has_arch_binaries() {
# look for static *.a
[ -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
}