summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/sis_targets.prf
blob: c31e38fe092ff9f24e6f31e4bff8e5c3718bfa55 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# Sis file creation
GENERATE_SIS_TARGETS = false

contains(TEMPLATE, app): GENERATE_SIS_TARGETS = true
else:!equals(DEPLOYMENT, default_deployment) {
    for(dep_item, $$list($$DEPLOYMENT)) {
        dep_item_sources = $$eval($${dep_item}.sources)
        !isEmpty(dep_item_sources): GENERATE_SIS_TARGETS = true
    }
}

equals(GENERATE_SIS_TARGETS, true) {
    symbian-abld|symbian-sbsv2 {
        sis_destdir =
        make_cache_name = .make.cache
        sis_target.target = sis
        sis_target.commands = $(if $(wildcard $$basename(TARGET)_template.pkg), \
                                  $(if $(wildcard $$make_cache_name), \
                                      $(MAKE) -f $(MAKEFILE) ok_sis MAKEFILES=$$make_cache_name \
                                  , \
                                      $(if $(QT_SIS_TARGET), \
                                          $(MAKE) -f $(MAKEFILE) ok_sis \
                                      , \
                                          $(MAKE) -f $(MAKEFILE) fail_sis_nocache \
                                      ) \
                                  ) \
                              , \
                                  $(MAKE) -f $(MAKEFILE) fail_sis_nopkg \
                              )

        ok_sis_target.target = ok_sis
        ok_sis_target.commands = createpackage.bat $(QT_SIS_OPTIONS) $$basename(TARGET)_template.pkg \
                                     $(QT_SIS_TARGET) $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)

        unsigned_sis_target.target = unsigned_sis
        unsigned_sis_target.commands = $(if $(wildcard $$basename(TARGET)_template.pkg), \
                                  $(if $(wildcard $$make_cache_name), \
                                      $(MAKE) -f $(MAKEFILE) ok_unsigned_sis MAKEFILES=$$make_cache_name \
                                  , \
                                      $(if $(QT_SIS_TARGET), \
                                          $(MAKE) -f $(MAKEFILE) ok_unsigned_sis \
                                      , \
                                          $(MAKE) -f $(MAKEFILE) fail_sis_nocache \
                                      ) \
                                  ) \
                              , \
                                  $(MAKE) -f $(MAKEFILE) fail_sis_nopkg \
                              )

        ok_unsigned_sis_target.target = ok_unsigned_sis
        ok_unsigned_sis_target.commands = createpackage.bat $(QT_SIS_OPTIONS) -o $$basename(TARGET)_template.pkg $(QT_SIS_TARGET)

        target_sis_target.target = $${sis_destdir}$${TARGET}.sis
        target_sis_target.commands = $(MAKE) -f $(MAKEFILE) sis

        installer_sis_target.target = installer_sis
        installer_sis_target.commands = $(if $(wildcard $$basename(TARGET)_installer.pkg), \
                                            $(MAKE) -f $(MAKEFILE) ok_installer_sis \
                                        , \
                                            $(MAKE) -f $(MAKEFILE) fail_sis_nopkg \
                                        )
        installer_sis_target.depends = $${sis_destdir}$${TARGET}.sis

        ok_installer_sis_target.target = ok_installer_sis
        ok_installer_sis_target.commands = createpackage.bat $(QT_SIS_OPTIONS) $$basename(TARGET)_installer.pkg - \
                                               $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)

        fail_sis_nopkg_target.target = fail_sis_nopkg
        fail_sis_nopkg_target.commands = "$(error PKG file does not exist, 'sis' and 'installer_sis' target are only supported for executables or projects with DEPLOYMENT statement)"

        fail_sis_nocache_target.target = fail_sis_nocache
        fail_sis_nocache_target.commands = "$(error Project has to be built or QT_SIS_TARGET environment variable has to be set before calling 'SIS' target)"

        stub_sis_target.target = stub_sis
        stub_sis_target.commands = $(if $(wildcard $$basename(TARGET)_template.pkg), \
                                       $(if $(wildcard $$make_cache_name), \
                                           $(MAKE) -f $(MAKEFILE) ok_stub_sis MAKEFILES=$$make_cache_name \
                                       , \
                                           $(if $(QT_SIS_TARGET), \
                                               $(MAKE) -f $(MAKEFILE) ok_stub_sis \
                                           , \
                                               $(MAKE) -f $(MAKEFILE) fail_sis_nocache \
                                           ) \
                                       ) \
                                   , \
                                       $(MAKE) -f $(MAKEFILE) fail_sis_nopkg \
                                   )

        ok_stub_sis_target.target = ok_stub_sis
        ok_stub_sis_target.commands = createpackage.bat -s $(QT_SIS_OPTIONS) $$basename(TARGET)_stub.pkg \
                                          $(QT_SIS_TARGET) $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)

        QMAKE_EXTRA_TARGETS += sis_target \
                               ok_sis_target \
                               unsigned_sis_target \
                               ok_unsigned_sis_target \
                               target_sis_target \
                               installer_sis_target \
                               ok_installer_sis_target \
                               fail_sis_nopkg_target \
                               fail_sis_nocache_target \
                               stub_sis_target \
                               ok_stub_sis_target
        # Sbsv2 has its own store_build target which is using flms.
        !symbian-sbsv2 {
            contains(QMAKE_HOST.os, "Windows") {
                shellFixedHash = $${LITERAL_HASH}
            } else {
                shellFixedHash = \\$${LITERAL_HASH}
            }
            store_build_target.target = store_build
            store_build_target.commands = \
                  @echo $${shellFixedHash} ============================================================================== > $$make_cache_name \
                && echo $${shellFixedHash}   This file is generated by make and should not be modified by the user >> $$make_cache_name \
                && echo $${shellFixedHash}  Name        : $$make_cache_name >> $$make_cache_name \
                && echo $${shellFixedHash}  Part of     : lineedits >> $$make_cache_name \
                && echo $${shellFixedHash}  Description : This file is used to cache last build target for >> $$make_cache_name \
                && echo $${shellFixedHash}                make sis target. >> $$make_cache_name \
                && echo $${shellFixedHash}  Version     :  >> $$make_cache_name \
                && echo $${shellFixedHash} >> $$make_cache_name \
                && echo $${shellFixedHash} ============================================================================== >> $$make_cache_name \
                && echo. >> $$make_cache_name \
                && echo QT_SIS_TARGET ?= $(QT_SIS_TARGET) >> $$make_cache_name

            QMAKE_EXTRA_TARGETS += store_build_target
        }
    } else {
        sis_destdir = $$DESTDIR
        isEmpty(sis_destdir):sis_destdir = .
        baseTarget = $$basename(TARGET)
        !equals(TARGET, "$$baseTarget"):sis_destdir = $$sis_destdir/$$dirname(TARGET)

        sis_target.target = sis
        sis_target.commands = createpackage $(QT_SIS_OPTIONS) $${baseTarget}_template.pkg \
                                  - $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)
        sis_target.depends = first

        unsigned_sis_target.target = unsigned_sis
        unsigned_sis_target.commands = createpackage $(QT_SIS_OPTIONS) -o $${baseTarget}_template.pkg
        unsigned_sis_target.depends = first

        target_sis_target.target = $${sis_destdir}/$${baseTarget}.sis
        target_sis_target.commands = $(MAKE) -f $(MAKEFILE) sis

        installer_sis_target.target = installer_sis
        installer_sis_target.commands = createpackage $(QT_SIS_OPTIONS) $${baseTarget}_installer.pkg - \
                                            $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)
        installer_sis_target.depends = $${sis_destdir}/$${baseTarget}.sis

        !isEmpty(sis_destdir):!equals(sis_destdir, "."):!equals(sis_destdir, "./") {
            sis_target.commands += && $$QMAKE_MOVE $${baseTarget}.sis $$sis_destdir
            installer_sis_target.commands += && $$QMAKE_MOVE $${baseTarget}.sis $$sis_destdir
        }

        QMAKE_EXTRA_TARGETS += sis_target \
                               unsigned_sis_target \
                               target_sis_target \
                               installer_sis_target

        QMAKE_DISTCLEAN += $${sis_destdir}/$${baseTarget}.sis
    }
} else {
    contains(TEMPLATE, subdirs) {
        # Enable recursive sis target.
        sis_target.CONFIG = recursive
        sis_target.recurse = $$SUBDIRS
    } else {
        # Make sure we build everything, since other sis targets in a recursive invocation
        # may depend on them, even if this one is empty.
        # In abld/sbsv2, we assume that subdir has been built already, as all builds are recursive.
        !symbian-abld:!symbian-sbsv2: sis_target.depends = first
    }
    sis_target.commands =
    sis_target.target = sis
    QMAKE_EXTRA_TARGETS += sis_target

    symbian-abld {
        # Create dummy store_build target to avoid errors from .mk callbacks during build
        store_build_target.target = store_build
        QMAKE_EXTRA_TARGETS += store_build_target
    }
}