Removing PowerLine since we weren't using it and don't have plans to.
[debian/gnuradio] / dtools / bin / install-tbb
1 #!/usr/bin/env python
2
3 """
4 Install the release and debug libs and includes under --prefix
5 """
6
7 from optparse import OptionParser
8 import os
9 import os.path
10 import glob
11
12 default_prefix="/usr/local"
13
14 pkgconfig_filename = "tbb.pc"
15 pkgconfig_file_contents = """\
16 prefix=%s
17 exec_prefix=${prefix}
18 libdir=${exec_prefix}/lib
19 includedir=${prefix}/include
20
21 Name: tbb
22 Description: Intel Threading Building Blocks
23 Requires: 
24 Version: 2.0
25 Libs: -L${libdir} -ltbb -ltbbmalloc
26 Cflags: -I${includedir}
27 """
28
29 debug_pkgconfig_filename = "tbb_debug.pc"
30 debug_pkgconfig_file_contents = """\
31 prefix=%s
32 exec_prefix=${prefix}
33 libdir=${exec_prefix}/lib
34 includedir=${prefix}/include
35
36 Name: tbb
37 Description: Intel Threading Building Blocks
38 Requires: 
39 Version: 2.0
40 Libs: -L${libdir} -ltbb_debug -ltbbmalloc_debug
41 Cflags: -I${includedir}
42 """
43
44 def main():
45    parser = OptionParser()
46    parser.add_option('','--prefix', default=default_prefix,
47                      help="install architecture-independent files in PREFIX [default=%default]")
48    (options, args) = parser.parse_args()
49    if len(args) != 0:
50       parser.print_help()
51       raise SystemExit, 1
52
53    prefix = options.prefix
54    
55    # are we installing 64-bit libs?
56
57    is_64bit = False
58    files = glob.glob('build/*_em64t_*_release')
59    # print "files: ", files
60    if len(files) != 0:
61       is_64bit = True
62
63    # FIXME add 32 and 64-bit PPC support
64
65    if is_64bit:
66       lib = 'lib64'
67    else:
68       lib = 'lib'
69       
70    os.system('install -d ' + os.path.join(prefix, 'include/tbb'))
71    os.system('install -d ' + os.path.join(prefix, 'include/tbb/machine'))
72    os.system('install -d ' + os.path.join(prefix, lib))
73    os.system('install -d ' + os.path.join(prefix, lib, 'pkgconfig'))
74    os.system('install -t ' + os.path.join(prefix, lib) + ' build/linux*release/*.so*')
75    os.system('install -t ' + os.path.join(prefix, lib) + ' build/linux*debug/*.so*')
76    os.system('install -t ' + os.path.join(prefix, 'include/tbb') + ' include/tbb/*.h')
77    os.system('install -t ' + os.path.join(prefix, 'include/tbb/machine') + ' include/tbb/machine/*.h')
78
79    f = open(os.path.join(prefix, lib, 'pkgconfig', pkgconfig_filename), 'w')
80    f.write(pkgconfig_file_contents % (prefix,))
81    f.close()
82    
83    f = open(os.path.join(prefix, lib, 'pkgconfig', debug_pkgconfig_filename), 'w')
84    f.write(debug_pkgconfig_file_contents % (prefix,))
85    f.close()
86    
87 if __name__ == "__main__":
88    main()