488 |
awk |
1 |
#!/usr/bin/env python
|
|
|
2 |
# ============================================================================
|
|
|
3 |
# Script for downloading the various GEL dependencies on Windows
|
|
|
4 |
#
|
|
|
5 |
# Downloads the following libraries:
|
|
|
6 |
#
|
|
|
7 |
# clapack
|
|
|
8 |
# glut
|
|
|
9 |
# glew
|
|
|
10 |
# (glconsole)
|
|
|
11 |
# Anders Wang Kristensen / awk@imm.dtu.dk 2009
|
|
|
12 |
# ============================================================================
|
|
|
13 |
|
|
|
14 |
def download(url, fn=None):
|
|
|
15 |
import urllib
|
|
|
16 |
web = urllib.urlopen(url)
|
|
|
17 |
if not fn:
|
|
|
18 |
fn = url.split('/')[-1]
|
|
|
19 |
print fn
|
|
|
20 |
local = open(fn, 'wb')
|
|
|
21 |
local.write(web.read())
|
|
|
22 |
web.close()
|
|
|
23 |
local.close()
|
|
|
24 |
return fn
|
|
|
25 |
|
|
|
26 |
def banner(str):
|
|
|
27 |
print '\n'
|
|
|
28 |
print '---------------------------------------------------'
|
|
|
29 |
print '=> Downloading %s..' % str
|
|
|
30 |
print '---------------------------------------------------'
|
|
|
31 |
|
|
|
32 |
if __name__ == '__main__':
|
|
|
33 |
|
|
|
34 |
import os, sys, shutil, zipfile
|
|
|
35 |
|
|
|
36 |
sf = 'http://downloads.sourceforge.net/project/'
|
|
|
37 |
|
|
|
38 |
if not os.path.exists('lib/win32'):
|
|
|
39 |
os.makedirs('lib/win32')
|
|
|
40 |
|
|
|
41 |
#lapack stuff
|
|
|
42 |
banner('clapack')
|
|
|
43 |
shutil.rmtree('lib/win32/lapack', ignore_errors=True)
|
|
|
44 |
os.makedirs('lib/win32/lapack')
|
|
|
45 |
urls = ['http://www.netlib.org/clapack/LIB_WINDOWS/Win32/libf2c.lib',
|
|
|
46 |
'http://www.netlib.org/clapack/LIB_WINDOWS/Win32/BLAS.lib',
|
|
|
47 |
'http://www.netlib.org/clapack/LIB_WINDOWS/Win32/clapack.lib']
|
|
|
48 |
for u in urls:
|
|
|
49 |
fn = download(u)
|
|
|
50 |
shutil.move(fn, 'lib/win32/lapack')
|
|
|
51 |
|
|
|
52 |
#glut
|
|
|
53 |
banner('glut')
|
|
|
54 |
if not os.path.exists('lib/win32/gl'):
|
|
|
55 |
os.makedirs('lib/win32/gl')
|
|
|
56 |
download('http://www.xmission.com/~nate/glut/glut-3.7.6-bin.zip')
|
|
|
57 |
zf = zipfile.ZipFile(open('glut-3.7.6-bin.zip', 'rb'))
|
|
|
58 |
folder = 'lib/win32/gl/'
|
|
|
59 |
file(folder+'glut.h','wb').write(zf.read('glut-3.7.6-bin/glut.h'))
|
|
|
60 |
file(folder+'glut32.lib','wb').write(zf.read('glut-3.7.6-bin/glut32.lib'))
|
|
|
61 |
file('bin/glut32.dll','wb').write(zf.read('glut-3.7.6-bin/glut32.dll'))
|
|
|
62 |
zf.close()
|
|
|
63 |
os.remove('glut-3.7.6-bin.zip')
|
|
|
64 |
|
|
|
65 |
#glew
|
|
|
66 |
banner('glew')
|
|
|
67 |
folder1 = 'lib/win32/glew/include/gl/'
|
|
|
68 |
folder2 = 'lib/win32/glew/lib/'
|
|
|
69 |
for d in [folder1, folder2]:
|
|
|
70 |
if not os.path.exists(d):
|
|
|
71 |
os.makedirs(d)
|
|
|
72 |
if not os.path.exists('lib/win32/glew/lib'):
|
|
|
73 |
os.makedirs('lib/win32/glew/lib')
|
|
|
74 |
download(sf + 'glew/glew/1.5.1/glew-1.5.1-win32.zip?use_mirror=mesh',
|
|
|
75 |
'glew-1.5.1-win32.zip')
|
|
|
76 |
zf = zipfile.ZipFile(open('glew-1.5.1-win32.zip', 'rb'))
|
|
|
77 |
file(folder1+'glew.h','wb').write(zf.read('glew/include/GL/glew.h'))
|
|
|
78 |
file(folder1+'wglew.h','wb').write(zf.read('glew/include/GL/wglew.h'))
|
|
|
79 |
file(folder2+'glew32.lib','wb').write(zf.read('glew/lib/glew32.lib'))
|
|
|
80 |
file(folder2+'glew32s.lib','wb').write(zf.read('glew/lib/glew32s.lib'))
|
|
|
81 |
file('bin/glew32.dll','wb').write(zf.read('glew/bin/glew32.dll'))
|
|
|
82 |
zf.close()
|
|
|
83 |
os.remove('glew-1.5.1-win32.zip')
|
|
|
84 |
|
|
|
85 |
#glconsole
|
|
|
86 |
banner('glconsole')
|
|
|
87 |
download('http://mmandel.com/demos/GLConsole_mmandel_version_05.zip')
|
|
|
88 |
zf = zipfile.ZipFile(open('GLConsole_mmandel_version_05.zip', 'rb'))
|
|
|
89 |
zf.close()
|
|
|
90 |
os.remove('GLConsole_mmandel_version_05.zip')
|
|
|
91 |
|
|
|
92 |
print ' '
|
|
|
93 |
print '---------------------------------------------------'
|
|
|
94 |
print '=> Done!'
|
|
|
95 |
print '---------------------------------------------------'
|