fix breakqge introduce in [16152]
[vlc.git] / test / setup.py
blob098b52a0d680050db7544e58e58343ef9634dba8
1 from distutils.core import setup,Extension
2 import os
4 def get_vlcconfig():
5 vlcconfig=None
6 for n in ( 'vlc-config',
7 os.path.sep.join( ( '..', 'vlc-config' ))):
8 if os.path.exists(n):
9 vlcconfig=n
10 break
11 if vlcconfig is None:
12 print "*** Warning *** Cannot find vlc-config"
13 elif os.sys.platform == 'win32':
14 # Win32 does not know how to invoke the shell itself.
15 vlcconfig="sh %s" % vlcconfig
16 return vlcconfig
18 def get_cflags():
19 vlcconfig=get_vlcconfig()
20 if vlcconfig is None:
21 return []
22 else:
23 cflags=os.popen('%s --cflags' % vlcconfig, 'r').readline().rstrip().split()
24 cflags.append( "-D__VLC__")
25 return cflags
27 def get_ldflags():
28 vlcconfig=get_vlcconfig()
29 if vlcconfig is None:
30 return []
31 else:
32 os.environ['top_builddir'] = '..'
33 ldflags = []
34 if os.sys.platform == 'darwin':
35 ldflags = "-read_only_relocs warning".split()
36 ldflags.extend(os.popen('%s --libs vlc builtin' % vlcconfig, 'r').readline().rstrip().split())
37 if os.sys.platform == 'darwin':
38 ldflags.append('-lstdc++')
39 return ldflags
41 # To compile in a local vlc tree
42 native_libvlc_test = Extension( 'native_libvlc_test',
43 sources = ['native/init.c', 'native/url.c', 'native/i18n.c',
44 'native/stats.c', 'native/libvlc.c', 'native/profiles.c'],
45 include_dirs = ['../include', '../', '/usr/win32/include' ],
46 extra_objects = [ '../src/.libs/libvlc.so' ],
47 extra_compile_args = get_cflags(),
48 extra_link_args = [ '-L../..' ] + get_ldflags(),
51 native_gc_test = Extension( 'native_gc_test',
52 sources = ['native/gc.c'],
53 include_dirs = ['../include', '../', '/usr/win32/include' ],
54 extra_objects = [ '../src/.libs/libvlc.so' ],
55 extra_compile_args = get_cflags(),
56 extra_link_args = [ '-L../..' ] + get_ldflags(),
59 setup( name = 'native_libvlc_test' ,version = '1242', ext_modules = [ native_libvlc_test ] )
62 setup( name = 'native_gc_test' ,version = '1242', ext_modules = [ native_gc_test ] )