Missing files.
[dcpomatic.git] / cscript
1 import glob
2 import shutil
3 import os
4
5 build_depends = {'debhelper': '8.0.0',
6                  'python': '2.7.3',
7                  'g++': '4:4.6.3',
8                  'pkg-config': '0.26',
9                  'libssh-dev': '0.5.2',
10                  'libboost-filesystem-dev': '1.46.0',
11                  'libboost-thread-dev': '1.46.0',
12                  'libsndfile1-dev': '1.0.25',
13                  'libmagick++-dev': '8:6.6.9.7',
14                  'libgtk2.0-dev': '2.24.10'}
15
16 depends = dict()
17
18 depends['12.04'] = {'libc6': '2.15',
19                     'libssh-4': '0.5.2',
20                     'libboost-filesystem1.46.1': '1.46.1',
21                     'libboost-thread1.46.1': '1.46.1',
22                     'libsndfile1': '1.0.25',
23                     'libmagick++4': '8:6.6.9.7',
24                     'libxml++2.6-2': '2.34.1',
25                     'libgtk2.0-0': '2.24.10',
26                     'libxmlsec1': '1.2.14-1.2build1',
27                     'libxmlsec1-openssl': '1.2.14-1.2build1',
28                     'libboost-date-time1.46.1': '1.46.1',
29                     'libcurl3': '7.22.0-3ubuntu4',
30                     'libzip2': '0.10-1ubuntu1'}
31
32 depends['12.10'] = {'libc6': '2.15',
33                     'libssh-4': '0.5.2',
34                     'libboost-filesystem1.49.0': '1.49.0',
35                     'libboost-thread1.49.0': '1.49.0',
36                     'libsndfile1': '1.0.25',
37                     'libmagick++5': '8:6.7.7.10',
38                     'libxml++2.6-2': '2.34.2',
39                     'libgtk2.0-0': '2.24.13',
40                     'libxmlsec1': '1.2.18-2',
41                     'libxmlsec1-openssl': '1.2.18-2',
42                     'libboost-date-time1.49.0': '1.49.0',
43                     'libcurl3': '7.27.0-1ubuntu1',
44                     'libzip2': '0.10.1-1.1'}
45
46 depends['13.04'] = {'libc6': '2.15',
47                     'libssh-4': '0.5.2',
48                     'libboost-filesystem1.49.0': '1.49.0',
49                     'libboost-thread1.49.0': '1.49.0',
50                     'libsndfile1': '1.0.25',
51                     'libmagick++5': '8:6.7.7.10',
52                     'libxml++2.6-2': '2.34.2',
53                     'libgtk2.0-0': '2.24.13',
54                     'libxmlsec1': '1.2.18-2',
55                     'libxmlsec1-openssl': '1.2.18-2',
56                     'libboost-date-time1.49.0': '1.49.0',
57                     'libcurl3': '7.29.0-1ubuntu3',
58                     'libzip2': '0.10.1-1.1'}
59
60 depends['13.10'] = {'libc6': '2.17-93',
61                     'libssh-4': '0.5.4',
62                     'libboost-filesystem1.53.0': '1.53.0',
63                     'libboost-thread1.53.0': '1.53.0',
64                     'libsndfile1': '1.0.25',
65                     'libmagick++5': '8:6.7.7.10',
66                     'libxml++2.6-2': '2.36.0',
67                     'libgtk2.0-0': '2.24.20',
68                     'libxmlsec1': '1.2.18-2',
69                     'libxmlsec1-openssl': '1.2.18-2',
70                     'libboost-date-time1.49.0': '1.49.0',
71                     'libcurl3': '7.29.0-1ubuntu3',
72                     'libzip2': '0.10.1-1.1'}
73
74 depends['7'] = {'libc6': '2.13',
75                 'libssh-4': '0.5.4',
76                 'libboost-filesystem1.49.0': '1.49.0',
77                 'libboost-thread1.49.0': '1.49.0',
78                 'libsndfile1': '1.0.25',
79                 'libmagick++5': '8:6.7.7.10',
80                 'libxml++2.6-2': '2.34.2',
81                 'libgtk2.0-0': '2.24.10',
82                 'libxmlsec1': '1.2.18',
83                 'libboost-date-time1.49.0': '1.49.0',
84                 'libxmlsec1-openssl': '1.2.18',
85                 'libcurl3': '7.26.0',
86                 'libzip2': '0.10.1'}
87
88 def packages(name, packages, f):
89     s = '%s: ' % name
90     for p in packages:
91         s += str(p) + ', '
92     print >>f,s[:-2]
93
94 def make_control(version, bits, filename):
95     f = open(filename, 'w')
96     print >>f,'Source: dcpomatic'
97     print >>f,'Section: video'
98     print >>f,'Priority: extra'
99     print >>f,'Maintainer: Carl Hetherington <carl@dcpomatic.com>'
100     packages('Build-Depends', build_depends, f)
101     print >>f,'Standards-Version: 3.9.3'
102     print >>f,'Homepage: http://dcpomatic.com/'
103     print >>f,''
104     print >>f,'Package: dcpomatic'
105     if bits == 32:
106         print >>f,'Architecture: i386'
107     else:
108         print >>f,'Architecture: amd64'
109
110     packages('Depends', depends[version], f)
111     print >>f,'Description: Generator of Digital Cinema Packages (DCPs)'
112     print >>f,'  DCP-o-matic generates Digital Cinema Packages (DCPs) from video and audio'
113     print >>f,'  files (such as those from DVDs or Blu-Rays) for presentation on DCI-compliant'
114     print >>f,'  digital projectors.'
115
116 def dependencies(target):
117     return (('ffmpeg-cdist', '0b7ef017aca8b572914518c759db1e234d8fc505'),
118             ('libdcp', 'v0.85'))
119
120 def build(target):
121     cmd = './waf configure --prefix=%s' % target.work_dir_cscript()
122     if target.platform == 'windows':
123         cmd += ' --target-windows'
124     elif target.platform == 'linux':
125         cmd += ' --static'
126     target.command(cmd)
127
128     target.command('./waf')
129
130     if target.platform == 'linux' or target.platform == 'osx':
131         target.command('./waf install')
132
133 def package(target, version):
134     if target.platform == 'windows':
135         shutil.copyfile('build/platform/windows/installer.%s.nsi' % target.bits, 'build/platform/windows/installer2.%s.nsi' % target.bits)
136         target.command('sed -i "s~%%resources%%~%s/platform/windows~g" build/platform/windows/installer2.%s.nsi' % (os.getcwd(), target.bits))
137         target.command('sed -i "s~%%static_deps%%~%s~g" build/platform/windows/installer2.%s.nsi' % (target.windows_prefix, target.bits))
138         target.command('sed -i "s~%%cdist_deps%%~%s~g" build/platform/windows/installer2.%s.nsi' % (target.work_dir_cscript(), target.bits))
139         target.command('sed -i "s~%%binaries%%~%s/build~g" build/platform/windows/installer2.%s.nsi' % (os.getcwd(), target.bits))
140         target.command('sed -i "s~%%bits%%~32~g" build/platform/windows/installer2.%s.nsi' % target.bits)
141         target.command('makensis build/platform/windows/installer2.%s.nsi' % target.bits)
142         return os.path.abspath(glob.glob('build/platform/windows/*%s*.exe' % target.bits)[0])
143     elif target.platform == 'linux':
144         if target.bits == 32:
145             cpu = 'i386'
146         else:
147             cpu = 'amd64'
148
149         make_control(target.version, target.bits, 'debian/control')
150         target.command('./waf dist')
151         f = open('debian/files', 'w')
152         print >>f,'dcpomatic_%s-1_%s.deb video extra' % (version, cpu)
153         shutil.rmtree('build/deb', ignore_errors=True)
154
155         os.makedirs('build/deb')
156         os.chdir('build/deb')
157         shutil.move('../../dcpomatic-%s.tar.bz2' % version, 'dcpomatic_%s.orig.tar.bz2' % version)
158         target.command('tar xjf dcpomatic_%s.orig.tar.bz2' % version)
159         os.chdir('dcpomatic-%s' % version)
160         target.command('dch -b -v %s-1 "New upstream release."' % version)
161         target.set('CDIST_LINKFLAGS', target.get('LINKFLAGS'))
162         target.set('CDIST_CXXFLAGS', target.get('CXXFLAGS'))
163         target.set('CDIST_PKG_CONFIG_PATH', target.get('PKG_CONFIG_PATH'))
164         target.command('dpkg-buildpackage')
165         
166         debs = []
167         for p in glob.glob('../*.deb'):
168             debs.append(os.path.abspath(p))
169
170         return debs
171     elif target.platform == 'osx':
172         target.command('bash platform/osx/make_dmg.sh %s' % target.work_dir_cscript())
173         return os.path.abspath(glob.glob('build/platform/osx/DCP-o-matic*.dmg')[0])
174
175 def make_pot(target):
176     target.command('./waf pot')
177     return [os.path.abspath('build/src/lib/libdcpomatic.pot'),
178             os.path.abspath('build/src/wx/libdcpomatic-wx.pot'),
179             os.path.abspath('build/src/tools/dcpomatic.pot')]
180
181 def make_manual(target):
182     os.chdir('doc/manual')
183     target.command('make')
184     target.command('pdflatex colour.tex')
185     return [os.path.abspath('pdf'), os.path.abspath('html'), os.path.abspath('colour.pdf')]
186
187 def test(target):
188     if target.platform != 'windows':
189         target.set('LC_ALL', 'C')
190         target.command('run/tests')