cleanup: move autotools support files to subdir
[gtk-doc.git] / meson.build
blobafa27be44c54cf72307acfd8a5f66807845a7ca7
1 project('gtk-doc', 'c',
2   version: '1.28.1',
3   license: 'GPL2+',
4   meson_version: '>= 0.41.0',
7 gnome = import('gnome')
8 python = import('python3')
10 # Versioning
11 version = meson.project_version()
12 version_arr = version.split('.')
13 version_major = version_arr[0].to_int()
14 version_minor = version_arr[1].to_int()
15 version_micro = version_arr[2].to_int()
17 package_name = meson.project_name()
19 # Paths
20 srcdir = meson.source_root()
21 builddir = meson.build_root()
23 prefix = get_option('prefix')
25 bindir = join_paths(prefix, get_option('bindir'))
26 libdir = join_paths(prefix, get_option('libdir'))
27 datadir = join_paths(prefix, get_option('datadir'))
29 cmakedatadir = join_paths(libdir, 'cmake')
31 autoconfdatadir = join_paths(datadir, 'aclocal')
32 pkgdir = join_paths(datadir, package_name)
33 pkgdatadir = join_paths(pkgdir, 'data')
34 pkgpythondir = join_paths(pkgdir, 'python')
35 pkgconfigdir = join_paths(datadir, 'pkgconfig')
37 # Dependencies
38 glib_req = '>= 2.38.0'
39 python3_req = '>= 3.4.0'
41 glib_dep = dependency('glib-2.0', version: glib_req)
42 gobject_dep = dependency('gobject-2.0', version: glib_req)
43 python3_dep = dependency('python3', version: python3_req)
45 python_prg = python.find_python()
47 pkgconfig_prg = find_program('pkg-config', required: true)
48 xsltproc_prg = find_program('xsltproc', required: true)
49 dblatex_prg = find_program('dblatex', required: false)
50 fop_prg = find_program('fop', required: false)
52 source_highlight_prg = find_program('source-highlight', required: false)
53 highlight_prg = find_program('highlight', required: false)
54 vim_prg = find_program('vim', required: false)
56 python_prg_path = join_paths(python_prg.path())
57 pkgconfig_prg_path = join_paths(pkgconfig_prg.path())
58 xsltproc_prg_path = join_paths(xsltproc_prg.path())
60 dblatex_prg_path = ''
61 if dblatex_prg.found()
62   dblatex_prg_path = join_paths(dblatex_prg.path())
63 endif
65 fop_prg_path = ''
66 if fop_prg.found()
67   fop_prg_path = join_paths(fop_prg.path())
68 endif
70 highlight_prg_path = ''
71 highlight_prg_args = ''
72 if source_highlight_prg.found()
73   highlight_prg_path = join_paths(source_highlight_prg.path())
74   highlight_prg_args = [
75     '-t4',
76     '-s$SRC_LANG',
77     '-cstyle.css',
78     '--no-doc',
79     '-i',
80   ]
81 elif highlight_prg.found()
82   highlight_prg_path = join_paths(highlight_prg.path())
83   highlight_prg_args = [
84     '--syntax=$SRC_LANG',
85     '--out-format=xhtml',
86     '-f',
87     '--class-name=gtkdoc',
88   ]
89 elif vim_prg.found()
90   highlight_prg_path = join_paths(vim_prg.path())
91 endif
93 # Options
94 generate_pdf_output = true
95 if not dblatex_prg.found() and not fop_prg.found()
96   generate_pdf_output = false
97 endif
99 # Code
100 subdir('gtkdoc')
102 gtkdoc_binaires = [
103   'gtkdoc-check',
104   'gtkdoc-depscan',
105   'gtkdoc-fixxref',
106   'gtkdoc-mkdb',
107   'gtkdoc-mkhtml',
108   'gtkdoc-mkhtml2',
109   'gtkdoc-mkman',
110   'gtkdoc-mkpdf',
111   'gtkdoc-rebase',
112   'gtkdoc-scan',
113   'gtkdoc-scangobj',
114   'gtkdocize',
117 binary_in = configuration_data()
118 binary_in.set('PYTHON', python_prg_path)
119 binary_in.set('PKG_CONFIG', pkgconfig_prg_path)
121 binary_in.set('PYTHON_PACKAGE_DIR', pkgpythondir)
123 binary_in.set('prefix', get_option('prefix'))
124 binary_in.set('datarootdir', join_paths('${prefix}', get_option('datadir')))
125 binary_in.set('datadir', '${datarootdir}')
127 binary_in.set('PACKAGE', package_name)
129 binary_in.set('VERSION', version)
131 foreach binary: gtkdoc_binaires
132   configure_file(
133     input: '@0@.in'.format(binary),
134     output: binary,
135     configuration: binary_in,
136     install: true,
137     install_dir: bindir,
138   )
139 endforeach
141 # Data
142 gtkdoc_data = [
143   'devhelp2.xsd',
144   'devhelp2.xsl',
145   'gtk-doc.make',
146   'gtk-doc.xsl',
147   'version-greater-or-equal.xsl',
150 install_data(
151   gtkdoc_data,
152   install_dir: pkgdatadir,
155 subdir('style')
157 if get_option('autotools_support') == true
158   subdir('buildsystems/autotools')
159 endif
161 if get_option('cmake_support') == true
162   subdir('buildsystems/cmake')
163 endif
165 gtkdoc_pc = configuration_data()
166 gtkdoc_pc.set('prefix', prefix)
167 gtkdoc_pc.set('exec_prefix', '${prefix}')
168 gtkdoc_pc.set('datadir', join_paths('${prefix}', get_option('datadir')))
170 gtkdoc_pc.set('PACKAGE', package_name)
171 gtkdoc_pc.set('VERSION', version)
173 configure_file(
174   input: 'gtk-doc.pc.in',
175   output: 'gtk-doc.pc',
176   configuration: gtkdoc_pc,
177   install: true,
178   install_dir: pkgconfigdir,
181 subdir('help')
182 subdir('tests')
184 summary = [
185   '',
186   '------',
187   'gtk-doc @0@'.format(version),
188   '',
189   'Directories:',
190   '             prefix: @0@'.format(prefix),
191   '             bindir: @0@'.format(bindir),
192   '             libdir: @0@'.format(libdir),
193   '            datadir: @0@'.format(datadir),
194   '',
195   'Configuration:',
196   '  Autotools support: @0@'.format(get_option('autotools_support')),
197   '      CMake support: @0@'.format(get_option('cmake_support')),
198   '         PDF output: @0@'.format(generate_pdf_output),
199   '        User manual: @0@'.format(get_option('yelp_manual')),
200   '------',
203 message('\n'.join(summary))