RSS

(root)/fsp/fsplib : 52

Radim Kolar
2009-06-13 15:26:01
Revision ID: radim_kolar-20090613152601-uwxxg022ffqp7jhh
scons enable-shared=yes now builds shared version of fsplib. Default is to build static library only.

collapse all collapse all

added added

removed removed

 
 
1
0.11
 
 
2
        optionally build and install shared library (EXPERIMENTAL FEATURE)
1
0.10
3
0.10
2
        configure.ac nuked, fsplib builds now with scons tool only
4
        configure.ac nuked, fsplib builds now with scons tool only
3
        INSTALL file removed, it was autoconf specific
5
        INSTALL file removed, it was autoconf specific
60
      Where to install builded library and header file. Standard option.
60
      Where to install builded library and header file. Standard option.
61
 
61
 
62
enable-maintainer-mode=yes
62
enable-maintainer-mode=yes
63
      Compile with more debug code inside     
63
      Compile with more debug code inside
 
 
64
 
 
 
65
enable-shared=yes
 
 
66
      Build and install shared version of fsplib
1
Import(Split("env PREFIX VERSION PACKAGE "))
1
Import(Split("env PREFIX VERSION PACKAGE SHARED"))
2
 
2
 
3
#Build library
3
#Build static library
4
libfsp=env.StaticLibrary(target = 'fsp', source = Split('fsplib.c lock.c'))
4
libfsp=env.StaticLibrary(target = 'fsp', source = Split('fsplib.c lock.c'))
5
libfspshared=env.SharedLibrary(target = 'fsp', source = Split('fsplib.c lock.c'))
5
env.Alias("build", libfsp)
 
 
6
 
 
 
7
#Build shared library
 
 
8
if SHARED:
 
 
9
    env.Append(SHLIBSUFFIX = '.0.0.0')
 
 
10
    env.Append(SHLINKFLAGS = '-Wl,-soname -Wl,libfsplib.so.0')
 
 
11
    libfspshared=env.SharedLibrary(target = 'fsplib', source = Split('fsplib.c lock.c'))
 
 
12
    env.Alias("build", libfspshared)
 
 
13
 
 
 
14
#Install library and header
6
env.Install(dir = PREFIX+'/lib', source = libfsp)
15
env.Install(dir = PREFIX+'/lib', source = libfsp)
7
env.Install(dir = PREFIX+'/lib', source = libfspshared)
 
 
8
env.Install(dir = PREFIX+'/include', source='fsplib.h')
16
env.Install(dir = PREFIX+'/include', source='fsplib.h')
 
 
17
if SHARED:
 
 
18
    env.Install(dir = PREFIX+'/lib', source = libfspshared)
9
 
19
 
10
#Build test program
20
#Build test program
11
test=env.Program(target = 'test', source = ['test.c', libfsp])
21
test=env.Program(target = 'test', source = ['test.c', libfsp])
 
 
22
env.Alias("build",test)
 
 
23
if SHARED:
 
 
24
    testshared=env.Program(target = 'test-shared', source = ['test.c', libfspshared])
 
 
25
    env.Alias("build",testshared)
12
 
26
 
13
# *************** Targets ****************
27
# *************** Targets ****************
14
 
28
 
15
#Add install target
29
#Add install target
16
env.Alias("install",[ PREFIX+'/lib', PREFIX+'/include'] )
30
env.Alias("install",[ PREFIX+'/lib', PREFIX+'/include'])
17
 
 
 
18
#Add build target
 
 
19
env.Alias("build", [ libfsp, libfspshared, test ])
 
 
20
 
31
 
21
#Change default target to build
32
#Change default target to build
22
env.Default(None)
33
env.Default(None)
3
import os
3
import os
4
# init Scons
4
# init Scons
5
EnsureSConsVersion(0,96)
5
EnsureSConsVersion(0,96)
6
PREFIX='/usr/local'
 
 
7
PACKAGE='fsplib'
6
PACKAGE='fsplib'
8
VERSION='0.10'
7
VERSION='0.10'
9
 
8
 
 
 
9
#Defaults
 
 
10
PREFIX='/usr/local'
 
 
11
SHARED=0
 
 
12
 
10
env = Environment()
13
env = Environment()
11
# Turn CPPFLAGS to list
14
# Turn CPPFLAGS to list
12
env.Append( CPPFLAGS = [])
15
env.Append( CPPFLAGS = [])
106
    else:
109
    else:
107
                          conf.Result(0)
110
                          conf.Result(0)
108
 
111
 
 
 
112
def checkForBuildingSharedLibrary(conf):
 
 
113
    global SHARED
 
 
114
    conf.Message("checking whether to build shared library... ")
 
 
115
    makeshared=ARGUMENTS.get('enable-shared', 0)
 
 
116
    if makeshared == 0 or makeshared == 'no':
 
 
117
                          conf.Result(0)
 
 
118
                          SHARED=0
 
 
119
    else:
 
 
120
                          conf.Result(1)
 
 
121
                          SHARED=1
 
 
122
 
109
#Start configuration
123
#Start configuration
110
conf = Configure(env,{'checkForGCCOption':checkForGCCOption,
124
conf = Configure(env,{'checkForGCCOption':checkForGCCOption,
111
                      'MAINTAINER_MODE':checkForMaintainerMode,
125
                      'MAINTAINER_MODE':checkForMaintainerMode,
112
                      'checkForLockPrefix':checkForLockPrefix,
126
                      'checkForLockPrefix':checkForLockPrefix,
113
                      'checkPrefix':checkForUserPrefix,
127
                      'checkPrefix':checkForUserPrefix,
114
                      'checkDirentFor':checkForDirentMember})
128
                      'checkDirentFor':checkForDirentMember,
 
 
129
                      'ENABLE_SHARED':checkForBuildingSharedLibrary}
 
 
130
                      )
115
for option in Split("""
131
for option in Split("""
116
      -Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wshadow
132
      -Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wshadow
117
      -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings
133
      -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings
153
    conf.env.Append(CPPFLAGS = '-DFSP_NOLOCKING')
169
    conf.env.Append(CPPFLAGS = '-DFSP_NOLOCKING')
154
conf.checkForLockPrefix()
170
conf.checkForLockPrefix()
155
conf.checkPrefix()
171
conf.checkPrefix()
 
 
172
conf.ENABLE_SHARED()
156
conf.MAINTAINER_MODE()
173
conf.MAINTAINER_MODE()
157
conf.Finish()
174
conf.Finish()
158
 
175
 
159
# process build rules
176
# process build rules
160
Export( Split("env PREFIX PACKAGE VERSION"))
177
Export( Split("env PREFIX PACKAGE VERSION SHARED"))
161
env.SConscript(dirs=['.'])
178
env.SConscript(dirs=['.'])

Loggerhead is a web-based interface for Bazaar branches