3 # gen-make.py -- generate makefiles for building Subversion
11 my_getopt
= getopt
.gnu_getopt
12 except AttributeError:
13 my_getopt
= getopt
.getopt
16 # for the generator modules
17 sys
.path
.insert(0, os
.path
.join('build', 'generator'))
20 sys
.path
.insert(1, 'build')
23 'make' : ('gen_make', 'Makefiles for POSIX systems'),
24 'dsp' : ('gen_msvc_dsp', 'MSVC 6.x project files'),
25 'vcproj' : ('gen_vcnet_vcproj', 'VC.Net project files'),
28 def main(fname
, gentype
, verfname
=None,
29 skip_depends
=0, other_options
=None):
31 verfname
= os
.path
.join('subversion', 'include', 'svn_version.h')
33 gen_module
= __import__(gen_modules
[gentype
][0])
35 generator
= gen_module
.Generator(fname
, verfname
, other_options
)
38 generator
.compute_hdr_deps()
42 if ('--debug', '') in other_options
:
43 for dep_type
, target_dict
in generator
.graph
.deps
.items():
44 sorted_targets
= target_dict
.keys(); sorted_targets
.sort()
45 for target
in sorted_targets
:
46 print dep_type
+ ": " + _objinfo(target
)
47 for source
in target_dict
[target
]:
48 print " " + _objinfo(source
)
50 gen_keys
= generator
.__dict
__.keys()
53 value
= generator
.__dict
__[name
]
54 if type(value
) == type([]):
57 print " " + _objinfo(i
)
62 if type(o
) == type(''):
65 t
= o
.__class
__.__name
__
66 n
= getattr(o
, 'name', '-')
67 f
= getattr(o
, 'filename', '-')
68 return "%s: %s %s" % (t
,n
,f
)
72 "print usage, exit the script"
73 print "USAGE: gen-make.py [options...] [conf-file]"
74 print " -s skip dependency generation"
75 print " --debug print lots of stuff only developers care about"
76 print " --release release mode"
77 print " --reload reuse all options from the previous invocation"
78 print " of the script, except -s, -t, --debug and --reload"
79 print " -t TYPE use the TYPE generator; can be one of:"
80 items
= gen_modules
.items()
82 for name
, (module
, desc
) in items
:
83 print ' %-12s %s' % (name
, desc
)
85 print " The default generator type is 'make'"
87 print " Makefile-specific options:"
89 print " --assume-shared-libs"
90 print " omit dependencies on libraries, on the assumption that"
91 print " shared libraries will be built, so that it is unnecessary"
92 print " to relink executables when the libraries that they depend"
93 print " on change. This is an option for developers who want to"
94 print " increase the speed of frequent rebuilds."
95 print " *** Do not use unless you understand the consequences. ***"
97 print " UNIX-specific options:"
99 print " --installed-libs"
100 print " Comma-separated list of Subversion libraries to find"
101 print " pre-installed instead of building (probably only"
102 print " useful for packagers)"
104 print " Windows-specific options:"
106 print " --with-apr=DIR"
107 print " the APR sources are in DIR"
109 print " --with-apr-util=DIR"
110 print " the APR-Util sources are in DIR"
112 print " --with-apr-iconv=DIR"
113 print " the APR-Iconv sources are in DIR"
115 print " --with-berkeley-db=DIR"
116 print " look for Berkeley DB headers and libs in"
119 print " --with-neon=DIR"
120 print " the Neon sources are in DIR"
122 print " --without-neon"
123 print " Don't build Neon sources (if present)"
125 print " --with-serf=DIR"
126 print " the Serf sources are in DIR"
128 print " --with-httpd=DIR"
129 print " the httpd sources and binaries required"
130 print " for building mod_dav_svn are in DIR;"
131 print " implies --with-apr{-util, -iconv}, but"
132 print " you can override them"
134 print " --with-libintl=DIR"
135 print " look for GNU libintl headers and libs in DIR;"
136 print " implies --enable-nls"
138 print " --with-openssl=DIR"
139 print " tell neon to look for OpenSSL headers"
140 print " and libs in DIR"
142 print " --with-zlib=DIR"
143 print " tell neon to look for ZLib headers and"
146 print " --with-junit=DIR"
147 print " look for the junit jar here"
148 print " junit is for testing the java bindings"
150 print " --with-swig=DIR"
151 print " look for the swig program in DIR"
153 print " --with-sasl=DIR"
154 print " look for the sasl headers and libs in DIR"
156 print " --enable-pool-debug"
157 print " turn on APR pool debugging"
159 print " --enable-purify"
160 print " add support for Purify instrumentation;"
161 print " implies --enable-pool-debug"
163 print " --enable-quantify"
164 print " add support for Quantify instrumentation"
166 print " --enable-nls"
167 print " add support for gettext localization"
169 print " --enable-bdb-in-apr-util"
170 print " configure APR-Util to use Berkeley DB"
173 print " enable use of ML assembler with zlib"
175 print " --disable-shared"
176 print " only build static libraries"
178 print " --vsnet-version=VER"
179 print " generate for VS.NET version VER (2002, 2003, 2005 or 2008)"
180 print " [only valid in combination with '-t vcproj']"
189 def add(self
, opt
, val
):
190 if self
.dict.has_key(opt
):
191 self
.list[self
.dict[opt
]] = (opt
, val
)
193 self
.dict[opt
] = len(self
.list)
194 self
.list.append((opt
, val
))
196 if __name__
== '__main__':
198 opts
, args
= my_getopt(sys
.argv
[1:], 'st:',
202 'assume-shared-libs',
221 'enable-bdb-in-apr-util',
229 except getopt
.GetoptError
:
240 for opt
, val
in opts
:
245 elif opt
== '--reload':
246 prev_conf
= ConfigParser
.ConfigParser()
247 prev_conf
.read('gen-make.opts')
248 for opt
, val
in prev_conf
.items('options'):
254 if opt
== '--with-httpd':
255 rest
.add('--with-apr', os
.path
.join(val
, 'srclib', 'apr'))
256 rest
.add('--with-apr-util', os
.path
.join(val
, 'srclib', 'apr-util'))
257 rest
.add('--with-apr-iconv', os
.path
.join(val
, 'srclib', 'apr-iconv'))
259 # Remember all options so that --reload and other scripts can use them
260 opt_conf
= open('gen-make.opts', 'w')
261 opt_conf
.write('[options]\n')
262 for opt
, val
in rest
.list:
263 opt_conf
.write(opt
+ ' = ' + val
+ '\n')
266 if gentype
not in gen_modules
.keys():
269 main(conf
, gentype
, skip_depends
=skip
, other_options
=rest
.list)