1#######################################################################
2# SConscript for xlib winsys
3
4Import('*')
5
6env = env.Clone()
7
8env.Append(CPPPATH = [
9    '#/src/mapi',
10    '#/src/mesa',
11    '#/src/mesa/main',
12    '#src/gallium/state_trackers/glx/xlib',
13    Dir('../../../mapi'), # src/mapi build path for python-generated GL API files/headers
14])
15
16env.Append(CPPDEFINES = ['USE_XSHM'])
17
18env.Prepend(LIBS = env['X11_LIBS'])
19env.Prepend(LIBPATH = env['X11_LIBPATH'])
20
21env.Prepend(LIBS = [
22    st_xlib,
23    ws_xlib,
24    glapi,
25    mesautil,
26    compiler,
27    mesa,
28    glsl,
29    nir,
30    spirv,
31    gallium,
32])
33
34sources = [
35    'xlib.c',
36]
37
38if True:
39    env.Append(CPPDEFINES = ['GALLIUM_SOFTPIPE'])
40    env.Prepend(LIBS = [softpipe])
41
42if env['llvm']:
43    env.Append(CPPDEFINES = ['GALLIUM_LLVMPIPE'])
44    env.Prepend(LIBS = [llvmpipe])
45
46    if env['swr']:
47        env.Append(CPPDEFINES = 'GALLIUM_SWR')
48        env.Prepend(LIBS = [swr])
49
50if env['platform'] != 'darwin':
51    # Disallow undefined symbols, except with Address Sanitizer, since libasan
52    # is not linked on shared libs, as it should be LD_PRELOAD'ed instead
53    if not env['asan']:
54        env.Append(SHLINKFLAGS = [
55            '-Wl,-z,defs',
56        ])
57    env.Append(SHLINKFLAGS = [
58        # Restrict exported symbols
59        '-Wl,--version-script=%s' % File("libgl-xlib.sym").srcnode().path,
60    ])
61
62# libGL.so.1.5
63libgl_1_5 = env.SharedLibrary(
64    target ='GL',
65    source = sources,
66    SHLIBSUFFIX = env['SHLIBSUFFIX'] + '.1.5',
67)
68
69# libGL.so.1
70libgl = env.subst('${SHLIBPREFIX}GL${SHLIBSUFFIX}')
71libgl_1 = libgl + '.1'
72env.Command(libgl_1, libgl_1_5, "ln -sf ${SOURCE.file} ${TARGET}")
73env.Command(libgl, libgl_1, "ln -sf ${SOURCE.file} ${TARGET}")
74
75env.Alias('libgl-xlib', libgl)
76