Steve,
On Sun, 2011-09-11 at 18:28 +0000, Steve Teale wrote:
> I was able to get some distance down the road with:
>
> env = Environment()
>
> def CheckPKGConfig(context, version):
> context.Message( 'Checking for pkg-config... ' )
> ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' %
> version)[0]
> context.Result( ret )
> return ret
>
> def CheckPKG(context, name):
> context.Message( 'Checking for %s... ' % name )
> ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0]
> context.Result( ret )
> return ret
The support for pkg-config in SCons needs improving, you shouldn't have
to define these sorts of function yourself. I have variants on the
above, but the itch to actually create something in SCons never got bad
enough to have to scratch. If there were others definitely using
pkg-config with SCons, we should club together and create something that
people could use and which could be lined up for inclusion in SCons.
> # Configuration:
>
> conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig,
> 'CheckPKG' : CheckPKG })
>
> if not conf.CheckPKGConfig('0.15.0'):
> print 'pkg-config >= 0.15.0 not found.'
> Exit(1)
>
> if not conf.CheckPKG('gtk+-2.0 >= 2.24.4'):
> print 'gtk+-2.0 >= 2.24.4 not found.'
> Exit(1)
>
> if not conf.CheckPKG('glib-2.0 >= 2.28.6'):
> print 'glib-2.0 >= 2.28.6 not found.'
> Exit(1)
>
> if not conf.CheckPKG('cairo >= 1.10.2'):
> print 'cairo >= 1.10.2 not found.'
> Exit(1)
>
> if not conf.CheckPKG('pango >= 1.28.4'):
> print 'pango >= 1.28.4 not found.'
> Exit(1)
I tend to avoid these repetitious tests by doing:
for dependency in (
'gtk+-2.0 >= 2.24.4',
'glib-2.0 >= 2.28.6',
'cairo >= 1.10.2',
'pango >= 1.28.4',
):
if not conf.CheckPKG(dependency):
print dependency + ' not found.'
Exit(1)
> # Your extra checks here
>
> env = conf.Finish()
>
>
> Program('compo', Glob('*.d'), LIBS = [ 'gtkd', 'phobos2', 'dl', 'rt' ],
> LIBPATH = [ '/usr/lib32' ], DPATH =
> ['/usr/local/include/d'])
>
> This at least allows me to check for the versions of GTK+ components that I
> built
> against.
>
> But I don't know how to check for the versions of DMD and gtkD.
>
> Does your stuff get me anywhere in that direction Russel?
The DMD tool handles all the Phobos and known transitive dependencies so
by including it you can get rid of the LIBPATH and DPATH stuff and also
the LIBS, except the gtkd.
I wonder if it might be worth having a gtkd tool?
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:[email protected]
41 Buckmaster Road m: +44 7770 465 077 xmpp: [email protected]
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc
Description: This is a digitally signed message part
