gtk-mac-bundler
gtk-mac-bundler copied to clipboard
Attempt to fix otool/gimp issue with a subdirs
Hello,
I found an issue with GIMP packaging.
To add GIMP plugins and all it dependencies i added such line to my bundle file:
<binary>${prefix}/lib/gimp/2.0/plug-ins/*</binary>
However, i found that otool is failing because it is called with not only files but also directories (GIMP has some plugins in subdirs). Also i found that depending on SDK version otool crashing, printing warnings or just exiting with a fatal message (last SDK). This PR filtering list to files-only
Just checking if item is a file isn't really sufficient: otool will choke on libtool .la files too, but there's no good way to check if an unspecified file is really a shared library, loadable module, or Mach-O executable.
So don't use a naked * as the glob, use *.so or *.dylib, or both in separate entries if necessary. You probably also want to say <binary recurse="True"> to traverse the subdirectories for the plugins.
the problem is that many plugins do not have extension (they are in fact normal binaries). I think that otool is not crashing on non-Mach-O files, just prints a warning, so it is not an issue.
Actually just checked:
Adding dir, otool stops early:
$ otool -L ~/tmp/ /bin/sh
/Library/Developer/CommandLineTools/usr/bin/objdump: '/Users/asamorukov/tmp/': Is a directory
Same for non-binary file, otool prints warning but works:
$ otool -L ~/tmp/sas.html /bin/sh
/Users/builder/tmp/sas.html: is not an object file
/bin/sh:
/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0)
So looks like this workaround is not perfect but good enough.
Thanks and sorry I forgot about this.