Return-Path: Delivered-To: apmail-apr-commits-archive@www.apache.org Received: (qmail 74887 invoked from network); 3 Jan 2009 23:01:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Jan 2009 23:01:36 -0000 Received: (qmail 35412 invoked by uid 500); 3 Jan 2009 23:01:35 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 35369 invoked by uid 500); 3 Jan 2009 23:01:35 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 35359 invoked by uid 99); 3 Jan 2009 23:01:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Jan 2009 15:01:35 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Jan 2009 23:01:33 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5306923888F1; Sat, 3 Jan 2009 15:01:12 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r731120 - in /apr/apr/trunk: SConstruct build/__init__.py build/aprenv.py Date: Sat, 03 Jan 2009 23:01:12 -0000 To: commits@apr.apache.org From: pquerna@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090103230112.5306923888F1@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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_(?PMAJOR|MINOR|PATCH)_VERSION(\s+)(?P\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