Sign a Framework for OSX 10.9

前端 未结 6 2111
悲哀的现实
悲哀的现实 2020-12-05 08:24

After using macdeployqt I sign my application to avoid Gatekeeper problems.

I can use codesign on all the frameworks and everything inside

6条回答
  •  -上瘾入骨i
    2020-12-05 08:35

    I use this script to correct the QT 4.8 frameworks before codesigning. Hope this helps. It took me and a coworker about 3-4 days to figure this out (this was before the blog post by QT).

    # we need to massage qt frameworks so they get codesigned by the new codesign
    # more information about this $#@$!@# piece of $@#$@$!
    # http://blog.qt.digia.com/blog/2014/10/29/an-update-on-os-x-code-signing/
    
    QT_LIB_DIR=$(qmake -query QT_INSTALL_LIBS)
    for i in $(find "$APP/Contents/Frameworks/" -name Qt\*.framework); do
       FW_NAME=$(basename "$i")
       FW_SHORTNAME=$(basename -s ".framework" "$i")
       mv "$i/Resources" "$i/Versions/4"
       ln -s Versions/Current/Resources "$i/"
       ln -s Versions/Current/${FW_SHORTNAME} "$i/${FW_SHORTNAME}"
       ln -s 4 "$i/Versions/Current"
       cp "${QT_LIB_DIR}/${FW_NAME}/Contents/Info.plist" "$i/Resources"
       chmod u+w "$i/Resources/Info.plist"
       # now comes the real magic, we have to add CFBundleIdentifier and CFBundleVersion to the Info.plist
       awk "/<\/dict>/{print \"CFBundleIdentifier\norg.qt-project.${FW_SHORTNAME}\"}1" "$i/Resources/Info.plist" > "$i/Resources/Info.plist.tmp"
       mv "$i/Resources/Info.plist.tmp" "$i/Resources/Info.plist"
       awk '/<\/dict>/{print "CFBundleVersion\n4.8"}1' "$i/Resources/Info.plist" > "$i/Resources/Info.plist.tmp"
       mv "$i/Resources/Info.plist.tmp" "$i/Resources/Info.plist"
    done
    

提交回复
热议问题