3 # Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 deb_build_depends = {'debhelper': '8.0.0',
28 'libssh-dev': '0.5.2',
29 'libsndfile1-dev': '1.0.25',
30 'libgtk2.0-dev': '2.24.10'}
34 deb_depends['12.04'] = {'libc6': '2.15',
36 'libboost-filesystem1.48.0': '1.48.0-3',
37 'libboost-thread1.48.0': '1.48.0-3',
38 'libboost-regex1.48.0': '1.48.0-3',
39 'libsndfile1': '1.0.25',
40 'libmagick++4': '8:6.6.9.7',
41 'libxml++2.6-2': '2.34.1',
42 'libgtk2.0-0': '2.24.10',
43 'libxmlsec1': '1.2.14-1.2build1',
44 'libxmlsec1-openssl': '1.2.14-1.2build1',
45 'libboost-date-time1.48.0': '1.48.0-3',
46 'libcurl3': '7.22.0-3ubuntu4',
47 'libzip2': '0.10-1ubuntu1',
48 'libsamplerate0': '0.1.8-4',
49 'libicu48': '4.8.1.1-3'}
51 deb_depends['14.04'] = {'libc6': '2.19-0ubuntu6',
52 'libssh-4': '0.6.1-0ubuntu3',
53 'libboost-filesystem1.54.0': '1.54.0-4ubuntu3',
54 'libboost-thread1.54.0': '1.54.0-4ubuntu3',
55 'libboost-regex1.54.0': '1.54.0-4ubuntu3',
56 'libsndfile1': '1.0.25-7ubuntu2',
57 'libmagick++5': '8:6.7.7.10-6ubuntu3',
58 'libxml++2.6-2': '2.36.0-2ubuntu1',
59 'libgtk2.0-0': '2.24.23-0ubuntu1',
60 'libxmlsec1': '1.2.18-2ubuntu1',
61 'libxmlsec1-openssl': '1.2.18-2ubuntu1',
62 'libboost-date-time1.54.0': '1.54.0-4ubuntu3',
63 'libcurl3': '7.35.0-1ubuntu2',
64 'libzip2': '0.10.1-1.2',
65 'libsamplerate0': '0.1.8-7',
68 deb_depends['15.04'] = {'libc6': '2.21-0ubuntu4',
69 'libssh-4': '0.6.3-3ubuntu3',
70 'libboost-filesystem1.55.0': '1.55.0+dfsg-3ubuntu2',
71 'libboost-thread1.55.0': '1.55.0+dfsg-3ubuntu2',
72 'libboost-regex1.55.0': '1.55.0+dfsg-3ubuntu2',
73 'libsndfile1': '1.0.25-9.1',
74 'libmagick++-6.q16-5': '8:6.8.9.9-5',
75 'libxml++2.6-2': '2.36.0-2.1',
76 'libgtk2.0-0': '2.24.27-0ubuntu1',
77 'libxmlsec1': '1.2.20-2ubuntu2',
78 'libxmlsec1-openssl': '1.2.20-2ubuntu2',
79 'libboost-date-time1.55.0': '1.55.0+dfsg-3ubuntu2',
80 'libcurl3': '7.38.0-3ubuntu2',
81 'libzip2': '0.11.2-1.2',
82 'libwxgtk3.0-0': '3.0.2-1',
83 'libsamplerate0': '0.1.8-8',
86 deb_depends['7'] = {'libc6': '2.13',
88 'libboost-filesystem1.49.0': '1.49.0',
89 'libboost-thread1.49.0': '1.49.0',
90 'libboost-regex1.49.0': '1.49.0',
91 'libsndfile1': '1.0.25',
92 'libmagick++5': '8:6.7.7.10',
93 'libxml++2.6-2': '2.34.2',
94 'libgtk2.0-0': '2.24.10',
95 'libxmlsec1': '1.2.18',
96 'libboost-date-time1.49.0': '1.49.0',
97 'libxmlsec1-openssl': '1.2.18',
100 'libcairomm-1.0-1': '1.10.0-1',
101 'libpangomm-1.4-1': '2.28.4-1',
102 'libsamplerate0': '0.1.8-5',
103 'libicu48': '4.8.1.1-12+deb7u3'}
105 deb_depends['8'] = {'libc6': '2.19-18',
106 'libssh-4': '0.6.3-4',
107 'libboost-filesystem1.55.0': '1.55.0',
108 'libboost-thread1.55.0': '1.55.0',
109 'libboost-date-time1.55.0': '1.55.0',
110 'libboost-regex1.55.0': '1.55.0',
111 'libsndfile1': '1.0.25-9.1',
112 'libmagick++-6.q16-5': '8:6.8.9.9-5',
113 'libxml++2.6-2': '2.36.0',
114 'libgtk2.0-0': '2.24.25',
115 'libxmlsec1': '1.2.20',
116 'libxmlsec1-openssl': '1.2.20',
117 'libcurl3': '7.38.0',
119 'libwxgtk3.0-0': '3.0.2',
120 'libxcb-xfixes0': '1.10',
121 'libxcb-shape0': '1.10',
122 'libsamplerate0': '0.1.8-8',
123 'libicu52': '52.1-8+deb8u2'}
125 deb_depends['unstable'] = {'libc6': '2.13',
127 'libboost-filesystem1.55.0': '1.55.0',
128 'libboost-thread1.55.0': '1.55.0',
129 'libboost-regex1.55.0': '1.55.0',
130 'libsndfile1': '1.0.25',
131 'libmagick++5': '8:6.7.7.10',
132 'libxml++2.6-2': '2.34.2',
133 'libgtk2.0-0': '2.24.10',
134 'libxmlsec1': '1.2.18',
135 'libboost-date-time1.55.0': '1.55.0',
136 'libxmlsec1-openssl': '1.2.18',
137 'libcurl3': '7.26.0',
139 'libsamplerate0': '0.1.8-8',
140 'libicu52': '52.1-9'}
142 def packages(name, packages, f):
148 def make_control(debian_version, bits, filename, debug):
149 f = open(filename, 'w')
150 print >>f,'Source: dcpomatic'
151 print >>f,'Section: video'
152 print >>f,'Priority: extra'
153 print >>f,'Maintainer: Carl Hetherington <carl@dcpomatic.com>'
154 packages('Build-Depends', deb_build_depends, f)
155 print >>f,'Standards-Version: 3.9.3'
156 print >>f,'Homepage: http://dcpomatic.com/'
158 print >>f,'Package: dcpomatic'
160 print >>f,'Architecture: i386'
162 print >>f,'Architecture: amd64'
164 packages('Depends', deb_depends[debian_version], f)
166 print >>f,'Description: Generator of Digital Cinema Packages (DCPs)'
167 print >>f,' DCP-o-matic generates Digital Cinema Packages (DCPs) from video and audio'
168 print >>f,' files (such as those from DVDs or Blu-Rays) for presentation on DCI-compliant'
169 print >>f,' digital projectors.'
173 print >>f,'Package: dcpomatic-dbg'
175 print >>f,'Architecture: i386'
177 print >>f,'Architecture: amd64'
178 print >>f,'Section: debug'
179 print >>f,'Priority: extra'
180 packages('Depends', deb_depends[debian_version], f)
181 print >>f,'Description: debugging symbols for dcpomatic'
182 print >>f,' This package contains the debugging symbols for dcpomatic.'
185 def make_spec(filename, version, target):
186 """Make a .spec file for a RPM build"""
187 f = open(filename, 'w')
188 print >>f,'Summary:A program that generates Digital Cinema Packages (DCPs) from video and audio files'
189 print >>f,'Name:dcpomatic2'
190 print >>f,'Version:%s' % version
191 print >>f,'Release:1%{?dist}'
192 print >>f,'License:GPL'
193 print >>f,'Group:Applications/Multimedia'
194 print >>f,'URL:http://dcpomatic.com/'
195 print >>f,'Requires: ImageMagick-c++, glibmm24, libzip'
197 print >>f,'%description'
198 print >>f,'DCP-o-matic generates Digital Cinema Packages (DCPs) from video and audio '
199 print >>f,'files (such as those from DVDs or Blu-Rays) for presentation on DCI-compliant '
200 print >>f,'digital projectors.'
203 print >>f,'%{_bindir}/dcpomatic2'
204 print >>f,'%{_bindir}/dcpomatic2_batch'
205 print >>f,'%{_bindir}/dcpomatic2_cli'
206 print >>f,'%{_bindir}/dcpomatic2_create'
207 print >>f,'%{_bindir}/dcpomatic2_kdm'
208 print >>f,'%{_bindir}/dcpomatic2_server'
209 print >>f,'%{_bindir}/dcpomatic2_server_cli'
210 print >>f,'%{_datadir}/applications/dcpomatic2.desktop'
211 print >>f,'%{_datadir}/applications/dcpomatic2_batch.desktop'
212 print >>f,'%{_datadir}/applications/dcpomatic2_server.desktop'
213 print >>f,'%{_datadir}/dcpomatic2/taskbar_icon.png'
214 print >>f,'%{_datadir}/dcpomatic2/LiberationSans-Regular.ttf'
215 print >>f,'%{_datadir}/dcpomatic2/splash.png'
216 for r in ['128x128', '22x22', '32x32', '48x48', '64x64']:
217 print >>f,'%%{_datadir}/icons/hicolor/%s/apps/dcpomatic2.png' % r
218 for l in ['de_DE', 'es_ES', 'fr_FR', 'it_IT', 'sv_SE', 'nl_NL', 'ru_RU', 'pl_PL', 'da_DK']:
219 print >>f,'%%{_datadir}/locale/%s/LC_MESSAGES/dcpomatic2.mo' % l
220 print >>f,'%%{_datadir}/locale/%s/LC_MESSAGES/libdcpomatic2-wx.mo' % l
221 print >>f,'%%{_datadir}/locale/%s/LC_MESSAGES/libdcpomatic2.mo' % l
224 print >>f,'rm -rf $RPM_BUILD_DIR/dcpomatic-%s' % version
225 print >>f,'tar xjf $RPM_SOURCE_DIR/dcpomatic-%s.tar.bz2' % version
227 print >>f,'cd dcpomatic-%s' % version
228 print >>f,'export PKG_CONFIG_PATH=%s/lib/pkgconfig:/usr/local/lib/pkgconfig' % target.directory
229 print >>f,'CXXFLAGS="-I%s/include" LDFLAGS="-L%s/lib" ./waf configure --prefix=%%{buildroot}/usr --install-prefix=/usr %s' % (target.directory, target.directory, configure_options(target))
232 print >>f,'cd dcpomatic-%s' % version
233 print >>f,'./waf install'
236 print >>f,'/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :'
239 print >>f,'if [ $1 -eq 0 ] ; then'
240 print >>f,' /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null'
241 print >>f,' /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :'
244 print >>f,'%posttrans'
245 print >>f,'/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :'
247 def dependencies(target):
249 if target.platform == 'linux':
250 ffmpeg_options = { 'shared': False }
254 return (('ffmpeg-cdist', 'd0986a9', ffmpeg_options),
255 ('libdcp', '4852a22'),
256 ('libsub', 'b98c145'))
258 def configure_options(target):
261 opt += ' --enable-debug'
262 if target.platform == 'windows':
263 opt += ' --target-windows'
264 elif target.platform == 'linux':
265 opt += ' --static-dcpomatic --static-openjpeg --static-wxwidgets --static-ffmpeg --static-dcp --static-sub --static-cxml'
266 if target.distro == 'centos':
267 opt += ' --static-xmlsec --static-ssh --disable-tests'
268 if target.version == '6.5':
269 opt += ' --static-boost --static-xmlpp'
270 elif target.version == '7':
271 opt += ' --workaround-gssapi --static-xmlpp'
275 def build(target, options):
276 target.command('./waf configure --prefix=%s %s' % (target.directory, configure_options(target)))
277 target.command('./waf')
279 if target.platform == 'linux' or target.platform == 'osx':
280 target.command('./waf install')
282 def package_windows(target):
283 shutil.copyfile('build/platform/windows/installer.%s.nsi' % target.bits, 'build/platform/windows/installer2.%s.nsi' % target.bits)
284 target.command('sed -i "s~%%resources%%~%s/platform/windows~g" build/platform/windows/installer2.%s.nsi' % (os.getcwd(), target.bits))
285 target.command('sed -i "s~%%graphics%%~%s/graphics~g" build/platform/windows/installer2.%s.nsi' % (os.getcwd(), target.bits))
286 target.command('sed -i "s~%%static_deps%%~%s~g" build/platform/windows/installer2.%s.nsi' % (target.windows_prefix, target.bits))
287 target.command('sed -i "s~%%cdist_deps%%~%s~g" build/platform/windows/installer2.%s.nsi' % (target.directory, target.bits))
288 target.command('sed -i "s~%%mingw%%~%s~g" build/platform/windows/installer2.%s.nsi' % (target.mingw_path, target.bits))
289 target.command('sed -i "s~%%binaries%%~%s/build~g" build/platform/windows/installer2.%s.nsi' % (os.getcwd(), target.bits))
290 target.command('sed -i "s~%%bits%%~32~g" build/platform/windows/installer2.%s.nsi' % target.bits)
291 target.command('makensis build/platform/windows/installer2.%s.nsi' % target.bits)
292 return os.path.abspath(glob.glob('build/platform/windows/*%s*.exe' % target.bits)[0])
294 def package_debian(target, cpu, version):
295 make_control(target.version, target.bits, 'debian/control', target.debug)
296 target.command('./waf dist')
297 f = open('debian/files', 'w')
298 print >>f,'dcpomatic_%s-1_%s.deb video extra' % (version, cpu)
299 shutil.rmtree('build/deb', ignore_errors=True)
301 os.makedirs('build/deb')
302 os.chdir('build/deb')
303 shutil.move('../../dcpomatic-%s.tar.bz2' % version, 'dcpomatic_%s.orig.tar.bz2' % version)
304 target.command('tar xjf dcpomatic_%s.orig.tar.bz2' % version)
305 os.chdir('dcpomatic-%s' % version)
306 target.command('dch -b -v %s-1 "New upstream release."' % version)
307 target.set('CDIST_LINKFLAGS', target.get('LINKFLAGS'))
308 target.set('CDIST_CXXFLAGS', target.get('CXXFLAGS'))
309 target.set('CDIST_PKG_CONFIG_PATH', target.get('PKG_CONFIG_PATH'))
311 target.set('CDIST_CONFIGURE', '"' + configure_options(target) + '"')
313 target.set('CDIST_DEBUG_PACKAGE', '--dbg-package=dcpomatic-dbg')
314 if target.version == '15.04' or target.version == '8':
315 target.set('CDIST_LOCALE_PREFIX', '/usr/share/locale')
317 target.set('CDIST_LOCALE_PREFIX', '/usr/local/share/locale')
319 target.command('dpkg-buildpackage -uc -us')
322 for p in glob.glob('../*.deb'):
323 debs.append(os.path.abspath(p))
327 def package_rpm(target, cpu, version):
328 topdir = os.path.realpath('build/rpmbuild')
329 os.makedirs('%s/BUILD' % topdir)
330 os.makedirs('%s/RPMS' % topdir)
331 os.makedirs('%s/SOURCES' % topdir)
332 os.makedirs('%s/SPECS' % topdir)
333 os.makedirs('%s/SRPMS' % topdir)
335 target.command('./waf dist')
337 "%s/src/dcpomatic/dcpomatic-%s.tar.bz2" % (target.directory, version),
338 "%s/SOURCES/dcpomatic-%s.tar.bz2" % (topdir, version)
341 make_spec('build/platform/linux/dcpomatic2.spec', version, target)
342 target.command('rpmbuild --define \'_topdir %s\' -bb build/platform/linux/dcpomatic2.spec' % topdir)
350 print 'Looking in %s/RPMS/%s/*.rpm' % (topdir, cpu)
351 for p in glob.glob('%s/RPMS/%s/*.rpm' % (topdir, cpu)):
353 rpms.append(os.path.abspath(p))
357 def package(target, version):
358 if target.platform == 'windows':
359 return package_windows(target)
360 elif target.platform == 'linux':
361 if target.bits == 32:
366 if target.distro == 'debian' or target.distro == 'ubuntu':
367 return package_debian(target, cpu, version)
368 elif target.distro == 'centos' or target.distro == 'fedora':
369 return package_rpm(target, cpu, version)
370 elif target.platform == 'osx':
371 target.command('bash platform/osx/make_dmg.sh %s' % target.directory)
372 return os.path.abspath(glob.glob('build/platform/osx/DCP-o-matic*.dmg')[0])
374 def make_pot(target):
375 target.command('./waf pot')
376 return [os.path.abspath('build/src/lib/libdcpomatic.pot'),
377 os.path.abspath('build/src/wx/libdcpomatic-wx.pot'),
378 os.path.abspath('build/src/tools/dcpomatic.pot')]
380 def make_manual(target):
381 os.chdir('doc/manual')
382 target.command('make')
383 target.command('pdflatex colour.tex')
384 return [os.path.abspath('pdf'), os.path.abspath('html'), os.path.abspath('colour.pdf')]
387 if target.platform != 'windows':
388 target.set('LC_ALL', 'C')
389 target.command('run/tests')