summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/symbian/sis_targets.prf
blob: f3452b70911c10dc3e21cb3f4448f57db5d83d5b (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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# Sis file creation
GENERATE_SIS_TARGETS = false

contains(TEMPLATE, app): GENERATE_SIS_TARGETS = true
else:!equals(DEPLOYMENT, default_deployment) {
    for(dep_item, $$list($$DEPLOYMENT)) {
        ### Qt 5: remove .sources, inconsistent with INSTALLS
        dep_item_sources = $$eval($${dep_item}.files) $$eval($${dep_item}.sources)
        !isEmpty(dep_item_sources): GENERATE_SIS_TARGETS = true
    }
}

equals(GENERATE_SIS_TARGETS, true) {

    baseTarget = $$symbianRemoveSpecialCharacters($$basename(TARGET))
    template_pkg_target.target = $${baseTarget}_template.pkg
    template_pkg_target.depends += $$_PRO_FILE_
    template_pkg_target.commands = $(MAKE) -f $(MAKEFILE) qmake
    installer_pkg_target.target = $${baseTarget}_installer.pkg
    installer_pkg_target.depends += $$_PRO_FILE_
    installer_pkg_target.commands = $(MAKE) -f $(MAKEFILE) qmake
    stub_pkg_target.target = $${baseTarget}_stub.pkg
    stub_pkg_target.depends += $$_PRO_FILE_
    stub_pkg_target.commands = $(MAKE) -f $(MAKEFILE) qmake
    QMAKE_EXTRA_TARGETS += template_pkg_target installer_pkg_target stub_pkg_target

    qtPrepareTool(QMAKE_CREATEPACKAGE, createpackage)

    sis_objects_dir = $$OBJECTS_DIR
    isEmpty(sis_objects_dir):sis_objects_dir = .

    CREATEPACKAGE_DIR = $$sis_objects_dir/createpackage_tmp

    QMAKE_CLEAN += $$CREATEPACKAGE_DIR/*

    symbian-abld|symbian-sbsv2 {
        symbian-sbsv2 {
            CONVERT_GCCE_PARAM = -g
        } else {
            CONVERT_GCCE_PARAM =
        }
        
        make_cache_name = .make.cache
        sis_target.target = sis
        sis_target.commands = $(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 \
                                  ) \
                              )

        sis_target.depends += $${baseTarget}_template.pkg

        ok_sis_target.target = ok_sis
        ok_sis_target.commands = $$QMAKE_CREATEPACKAGE $$CONVERT_GCCE_PARAM -t $$CREATEPACKAGE_DIR $(QT_SIS_OPTIONS) $${baseTarget}_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 $$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 \
                                          ) \
                                      )

        unsigned_sis_target.depends += $${baseTarget}_template.pkg

        ok_unsigned_sis_target.target = ok_unsigned_sis
        ok_unsigned_sis_target.commands = $$QMAKE_CREATEPACKAGE $$CONVERT_GCCE_PARAM -t $$CREATEPACKAGE_DIR $(QT_SIS_OPTIONS) -o $${baseTarget}_template.pkg $(QT_SIS_TARGET)

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

        # The installer_sis target has dependency to sis target, so it will regenerate sis package.
        # To create smart installer wrapper for for an existing sis package, use ok_installer_sis target directly.
        installer_sis_target.target = installer_sis
        installer_sis_target.commands = $(MAKE) -f $(MAKEFILE) ok_installer_sis
        installer_sis_target.depends = $${baseTarget}_installer.pkg sis

        ok_installer_sis_target.target = ok_installer_sis
        ok_installer_sis_target.commands = $$QMAKE_CREATEPACKAGE -t $$CREATEPACKAGE_DIR $(QT_SIS_OPTIONS) $${baseTarget}_installer.pkg - \
                                               $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)
        ok_installer_sis_target.depends = $${baseTarget}_installer.pkg

        unsigned_installer_sis_target.target = unsigned_installer_sis
        unsigned_installer_sis_target.commands = $(MAKE) -f $(MAKEFILE) ok_unsigned_installer_sis
        unsigned_installer_sis_target.depends = $${baseTarget}_installer.pkg unsigned_sis

        ok_unsigned_installer_sis_target.target = ok_unsigned_installer_sis
        ok_unsigned_installer_sis_target.commands = $$QMAKE_CREATEPACKAGE -t $$CREATEPACKAGE_DIR $(QT_SIS_OPTIONS) -o $${baseTarget}_installer.pkg
        ok_unsigned_installer_sis_target.depends = $${baseTarget}_installer.pkg

        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 $$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 \
                                       ) \
                                   )

        stub_sis_target.depends += $${baseTarget}_stub.pkg

        ok_stub_sis_target.target = ok_stub_sis
        ok_stub_sis_target.commands = $$QMAKE_CREATEPACKAGE -t $$CREATEPACKAGE_DIR -s $(QT_SIS_OPTIONS) $${baseTarget}_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 \
                               unsigned_installer_sis_target \
                               ok_unsigned_installer_sis_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 QT_SIS_TARGET ?= $(QT_SIS_TARGET) >> $$make_cache_name

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

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

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

        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 = $(MAKE) -f $(MAKEFILE) ok_installer_sis
        installer_sis_target.depends = $${baseTarget}_installer.pkg sis

        ok_installer_sis_target.target = ok_installer_sis
        ok_installer_sis_target.commands = $$QMAKE_CREATEPACKAGE -t $$CREATEPACKAGE_DIR $(QT_SIS_OPTIONS) $${baseTarget}_installer.pkg - \
                                            $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)
        ok_installer_sis_target.depends = $${baseTarget}_installer.pkg

        unsigned_installer_sis_target.target = unsigned_installer_sis
        unsigned_installer_sis_target.commands = $$QMAKE_CREATEPACKAGE -t $$CREATEPACKAGE_DIR $(QT_SIS_OPTIONS) -o $${baseTarget}_installer.pkg
        unsigned_installer_sis_target.depends = $${baseTarget}_installer.pkg unsigned_sis

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

        QMAKE_EXTRA_TARGETS += sis_target \
                               unsigned_sis_target \
                               target_sis_target \
                               installer_sis_target \
                               ok_installer_sis_target \
                               unsigned_installer_sis_target

        QMAKE_DISTCLEAN += $${sis_destdir}/$${baseTarget}.sis
    }

    deploy_target.target = deploy
    contains(QMAKE_HOST.os, "Windows") {
        deploy_target.depends = sis
        deploy_target.commands = call $$target_sis_target.target
    } else {
        deploy_target.commands = @echo Deployment not supported in this environment
    }
    QMAKE_EXTRA_TARGETS += deploy_target

} 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
    }
}