For an application on OS X, the Info.plist file is very common. But could we embed it into the binaries?
Yes, we can. There is a compiler option “–sectcreate __TEXT __info_plist Info.plist”.
One example is the .pro file for qmlplugindump in qtdeclrative, change 4d173d5f16c103f640d4089feed44a74b14e9004.
1 2 3 4 5 6 7 |
mac { # Prevent qmlplugindump from popping up in the dock when launched. # We embed the Info.plist file, so the application doesn't need to # be a bundle. QMAKE_LFLAGS += -sectcreate __TEXT __info_plist $$shell_quote($$PWD/Info.plist) CONFIG -= app_bundle } |
I learned it from ariya‘s commit in phantomjs: 71425850f61ad85e33741ed5a59364327532f6a8.
1 2 3 4 5 6 7 |
mac { QMAKE_CXXFLAGS += -fvisibility=hidden QMAKE_LFLAGS += '-sectcreate __TEXT __info_plist Info.plist' CONFIG -= app_bundle # Uncomment to build a Mac OS X Universal Binary (i.e. x86 + ppc) # CONFIG += x86 ppc } |
And today I read an article: Gimmedebugah: how to embedded a Info.plist into arbitrary binaries, which also mentioned this. And it gives me the Apple documentation for that, Code Signing Tasks: Adding an Info.plist to Single-File Tools.