1#
2# Copyright (c) 2023, Oracle and/or its affiliates.
3#
4# Permission is hereby granted, free of charge, to any person obtaining a
5# copy of this software and associated documentation files (the "Software"),
6# to deal in the Software without restriction, including without limitation
7# the rights to use, copy, modify, merge, publish, distribute, sublicense,
8# and/or sell copies of the Software, and to permit persons to whom the
9# Software is furnished to do so, subject to the following conditions:
10#
11# The above copyright notice and this permission notice (including the next
12# paragraph) shall be included in all copies or substantial portions of the
13# Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21# DEALINGS IN THE SOFTWARE.
22#
23
24project('xorg-cf-files', version: '1.0.8', meson_version: '>=0.60.0')
25conf = configuration_data()
26conf.set('prefix', get_option('prefix'))
27
28# Replaces XORG_FONTROOTDIR from xorg/font/util/fontutil.m4
29fontrootdir = get_option('with-fontrootdir')
30if fontrootdir == ''
31    fontutil_dep = dependency('fontutil', required: false)
32    if fontutil_dep.found() and fontutil_dep.type_name() == 'pkgconfig'
33        fontrootdir = fontutil_dep.get_variable(pkgconfig: 'fontrootdir')
34    endif
35    if fontrootdir == ''
36        fontrootdir = get_option('prefix') / get_option('datadir') / '/fonts/X11'
37    endif
38endif
39conf.set('FONTROOTDIR', fontrootdir)
40
41# Replaces XORG_FONTSUBDIR([ENCODINGSDIR],[encodingsdir],[encodings])
42# with the substitution to use the FontDir defined in the Imake configs
43encodingsdir = get_option('with-fontrootdir')
44if encodingsdir == ''
45    encodingsdir = 'FontDir' / 'encodings'
46endif
47conf.set('ENCODINGSDIR', encodingsdir)
48
49xconfdir = get_option('with-config-dir')
50if xconfdir == ''
51    xconfdir = get_option('prefix') / get_option('libdir') / 'X11/config'
52endif
53
54site_def = configure_file(input: 'site.def.in', output: 'site.def',
55               configuration: conf)
56
57def_files = [
58    'cross.def',
59    site_def,
60    'xf86site.def',
61    'xorgsite.def',
62    'xorgversion.def'
63]
64
65rule_files = [
66    'Imake.rules',
67    'Motif.rules',
68    'OpenBSDLib.rules',
69    'Win32.rules',
70    'X11.rules',
71    'bsdiLib.rules',
72    'bsdLib.rules',
73    'cde.rules',
74    'cross.rules',
75    'cygwin.rules',
76    'mingw.rules',
77    'darwinLib.rules',
78    'gnuLib.rules',
79    'hpLib.rules',
80    'ibmLib.rules',
81    'lnxLib.rules',
82    'lnxdoc.rules',
83    'necLib.rules',
84    'noop.rules',
85    'nto.rules',
86    'oldlib.rules',
87    'os2.rules',
88    'os2Lib.rules',
89    'osfLib.rules',
90    'scoLib.rules',
91    'sequentLib.rules',
92    'sgiLib.rules',
93    'sunLib.rules',
94    'sv3Lib.rules',
95    'sv4Lib.rules',
96    'QNX4.rules',
97    'xf86.rules'
98]
99
100tmpl_files = [
101    'Imake.tmpl',
102    'Library.tmpl',
103    'Motif.tmpl',
104    'OpenBSDLib.tmpl',
105    'Server.tmpl',
106    'ServerLib.tmpl',
107    'Threads.tmpl',
108    'WinLib.tmpl',
109    'X11.tmpl',
110    'bsdiLib.tmpl',
111    'bsdLib.tmpl',
112    'cde.tmpl',
113    'cygwin.tmpl',
114    'mingw.tmpl',
115    'darwinLib.tmpl',
116    'hpLib.tmpl',
117    'gnuLib.tmpl',
118    'ibmLib.tmpl',
119    'lnxLib.tmpl',
120    'lnxdoc.tmpl',
121    'necLib.tmpl',
122    'os2Lib.tmpl',
123    'osfLib.tmpl',
124    'sgiLib.tmpl',
125    'sunLib.tmpl',
126    'sv3Lib.tmpl',
127    'sv4Lib.tmpl',
128    'xf86.tmpl',
129    'xorg.tmpl'
130]
131
132cf_files = [
133    'Imake.cf',
134    'Amoeba.cf',
135    'DGUX.cf',
136    'dmx.cf',
137    'DragonFly.cf',
138    'FreeBSD.cf',
139    'Mips.cf',
140    'NetBSD.cf',
141    'OpenBSD.cf',
142    'Oki.cf',
143    'cygwin.cf',
144    'mingw.cf',
145    'Win32.cf',
146    'apollo.cf',
147    'bsd.cf',
148    'bsdi.cf',
149    'convex.cf',
150    'cray.cf',
151    'fujitsu.cf',
152    'generic.cf',
153    'gnu.cf',
154    'hp.cf',
155    'ibm.cf',
156    'isc.cf',
157    'linux.cf',
158    'luna.cf',
159    'macII.cf',
160    'mach.cf',
161    'minix.cf',
162    'moto.cf',
163    'ncr.cf',
164    'nec.cf',
165    'nto.cf',
166    'os2.cf',
167    'osf1.cf',
168    'pegasus.cf',
169    'sco.cf',
170    'sco5.cf',
171    'sequent.cf',
172    'sgi.cf',
173    'sony.cf',
174    'sun.cf',
175    'svr3.cf',
176    'svr4.cf',
177    'ultrix.cf',
178    'usl.cf',
179    'lynx.cf',
180    'x386.cf',
181    'QNX4.cf',
182    'darwin.cf',
183    'xfree86.cf',
184    'xorg.cf'
185]
186
187data_files = [ rule_files, tmpl_files, def_files, cf_files ]
188
189install_data(data_files, install_dir: xconfdir)
190
191foreach target_def: ['date.def', 'host.def', 'version.def']
192  install_data('empty.def', rename: target_def, install_dir: xconfdir)
193endforeach
194