jack2 codebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

475 lines
20KB

  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. from __future__ import print_function
  4. import os
  5. import Utils
  6. import Options
  7. import subprocess
  8. g_maxlen = 40
  9. import shutil
  10. import Task
  11. import re
  12. import Logs
  13. import sys
  14. import waflib.Options
  15. from waflib.Build import BuildContext, CleanContext, InstallContext, UninstallContext
  16. VERSION='1.9.11'
  17. APPNAME='jack'
  18. JACK_API_VERSION = '0.1.0'
  19. # these variables are mandatory ('/' are converted automatically)
  20. top = '.'
  21. out = 'build'
  22. # lib32 variant name used when building in mixed mode
  23. lib32 = 'lib32'
  24. def display_msg(msg, status = None, color = None):
  25. sr = msg
  26. global g_maxlen
  27. g_maxlen = max(g_maxlen, len(msg))
  28. if status:
  29. Logs.pprint('NORMAL', "%s :" % msg.ljust(g_maxlen), sep=' ')
  30. Logs.pprint(color, status)
  31. else:
  32. print("%s" % msg.ljust(g_maxlen))
  33. def display_feature(msg, build):
  34. if build:
  35. display_msg(msg, "yes", 'GREEN')
  36. else:
  37. display_msg(msg, "no", 'YELLOW')
  38. def create_svnversion_task(bld, header='svnversion.h', define=None):
  39. cmd = '../svnversion_regenerate.sh ${TGT}'
  40. if define:
  41. cmd += " " + define
  42. def post_run(self):
  43. sg = Utils.h_file(self.outputs[0].abspath(self.env))
  44. #print sg.encode('hex')
  45. Build.bld.node_sigs[self.env.variant()][self.outputs[0].id] = sg
  46. bld(
  47. rule = cmd,
  48. name = 'svnversion',
  49. runnable_status = Task.RUN_ME,
  50. before = 'c',
  51. color = 'BLUE',
  52. post_run = post_run,
  53. target = [bld.path.find_or_declare(header)]
  54. )
  55. def options(opt):
  56. # options provided by the modules
  57. opt.tool_options('compiler_cxx')
  58. opt.tool_options('compiler_cc')
  59. # install directories
  60. opt.add_option('--libdir', type='string', help="Library directory [Default: <prefix>/lib]")
  61. opt.add_option('--libdir32', type='string', help="32bit Library directory [Default: <prefix>/lib32]")
  62. opt.add_option('--mandir', type='string', help="Manpage directory [Default: <prefix>/share/man/man1]")
  63. # options affecting binaries
  64. opt.add_option('--dist-target', type='string', default='auto', help='Specify the target for cross-compiling [auto,mingw]')
  65. opt.add_option('--mixed', action='store_true', default=False, help='Build with 32/64 bits mixed mode')
  66. opt.add_option('--debug', action='store_true', default=False, dest='debug', help='Build debuggable binaries')
  67. # options affecting general jack functionality
  68. opt.add_option('--classic', action='store_true', default=False, help='Force enable standard JACK (jackd) even if D-Bus JACK (jackdbus) is enabled too')
  69. opt.add_option('--dbus', action='store_true', default=False, help='Enable D-Bus JACK (jackdbus)')
  70. opt.add_option('--autostart', type='string', default="default", help='Autostart method. Possible values: "default", "classic", "dbus", "none"')
  71. opt.add_option('--profile', action='store_true', default=False, help='Build with engine profiling')
  72. opt.add_option('--clients', default=64, type="int", dest="clients", help='Maximum number of JACK clients')
  73. opt.add_option('--ports-per-application', default=768, type="int", dest="application_ports", help='Maximum number of ports per application')
  74. # options with third party dependencies
  75. opt.add_option('--doxygen', action='store_true', default=False, help='Enable build of doxygen documentation')
  76. opt.add_option('--alsa', action='store_true', default=False, help='Enable ALSA driver')
  77. opt.add_option('--firewire', action='store_true', default=False, help='Enable FireWire driver (FFADO)')
  78. opt.add_option('--freebob', action='store_true', default=False, help='Enable FreeBob driver')
  79. opt.add_option('--iio', action='store_true', default=False, help='Enable IIO driver')
  80. opt.add_option('--portaudio', action='store_true', default=False, help='Enable Portaudio driver')
  81. opt.add_option('--winmme', action='store_true', default=False, help='Enable WinMME driver')
  82. # dbus options
  83. opt.sub_options('dbus')
  84. def configure(conf):
  85. conf.load('compiler_cxx')
  86. conf.load('compiler_cc')
  87. if Options.options.dist_target == 'auto':
  88. platform = sys.platform
  89. conf.env['IS_MACOSX'] = platform == 'darwin'
  90. conf.env['IS_LINUX'] = platform == 'linux' or platform == 'linux2' or platform == 'linux3' or platform == 'posix'
  91. conf.env['IS_SUN'] = platform == 'sunos'
  92. # GNU/kFreeBSD and GNU/Hurd are treated as Linux
  93. if platform.startswith('gnu0') or platform.startswith('gnukfreebsd'):
  94. conf.env['IS_LINUX'] = True
  95. elif Options.options.dist_target == 'mingw':
  96. conf.env['IS_WINDOWS'] = True
  97. if conf.env['IS_LINUX']:
  98. Logs.pprint('CYAN', "Linux detected")
  99. if conf.env['IS_MACOSX']:
  100. Logs.pprint('CYAN', "MacOS X detected")
  101. if conf.env['IS_SUN']:
  102. Logs.pprint('CYAN', "SunOS detected")
  103. if conf.env['IS_WINDOWS']:
  104. Logs.pprint('CYAN', "Windows detected")
  105. if conf.env['IS_LINUX']:
  106. conf.check_tool('compiler_cxx')
  107. conf.check_tool('compiler_cc')
  108. if conf.env['IS_MACOSX']:
  109. conf.check_tool('compiler_cxx')
  110. conf.check_tool('compiler_cc')
  111. # waf 1.5 : check_tool('compiler_cxx') and check_tool('compiler_cc') do not work correctly, so explicit use of gcc and g++
  112. if conf.env['IS_SUN']:
  113. conf.check_tool('g++')
  114. conf.check_tool('gcc')
  115. #if conf.env['IS_SUN']:
  116. # conf.check_tool('compiler_cxx')
  117. # conf.check_tool('compiler_cc')
  118. if conf.env['IS_WINDOWS']:
  119. conf.check_tool('compiler_cxx')
  120. conf.check_tool('compiler_cc')
  121. conf.env.append_unique('CCDEFINES', '_POSIX')
  122. conf.env.append_unique('CXXDEFINES', '_POSIX')
  123. conf.env.append_unique('CXXFLAGS', '-Wall')
  124. conf.env.append_unique('CFLAGS', '-Wall')
  125. conf.sub_config('common')
  126. if conf.env['IS_LINUX']:
  127. conf.sub_config('linux')
  128. if Options.options.alsa and not conf.env['BUILD_DRIVER_ALSA']:
  129. conf.fatal('ALSA driver was explicitly requested but cannot be built')
  130. if Options.options.freebob and not conf.env['BUILD_DRIVER_FREEBOB']:
  131. conf.fatal('FreeBob driver was explicitly requested but cannot be built')
  132. if Options.options.firewire and not conf.env['BUILD_DRIVER_FFADO']:
  133. conf.fatal('FFADO driver was explicitly requested but cannot be built')
  134. if Options.options.iio and not conf.env['BUILD_DRIVER_IIO']:
  135. conf.fatal('IIO driver was explicitly requested but cannot be built')
  136. conf.env['BUILD_DRIVER_ALSA'] = Options.options.alsa
  137. conf.env['BUILD_DRIVER_FFADO'] = Options.options.firewire
  138. conf.env['BUILD_DRIVER_FREEBOB'] = Options.options.freebob
  139. conf.env['BUILD_DRIVER_IIO'] = Options.options.iio
  140. if conf.env['IS_WINDOWS']:
  141. conf.sub_config('windows')
  142. if Options.options.portaudio and not conf.env['BUILD_DRIVER_PORTAUDIO']:
  143. conf.fatal('Portaudio driver was explicitly requested but cannot be built')
  144. conf.env['BUILD_DRIVER_WINMME'] = Options.options.winmme
  145. if Options.options.dbus:
  146. conf.sub_config('dbus')
  147. if conf.env['BUILD_JACKDBUS'] != True:
  148. conf.fatal('jackdbus was explicitly requested but cannot be built')
  149. conf.check_cc(header_name='samplerate.h', define_name="HAVE_SAMPLERATE")
  150. if conf.is_defined('HAVE_SAMPLERATE'):
  151. conf.env['LIB_SAMPLERATE'] = ['samplerate']
  152. conf.sub_config('example-clients')
  153. if conf.check_cfg(package='celt', atleast_version='0.11.0', args='--cflags --libs', mandatory=False):
  154. conf.define('HAVE_CELT', 1)
  155. conf.define('HAVE_CELT_API_0_11', 1)
  156. conf.define('HAVE_CELT_API_0_8', 0)
  157. conf.define('HAVE_CELT_API_0_7', 0)
  158. conf.define('HAVE_CELT_API_0_5', 0)
  159. elif conf.check_cfg(package='celt', atleast_version='0.8.0', args='--cflags --libs', mandatory=False):
  160. conf.define('HAVE_CELT', 1)
  161. conf.define('HAVE_CELT_API_0_11', 0)
  162. conf.define('HAVE_CELT_API_0_8', 1)
  163. conf.define('HAVE_CELT_API_0_7', 0)
  164. conf.define('HAVE_CELT_API_0_5', 0)
  165. elif conf.check_cfg(package='celt', atleast_version='0.7.0', args='--cflags --libs', mandatory=False):
  166. conf.define('HAVE_CELT', 1)
  167. conf.define('HAVE_CELT_API_0_11', 0)
  168. conf.define('HAVE_CELT_API_0_8', 0)
  169. conf.define('HAVE_CELT_API_0_7', 1)
  170. conf.define('HAVE_CELT_API_0_5', 0)
  171. elif conf.check_cfg(package='celt', atleast_version='0.5.0', args='--cflags --libs', mandatory=False):
  172. conf.define('HAVE_CELT', 1)
  173. conf.define('HAVE_CELT_API_0_11', 0)
  174. conf.define('HAVE_CELT_API_0_8', 0)
  175. conf.define('HAVE_CELT_API_0_7', 0)
  176. conf.define('HAVE_CELT_API_0_5', 1)
  177. else:
  178. conf.define('HAVE_CELT', 0)
  179. conf.define('HAVE_CELT_API_0_11', 0)
  180. conf.define('HAVE_CELT_API_0_8', 0)
  181. conf.define('HAVE_CELT_API_0_7', 0)
  182. conf.define('HAVE_CELT_API_0_5', 0)
  183. conf.env['WITH_OPUS'] = False
  184. if conf.check_cfg(package='opus', atleast_version='0.9.0' , args='--cflags --libs', mandatory=False):
  185. if conf.check_cc(header_name='opus/opus_custom.h', mandatory=False):
  186. conf.define('HAVE_OPUS', 1)
  187. conf.env['WITH_OPUS'] = True
  188. else:
  189. conf.define('HAVE_OPUS', 0)
  190. conf.env['LIB_PTHREAD'] = ['pthread']
  191. conf.env['LIB_DL'] = ['dl']
  192. conf.env['LIB_RT'] = ['rt']
  193. conf.env['LIB_M'] = ['m']
  194. conf.env['LIB_STDC++'] = ['stdc++']
  195. conf.env['JACK_API_VERSION'] = JACK_API_VERSION
  196. conf.env['JACK_VERSION'] = VERSION
  197. conf.env['BUILD_DOXYGEN_DOCS'] = Options.options.doxygen
  198. conf.env['BUILD_WITH_PROFILE'] = Options.options.profile
  199. conf.env['BUILD_WITH_32_64'] = Options.options.mixed
  200. conf.env['BUILD_CLASSIC'] = Options.options.classic
  201. conf.env['BUILD_DEBUG'] = Options.options.debug
  202. if conf.env['BUILD_JACKDBUS']:
  203. conf.env['BUILD_JACKD'] = conf.env['BUILD_CLASSIC']
  204. else:
  205. conf.env['BUILD_JACKD'] = True
  206. conf.env['BINDIR'] = conf.env['PREFIX'] + '/bin'
  207. if Options.options.libdir:
  208. conf.env['LIBDIR'] = Options.options.libdir
  209. else:
  210. conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib'
  211. if Options.options.mandir:
  212. conf.env['MANDIR'] = Options.options.mandir
  213. else:
  214. conf.env['MANDIR'] = conf.env['PREFIX'] + '/share/man/man1'
  215. if conf.env['BUILD_DEBUG']:
  216. conf.env.append_unique('CXXFLAGS', '-g')
  217. conf.env.append_unique('CFLAGS', '-g')
  218. conf.env.append_unique('LINKFLAGS', '-g')
  219. if not Options.options.autostart in ["default", "classic", "dbus", "none"]:
  220. conf.fatal("Invalid autostart value \"" + Options.options.autostart + "\"")
  221. if Options.options.autostart == "default":
  222. if conf.env['BUILD_JACKDBUS'] == True and conf.env['BUILD_JACKD'] == False:
  223. conf.env['AUTOSTART_METHOD'] = "dbus"
  224. else:
  225. conf.env['AUTOSTART_METHOD'] = "classic"
  226. else:
  227. conf.env['AUTOSTART_METHOD'] = Options.options.autostart
  228. if conf.env['AUTOSTART_METHOD'] == "dbus" and not conf.env['BUILD_JACKDBUS']:
  229. conf.fatal("D-Bus autostart mode was specified but jackdbus will not be built")
  230. if conf.env['AUTOSTART_METHOD'] == "classic" and not conf.env['BUILD_JACKD']:
  231. conf.fatal("Classic autostart mode was specified but jackd will not be built")
  232. if conf.env['AUTOSTART_METHOD'] == "dbus":
  233. conf.define('USE_LIBDBUS_AUTOLAUNCH', 1)
  234. elif conf.env['AUTOSTART_METHOD'] == "classic":
  235. conf.define('USE_CLASSIC_AUTOLAUNCH', 1)
  236. conf.define('CLIENT_NUM', Options.options.clients)
  237. conf.define('PORT_NUM_FOR_CLIENT', Options.options.application_ports)
  238. if conf.env['IS_WINDOWS']:
  239. # we define this in the environment to maintain compatability with
  240. # existing install paths that use ADDON_DIR rather than have to
  241. # have special cases for windows each time.
  242. conf.env['ADDON_DIR'] = conf.env['BINDIR'] + '/jack'
  243. # don't define ADDON_DIR in config.h, use the default 'jack' defined in
  244. # windows/JackPlatformPlug_os.h
  245. else:
  246. conf.env['ADDON_DIR'] = os.path.normpath(os.path.join(conf.env['LIBDIR'], 'jack'))
  247. conf.define('ADDON_DIR', conf.env['ADDON_DIR'])
  248. conf.define('JACK_LOCATION', os.path.normpath(os.path.join(conf.env['PREFIX'], 'bin')))
  249. if not conf.env['IS_WINDOWS']:
  250. conf.define('USE_POSIX_SHM', 1)
  251. conf.define('JACKMP', 1)
  252. if conf.env['BUILD_JACKDBUS'] == True:
  253. conf.define('JACK_DBUS', 1)
  254. if conf.env['BUILD_WITH_PROFILE'] == True:
  255. conf.define('JACK_MONITOR', 1)
  256. conf.write_config_header('config.h', remove=False)
  257. svnrev = None
  258. if os.access('svnversion.h', os.R_OK):
  259. data = file('svnversion.h').read()
  260. m = re.match(r'^#define SVN_VERSION "([^"]*)"$', data)
  261. if m != None:
  262. svnrev = m.group(1)
  263. if Options.options.mixed == True:
  264. conf.setenv(lib32, env=conf.env.derive())
  265. conf.env.append_unique('CXXFLAGS', '-m32')
  266. conf.env.append_unique('CFLAGS', '-m32')
  267. conf.env.append_unique('LINKFLAGS', '-m32')
  268. if Options.options.libdir32:
  269. conf.env['LIBDIR'] = Options.options.libdir32
  270. else:
  271. conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib32'
  272. conf.write_config_header('config.h')
  273. print()
  274. display_msg("==================")
  275. version_msg = "JACK " + VERSION
  276. if svnrev:
  277. version_msg += " exported from r" + svnrev
  278. else:
  279. version_msg += " svn revision will checked and eventually updated during build"
  280. print(version_msg)
  281. print("Build with a maximum of %d JACK clients" % Options.options.clients)
  282. print("Build with a maximum of %d ports per application" % Options.options.application_ports)
  283. display_msg("Install prefix", conf.env['PREFIX'], 'CYAN')
  284. display_msg("Library directory", conf.all_envs[""]['LIBDIR'], 'CYAN')
  285. if conf.env['BUILD_WITH_32_64'] == True:
  286. display_msg("32-bit library directory", conf.all_envs[lib32]['LIBDIR'], 'CYAN')
  287. display_msg("Drivers directory", conf.env['ADDON_DIR'], 'CYAN')
  288. display_feature('Build debuggable binaries', conf.env['BUILD_DEBUG'])
  289. display_msg('C compiler flags', repr(conf.all_envs[""]['CFLAGS']))
  290. display_msg('C++ compiler flags', repr(conf.all_envs[""]['CXXFLAGS']))
  291. display_msg('Linker flags', repr(conf.all_envs[""]['LINKFLAGS']))
  292. if conf.env['BUILD_WITH_32_64'] == True:
  293. display_msg('32-bit C compiler flags', repr(conf.all_envs[lib32]['CFLAGS']))
  294. display_msg('32-bit C++ compiler flags', repr(conf.all_envs[lib32]['CXXFLAGS']))
  295. display_msg('32-bit linker flags', repr(conf.all_envs[lib32]['LINKFLAGS']))
  296. display_feature('Build doxygen documentation', conf.env['BUILD_DOXYGEN_DOCS'])
  297. display_feature('Build Opus netjack2', conf.env['WITH_OPUS'])
  298. display_feature('Build with engine profiling', conf.env['BUILD_WITH_PROFILE'])
  299. display_feature('Build with 32/64 bits mixed mode', conf.env['BUILD_WITH_32_64'])
  300. display_feature('Build standard JACK (jackd)', conf.env['BUILD_JACKD'])
  301. display_feature('Build D-Bus JACK (jackdbus)', conf.env['BUILD_JACKDBUS'])
  302. display_msg('Autostart method', conf.env['AUTOSTART_METHOD'])
  303. if conf.env['BUILD_JACKDBUS'] and conf.env['BUILD_JACKD']:
  304. print(Logs.colors.RED + 'WARNING !! mixing both jackd and jackdbus may cause issues:' + Logs.colors.NORMAL)
  305. print(Logs.colors.RED + 'WARNING !! jackdbus does not use .jackdrc nor qjackctl settings' + Logs.colors.NORMAL)
  306. if conf.env['IS_LINUX']:
  307. display_feature('Build with ALSA support', conf.env['BUILD_DRIVER_ALSA'] == True)
  308. display_feature('Build with FireWire (FreeBob) support', conf.env['BUILD_DRIVER_FREEBOB'] == True)
  309. display_feature('Build with FireWire (FFADO) support', conf.env['BUILD_DRIVER_FFADO'] == True)
  310. display_feature('Build with IIO support', conf.env['BUILD_DRIVER_IIO'] == True)
  311. if conf.env['IS_WINDOWS']:
  312. display_feature('Build with WinMME support', conf.env['BUILD_DRIVER_WINMME'] == True)
  313. display_feature('Build with Portaudio support', conf.env['BUILD_DRIVER_PORTAUDIO'] == True)
  314. if conf.env['BUILD_JACKDBUS'] == True:
  315. display_msg('D-Bus service install directory', conf.env['DBUS_SERVICES_DIR'], 'CYAN')
  316. #display_msg('Settings persistence', xxx)
  317. if conf.env['DBUS_SERVICES_DIR'] != conf.env['DBUS_SERVICES_DIR_REAL']:
  318. print()
  319. print(Logs.colors.RED + "WARNING: D-Bus session services directory as reported by pkg-config is")
  320. print(Logs.colors.RED + "WARNING:", end=' ')
  321. print(Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR_REAL'])
  322. print(Logs.colors.RED + 'WARNING: but service file will be installed in')
  323. print(Logs.colors.RED + "WARNING:", end=' ')
  324. print(Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR'])
  325. print(Logs.colors.RED + 'WARNING: You may need to adjust your D-Bus configuration after installing jackdbus')
  326. print('WARNING: You can override dbus service install directory')
  327. print('WARNING: with --enable-pkg-config-dbus-service-dir option to this script')
  328. print(Logs.colors.NORMAL, end=' ')
  329. print()
  330. def init(ctx):
  331. for y in (BuildContext, CleanContext, InstallContext, UninstallContext):
  332. name = y.__name__.replace('Context','').lower()
  333. class tmp(y):
  334. cmd = name + '_' + lib32
  335. variant = lib32
  336. def build(bld):
  337. if not bld.variant:
  338. out2 = out
  339. else:
  340. out2 = out + "/" + bld.variant
  341. print("make[1]: Entering directory `" + os.getcwd() + "/" + out2 + "'")
  342. if not bld.variant:
  343. if not os.access('svnversion.h', os.R_OK):
  344. create_svnversion_task(bld)
  345. if bld.env['BUILD_WITH_32_64'] == True:
  346. waflib.Options.commands.append(bld.cmd + '_' + lib32)
  347. # process subfolders from here
  348. bld.add_subdirs('common')
  349. if bld.variant:
  350. # only the wscript in common/ knows how to handle variants
  351. return
  352. if bld.env['IS_LINUX']:
  353. bld.add_subdirs('linux')
  354. bld.add_subdirs('example-clients')
  355. bld.add_subdirs('tests')
  356. bld.add_subdirs('man')
  357. if bld.env['BUILD_JACKDBUS'] == True:
  358. bld.add_subdirs('dbus')
  359. if bld.env['IS_MACOSX']:
  360. bld.add_subdirs('macosx')
  361. bld.add_subdirs('example-clients')
  362. bld.add_subdirs('tests')
  363. if bld.env['BUILD_JACKDBUS'] == True:
  364. bld.add_subdirs('dbus')
  365. if bld.env['IS_SUN']:
  366. bld.add_subdirs('solaris')
  367. bld.add_subdirs('example-clients')
  368. bld.add_subdirs('tests')
  369. if bld.env['BUILD_JACKDBUS'] == True:
  370. bld.add_subdirs('dbus')
  371. if bld.env['IS_WINDOWS']:
  372. bld.add_subdirs('windows')
  373. bld.add_subdirs('example-clients')
  374. #bld.add_subdirs('tests')
  375. if bld.env['BUILD_DOXYGEN_DOCS'] == True:
  376. html_docs_source_dir = "build/default/html"
  377. if bld.cmd == 'install':
  378. share_dir = bld.options.destdir + bld.env['PREFIX'] + '/share/jack-audio-connection-kit'
  379. html_docs_install_dir = share_dir + '/reference/html/'
  380. if os.path.isdir(html_docs_install_dir):
  381. Logs.pprint('CYAN', "Removing old doxygen documentation installation...")
  382. shutil.rmtree(html_docs_install_dir)
  383. Logs.pprint('CYAN', "Removing old doxygen documentation installation done.")
  384. Logs.pprint('CYAN', "Installing doxygen documentation...")
  385. shutil.copytree(html_docs_source_dir, html_docs_install_dir)
  386. Logs.pprint('CYAN', "Installing doxygen documentation done.")
  387. elif bld.cmd =='uninstall':
  388. Logs.pprint('CYAN', "Uninstalling doxygen documentation...")
  389. if os.path.isdir(share_dir):
  390. shutil.rmtree(share_dir)
  391. Logs.pprint('CYAN', "Uninstalling doxygen documentation done.")
  392. elif bld.cmd =='clean':
  393. if os.access(html_docs_source_dir, os.R_OK):
  394. Logs.pprint('CYAN', "Removing doxygen generated documentation...")
  395. shutil.rmtree(html_docs_source_dir)
  396. Logs.pprint('CYAN', "Removing doxygen generated documentation done.")
  397. elif bld.cmd =='build':
  398. if not os.access(html_docs_source_dir, os.R_OK):
  399. os.popen("doxygen").read()
  400. else:
  401. Logs.pprint('CYAN', "doxygen documentation already built.")
  402. def dist_hook():
  403. os.remove('svnversion_regenerate.sh')
  404. os.system('../svnversion_regenerate.sh svnversion.h')