5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__
= "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
28 Ensure that SharedLibrary builder with SHLIBVERSION set works with VariantDir.
38 test
= TestSCons
.TestSCons()
40 env
= SCons
.Defaults
.DefaultEnvironment()
41 platform
= SCons
.Platform
.platform_default()
42 tool_list
= SCons
.Platform
.DefaultToolList(platform
, env
)
47 test
.subdir(['src','lib'])
48 test
.subdir(['src','bin'])
50 test
.write(['src','lib','foo.c'], """
54 int foo() { return 0; }
57 test
.write(['src','bin','main.c'], """
68 test
.write('SConstruct', """
70 variant = { 'variant_dir' : 'build',
73 'exports' : { 'env' : env } }
74 SConscript('src/lib/SConscript', **variant)
75 SConscript('src/bin/SConscript', **variant)
78 test
.write(['src','lib','SConscript'], """
80 env.SharedLibrary('foo', 'foo.c', SHLIBVERSION = '0.1.2')
83 test
.write(['src','bin','SConscript'], """
85 env.Program('main.c', LIBS=['foo'], LIBPATH=['../lib'])
88 test
.run(arguments
= ['--tree=all'])
90 if platform
== 'cygwin' or platform
== 'win32':
91 # PATH is used to search for *.dll libraries on windows
92 path
= os
.environ
.get('PATH','')
93 if path
: path
= path
+ os
.pathsep
94 path
= path
+ test
.workpath('build/lib')
95 os
.environ
['PATH'] = path
97 if os
.name
== 'posix':
98 os
.environ
['LD_LIBRARY_PATH'] = test
.workpath('build/lib')
99 if sys
.platform
.find('irix') != -1:
100 os
.environ
['LD_LIBRARYN32_PATH'] = test
.workpath('build/lib')
102 test
.run(program
= test
.workpath('build/bin/main'))
104 if 'gnulink' in tool_list
:
105 # All (?) the files we expect will get created in the current directory
112 elif 'applelink' in tool_list
:
113 # All (?) the files we expect will get created in the current directory
116 'libfoo.0.1.2.dylib',
119 elif 'cyglink' in tool_list
:
120 # All (?) the files we expect will get created in the current directory
123 'libfoo-0-1-2.dll.a',
127 elif 'mslink' in tool_list
:
128 # All (?) the files we expect will get created in the current directory
134 elif 'sunlink' in tool_list
:
135 # All (?) the files we expect will get created in the current directory
143 # All (?) the files we expect will get created in the current directory
149 test
.must_exist([ 'build', 'lib', obj
])
151 test
.must_exist([ 'build', 'lib', f
])
153 test
.run(arguments
= ['-c'])
155 test
.must_not_exist([ 'build', 'lib', obj
])
157 test
.must_not_exist([ 'build', 'lib', f
])
159 test
.must_exist(['src', 'lib', 'foo.c'])
160 test
.must_exist(['SConstruct'])
161 test
.must_exist(['src', 'lib', 'SConscript'])
162 test
.must_exist(['src', 'bin', 'SConscript'])
168 # indent-tabs-mode:nil
170 # vim: set expandtab tabstop=4 shiftwidth=4: