File: gdc.py

package info (click to toggle)
lv2fil 2.0%2B20100312.git18130f5a%2Bdfsg0-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 888 kB
  • sloc: python: 10,590; ansic: 1,180; makefile: 27; sh: 11
file content (67 lines) | stat: -rw-r--r-- 1,571 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#! /usr/bin/env python
# encoding: utf-8

#! /usr/bin/env python
# encoding: utf-8
# Carlos Rafael Giani, 2007 (dv)

import sys
import ar

def find_gdc(conf):
	v = conf.env
	d_compiler = None
	if v['D_COMPILER']:
		d_compiler = v['D_COMPILER']
	if not d_compiler: d_compiler = conf.find_program('gdc', var='D_COMPILER')
	if not d_compiler: return 0
	v['D_COMPILER'] = d_compiler

def common_flags(conf):
	v = conf.env

	# _DFLAGS _DIMPORTFLAGS _DLIBDIRFLAGS _DLIBFLAGS

	# for mory info about the meaning of this dict see dmd.py
	v['DFLAGS']            = {'gdc':[], 'dmd':[]}

	v['D_SRC_F']           = ''
	v['D_TGT_F']           = '-c -o '
	v['DPATH_ST']          = '-I%s' # template for adding import paths

	# linker
	v['D_LINKER']          = v['D_COMPILER']
	v['DLNK_SRC_F']        = ''
	v['DLNK_TGT_F']        = '-o '

	v['DLIB_ST']           = '-l%s' # template for adding libs
	v['DLIBPATH_ST']       = '-L%s' # template for adding libpaths

	# debug levels
	v['DLINKFLAGS']        = []
	v['DFLAGS_OPTIMIZED']  = ['-O3']
	v['DFLAGS_DEBUG']      = ['-O0']
	v['DFLAGS_ULTRADEBUG'] = ['-O0']

	v['D_shlib_DFLAGS']    = []
	v['D_shlib_LINKFLAGS'] = ['-shared']

	if sys.platform == "win32":
		v['D_program_PATTERN']   = '%s.exe'
		v['D_shlib_PATTERN']     = 'lib%s.dll'
		v['D_staticlib_PATTERN'] = 'lib%s.a'
	else:
		v['D_program_PATTERN']   = '%s'
		v['D_shlib_PATTERN']     = 'lib%s.so'
		v['D_staticlib_PATTERN'] = 'lib%s.a'

def detect(conf):
	v = conf.env
	find_gdc(conf)
	ar.find_ar(conf)
	conf.check_tool('d')
	common_flags(conf)

def set_options(opt):
	pass