summaryrefslogtreecommitdiff
path: root/docs/reference/libtracker-sparql/meson.build
blob: 507555b2c1607c3dfe2bbfe0e3511ccf74213e77 (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
fs = import('fs')

if fs.exists('doc')
  # Special case for tarballs, install the pre-generated docs
  install_subdir('doc',
    install_dir: datadir)
  subdir_done()
endif

gidocgen_dep = dependency('gi-docgen', fallback: ['gi-docgen', 'dummy_dep'])
gidocgen = find_program('gi-docgen')
graphviz_dot = find_program('dot')

ontology_introductions = [
  'nie-introduction.md',
  'nmm-introduction.md',
  'nco-introduction.md',
  'mfo-introduction.md',
]

base_ontology_docs = custom_target('ontology-docgen',
    output: ['dc-ontology.md.in'],
    command: [tracker_docgen,
              '--md',
              '--ontology-dir', meson.current_build_dir(), # Directory without ontology files
              '--output-dir', meson.current_build_dir(),
              '--introduction-dir', meson.current_source_dir(),
              '--ontology-description-dir', join_paths(source_root, 'src/ontologies/')],
    depends: tracker_docgen,
    depend_files: [base_ontology, ontology_introductions],
)

nepomuk_ontology_docs = custom_target('nepomuk-docgen',
    output: ['nie-ontology.md.in'],
    command: [tracker_docgen,
              '--md',
              '--ontology-dir', join_paths(source_root, 'src/ontologies/nepomuk'),
              '--output-dir', meson.current_build_dir(),
              '--introduction-dir', meson.current_source_dir()],
    depends: tracker_docgen,
    depend_files: [nepomuk, ontology_introductions],
)

generate_images = custom_target(
  'doc-images',
  output: 'rdfs:Resource-hierarchy.svg',
  command: [
    'generate-svgs.sh',
    graphviz_dot,
    meson.current_build_dir(),
  ],
  depends: [base_ontology_docs, nepomuk_ontology_docs])

generated_ontology_files = [
  'xsd-ontology.md.in',
  'rdf-ontology.md.in',
  'rdfs-ontology.md.in',
  'nrl-ontology.md.in',
  'dc-ontology.md.in',

  'nie-ontology.md.in',
  'nao-ontology.md.in',
  'nco-ontology.md.in',
  'nfo-ontology.md.in',
  'nmm-ontology.md.in',
  'mfo-ontology.md.in',
  'tracker-ontology.md.in',
  'slo-ontology.md.in',
  'osinfo-ontology.md.in',
]

generated_targets = []
generated_ontology_content = []

foreach doc : generated_ontology_files
  output_file = doc.replace('.in', '')
  generated_ontology_content += output_file
  generated_targets += custom_target(
    output_file,
    output: output_file,
    command: [
      'embed-files.py',
      meson.current_build_dir() / doc,
      meson.current_build_dir() / output_file,
    ],
    depends: [base_ontology_docs, nepomuk_ontology_docs, generate_images])
endforeach

generated_content_files = [
  'overview.md.in',
  'examples.md.in',
  'tutorial.md.in',
  'sandboxing.md.in',
]

generated_content = []

foreach doc : generated_content_files
  output_file = doc.replace('.in', '')
  generated_content += output_file
  generated_targets += custom_target(
    output_file,
    input: doc,
    output: output_file,
    command: [
      'embed-files.py',
      '@INPUT@',
      '@OUTPUT@',
    ])
endforeach

content = [
  'ontologies.md',
  'sparql-functions.md',
  'sparql-and-tracker.md',
  'limits.md',
  'performance.md',
  'security.md',
  'migrating-2to3.md',
]

# The TOML gi-docgen configuration wants a list of quoted file names.
content_quoted = []
foreach c : generated_content + content + generated_ontology_content
  content_quoted += '"@0@"'.format(c)
endforeach

gidocgen_conf = configuration_data()
gidocgen_conf.set('version', meson.project_version())
gidocgen_conf.set('content', ','.join(content_quoted))

gidocgen_toml = configure_file(
  input: 'tracker-sparql.toml.in',
  output: 'tracker-sparql.toml',
  configuration: gidocgen_conf)

reference = custom_target(
  'docgen',
  input: [ gidocgen_toml, tracker_sparql_gir[0] ],
  output: 'doc',
  command: [
    gidocgen,
    'generate',
    '--quiet',
    '--config=@INPUT0@',
    '--output-dir=@OUTPUT@',
    '--content-dir=@0@'.format(meson.current_source_dir()),
    '--content-dir=@0@'.format(meson.current_build_dir()),
    '@INPUT1@',
  ],
  depends: [tracker_sparql_gir[0], generated_targets],
  depend_files: [content])

docs_name = 'Tracker-3.0'
meson.add_install_script('install-devhelp.sh', docs_name, reference)
meson.add_dist_script('dist-docs.sh', docs_name, reference.full_path())