5 # Copyright The SCons Foundation
7 # Permission is hereby granted, free of charge, to any person obtaining
8 # a copy of this software and associated documentation files (the
9 # "Software"), to deal in the Software without restriction, including
10 # without limitation the rights to use, copy, modify, merge, publish,
11 # distribute, sublicense, and/or sell copies of the Software, and to
12 # permit persons to whom the Software is furnished to do so, subject to
13 # the following conditions:
15 # The above copyright notice and this permission notice shall be included
16 # in all copies or substantial portions of the Software.
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 Ensure that SharedLibrary builder with SHLIBVERSION='0.1.2' can build its target
28 in a subdirectory containing .so.0.1.2 in name.
30 This is regression test for issue mentioned in:
31 https://thread.gmane.org/gmane.comp.programming.tools.scons.user/27081
32 (historical - dead link)
42 test
= TestSCons
.TestSCons()
44 test
.write('foo.c', """
48 int foo() { return 0; }
51 test
.write('main.c', """
62 env
= SCons
.Defaults
.DefaultEnvironment()
63 platform
= SCons
.Platform
.platform_default()
64 tool_list
= SCons
.Platform
.DefaultToolList(platform
, env
)
66 if 'applelink' in tool_list
:
67 subdir
= 'blah.0.1.2.dylib.blah'
68 elif 'cyglink' in tool_list
:
69 subdir
= 'blah-0-1-2.dll.a.blah'
71 subdir
= 'blah.so.0.1.2.blah'
73 test
.write('SConstruct', """
75 env.AppendUnique(LIBPATH = [ '%s' ])
76 env.SharedLibrary('%s/foo', 'foo.c', SHLIBVERSION = '0.1.2')
77 env.Program('main.c', LIBS=['foo'])
78 """ % (subdir
,subdir
))
80 test
.run(arguments
= ['--tree=all'])
82 if platform
== 'cygwin' or platform
== 'win32':
83 # PATH is used to search for *.dll libraries on windows
84 path
= os
.environ
.get('PATH','')
85 if path
: path
= path
+ os
.pathsep
86 path
= path
+ test
.workpath(subdir
)
87 os
.environ
['PATH'] = path
89 if os
.name
== 'posix':
90 os
.environ
['LD_LIBRARY_PATH'] = subdir
91 if sys
.platform
.find('irix') != -1:
92 os
.environ
['LD_LIBRARYN32_PATH'] = subdir
94 test
.run(program
= test
.workpath('main'))
96 if 'gnulink' in tool_list
:
97 # All (?) the files we expect will get created in the current directory
104 elif 'applelink' in tool_list
:
105 # All (?) the files we expect will get created in the current directory
108 'libfoo.0.1.2.dylib',
111 elif 'cyglink' in tool_list
:
112 # All (?) the files we expect will get created in the current directory
115 'libfoo-0-1-2.dll.a',
119 elif 'mslink' in tool_list
:
120 # All (?) the files we expect will get created in the current directory
126 elif 'sunlink' in tool_list
:
127 # All (?) the files we expect will get created in the current directory
135 # All (?) the files we expect will get created in the current directory
141 test
.must_exist([ obj
])
143 test
.must_exist([ subdir
, f
])
145 test
.run(arguments
= ['-c'])
147 test
.must_not_exist([ obj
])
149 test
.must_not_exist([ subdir
, f
])
151 test
.must_exist(['foo.c'])
152 test
.must_exist(['SConstruct'])
158 # indent-tabs-mode:nil
160 # vim: set expandtab tabstop=4 shiftwidth=4: