3 # Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
5 # This file is part of DCP-o-matic.
7 # DCP-o-matic is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # DCP-o-matic is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 from __future__ import print_function
28 deb_build_depends = dict()
30 deb_build_depends_base = ['debhelper', 'python', 'g++', 'pkg-config', 'libsndfile1-dev', 'libgtk2.0-dev', 'libx264-dev']
32 deb_build_depends['16.04'] = copy.deepcopy(deb_build_depends_base)
33 deb_build_depends['16.04'].extend(['libssh-dev'])
34 deb_build_depends['18.04'] = copy.deepcopy(deb_build_depends_base)
35 deb_build_depends['18.04'].extend(['libssh-dev'])
36 deb_build_depends['19.04'] = copy.deepcopy(deb_build_depends_base)
37 deb_build_depends['19.04'].extend(['libssh-dev'])
38 deb_build_depends['19.10'] = copy.deepcopy(deb_build_depends_base)
39 deb_build_depends['19.10'].extend(['libssh-dev'])
40 deb_build_depends['20.04'] = copy.deepcopy(deb_build_depends_base)
41 deb_build_depends['20.04'].extend(['libssh-dev'])
42 deb_build_depends['7'] = copy.deepcopy(deb_build_depends_base)
43 deb_build_depends['7'].extend(['libssh-dev'])
44 deb_build_depends['8'] = copy.deepcopy(deb_build_depends_base)
45 deb_build_depends['8'].extend(['libssh-gcrypt-dev'])
46 deb_build_depends['9'] = copy.deepcopy(deb_build_depends_base)
47 deb_build_depends['9'].extend(['libssh-gcrypt-dev'])
48 deb_build_depends['10'] = copy.deepcopy(deb_build_depends_base)
49 deb_build_depends['10'].extend(['libssh-gcrypt-dev'])
50 deb_build_depends['unstable'] = copy.deepcopy(deb_build_depends_base)
53 deb_depends_gui = dict()
55 deb_depends_base = ['libc6', 'libsndfile1', 'libsamplerate0', 'libxmlsec1', 'libxmlsec1-openssl', 'libgtk2.0-0']
57 deb_depends['16.04'] = copy.deepcopy(deb_depends_base)
58 deb_depends['16.04'].extend(['libboost-filesystem1.58.0',
59 'libboost-thread1.58.0',
60 'libboost-regex1.58.0',
62 'libboost-date-time1.58.0',
73 deb_depends['18.04'] = copy.deepcopy(deb_depends_base)
74 deb_depends['18.04'].extend(['libboost-filesystem1.65.1',
75 'libboost-thread1.65.1',
76 'libboost-regex1.65.1',
77 'libboost-date-time1.65.1',
90 deb_depends['19.04'] = copy.deepcopy(deb_depends_base)
91 deb_depends['19.04'].extend(['libboost-filesystem1.67.0',
92 'libboost-thread1.67.0',
93 'libboost-regex1.67.0',
94 'libboost-date-time1.67.0',
107 deb_depends['19.10'] = copy.deepcopy(deb_depends_base)
108 deb_depends['19.10'].extend(['libboost-filesystem1.67.0',
109 'libboost-thread1.67.0',
110 'libboost-regex1.67.0',
111 'libboost-date-time1.67.0',
112 'libcairomm-1.0-1v5',
113 'libpangomm-1.4-1v5',
124 deb_depends['20.04'] = copy.deepcopy(deb_depends_base)
125 deb_depends['20.04'].extend(['libboost-filesystem1.71.0',
126 'libboost-thread1.71.0',
127 'libboost-regex1.71.0',
128 'libboost-date-time1.71.0',
129 'libcairomm-1.0-1v5',
130 'libpangomm-1.4-1v5',
133 'libwxgtk3.0-gtk3-0v5',
143 deb_depends['8'] = copy.deepcopy(deb_depends_base)
144 deb_depends['8'].extend(['libboost-filesystem1.55.0',
145 'libboost-thread1.55.0',
146 'libboost-date-time1.55.0',
147 'libboost-regex1.55.0',
161 deb_depends['9'] = copy.deepcopy(deb_depends_base)
162 deb_depends['9'].extend(['libboost-filesystem1.62.0',
163 'libboost-thread1.62.0',
164 'libboost-regex1.62.0',
165 'libboost-date-time1.62.0',
169 'libcairomm-1.0-1v5',
170 'libpangomm-1.4-1v5',
178 deb_depends_gui['9'] = [ 'libwxgtk3.0-0v5',
184 deb_depends['10'] = copy.deepcopy(deb_depends_base)
185 deb_depends['10'].extend(['libboost-filesystem1.67.0',
186 'libboost-thread1.67.0',
187 'libboost-regex1.67.0',
188 'libboost-date-time1.67.0',
192 'libcairomm-1.0-1v5',
193 'libpangomm-1.4-1v5',
201 deb_depends_gui['10'] = [ 'libwxgtk3.0-0v5',
207 deb_depends['unstable'] = copy.deepcopy(deb_depends_base)
208 deb_depends['unstable'].extend(['libboost-filesystem1.67.0',
209 'libboost-thread1.67.0',
210 'libboost-regex1.67.0',
211 'libboost-date-time1.67.0',
220 def packages(name, packages, f):
224 print(s[:-2], file=f)
226 def make_control(debian_version, bits, filename, debug, gui):
227 f = open(filename, 'w')
228 print('Source: dcpomatic', file=f)
229 print('Section: video', file=f)
230 print('Priority: extra', file=f)
231 print('Maintainer: Carl Hetherington <carl@dcpomatic.com>', file=f)
232 packages('Build-Depends', deb_build_depends[debian_version], f)
233 print('Standards-Version: 3.9.3', file=f)
234 print('Homepage: https://dcpomatic.com/', file=f)
236 print('Package: dcpomatic', file=f)
238 print('Architecture: i386', file=f)
240 print('Architecture: amd64', file=f)
242 pkg = deb_depends[debian_version]
243 if gui and debian_version in deb_depends_gui:
244 pkg.extend(deb_depends_gui[debian_version])
246 packages('Depends', pkg, f)
248 print('Description: Generator of Digital Cinema Packages (DCPs)', file=f)
249 print(' DCP-o-matic generates Digital Cinema Packages (DCPs) from videos, images,', file=f)
250 print(' sound and subtitle files. You can use it to make content for playback on DCI-compliant', file=f)
251 print(' cinema projectors.', file=f)
255 print('Package: dcpomatic-dbg', file=f)
257 print('Architecture: i386', file=f)
259 print('Architecture: amd64', file=f)
260 print('Section: debug', file=f)
261 print('Priority: extra', file=f)
262 packages('Depends', pkg, f)
263 print('Description: debugging symbols for dcpomatic', file=f)
264 print(' This package contains the debugging symbols for dcpomatic.', file=f)
267 def make_spec(filename, version, target, options, requires=None):
268 """Make a .spec file for a RPM build"""
269 f = open(filename, 'w')
270 print('Summary:A program that generates Digital Cinema Packages (DCPs) from video and audio files', file=f)
271 print('Name:dcpomatic2', file=f)
272 print('Version:%s' % version, file=f)
273 print('Release:1%{?dist}', file=f)
274 print('License:GPL', file=f)
275 print('Group:Applications/Multimedia', file=f)
276 print('URL:https://dcpomatic.com/', file=f)
277 if requires is not None:
278 print('Requires:%s' % requires, file=f)
280 print('%description', file=f)
281 print('DCP-o-matic generates Digital Cinema Packages (DCPs) from video and audio ', file=f)
282 print('files for presentation on DCI-compliant digital projectors.', file=f)
284 print('%files', file=f)
285 print('%{_bindir}/dcpomatic2', file=f)
286 print('%{_bindir}/dcpomatic2_batch', file=f)
287 print('%{_bindir}/dcpomatic2_cli', file=f)
288 print('%{_bindir}/dcpomatic2_create', file=f)
289 print('%{_bindir}/dcpomatic2_kdm', file=f)
290 print('%{_bindir}/dcpomatic2_server', file=f)
291 print('%{_bindir}/dcpomatic2_server_cli', file=f)
292 print('%{_bindir}/dcpomatic2_kdm_cli', file=f)
293 print('%{_bindir}/dcpomatic2_player', file=f)
294 print('%{_bindir}/dcpomatic2_playlist', file=f)
295 print('%{_datadir}/applications/dcpomatic2.desktop', file=f)
296 print('%{_datadir}/applications/dcpomatic2_batch.desktop', file=f)
297 print('%{_datadir}/applications/dcpomatic2_server.desktop', file=f)
298 print('%{_datadir}/applications/dcpomatic2_kdm.desktop', file=f)
299 print('%{_datadir}/applications/dcpomatic2_player.desktop', file=f)
300 print('%{_datadir}/applications/dcpomatic2_playlist.desktop', file=f)
301 print('%{_datadir}/dcpomatic2/dcpomatic2_server_small.png', file=f)
302 print('%{_datadir}/dcpomatic2/select.png', file=f)
303 print('%{_datadir}/dcpomatic2/sequence.png', file=f)
304 print('%{_datadir}/dcpomatic2/snap.png', file=f)
305 print('%{_datadir}/dcpomatic2/zoom.png', file=f)
306 print('%{_datadir}/dcpomatic2/zoom_all.png', file=f)
307 print('%{_datadir}/dcpomatic2/tick.png', file=f)
308 print('%{_datadir}/dcpomatic2/no_tick.png', file=f)
309 print('%{_datadir}/dcpomatic2/me.jpg', file=f)
310 print('%{_datadir}/dcpomatic2/LiberationSans-Regular.ttf', file=f)
311 print('%{_datadir}/dcpomatic2/LiberationSans-Italic.ttf', file=f)
312 print('%{_datadir}/dcpomatic2/LiberationSans-Bold.ttf', file=f)
313 print('%{_datadir}/dcpomatic2/splash.png', file=f)
314 for r in ['128x128', '16x16', '22x22', '256x256', '32x32', '48x48', '512x512', '64x64']:
315 print('%%{_datadir}/icons/hicolor/%s/apps/dcpomatic2.png' % r, file=f)
316 print('%%{_datadir}/icons/hicolor/%s/apps/dcpomatic2_batch.png' % r, file=f)
317 print('%%{_datadir}/icons/hicolor/%s/apps/dcpomatic2_kdm.png' % r, file=f)
318 print('%%{_datadir}/icons/hicolor/%s/apps/dcpomatic2_server.png' % r, file=f)
319 print('%%{_datadir}/icons/hicolor/%s/apps/dcpomatic2_player.png' % r, file=f)
320 print('%%{_datadir}/icons/hicolor/%s/apps/dcpomatic2_playlist.png' % r, file=f)
321 for l in ['de_DE', 'es_ES', 'fr_FR', 'it_IT', 'sv_SE', 'nl_NL', 'ru_RU', 'pl_PL', 'da_DK',
322 'pt_PT', 'pt_BR', 'sk_SK', 'cs_CZ', 'uk_UA', 'zh_CN', 'tr_TR', 'ko_KR']:
323 print('%%{_datadir}/locale/%s/LC_MESSAGES/dcpomatic2.mo' % l, file=f)
324 print('%%{_datadir}/locale/%s/LC_MESSAGES/libdcpomatic2-wx.mo' % l, file=f)
325 print('%%{_datadir}/locale/%s/LC_MESSAGES/libdcpomatic2.mo' % l, file=f)
327 print('%prep', file=f)
328 print('rm -rf $RPM_BUILD_DIR/dcpomatic-%s' % version, file=f)
329 print('tar xjf $RPM_SOURCE_DIR/dcpomatic-%s.tar.bz2' % version, file=f)
330 print('%build', file=f)
331 print('cd dcpomatic-%s' % version, file=f)
332 print('export PKG_CONFIG_PATH=%s/lib/pkgconfig:%s/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig' % (target.directory, target.directory), file=f)
334 print('CXXFLAGS="-I%s/include" LDFLAGS="-L%s/lib" ./waf configure --prefix=%%{buildroot}/usr --install-prefix=/usr %s' %
335 (target.directory, target.directory, configure_options(target, options)), file=f)
336 print('./waf', file=f)
337 print('%install', file=f)
338 print('cd dcpomatic-%s' % version, file=f)
339 print('./waf install', file=f)
341 print('%post', file=f)
342 print('/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :', file=f)
344 print('%postun', file=f)
345 print('if [ $1 -eq 0 ] ; then', file=f)
346 print(' /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null', file=f)
347 print(' /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :', file=f)
350 print('%posttrans', file=f)
351 print('/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :', file=f)
353 def dependencies(target):
355 if target.platform == 'linux':
356 ffmpeg_options = { 'shared': False }
360 if target.platform == 'windows' and target.version == 'xp':
361 deps = [('ffmpeg-cdist', '5783efa', ffmpeg_options)]
362 elif target.platform != 'linux' or target.distro != 'arch':
363 deps = [('ffmpeg-cdist', 'a820b44', ffmpeg_options)]
365 # Use distro-provided FFmpeg on Arch
368 deps.append(('libdcp', 'v1.6.15'))
369 deps.append(('libsub', 'v1.4.19'))
370 deps.append(('rtaudio-cdist', 'bf0fc23'))
374 def option_defaults():
375 return { "gui": True, "variant": None }
377 def configure_options(target, options):
380 if not (target.platform == 'linux' and target.distro == 'ubuntu' and target.version == '18.04'):
381 # Currently we only build tests on Ubuntu 18.04
382 opt += ' --disable-tests'
385 opt += ' --enable-debug'
386 if target.platform == 'windows':
387 opt += ' --target-windows'
388 elif target.platform == 'linux':
389 opt += ' --static-dcpomatic --static-wxwidgets --static-ffmpeg --static-dcp --static-sub --static-cxml'
390 if target.distro == 'centos':
391 if target.version == '6.5':
392 opt += ' --static-boost --static-xmlpp'
393 elif target.version == '7':
394 opt += ' --workaround-gssapi'
395 # Centos 7 ships with glibmm 2.50.0 which requires C++11
396 # but its compiler (gcc 4.8.5) defaults to C++97. Go figure.
397 # I worry that this will cause ABI problems but I don't have
399 opt += ' --force-cpp11'
401 if not options['gui']:
402 opt += ' --disable-gui'
404 if options['variant'] is not None:
405 opt += ' --variant=%s' % options['variant']
407 # Build Windows debug versions with static linking as I think gdb works better then
408 if target.debug and target.platform == 'windows':
409 opt += ' --static-dcpomatic'
413 def build(target, options):
414 if target.platform == 'flatpak':
415 target.checkout_dependencies()
416 prefix = 'https://dcpomatic.com/deps'
418 modules.append({'name': 'libzip',
419 'buildsystem': 'cmake',
420 'sources': [{'type': 'archive',
421 'url': '%s/libzip-1.4.0.tar.xz' % prefix,
422 'sha256': 'e508aba025f5f94b267d5120fc33761bcd98440ebe49dbfe2ed3df3afeacc7b1'}]})
423 modules.append({'name': 'libsigc++',
424 'sources': [{'type': 'archive',
425 'url': '%s/libsigc++-2.10.0.tar.xz' % prefix,
426 'sha256': 'f843d6346260bfcb4426259e314512b99e296e8ca241d771d21ac64f28298d81'}]})
427 modules.append({'name': 'glibmm',
428 'sources': [{'type': 'archive',
429 'url': '%s/glibmm-2.48.1.tar.xz' % prefix,
430 'sha256': 'dc225f7d2f466479766332483ea78f82dc349d59399d30c00de50e5073157cdf'}]})
431 modules.append({'name': 'cairomm',
432 'sources': [{'type': 'archive',
433 'url': '%s/cairomm-1.12.2.tar.gz' % prefix,
434 'sha256': '45c47fd4d0aa77464a75cdca011143fea3ef795c4753f6e860057da5fb8bd599'}]})
435 modules.append({'name': 'pangomm',
436 'sources': [{'type': 'archive',
437 'url': '%s/pangomm-2.40.1.tar.xz' % prefix,
438 'sha256': '9762ee2a2d5781be6797448d4dd2383ce14907159b30bc12bf6b08e7227be3af'}]})
439 modules.append({'name': 'libxml++',
440 'sources': [{'type': 'archive',
441 'url': '%s/libxml++-2.40.1.tar.xz' % prefix,
442 'sha256': '4ad4abdd3258874f61c2e2a41d08e9930677976d303653cd1670d3e9f35463e9'}]})
443 modules.append({'name': 'xmlsec1',
444 'sources': [{'type': 'archive',
445 'url': '%s/xmlsec1-1.2.25.tar.gz' % prefix,
446 'sha256': '967ca83edf25ccb5b48a3c4a09ad3405a63365576503bf34290a42de1b92fcd2'}]})
447 modules.append({'name': 'openjpeg2',
448 'buildsystem': 'cmake',
449 'sources': [{'type': 'dir', 'path': os.path.abspath('../openjpeg2-cdist')}]})
450 modules.append({'name': 'boost',
451 'buildsystem': 'simple',
453 './bootstrap.sh --prefix=/app',
456 'sources': [{'type': 'archive',
457 'url': '%s/boost_1_66_0.tar.bz2' % prefix,
458 'sha256': '5721818253e6a0989583192f96782c4a98eb6204965316df9f5ad75819225ca9'}]})
459 modules.append({'name': 'asdcplib',
460 'buildsystem': 'simple',
462 './waf configure --prefix=/app --libdir=/app/lib build install'
464 'sources': [{'type': 'dir', 'path': os.path.abspath('../asdcplib-cth')}]})
465 modules.append({'name': 'locked_sstream',
466 'buildsystem': 'simple',
468 './waf configure --prefix=/app build install'
470 'sources': [{'type': 'dir', 'path': os.path.abspath('../locked_sstream')}]})
471 modules.append({'name': 'libcxml',
472 'buildsystem': 'simple',
474 './waf configure --prefix=/app --libdir=/app/lib build install'
476 'sources': [{'type': 'dir', 'path': os.path.abspath('../libcxml')}]})
477 modules.append({'name': 'libdcp',
478 'buildsystem': 'simple',
480 './waf configure --prefix=/app --libdir=/app/lib build install'
482 'sources': [{'type': 'dir', 'path': os.path.abspath('../libdcp')}]})
483 modules.append({'name': 'libsub',
484 'buildsystem': 'simple',
486 './waf configure --prefix=/app --libdir=/app/lib build install'
488 'sources': [{'type': 'dir', 'path': os.path.abspath('../libsub')}]})
489 modules.append({'name': 'rtaudio',
497 'sources': [{'type': 'dir', 'path': os.path.abspath('../rtaudio-cdist')}]})
498 modules.append({'name': 'wxwidgets',
499 'sources': [{'type': 'archive',
500 'url': '%s/wxWidgets-3.0.3.tar.bz2' % prefix,
501 'sha256': '08c8033f48ec1b23520f036cde37b5ae925a6a65f137ded665633ca159b9307b'}]})
502 modules.append({'name': 'libssh',
503 'buildsystem': 'cmake',
505 'sources': [{'type': 'archive',
506 'url': '%s/libssh-0.7.5.tar.xz' % prefix,
507 'sha256': '54e86dd5dc20e5367e58f3caab337ce37675f863f80df85b6b1614966a337095'}]})
508 modules.append({'name': 'dcpomatic',
509 'buildsystem': 'simple',
511 './waf configure --prefix=/app build install'
514 'build-args': ['--share=network']
516 'sources': [{'type': 'dir', 'path': os.path.abspath('.')}]})
517 desc = {'app-id': 'com.dcpomatic.DCP-o-matic',
518 'runtime': 'org.gnome.Sdk',
519 'runtime-version': '3.26',
520 'sdk': 'org.gnome.Sdk',
521 'command': 'dcpomatic2',
522 'finish-args': ['--socket=x11', '--share=ipc', '--share=network', '--socket=pulseaudio', '--filesystem=host'],
524 os.makedirs('build/platform')
525 with open('build/com.dcpomatic.DCP-o-matic.json', 'w') as outfile:
526 json.dump(desc, outfile)
527 target.command('%s --repo=build/platform/repo build/platform/flatpak build/com.dcpomatic.DCP-o-matic.json' % target.flatpak_builder())
529 target.command('./waf configure --prefix=%s %s' % (target.directory, configure_options(target, options)))
530 target.command('./waf')
532 if target.platform == 'linux' or target.platform == 'osx':
533 target.command('./waf install')
535 def package_windows(target):
537 if target.version is not None:
538 identifier = '%s.' % target.version
539 identifier += '%d' % target.bits
540 shutil.copyfile('build/platform/windows/installer.%s.nsi' % identifier, 'build/platform/windows/installer2.%s.nsi' % identifier)
541 target.command('sed -i "s~%%resources%%~%s/platform/windows~g" build/platform/windows/installer2.%s.nsi' % (os.getcwd(), identifier))
542 target.command('sed -i "s~%%graphics%%~%s/graphics~g" build/platform/windows/installer2.%s.nsi' % (os.getcwd(), identifier))
543 target.command('sed -i "s~%%static_deps%%~%s~g" build/platform/windows/installer2.%s.nsi' % (target.windows_prefix, identifier))
544 target.command('sed -i "s~%%cdist_deps%%~%s~g" build/platform/windows/installer2.%s.nsi' % (target.directory, identifier))
545 target.command('sed -i "s~%%mingw%%~%s~g" build/platform/windows/installer2.%s.nsi' % (target.environment_prefix, identifier))
546 target.command('sed -i "s~%%binaries%%~%s/build~g" build/platform/windows/installer2.%s.nsi' % (os.getcwd(), identifier))
547 target.command('sed -i "s~%%bits%%~32~g" build/platform/windows/installer2.%s.nsi' % identifier)
548 target.command('makensis build/platform/windows/installer2.%s.nsi' % identifier)
549 return os.path.abspath(glob.glob('build/platform/windows/*%s*.exe' % target.bits)[0])
551 def package_debian(target, cpu, version, options):
552 make_control(target.version, target.bits, 'debian/control', target.debug, options['gui'])
553 target.command('./waf dist')
554 f = open('debian/files', 'w')
555 print('dcpomatic_%s-1_%s.deb video extra' % (version, cpu), file=f)
556 shutil.rmtree('build/deb', ignore_errors=True)
558 os.makedirs('build/deb')
559 os.chdir('build/deb')
560 shutil.move('../../dcpomatic-%s.tar.bz2' % version, 'dcpomatic_%s.orig.tar.bz2' % version)
561 target.command('tar xjf dcpomatic_%s.orig.tar.bz2' % version)
562 os.chdir('dcpomatic-%s' % version)
563 target.command('dch -b -v %s-1 "New upstream release."' % version)
564 target.set('CDIST_LINKFLAGS', target.get('LINKFLAGS'))
565 target.set('CDIST_CXXFLAGS', target.get('CXXFLAGS'))
566 target.set('CDIST_PKG_CONFIG_PATH', target.get('PKG_CONFIG_PATH'))
568 target.set('CDIST_CONFIGURE', '"' + configure_options(target, options) + '"')
570 target.set('CDIST_DEBUG_PACKAGE', '--dbg-package=dcpomatic-dbg')
571 if target.version in ['7', '14.04']:
572 target.set('CDIST_LOCALE_PREFIX', '/usr/local/share/locale')
574 target.set('CDIST_LOCALE_PREFIX', '/usr/share/locale')
576 target.command('dpkg-buildpackage -uc -us')
579 for p in glob.glob('../*.deb'):
580 debs.append(os.path.abspath(p))
584 def package_rpm(target, cpu, version, options):
585 topdir = os.path.realpath('build/rpmbuild')
586 os.makedirs('%s/BUILD' % topdir)
587 os.makedirs('%s/RPMS' % topdir)
588 os.makedirs('%s/SOURCES' % topdir)
589 os.makedirs('%s/SPECS' % topdir)
590 os.makedirs('%s/SRPMS' % topdir)
592 target.command('./waf dist')
594 "%s/src/dcpomatic/dcpomatic-%s.tar.bz2" % (target.directory, version),
595 "%s/SOURCES/dcpomatic-%s.tar.bz2" % (topdir, version)
599 if target.distro == 'mageia':
600 requires = "lib64xmlsec1-devel"
602 make_spec('build/platform/linux/dcpomatic2.spec', version, target, options, requires)
603 cmd = 'rpmbuild --define "_topdir %s" -bb build/platform/linux/dcpomatic2.spec' % topdir
612 for p in glob.glob('%s/RPMS/%s/*.rpm' % (topdir, cpu)):
613 rpms.append(os.path.abspath(p))
617 def make_appimage(target, nice_name, internal_name, version):
618 nice_filename = nice_name.replace(' ', '_')
619 os.makedirs('build/%s.AppDir/usr/bin' % nice_filename)
620 target.command('cp %s/bin/%s build/%s.AppDir/usr/bin' % (target.directory, internal_name, nice_filename))
621 with open('build/%s.AppDir/AppRun' % nice_filename, 'w') as f:
622 print('#!/bin/bash', file=f)
623 print('export APPDIR="$(dirname "$(readlink -f "$0")")"', file=f)
624 print('export PATH=$APPDIR/usr/bin:$PATH', file=f)
625 print('export XDG_DATA_DIRS="$APPDIR/usr/share/:/usr/share/:$XDG_DATA_DIRS"', file=f)
626 print('"$APPDIR"/usr/bin/%s $@' % internal_name, file=f)
627 target.command('chmod a+rx build/%s.AppDir/AppRun' % nice_filename)
628 with open('build/%s.AppDir/%s.desktop' % (nice_filename, internal_name), 'w') as f:
629 print('[Desktop Entry]', file=f)
630 print('Type=Application', file=f)
631 print('Categories=AudioVideo;', file=f)
632 print('Name=%s' % nice_name, file=f)
633 print('Icon=%s' % internal_name, file=f)
634 target.command('cp graphics/linux/256/%s.png build/%s.AppDir' % (internal_name, nice_filename))
635 target.command('linuxdeploy-x86_64.AppImage --appdir build/%s.AppDir' % nice_filename)
636 target.command('appimagetool-x86_64.AppImage build/%s.AppDir' % nice_filename)
637 target.command('mv %s-x86_64.AppImage build/%s-%s-x86_64.AppImage' % (nice_filename, nice_filename, version))
638 return os.path.abspath('build/%s-%s-x86_64.AppImage' % (nice_filename, version))
640 def package(target, version, options):
641 """version: DCP-o-matic version string"""
642 if target.platform == 'windows':
643 return package_windows(target)
644 elif target.platform == 'linux':
645 if target.detail == 'appimage':
647 out.append(make_appimage(target, 'DCP-o-matic', 'dcpomatic2', version))
648 out.append(make_appimage(target, 'DCP-o-matic Player', 'dcpomatic2_player', version))
649 out.append(make_appimage(target, 'DCP-o-matic Playlist Editor', 'dcpomatic2_playlist', version))
650 out.append(make_appimage(target, 'DCP-o-matic KDM Creator', 'dcpomatic2_kdm', version))
651 out.append(make_appimage(target, 'DCP-o-matic Batch Converter', 'dcpomatic2_batch', version))
652 out.append(make_appimage(target, 'DCP-o-matic Encode Server', 'dcpomatic2_server', version))
655 if target.bits == 32:
660 if target.distro == 'debian' or target.distro == 'ubuntu':
661 return package_debian(target, cpu, version, options)
662 elif target.distro == 'centos' or target.distro == 'fedora' or target.distro == 'mageia':
663 return package_rpm(target, cpu, version, options)
664 elif target.platform == 'osx' and target.bits is None:
665 target.command('bash platform/osx/make_dmg.sh %s %s universal %s %s' % (target.environment_prefix, target.directory, target.apple_id, target.apple_password))
666 return [os.path.abspath(x) for x in glob.glob('build/platform/osx/DCP-o-matic*.dmg')]
667 elif target.platform == 'osx' and target.bits == 64:
668 target.command('bash platform/osx/make_dmg.sh %s %s thin %s %s' % (target.environment_prefix, target.directory, target.apple_id, target.apple_password))
669 return [os.path.abspath(x) for x in glob.glob('build/platform/osx/DCP-o-matic*.dmg')]
670 elif target.platform == 'docker':
671 shutil.copyfile(target.deb, 'build/platform/docker')
672 f = open('build/platform/docker/Dockerfile', 'w')
673 print('FROM debian:jessie', file=f)
674 print('MAINTAINER carl@dcpomatic.com', file=f)
675 print('ADD build/platform/docker/dcpomatic_%s-1_amd64.deb /tmp' % (version, version), file=f)
676 print('RUN apt-get -o Acquire:http::Timeout="5" update; exit 0', file=f)
677 print('RUN dpkg -i /tmp/dcpomatic_*.deb; exit 0', file=f)
678 print('RUN apt-get -y -f install', file=f)
679 print('RUN apt-get clean', file=f)
680 print('EXPOSE 6192', file=f)
681 print('CMD ["/usr/bin/dcpomatic2_server_cli", "--verbose"]', file=f)
683 target.command('docker build build/platform/docker -t dcpomatic-server:%s' % version)
684 target.command('docker save dcpomatic-server:%s -o dcpomatic-server-%s-docker.tar' % (version, version))
685 elif target.platform == 'flatpak':
686 target.command('%s build-bundle build/platform/repo build/dcpomatic_%s.flatpak com.dcpomatic.DCP-o-matic' % (target.flatpak(), version))
687 return os.path.abspath('build/dcpomatic_%s.flatpak' % version)
689 def make_pot(target):
690 target.command('./waf pot')
691 return [os.path.abspath('build/src/lib/libdcpomatic.pot'),
692 os.path.abspath('build/src/wx/libdcpomatic-wx.pot'),
693 os.path.abspath('build/src/tools/dcpomatic.pot')]
695 def make_manual(target):
696 os.chdir('doc/manual')
697 target.command('make')
698 target.command('pdflatex colour.tex')
699 return [os.path.abspath('pdf'), os.path.abspath('html'), os.path.abspath('colour.pdf')]
701 def test(target, test):
702 if target.platform != 'windows':
703 target.set('LC_ALL', 'C')
706 cmd += '--backtrace '
708 cmd += '--run_test=%s' % test