13
0

hack wscript to correctly rebuild ardour3_FOO.rc files after changes to files ##include'd in the template

git-svn-id: svn://localhost/ardour2/branches/3.0@10312 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-10-26 21:47:08 +00:00
parent 51ab5ccabf
commit 795b7f05c0

View File

@ -5,6 +5,8 @@ import waflib.Logs as Logs, waflib.Utils as Utils
import os import os
import sys import sys
import re import re
import time
from waflib.Task import Task
# Version of this package (even if built as a child) # Version of this package (even if built as a child)
MAJOR = '3' MAJOR = '3'
@ -277,18 +279,11 @@ def set_winegcc(self):
self.env.LINK_CXX = self.env.LINK_CC = 'wineg++' self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
self.env.CC = 'winegcc' self.env.CC = 'winegcc'
#pre-processor-like operation to merge GTK RC files def _doPyp(infileName, deps = False):
re_spaces = re.compile("\s+")
def _doPyp(infileName):
"""
Does the main work of preprocessing.
Takes 'infileName' as a filename, opens and processes it,
and returns the processed file as a string
Note - this works recursively.
"""
outStr = '' outStr = ''
out = []
re_spaces = re.compile("\s+")
if infileName == '-': if infileName == '-':
fd = sys.stdin fd = sys.stdin
else: else:
@ -297,18 +292,26 @@ def _doPyp(infileName):
if fd != sys.stdin: if fd != sys.stdin:
fd.close() fd.close()
for line in inLines: for line in inLines:
bits = re_spaces.split(line) bits = re_spaces.split(line)
if bits[0] == '##include': if bits[0] == '##include':
incName = bits[1] incName = bits[1]
# assume included file comes from same place as source file if (deps):
incName = os.path.join (os.path.dirname (infileName), incName); out += [ incName ]
outStr += _doPyp(incName) else:
# assume included file comes from same place as source file
incName = os.path.join (os.path.dirname (infileName), incName);
outStr += _doPyp(incName)
else: else:
outStr += line if not deps:
outStr += line
# done # done
return outStr if deps:
return out
else:
return outStr
def include_processor(task): def include_processor(task):
infileName = task.inputs[0].srcpath() infileName = task.inputs[0].srcpath()
@ -335,7 +338,6 @@ def build_color_scheme(path, prefix):
f.close() f.close()
return color_scheme return color_scheme
def build(bld): def build(bld):
# GTK front-end; if we're using VST we build this as a shared library, # GTK front-end; if we're using VST we build this as a shared library,
# otherwise it's a normal executabale # otherwise it's a normal executabale
@ -560,11 +562,15 @@ def build(bld):
obj = bld (rule = include_processor) obj = bld (rule = include_processor)
obj.source = [ 'ardour3_ui_dark.rc.pre' ] obj.source = [ 'ardour3_ui_dark.rc.pre' ]
# find and add all ##include dependencies as sources
obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
obj.target = 'ardour3_ui_dark.rc' obj.target = 'ardour3_ui_dark.rc'
obj.install_path = '${SYSCONFDIR}/ardour3' obj.install_path = '${SYSCONFDIR}/ardour3'
obj = bld (rule = include_processor) obj = bld (rule = include_processor)
obj.source = [ 'ardour3_ui_light.rc.pre' ] obj.source = [ 'ardour3_ui_light.rc.pre' ]
# find and add all ##include dependencies as sources
obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
obj.target = 'ardour3_ui_light.rc' obj.target = 'ardour3_ui_light.rc'
obj.install_path = '${SYSCONFDIR}/ardour3' obj.install_path = '${SYSCONFDIR}/ardour3'