summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorBoris Nagaev <bnagaev@gmail.com>2015-09-06 12:52:53 (GMT)
committerBoris Nagaev <bnagaev@gmail.com>2015-09-16 20:00:34 (GMT)
commita8ccc4d3c60679cf060546e4c8e2f01812f68be1 (patch)
treeaaea6d67220bba69e59d33573d29419361eeed9b /tools
parent6dda14dd0b3a2c18f2869aaf0eb47d9c8ddc84ef (diff)
downloadmxe-a8ccc4d3c60679cf060546e4c8e2f01812f68be1.zip
mxe-a8ccc4d3c60679cf060546e4c8e2f01812f68be1.tar.gz
mxe-a8ccc4d3c60679cf060546e4c8e2f01812f68be1.tar.bz2
build-pkg: catch symlinks with bad extensions
Example: usr/i686-w64-mingw32.static/bin/luajit This file must have '.exe' in name, but build-pkg doesn't catch this error, because it's type was "symbolic link to luajit-2.0.4". With option --dereference, "file" follows symlinks. For usr/i686-w64-mingw32.static/bin/luajit it returns "PE32 executable (console) Intel 80386 (stripped to external PDB), for MS Windows".
Diffstat (limited to 'tools')
-rwxr-xr-xtools/build-pkg.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/build-pkg.lua b/tools/build-pkg.lua
index a5647fe..7b7114d 100755
--- a/tools/build-pkg.lua
+++ b/tools/build-pkg.lua
@@ -282,19 +282,19 @@ end
local function checkFile(file, pkg)
-- if it is PE32 file, it must have '.exe' in name
local ext = file:sub(-4):lower()
- local file_type0 = trim(shell(('file %q'):format(file)))
+ local cmd = 'file --dereference %q'
+ local file_type0 = trim(shell(cmd:format(file)))
local file_type = file_type0:match('^[^:]+: (.*)$')
if file_type then
- local symlink = file_type:match('symbolic link')
if ext == '.bin' then
-- can be an executable or something else (font)
elseif ext == '.exe' then
- if not file_type:match('PE32') and not symlink then
+ if not file_type:match('PE32') then
log('File %s (%s) is %q. Remove .exe',
file, pkg, file_type)
end
elseif ext == '.dll' then
- if not file_type:match('PE32.*DLL') and not symlink then
+ if not file_type:match('PE32.*DLL') then
log('File %s (%s) is %q. Remove .dll',
file, pkg, file_type)
end