meson.build revision 9ea7388f
1# And some files that are a straight install 2install_data('README', 'xkb.dtd', 'xfree98', 3 install_dir: dir_xkb_rules) 4 5# the actual rules files are generated from a list of parts in a very 6# specific order 7parts = [ 8 '0000-hdr.part', 9 '0001-lists.part', 10 '0002-@0@.lists.part', 11 '0004-@0@.m_k.part', 12 '0005-l1_k.part', 13 '0006-l_k.part', 14 '0007-o_k.part', 15 '0008-ml_g.part', 16 '0009-m_g.part', 17 '0011-mlv_s.part', 18 '0013-ml_s.part', 19 '0015-ml1_s.part', 20 '0018-ml2_s.part', 21 '0020-ml3_s.part', 22 '0022-ml4_s.part', 23 '0026-@0@.m_s.part', 24 '0027-@0@.ml_s1.part', 25 '0033-ml_c.part', 26 '0034-ml1_c.part', 27 '0035-m_t.part', 28 '0036-lo_s.part', 29 '0037-l1o_s.part', 30 '0038-l2o_s.part', 31 '0039-l3o_s.part', 32 '0040-l4o_s.part', 33 '0042-o_s.part', 34 '0043-o_c.part', 35 '0044-o_t.part', 36] 37 38# generated compat parts 39rules_compat_generated = [] 40 41if get_option('compat-rules') 42 # non-generated compat parts 43 parts += [ 44 'compat/0003-lists.part', 45 'compat/0028-lv_c.part', 46 'compat/0029-l1v1_c.part', 47 'compat/0030-l2v2_c.part', 48 'compat/0031-l3v3_c.part', 49 'compat/0032-l4v4_c.part', 50 'compat/0041-o_s.part', 51 ] 52 53 layout_mappings = files('compat/layoutsMapping.lst') 54 variant_mappings = files('compat/variantsMapping.lst') 55 map_variants_py = find_program('compat/map-variants.py') 56 57 # two sets of files are generated: ml_s.part and mlv_s.part 58 # each with the level name in the filename 59 lvl_ml_s = { 60 '0': '0012-ml_s.part', 61 '1': '0014-ml1_s.part', 62 '2': '0017-ml2_s.part', 63 '3': '0019-ml3_s.part', 64 '4': '0021-ml4_s.part', 65 } 66 67 lvl_mlv_s = { 68 '0': '0010-mlv_s.part', 69 '1': '0016-ml1v1_s.part', 70 '2': '0023-ml2v2_s.part', 71 '3': '0024-ml3v3_s.part', 72 '4': '0025-ml4v4_s.part', 73 } 74 75 foreach lvl: [0, 1, 2, 3, 4] 76 ml_s_file = lvl_ml_s['@0@'.format(lvl)] 77 ml_s = custom_target(ml_s_file, 78 build_by_default: true, 79 command: [ 80 map_variants_py, 81 '--want=mls', 82 '--number=@0@'.format(lvl), 83 '@OUTPUT@', 84 layout_mappings, 85 variant_mappings, 86 ], 87 output: ml_s_file, 88 install: false) 89 rules_compat_generated += [ml_s] 90 91 mlv_s_file = lvl_mlv_s['@0@'.format(lvl)] 92 mlv_s = custom_target(mlv_s_file, 93 build_by_default: true, 94 command: [ 95 map_variants_py, 96 '--want=mlvs', 97 '--number=@0@'.format(lvl), 98 '@OUTPUT@', 99 variant_mappings, 100 ], 101 output: mlv_s_file, 102 install: false) 103 rules_compat_generated += [mlv_s] 104 endforeach 105endif # compat-rules 106 107merge_py = find_program('merge.py') 108perl = find_program('perl') 109xml2lst = find_program('xml2lst.pl') 110foreach ruleset: ['base', 'evdev'] 111 # generate the "evdev" and "base" rules files 112 # 113 # First: copy all the parts over to the build directory, replacing 114 # RULESET with the rulename (evdev or base) and prefix it with the 115 # ruleset name. So 0000-hdr.part becomes 0000-hdr.part.evdev and 116 # 0000-hdr.part.base 117 rules_parts = [] 118 foreach part: parts 119 infile = part.format(ruleset) 120 p = configure_file(output: '@PLAINNAME@.@0@'.format(ruleset), 121 input: infile, 122 copy: true, 123 install: false) 124 rules_parts += p 125 endforeach 126 127 # Second: merge those parts together into the actual rules file 128 custom_target('rules-@0@'.format(ruleset), 129 build_by_default: true, 130 command: [ 131 merge_py, 132 rules_parts + rules_compat_generated, 133 ], 134 depends: rules_compat_generated, 135 output: ruleset, 136 capture: true, 137 install: true, 138 install_dir: dir_xkb_rules) 139 140 # Third: the xml files, simply copied from the base*.xml files 141 ruleset_xml = configure_file(output: '@0@.xml'.format(ruleset), 142 input: 'base.xml', 143 copy: true, 144 install: true, 145 install_dir: dir_xkb_rules) 146 147 # This is used by the man page's meson.build 148 if ruleset == 'evdev' 149 evdev_ruleset = ruleset_xml 150 endif 151 152 configure_file(output: '@0@.extras.xml'.format(ruleset), 153 input: 'base.extras.xml', 154 copy: true, 155 install: true, 156 install_dir: dir_xkb_rules) 157 158 # Fourth: generate the evdev.lst and base.lst files 159 lst_file = '@0@.lst'.format(ruleset) 160 custom_target(lst_file, 161 build_by_default: true, 162 command: [xml2lst, ruleset_xml], 163 capture: true, 164 output: lst_file, 165 install: true, 166 install_dir: dir_xkb_rules) 167 168endforeach 169 170if get_option('xorg-rules-symlinks') 171 foreach suffix: ['', '.lst', '.xml'] 172 meson.add_install_script('sh', '-c', 173 'ln -s base@0@ $DESTDIR@1@/xorg@0@'.format(suffix, dir_xkb_rules)) 174 endforeach 175endif 176# Copy the DTD to the build directory, the man page generation expects it in 177# the same directory as the input XML file. 178configure_file(output: 'xkb.dtd', 179 input: 'xkb.dtd', 180 copy: true, 181 install: false) 182