s4:lib/messaging: terminate the irpc_servers_byname() result with server_id_set_disco...
[Samba/gebeck_regimport.git] / buildtools / wafadmin / Tools / winres.py
blob2500d431de9000edf1ca53c8ad7ffcfa48b276f2
1 #!/usr/bin/env python
2 # encoding: utf-8
3 # Brant Young, 2007
5 "This hook is called when the class cpp/cc task generator encounters a '.rc' file: X{.rc -> [.res|.rc.o]}"
7 import os, sys, re
8 import TaskGen, Task
9 from Utils import quote_whitespace
10 from TaskGen import extension
12 EXT_WINRC = ['.rc']
14 winrc_str = '${WINRC} ${_CPPDEFFLAGS} ${_CCDEFFLAGS} ${WINRCFLAGS} ${_CPPINCFLAGS} ${_CCINCFLAGS} ${WINRC_TGT_F} ${TGT} ${WINRC_SRC_F} ${SRC}'
16 @extension(EXT_WINRC)
17 def rc_file(self, node):
18 obj_ext = '.rc.o'
19 if self.env['WINRC_TGT_F'] == '/fo': obj_ext = '.res'
21 rctask = self.create_task('winrc', node, node.change_ext(obj_ext))
22 self.compiled_tasks.append(rctask)
24 # create our action, for use with rc file
25 Task.simple_task_type('winrc', winrc_str, color='BLUE', before='cc cxx', shell=False)
27 def detect(conf):
28 v = conf.env
30 winrc = v['WINRC']
31 v['WINRC_TGT_F'] = '-o'
32 v['WINRC_SRC_F'] = '-i'
33 # find rc.exe
34 if not winrc:
35 if v['CC_NAME'] in ['gcc', 'cc', 'g++', 'c++']:
36 winrc = conf.find_program('windres', var='WINRC', path_list = v['PATH'])
37 elif v['CC_NAME'] == 'msvc':
38 winrc = conf.find_program('RC', var='WINRC', path_list = v['PATH'])
39 v['WINRC_TGT_F'] = '/fo'
40 v['WINRC_SRC_F'] = ''
41 if not winrc:
42 conf.fatal('winrc was not found!')
44 v['WINRCFLAGS'] = ''