-
Notifications
You must be signed in to change notification settings - Fork 46
/
Rakefile
623 lines (524 loc) · 23.6 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
#!/usr/bin/env rake
# -*- mode: ruby; -*-
# Change to base directory before doing anything
if FileUtils.pwd != File.dirname(__FILE__)
new_dir = File.absolute_path(File.dirname(__FILE__))
puts "Entering directory `#{new_dir}'"
Dir.chdir new_dir
end
# Set number of threads to use if it is unset and we're running with
# drake
if Rake.application.options.respond_to?(:threads) && [nil, 0, 1].include?(Rake.application.options.threads) && !ENV['DRAKETHREADS'].nil?
Rake.application.options.threads = ENV['DRAKETHREADS'].to_i
end
# Ruby 1.9.x introduce "require_relative" for local requires. 1.9.2
# removes "." from $: and forces us to use "require_relative". 1.8.x
# does not know "require_relative" yet though.
begin
require_relative()
rescue NoMethodError
def require_relative *args
require *args
end
rescue Exception
end
require "pp"
require_relative "rake.d/extensions"
require_relative "rake.d/config"
require_relative "rake.d/helpers"
require_relative "rake.d/target"
require_relative "rake.d/application"
require_relative "rake.d/library"
def setup_globals
$programs = %w{mkvmerge mkvinfo mkvextract mkvpropedit}
$programs << "mmg" if c?(:USE_WXWIDGETS)
$tools = %w{base64tool diracparser ebml_validator vc1parser}
$mmg_bin = c(:MMG_BIN)
$mmg_bin = "mmg" if $mmg_bin.empty?
$application_subdirs = { "mmg" => "mmg/" }
$applications = $programs.collect { |name| "src/#{$application_subdirs[name]}#{name}" + c(:EXEEXT) }
$manpages = $programs.collect { |name| "doc/man/#{name}.1" }
$system_includes = "-I. -Ilib -Ilib/avilib-0.6.10 -Ilib/utf8-cpp/source -Isrc"
$system_libdirs = "-Llib/avilib-0.6.10 -Llib/librmff -Lsrc/common -Lsrc/input -Lsrc/output -Lsrc/mpegparser"
$source_directories = %w{lib/avilib-0.6.10 lib/librmff src src/input src/output src/common src/common/chapters src/common/strings src/common/tags src/common/xml
src/mmg src/mmg/header_editor src/mmg/options src/mmg/tabs src/extract src/propedit src/merge src/info src/mpegparser}
$all_sources = $source_directories.collect { |dir| FileList[ "#{dir}/*.c", "#{dir}/*.cpp" ].to_a }.flatten.sort
$all_headers = $source_directories.collect { |dir| FileList[ "#{dir}/*.h", ].to_a }.flatten.sort
$all_objects = $all_sources.collect { |file| file.ext('o') }
$top_srcdir = c(:top_srcdir)
$dependency_dir = "#{$top_srcdir}/rake.d/dependecy.d"
$languages = {
:applications => c(:TRANSLATIONS).split(/\s+/),
:manpages => c(:MANPAGES_TRANSLATIONS).split(/\s+/),
:guides => c(:GUIDE_TRANSLATIONS).split(/\s+/),
}
$translations = {
:applications => $languages[:applications].collect { |language| "po/#{language}.mo" },
:guides => $languages[:guides].collect { |language| "doc/guide/#{language}/mkvmerge-gui.hhk" },
:manpages => !c?(:PO4A_WORKS) ? [] : $languages[:manpages].collect { |language| $manpages.collect { |manpage| manpage.gsub(/man\//, "man/#{language}/") } }.flatten,
}
$available_languages = {
:applications => FileList[ "#{$top_srcdir }/po/*.po" ].collect { |name| File.basename name, '.po' },
:manpages => FileList[ "#{$top_srcdir }/doc/man/po4a/po/*.po" ].collect { |name| File.basename name, '.po' },
:guides => FileList[ "#{$top_srcdir }/doc/guide/*/mkvmerge-gui.html" ].collect { |name| File.basename File.dirname(name) },
}
$build_tools ||= c?(:TOOLS)
cflags_common = "-Wall -Wno-comment #{c(:OPTIMIZATION_CFLAGS)} -D_FILE_OFFSET_BITS=64 #{c(:MATROSKA_CFLAGS)} #{c(:EBML_CFLAGS)} #{c(:EXTRA_CFLAGS)} #{c(:DEBUG_CFLAGS)} #{c(:PROFILING_CFLAGS)} #{c(:USER_CPPFLAGS)} -DPACKAGE=\\\"#{c(:PACKAGE)}\\\" -DVERSION=\\\"#{c(:VERSION)}\\\" -DMTX_LOCALE_DIR=\\\"#{c(:localedir)}\\\" -DMTX_PKG_DATA_DIR=\\\"#{c(:pkgdatadir)}\\\" -DMTX_DOC_DIR=\\\"#{c(:docdir)}\\\""
ldflags_extra = c?(:MINGW) ? '' : "-Wl,--enable-auto-import"
$flags = {
:cflags => "#{cflags_common} #{c(:USER_CFLAGS)}",
:cxxflags => "#{cflags_common} #{c(:STD_CXX0X)} -Wnon-virtual-dtor -Woverloaded-virtual -Wextra #{c(:WXWIDGETS_CFLAGS)} #{c(:QT_CFLAGS)} #{c(:BOOST_CPPFLAGS)} #{c(:CURL_CFLAGS)} #{c(:USER_CXXFLAGS)}",
:cppflags => "#{c(:USER_CPPFLAGS)}",
:ldflags => "#{c(:EBML_LDFLAGS)} #{c(:MATROSKA_LDFLAGS)} #{c(:EXTRA_LDFLAGS)} #{c(:PROFILING_LIBS)} #{c(:USER_LDFLAGS)} #{c(:LDFLAGS_RPATHS)} #{c(:BOOST_LDFLAGS)}",
:windres => c?(:USE_WXWIDGETS) ? c(:WXWIDGETS_INCLUDES) : '-DNOWXWIDGETS',
}
end
def define_default_task
desc "Build everything"
# The applications themselves
targets = $applications.clone
# Build the stuff in the 'src/tools' directory only if requested
targets << "apps:tools" if $build_tools
# The tags file -- but only if it exists already
targets << "TAGS" if File.exist?("TAGS") && !c(:ETAGS).empty?
# Build developer documentation?
targets << "doc/development.html" if !c(:PANDOC).empty?
# Build man pages and translations?
targets += [ "manpages", "translations:manpages" ] if c?(:XSLTPROC_WORKS)
# Build translations for the programs
targets << "translations:applications"
# The GUI help
targets << "translations:guides" if c?(:USE_WXWIDGETS)
task :default => targets do
puts "Done. Enjoy :)"
end
end
# main
read_config
setup_globals
import_dependencies
# Default task
define_default_task
desc "Build all applications"
task :apps => $applications
desc "Build all command line applications"
namespace :apps do
task :cli => %w{apps:mkvmerge apps:mkvinfo apps:mkvextract apps:mkvpropedit}
end
# Store compiler block for re-use
cxx_compiler = lambda do |t|
# t.sources is empty for a 'file' task (common_pch.h.o).
sources = t.sources.empty? ? [ t.prerequisites.first ] : t.sources
runq " CXX #{sources.first}", "#{c(:CXX)} #{$flags[:cxxflags]} #{$system_includes} -c -MMD -o #{t.name} #{sources.join(" ")}", :allow_failure => true
handle_deps t.name, last_exit_code
end
# Precompiled headers
if c?(:USE_PRECOMPILED_HEADERS)
$all_objects.each { |name| file name => "src/common/common.h.gch" }
file "src/common/common.h.gch" => "src/common/common.h", &cxx_compiler
end
# Pattern rules
rule '.o' => '.cpp', &cxx_compiler
rule '.o' => '.c' do |t|
runq " CC #{t.source}", "#{c(:CC)} #{$flags[:cflags]} #{$system_includes} -c -MMD -o #{t.name} #{t.sources.join(" ")}", :allow_failure => true
handle_deps t.name, last_exit_code
end
rule '.o' => '.rc' do |t|
runq " WINDRES #{t.source}", "#{c(:WINDRES)} #{$flags[:windres]} -Isrc/mmg -o #{t.name} #{t.sources.join(" ")}"
end
# Resources depend on the manifest.xml file for Windows builds.
if c?(:MINGW)
$programs.each do |program|
path = program.gsub(/^mkv/, '')
file "src/#{path}/resources.o" => "src/#{path}/manifest.xml"
end
end
rule '.mo' => '.po' do |t|
runq " MSGFMT #{t.source}", "msgfmt -c -o #{t.name} #{t.sources.join(" ")}"
end
# HTML help book stuff
rule '.hhk' => '.hhc' do |t|
runq " GREP #{t.source}", "#{c(:GREP)} -v 'name=\"ID\"' #{t.sources.join(" ")} > #{t.name}"
end
# man pages from DocBook XML
if c?(:XSLTPROC_WORKS)
rule '.1' => '.xml' do |t|
runq "XSLTPROC #{t.source}", "#{c(:XSLTPROC)} #{c(:XSLTPROC_FLAGS)} -o #{t.name} #{c(:DOCBOOK_MANPAGES_STYLESHEET)} #{t.sources.join(" ")}"
end
$manpages.each do |manpage|
file manpage => manpage.ext('xml')
$available_languages[:manpages].each do |language|
localized_manpage = manpage.gsub(/.*\//, "doc/man/#{language}/")
file localized_manpage => localized_manpage.ext('xml')
end
end
end
# Qt files
rule '.h' => '.ui' do |t|
runq " UIC #{t.source}", "#{c(:UIC)} #{t.sources.join(" ")} > #{t.name}"
end
# Rake does not support rules like '.moc.cpp' => '.h'. Therefore
# Target creats 'file' entries for all .moc.cpp entries submitted via
# Target#sources.
$moc_compiler = lambda do |t|
runq " MOC #{t.prerequisites.first}", "#{c(:MOC)} #{c(:QT_CFLAGS)} #{t.prerequisites.join(" ")} > #{t.name}"
end
# Tag files
desc "Create tags file for Emacs"
task :tags => "TAGS"
file "TAGS" => $all_sources do |t|
runq ' ETAGS', "#{c(:ETAGS)} -o #{t.name} #{t.prerequisites.join(" ")}"
end
file "doc/development.html" => [ "doc/development.md", "doc/pandoc-template.html" ] do |t|
runq " PANDOC #{t.prerequisites.first}", "#{c(:PANDOC)} -o #{t.name} --standalone --from markdown --to html --strict --number-sections --table-of-contents " +
"--css=pandoc.css --template=doc/pandoc-template.html doc/development.md"
end
file "po/mkvtoolnix.pot" => $all_sources + $all_headers + %w{Rakefile} do |t|
sources = t.prerequisites.dup - %w{Rakefile}
runq "XGETTEXT #{t.name}", <<-COMMAND
xgettext --keyword=YT --keyword=Y --keyword=Z --keyword=TIP --keyword=NY:1,2 --keyword=NZ:1,2 --default-domain=mkvtoolnix --from-code=UTF-8 -s --omit-header --boost -o #{t.name} #{sources.join(" ")}
COMMAND
end
task :manpages => $manpages
# Translations for the programs
namespace :translations do
desc "Create a template for translating the programs"
task :pot => "po/mkvtoolnix.pot"
desc "Create a new .po file with an empty template"
task "new-po" => "po/mkvtoolnix.pot" do
%w{LANGUAGE EMAIL}.each { |e| fail "Variable '#{e}' is not set" if ENV[e].blank? }
require 'rexml/document'
node = REXML::XPath.first REXML::Document.new(File.new("/usr/share/xml/iso-codes/iso_639.xml")), "//iso_639_entry[@name='#{ENV['LANGUAGE']}']"
locale = node ? node.attributes['iso_639_1_code'] : nil
fail "Unknown language/ISO-639-1 code not found" if locale.blank?
puts " CREATE po/#{locale}.po"
File.open "po/#{locale}.po", "w" do |out|
now = Time.now
out.puts <<EOT
# translation of mkvtoolnix.pot to #{ENV['LANGUAGE']}
# Copyright (C) #{now.year} Moritz Bunkus
# This file is distributed under the same license as the mkvtoolnix package.
#
msgid ""
msgstr ""
"Project-Id-Version: #{locale}\\n"
"Report-Msgid-Bugs-To: Moritz Bunkus <[email protected]>\\n"
"POT-Creation-Date: #{now.strftime('%Y-%m-%d %H:%M%z')}\\n"
"PO-Revision-Date: #{now.strftime('%Y-%m-%d %H:%M%z')}\\n"
"Last-Translator: YOUR NAME <#{ENV['EMAIL']}>\\n"
"Language-Team: #{ENV['LANGUAGE']} <[email protected]>\\n"
"Language: #{locale}\\n"
"MIME-Version: 1.0\\n"
EOT
out.puts IO.readlines("po/mkvtoolnix.pot")
end
end
desc "Verify format strings in translations"
task "verify-format-strings" do
files = $available_languages[:applications].collect { |language| "po/#{language}.po" }.join(' ')
runq 'VERIFY', <<-COMMAND
./src/scripts/verify_format_srings_in_translations.rb #{files}
COMMAND
end
[ :applications, :manpages, :guides ].each { |type| task type => $translations[type] }
$available_languages[:manpages].each do |language|
$manpages.each do |manpage|
name = manpage.gsub(/man\//, "man/#{language}/")
file name => [ name.ext('xml'), "doc/man/po4a/po/#{language}.po" ]
file name.ext('xml') => [ manpage.ext('.xml'), "doc/man/po4a/po/#{language}.po" ] do |t|
runq " PO4A #{manpage.ext('.xml')} (#{language})", "#{c(:PO4A_TRANSLATE)} #{c(:PO4A_TRANSLATE_FLAGS)} -m #{manpage.ext('.xml')} -p doc/man/po4a/po/#{language}.po -l #{t.name}"
end
end
end
desc "Update all translation files"
task :update => [ "translations:update:applications", "translations:update:manpages" ]
namespace :update do
desc "Update the program's translation files"
task :applications => [ "po/mkvtoolnix.pot", ] + $available_languages[:applications].collect { |language| "translations:update:applications:#{language}" }
namespace :applications do
$available_languages[:applications].each do |language|
task language => "po/mkvtoolnix.pot" do |t|
po = "po/#{language}.po"
tmp_file = "#{po}.new"
runq "MSGMERGE #{po}", "msgmerge -q -s --no-wrap #{po} po/mkvtoolnix.pot > #{tmp_file}", :allow_failure => true
exit_code = last_exit_code
if 0 != exit_code
File.unlink tmp_file
exit exit_code
end
adjust_to_poedit_style tmp_file, po
end
end
end
desc "Update the man pages' translation files"
task :manpages do
runq " PO4A doc/man/po4a/po4a.cfg", "#{c(:PO4A)} #{c(:PO4A_FLAGS)} --msgmerge-opt=--no-wrap doc/man/po4a/po4a.cfg"
%w{nl zh_CN}.each do |language|
name = "doc/man/po4a/po/#{language}.po"
FileUtils.cp name, "#{name}.tmp"
adjust_to_poedit_style "#{name}.tmp", name
end
end
end
[ :stats, :statistics ].each_with_index do |name, idx|
desc "Generate statistics about translation coverage" if 0 == idx
task name do
FileList["po/*.po", "doc/man/po4a/po/*.po"].each do |name|
command = "msgfmt --statistics -o /dev/null #{name} 2>&1"
if ENV["V"].to_bool
runq " MSGFMT #{name}", command, :allow_failure => true
else
puts "#{name} : " + `#{command}`.split(/\n/).first
end
end
end
end
end
# HTMLO generation for the man pages
targets = ([ 'en' ] + $languages[:manpages]).collect do |language|
dir = language == 'en' ? '' : "/#{language}"
FileList[ "doc/man#{dir}/*.xml" ].collect { |name| "man2html:#{language}:#{File.basename(name, '.xml')}" }
end.flatten
%w{manpages-html man2html}.each_with_index do |task_name, idx|
desc "Create HTML files for the man pages" if 0 == idx
task task_name => targets
end
namespace :man2html do
([ 'en' ] + $languages[:manpages]).collect do |language|
namespace language do
dir = language == 'en' ? '' : "/#{language}"
FileList[ "doc/man#{dir}/*.xml" ].each do |name|
task File.basename(name, '.xml') => %w{manpages translations:manpages} do
runq "XSLTPROC #{name}", "xsltproc --nonet -o #{name.ext('html')} /usr/share/xml/docbook/stylesheet/nwalsh/html/docbook.xsl #{name}"
end
end
end
end
end
# Installation tasks
desc "Install all applications and support files"
targets = [ "install:programs", "install:manpages", "install:translations:manpages", "install:translations:applications" ]
targets += [ "install:translations:guides", "install:shared" ] if c?(:USE_WXWIDGETS)
task :install => targets
namespace :install do
application_name_mapper = lambda do |name|
base = File.basename name
base == "mmg" ? $mmg_bin : base
end
task :programs => $applications do
install_dir :bindir
$applications.each { |application| install_program "#{c(:bindir)}/#{application_name_mapper[application]}", application }
end
task :shared do
install_dir :desktopdir, :mimepackagesdir
install_data :desktopdir, FileList[ "#{$top_srcdir}/share/desktop/*.desktop" ]
install_data :mimepackagesdir, FileList[ "#{$top_srcdir}/share/mime/*.xml" ]
FileList[ "#{$top_srcdir}/share/icons/*" ].collect { |dir| File.basename dir }.select { |dir| dir != "windows" }.each do |dir|
install_dir "#{c(:icondir)}/#{dir}/apps"
install_data "#{c(:icondir)}/#{dir}/apps/", FileList[ "#{$top_srcdir}/share/icons/#{dir}/*.png" ]
end
end
man_page_name_mapper = lambda do |name|
base = File.basename name
base == "mmg.1" ? "#{$mmg_bin}.1" : base
end
task :manpages => $manpages do
install_dir :man1dir
$manpages.each { |manpage| install_data "#{c(:man1dir)}/#{man_page_name_mapper[manpage]}", manpage }
end
namespace :translations do
task :applications do
install_dir $languages[:applications].collect { |language| "#{c(:localedir)}/#{language}/LC_MESSAGES" }
$languages[:applications].each do |language|
install_data "#{c(:localedir)}/#{language}/LC_MESSAGES/mkvtoolnix.mo", "po/#{language}.mo"
end
end
task :manpages do
install_dir $languages[:manpages].collect { |language| "#{c(:mandir)}/#{language}/man1" }
$languages[:manpages].each do |language|
$manpages.each { |manpage| install_data "#{c(:mandir)}/#{language}/man1/#{man_page_name_mapper[manpage]}", manpage.sub(/man\//, "man/#{language}/") }
end
end
task :guides do
install_dir :docdir, $languages[:guides].collect { |language| "#{c(:docdir)}/guide/#{language}/images" }
$languages[:guides].each do |language|
install_data "#{c(:docdir)}/guide/#{language}/", FileList[ "#{$top_srcdir}/doc/guide/#{language}/mkvmerge-gui.*" ]
install_data "#{c(:docdir)}/guide/#{language}/images/", FileList[ "#{$top_srcdir}/doc/guide/#{language}/images/*.gif" ]
end
end
end
end
# Cleaning tasks
desc "Remove all compiled files"
task :clean do
tools = $tools.collect { |name| "src/tools/#{name}" }.join " "
run <<-SHELL, :allow_failure => true
rm -f *.o */*.o */*/*.o */lib*.a */*/lib*.a */*/*.gch po/*.mo
*/*.exe */*/*.exe */*/*.dll */*/*.dll.a doc/guide/*/*.hhk
src/info/ui/*.h src/info/*.moc.cpp src/common/*/*.o
src/mmg/*/*.o #{$applications.join(" ")} #{tools}
lib/libebml/src/*.o lib/libmatroska/src/*.o
lib/libebml/src/lib*.a lib/libmatroska/src/lib*.a
SHELL
end
namespace :clean do
desc "Remove all compiled and generated files ('tarball' clean)"
task :dist => :clean do
run "rm -f config.h config.log config.cache build-config Makefile */Makefile */*/Makefile TAGS", :allow_failure => true
run "rm -rf #{$dependency_dir}", :allow_failure => true
end
desc "Remove all compiled and generated files ('git' clean)"
task :maintainer => "clean:dist" do
run "rm -f configure config.h.in", :allow_failure => true
end
desc "Remove all compiled libraries"
task :libs do
run "rm -f */lib*.a */*/lib*.a */*/*.dll */*/*.dll.a", :allow_failure => true
end
[:apps, :applications, :exe].each_with_index do |name, idx|
desc "Remove all compiled applications" if 0 == idx
task name do
run "rm -f #{$applications.join(" ")} */*.exe */*/*.exe", :allow_failure => true
end
end
%w{manpages-html man2html}.each do |name|
task name do
run "rm -f doc/man/*.html doc/man/*/*.html"
end
end
end
#
# avilib-0.6.10
# librmff
# spyder's MPEG parser
# src/common
# src/input
# src/output
#
[ { :name => 'avi', :dir => 'lib/avilib-0.6.10' },
{ :name => 'rmff', :dir => 'lib/librmff' },
{ :name => 'mpegparser', :dir => 'src/mpegparser' },
{ :name => 'mtxcommon', :dir => [ 'src/common', 'src/common/chapters', 'src/common/strings', 'src/common/tags', 'src/common/xml' ] },
{ :name => 'mtxinput', :dir => 'src/input' },
{ :name => 'mtxoutput', :dir => 'src/output' },
{ :name => 'ebml', :dir => 'lib/libebml/src' },
{ :name => 'matroska', :dir => 'lib/libmatroska/src' },
].each do |lib|
Library.
new("#{[ lib[:dir] ].flatten.first}/lib#{lib[:name]}").
sources([ lib[:dir] ].flatten, :type => :dir).
build_dll(lib[:name] == 'mtxcommon').
libraries(:iconv, :z, :compression, :matroska, :ebml, :expat, :rpcrt4).
create
end
#
# mkvmerge
#
Application.new("src/mkvmerge").
description("Build the mkvmerge executable").
aliases(:mkvmerge).
sources("src/merge", :type => :dir).
sources("src/merge/resources.o", :if => c?(:MINGW)).
libraries(:mtxinput, :mtxoutput, :mtxcommon, :magic, :matroska, :ebml, :avi, :rmff, :mpegparser, :flac, :vorbis, :ogg, :z, :compression, :expat, :iconv, :intl, :curl,
:boost_regex, :boost_filesystem, :boost_system).
create
#
# mkvinfo
#
$mkvinfo_ui_files = FileList["src/info/ui/*.ui"].to_a
file "src/info/qt_ui.o" => $mkvinfo_ui_files.collect { |file| file.ext('h') }
Application.new("src/mkvinfo").
description("Build the mkvinfo executable").
aliases(:mkvinfo).
sources(FileList["src/info/*.cpp"].exclude("src/info/qt_ui.cpp", "src/info/wxwidgets_ui.cpp")).
sources("src/info/resources.o", :if => c?(:MINGW)).
libraries(:mtxcommon, :magic, :matroska, :ebml, :expat, :intl, :iconv, :curl, :boost_regex, :boost_filesystem, :boost_system).
only_if(c?(:USE_QT)).
sources("src/info/qt_ui.cpp", "src/info/qt_ui.moc.cpp", "src/info/rightclick_tree_widget.moc.cpp", $mkvinfo_ui_files).
libraries(:qt).
end_if.
only_if(!c?(:USE_QT) && c?(:USE_WXWIDGETS)).
sources("src/info/wxwidgets_ui.cpp").
libraries(:wxwidgets).
end_if.
create
#
# mkvextract
#
Application.new("src/mkvextract").
description("Build the mkvextract executable").
aliases(:mkvextract).
sources("src/extract", :type => :dir).
sources("src/extract/resources.o", :if => c?(:MINGW)).
libraries(:mtxcommon, :magic, :matroska, :ebml, :avi, :rmff, :vorbis, :ogg, :z, :compression, :expat, :iconv, :intl, :curl,
:boost_regex, :boost_filesystem, :boost_system).
create
#
# mkvpropedit
#
Application.new("src/mkvpropedit").
description("Build the mkvpropedit executable").
aliases(:mkvpropedit).
sources("src/propedit", :type => :dir).
sources("src/propedit/resources.o", :if => c?(:MINGW)).
libraries(:mtxcommon, :magic, :matroska, :ebml, :avi, :rmff, :vorbis, :ogg, :z, :compression, :expat, :iconv, :intl, :curl,
:boost_regex, :boost_filesystem, :boost_system).
create
#
# mmg
#
if c?(:USE_WXWIDGETS)
Application.new("src/mmg/mmg").
description("Build the mmg executable").
aliases(:mmg).
sources("src/mmg", "src/mmg/header_editor", "src/mmg/options", "src/mmg/tabs", :type => :dir).
sources("src/mmg/resources.o", :if => c?(:MINGW)).
libraries(:mtxcommon, :magic, :matroska, :ebml, :avi, :rmff, :vorbis, :ogg, :z, :compression, :expat, :iconv, :intl, :wxwidgets, :curl,
:boost_regex, :boost_filesystem, :boost_system).
libraries(:ole32, :shell32, "-mwindows", :if => c?(:MINGW)).
create
end
#
# Applications in src/tools
#
if $build_tools
namespace :apps do
task :tools => $tools.collect { |name| "apps:tools:#{name}" }
end
#
# tools: base64tool
#
Application.new("src/tools/base64tool").
description("Build the base64tool executable").
aliases("tools:base64tool").
sources("src/tools/base64tool.cpp").
libraries(:mtxcommon, :magic, :matroska, :ebml, :expat, :iconv, :intl, :boost_regex, :curl).
create
#
# tools: diracparser
#
Application.new("src/tools/diracparser").
description("Build the diracparser executable").
aliases("tools:diracparser").
sources("src/tools/diracparser.cpp").
libraries(:mtxcommon, :magic, :matroska, :ebml, :expat, :iconv, :intl, :boost_regex, :curl).
create
#
# tools: ebml_validator
#
Application.new("src/tools/ebml_validator").
description("Build the ebml_validator executable").
aliases("tools:ebml_validator").
sources("src/tools/ebml_validator.cpp", "src/tools/element_info.cpp").
libraries(:mtxcommon, :magic, :matroska, :ebml, :expat, :iconv, :intl, :boost_regex, :curl).
create
#
# tools: vc1parser
#
Application.new("src/tools/vc1parser").
description("Build the vc1parser executable").
aliases("tools:vc1parser").
sources("src/tools/vc1parser.cpp").
libraries(:mtxcommon, :magic, :matroska, :ebml, :expat, :iconv, :intl, :boost_regex, :curl).
create
end