summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/permissions.prf
blob: ac5f2cb108f1ee01171c37d48fbec55c6e83df85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

isEmpty(QMAKE_INFO_PLIST): \
    return()

plist_path = $$absolute_path($$QMAKE_INFO_PLIST, $$_PRO_FILE_PWD_)

!exists($$plist_path): \
    return()

for(plugin, QT_PLUGINS) {
    !equals(QT_PLUGIN.$${plugin}.TYPE, permissions): \
        next()

    usage_descriptions = $$eval(QT_PLUGIN.$${plugin}.usage_descriptions)

    found_usage_description = false
    for(usage_description_key, usage_descriptions) {
        usage_description = $$system("/usr/libexec/PlistBuddy" \
            "-c 'print $$usage_description_key' $$plist_path 2>/dev/null", \
            singleLine, exit_code)

        !equals(exit_code, 0): \
            next()

        !isEmpty(usage_description) {
            found_usage_description = true
            break()
        }
    }

    !$$found_usage_description: \
        next()

    request_flag = $$eval(QT_PLUGIN.$${plugin}.request_flag)

    QTPLUGIN += $$plugin
    QMAKE_LFLAGS += $$request_flag

    QMAKE_INTERNAL_INCLUDED_FILES *= $$QMAKE_INFO_PLIST
}