2012-04-25 21:47:51 +00:00
|
|
|
#!/usr/bin/env ruby
|
2010-07-25 19:41:08 +00:00
|
|
|
|
2010-07-27 19:31:39 +00:00
|
|
|
# Change to base directory before doing anything
|
2010-08-05 20:18:29 +00:00
|
|
|
if FileUtils.pwd != File.dirname(__FILE__)
|
|
|
|
new_dir = File.absolute_path(File.dirname(__FILE__))
|
|
|
|
puts "Entering directory `#{new_dir}'"
|
|
|
|
Dir.chdir new_dir
|
|
|
|
end
|
2010-07-27 19:00:50 +00:00
|
|
|
|
2010-07-27 19:31:39 +00:00
|
|
|
# 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
|
|
|
|
|
2010-09-04 15:14:50 +00:00
|
|
|
# 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.
|
2010-10-28 07:09:32 +00:00
|
|
|
begin
|
|
|
|
require_relative()
|
|
|
|
rescue NoMethodError
|
|
|
|
def require_relative *args
|
|
|
|
require *args
|
|
|
|
end
|
|
|
|
rescue Exception
|
2010-09-04 15:14:50 +00:00
|
|
|
end
|
|
|
|
|
2010-07-25 19:41:08 +00:00
|
|
|
require "pp"
|
|
|
|
|
2012-08-13 06:46:37 +00:00
|
|
|
# Extensions have to be loaded before certain functions that don't
|
|
|
|
# exist in Ruby 1.8.x are used, e.g. Dir.exists?
|
|
|
|
require_relative "rake.d/extensions"
|
2013-12-25 12:00:28 +00:00
|
|
|
require_relative "rake.d/config"
|
|
|
|
|
|
|
|
read_config
|
2012-08-13 06:46:37 +00:00
|
|
|
|
2012-08-07 20:48:28 +00:00
|
|
|
$build_system_modules = {}
|
2013-12-25 12:00:28 +00:00
|
|
|
$have_gtest = (c(:GTEST_TYPE) == "system") || (c(:GTEST_TYPE) == "internal")
|
2013-07-04 19:04:29 +00:00
|
|
|
$gtest_apps = []
|
2012-08-07 20:48:28 +00:00
|
|
|
|
2010-09-04 15:14:50 +00:00
|
|
|
require_relative "rake.d/helpers"
|
|
|
|
require_relative "rake.d/target"
|
|
|
|
require_relative "rake.d/application"
|
|
|
|
require_relative "rake.d/library"
|
2012-08-07 20:48:28 +00:00
|
|
|
require_relative 'rake.d/gtest' if $have_gtest
|
2010-07-25 19:41:08 +00:00
|
|
|
|
2010-07-26 10:29:18 +00:00
|
|
|
def setup_globals
|
2012-04-16 11:55:09 +00:00
|
|
|
$build_mkvtoolnix_gui ||= c?(:USE_QT) && c?(:BUILD_MKVTOOLNIX_GUI)
|
|
|
|
|
2010-07-27 17:27:06 +00:00
|
|
|
$programs = %w{mkvmerge mkvinfo mkvextract mkvpropedit}
|
|
|
|
$programs << "mmg" if c?(:USE_WXWIDGETS)
|
2012-04-16 11:55:09 +00:00
|
|
|
$programs << "mkvtoolnix-gui" if $build_mkvtoolnix_gui
|
2012-02-25 18:23:02 +00:00
|
|
|
$tools = %w{ac3parser base64tool diracparser ebml_validator vc1parser}
|
2010-08-01 18:04:47 +00:00
|
|
|
$mmg_bin = c(:MMG_BIN)
|
|
|
|
$mmg_bin = "mmg" if $mmg_bin.empty?
|
2010-07-27 17:27:06 +00:00
|
|
|
|
2012-04-16 11:55:09 +00:00
|
|
|
$application_subdirs = { "mmg" => "mmg/", "mkvtoolnix-gui" => "mkvtoolnix-gui/" }
|
2010-07-27 17:27:06 +00:00
|
|
|
$applications = $programs.collect { |name| "src/#{$application_subdirs[name]}#{name}" + c(:EXEEXT) }
|
|
|
|
$manpages = $programs.collect { |name| "doc/man/#{name}.1" }
|
|
|
|
|
2012-03-17 00:10:46 +00:00
|
|
|
$system_includes = "-I. -Ilib -Ilib/avilib-0.6.10 -Ilib/utf8-cpp/source -Ilib/pugixml/src -Isrc"
|
2012-08-15 07:16:52 +00:00
|
|
|
$system_libdirs = "-Llib/avilib-0.6.10 -Llib/librmff -Llib/pugixml/src -Lsrc/common"
|
2010-07-27 17:27:06 +00:00
|
|
|
|
2012-03-23 17:02:48 +00:00
|
|
|
$source_directories = %w{lib/avilib-0.6.10 lib/librmff src src/input src/output src/common src/common/chapters src/common/compression src/common/strings src/common/tags src/common/xml
|
2010-07-27 17:27:06 +00:00
|
|
|
src/mmg src/mmg/header_editor src/mmg/options src/mmg/tabs src/extract src/propedit src/merge src/info src/mpegparser}
|
2011-10-12 19:53:35 +00:00
|
|
|
$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
|
2010-07-27 17:27:06 +00:00
|
|
|
$all_objects = $all_sources.collect { |file| file.ext('o') }
|
|
|
|
|
|
|
|
$top_srcdir = c(:top_srcdir)
|
2012-03-18 09:55:42 +00:00
|
|
|
$dependency_dir = "#{$top_srcdir}/rake.d/dependency.d"
|
|
|
|
$dependency_tmp_dir = "#{$dependency_dir}/tmp"
|
2010-07-27 17:27:06 +00:00
|
|
|
|
|
|
|
$languages = {
|
|
|
|
:applications => c(:TRANSLATIONS).split(/\s+/),
|
|
|
|
:manpages => c(:MANPAGES_TRANSLATIONS).split(/\s+/),
|
|
|
|
:guides => c(:GUIDE_TRANSLATIONS).split(/\s+/),
|
|
|
|
}
|
|
|
|
|
|
|
|
$translations = {
|
2010-07-27 18:49:35 +00:00
|
|
|
: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,
|
2010-07-27 17:27:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$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) },
|
|
|
|
}
|
2010-07-27 19:49:51 +00:00
|
|
|
|
|
|
|
$build_tools ||= c?(:TOOLS)
|
2010-08-01 10:53:34 +00:00
|
|
|
|
2013-10-26 10:12:24 +00:00
|
|
|
cflags_common = "-Wall -Wno-comment -Wfatal-errors #{c(:WLOGICAL_OP)} #{c(:WNO_MISMATCHED_TAGS)} #{c(:WNO_SELF_ASSIGN)} #{c(:QUNUSED_ARGUMENTS)}"
|
2013-11-27 21:00:00 +00:00
|
|
|
cflags_common += " #{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)}"
|
|
|
|
cflags_common += " -DPACKAGE=\\\"#{c(:PACKAGE)}\\\" -DVERSION=\\\"#{c(:VERSION)}\\\" -DMTX_LOCALE_DIR=\\\"#{c(:localedir)}\\\" -DMTX_PKG_DATA_DIR=\\\"#{c(:pkgdatadir)}\\\" -DMTX_DOC_DIR=\\\"#{c(:docdir)}\\\""
|
|
|
|
cflags_common += " -mno-ms-bitfields -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 " if c?(:MINGW)
|
2010-08-01 10:53:34 +00:00
|
|
|
ldflags_extra = c?(:MINGW) ? '' : "-Wl,--enable-auto-import"
|
|
|
|
$flags = {
|
|
|
|
:cflags => "#{cflags_common} #{c(:USER_CFLAGS)}",
|
2013-10-26 16:50:15 +00:00
|
|
|
:cxxflags => "#{cflags_common} #{c(:STD_CXX11)} -Wnon-virtual-dtor -Woverloaded-virtual -Wextra #{c(:WXWIDGETS_CFLAGS)} #{c(:QT_CFLAGS)} #{c(:BOOST_CPPFLAGS)} #{c(:CURL_CFLAGS)} #{c(:USER_CXXFLAGS)}",
|
2010-08-01 10:53:34 +00:00
|
|
|
:cppflags => "#{c(:USER_CPPFLAGS)}",
|
2011-02-06 11:54:56 +00:00
|
|
|
:ldflags => "#{c(:EBML_LDFLAGS)} #{c(:MATROSKA_LDFLAGS)} #{c(:EXTRA_LDFLAGS)} #{c(:PROFILING_LIBS)} #{c(:USER_LDFLAGS)} #{c(:LDFLAGS_RPATHS)} #{c(:BOOST_LDFLAGS)}",
|
2014-01-02 20:23:13 +00:00
|
|
|
:windres => (c(:MINGW_PROCESSOR_ARCH) == 'amd64' ? '-DMINGW_PROCESSOR_ARCH_AMD64=1 ' : '') + (c?(:USE_WXWIDGETS) ? c(:WXWIDGETS_INCLUDES) : '-DNOWXWIDGETS'),
|
2010-08-01 10:53:34 +00:00
|
|
|
}
|
2012-08-07 20:48:28 +00:00
|
|
|
|
|
|
|
$build_system_modules.values.each { |bsm| bsm[:setup].call if bsm[:setup] }
|
2010-07-26 10:29:18 +00:00
|
|
|
end
|
|
|
|
|
2012-02-06 11:39:59 +00:00
|
|
|
def setup_overrides
|
|
|
|
[ :applications, :manpages, :guides ].each do |type|
|
|
|
|
value = c("AVAILABLE_LANGUAGES_#{type.to_s.upcase}")
|
|
|
|
$available_languages[type] = value.split(/\s+/) unless value.empty?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-07-26 11:30:59 +00:00
|
|
|
def define_default_task
|
|
|
|
desc "Build everything"
|
2010-07-26 19:47:37 +00:00
|
|
|
|
|
|
|
# The applications themselves
|
2010-07-26 11:30:59 +00:00
|
|
|
targets = $applications.clone
|
2010-07-26 19:47:37 +00:00
|
|
|
|
2010-07-27 19:49:51 +00:00
|
|
|
# Build the stuff in the 'src/tools' directory only if requested
|
2012-04-16 11:55:09 +00:00
|
|
|
targets << "apps:tools" if $build_tools
|
2010-07-27 19:49:51 +00:00
|
|
|
|
2012-08-07 20:48:28 +00:00
|
|
|
# Build the unit tests only if requested
|
2012-08-26 10:36:14 +00:00
|
|
|
targets << ($run_unit_tests ? 'tests:run_unit' : 'tests:unit') if $have_gtest
|
2012-08-07 20:48:28 +00:00
|
|
|
|
2010-07-26 19:47:37 +00:00
|
|
|
# The tags file -- but only if it exists already
|
2012-03-26 18:19:14 +00:00
|
|
|
if File.exists?("TAGS")
|
|
|
|
targets << "TAGS" if !c(:ETAGS).empty?
|
|
|
|
targets << "BROWSE" if !c(:EBROWSE).empty?
|
|
|
|
end
|
2010-07-26 11:30:59 +00:00
|
|
|
|
2011-08-03 18:42:32 +00:00
|
|
|
# Build developer documentation?
|
|
|
|
targets << "doc/development.html" if !c(:PANDOC).empty?
|
|
|
|
|
2010-07-26 11:30:59 +00:00
|
|
|
# Build man pages and translations?
|
2010-07-27 17:27:06 +00:00
|
|
|
targets += [ "manpages", "translations:manpages" ] if c?(:XSLTPROC_WORKS)
|
2010-07-26 11:30:59 +00:00
|
|
|
|
2010-07-26 19:31:57 +00:00
|
|
|
# Build translations for the programs
|
2010-07-27 17:27:06 +00:00
|
|
|
targets << "translations:applications"
|
2010-07-26 19:31:57 +00:00
|
|
|
|
2010-07-26 19:47:37 +00:00
|
|
|
# The GUI help
|
2011-10-12 20:33:27 +00:00
|
|
|
targets << "translations:guides" if c?(:USE_WXWIDGETS)
|
2010-07-26 19:47:37 +00:00
|
|
|
|
2010-07-27 13:08:23 +00:00
|
|
|
task :default => targets do
|
|
|
|
puts "Done. Enjoy :)"
|
|
|
|
end
|
2010-07-26 11:30:59 +00:00
|
|
|
end
|
|
|
|
|
2010-07-26 10:29:18 +00:00
|
|
|
# main
|
|
|
|
setup_globals
|
2012-02-06 11:39:59 +00:00
|
|
|
setup_overrides
|
2010-07-26 10:29:18 +00:00
|
|
|
import_dependencies
|
2010-07-25 19:41:08 +00:00
|
|
|
|
|
|
|
# Default task
|
2010-07-26 11:30:59 +00:00
|
|
|
define_default_task
|
2010-07-25 19:41:08 +00:00
|
|
|
|
2010-07-27 07:25:02 +00:00
|
|
|
desc "Build all applications"
|
|
|
|
task :apps => $applications
|
2010-07-25 19:41:08 +00:00
|
|
|
|
2011-10-16 17:43:10 +00:00
|
|
|
desc "Build all command line applications"
|
|
|
|
namespace :apps do
|
|
|
|
task :cli => %w{apps:mkvmerge apps:mkvinfo apps:mkvextract apps:mkvpropedit}
|
|
|
|
end
|
|
|
|
|
2010-07-25 19:41:08 +00:00
|
|
|
# Store compiler block for re-use
|
|
|
|
cxx_compiler = lambda do |t|
|
2012-03-18 09:55:42 +00:00
|
|
|
create_dependency_dirs
|
|
|
|
|
2010-07-26 10:42:14 +00:00
|
|
|
# t.sources is empty for a 'file' task (common_pch.h.o).
|
|
|
|
sources = t.sources.empty? ? [ t.prerequisites.first ] : t.sources
|
2012-03-18 09:55:42 +00:00
|
|
|
dep = dependency_output_name_for t.name
|
2010-07-26 10:29:18 +00:00
|
|
|
|
2012-04-09 15:48:38 +00:00
|
|
|
runq " CXX #{sources.first}", "#{c(:CXX)} #{$flags[:cxxflags]} #{$system_includes} -c -MMD -MF #{dep} -o #{t.name} -x c++ #{sources.join(" ")}", :allow_failure => true
|
2012-03-18 09:55:42 +00:00
|
|
|
handle_deps t.name, last_exit_code, true
|
2010-07-25 19:41:08 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# Precompiled headers
|
|
|
|
if c?(:USE_PRECOMPILED_HEADERS)
|
2011-12-05 12:43:36 +00:00
|
|
|
$all_objects.each { |name| file name => "src/common/common_pch.h.gch" }
|
|
|
|
file "src/common/common_pch.h.gch" => "src/common/common_pch.h", &cxx_compiler
|
2010-07-25 19:41:08 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# Pattern rules
|
|
|
|
rule '.o' => '.cpp', &cxx_compiler
|
2012-08-07 20:48:28 +00:00
|
|
|
rule '.o' => '.cc', &cxx_compiler
|
2010-07-25 19:41:08 +00:00
|
|
|
|
|
|
|
rule '.o' => '.c' do |t|
|
2012-03-18 09:55:42 +00:00
|
|
|
create_dependency_dirs
|
|
|
|
dep = dependency_output_name_for t.name
|
|
|
|
|
|
|
|
runq " CC #{t.source}", "#{c(:CC)} #{$flags[:cflags]} #{$system_includes} -c -MMD -MF #{dep} -o #{t.name} #{t.sources.join(" ")}", :allow_failure => true
|
2010-07-26 10:29:18 +00:00
|
|
|
handle_deps t.name, last_exit_code
|
2010-07-25 19:41:08 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
rule '.o' => '.rc' do |t|
|
2011-11-23 19:30:00 +00:00
|
|
|
runq " WINDRES #{t.source}", "#{c(:WINDRES)} #{$flags[:windres]} -Isrc/mmg -o #{t.name} #{t.sources.join(" ")}"
|
2010-07-25 19:41:08 +00:00
|
|
|
end
|
|
|
|
|
2012-03-15 16:17:57 +00:00
|
|
|
rule '.h' => '.png' do |t|
|
2014-01-01 20:41:01 +00:00
|
|
|
puts " BIN2H #{t.source}" if !ENV['V'].to_bool
|
|
|
|
bin2h t.source, t.name
|
2012-03-15 16:17:57 +00:00
|
|
|
end
|
|
|
|
|
2011-11-23 23:50:00 +00:00
|
|
|
# Resources depend on the manifest.xml file for Windows builds.
|
|
|
|
if c?(:MINGW)
|
|
|
|
$programs.each do |program|
|
|
|
|
path = program.gsub(/^mkv/, '')
|
2011-12-03 19:41:38 +00:00
|
|
|
icon = program == 'mkvinfo' ? 'share/icons/windows/mkvinfo.ico' : 'share/icons/windows/mkvmergeGUI.ico'
|
2014-01-02 20:23:13 +00:00
|
|
|
file "src/#{path}/resources.o" => [ "src/#{path}/manifest-#{c(:MINGW_PROCESSOR_ARCH)}.xml", "src/#{path}/resources.rc", icon ]
|
2011-11-23 23:50:00 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-07-25 19:41:08 +00:00
|
|
|
rule '.mo' => '.po' do |t|
|
2011-09-17 14:36:51 +00:00
|
|
|
runq " MSGFMT #{t.source}", "msgfmt -c -o #{t.name} #{t.sources.join(" ")}"
|
2010-07-25 19:41:08 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# HTML help book stuff
|
|
|
|
rule '.hhk' => '.hhc' do |t|
|
2010-07-26 10:29:18 +00:00
|
|
|
runq " GREP #{t.source}", "#{c(:GREP)} -v 'name=\"ID\"' #{t.sources.join(" ")} > #{t.name}"
|
2010-07-25 19:41:08 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# man pages from DocBook XML
|
2010-10-31 14:40:45 +00:00
|
|
|
if c?(:XSLTPROC_WORKS)
|
|
|
|
rule '.1' => '.xml' do |t|
|
2012-02-25 14:05:14 +00:00
|
|
|
filter = lambda do |code, lines|
|
|
|
|
puts lines.join('')
|
|
|
|
if (0 == code) && lines.any? { |line| /^error/i.match(line) }
|
|
|
|
File.unlink(t.name) if File.exists?(t.name)
|
|
|
|
1
|
|
|
|
else
|
|
|
|
0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
runq "XSLTPROC #{t.source}", "#{c(:XSLTPROC)} #{c(:XSLTPROC_FLAGS)} -o #{t.name} #{c(:DOCBOOK_MANPAGES_STYLESHEET)} #{t.sources.join(" ")}", :filter_output => filter
|
2010-10-31 14:40:45 +00:00
|
|
|
end
|
2010-12-26 00:50:21 +00:00
|
|
|
|
|
|
|
$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
|
2010-07-25 19:41:08 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# Qt files
|
|
|
|
rule '.h' => '.ui' do |t|
|
2010-07-26 10:29:18 +00:00
|
|
|
runq " UIC #{t.source}", "#{c(:UIC)} #{t.sources.join(" ")} > #{t.name}"
|
2010-07-25 19:41:08 +00:00
|
|
|
end
|
|
|
|
|
2012-04-10 15:37:55 +00:00
|
|
|
rule '.cpp' => '.qrc' do |t|
|
|
|
|
runq " RCC #{t.source}", "#{c(:RCC)} #{t.sources.join(" ")} > #{t.name}"
|
|
|
|
end
|
|
|
|
|
2012-04-09 15:48:38 +00:00
|
|
|
rule '.moc' => '.h' do |t|
|
|
|
|
runq " MOC #{t.prerequisites.first}", "#{c(:MOC)} #{c(:QT_CFLAGS)} -nw #{t.prerequisites.join(" ")} > #{t.name}"
|
|
|
|
end
|
|
|
|
|
|
|
|
rule '.moco' => '.moc' do |t|
|
|
|
|
cxx_compiler.call t
|
2010-07-25 19:41:08 +00:00
|
|
|
end
|
|
|
|
|
2010-07-26 11:06:24 +00:00
|
|
|
# Tag files
|
|
|
|
desc "Create tags file for Emacs"
|
|
|
|
task :tags => "TAGS"
|
|
|
|
|
2012-03-26 18:19:14 +00:00
|
|
|
desc "Create browse file for Emacs"
|
|
|
|
task :browse => "BROWSE"
|
|
|
|
|
2010-07-26 11:06:24 +00:00
|
|
|
file "TAGS" => $all_sources do |t|
|
|
|
|
runq ' ETAGS', "#{c(:ETAGS)} -o #{t.name} #{t.prerequisites.join(" ")}"
|
|
|
|
end
|
|
|
|
|
2012-03-26 18:19:14 +00:00
|
|
|
file "BROWSE" => ($all_sources + $all_headers) do |t|
|
|
|
|
runq ' EBROWSE', "#{c(:EBROWSE)} -o #{t.name} #{t.prerequisites.join(" ")}"
|
|
|
|
end
|
|
|
|
|
2011-08-03 18:42:32 +00:00
|
|
|
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
|
|
|
|
|
2011-11-05 13:29:02 +00:00
|
|
|
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
|
|
|
|
|
2010-07-27 17:27:06 +00:00
|
|
|
task :manpages => $manpages
|
|
|
|
|
2010-07-27 07:25:02 +00:00
|
|
|
# Translations for the programs
|
|
|
|
namespace :translations do
|
|
|
|
desc "Create a template for translating the programs"
|
|
|
|
task :pot => "po/mkvtoolnix.pot"
|
|
|
|
|
2011-11-03 23:34:05 +00:00
|
|
|
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'
|
2013-09-19 09:01:05 +00:00
|
|
|
iso639_file = "/usr/share/xml/iso-codes/iso_639.xml"
|
|
|
|
node = REXML::XPath.first REXML::Document.new(File.new(iso639_file)), "//iso_639_entry[@name='#{ENV['LANGUAGE']}']"
|
|
|
|
locale = node ? node.attributes['iso_639_1_code'] : nil
|
|
|
|
if locale.blank?
|
|
|
|
if /^ [a-z]{2} (?: _ [A-Z]{2} )? $/x.match(ENV['LANGUAGE'])
|
|
|
|
locale = ENV['LANGUAGE']
|
|
|
|
else
|
|
|
|
fail "Unknown language/ISO-639-1 code not found in #{iso639_file}"
|
|
|
|
end
|
|
|
|
end
|
2011-11-03 23:34:05 +00:00
|
|
|
|
|
|
|
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 <moritz@bunkus.org>\\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']} <moritz@bunkus.org>\\n"
|
|
|
|
"Language: #{locale}\\n"
|
|
|
|
"MIME-Version: 1.0\\n"
|
|
|
|
|
|
|
|
EOT
|
|
|
|
out.puts IO.readlines("po/mkvtoolnix.pot")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-12-25 20:16:50 +00:00
|
|
|
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
|
|
|
|
|
2010-07-27 17:27:06 +00:00
|
|
|
[ :applications, :manpages, :guides ].each { |type| task type => $translations[type] }
|
|
|
|
|
2010-07-27 18:49:35 +00:00
|
|
|
$available_languages[:manpages].each do |language|
|
|
|
|
$manpages.each do |manpage|
|
|
|
|
name = manpage.gsub(/man\//, "man/#{language}/")
|
2010-08-01 10:24:54 +00:00
|
|
|
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|
|
2013-04-27 11:00:58 +00:00
|
|
|
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}"
|
2010-08-01 10:24:54 +00:00
|
|
|
end
|
2010-07-27 18:49:35 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-07-27 17:47:40 +00:00
|
|
|
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"
|
2013-12-28 23:29:28 +00:00
|
|
|
no_wrap = %{es it}.include?(language) ? "" : "--no-wrap"
|
|
|
|
runq "MSGMERGE #{po}", "msgmerge -q -s #{no_wrap} #{po} po/mkvtoolnix.pot > #{tmp_file}", :allow_failure => true
|
2010-07-27 17:47:40 +00:00
|
|
|
|
|
|
|
exit_code = last_exit_code
|
|
|
|
if 0 != exit_code
|
|
|
|
File.unlink tmp_file
|
|
|
|
exit exit_code
|
|
|
|
end
|
2010-07-27 07:25:02 +00:00
|
|
|
|
2013-12-28 23:29:28 +00:00
|
|
|
adjust_to_poedit_style tmp_file, po, language
|
2010-07-27 07:25:02 +00:00
|
|
|
end
|
2010-07-27 17:47:40 +00:00
|
|
|
end
|
|
|
|
end
|
2010-07-27 07:25:02 +00:00
|
|
|
|
2010-07-27 17:47:40 +00:00
|
|
|
desc "Update the man pages' translation files"
|
|
|
|
task :manpages do
|
2010-12-21 10:52:57 +00:00
|
|
|
runq " PO4A doc/man/po4a/po4a.cfg", "#{c(:PO4A)} #{c(:PO4A_FLAGS)} --msgmerge-opt=--no-wrap doc/man/po4a/po4a.cfg"
|
2011-12-14 21:00:32 +00:00
|
|
|
%w{nl uk zh_CN}.each do |language|
|
2010-07-27 17:47:40 +00:00
|
|
|
name = "doc/man/po4a/po/#{language}.po"
|
|
|
|
FileUtils.cp name, "#{name}.tmp"
|
|
|
|
adjust_to_poedit_style "#{name}.tmp", name
|
2010-07-27 07:25:02 +00:00
|
|
|
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
|
|
|
|
|
2012-04-11 10:45:18 +00:00
|
|
|
# HTML generation for the man pages
|
2010-07-27 18:13:10 +00:00
|
|
|
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
|
2013-01-21 21:50:04 +00:00
|
|
|
runq "SAXON-HE #{name}", "java -classpath lib/saxon-he/saxon9he.jar net.sf.saxon.Transform -o:#{name.ext('html')} -xsl:doc/stylesheets/docbook-to-html.xsl #{name}"
|
2010-07-27 18:13:10 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-04-11 10:45:18 +00:00
|
|
|
# Developer helper tasks
|
|
|
|
namespace :dev do
|
|
|
|
if $build_mkvtoolnix_gui
|
|
|
|
desc "Update Qt resource files"
|
|
|
|
task "update-qt-resources" do
|
|
|
|
require 'rexml/document'
|
|
|
|
|
|
|
|
qrc = "src/mkvtoolnix-gui/qt_resources.qrc"
|
|
|
|
doc = REXML::Document.new File.new(qrc)
|
|
|
|
existing = Hash.new
|
|
|
|
|
|
|
|
doc.elements.to_a("/RCC/qresource/file").each do |node|
|
|
|
|
if File.exists? "src/mkvtoolnix-gui/#{node.text}"
|
|
|
|
existing[node.text] = true
|
|
|
|
else
|
|
|
|
puts "Removing <file> for non-existing #{node.text}"
|
|
|
|
node.remove
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
parent = doc.elements.to_a("/RCC/qresource")[0]
|
|
|
|
FileList["share/icons/*/*.png"].select { |file| !existing["../../#{file}"] }.each do |file|
|
|
|
|
puts "Adding <file> for #{file}"
|
|
|
|
node = REXML::Element.new "file"
|
|
|
|
node.attributes["alias"] = file.gsub(/share\//, '')
|
|
|
|
node.text = "../../#{file}"
|
|
|
|
parent << node
|
|
|
|
end
|
|
|
|
|
|
|
|
formatter = REXML::Formatters::Pretty.new 1
|
|
|
|
formatter.compact = true
|
|
|
|
formatter.width = 9999999
|
|
|
|
formatter.write doc, File.open(qrc, "w")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-07-27 07:25:02 +00:00
|
|
|
# Installation tasks
|
|
|
|
desc "Install all applications and support files"
|
2011-10-12 20:33:27 +00:00
|
|
|
targets = [ "install:programs", "install:manpages", "install:translations:manpages", "install:translations:applications" ]
|
|
|
|
targets += [ "install:translations:guides", "install:shared" ] if c?(:USE_WXWIDGETS)
|
2010-07-27 16:52:12 +00:00
|
|
|
task :install => targets
|
|
|
|
|
|
|
|
namespace :install do
|
2010-08-01 18:04:47 +00:00
|
|
|
application_name_mapper = lambda do |name|
|
|
|
|
base = File.basename name
|
|
|
|
base == "mmg" ? $mmg_bin : base
|
|
|
|
end
|
|
|
|
|
2010-07-27 16:52:12 +00:00
|
|
|
task :programs => $applications do
|
|
|
|
install_dir :bindir
|
2010-08-01 18:04:47 +00:00
|
|
|
$applications.each { |application| install_program "#{c(:bindir)}/#{application_name_mapper[application]}", application }
|
2010-07-27 16:52:12 +00:00
|
|
|
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" ]
|
|
|
|
|
2012-04-11 10:00:48 +00:00
|
|
|
wanted_apps = %w{mkvmerge mkvmergeGUI mkvinfo mkvextract mkvpropedit}.collect { |e| "#{e}.png" }.to_hash_by
|
2012-06-17 17:05:12 +00:00
|
|
|
wanted_dirs = %w{16x16 24x24 32x32 48x48 64x64 96x96 128x128 256x256}.to_hash_by
|
2012-04-11 10:00:48 +00:00
|
|
|
dirs_to_install = FileList[ "#{$top_srcdir}/share/icons/*" ].select { |dir| wanted_dirs[ dir.gsub(/.*icons\//, '').gsub(/\/.*/, '') ] }.sort.uniq
|
|
|
|
|
|
|
|
dirs_to_install.each do |dir|
|
2012-05-27 13:30:27 +00:00
|
|
|
dest_dir = "#{c(:icondir)}/#{dir.gsub(/.*icons\//, '')}/apps"
|
|
|
|
install_dir dest_dir
|
|
|
|
install_data "#{dest_dir}/", FileList[ "#{dir}/*" ].to_a.select { |file| wanted_apps[ file.gsub(/.*\//, '') ] }
|
2010-07-27 16:52:12 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-08-01 18:04:47 +00:00
|
|
|
man_page_name_mapper = lambda do |name|
|
|
|
|
base = File.basename name
|
|
|
|
base == "mmg.1" ? "#{$mmg_bin}.1" : base
|
|
|
|
end
|
|
|
|
|
2010-07-27 16:52:12 +00:00
|
|
|
task :manpages => $manpages do
|
|
|
|
install_dir :man1dir
|
2010-08-01 18:04:47 +00:00
|
|
|
$manpages.each { |manpage| install_data "#{c(:man1dir)}/#{man_page_name_mapper[manpage]}", manpage }
|
2010-07-27 16:52:12 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
namespace :translations do
|
|
|
|
task :applications do
|
2010-07-27 17:27:06 +00:00
|
|
|
install_dir $languages[:applications].collect { |language| "#{c(:localedir)}/#{language}/LC_MESSAGES" }
|
|
|
|
$languages[:applications].each do |language|
|
2010-07-27 16:52:12 +00:00
|
|
|
install_data "#{c(:localedir)}/#{language}/LC_MESSAGES/mkvtoolnix.mo", "po/#{language}.mo"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
task :manpages do
|
2010-07-27 17:27:06 +00:00
|
|
|
install_dir $languages[:manpages].collect { |language| "#{c(:mandir)}/#{language}/man1" }
|
|
|
|
$languages[:manpages].each do |language|
|
2010-08-01 18:04:47 +00:00
|
|
|
$manpages.each { |manpage| install_data "#{c(:mandir)}/#{language}/man1/#{man_page_name_mapper[manpage]}", manpage.sub(/man\//, "man/#{language}/") }
|
2010-07-27 16:52:12 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
task :guides do
|
2010-11-09 13:41:06 +00:00
|
|
|
install_dir :docdir, $languages[:guides].collect { |language| "#{c(:docdir)}/guide/#{language}/images" }
|
2010-07-27 16:52:12 +00:00
|
|
|
|
2010-07-27 17:27:06 +00:00
|
|
|
$languages[:guides].each do |language|
|
2010-11-09 13:41:06 +00:00
|
|
|
install_data "#{c(:docdir)}/guide/#{language}/", FileList[ "#{$top_srcdir}/doc/guide/#{language}/mkvmerge-gui.*" ]
|
2013-12-15 11:42:43 +00:00
|
|
|
install_data "#{c(:docdir)}/guide/#{language}/images/", FileList[ "#{$top_srcdir}/doc/guide/#{language}/images/*.{gif,png}" ]
|
2010-07-27 16:52:12 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2010-07-27 07:25:02 +00:00
|
|
|
|
2010-07-25 19:41:08 +00:00
|
|
|
# Cleaning tasks
|
2010-07-26 10:56:42 +00:00
|
|
|
desc "Remove all compiled files"
|
2010-07-25 19:41:08 +00:00
|
|
|
task :clean do
|
2012-04-09 14:32:46 +00:00
|
|
|
puts " CLEAN"
|
|
|
|
|
|
|
|
patterns = %w{
|
2012-04-10 15:37:55 +00:00
|
|
|
src/**/*.o lib/**/*.o src/**/*.a lib/**/*.a src/**/*.gch
|
2012-04-09 14:32:46 +00:00
|
|
|
src/**/*.exe src/**/*.dll src/**/*.dll.a
|
2014-01-01 20:33:08 +00:00
|
|
|
share/icons/*x*/*.h
|
2012-04-10 20:34:58 +00:00
|
|
|
src/info/ui/*.h src/mkvtoolnix-gui/forms/*.h src/**/*.moc src/**/*.moco src/mkvtoolnix-gui/qt_resources.cpp
|
2013-12-25 18:59:37 +00:00
|
|
|
tests/unit/**/*.o tests/unit/**/*.a tests/unit/all
|
2012-04-09 14:32:46 +00:00
|
|
|
po/*.mo doc/guide/**/*.hhk
|
|
|
|
}
|
|
|
|
patterns += $applications + $tools.collect { |name| "src/tools/#{name}" }
|
|
|
|
|
2013-07-04 19:04:29 +00:00
|
|
|
remove_files_by_patters patterns
|
2012-04-09 14:32:46 +00:00
|
|
|
|
|
|
|
if Dir.exists? $dependency_dir
|
|
|
|
puts " rm -rf #{$dependency_dir}" if verbose
|
|
|
|
FileUtils.rm_rf $dependency_dir
|
|
|
|
end
|
2010-07-25 19:41:08 +00:00
|
|
|
end
|
|
|
|
|
2010-07-27 07:25:02 +00:00
|
|
|
namespace :clean do
|
|
|
|
desc "Remove all compiled and generated files ('tarball' clean)"
|
|
|
|
task :dist => :clean do
|
2010-07-26 10:29:18 +00:00
|
|
|
run "rm -f config.h config.log config.cache build-config Makefile */Makefile */*/Makefile TAGS", :allow_failure => true
|
2010-07-25 19:41:08 +00:00
|
|
|
end
|
|
|
|
|
2010-07-27 07:25:02 +00:00
|
|
|
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
|
2010-07-25 19:41:08 +00:00
|
|
|
|
2010-07-27 07:25:02 +00:00
|
|
|
desc "Remove all compiled libraries"
|
|
|
|
task :libs do
|
|
|
|
run "rm -f */lib*.a */*/lib*.a */*/*.dll */*/*.dll.a", :allow_failure => true
|
|
|
|
end
|
2010-07-25 19:41:08 +00:00
|
|
|
|
2010-07-27 07:25:02 +00:00
|
|
|
[: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
|
2010-07-25 19:41:08 +00:00
|
|
|
end
|
2010-07-27 18:13:10 +00:00
|
|
|
|
|
|
|
%w{manpages-html man2html}.each do |name|
|
|
|
|
task name do
|
|
|
|
run "rm -f doc/man/*.html doc/man/*/*.html"
|
|
|
|
end
|
|
|
|
end
|
2013-07-04 19:04:29 +00:00
|
|
|
|
|
|
|
desc "Remove compiled objects and programs in the unit test suite"
|
|
|
|
task :unittests do
|
|
|
|
patterns = %w{tests/unit/*.o tests/unit/*/*.o tests/unit/*.a tests/unit/*/*.a}
|
|
|
|
patterns += $gtest_apps.collect { |app| "tests/unit/#{app}/#{app}" }
|
|
|
|
remove_files_by_patters patterns
|
|
|
|
end
|
2010-07-25 19:41:08 +00:00
|
|
|
end
|
|
|
|
|
2012-08-02 09:26:54 +00:00
|
|
|
# Tests
|
|
|
|
desc "Run all tests"
|
|
|
|
task :tests => [ 'tests:products' ]
|
|
|
|
namespace :tests do
|
|
|
|
desc "Run prodct tests from 'tests' sub-directory (requires data files to be present)"
|
|
|
|
task :products do
|
|
|
|
run "cd tests && ./run.rb"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-07-25 19:41:08 +00:00
|
|
|
#
|
|
|
|
# avilib-0.6.10
|
|
|
|
# librmff
|
|
|
|
# spyder's MPEG parser
|
|
|
|
# src/common
|
|
|
|
# src/input
|
|
|
|
# src/output
|
|
|
|
#
|
|
|
|
|
2012-08-13 19:20:50 +00:00
|
|
|
[ { :name => 'avi', :dir => 'lib/avilib-0.6.10' },
|
|
|
|
{ :name => 'rmff', :dir => 'lib/librmff' },
|
|
|
|
{ :name => 'pugixml', :dir => 'lib/pugixml/src' },
|
|
|
|
{ :name => 'mpegparser', :dir => 'src/mpegparser' },
|
|
|
|
{ :name => 'mtxcommon', :dir => [ 'src/common' ] + %w{chapters compression strings tags xml }.collect { |e| "src/common/#{e}" } },
|
|
|
|
{ :name => 'mtxinput', :dir => 'src/input' },
|
|
|
|
{ :name => 'mtxoutput', :dir => 'src/output' },
|
|
|
|
{ :name => 'mtxmerge', :dir => 'src/merge', :except => [ 'mkvmerge.cpp' ], },
|
|
|
|
{ :name => 'mtxinfo', :dir => 'src/info', :except => %w{qt_ui.cpp wxwidgets_ui.cpp mkvinfo.cpp}, },
|
|
|
|
{ :name => 'mtxextract', :dir => 'src/extract', :except => [ 'mkvextract.cpp' ], },
|
|
|
|
{ :name => 'mtxpropedit', :dir => 'src/propedit', :except => [ 'mkvpropedit.cpp' ], },
|
|
|
|
{ :name => 'ebml', :dir => 'lib/libebml/src' },
|
|
|
|
{ :name => 'matroska', :dir => 'lib/libmatroska/src' },
|
2010-07-25 19:41:08 +00:00
|
|
|
].each do |lib|
|
|
|
|
Library.
|
|
|
|
new("#{[ lib[:dir] ].flatten.first}/lib#{lib[:name]}").
|
2012-08-13 19:20:50 +00:00
|
|
|
sources([ lib[:dir] ].flatten, :type => :dir, :except => lib[:except]).
|
2010-07-25 19:41:08 +00:00
|
|
|
build_dll(lib[:name] == 'mtxcommon').
|
2013-03-03 19:59:49 +00:00
|
|
|
libraries(:iconv, :z, :matroska, :ebml, :rpcrt4).
|
2010-07-25 19:41:08 +00:00
|
|
|
create
|
|
|
|
end
|
|
|
|
|
2012-03-17 00:07:45 +00:00
|
|
|
# libraries required for all programs via mtxcommon
|
2012-08-07 20:48:28 +00:00
|
|
|
$common_libs = [
|
2012-03-17 00:07:45 +00:00
|
|
|
:mtxcommon,
|
|
|
|
:magic,
|
|
|
|
:matroska,
|
|
|
|
:ebml,
|
|
|
|
:z,
|
2012-03-17 00:10:46 +00:00
|
|
|
:pugixml,
|
2012-03-17 00:07:45 +00:00
|
|
|
:iconv,
|
|
|
|
:intl,
|
|
|
|
:curl,
|
|
|
|
:boost_regex,
|
|
|
|
:boost_filesystem,
|
|
|
|
:boost_system,
|
|
|
|
]
|
|
|
|
|
2010-07-25 19:41:08 +00:00
|
|
|
#
|
|
|
|
# mkvmerge
|
|
|
|
#
|
|
|
|
|
|
|
|
Application.new("src/mkvmerge").
|
2010-07-26 10:56:42 +00:00
|
|
|
description("Build the mkvmerge executable").
|
2010-07-25 19:41:08 +00:00
|
|
|
aliases(:mkvmerge).
|
2012-08-13 19:20:50 +00:00
|
|
|
sources("src/merge/mkvmerge.cpp").
|
2010-07-25 19:41:08 +00:00
|
|
|
sources("src/merge/resources.o", :if => c?(:MINGW)).
|
2012-08-13 19:20:50 +00:00
|
|
|
libraries(:mtxmerge, :mtxinput, :mtxoutput, $common_libs, :avi, :rmff, :mpegparser, :flac, :vorbis, :ogg).
|
2010-07-25 19:41:08 +00:00
|
|
|
create
|
|
|
|
|
|
|
|
#
|
|
|
|
# mkvinfo
|
|
|
|
#
|
|
|
|
|
|
|
|
$mkvinfo_ui_files = FileList["src/info/ui/*.ui"].to_a
|
2011-03-07 23:16:21 +00:00
|
|
|
file "src/info/qt_ui.o" => $mkvinfo_ui_files.collect { |file| file.ext('h') }
|
2010-07-25 19:41:08 +00:00
|
|
|
|
|
|
|
Application.new("src/mkvinfo").
|
2010-07-26 10:56:42 +00:00
|
|
|
description("Build the mkvinfo executable").
|
2010-07-25 19:41:08 +00:00
|
|
|
aliases(:mkvinfo).
|
2012-08-13 19:20:50 +00:00
|
|
|
sources("src/info/mkvinfo.cpp").
|
2010-07-25 19:41:08 +00:00
|
|
|
sources("src/info/resources.o", :if => c?(:MINGW)).
|
2012-08-13 19:20:50 +00:00
|
|
|
libraries(:mtxinfo, $common_libs).
|
2010-07-25 19:41:08 +00:00
|
|
|
only_if(c?(:USE_QT)).
|
2012-04-09 15:48:38 +00:00
|
|
|
sources("src/info/qt_ui.cpp", "src/info/qt_ui.moc", "src/info/rightclick_tree_widget.moc", $mkvinfo_ui_files).
|
2010-07-25 19:41:08 +00:00
|
|
|
libraries(:qt).
|
2011-11-23 16:58:55 +00:00
|
|
|
end_if.
|
2010-07-25 19:41:08 +00:00
|
|
|
only_if(!c?(:USE_QT) && c?(:USE_WXWIDGETS)).
|
|
|
|
sources("src/info/wxwidgets_ui.cpp").
|
2014-01-01 21:37:28 +00:00
|
|
|
png_icon("share/icons/64x64/mkvinfo.png", "src/info/wxwidgets_ui.cpp").
|
2010-07-25 19:41:08 +00:00
|
|
|
libraries(:wxwidgets).
|
2011-11-23 16:58:55 +00:00
|
|
|
end_if.
|
2010-07-25 19:41:08 +00:00
|
|
|
create
|
|
|
|
|
|
|
|
#
|
|
|
|
# mkvextract
|
|
|
|
#
|
|
|
|
|
|
|
|
Application.new("src/mkvextract").
|
2011-03-23 11:08:30 +00:00
|
|
|
description("Build the mkvextract executable").
|
2010-07-25 19:41:08 +00:00
|
|
|
aliases(:mkvextract).
|
2012-08-13 19:20:50 +00:00
|
|
|
sources("src/extract/mkvextract.cpp").
|
2010-07-25 19:41:08 +00:00
|
|
|
sources("src/extract/resources.o", :if => c?(:MINGW)).
|
2012-08-13 19:20:50 +00:00
|
|
|
libraries(:mtxextract, $common_libs, :avi, :rmff, :vorbis, :ogg).
|
2010-07-25 19:41:08 +00:00
|
|
|
create
|
|
|
|
|
|
|
|
#
|
|
|
|
# mkvpropedit
|
|
|
|
#
|
|
|
|
|
|
|
|
Application.new("src/mkvpropedit").
|
2010-07-26 10:56:42 +00:00
|
|
|
description("Build the mkvpropedit executable").
|
2010-07-25 19:41:08 +00:00
|
|
|
aliases(:mkvpropedit).
|
2012-08-13 19:20:50 +00:00
|
|
|
sources("src/propedit/propedit.cpp").
|
2010-07-25 19:41:08 +00:00
|
|
|
sources("src/propedit/resources.o", :if => c?(:MINGW)).
|
2012-08-13 19:20:50 +00:00
|
|
|
libraries(:mtxpropedit, $common_libs).
|
2010-07-25 19:41:08 +00:00
|
|
|
create
|
|
|
|
|
|
|
|
#
|
|
|
|
# mmg
|
|
|
|
#
|
|
|
|
|
|
|
|
if c?(:USE_WXWIDGETS)
|
|
|
|
Application.new("src/mmg/mmg").
|
2010-07-26 10:56:42 +00:00
|
|
|
description("Build the mmg executable").
|
2010-07-25 19:41:08 +00:00
|
|
|
aliases(:mmg).
|
|
|
|
sources("src/mmg", "src/mmg/header_editor", "src/mmg/options", "src/mmg/tabs", :type => :dir).
|
2011-11-23 23:49:26 +00:00
|
|
|
sources("src/mmg/resources.o", :if => c?(:MINGW)).
|
2014-01-01 21:37:28 +00:00
|
|
|
png_icon("share/icons/64x64/mkvmergeGUI.png", "src/mmg/mmg_dialog.cpp", "src/mmg/header_editor/frame.cpp").
|
|
|
|
png_icon("share/icons/16x16/sort_ascending.png", "src/mmg/tabs/select_scanned_file_dlg.cpp").
|
|
|
|
png_icon("share/icons/16x16/sort_descending.png", "src/mmg/tabs/select_scanned_file_dlg.cpp").
|
2012-08-07 20:48:28 +00:00
|
|
|
libraries($common_libs, :wxwidgets).
|
2010-07-28 07:27:17 +00:00
|
|
|
libraries(:ole32, :shell32, "-mwindows", :if => c?(:MINGW)).
|
2010-07-25 19:41:08 +00:00
|
|
|
create
|
|
|
|
end
|
2010-07-27 19:49:51 +00:00
|
|
|
|
2012-04-09 15:48:38 +00:00
|
|
|
#
|
2012-04-10 20:34:58 +00:00
|
|
|
# mkvtoolnix-gui
|
2012-04-09 15:48:38 +00:00
|
|
|
#
|
|
|
|
|
2012-04-10 20:34:58 +00:00
|
|
|
if $build_mkvtoolnix_gui
|
|
|
|
ui_files = FileList["src/mkvtoolnix-gui/forms/**/*.ui"].to_a
|
2012-04-09 15:48:38 +00:00
|
|
|
ui_files.each do |ui|
|
2012-04-22 17:13:47 +00:00
|
|
|
file ui.gsub(/forms\/(.*)\.ui$/, '\1/\1.cpp') => ui.ext('h')
|
2012-04-09 15:48:38 +00:00
|
|
|
end
|
|
|
|
|
2012-04-25 18:16:03 +00:00
|
|
|
ui_static_deps = {
|
|
|
|
"main_window" => [ "merge_widget/merge_widget" ]
|
|
|
|
}
|
|
|
|
ui_static_deps.each do |ui_h, objects|
|
|
|
|
objects.each { |object| file "src/mkvtoolnix-gui/#{object}.o" => "src/mkvtoolnix-gui/forms/#{ui_h}.h" }
|
|
|
|
end
|
|
|
|
|
2012-04-10 20:34:58 +00:00
|
|
|
Application.new("src/mkvtoolnix-gui/mkvtoolnix-gui").
|
|
|
|
description("Build the mkvtoolnix-gui executable").
|
|
|
|
aliases("mkvtoolnix-gui").
|
|
|
|
sources(FileList["src/mkvtoolnix-gui/**/*.cpp"], ui_files, 'src/mkvtoolnix-gui/qt_resources.cpp').
|
|
|
|
sources((FileList["src/mkvtoolnix-gui/**/*.h"].to_a - ui_files.collect { |ui| ui.ext 'h' }).collect { |h| h.ext 'moc' }).
|
|
|
|
sources("src/mkvtoolnix-gui/resources.o", :if => c?(:MINGW)).
|
2012-08-07 20:48:28 +00:00
|
|
|
libraries($common_libs, :qt).
|
2012-04-09 15:48:38 +00:00
|
|
|
png_icon("share/icons/64x64/mkvmergeGUI.png").
|
|
|
|
create
|
|
|
|
end
|
|
|
|
|
2010-07-27 19:49:51 +00:00
|
|
|
#
|
|
|
|
# Applications in src/tools
|
|
|
|
#
|
|
|
|
if $build_tools
|
|
|
|
namespace :apps do
|
|
|
|
task :tools => $tools.collect { |name| "apps:tools:#{name}" }
|
|
|
|
end
|
|
|
|
|
2012-02-25 18:23:02 +00:00
|
|
|
#
|
|
|
|
# tools: ac3parser
|
|
|
|
#
|
|
|
|
Application.new("src/tools/ac3parser").
|
|
|
|
description("Build the ac3parser executable").
|
|
|
|
aliases("tools:ac3parser").
|
|
|
|
sources("src/tools/ac3parser.cpp").
|
2012-08-07 20:48:28 +00:00
|
|
|
libraries($common_libs).
|
2012-02-25 18:23:02 +00:00
|
|
|
create
|
|
|
|
|
2010-07-27 19:49:51 +00:00
|
|
|
#
|
|
|
|
# tools: base64tool
|
|
|
|
#
|
|
|
|
Application.new("src/tools/base64tool").
|
|
|
|
description("Build the base64tool executable").
|
|
|
|
aliases("tools:base64tool").
|
|
|
|
sources("src/tools/base64tool.cpp").
|
2012-08-07 20:48:28 +00:00
|
|
|
libraries($common_libs).
|
2010-07-27 19:49:51 +00:00
|
|
|
create
|
|
|
|
|
|
|
|
#
|
|
|
|
# tools: diracparser
|
|
|
|
#
|
|
|
|
Application.new("src/tools/diracparser").
|
|
|
|
description("Build the diracparser executable").
|
|
|
|
aliases("tools:diracparser").
|
|
|
|
sources("src/tools/diracparser.cpp").
|
2012-08-07 20:48:28 +00:00
|
|
|
libraries($common_libs).
|
2010-07-27 19:49:51 +00:00
|
|
|
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").
|
2012-08-07 20:48:28 +00:00
|
|
|
libraries($common_libs).
|
2010-07-27 19:49:51 +00:00
|
|
|
create
|
|
|
|
|
|
|
|
#
|
|
|
|
# tools: vc1parser
|
|
|
|
#
|
|
|
|
Application.new("src/tools/vc1parser").
|
|
|
|
description("Build the vc1parser executable").
|
|
|
|
aliases("tools:vc1parser").
|
|
|
|
sources("src/tools/vc1parser.cpp").
|
2012-08-07 20:48:28 +00:00
|
|
|
libraries($common_libs).
|
2010-07-27 19:49:51 +00:00
|
|
|
create
|
|
|
|
end
|
2012-04-25 21:47:51 +00:00
|
|
|
|
2012-08-07 20:48:28 +00:00
|
|
|
$build_system_modules.values.each { |bsm| bsm[:define_tasks].call if bsm[:define_tasks] }
|
|
|
|
|
2012-04-25 21:47:51 +00:00
|
|
|
# Local Variables:
|
|
|
|
# mode: ruby
|
|
|
|
# End:
|