1xorg_inc = include_directories(
2    'common',
3    'ddc',
4    'dri2',
5    'i2c',
6    'int10',
7    'loader',
8    'modes',
9    'os-support',
10    'os-support/bus',
11    'parser',
12    'ramdac',
13    'vgahw',
14)
15
16xorg_c_args = []
17xorg_c_args += '-DHAVE_XORG_CONFIG_H'
18xorg_c_args += '-DXORG_NO_SDKSYMS'
19
20pciaccess_dep = []
21if get_option('pciaccess')
22    pciaccess_dep = dependency('pciaccess', version: '>= 0.12.901')
23endif
24
25# subdirs for convenience libraries statically linked into Xorg
26subdir('common')
27subdir('ddc')
28if build_dri1
29    subdir('dri')
30endif
31if build_dri2
32    subdir('dri2')
33endif
34subdir('i2c')
35subdir('loader')
36subdir('modes')
37subdir('os-support')
38subdir('parser')
39subdir('ramdac')
40subdir('xkb')
41
42srcs_xorg = [
43    '../../mi/miinitext.c',
44    '../../mi/miinitext.h',
45]
46
47# Extract all the objects so that all symbols get brought into the
48# server.  This prevents us from needing a global table of all symbols
49# that should be exported to Xorg modules, at the expense of all
50# symbols being included and public
51
52xorg_link = [
53    libxserver,
54    libglxvnd,
55    xorg_common,
56    xorg_loader,
57    xorg_ddc,
58    xorg_xkb,
59    xorg_i2c,
60    xorg_modes,
61    xorg_os_support,
62    xorg_parser,
63    xorg_ramdac,
64    libxserver_fb,
65    libxserver_xext_vidmode,
66    libxserver_main,
67    libxserver_config,
68]
69if build_dri1
70    xorg_link += xorg_dri
71endif
72if build_dri2
73    xorg_link += xorg_dri2
74endif
75
76if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
77    linker_export_flags = '-Wl,--export-all-symbols'
78elif host_machine.system() == 'sunos' or host_machine.system() == 'darwin'
79    linker_export_flags = []
80else
81    linker_export_flags = '-Wl,--export-dynamic'
82endif
83
84xorg_deps = [
85    pixman_dep,
86    m_dep,
87    dl_dep,
88    pciaccess_dep,
89    sha1_dep,
90    dependency('xau'),
91    xdmcp_dep,
92    xfont2_dep,
93    xshmfence_dep,
94    config_dep,
95    libdrm_dep,
96]
97
98if get_option('suid_wrapper')
99    xorg_install_dir = get_option('libexecdir')
100else
101    xorg_install_dir = get_option('bindir')
102endif
103
104e = executable(
105    'Xorg',
106    srcs_xorg,
107    include_directories: [inc, xorg_inc],
108    link_whole: xorg_link,
109    dependencies: xorg_deps,
110    link_args: linker_export_flags,
111    c_args: xorg_c_args,
112    install: true,
113    install_dir: xorg_install_dir,
114    implib: true,
115)
116
117# subdirs for modules loadable by Xorg
118subdir('dixmods')
119subdir('exa')
120subdir('fbdevhw')
121if gbm_dep.found()
122    subdir('glamor_egl')
123endif
124if int10 != 'false'
125    if int10 == 'x86emu'
126        subdir('x86emu')
127    endif
128    subdir('int10')
129endif
130subdir('shadowfb')
131if build_vgahw
132    subdir('vgahw')
133endif
134if build_modesetting
135   subdir('drivers/modesetting')
136endif
137if get_option('xf86-input-inputtest')
138    subdir('drivers/inputtest')
139endif
140
141meson.add_install_script(
142    'sh', '-c',
143    'ln -fs Xorg @0@@1@'.format(
144        '${DESTDIR}',
145        join_paths(get_option('prefix'), get_option('bindir'), 'X')))
146
147if get_option('suid_wrapper')
148    executable('Xorg.wrap',
149        'xorg-wrapper.c',
150        include_directories: [inc, xorg_inc],
151        dependencies: xorg_deps,
152        c_args: xorg_c_args,
153        install: true,
154        install_dir: get_option('libexecdir'),
155        install_mode: ['r-sr-xr-x', 0, 0],
156    )
157
158    # meson gets confused when there are two targets of the same name
159    # within the same directory, so we use a different intermediate name.
160    xorg_sh = configure_file(
161        input: 'Xorg.sh.in',
162        output: 'Xorg.sh',
163        configuration: conf_data,
164    )
165
166    install_data(
167        xorg_sh,
168        install_mode: 'rwxr-xr-x',
169        install_dir: join_paths(get_option('prefix'), get_option('bindir')),
170        rename: ['Xorg']
171    )
172endif
173
174executable('gtf',
175    'utils/gtf/gtf.c',
176    include_directories: [inc, xorg_inc],
177    dependencies: xorg_deps,
178    c_args: xorg_c_args,
179    install: true,
180)
181
182# For symbol presence testing only
183xorgserver_lib = shared_library(
184    'xorgserver',
185    srcs_xorg,
186    include_directories: [inc, xorg_inc],
187    link_whole: xorg_link,
188    dependencies: xorg_deps,
189    link_args: linker_export_flags,
190    c_args: xorg_c_args,
191    install: false,
192)
193
194xorgserver_dep = declare_dependency(link_with: xorgserver_lib)
195
196install_man(configure_file(
197    input: 'man/Xorg.man',
198    output: 'Xorg.1',
199    configuration: manpage_config,
200))
201
202if get_option('suid_wrapper')
203    install_man(configure_file(
204        input: 'man/Xorg.wrap.man',
205        output: 'Xorg.wrap.1',
206        configuration: manpage_config,
207    ))
208
209    install_man(configure_file(
210        input: 'man/Xwrapper.config.man',
211        output: 'Xwrapper.config.5',
212        configuration: manpage_config,
213    ))
214endif
215
216install_man(configure_file(
217    input: 'man/xorg.conf.man',
218    output: 'xorg.conf.5',
219    configuration: manpage_config,
220))
221
222install_man(configure_file(
223    input: 'man/xorg.conf.d.man',
224    output: 'xorg.conf.d.5',
225    configuration: manpage_config,
226))
227
228install_man(configure_file(
229    input: 'utils/man/gtf.man',
230    output: 'gtf.1',
231    configuration: manpage_config,
232))
233
234subdir('doc')
235