-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.pro
348 lines (275 loc) · 8.62 KB
/
app.pro
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
NAME = yubikey
PREFIX = harbour
TARGET = $${PREFIX}-$${NAME}
CONFIG += sailfishapp link_pkgconfig
PKGCONFIG += sailfishapp mlite5 glib-2.0 gobject-2.0 gio-unix-2.0
QT += qml quick dbus multimedia concurrent
DEFINES += NFCDC_NEED_PEER_SERVICE=0
QMAKE_CXXFLAGS += -Wno-unused-parameter
QMAKE_CFLAGS += -Wno-unused-parameter
LIBS += -ldl
TARGET_DATA_DIR = /usr/share/$${TARGET}
app_settings {
# This path is hardcoded in jolla-settings
TRANSLATIONS_PATH = /usr/share/translations
} else {
TRANSLATIONS_PATH = $${TARGET_DATA_DIR}/translations
}
CONFIG(debug, debug|release) {
DEFINES += DEBUG HARBOUR_DEBUG
} else {
QMAKE_CXXFLAGS += -flto -fPIC
QMAKE_CFLAGS += -flto -fPIC
QMAKE_LFLAGS += -flto -fPIC
}
equals(QT_ARCH, arm64){
message(Linking with OpenSSL)
PKGCONFIG += libcrypto
}
# Directories
HARBOUR_LIB_DIR = $${_PRO_FILE_PWD_}/harbour-lib
LIBGLIBUTIL_DIR = $${_PRO_FILE_PWD_}/libglibutil
LIBGNFCDC_DIR = $${_PRO_FILE_PWD_}/libgnfcdc
LIBQNFCDC_DIR = $${_PRO_FILE_PWD_}/libqnfcdc
FOIL_DIR = $${_PRO_FILE_PWD_}/foil
ZBAR_DIR = $${_PRO_FILE_PWD_}/zbar/zbar
# Files
OTHER_FILES += \
harbour.yubikey.conf \
_harbour-yubikey.conf \
*.desktop \
qml/*.qml \
qml/images/*.svg \
qml/components/*.js \
qml/components/*.qml \
icons/*.svg \
translations/*.ts
# App
INCLUDEPATH += \
src
HEADERS += \
src/QrCodeDecoder.h \
src/QrCodeScanner.h \
src/YubiKey.h \
src/YubiKeyAuth.h \
src/YubiKeyAuthListModel.h \
src/YubiKeyCard.h \
src/YubiKeyCardSettings.h \
src/YubiKeyDefs.h \
src/YubiKeyConstants.h \
src/YubiKeyImportModel.h \
src/YubiKeyRecognizer.h \
src/YubiKeySettings.h \
src/YubiKeyTag.h \
src/YubiKeyToken.h \
src/YubiKeyTypes.h \
src/YubiKeyUtil.h
SOURCES += \
src/main.cpp \
src/QrCodeDecoder.cpp \
src/QrCodeScanner.cpp \
src/YubiKey.cpp \
src/YubiKeyAuth.cpp \
src/YubiKeyAuthListModel.cpp \
src/YubiKeyCard.cpp \
src/YubiKeyCardSettings.cpp \
src/YubiKeyImportModel.cpp \
src/YubiKeyRecognizer.cpp \
src/YubiKeyTag.cpp \
src/YubiKeyToken.cpp \
src/YubiKeySettings.cpp \
src/YubiKeyUtil.cpp
# libfoil
LIBFOIL_DIR = $${FOIL_DIR}/libfoil
LIBFOIL_INCLUDE = $${LIBFOIL_DIR}/include
LIBFOIL_SRC = $${LIBFOIL_DIR}/src
LIBFOIL_OPENSSL_SRC = $${LIBFOIL_SRC}/openssl
INCLUDEPATH += \
$${LIBFOIL_INCLUDE} \
$${LIBFOIL_SRC}
HEADERS += \
$${LIBFOIL_INCLUDE}/*.h
SOURCES += \
$${LIBFOIL_SRC}/foil_digest.c \
$${LIBFOIL_SRC}/foil_digest_sha1.c \
$${LIBFOIL_SRC}/foil_digest_sha256.c \
$${LIBFOIL_SRC}/foil_digest_sha512.c \
$${LIBFOIL_SRC}/foil_hmac.c \
$${LIBFOIL_SRC}/foil_input.c \
$${LIBFOIL_SRC}/foil_input_mem.c \
$${LIBFOIL_SRC}/foil_input_base64.c \
$${LIBFOIL_SRC}/foil_kdf.c \
$${LIBFOIL_SRC}/foil_output.c \
$${LIBFOIL_SRC}/foil_random.c \
$${LIBFOIL_SRC}/foil_util.c \
$${LIBFOIL_OPENSSL_SRC}/foil_openssl_digest_sha1.c \
$${LIBFOIL_OPENSSL_SRC}/foil_openssl_digest_sha256.c \
$${LIBFOIL_OPENSSL_SRC}/foil_openssl_digest_sha512.c \
$${LIBFOIL_OPENSSL_SRC}/foil_openssl_random.c
# libglibutil
LIBGLIBUTIL_SRC = $${LIBGLIBUTIL_DIR}/src
LIBGLIBUTIL_INCLUDE = $${LIBGLIBUTIL_DIR}/include
INCLUDEPATH += \
$${LIBGLIBUTIL_INCLUDE}
HEADERS += \
$${LIBGLIBUTIL_INCLUDE}/*.h
SOURCES += \
$${LIBGLIBUTIL_SRC}/gutil_log.c \
$${LIBGLIBUTIL_SRC}/gutil_misc.c \
$${LIBGLIBUTIL_SRC}/gutil_strv.c
# libgnfcdc
LIBGNFCDC_INCLUDE = $${LIBGNFCDC_DIR}/include
LIBGNFCDC_SRC = $${LIBGNFCDC_DIR}/src
LIBGNFCDC_SPEC = $${LIBGNFCDC_DIR}/spec
INCLUDEPATH += \
$${LIBGNFCDC_INCLUDE}
HEADERS += \
$${LIBGNFCDC_INCLUDE}/*.h \
$${LIBGNFCDC_SRC}/*.h
SOURCES += \
$${LIBGNFCDC_SRC}/nfcdc_adapter.c \
$${LIBGNFCDC_SRC}/nfcdc_base.c \
$${LIBGNFCDC_SRC}/nfcdc_daemon.c \
$${LIBGNFCDC_SRC}/nfcdc_default_adapter.c \
$${LIBGNFCDC_SRC}/nfcdc_error.c \
$${LIBGNFCDC_SRC}/nfcdc_isodep.c \
$${LIBGNFCDC_SRC}/nfcdc_log.c \
$${LIBGNFCDC_SRC}/nfcdc_tag.c \
$${LIBGNFCDC_SRC}/nfcdc_util.c
OTHER_FILES += \
$${LIBGNFCDC_SPEC}/*.xml
defineTest(generateStub) {
xml = $${LIBGNFCDC_SPEC}/org.sailfishos.nfc.$${1}.xml
cmd = gdbus-codegen --generate-c-code org.sailfishos.nfc.$${1} $${xml}
gen_h = $${OUT_PWD}/org.sailfishos.nfc.$${1}.h
gen_c = $${OUT_PWD}/org.sailfishos.nfc.$${1}.c
target_h = org_sailfishos_nfc_$${1}_h
target_c = org_sailfishos_nfc_$${1}_c
$${target_h}.target = $${gen_h}
$${target_h}.depends = $${xml}
$${target_h}.commands = $${cmd}
export($${target_h}.target)
export($${target_h}.depends)
export($${target_h}.commands)
GENERATED_HEADERS += $${gen_h}
PRE_TARGETDEPS += $${gen_h}
QMAKE_EXTRA_TARGETS += $${target_h}
$${target_c}.target = $${gen_c}
$${target_c}.depends = $${target_h}
export($${target_c}.target)
export($${target_c}.depends)
GENERATED_SOURCES += $${gen_c}
QMAKE_EXTRA_TARGETS += $${target_c}
PRE_TARGETDEPS += $${gen_c}
export(QMAKE_EXTRA_TARGETS)
export(GENERATED_SOURCES)
export(PRE_TARGETDEPS)
}
generateStub(Adapter)
generateStub(Daemon)
generateStub(IsoDep)
generateStub(Settings)
generateStub(Tag)
# libqnfcdc
LIBQNFCDC_INCLUDE = $${LIBQNFCDC_DIR}/include
LIBQNFCDC_SRC = $${LIBQNFCDC_DIR}/src
INCLUDEPATH += \
$${LIBQNFCDC_INCLUDE}
HEADERS += \
$${LIBQNFCDC_INCLUDE}/NfcAdapter.h \
$${LIBQNFCDC_INCLUDE}/NfcMode.h \
$${LIBQNFCDC_INCLUDE}/NfcSystem.h
SOURCES += \
$${LIBQNFCDC_SRC}/NfcAdapter.cpp \
$${LIBQNFCDC_SRC}/NfcMode.cpp \
$${LIBQNFCDC_SRC}/NfcSystem.cpp
# harbour-lib
HARBOUR_LIB_INCLUDE = $${HARBOUR_LIB_DIR}/include
HARBOUR_LIB_SRC = $${HARBOUR_LIB_DIR}/src
HARBOUR_LIB_QML = $${HARBOUR_LIB_DIR}/qml
INCLUDEPATH += \
$${HARBOUR_LIB_INCLUDE}
HEADERS += \
$${HARBOUR_LIB_INCLUDE}/HarbourBase32.h \
$${HARBOUR_LIB_INCLUDE}/HarbourDebug.h \
$${HARBOUR_LIB_INCLUDE}/HarbourProtoBuf.h \
$${HARBOUR_LIB_INCLUDE}/HarbourSingleImageProvider.h \
$${HARBOUR_LIB_INCLUDE}/HarbourUtil.h
SOURCES += \
$${HARBOUR_LIB_SRC}/HarbourBase32.cpp \
$${HARBOUR_LIB_SRC}/HarbourProtoBuf.cpp \
$${HARBOUR_LIB_SRC}/HarbourSingleImageProvider.cpp \
$${HARBOUR_LIB_SRC}/HarbourUtil.cpp
HARBOUR_QML_COMPONENTS = \
$${HARBOUR_LIB_QML}/HarbourFitLabel.qml \
$${HARBOUR_LIB_QML}/HarbourHighlightIcon.qml \
$${HARBOUR_LIB_QML}/HarbourPasswordInputField.qml \
$${HARBOUR_LIB_QML}/HarbourShakeAnimation.qml \
$${HARBOUR_LIB_QML}/HarbourTextFlip.qml
OTHER_FILES += $${HARBOUR_QML_COMPONENTS}
qml_components.files = $${HARBOUR_QML_COMPONENTS}
qml_components.path = $${TARGET_DATA_DIR}/qml/harbour
INSTALLS += qml_components
# openssl
!equals(QT_ARCH, arm64){
SOURCES += \
$${HARBOUR_LIB_SRC}/libcrypto.c
}
# zbar
INCLUDEPATH += \
$${ZBAR_DIR}/include \
$${ZBAR_DIR}/zbar
LIBS += zbar/libzbar.a
# Config files
dbus_config.files = $${_PRO_FILE_PWD_}/harbour.yubikey.conf
dbus_config.path = /etc/dbus-1/system.d
INSTALLS += dbus_config
nfcd_config.files = $${_PRO_FILE_PWD_}/_harbour-yubikey.conf
nfcd_config.path = /etc/nfcd/ndef-handlers
INSTALLS += nfcd_config
# Icons
ICON_SIZES = 86 108 128 172 256
for(s, ICON_SIZES) {
icon_target = icon_$${s}
icon_dir = icons/$${s}x$${s}
$${icon_target}.files = $${icon_dir}/$${TARGET}.png
$${icon_target}.path = /usr/share/icons/hicolor/$${s}x$${s}/apps
INSTALLS += $${icon_target}
}
# Translations
TRANSLATION_IDBASED=-idbased
TRANSLATION_SOURCES = \
$${_PRO_FILE_PWD_}/qml
defineTest(addTrFile) {
rel = translations/$${1}
OTHER_FILES += $${rel}.ts
export(OTHER_FILES)
in = $${_PRO_FILE_PWD_}/$$rel
out = $${OUT_PWD}/$$rel
s = $$replace(1,-,_)
lupdate_target = lupdate_$$s
qm_target = qm_$$s
$${lupdate_target}.commands = lupdate -noobsolete -locations none $${TRANSLATION_SOURCES} -ts \"$${in}.ts\" && \
mkdir -p \"$${OUT_PWD}/translations\" && [ \"$${in}.ts\" != \"$${out}.ts\" ] && \
cp -af \"$${in}.ts\" \"$${out}.ts\" || :
$${qm_target}.path = $$TRANSLATIONS_PATH
$${qm_target}.depends = $${lupdate_target}
$${qm_target}.commands = lrelease $$TRANSLATION_IDBASED \"$${out}.ts\" && \
$(INSTALL_FILE) \"$${out}.qm\" $(INSTALL_ROOT)$${TRANSLATIONS_PATH}/
QMAKE_EXTRA_TARGETS += $${lupdate_target} $${qm_target}
INSTALLS += $${qm_target}
export($${lupdate_target}.commands)
export($${qm_target}.path)
export($${qm_target}.depends)
export($${qm_target}.commands)
export(QMAKE_EXTRA_TARGETS)
export(INSTALLS)
}
LANGUAGES = ru sv
addTrFile($${TARGET})
for(l, LANGUAGES) {
addTrFile($${TARGET}-$$l)
}
qm.path = $$TRANSLATIONS_PATH
qm.CONFIG += no_check_exist
INSTALLS += qm