2016-01-18 19:29:56 +00:00
# coding: utf-8
2010-07-25 19:41:08 +00:00
2019-01-02 22:05:39 +00:00
$build_start = Time . now
2015-04-05 11:36:50 +00:00
if Signal . list . key? ( 'ALRM' )
Signal . trap ( 'ALRM' ) { | signo | }
end
2014-01-08 12:58:37 +00:00
version = RUBY_VERSION . gsub ( / [^0-9 \ .]+ / , " " ) . split ( / \ . / ) . collect ( & :to_i )
version << 0 while version . size < 3
if ( version [ 0 ] < 2 ) && ( version [ 1 ] < 9 )
fail " Ruby 1.9.x or newer is required for building "
end
2010-07-27 19:31:39 +00:00
# Change to base directory before doing anything
2018-02-26 19:37:34 +00:00
$source_dir = File . absolute_path ( File . dirname ( __FILE__ ) )
$build_dir = $source_dir
2010-08-05 20:18:29 +00:00
if FileUtils . pwd != File . dirname ( __FILE__ )
2018-02-26 19:37:34 +00:00
puts " Entering directory ` #{ $source_dir } ' "
Dir . chdir $source_dir
2010-08-05 20:18:29 +00:00
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
2017-01-07 15:33:57 +00:00
# drake.
2010-07-27 19:31:39 +00:00
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
2017-01-07 15:33:57 +00:00
# For newer rake turn on parallel processing, too. Newer rake versions
# use an OpenStruct, though, so testing with responds_to? won't work.
version = Rake :: VERSION . gsub ( %r{ [^0-9 \ .]+ } , " " ) . split ( %r{ \ . } ) . map ( & :to_i )
2017-10-17 18:44:16 +00:00
if ( version [ 0 ] > 10 ) || ( ( version [ 0 ] == 10 ) && ( version [ 1 ] > = 3 ) )
2017-01-07 15:33:57 +00:00
Rake . application . options . always_multitask = true
end
2017-05-20 16:05:45 +00:00
module Mtx
end
2019-02-05 12:45:34 +00:00
require_relative " rake.d/requirements "
2012-08-13 06:46:37 +00:00
require_relative " rake.d/extensions "
2013-12-25 12:00:28 +00:00
require_relative " rake.d/config "
2017-08-20 17:46:57 +00:00
$config = read_build_config
2016-04-10 13:22:19 +00:00
$verbose = ENV [ 'V' ] . to_bool
2018-03-10 09:25:05 +00:00
$run_show_start_stop = ! $verbose && c? ( 'RUN_SHOW_START_STOP' )
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
2018-12-04 20:13:17 +00:00
require_relative " rake.d/digest "
2010-09-04 15:14:50 +00:00
require_relative " rake.d/helpers "
require_relative " rake.d/target "
require_relative " rake.d/application "
2017-05-20 16:05:45 +00:00
require_relative " rake.d/installer "
2010-09-04 15:14:50 +00:00
require_relative " rake.d/library "
2018-02-26 19:37:34 +00:00
require_relative " rake.d/compilation_database "
2014-01-25 11:23:02 +00:00
require_relative " rake.d/format_string_verifier "
2016-03-22 09:20:12 +00:00
require_relative " rake.d/pch "
2016-02-28 09:49:57 +00:00
require_relative " rake.d/po "
2017-07-15 09:57:45 +00:00
require_relative " rake.d/source_tests "
2014-09-01 13:16:04 +00:00
require_relative " rake.d/tarball "
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
2016-05-05 14:06:06 +00:00
$building_for = {
2017-04-02 19:56:30 +00:00
:linux = > %r{ linux }i . match ( c ( :host ) ) ,
:macos = > %r{ darwin }i . match ( c ( :host ) ) ,
:windows = > %r{ mingw }i . match ( c ( :host ) ) ,
2016-05-05 14:06:06 +00:00
}
2015-08-15 16:53:12 +00:00
$build_mkvtoolnix_gui || = c? ( :USE_QT )
2015-03-27 09:04:33 +00:00
$build_tools || = c? ( :BUILD_TOOLS )
2012-04-16 11:55:09 +00:00
2010-07-27 17:27:06 +00:00
$programs = %w{ mkvmerge mkvinfo mkvextract mkvpropedit }
2012-04-16 11:55:09 +00:00
$programs << " mkvtoolnix-gui " if $build_mkvtoolnix_gui
2019-01-22 17:00:58 +00:00
$tools = %w{ ac3parser base64tool bluray_dump checksum diracparser ebml_validator hevc_dump hevcc_dump vc1parser }
2010-07-27 17:27:06 +00:00
2015-08-15 16:27:44 +00:00
$application_subdirs = { " mkvtoolnix-gui " = > " mkvtoolnix-gui/ " }
2018-01-07 11:41:49 +00:00
$applications = $programs . map { | name | " src/ #{ $application_subdirs [ name ] } #{ name } " + c ( :EXEEXT ) }
$manpages = $programs . map { | name | " doc/man/ #{ name } .1 " }
2015-05-30 09:11:08 +00:00
$manpages << " doc/man/mkvtoolnix-gui.1 " if $build_mkvtoolnix_gui
2010-07-27 17:27:06 +00:00
2015-03-30 23:32:37 +00:00
$system_includes = " -I. -Ilib -Ilib/avilib-0.6.10 -Isrc "
2017-02-13 20:37:29 +00:00
$system_includes += " -Ilib/utf8-cpp/source " if c? ( :UTF8CPP_INTERNAL )
$system_includes += " -Ilib/pugixml/src " if c? ( :PUGIXML_INTERNAL )
2014-12-05 11:35:39 +00:00
$system_libdirs = " -Llib/avilib-0.6.10 -Llib/librmff -Lsrc/common "
2015-08-15 16:27:44 +00:00
$source_directories = %w{ lib/avilib-0.6.10 lib/librmff src/common src/extract src/info src/input src/merge src/mkvtoolnix-gui src/mpegparser src/output src/propedit }
2015-03-31 18:45:06 +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' ) }
2016-02-28 09:49:57 +00:00
$all_app_po_files = FileList [ " po/*.po " ] . to_a . sort
$all_man_po_files = FileList [ " doc/man/po4a/po/*.po " ] . to_a . sort
$all_po_files = $all_app_po_files + $all_man_po_files
2010-07-27 17:27:06 +00:00
2015-04-14 19:29:09 +00:00
$gui_ui_files = FileList [ " src/mkvtoolnix-gui/forms/**/*.ui " ] . to_a
$gui_ui_h_files = $gui_ui_files . collect { | file | file . ext 'h' }
2015-04-03 13:07:27 +00:00
2018-08-14 13:06:05 +00:00
$dependency_dir = " #{ $source_dir } /rake.d/dependency.d "
2012-03-18 09:55:42 +00:00
$dependency_tmp_dir = " #{ $dependency_dir } /tmp "
2010-07-27 17:27:06 +00:00
2019-09-11 18:26:37 +00:00
$version_header_name = " #{ $build_dir } /src/common/mkvtoolnix_version.h "
2010-07-27 17:27:06 +00:00
$languages = {
2016-08-07 09:09:40 +00:00
:programs = > c ( :TRANSLATIONS ) . split ( / \ s+ / ) ,
2010-07-27 17:27:06 +00:00
:manpages = > c ( :MANPAGES_TRANSLATIONS ) . split ( / \ s+ / ) ,
}
$translations = {
2016-08-07 09:09:40 +00:00
:programs = > $languages [ :programs ] . collect { | language | " po/ #{ language } .mo " } ,
: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 = {
2018-08-14 13:06:05 +00:00
:programs = > FileList [ " #{ $source_dir } /po/*.po " ] . collect { | name | File . basename name , '.po' } ,
:manpages = > FileList [ " #{ $source_dir } /doc/man/po4a/po/*.po " ] . collect { | name | File . basename name , '.po' } ,
2010-07-27 17:27:06 +00:00
}
2010-07-27 19:49:51 +00:00
2015-08-29 16:57:30 +00:00
$unwrapped_po = %{ ca es eu it nl uk pl sr_RS@latin tr }
2015-03-24 12:14:55 +00:00
$po_multiple_sources = %{ sv }
2014-08-24 12:40:12 +00:00
2017-11-16 14:15:29 +00:00
$benchmark_sources = FileList [ " src/benchmark/*.cpp " ] . to_a if c? ( :GOOGLE_BENCHMARK )
2018-04-08 10:09:30 +00:00
$libmtxcommon_as_dll = $building_for [ :windows ] && %r{ shared }i . match ( c ( :host ) )
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 ) } "
2015-03-25 16:51:30 +00:00
cflags_common += " #{ c ( :WNO_INCONSISTENT_MISSING_OVERRIDE ) } #{ c ( :WNO_POTENTIALLY_EVALUATED_EXPRESSION ) } "
2015-04-28 11:21:40 +00:00
cflags_common += " #{ c ( :OPTIMIZATION_CFLAGS ) } -D_FILE_OFFSET_BITS=64 "
2015-02-12 13:35:48 +00:00
cflags_common += " -DMTX_LOCALE_DIR= \\ \" #{ c ( :localedir ) } \\ \" -DMTX_PKG_DATA_DIR= \\ \" #{ c ( :pkgdatadir ) } \\ \" -DMTX_DOC_DIR= \\ \" #{ c ( :docdir ) } \\ \" "
2019-10-07 22:44:08 +00:00
cflags_common += determine_stack_protector_flags
cflags_common += determine_optimization_cflags
cflags_common += " -g3 -DDEBUG " if c? ( :USE_DEBUG )
cflags_common += " -pg " if c? ( :USE_PROFILING )
cflags_common += " -fsanitize=undefined " if c? ( :USE_UBSAN )
cflags_common += " -fsanitize=address -fno-omit-frame-pointer " if c? ( :USE_ADDRSAN )
2015-04-28 18:43:37 +00:00
cflags_common += " -Ilib/libebml -Ilib/libmatroska " if c? ( :EBML_MATROSKA_INTERNAL )
2018-06-08 19:36:53 +00:00
cflags_common += " -Ilib/nlohmann-json/include " if c? ( :NLOHMANN_JSON_INTERNAL )
2018-11-19 22:40:53 +00:00
cflags_common += " -Ilib/fmt/include " if c? ( :FMT_INTERNAL )
2019-10-07 22:44:08 +00:00
cflags_common += " #{ c ( :MATROSKA_CFLAGS ) } #{ c ( :EBML_CFLAGS ) } #{ c ( :PUGIXML_CFLAGS ) } #{ c ( :CMARK_CFLAGS ) } #{ c ( :EXTRA_CFLAGS ) } #{ c ( :USER_CPPFLAGS ) } "
2017-07-06 18:18:38 +00:00
cflags_common += " -mno-ms-bitfields -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 " if $building_for [ :windows ] # 0x0601 = Windows 7/Server 2008 R2
2017-04-02 19:56:30 +00:00
cflags_common += " -march=i686 " if $building_for [ :windows ] && / i686 / . match ( c ( :host ) )
cflags_common += " -fPIC " if c? ( :USE_QT ) && ! $building_for [ :windows ]
cflags_common += " -DQT_STATICPLUGIN " if c? ( :USE_QT ) && $building_for [ :windows ]
2018-09-02 15:37:59 +00:00
cflags_common += " -DUSE_DRMINGW -I #{ c ( :DRMINGW_PATH ) } /include " if c? ( :USE_DRMINGW ) && $building_for [ :windows ]
2017-12-12 08:59:34 +00:00
cflags_common += " -DMTX_APPIMAGE " if c? ( :APPIMAGE_BUILD ) && ! $building_for [ :windows ]
2015-04-28 18:43:37 +00:00
cflags = " #{ cflags_common } #{ c ( :USER_CFLAGS ) } "
cxxflags = " #{ cflags_common } #{ c ( :STD_CXX ) } "
2019-04-13 15:21:30 +00:00
cxxflags += " -Wnon-virtual-dtor -Wextra -Wno-missing-field-initializers -Wunused -Wpedantic "
cxxflags += " -Woverloaded-virtual " if is_clang? # too many false positives in EbmlElement.h on g++ 8
2019-02-23 15:46:59 +00:00
cxxflags += " -Wno-maybe-uninitialized -Wlogical-op " if is_gcc?
2019-02-23 18:26:31 +00:00
cxxflags += " -Wshadow -Qunused-arguments -Wno-self-assign -Wno-mismatched-tags " if is_clang?
2019-02-23 15:46:59 +00:00
cxxflags += " -Wno-inconsistent-missing-override -Wno-potentially-evaluated-expression " if is_clang?
2019-04-12 16:35:38 +00:00
cxxflags += " -Wno-extra-semi " if is_clang? || check_compiler_version ( " gcc " , " 8.0.0 " )
2019-02-23 18:26:31 +00:00
cxxflags += " -Wmisleading-indentation -Wduplicated-cond " if check_compiler_version ( " gcc " , " 6.0.0 " )
2019-02-23 17:42:17 +00:00
cxxflags += " -Wshadow-compatible-local -Wduplicated-branches " if check_compiler_version ( " gcc " , " 7.0.0 " )
2019-08-08 17:03:16 +00:00
cxxflags += " -Wno-deprecated-copy " if check_compiler_version ( " gcc " , " 9.0.0 " )
2017-03-31 07:07:22 +00:00
cxxflags += " #{ c ( :QT_CFLAGS ) } #{ c ( :BOOST_CPPFLAGS ) } #{ c ( :USER_CXXFLAGS ) } "
2015-04-28 18:43:37 +00:00
2015-04-28 11:21:40 +00:00
ldflags = " "
2019-10-07 22:44:08 +00:00
ldflags += determine_stack_protector_flags
ldflags += " -pg " if c? ( :USE_PROFILING )
2019-02-23 15:46:59 +00:00
ldflags += " -fuse-ld=lld " if is_clang? && ! c ( :LLVM_LLD ) . empty?
2015-04-28 11:21:40 +00:00
ldflags += " -Llib/libebml/src -Llib/libmatroska/src " if c? ( :EBML_MATROSKA_INTERNAL )
2018-11-19 22:40:53 +00:00
ldflags += " -Llib/fmt/src " if c? ( :FMT_INTERNAL )
2019-10-07 22:44:08 +00:00
ldflags += " #{ c ( :EXTRA_LDFLAGS ) } #{ c ( :USER_LDFLAGS ) } #{ c ( :LDFLAGS_RPATHS ) } #{ c ( :BOOST_LDFLAGS ) } "
2017-04-02 19:56:30 +00:00
ldflags += " -Wl,--dynamicbase,--nxcompat " if $building_for [ :windows ]
2018-09-02 15:37:59 +00:00
ldflags += " -L #{ c ( :DRMINGW_PATH ) } /lib " if c? ( :USE_DRMINGW ) && $building_for [ :windows ]
2019-10-07 22:44:08 +00:00
ldflags += " -fsanitize=undefined " if c? ( :USE_UBSAN )
ldflags += " -fsanitize=address -fno-omit-frame-pointer " if c? ( :USE_ADDRSAN )
2019-01-26 11:02:55 +00:00
ldflags += " -headerpad_max_install_names " if $building_for [ :macos ]
2015-04-28 18:43:37 +00:00
2015-08-15 16:27:44 +00:00
windres = " "
2015-05-03 15:51:22 +00:00
windres += " -DMINGW_PROCESSOR_ARCH_AMD64=1 " if c ( :MINGW_PROCESSOR_ARCH ) == 'amd64'
2015-04-28 18:43:37 +00:00
2017-04-05 12:02:24 +00:00
mocflags = $building_for [ :macos ] ? " -DSYS_APPLE " : $building_for [ :windows ] ? " -DSYS_WINDOWS " : " "
2015-07-04 16:21:26 +00:00
2010-08-01 10:53:34 +00:00
$flags = {
2015-04-28 18:43:37 +00:00
:cflags = > cflags ,
:cxxflags = > cxxflags ,
2015-04-28 11:21:40 +00:00
:ldflags = > ldflags ,
2015-04-28 18:43:37 +00:00
:windres = > windres ,
2015-07-04 16:21:26 +00:00
:moc = > mocflags ,
2010-08-01 10:53:34 +00:00
}
2012-08-07 20:48:28 +00:00
2017-08-20 17:46:57 +00:00
setup_macos_specifics if $building_for [ :macos ]
2018-09-18 19:18:10 +00:00
setup_compiler_specifics
2017-08-20 17:46:57 +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
2016-08-07 09:09:40 +00:00
[ :programs , :manpages ] . each do | type |
2012-02-06 11:39:59 +00:00
value = c ( " AVAILABLE_LANGUAGES_ #{ type . to_s . upcase } " )
$available_languages [ type ] = value . split ( / \ s+ / ) unless value . empty?
end
end
2017-08-20 17:46:57 +00:00
def setup_macos_specifics
2018-06-25 15:59:11 +00:00
$macos_config = read_config_file ( " packaging/macos/config.sh " )
2017-08-20 17:46:57 +00:00
if ENV [ 'MACOSX_DEPLOYMENT_TARGET' ] . to_s . empty? && ! $macos_config [ :MACOSX_DEPLOYMENT_TARGET ] . to_s . empty?
ENV [ 'MACOSX_DEPLOYMENT_TARGET' ] = $macos_config [ :MACOSX_DEPLOYMENT_TARGET ]
end
end
2018-09-18 19:18:10 +00:00
def setup_compiler_specifics
2018-09-18 19:35:56 +00:00
if %r{ zapcc } . match ( c ( :CXX ) + c ( :CC ) )
# ccache and certain versions of zapcc don't seem to be playing well
# together. As zapcc's servers do the caching already, disable
# ccache if compiling with zapcc.
ENV [ 'CCACHE_DISABLE' ] = " 1 "
# zapcc doesn't support pre-compiled headers.
ENV [ 'USE_PRECOMPILED_HEADERS' ] = " 0 "
end
2018-09-18 19:18:10 +00:00
end
2019-10-07 22:44:08 +00:00
def determine_optimization_cflags
return " " if ! c? ( :USE_OPTIMIZATION )
return " -O1 " if is_clang? && ! check_compiler_version ( " clang " , " 3.8.0 " ) # LLVM bug 11962
return " -O2 -fno-ipa-icf " if $building_for [ :windows ] && check_compiler_version ( " gcc " , " 5.1.0 " ) && ! check_compiler_version ( " gcc " , " 7.2.0 " )
return " -O3 "
end
def determine_stack_protector_flags
return " -fstack-protector " if is_gcc? && ! check_compiler_version ( " gcc " , " 4.9.0 " )
return " -fstack-protector-strong " if check_compiler_version ( " gcc " , " 4.9.0 " ) || check_compiler_version ( " clang " , " 3.5.0 " )
return " "
end
2019-05-20 06:40:09 +00:00
def generate_helper_files
return unless c? ( :EBML_MATROSKA_INTERNAL )
2019-05-27 20:15:20 +00:00
ensure_file ( " lib/libebml/ebml/ebml_export.h " , " # define EBML_DLL_API \n " )
2019-05-20 06:40:09 +00:00
end
2010-07-26 11:30:59 +00:00
def define_default_task
2018-08-31 18:19:00 +00:00
if ! c ( :DEFAULT_TARGET ) . empty?
desc " Build target ' #{ c ( :DEFAULT_TARGET ) } ' by default "
task :default = > c ( :DEFAULT_TARGET )
return
end
2010-07-26 11:30:59 +00:00
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
2015-03-27 09:04:33 +00:00
targets << " apps:tools " if $build_tools
2017-04-23 16:37:26 +00:00
targets += ( c ( :ADDITIONAL_TARGETS ) || '' ) . split ( %r{ + } )
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?
2017-01-25 19:51:47 +00:00
targets << " manpages "
targets << " translations:manpages " if c? ( :PO4A_WORKS )
2010-07-26 11:30:59 +00:00
2010-07-26 19:31:57 +00:00
# Build translations for the programs
2016-08-07 09:09:40 +00:00
targets << " translations:programs "
2010-07-26 19:31:57 +00:00
2015-06-03 18:06:34 +00:00
# The Qt translation files: only for Windows
2017-04-02 19:56:30 +00:00
targets << " translations:qt " if $building_for [ :windows ] && ! c ( :LCONVERT ) . blank?
2015-06-03 18:06:34 +00:00
2015-11-21 14:07:39 +00:00
# Build ebml_validator by default when not cross-compiling as it is
# needed for running the tests.
targets << " apps:tools:ebml_validator " if c ( :host ) == c ( :build )
2017-11-16 14:15:29 +00:00
targets << " src/benchmark/benchmark " if c? ( :GOOGLE_BENCHMARK ) && ! $benchmark_sources . empty?
2010-07-27 13:08:23 +00:00
task :default = > targets do
2019-01-02 22:05:39 +00:00
build_duration = Time . now - $build_start
build_duration = sprintf ( " %02d:%02d.%03d " , ( build_duration / 60 ) . to_i , build_duration . to_i % 60 , ( build_duration * 1000 ) . to_i % 1000 )
puts " Done after #{ build_duration } . Enjoy :) "
2010-07-27 13:08:23 +00:00
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
2019-05-20 06:40:09 +00:00
generate_helper_files
2019-09-11 18:26:37 +00:00
update_version_number_include
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
2016-03-26 10:56:40 +00:00
# A helper task to check if there are any unstaged changes.
task :no_unstaged_changes do
has_changes = false
has_changes = true if ! system ( " git rev-parse --verify HEAD &> /dev/null " ) || $? . exitstatus != 0
has_changes = true if ! system ( " git update-index -q --ignore-submodules --refresh &> /dev/null " ) || $? . exitstatus != 0
has_changes = true if ! system ( " git diff-files --quiet --ignore-submodules &> /dev/null " ) || $? . exitstatus != 0
has_changes = true if ! system ( " git diff-index --cached --quiet --ignore-submodules HEAD -- &> /dev/null " ) || $? . exitstatus != 0
fail " There are unstaged changes; the operation cannot continue. " if has_changes
end
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 }
2014-07-26 17:15:18 +00:00
desc " Strip all apps "
task :strip = > $applications do
2016-03-26 11:34:52 +00:00
runq " strip " , nil , " #{ c ( :STRIP ) } #{ $applications . join ( ' ' ) } "
2014-07-26 17:15:18 +00:00
end
2011-10-16 17:43:10 +00:00
end
2010-07-25 19:41:08 +00:00
# Store compiler block for re-use
2017-01-07 15:29:15 +00:00
cxx_compiler = lambda do | * args |
t = args . first
2012-03-18 09:55:42 +00:00
create_dependency_dirs
2016-03-22 09:20:12 +00:00
source = t . source ? t . source : t . prerequisites . first
dep = dependency_output_name_for t . name
pchi = PCH . info_for_user ( source , t . name )
pchu = pchi . use_flags ? " #{ pchi . use_flags } " : " "
pchx = pchi . extra_flags ? " #{ pchi . extra_flags } " : " "
lang = pchi . language ? pchi . language : " c++ "
2019-07-08 16:30:09 +00:00
flags = $flags [ :cxxflags ]
if %r{ lib/fmt/ } . match ( source )
flags . gsub! ( %r{ -Wpedantic } , '' )
end
2016-03-22 09:20:12 +00:00
args = [
2016-03-26 11:34:52 +00:00
" cxx " , source ,
2019-07-08 16:30:09 +00:00
" #{ c ( :CXX ) } #{ flags } #{ pchu } #{ pchx } #{ $system_includes } -c -MMD -MF #{ dep } -o #{ t . name } -x #{ lang } #{ source } " ,
2016-03-22 09:20:12 +00:00
:allow_failure = > true
]
2018-02-26 19:37:34 +00:00
Mtx :: CompilationDatabase . add " directory " = > $source_dir , " file " = > source , " command " = > args [ 2 ]
2016-03-22 09:20:12 +00:00
if pchi . pretty_flags
2016-03-26 14:26:51 +00:00
PCH . runq ( * args [ 0 .. 2 ] , args [ 3 ] . merge ( pchi . pretty_flags ) )
2016-03-22 09:20:12 +00:00
else
runq ( * args )
end
2010-07-26 10:29:18 +00:00
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
2019-10-12 21:29:36 +00:00
qrc_compiler = lambda do | * args |
t = args [ 0 ]
sources = t . prerequisites
runq " rcc " , sources [ 0 ] , " #{ c ( :RCC ) } -o #{ t . name } #{ sources . join ( " " ) } "
end
2010-07-25 19:41:08 +00:00
# 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
2016-03-26 11:34:52 +00:00
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 |
2016-03-26 11:34:52 +00:00
runq " windres " , t . source , " #{ c ( :WINDRES ) } #{ $flags [ :windres ] } -o #{ t . name } #{ t . sources . join ( " " ) } "
2010-07-25 19:41:08 +00:00
end
2018-10-28 11:14:08 +00:00
rule '.xml' = > '.xml.erb' do | t |
process_erb ( t )
end
2011-11-23 23:50:00 +00:00
# Resources depend on the manifest.xml file for Windows builds.
2017-04-02 19:56:30 +00:00
if $building_for [ :windows ]
2011-11-23 23:50:00 +00:00
$programs . each do | program |
2018-10-28 11:14:08 +00:00
path = FileTest . directory? ( " src/ #{ program } " ) ? program : program . gsub ( / ^mkv / , '' )
2015-05-09 07:41:04 +00:00
icon = program == 'mkvinfo' ? 'share/icons/windows/mkvinfo.ico' : 'share/icons/windows/mkvtoolnix-gui.ico'
2018-10-28 11:14:08 +00:00
file " src/ #{ path } /resources.o " = > [ " src/ #{ path } /manifest.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 |
2018-12-04 15:46:35 +00:00
if ! %r{ doc/man } . match ( t . sources [ 0 ] )
runq_code " VERIFY-PO-FMT " , :target = > t . sources [ 0 ] do
FormatStringVerifier . new . verify t . sources [ 0 ]
end
end
2018-01-21 12:04:29 +00:00
runq " msgfmt " , t . source , " #{ c ( :MSGFMT ) } -c -o #{ t . name } #{ t . sources . join ( " " ) } "
2010-07-25 19:41:08 +00:00
end
2015-06-03 18:06:34 +00:00
if ! c ( :LCONVERT ) . blank?
rule '.qm' = > '.ts' do | t |
2016-03-26 11:34:52 +00:00
runq " lconvert " , t . source , " #{ c ( :LCONVERT ) } -o #{ t . name } -i #{ t . sources . join ( " " ) } "
2015-06-03 18:06:34 +00:00
end
end
2010-07-25 19:41:08 +00:00
# man pages from DocBook XML
2017-01-25 19:51:47 +00:00
rule '.1' = > '.xml' do | t |
filter = lambda do | code , lines |
2017-09-29 16:31:45 +00:00
if ( 0 == code ) && lines . any? { | line | / ^error|parser error /i . match ( line ) }
2017-01-25 19:51:47 +00:00
File . unlink ( t . name ) if File . exists? ( t . name )
result = 1
2017-10-11 13:13:48 +00:00
puts lines . join ( '' )
2017-09-29 16:31:45 +00:00
elsif 0 != code
result = code
puts lines . join ( '' )
2017-01-25 19:51:47 +00:00
else
result = 0
2017-09-29 16:31:45 +00:00
puts lines . join ( '' ) if $verbose
2012-02-25 14:05:14 +00:00
end
2017-01-25 19:51:47 +00:00
result
2010-10-31 14:40:45 +00:00
end
2010-12-26 00:50:21 +00:00
2017-07-22 13:37:14 +00:00
stylesheet = " #{ c ( :DOCBOOK_ROOT ) } /manpages/docbook.xsl "
if ! FileTest . exists? ( stylesheet )
puts " Error: the DocBook stylesheet ' #{ stylesheet } ' does not exist. "
exit 1
end
runq " xsltproc " , t . source , " #{ c ( :XSLTPROC ) } #{ c ( :XSLTPROC_FLAGS ) } -o #{ t . name } #{ stylesheet } #{ t . sources . join ( " " ) } " , :filter_output = > filter
2017-01-25 19:51:47 +00:00
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' )
2010-12-26 00:50:21 +00:00
end
2010-07-25 19:41:08 +00:00
end
# Qt files
rule '.h' = > '.ui' do | t |
2016-11-20 16:17:24 +00:00
runq " uic " , t . source , " #{ c ( :UIC ) } --translate QTR #{ t . sources . join ( " " ) } > #{ t . name } "
2010-07-25 19:41:08 +00:00
end
2012-04-09 15:48:38 +00:00
rule '.moc' = > '.h' do | t |
2016-03-26 11:34:52 +00:00
runq " moc " , t . source , " #{ c ( :MOC ) } #{ c ( :QT_CFLAGS ) } #{ $system_includes } #{ $flags [ :moc ] } -nw #{ t . source } > #{ t . name } "
2012-04-09 15:48:38 +00:00
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 |
2016-03-26 11:34:52 +00:00
runq 'etags' , nil , " #{ c ( :ETAGS ) } -o #{ t . name } #{ t . prerequisites . join ( " " ) } "
2010-07-26 11:06:24 +00:00
end
2012-03-26 18:19:14 +00:00
file " BROWSE " = > ( $all_sources + $all_headers ) do | t |
2016-03-26 11:34:52 +00:00
runq 'ebrowse' , nil , " #{ c ( :EBROWSE ) } -o #{ t . name } #{ t . prerequisites . join ( " " ) } "
2012-03-26 18:19:14 +00:00
end
2011-08-03 18:42:32 +00:00
file " doc/development.html " = > [ " doc/development.md " , " doc/pandoc-template.html " ] do | t |
2016-03-26 11:34:52 +00:00
runq " pandoc " , t . prerequisites . first , <<COMMAND
#{c(:PANDOC)} -o #{t.name} --standalone --from markdown_strict --to html --number-sections --table-of-contents --css=pandoc.css --template=doc/pandoc-template.html doc/development.md
COMMAND
2011-08-03 18:42:32 +00:00
end
2015-04-14 19:29:09 +00:00
file " po/mkvtoolnix.pot " = > $all_sources + $all_headers + $gui_ui_h_files + %w{ Rakefile } do | t |
sources = ( t . prerequisites . dup - %w{ Rakefile } ) . sort . uniq
keywords = %w{ --keyword=Y --keyword=NY:1,2 } # singular & plural forms returning std::string
keywords += %w{ --keyword=YT } # singular form returning translatable_string_c
keywords += %w{ --keyword=QTR } # singular form returning QString, used by uic
keywords += %w{ --keyword=QY --keyword=QNY:1,2 } # singular & plural forms returning QString
2015-12-24 09:11:10 +00:00
keywords += %w{ --keyword=QYH } # singular form returning HTML-escaped QString
2015-04-14 19:29:09 +00:00
2018-11-20 19:33:02 +00:00
flags = %w{ Y NY YT QTR QY QNY QYH } . map { | func | " --flag= #{ func } :1:no-c-format --flag= #{ func } :1:no-boost-format " } . join ( " " )
2016-07-10 15:44:39 +00:00
2019-04-11 07:12:35 +00:00
options = %w{ --default-domain=mkvtoolnix --from-code=UTF-8 --sort-output --language=c++ }
2015-04-14 19:29:09 +00:00
options += [ " '--msgid-bugs-address=Moritz Bunkus <moritz@bunkus.org>' " ]
options += [ " '--copyright-holder=Moritz Bunkus <moritz@bunkus.org>' " , " --package-name=MKVToolNix " , " --package-version= #{ c ( :PACKAGE_VERSION ) } " , " --foreign-user " ]
2018-11-20 19:33:02 +00:00
runq " xgettext " , t . name , " xgettext #{ keywords . join ( " " ) } #{ flags } #{ options . join ( " " ) } -o #{ t . name } #{ sources . join ( " " ) } "
2011-11-05 13:29:02 +00:00
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
2018-01-02 14:40:24 +00:00
puts_action " create " , :target = > " po/ #{ locale } .po "
2011-11-03 23:34:05 +00:00
File . open " po/ #{ locale } .po " , " w " do | out |
2015-09-29 19:37:44 +00:00
now = Time . now
email = ENV [ 'EMAIL' ]
email = " YOUR NAME < #{ email } > " unless / < / . match ( email )
header = <<EOT
2011-11-03 23:34:05 +00:00
# translation of mkvtoolnix.pot to #{ENV['LANGUAGE']}
# Copyright (C) #{now.year} Moritz Bunkus
2017-12-20 21:15:40 +00:00
# This file is distributed under the same license as the MKVToolNix package.
2011-11-03 23:34:05 +00:00
#
msgid " "
EOT
2015-09-29 19:37:44 +00:00
content = IO .
readlines ( " po/mkvtoolnix.pot " ) .
join ( " " ) .
gsub ( / \ A.*?msgid "" \ n /m , header ) .
gsub ( / ^"PO-Revision-Date:.*?$ /m , %{ "PO-Revision-Date: #{ now . strftime ( '%Y-%m-%d %H:%M%z' ) } \\ n" } ) .
gsub ( / ^"Last-Translator:.*?$ /m , %{ "Last-Translator: #{ email } \\ n" } ) .
gsub ( / ^"Language-Team:.*?$ /m , %{ "Language-Team: #{ ENV [ 'LANGUAGE' ] } <moritz@bunkus.org> \\ n" } ) .
gsub ( / ^"Language: \\ n"$ / , %{ "Language: #{ locale } \\ n" } )
out . puts content
2011-11-03 23:34:05 +00:00
end
2017-12-20 21:15:40 +00:00
puts " Remember to look up the plural forms in this document: \n http://docs.translatehouse.org/projects/localization-guide/en/latest/l10n/pluralforms.html "
2011-11-03 23:34:05 +00:00
end
2016-01-15 10:57:32 +00:00
def verify_format_strings languages
2014-01-25 11:23:02 +00:00
is_ok = true
languages .
collect { | language | " po/ #{ language } .po " } .
sort .
each do | file_name |
puts " VERIFY #{ file_name } "
is_ok && = FormatStringVerifier . new . verify file_name
end
2016-01-15 10:57:32 +00:00
is_ok
end
desc " Verify format strings in translations "
task " verify-format-strings " do
languages = ( ENV [ 'LANGUAGES' ] || '' ) . split ( / + / )
2016-08-07 09:09:40 +00:00
languages = $available_languages [ :programs ] if languages . empty?
2016-01-15 10:57:32 +00:00
exit 1 if ! verify_format_strings ( languages )
end
desc " Verify format strings in staged translations "
task " verify-format-strings-staged " do
languages = ` git --no-pager diff --cached --name-only ` .
split ( / \ n / ) .
select { | file | / po \/ .* \ .po$ / . match ( file ) } .
map { | file | file . gsub ( / .* \/ / , '' ) . gsub ( / \ .po / , '' ) }
if languages . empty?
puts " Error: Nothing staged "
exit 2
end
exit 1 if ! verify_format_strings ( languages )
2010-12-25 20:16:50 +00:00
end
2016-02-28 09:49:57 +00:00
$all_po_files . each do | po_file |
task " normalize-po- #{ po_file } " do
normalize_po po_file
end
end
desc " Normalize all .po files to a standard format "
task " normalize-po " = > $all_po_files . map { | e | " translations:normalize-po- #{ e } " }
2016-08-07 09:09:40 +00:00
[ :programs , :manpages ] . each { | type | task type = > $translations [ type ] }
2010-07-27 17:27:06 +00:00
2018-08-14 13:06:05 +00:00
task :qt = > FileList [ " #{ $source_dir } /po/qt/*.ts " ] . collect { | file | file . ext 'qm' }
2015-06-03 18:06:34 +00:00
2017-01-25 19:51:47 +00:00
if c? ( :PO4A_WORKS )
2017-10-13 19:35:16 +00:00
filter = lambda do | code , lines |
lines = lines . reject { | l | %r{ seems outdated.*differ between|please consider running po4a-updatepo|^$ }i . match ( l ) }
puts lines . join ( '' ) unless lines . empty?
code
end
2017-01-25 19:51:47 +00:00
$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 |
2017-10-13 19:35:16 +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 } " , :filter_output = > filter
2017-01-25 19:51:47 +00:00
end
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 "
2017-05-20 16:05:45 +00:00
task :update = > [ " translations:update:programs " , " translations:update:manpages " , " translations:update:translations " ]
2010-07-27 17:47:40 +00:00
namespace :update do
desc " Update the program's translation files "
2016-08-07 09:09:40 +00:00
task :programs = > [ " po/mkvtoolnix.pot " , ] + $available_languages [ :programs ] . collect { | language | " translations:update:programs: #{ language } " }
2010-07-27 17:47:40 +00:00
2016-08-07 09:09:40 +00:00
namespace :programs do
$available_languages [ :programs ] . each do | language |
2010-07-27 17:47:40 +00:00
task language = > " po/mkvtoolnix.pot " do | t |
po = " po/ #{ language } .po "
tmp_file = " #{ po } .new "
2014-08-24 12:40:12 +00:00
no_wrap = $unwrapped_po . include? ( language ) ? " " : " --no-wrap "
2016-03-26 11:34:52 +00:00
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
2016-02-28 09:49:57 +00:00
FileUtils . move tmp_file , po
normalize_po po
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
2017-01-25 19:51:47 +00:00
if c? ( :PO4A_WORKS )
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 "
$all_man_po_files . each do | po_file |
normalize_po po_file
end
2010-07-27 07:25:02 +00:00
end
end
2017-05-20 16:05:45 +00:00
desc " Update the Windows installer's translation files "
2017-05-20 17:17:17 +00:00
task :installer do | t |
Mtx :: Installer . update_all_translation_files
end
2016-03-26 11:15:11 +00:00
end
2016-02-21 10:23:13 +00:00
2016-03-26 11:15:11 +00:00
namespace :transifex do
2016-02-28 10:44:58 +00:00
transifex_pull_targets = {
" man-pages " = > [ ] ,
" programs " = > [ ] ,
}
2016-02-21 10:23:13 +00:00
2016-03-26 11:15:11 +00:00
transifex_push_targets = {
" man-pages " = > [ ] ,
" programs " = > [ ] ,
}
2016-02-28 10:44:58 +00:00
$all_po_files . each do | po_file |
2016-03-26 11:15:11 +00:00
language = / \/ ([^ \/ ]+) \ .po$ / . match ( po_file ) [ 1 ]
resource = / doc \/ man / . match ( po_file ) ? " man-pages " : " programs "
pull_target = " pull- #{ resource } - #{ language } "
push_target = " push- #{ resource } - #{ language } "
2016-02-21 10:23:13 +00:00
2016-03-26 11:15:11 +00:00
transifex_pull_targets [ resource ] << " translations:transifex: #{ pull_target } "
transifex_push_targets [ resource ] << " translations:transifex: #{ push_target } "
2016-02-21 10:23:13 +00:00
2016-03-29 12:57:08 +00:00
desc " Fetch and merge #{ resource } translations from Transifex ( #{ language } ) " if list_targets? ( " transifex " , " transifex_pull " )
2016-03-26 11:15:11 +00:00
task pull_target = > :no_unstaged_changes do
2016-02-28 10:44:58 +00:00
transifex_pull_and_merge resource , language
2016-02-21 10:23:13 +00:00
end
2016-03-26 11:15:11 +00:00
2016-03-29 12:57:08 +00:00
desc " Push #{ resource } translations to Transifex ( #{ language } ) " if list_targets? ( " transifex " , " transifex_push " )
2016-03-26 11:15:11 +00:00
task push_target = > :no_unstaged_changes do
transifex_remove_fuzzy_and_push resource , language
end
2016-02-21 10:23:13 +00:00
end
2016-02-28 10:44:58 +00:00
desc " Fetch and merge program translations from Transifex "
2016-03-26 11:15:11 +00:00
task " pull-programs " = > transifex_pull_targets [ " programs " ]
2016-02-28 10:44:58 +00:00
desc " Fetch and merge man page translations from Transifex "
2016-03-26 11:15:11 +00:00
task " pull-man-pages " = > transifex_pull_targets [ " man-pages " ]
2016-02-28 10:44:58 +00:00
desc " Fetch and merge all translations from Transifex "
2016-03-26 11:15:11 +00:00
task " pull " = > transifex_pull_targets . values . flatten
2016-12-16 15:23:59 +00:00
desc " Push program translation source file to Transifex "
task " push-programs-source " = > " po/mkvtoolnix.pot " do
runq " tx push " , " po/mkvtoolnix.pot " , " tx push -s -r mkvtoolnix.programs > /dev/null "
end
2016-12-19 22:55:57 +00:00
desc " Push man page translation source file to Transifex "
task " push-man-pages-source " = > " doc/man/po4a/po/mkvtoolnix.pot " do
runq " tx push " , " doc/man/po4a/po/mkvtoolnix.pot " , " tx push -s -r mkvtoolnix.man-pages > /dev/null "
end
2016-12-22 19:58:19 +00:00
desc " Push program translations to Transifex "
task " push-programs " = > transifex_push_targets [ " programs " ]
desc " Push man page translations to Transifex "
task " push-man-pages " = > transifex_push_targets [ " man-pages " ]
desc " Push all translations to Transifex "
task " push " = > transifex_push_targets . values . flatten
2010-07-27 07:25:02 +00:00
end
2015-03-24 12:20:18 +00:00
[ :stats , :statistics ] . each_with_index do | task_name , idx |
2010-07-27 07:25:02 +00:00
desc " Generate statistics about translation coverage " if 0 == idx
2015-03-24 12:20:18 +00:00
task task_name do
2010-07-27 07:25:02 +00:00
FileList [ " po/*.po " , " doc/man/po4a/po/*.po " ] . each do | name |
command = " msgfmt --statistics -o /dev/null #{ name } 2>&1 "
2016-03-28 09:32:00 +00:00
if $verbose
2016-03-26 11:34:52 +00:00
runq " msgfmt " , name , command , :allow_failure = > true
2010-07-27 07:25:02 +00:00
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
2015-10-25 09:29:56 +00:00
dir = language == 'en' ? '' : " / #{ language } "
xml = FileList [ " doc/man #{ dir } /*.xml " ] . to_a
html = xml . map { | name | name . ext ( " .html " ) }
xml . each do | name |
2019-08-06 18:42:43 +00:00
file name . ext ( 'html' ) = > name do
2016-03-26 11:34:52 +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
2015-02-25 19:29:32 +00:00
task File . basename ( name , '.xml' ) = > name . ext ( 'html' )
2010-07-27 18:13:10 +00:00
end
2015-10-25 09:29:56 +00:00
task :all = > html
2010-07-27 18:13:10 +00:00
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'
2018-09-29 17:32:20 +00:00
qrc = " src/mkvtoolnix-gui/qt_resources.qrc "
puts_action " UPDATE " , :target = > qrc
2012-04-11 10:45:18 +00:00
2018-09-29 17:32:20 +00:00
doc = REXML :: Document . new File . new ( qrc )
doc . elements . to_a ( " /RCC/qresource/file " ) . select { | node | %r{ icons/ } . match ( node . text ) } . each ( & :remove )
2012-04-11 10:45:18 +00:00
2018-09-29 17:32:20 +00:00
parent = doc . elements . to_a ( " /RCC/qresource " ) [ 0 ]
icons = FileList [ " share/icons/*/*.png " ] . sort
seen = Hash . new
add_node = lambda do | name_to_add , name_alias |
2012-04-11 10:45:18 +00:00
node = REXML :: Element . new " file "
2018-09-29 17:32:20 +00:00
node . attributes [ " alias " ] = name_alias . gsub ( / share \/ / , '' )
node . text = " ../../ #{ name_to_add } "
2012-04-11 10:45:18 +00:00
parent << node
end
2018-09-29 17:32:20 +00:00
icons . each do | file |
add_node . call ( file , file )
base_name = file . gsub ( %r{ .*/| \ .png$ } , '' )
size = file . gsub ( %r{ .*/( \ d+)x \ d+/.* } , '\1' ) . to_i
name_alias = file . gsub ( %r{ \ .png } , '@2x.png' )
double_size = size * 2
double_file = " share/icons/ #{ double_size } x #{ double_size } / #{ base_name } .png "
next unless FileTest . exists? ( double_file )
add_node . call ( double_file , name_alias )
seen [ file . gsub ( %r{ .*/icons } , 'icons' ) ] = true
end
output = " "
2012-04-11 10:45:18 +00:00
formatter = REXML :: Formatters :: Pretty . new 1
formatter . compact = true
formatter . width = 9999999
2018-09-29 17:32:20 +00:00
formatter . write doc , output
File . open ( qrc , " w " ) . write ( output . gsub ( %r{ + \ n } , " \n " ) )
warned = Hash . new
files = read_files ( %w{ ui cpp } . map { | ext | FileList [ " src/mkvtoolnix-gui/**/*. #{ ext } " ] . to_a . reject { | name | %r{ qt_resources \ .cpp$ } . match ( name ) } } . flatten )
files . each do | file , lines |
line_num = 0
lines . each do | line |
line_num += 1
line . scan ( %r{ icons/ \ d+x \ d+/.*? \ .png } ) do | icon |
next if seen [ icon ] || warned [ icon ]
next if %r{ % } . match ( icon )
puts " Warning: no double-sized variant found for ' #{ icon } ' (found first in ' #{ file } : #{ line_num } ') "
warned [ icon ] = true
end
end
end
2012-04-11 10:45:18 +00:00
end
2015-04-03 13:07:27 +00:00
desc " Update Qt project file "
task " update-qt-project " do
2015-06-06 10:09:50 +00:00
project_file = " src/mkvtoolnix-gui/mkvtoolnix-gui.pro "
2015-04-03 13:07:27 +00:00
content = [ ]
skipping = false
IO . readlines ( project_file ) . collect { | line | line . chomp } . each do | line |
content << line unless skipping
if / ^FORMS \ b / . match line
skipping = true
2015-06-06 10:09:50 +00:00
content << $gui_ui_files . collect { | ui | ui . gsub! ( / .*forms \/ / , 'forms/' ) ; " #{ ui } " } . sort . join ( " \\ \n " )
2015-04-03 13:07:27 +00:00
elsif skipping && / ^ \ s*$ / . match ( line )
skipping = false
content << line
end
end
File . open ( project_file , " w " ) do | file |
file . puts content . join ( " \n " )
end
end
2012-04-11 10:45:18 +00:00
end
2014-09-01 13:16:04 +00:00
desc " Create source code tarball from current version in .. "
task :tarball do
create_source_tarball
end
desc " Create source code tarball from current version in .. with git revision in name "
task " tarball-rev " do
revision = ` git rev-parse --short HEAD ` . chomp
create_source_tarball " - #{ revision } "
end
2018-01-01 10:02:38 +00:00
desc " Dump dependencies of the task given with TASK environment variable "
task " dependencies " do
if ENV [ 'TASK' ] . blank?
puts " 'TASK' environment variable not set "
exit 1
end
task = Rake :: Task [ ENV [ 'TASK' ] ]
if ! task
puts " No task named ' #{ ENV [ 'MTASK' ] } ' "
exit 1
end
prereqs = task . mo_all_prerequisites
longest = prereqs . map { | p | p [ 0 ] . length } . max
puts prereqs . map { | p | sprintf ( " %- #{ longest } s => %s " , p [ 0 ] , p [ 1 ] . sort . join ( " " ) ) } . join ( " \n " )
end
2012-04-11 10:45:18 +00:00
end
2010-07-27 07:25:02 +00:00
# Installation tasks
desc " Install all applications and support files "
2017-01-25 19:51:47 +00:00
targets = [ " install:programs " , " install:manpages " , " install:translations:programs " ]
targets += [ " install:translations:manpages " ] if c? ( :PO4A_WORKS )
targets += [ " install:shared " ] if c? ( :USE_QT )
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 |
2015-08-15 16:27:44 +00:00
File . basename name
2010-08-01 18:04:47 +00:00
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
2018-08-14 13:06:05 +00:00
install_data :mimepackagesdir , FileList [ " #{ $source_dir } /share/mime/*.xml " ]
2017-04-19 14:10:08 +00:00
if c? ( :USE_QT )
2018-08-09 13:22:33 +00:00
install_dir :appdatadir
2018-08-14 13:06:05 +00:00
install_data :desktopdir , " #{ $source_dir } /share/desktop/org.bunkus.mkvtoolnix-gui.desktop "
install_data :appdatadir , " #{ $source_dir } /share/metainfo/org.bunkus.mkvtoolnix-gui.appdata.xml "
2017-04-19 14:10:08 +00:00
end
2010-07-27 16:52:12 +00:00
2015-05-09 07:41:04 +00:00
wanted_apps = %w{ mkvmerge mkvtoolnix-gui 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
2018-08-14 13:06:05 +00:00
dirs_to_install = FileList [ " #{ $source_dir } /share/icons/* " ] . select { | dir | wanted_dirs [ dir . gsub ( / .*icons \/ / , '' ) . gsub ( / \/ .* / , '' ) ] } . sort . uniq
2012-04-11 10:00:48 +00:00
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
2017-04-05 11:28:25 +00:00
if c? ( :USE_QT )
sounds_dir = " #{ c ( :pkgdatadir ) } /sounds "
install_dir sounds_dir
2018-08-14 13:06:05 +00:00
install_data sounds_dir , FileList [ " #{ $source_dir } /share/sounds/* " ]
2017-04-05 11:28:25 +00:00
end
2010-07-27 16:52:12 +00:00
end
2010-08-01 18:04:47 +00:00
man_page_name_mapper = lambda do | name |
2015-08-15 16:27:44 +00:00
File . basename name
2010-08-01 18:04:47 +00:00
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
2017-01-25 19:51:47 +00:00
task :programs = > $translations [ :programs ] do
2016-08-07 09:09:40 +00:00
install_dir $languages [ :programs ] . collect { | language | " #{ c ( :localedir ) } / #{ language } /LC_MESSAGES " }
$languages [ :programs ] . 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
2017-01-25 19:51:47 +00:00
if c? ( :PO4A_WORKS )
task :manpages = > $translations [ :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
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
2016-03-28 09:32:00 +00:00
puts_action " clean "
2012-04-09 14:32:46 +00:00
patterns = %w{
2015-11-04 18:12:40 +00:00
** / * . a
** / * . autosave
** / * . deps
** / * . dll
** / * . exe
** / * . exe
** / * . mo
** / * . moc
** / * . moco
** / * . o
** / * . pot
** / * . qm
2018-10-28 11:14:08 +00:00
** / manifest . xml
2017-01-25 19:51:47 +00:00
doc / man / * . 1
2015-11-04 18:12:40 +00:00
doc / man / * . html
2017-01-25 19:51:47 +00:00
doc / man / * / * . 1
2015-11-04 18:12:40 +00:00
doc / man / * / * . html
doc / man / * / * . xml
2019-05-20 06:40:09 +00:00
lib / libebml / ebml / ebml_export . h
2016-05-04 18:00:26 +00:00
src / * / qt_resources . cpp
2015-11-04 18:12:40 +00:00
src / info / ui / * . h
src / mkvtoolnix - gui / forms / ** / * . h
2017-11-16 14:15:29 +00:00
src / benchmark / benchmark
2015-11-04 18:12:40 +00:00
tests / unit / all
tests / unit / merge / merge
tests / unit / propedit / propedit
2012-04-09 14:32:46 +00:00
}
patterns += $applications + $tools . collect { | name | " src/tools/ #{ name } " }
2016-03-22 09:20:12 +00:00
patterns += PCH . clean_patterns
2019-09-11 18:26:37 +00:00
patterns << $version_header_name
2012-04-09 14:32:46 +00:00
2016-03-22 09:20:12 +00:00
remove_files_by_patterns patterns
2012-04-09 14:32:46 +00:00
if Dir . exists? $dependency_dir
2018-01-02 14:40:24 +00:00
puts_vaction " rm -rf " , :target = > " #{ $dependency_dir } "
2012-04-09 14:32:46 +00:00
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
2018-02-26 19:37:34 +00:00
run " rm -f config.h config.log config.cache build-config TAGS src/mkvtoolnix-gui/static_plugins.cpp #{ Mtx :: CompilationDatabase . database_file_name } " , :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
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 } " }
2016-03-22 09:20:12 +00:00
remove_files_by_patterns patterns
2013-07-04 19:04:29 +00:00
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
2016-06-04 08:49:38 +00:00
desc " Run product tests from 'tests' sub-directory (requires data files to be present) "
2012-08-02 09:26:54 +00:00
task :products do
run " cd tests && ./run.rb "
end
2017-07-15 09:57:45 +00:00
desc " Run built-in tests on source code files "
task :source do
Mtx :: SourceTests . test_include_guards
end
2012-08-02 09:26:54 +00:00
end
2010-07-25 19:41:08 +00:00
#
# avilib-0.6.10
# librmff
# spyder's MPEG parser
# src/common
# src/input
# src/output
#
2018-04-08 10:09:30 +00:00
# libraries required for all programs via mtxcommon
$common_libs = [
2019-09-27 12:24:15 +00:00
:boost_filesystem ,
:boost_system ,
2018-04-08 10:09:30 +00:00
:magic ,
:flac ,
:z ,
:pugixml ,
:intl ,
:iconv ,
2018-11-18 16:18:56 +00:00
:fmt ,
2018-04-08 10:09:30 +00:00
]
$common_libs += [ :cmark ] if c? ( :USE_QT )
2018-09-02 15:37:59 +00:00
$common_libs += [ :exchndl ] if c? ( :USE_DRMINGW ) && $building_for [ :windows ]
2018-04-08 10:09:30 +00:00
if ! $libmtxcommon_as_dll
$common_libs += [
:matroska ,
:ebml ,
]
end
2019-09-27 15:27:16 +00:00
$common_libs += [ :CoreFoundation ] if $building_for [ :macos ]
2018-04-08 10:09:30 +00:00
2015-08-15 16:27:44 +00:00
[ { :name = > 'avi' , :dir = > 'lib/avilib-0.6.10' } ,
2018-11-19 22:40:53 +00:00
{ :name = > 'fmt' , :dir = > 'lib/fmt/src' } ,
2015-08-15 16:27:44 +00:00
{ :name = > 'rmff' , :dir = > 'lib/librmff' } ,
{ :name = > 'pugixml' , :dir = > 'lib/pugixml/src' } ,
{ :name = > 'mpegparser' , :dir = > 'src/mpegparser' } ,
2015-04-10 19:08:43 +00:00
{ :name = > 'mtxcommon' , :dir = > [ 'src/common' ] + FileList [ 'src/common/*' ] . select { | e | FileTest . directory? e } } ,
2015-08-15 16:27:44 +00:00
{ :name = > 'mtxinput' , :dir = > 'src/input' } ,
{ :name = > 'mtxoutput' , :dir = > 'src/output' } ,
{ :name = > 'mtxmerge' , :dir = > 'src/merge' , :except = > [ 'mkvmerge.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 ] ) .
2017-12-24 14:20:49 +00:00
only_if ( c? ( :USE_QT ) && ( lib [ :name ] == 'mtxcommon' ) ) .
2018-01-01 10:25:28 +00:00
qt_dependencies_and_sources ( " common " ) .
2017-12-24 14:20:49 +00:00
end_if .
2018-04-08 10:09:30 +00:00
only_if ( $libmtxcommon_as_dll && ( lib [ :name ] == 'mtxcommon' ) ) .
build_dll ( true ) .
libraries ( :matroska , :ebml , $common_libs , :qt ) .
end_if .
2010-07-25 19:41:08 +00:00
create
end
2018-04-08 10:09:30 +00:00
$common_libs . unshift ( :mtxcommon )
2018-01-01 13:31:36 +00:00
2015-02-18 10:44:45 +00:00
# custom libraries
$custom_libs = [
:static ,
]
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 " ) .
2017-04-02 19:56:30 +00:00
sources ( " src/merge/resources.o " , :if = > $building_for [ :windows ] ) .
2018-04-08 10:09:30 +00:00
libraries ( :mtxmerge , :mtxinput , :mtxoutput , :mtxmerge , $common_libs , :avi , :rmff , :mpegparser , :vorbis , :ogg , $custom_libs ) .
2010-07-25 19:41:08 +00:00
create
#
# mkvinfo
#
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 ) .
2018-01-07 11:41:49 +00:00
sources ( FileList [ " src/info/*.cpp " ] ) .
2017-04-02 19:56:30 +00:00
sources ( " src/info/resources.o " , :if = > $building_for [ :windows ] ) .
2018-01-07 11:41:49 +00:00
libraries ( $common_libs , $custom_libs ) .
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 " ) .
2017-04-02 19:56:30 +00:00
sources ( " src/extract/resources.o " , :if = > $building_for [ :windows ] ) .
2015-02-18 10:44:45 +00:00
libraries ( :mtxextract , $common_libs , :avi , :rmff , :vorbis , :ogg , $custom_libs ) .
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 " ) .
2017-04-02 19:56:30 +00:00
sources ( " src/propedit/resources.o " , :if = > $building_for [ :windows ] ) .
2015-02-18 10:44:45 +00:00
libraries ( :mtxpropedit , $common_libs , $custom_libs ) .
2010-07-25 19:41:08 +00:00
create
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
2019-10-12 21:29:36 +00:00
qrc = [ " src/mkvtoolnix-gui/qt_resources.qrc " ]
2019-11-08 10:12:53 +00:00
add_qrc_dependencies ( * qrc )
2019-10-12 21:29:36 +00:00
file " src/mkvtoolnix-gui/qt_resources.cpp " = > qrc , & qrc_compiler
2012-04-10 20:34:58 +00:00
Application . new ( " src/mkvtoolnix-gui/mkvtoolnix-gui " ) .
description ( " Build the mkvtoolnix-gui executable " ) .
aliases ( " mkvtoolnix-gui " ) .
2017-12-30 22:48:33 +00:00
qt_dependencies_and_sources ( " mkvtoolnix-gui " ) .
2019-10-12 21:29:36 +00:00
sources ( " src/mkvtoolnix-gui/qt_resources.cpp " ) .
2017-04-02 19:56:30 +00:00
sources ( " src/mkvtoolnix-gui/resources.o " , :if = > $building_for [ :windows ] ) .
2012-08-07 20:48:28 +00:00
libraries ( $common_libs , :qt ) .
2017-04-02 19:56:30 +00:00
libraries ( " -mwindows " , :powrprof , :if = > $building_for [ :windows ] ) .
2018-11-04 20:06:20 +00:00
libraries ( " -framework IOKit " , :if = > $building_for [ :macos ] ) .
2015-02-18 10:44:45 +00:00
libraries ( $custom_libs ) .
2012-04-09 15:48:38 +00:00
create
end
2017-11-16 14:15:29 +00:00
#
# benchmark
#
if c? ( :GOOGLE_BENCHMARK ) && ! $benchmark_sources . empty?
Application . new ( " src/benchmark/benchmark " ) .
description ( " Build the benchmark executable " ) .
aliases ( :benchmark , :bench ) .
sources ( $benchmark_sources ) .
2017-11-21 11:20:20 +00:00
libraries ( $common_libs , :benchmark , :qt ) .
2017-11-16 14:15:29 +00:00
create
end
2010-07-27 19:49:51 +00:00
#
# Applications in src/tools
#
2014-07-15 18:16:14 +00:00
namespace :apps do
task :tools = > $tools . collect { | name | " apps:tools: #{ name } " }
end
2010-07-27 19:49:51 +00:00
2014-07-15 18:16:14 +00:00
#
# tools: ac3parser
#
Application . new ( " src/tools/ac3parser " ) .
description ( " Build the ac3parser executable " ) .
aliases ( " tools:ac3parser " ) .
sources ( " src/tools/ac3parser.cpp " ) .
libraries ( $common_libs ) .
create
2012-02-25 18:23:02 +00:00
2014-07-15 18:16:14 +00:00
#
# tools: base64tool
#
Application . new ( " src/tools/base64tool " ) .
description ( " Build the base64tool executable " ) .
aliases ( " tools:base64tool " ) .
sources ( " src/tools/base64tool.cpp " ) .
libraries ( $common_libs ) .
create
2010-07-27 19:49:51 +00:00
2015-01-03 13:18:12 +00:00
#
# tools: checksum
#
Application . new ( " src/tools/checksum " ) .
description ( " Build the checksum executable " ) .
aliases ( " tools:checksum " ) .
sources ( " src/tools/checksum.cpp " ) .
libraries ( $common_libs ) .
create
2014-07-15 18:16:14 +00:00
#
# tools: diracparser
#
Application . new ( " src/tools/diracparser " ) .
description ( " Build the diracparser executable " ) .
aliases ( " tools:diracparser " ) .
sources ( " src/tools/diracparser.cpp " ) .
libraries ( $common_libs ) .
create
2010-07-27 19:49:51 +00:00
2014-07-15 18:16:14 +00:00
#
# 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 ( $common_libs ) .
create
2010-07-27 19:49:51 +00:00
2015-03-27 09:05:00 +00:00
#
# tools: hevc_dump
#
Application . new ( " src/tools/hevc_dump " ) .
description ( " Build the hevc_dump executable " ) .
aliases ( " tools:hevc_dump " ) .
sources ( " src/tools/hevc_dump.cpp " ) .
libraries ( $common_libs ) .
create
2017-03-19 17:44:00 +00:00
#
# tools: hevcs_dump
#
Application . new ( " src/tools/hevcc_dump " ) .
description ( " Build the hevcc_dump executable " ) .
aliases ( " tools:hevcc_dump " ) .
sources ( " src/tools/hevcc_dump.cpp " ) .
libraries ( $common_libs ) .
create
2014-07-15 18:16:14 +00:00
#
2019-01-22 17:00:58 +00:00
# tools: bluray_dump
2014-07-15 18:16:14 +00:00
#
2019-01-22 17:00:58 +00:00
Application . new ( " src/tools/bluray_dump " ) .
description ( " Build the bluray_dump executable " ) .
aliases ( " tools:bluray_dump " ) .
sources ( " src/tools/bluray_dump.cpp " ) .
2014-07-15 18:16:14 +00:00
libraries ( $common_libs ) .
create
2014-02-04 19:14:07 +00:00
2014-07-15 18:16:14 +00:00
#
# tools: vc1parser
#
Application . new ( " src/tools/vc1parser " ) .
description ( " Build the vc1parser executable " ) .
aliases ( " tools:vc1parser " ) .
sources ( " src/tools/vc1parser.cpp " ) .
libraries ( $common_libs ) .
create
2012-04-25 21:47:51 +00:00
2016-03-22 09:20:12 +00:00
# Engage pch system
PCH . engage ( & cxx_compiler )
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: