freebsd-dev/contrib/serf/build/gen_def.py
Peter Wemm 937a200089 Introduce svnlite so that we can check out our source code again.
This is actually a fully functional build except:
* All internal shared libraries are static linked to make sure there
  is no interference with ports (and to reduce build time).
* It does not have the python/perl/etc plugin or API support.
* By default, it installs as "svnlite" rather than "svn".
* If WITH_SVN added in make.conf, you get "svn".
* If WITHOUT_SVNLITE is in make.conf, this is completely disabled.

To be absolutely clear, this is not intended for any use other than
checking out freebsd source and committing, like we once did with cvs.

It should be usable for small scale local repositories that don't
need the python/perl plugin architecture.
2013-06-18 02:53:45 +00:00

69 lines
2.2 KiB
Python
Executable File

#!/usr/bin/env python
#
# gen_def.py : Generate the .DEF file for Windows builds
#
# ====================================================================
# Copyright 2002-2010 Justin Erenkrantz and Greg Stein
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ====================================================================
#
#
# Typically, this script is used like:
#
# C:\PATH> python build/gen_def.py serf.h serf_bucket_types.h serf_bucket_util.h > build/serf.def
#
import re
import sys
# This regex parses function declarations that look like:
#
# return_type serf_func1(...
# return_type *serf_func2(...
#
# Where return_type is a combination of words and "*" each separated by a
# SINGLE space. If the function returns a pointer type (like serf_func2),
# then a space may exist between the "*" and the function name. Thus,
# a more complicated example might be:
# const type * const * serf_func3(...
#
_funcs = re.compile(r'^(?:(?:\w+|\*) )+\*?(serf_[a-z][a-z_0-9]*)\(',
re.MULTILINE)
# This regex parses the bucket type definitions which look like:
#
# extern const serf_bucket_type_t serf_bucket_type_FOO;
#
_types = re.compile(r'^extern const serf_bucket_type_t (serf_[a-z_]*);',
re.MULTILINE)
def extract_exports(fname):
content = open(fname).read()
exports = [ ]
for name in _funcs.findall(content):
exports.append(name)
for name in _types.findall(content):
exports.append(name)
return exports
if __name__ == '__main__':
# run the extraction over each file mentioned
import sys
print("EXPORTS")
for fname in sys.argv[1:]:
for func in extract_exports(fname):
print(func)