Debian Codegraph @

misc/dtk_install_dconfig.prf

raw
1 # This prf file is used to deploy files that dconfig's meta and override configure.
2 #
3 # get variable `$$DSG_DATA_DIR` 's value, it’s consistent with class DConfigFile code.
4 isEmpty(DSG_DATA_DIR) {
5 isEmpty(PREFIX) {
6 DSG_DATA_DIR=/usr/share/dsg
7 } else {
8 DSG_DATA_DIR=$$PREFIX/share/dsg
9 }
10 }
11
12 # deploy some `meta` 's configure.
13 #
14 # files - deployed files.
15 # base - used to get subpath, if it's empty, only copy files, and ignore it's subpath structure.
16 # appid - working for the app, if it's empty, depending on `TEMPLATE`.
17 # commonid - working for common, if it's empyt, depending on `TEMPLATE`.
18 #
19 # e.g:
20 # dconfig_example.files += \
21 # $$PWD/configs/dconf-example.json \
22 # $$PWD/configs/a/dconf-example.json
23 # dconfig_example.base = $$PWD/configs
24 # dconfig_example.appid = $$TARGET
25 #
26 # dconfig_example2.files += $$PWD/configs/a/dconf-example.json
27 #
28 # DCONFIG_META_FILES += dconfig_example dconfig_example2
29 #
30 for(metaitem, DCONFIG_META_FILES) {
31 eval(dconfig_meta_$${metaitem}.files = $$eval($${metaitem}.files))
32 eval(dconfig_meta_$${metaitem}.base = $$eval($${metaitem}.base))
33 isEmpty($${metaitem}.appid) {
34 is_common_configuration=true
35 isEmpty($${metaitem}.commonid) {
36 equals(TEMPLATE, app) {
37 eval(dconfig_meta_$${metaitem}.path = $$DSG_DATA_DIR/configs/$$TARGET/)
38 is_common_configuration=false
39 }
40 }
41 if ($$is_common_configuration) {
42 eval(dconfig_meta_$${metaitem}.path = $$DSG_DATA_DIR/configs)
43 }
44 } else {
45 eval(dconfig_meta_$${metaitem}.path = $$DSG_DATA_DIR/configs/$$eval($${metaitem}.appid))
46 }
47 INSTALLS += dconfig_meta_$${metaitem}
48 }
49
50
51 # deploy some `meta` 's override configure.
52 #
53 # configuration for the `meta_name` 's override configure.
54 #
55 # files - deployed files.
56 # base - used to get subpath, if it's empty, only copy files, and ignore it's subpath structure.
57 # appid - working for the app, if it's empty, working for all app.
58 # meta_name - override for the meta configure.
59 #
60 # e.g :
61 # dconfig_example.files += \
62 # $$PWD/configs/dconf-example.override.json \
63 # $$PWD/configs/a/dconf-example.override.a.json
64 # dconfig_example.base = $$PWD/configs
65 # dconfig_example.meta_name = example
66 # dconfig_example.appid = $$TARGET
67 #
68 # dconfig_example2.files += $$PWD/configs/a/dconf-example.override.a.json
69 # dconfig_example2.meta_name = example2
70 #
71 # DCONFIG_OVERRIDE_FILES += dconfig_example dconfig_example2
72 #
73 for(overrideitem, DCONFIG_OVERRIDE_FILES) {
74 eval(dconfig_override_$${overrideitem}.files = $$eval($${overrideitem}.files))
75 eval(dconfig_override_$${overrideitem}.base = $$eval($${overrideitem}.base))
76 isEmpty($${overrideitem}.meta_name) : error("Please set meta_name for the override configuration." $${overrideitem})
77 isEmpty($${overrideitem}.appid) {
78 eval(dconfig_override_$${overrideitem}.path = $$DSG_DATA_DIR/configs/overrides/$$eval($${overrideitem}.meta_name))
79 } else {
80 eval(dconfig_override_$${overrideitem}.path = $$DSG_DATA_DIR/configs/overrides/$$eval($${overrideitem}.appid)/$$eval($${overrideitem}.meta_name))
81 }
82 INSTALLS += dconfig_override_$${overrideitem}
83 }