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 -DSTRING_UTILS_INLINED')
83 env.Append (CFLAGS = '-W -Wall')
84 env.Append (CXXFLAGS = '-W -Wall -Wconversion')
86 env['MFMODE'] = 'ljfour'
88 conf = Configure (env)
90 #ugh -- hardcode territory
95 '2PACKAGE': '"lilypond"',
96 '3TOPLEVEL_VERSION' : '"2.3.6"',
97 '4DATADIR' : '"' + os.getcwd () + '/share"',
98 '5PACKAGE_DATADIR': 'DATADIR "/" PACKAGE',
99 '6LILYPOND_DATADIR' : 'PACKAGE_DATADIR',
100 '7LOCAL_PACKAGE_DATADIR' : 'PACKAGE_DATADIR "/" TOPLEVEL_VERSION',
101 '8LOCAL_LILYPOND_DATADIR' : 'LOCAL_PACKAGE_DATADIR',
102 '9LOCALEDIR' : '"' + os.getcwd () + '/share/locale"',
105 headers = ('sys/stat.h', 'assert.h', 'kpathsea/kpathsea.h')
107 if conf.CheckCHeader (i):
108 key = re.sub ('[./]', '_', 'zHAVE_' + string.upper (i))
111 ccheaders = ('sstream',)
113 if conf.CheckCXXHeader (i):
114 key = re.sub ('[./]', '_', 'zHAVE_' + string.upper (i))
117 functions = ('gettext', 'isinf', 'memmem', 'snprintf', 'vsnprintf')
119 if 0 or conf.CheckFunc (i):
120 key = re.sub ('[./]', '_', 'zHAVE_' + string.upper (i))
123 if conf.CheckLib ('dl'):
126 if conf.CheckLib ('kpathsea'):
127 defines['KPATHSEA'] = '1'
133 #this could happen after flower...
134 env.ParseConfig ('guile-config compile')
138 ##reldir = str (Dir ('.').srcnode ())
139 reldir = os.getcwd ()
140 outdir = os.path.join (env['build'], reldir, env['out'])
141 if not os.path.exists (outdir):
144 config = open (os.path.join (outdir, 'config.h'), 'w')
145 sort_helper = defines.keys ()
147 for i in sort_helper:
148 config.write ('#define %s %s\n' % (i[1:], defines[i]))
151 os.system (sys.executable \
152 + ' ./stepmake/bin/make-version.py VERSION > '\
153 + os.path.join (build, 'version.hh'))
155 if os.path.exists ('parser'):
156 env.Append (LIBPATH = ['#/flower', '#/lily', '#/parser', '#/gui',],
157 CPPPATH = [outdir, '#',])
159 env.Append (LIBPATH = ['#/flower/' + out,],
160 CPPPATH = [outdir, '#',])
163 #subdirs = ('flower', 'lily', 'parser', 'gui', 'main',)
164 subdirs = ('flower', 'lily', 'mf')
166 b = os.path.join (build, d, out)
167 # Support clean sourctree build (srcdir build)
169 # TODO: figure out SConscript (dir, builddir, duplicate)) feature
170 if (build and build != '.') \
171 or (out and out != '.'):
172 env.BuildDir (b, d, duplicate=0)
173 SConscript (os.path.join (b, 'SConscript'))