iplanetLDAP.sys.sconsider 2.5 KB
Newer Older
1
# vim: set et ai ts=4 sw=4:
Marcel Huber's avatar
Marcel Huber committed
2
# -------------------------------------------------------------------------
3
# Copyright (c) 2011, Peter Sommerlad and IFS Institute for Software
Marcel Huber's avatar
Marcel Huber committed
4
# at HSR Rapperswil, Switzerland
Marcel Huber's avatar
Marcel Huber committed
5
6
# All rights reserved.
#
Marcel Huber's avatar
Marcel Huber committed
7
8
9
10
# This library/application is free software; you can redistribute and/or
# modify it under the terms of the license that is included with this
# library/application in the file license.txt.
# -------------------------------------------------------------------------
11
12

import pkg_resources
Marcel Huber's avatar
Marcel Huber committed
13

14
pkg_resources.require(["SConsider"])
15
16
Import('*')

17
_sconsider_dist = pkg_resources.get_distribution("SConsider").parsed_version
18
19
20
21
22
23
if _sconsider_dist < pkg_resources.parse_version("0.3.10"):
    from SConsider.PackageRegistry import createFulltargetname
else:
    from SConsider.PackageRegistry import PackageRegistry
    createFulltargetname = PackageRegistry.createFulltargetname

24
if _sconsider_dist < pkg_resources.parse_version("0.5"):
25
    from ConfigureHelper import Configure
Marcel Huber's avatar
Marcel Huber committed
26
27

    from SConsider import cloneBaseEnv, createTargets
Marcel Huber's avatar
Marcel Huber committed
28
    buildSettings = {}
29
    env = cloneBaseEnv()
30
31
32
33
34
35
36
    conf = Configure(env)
    if conf.CheckLibWithHeader('ldap50', 'ldap.h', 'C'):
        buildSettings['ldap50'] = {
            'public': {
                'appendUnique': {
                    'LIBS': ['ldap50'],
                },
37
            },
38
        }
Marcel Huber's avatar
Marcel Huber committed
39
40
41
42
        buildSettings[packagename] = {
            'linkDependencies': [createFulltargetname(packagename, 'ldap50')],
        }
    env = conf.Finish()
43
    createTargets(packagename, buildSettings)
Marcel Huber's avatar
Marcel Huber committed
44

45
46
elif _sconsider_dist >= pkg_resources.parse_version("0.5"):
    from TargetMaker import EnvBuilder
Marcel Huber's avatar
Marcel Huber committed
47
    from ThirdParty import add_3rdparty_system_header_target, add_3rdparty_system_lib_target
48
49
50
51
52
53
54
55
56
    includeTarget = add_3rdparty_system_header_target(EnvBuilder().build(), packagename,
                                                      lambda conf: conf.CheckCHeader('ldap.h'))

    libnames = [('ldap50', 'lib_iplanetLDAP')]
    libs = add_3rdparty_system_lib_target(EnvBuilder().depend(includeTarget).build(), packagename,
                                          lambda conf: conf.CheckMultipleLibs([lib for lib, _ in libnames]),
                                          libnames)

    libs = EnvBuilder().depend(libs).build().RegisterPackageTarget(packagename=packagename, targetname='libs')
Marcel Huber's avatar
Marcel Huber committed
57
58
    EnvBuilder().depend(includeTarget, libs).build().RegisterPackageTarget(packagename=packagename,
                                                                           targetname=packagename)