Author: pquerna
Date: Sat Jan 3 15:01:11 2009
New Revision: 731120
URL: http://svn.apache.org/viewvc?rev=731120&view=rev
Log:
A very basic scons based build that barely works on Darwin.
Added:
apr/apr/trunk/SConstruct
apr/apr/trunk/build/__init__.py (with props)
apr/apr/trunk/build/aprenv.py (with props)
Added: apr/apr/trunk/SConstruct
URL: http://svn.apache.org/viewvc/apr/apr/trunk/SConstruct?rev=731120&view=auto
==============================================================================
--- apr/apr/trunk/SConstruct (added)
+++ apr/apr/trunk/SConstruct Sat Jan 3 15:01:11 2009
@@ -0,0 +1,48 @@
+#!/usr/bin/env scons
+#
+
+from build import APREnv
+
+EnsureSConsVersion(1, 1, 0)
+
+vars = Variables('build.py')
+
+vars.Add('maintainer_mode', 'Turn on debugging and compile time warnings', 0)
+vars.Add('profile', 'Turn on profiling for the build (GCC)', 0)
+vars.Add(EnumVariable('pool_debug', 'Turn on pools debugging', 'no',
+ allowed_values=('yes', 'no', 'verbose', 'verbose-alloc', 'lifetime',
'owner', 'all')))
+
+env = APREnv(args=ARGUMENTS, variables=vars)
+
+Help(vars.GenerateHelpText(env))
+
+env.APRHints()
+
+env.APRAutoconf()
+
+if env['maintainer_mode']:
+ if env.is_gcc():
+ env.AppendUnique(CPPFLAGS = ['-g', '-Wall', '-Wmissing-prototypes', '-Wstrict-prototypes',
'-Wmissing-declarations'])
+
+if env['profile']:
+ env.Filter(CPPFLAGS = '-g')
+ env.AppendUnique(CPPFLAGS = ['-pg'])
+
+if env['pool_debug'] != 'no':
+ flags = {'yes': 1,
+ 'verbose': 2,
+ 'lifetime': 4,
+ 'owner': 8,
+ 'verbose-alloc': 16,
+ 'all': 31}
+ env.AppendUnique(CPPFLAGS = "-DAPR_POOL_DEBUG=%d" % flags[env['pool_debug']])
+
+files = env.core_lib_files()
+
+(major, minor, patch) = env.APRVersion()
+
+libapr = env.SharedLibrary('apr-%d' % (major), files)
+
+targets = [libapr]
+
+env.Default(targets)
Added: apr/apr/trunk/build/__init__.py
URL: http://svn.apache.org/viewvc/apr/apr/trunk/build/__init__.py?rev=731120&view=auto
==============================================================================
--- apr/apr/trunk/build/__init__.py (added)
+++ apr/apr/trunk/build/__init__.py Sat Jan 3 15:01:11 2009
@@ -0,0 +1 @@
+from aprenv import *
Propchange: apr/apr/trunk/build/__init__.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: apr/apr/trunk/build/__init__.py
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: apr/apr/trunk/build/__init__.py
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: apr/apr/trunk/build/aprenv.py
URL: http://svn.apache.org/viewvc/apr/apr/trunk/build/aprenv.py?rev=731120&view=auto
==============================================================================
--- apr/apr/trunk/build/aprenv.py (added)
+++ apr/apr/trunk/build/aprenv.py Sat Jan 3 15:01:11 2009
@@ -0,0 +1,103 @@
+#
+#
+
+from SCons.Environment import Environment
+from os.path import join as pjoin
+import re
+import os
+
+
+_platforms = [ 'aix', 'beos', 'netware', 'os2', 'os390', 'unix', 'win32' ]
+
+_platform_dirs = ['atomic',
+ 'dso',
+ 'file_io',
+ 'helpers',
+ 'locks',
+ 'memory',
+ 'misc',
+ 'mmap',
+ 'network_io',
+ 'passwd',
+ 'poll',
+ 'random',
+ 'shmem',
+ 'strings',
+ 'support',
+ 'tables',
+ 'threadproc',
+ 'time',
+ 'user']
+
+_simple_dirs = ['tables', 'strings']
+
+class APREnv(Environment):
+ def __init__(self, parent=None, args=None, **kw):
+ Environment.__init__(self, ENV=os.environ, **kw)
+
+ # See SCons/Platform/__init__.py for possible values
+ if self['PLATFORM'] in _platforms:
+ self['APR_PLATFORM'] = self['PLATFORM']
+ else:
+ self['APR_PLATFORM'] = 'unix'
+
+ # if no *.c files are found in the original APR_PLATFORM, we switch to
+ # using this fallback platform.
+ self['APR_FALLBACK_PLATFORM'] = 'unix'
+
+ self.AppendUnique(CPPPATH = ['include', 'include/arch/'+self['APR_PLATFORM']])
+
+ def is_gcc(self):
+ # TOOD: This detection should be smarter, need look at SCons Internals
+ # for how it works/base it on the Tool selection.
+ return self['CC'] == 'gcc'
+
+ def core_lib_files(self):
+ rv = []
+ for d in _platform_dirs:
+ p = pjoin(d, self['APR_PLATFORM'], '*.c')
+ files = self.Glob(p)
+ if not files and self['APR_PLATFORM'] != self['APR_FALLBACK_PLATFORM']:
+ p = pjoin(d, self['APR_FALLBACK_PLATFORM'], '*.c')
+ files = self.Glob(p)
+ rv.extend(files)
+
+ for d in _simple_dirs:
+ p = pjoin(d, '*.c')
+ files = self.Glob(p)
+ rv.extend(files)
+ return rv
+
+ def APRVersion(self):
+ if not self.has_key('APR_VERSION'):
+ self['APR_VERSION'] = self.read_version('APR', 'include/apr_version.h')
+ return self['APR_VERSION']
+
+ def read_version(self, prefix, path):
+ version_re = re.compile("(.*)%s_(?P<id>MAJOR|MINOR|PATCH)_VERSION(\s+)(?P<num>\d)(.*)"
% prefix)
+ versions = {}
+ fp = open(path, 'rb')
+ for line in fp.readlines():
+ m = version_re.match(line)
+ if m:
+ versions[m.group('id')] = int(m.group('num'))
+ fp.close()
+ return (versions['MAJOR'], versions['MINOR'], versions['PATCH'])
+
+ def Filter(self, **kw):
+ for k in kw.keys():
+ self[k] = [x for x in self[k] if x is not kw[k]]
+
+ def APRHints(self):
+ # TOOD: port more from apr_hints.m4
+ if self['PLATFORM'] == 'darwin':
+ self.AppendUnique(CPPFLAGS=['-DDARWIN', '-DSIGPROCMASK_SETS_THREAD_MASK', '-no-cpp-precomp'])
+
+ def APRAutoconf(self):
+ if self.GetOption('clean'):
+ return
+
+ # TODO Port header detection here etc
+ conf = self.Configure()
+ conf.Finish()
+
Propchange: apr/apr/trunk/build/aprenv.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: apr/apr/trunk/build/aprenv.py
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: apr/apr/trunk/build/aprenv.py
------------------------------------------------------------------------------
svn:mime-type = text/plain
|