4 Experimental scons (www.scons.org) building:
12 scons build=DIR # scrdir build, write to new tree =build
13 scons out=DIR # write output to deeper dir DIR
15 Optionally, make a custom.py. I have
29 # *, Documentation, ly etc.
40 # put your favourite stuff in custom.py
41 opts = Options ('custom.py', ARGUMENTS)
42 opts.Add ('prefix', 'Install prefix', '/usr/')
43 opts.Add ('out', 'Output directory', 'out-scons')
44 opts.Add ('build', 'Build directory', '.')
46 BoolOption ('warnings', 'compile with -Wall and similiar',
48 BoolOption ('debugging', 'compile with debugging symbols',
50 BoolOption ('optimising', 'compile with optimising',
52 BoolOption ('shared', 'build shared libraries',
54 BoolOption ('static', 'build static libraries',
58 Help (opts.GenerateHelpText (env))
60 env = Environment (options = opts)
62 env.CacheDir (os.path.join (env['build'], '=build-cache'))
65 sys.path.append (os.path.join ('.', 'stepmake', 'bin'))
67 package = packagepython.Package ('.')
69 env['version'] = packagepython.version_tuple_to_str (package.version)
70 env['bindir'] = os.path.join (env['prefix'], 'bin')
71 env['sharedir'] = os.path.join (env['prefix'], 'share')
72 env['libdir'] = os.path.join (env['prefix'], 'lib')
73 env['lilypondprefix'] = os.path.join (env['sharedir'], 'lilypond',
77 env.Append (CFLAGS = '-g')
78 env.Append (CXXFLAGS = '-g')
80 env.Append (CFLAGS = '-O2')
81 env.Append (CXXFLAGS = '-O2')
82 env.Append (CXXFLAGS = '-DSTRING_UTILS_INLINED')
84 env.Append (CFLAGS = '-W ')
85 env.Append (CFLAGS = '-Wall')
86 env.Append (CXXFLAGS = '-W')
87 env.Append (CXXFLAGS = '-Wall')
88 env.Append (CXXFLAGS = '-Wconversion')
90 env['MFMODE'] = 'ljfour'
92 conf = Configure (env)
94 #ugh -- hardcode territory
99 '2PACKAGE': '"lilypond"',
100 '3TOPLEVEL_VERSION' : '"2.3.6"',
101 '4DATADIR' : '"' + os.getcwd () + '/share"',
102 '5PACKAGE_DATADIR': 'DATADIR "/" PACKAGE',
103 '6LILYPOND_DATADIR' : 'PACKAGE_DATADIR',
104 '7LOCAL_PACKAGE_DATADIR' : 'PACKAGE_DATADIR "/" TOPLEVEL_VERSION',
105 '8LOCAL_LILYPOND_DATADIR' : 'LOCAL_PACKAGE_DATADIR',
106 '9LOCALEDIR' : '"' + os.getcwd () + '/share/locale"',
109 headers = ('sys/stat.h', 'assert.h', 'kpathsea/kpathsea.h')
111 if conf.CheckCHeader (i):
112 key = re.sub ('[./]', '_', 'zHAVE_' + string.upper (i))
115 ccheaders = ('sstream',)
117 if conf.CheckCXXHeader (i):
118 key = re.sub ('[./]', '_', 'zHAVE_' + string.upper (i))
121 functions = ('gettext', 'isinf', 'memmem', 'snprintf', 'vsnprintf')
123 if 0 or conf.CheckFunc (i):
124 key = re.sub ('[./]', '_', 'zHAVE_' + string.upper (i))
128 key = 'HAVE_FLEXLEXER_YY_CURRENT_BUFFER'
129 defines[key] = conf.TryCompile("""using namespace std;
130 #include <FlexLexer.h>
131 class yy_flex_lexer: public yyFlexLexer
136 yy_current_buffer = 0;
140 if conf.CheckLib ('dl'):
143 if conf.CheckLib ('kpathsea'):
144 defines['KPATHSEA'] = '1'
147 if conf.CheckLib ('kpathsea', 'kpse_find_file'):
148 defines['HAVE_KPSE_FIND_FILE'] = '1'
154 #this could happen after flower...
155 env.ParseConfig ('guile-config compile')
159 ##reldir = str (Dir ('.').srcnode ())
160 reldir = os.getcwd ()
161 outdir = os.path.join (env['build'], reldir, env['out'])
162 if not os.path.exists (outdir):
165 config = open (os.path.join (outdir, 'config.h'), 'w')
166 sort_helper = defines.keys ()
168 for i in sort_helper:
169 config.write ('#define %s %s\n' % (i[1:], defines[i]))
172 os.system (sys.executable \
173 + ' ./stepmake/bin/make-version.py VERSION > '\
174 + os.path.join (build, 'version.hh'))
176 if os.path.exists ('parser'):
177 env.Append (LIBPATH = ['#/flower', '#/lily', '#/parser', '#/gui',],
178 CPPPATH = [outdir, '#',])
180 env.Append (LIBPATH = ['#/flower/' + out,],
181 CPPPATH = [outdir, '#',])
184 #subdirs = ('flower', 'lily', 'parser', 'gui', 'main',)
185 subdirs = ('flower', 'lily', 'mf')
187 b = os.path.join (build, d, out)
188 # Support clean sourctree build (srcdir build)
190 # TODO: figure out SConscript (dir, builddir, duplicate)) feature
191 if (build and build != '.') \
192 or (out and out != '.'):
193 env.BuildDir (b, d, duplicate=0)
194 SConscript (os.path.join (b, 'SConscript'))