Fix content selection update on new film.
[dcpomatic.git] / cscript
1 import glob
2 import shutil
3 import os
4
5 def dependencies(target):
6     if target.platform == 'windows':
7         return ()
8     else:
9         return (('ffmpeg-cdist', 'e797834288eaf05a2f406524ae04aaa0f114cb08'),
10                 ('libdcp', 'v0.69'))
11
12 def build(target):
13     cmd = './waf configure --prefix=%s' % target.work_dir_cscript()
14     if target.platform == 'windows':
15         cmd += ' --target-windows'
16     elif target.platform == 'linux':
17         cmd += ' --static'
18     target.command(cmd)
19
20     target.command('./waf')
21
22     if target.platform == 'linux' or target.platform == 'osx':
23         target.command('./waf install')
24
25
26 def package(target, version):
27     if target.platform == 'windows':
28         shutil.copyfile('build/platform/windows/installer.%s.nsi' % target.bits, 'build/platform/windows/installer2.%s.nsi' % target.bits)
29         target.command('sed -i "s~%%resources%%~%s/platform/windows~g" build/platform/windows/installer2.%s.nsi' % (os.getcwd(), target.bits))
30         target.command('sed -i "s~%%deps%%~%s~g" build/platform/windows/installer2.%s.nsi' % (target.windows_prefix, target.bits))
31         target.command('sed -i "s~%%binaries%%~%s/build~g" build/platform/windows/installer2.%s.nsi' % (os.getcwd(), target.bits))
32         target.command('sed -i "s~%%bits%%~32~g" build/platform/windows/installer2.%s.nsi' % target.bits)
33         target.command('makensis build/platform/windows/installer2.%s.nsi' % target.bits)
34         return os.path.abspath(glob.glob('build/platform/windows/*%s*.exe' % target.bits)[0])
35     elif target.platform == 'linux':
36         if target.bits == 32:
37             cpu = 'i386'
38         else:
39             cpu = 'amd64'
40
41         shutil.copyfile('platform/linux/control-%s-%d' % (target.version, target.bits), 'debian/control')
42         target.command('./waf dist')
43         f = open('debian/files', 'w')
44         print >>f,'dcpomatic_%s-1_%s.deb video extra' % (version, cpu)
45         shutil.rmtree('build/deb', ignore_errors=True)
46
47         os.makedirs('build/deb')
48         os.chdir('build/deb')
49         shutil.move('../../dcpomatic-%s.tar.bz2' % version, 'dcpomatic_%s.orig.tar.bz2' % version)
50         target.command('tar xjf dcpomatic_%s.orig.tar.bz2' % version)
51         os.chdir('dcpomatic-%s' % version)
52         target.command('dch -b -v %s-1 "New upstream release."' % version)
53         target.set('CDIST_LINKFLAGS', target.get('LINKFLAGS'))
54         target.set('CDIST_CXXFLAGS', target.get('CXXFLAGS'))
55         target.set('CDIST_PKG_CONFIG_PATH', target.get('PKG_CONFIG_PATH'))
56         target.command('dpkg-buildpackage')
57         
58         debs = []
59         for p in glob.glob('../*.deb'):
60             debs.append(os.path.abspath(p))
61
62         return debs
63     elif target.platform == 'osx':
64         target.command('bash platform/osx/make_dmg.sh')
65         return os.path.abspath(glob.glob('build/platform/osx/DCP-o-matic*.dmg')[0])
66
67 def make_pot(target):
68     target.command('./waf pot')
69     return [os.path.abspath('build/src/lib/libdcpomatic.pot'),
70             os.path.abspath('build/src/wx/libdcpomatic-wx.pot'),
71             os.path.abspath('build/src/tools/dcpomatic.pot')]
72
73 def make_manual(target):
74     os.chdir('doc/manual')
75     target.command('make')
76     return [os.path.abspath('pdf'), os.path.abspath('html')]