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