Changeset 764 for branches


Ignore:
Timestamp:
07/15/06 09:49:51 (6 years ago)
Author:
wd
Message:

Base build now works. We have a default options file. We also have some
added options for installation and a dummy 'update' target.

Location:
branches/ithildin-scons
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ithildin-scons/SConstruct

    r761 r764  
    1111############################################################################### 
    1212# Initial setup (Python path tweaks etc) 
    13 import os, sys 
    14 sys.path.insert(0, os.path.realpath(os.path.dirname(sys.argv[0]))) 
     13 
     14package_name = "ithildin" 
     15package_version = "1.2.0" 
    1516 
    1617EnsurePythonVersion(2,2) 
    1718EnsureSConsVersion(0,96,92) 
     19 
     20import os, sys 
     21# let's just stick the realpath() for ./build in there at the front.  THis 
     22# allows us to use our custom test code in the 'tests' module there. 
     23sys.path.insert(0, os.path.realpath('./build')) 
     24import tests 
    1825 
    1926############################################################################### 
     
    2330}) 
    2431 
     32# Perform some magic to get the repository version.  If we have svn and we 
     33# can use xml.dom.minidom let's go for it 
     34try: 
     35    subversion = WhereIs('svn') 
     36    import xml.dom.minidom 
     37    if subversion: 
     38        dom = xml.dom.minidom.parseString( 
     39            os.popen('%s info --xml .' % subversion).read()) 
     40        e = dom.getElementsByTagName('entry')[0] 
     41        package_repository_version = int(e.getAttribute('revision')) 
     42        dom.unlink() 
     43except: 
     44    # no luck eh, let's cheat 
     45    svnrev = "$Rev: 1 $" 
     46    package_repository_version = int(svnrev.split()[1]) 
     47 
     48 
    2549############################################################################### 
    2650# Options 
     51 
     52# Collect the list of modules we have shipped with 
     53 
     54if not os.path.exists('build/options'): 
     55    env.Help(""" 
     56You may save your build options in the file build/options with the format: 
     57optionname = "optionvalue" 
     58A sample options file is provided in build/options.default. 
     59""") 
     60 
    2761opts = Options('build/options', ARGUMENTS) 
    2862opts.AddOptions( 
     
    3468        ['kqueue', 'poll', 'select', 'auto']), 
    3569    BoolOption('warnings', 'Compile with very aggressive warning settings', 0), 
     70# Other path options are handled below  
     71    PathOption('prefix', 'Installation prefix', '/usr/local', 
     72        tests.PathIsDirCreateAccess), 
    3673) 
    37  
    3874opts.Update(env) 
    3975 
     76# Now take a look in prefix for the stuff we care about: bin, etc, lib, 
     77# include, share.  If these already exist we make our defaults 
     78# $prefix/etc/ithildin etc.  Otherwise we make them $prefix/etc (assuming 
     79# this is a lone installation location).  This is an automated version of 
     80# the old  --disable-dir-suffix autoconf macro from 1.1 and lower. 
     81# 
     82# XXX: this is all dumb in Windows where installations will be totally 
     83# different. 
     84 
     85# Okay, let's make some dumb guesses:  If the name already contains 
     86# 'package' in it let's go ahead and not add that again.  If the name is 
     87# standard (/usr, /usr/local, /opt) let's add it there.  Other than that we 
     88# aren't too smart. :) 
     89if env['prefix'] == '/usr' or env['prefix'] == '/opt': 
     90    # /usr and /opt need special handling to stuff things in /etc 
     91    sysconfdir = '/etc' 
     92else: 
     93    sysconfdir = env['prefix'] + '/etc' 
     94 
     95dir_suffix = '' 
     96if not package_name in env['prefix']: 
     97    dir_suffix = '/' + package_name 
     98# let's add one more, if it's in $HOME/<something> let's guess that they 
     99# don't want that nasty dir_suffix.  This could be so wrong as to be absurd, 
     100# but I believe it is what most will want. 
     101if (os.environ.has_key('HOME') and os.environ['HOME'] in env['prefix']): 
     102    dir_suffix = '' 
     103 
     104opts.AddOptions( 
     105    PathOption('bindir', "Binary installation directory", 
     106        env['prefix'] + '/bin', tests.PathIsDirCreateAccess), 
     107    PathOption('sysconfdir', "Configuration file installation directory", 
     108        sysconfdir + dir_suffix, tests.PathIsDirCreateAccess), 
     109    PathOption('libdir', "Library installation directory", 
     110        env['prefix'] + '/lib' + dir_suffix, tests.PathIsDirCreateAccess), 
     111    PathOption('includedir', 'C header installation directory', 
     112        env['prefix'] + '/include', tests.PathIsDirCreateAccess), 
     113    PathOption('datadir', "Miscellaneous file installation directory", 
     114        env['prefix'] + '/share' + dir_suffix, tests.PathIsDirCreateAccess), 
     115) 
     116opts.Update(env) 
     117 
    40118env.Help(opts.GenerateHelpText(env)) 
    41119 
     
    43121# Feature tests 
    44122 
    45 import tests 
    46123conf = env.Configure(config_h = 'include/ithildin/config.h', 
    47124    custom_tests = tests.tests) 
     
    198275env.Append(LIBPATH = '#/lib') 
    199276 
    200 env.Export('env') 
     277env.AlwaysBuild(env.Alias('update', '#/.svn', '%s update' % subversion)) 
     278 
     279env.Export(['env', 'package_name', 'package_version', 
     280    'package_repository_version']) 
    201281env.SConscript('lib/SConscript') 
    202282env.SConscript('source/SConscript') 
  • branches/ithildin-scons/source/main.c

    r761 r764  
    8383 
    8484    me.started = me.now = time(NULL); 
    85     /* 
    8685    strncpy(me.conf_path, PACKAGE_PATH_SYSCONF, PATH_MAX); 
    8786    strncpy(me.lib_path, PACKAGE_PATH_LIB "/modules", PATH_MAX); 
     
    9089    sprintf(me.version, "%s-%s", PACKAGE_NAME, PACKAGE_VERSION); 
    9190    me.revision = PACKAGE_REPOSITORY_VERSION; 
    92     */ 
    9391    me.fork = 1; /* by default we fork */ 
    9492 
     
    303301                strncpy(me.conf_path, optarg, PATH_MAX); 
    304302                break; 
    305                 /* 
    306303            case 'v': 
    307304                printf("%s (r%d)\n", me.version, me.revision); 
     
    318315 
    319316                exit(0); 
    320                 */ 
    321317            case '?': 
    322318                printf(usage, me.execname); 
Note: See TracChangeset for help on using the changeset viewer.