1Import('*')
2
3if not env['x11'] or not env['xcb'] or not env['drm']:
4    Return()
5
6from sys import executable as python_cmd
7
8env = env.Clone()
9
10env.Prepend(CPPPATH = [
11	'.',           # the build/<platform>/glx/ directory
12	'#include',
13	'#include/GL/internal',
14	'#src/mesa',
15	'#src/mapi',
16	'#src/mapi/glapi',
17	#$(LIBDRM_CFLAGS)
18	#$(DRI2PROTO_CFLAGS)
19	#$(GLPROTO_CFLAGS)
20	#$(X11_INCLUDES)
21])
22
23env.Append(CPPDEFINES = [
24    '_REENTRANT',
25    #('DEFAULT_DRIVER_DIR', 'DRI_DRIVER_SEARCH_DIR')
26])
27
28env.Prepend(LIBS = [
29    glapi
30])
31
32env.PkgUseModules('X11')
33env.PkgUseModules('XCB')
34env.PkgUseModules('DRM')
35
36if env['HAVE_XF86VIDMODE']:
37    env.Append(CPPDEFINES = ['XF86VIDMODE'])
38    env.PkgUseModules('XF86VIDMODE')
39
40if False: # XXX: SHARED_GLAPI
41    env.Append(CPPDEFINES = ['GLX_SHARED_GLAPI'])
42
43sources = [
44    'clientattrib.c',
45    'clientinfo.c',
46    'create_context.c',
47    'compsize.c',
48    'eval.c',
49    'glx_error.c',
50    'glxconfig.c',
51    'glxcmds.c',
52    'glxcurrent.c',
53    'glxext.c',
54    'glxextensions.c',
55    'indirect_glx.c',
56    'indirect.c',
57    'indirect_init.c',
58    'indirect_size.c',
59    'indirect_window_pos.c',
60    'indirect_texture_compression.c',
61    'indirect_transpose_matrix.c',
62    'indirect_vertex_array.c',
63    'indirect_vertex_program.c',
64    'pixel.c',
65    'pixelstore.c',
66    'render2.c',
67    'renderpix.c',
68    'single2.c',
69    'singlepix.c',
70    'vertarr.c',
71    'xfont.c',
72    'glx_pbuffer.c',
73    'glx_query.c',
74    'drisw_glx.c',
75    'dri_common.c',
76    'dri_glx.c',
77    'XF86dri.c',
78    'glxhash.c',
79    'dri2_glx.c',
80    'dri2.c',
81    'applegl_glx.c',
82]
83
84libgl = env.SharedLibrary(
85    target ='GL',
86    source = sources,
87)
88
89
90# Generate GLX-specific .c and .h files here.  Other GL API-related
91# files are used, but they're generated in mapi/glapi/gen/ since they're
92# used by other targets as well.
93
94GLAPI = '#src/mapi/glapi/'
95
96env.CodeGenerate(
97    target = 'indirect.c',
98    script = GLAPI + 'gen/glX_proto_send.py',
99    source = GLAPI + 'gen/gl_and_es_API.xml',
100    command = python_cmd + ' $SCRIPT -f $SOURCE -m proto > $TARGET'
101    )
102
103env.CodeGenerate(
104    target = 'indirect_size.c', 
105    script = GLAPI + 'gen/glX_proto_size.py',
106    source = GLAPI + 'gen/gl_API.xml',
107    command = python_cmd + ' $SCRIPT -f $SOURCE -m size_c --only-set > $TARGET'
108)
109
110env.CodeGenerate(
111    target = 'indirect_init.c', 
112    script = GLAPI + 'gen/glX_proto_send.py',
113    source = GLAPI + 'gen/gl_API.xml',
114    command = python_cmd + ' $SCRIPT -f $SOURCE -m init_c > $TARGET'
115)
116
117headers = []
118
119headers += env.CodeGenerate(
120    target = 'indirect_size.h',
121    script = GLAPI + 'gen/glX_proto_size.py',
122    source = GLAPI + 'gen/gl_API.xml',
123    command = python_cmd + ' $SCRIPT -f $SOURCE -m size_h --only-set -h _INDIRECT_SIZE_H > $TARGET'
124)
125
126headers += env.CodeGenerate(
127    target = 'indirect.h',
128    script = GLAPI + 'gen/glX_proto_send.py',
129    source = GLAPI + 'gen/gl_API.xml',
130    command = python_cmd + ' $SCRIPT -m init_h -f $SOURCE > $TARGET',
131    )
132
133
134env.Depends(sources, headers)
135
136
137libgl = env.InstallSharedLibrary(libgl, version=(1, 2))
138
139env.Alias('glx', libgl)
140env.Alias('libgl', libgl)
141