Build system for the 'src/tools' directory

This commit is contained in:
Moritz Bunkus 2010-07-27 21:49:51 +02:00
parent 4da568c591
commit 82657735ce
3 changed files with 68 additions and 59 deletions

View File

@ -22,6 +22,7 @@ require "rake.d/library"
def setup_globals
$programs = %w{mkvmerge mkvinfo mkvextract mkvpropedit}
$programs << "mmg" if c?(:USE_WXWIDGETS)
$tools = %w{base64tool diracparser ebml_validator vc1parser}
$application_subdirs = { "mmg" => "mmg/" }
$applications = $programs.collect { |name| "src/#{$application_subdirs[name]}#{name}" + c(:EXEEXT) }
@ -56,6 +57,8 @@ def setup_globals
:manpages => FileList[ "#{$top_srcdir }/doc/man/po4a/po/*.po" ].collect { |name| File.basename name, '.po' },
:guides => FileList[ "#{$top_srcdir }/doc/guide/*/mkvmerge-gui.html" ].collect { |name| File.basename File.dirname(name) },
}
$build_tools ||= c?(:TOOLS)
end
def define_default_task
@ -64,6 +67,9 @@ def define_default_task
# The applications themselves
targets = $applications.clone
# Build the stuff in the 'src/tools' directory only if requested
targets << "apps:tools" if $build_tools
# The tags file -- but only if it exists already
targets << "TAGS" if File.exist? "TAGS"
@ -314,11 +320,12 @@ end
# Cleaning tasks
desc "Remove all compiled files"
task :clean do
tools = $tools.collect { |name| "src/tools/#{name}" }.join " "
run <<-SHELL, :allow_failure => true
rm -f *.o */*.o */*/*.o */lib*.a */*/lib*.a po/*.mo #{$applications.join(" ")}
rm -f *.o */*.o */*/*.o */lib*.a */*/lib*.a po/*.mo
*/*.exe */*/*.exe */*/*.dll */*/*.dll.a doc/guide/*/*.hhk
src/info/ui/*.h src/info/*.moc.cpp src/common/*/*.o
src/mmg/*/*.o
src/mmg/*/*.o #{$applications.join(" ")} #{tools}
SHELL
end
@ -453,3 +460,56 @@ if c?(:USE_WXWIDGETS)
libraries(:rpcrt4, :ole32, :shell32, "-mwindows", :if => c?(:MINGW)).
create
end
#
# Applications in src/tools
#
if $build_tools
namespace :apps do
task :tools => $tools.collect { |name| "apps:tools:#{name}" }
end
#
# tools: base64tool
#
Application.new("src/tools/base64tool").
description("Build the base64tool executable").
aliases("tools:base64tool").
sources("src/tools/base64tool.cpp").
libraries(:mtxcommon, :magic, :matroska, :ebml, :expat, :iconv, :intl, :boost_regex).
libraries(:rpcrt4, :if => c?(:MINGW)).
create
#
# tools: diracparser
#
Application.new("src/tools/diracparser").
description("Build the diracparser executable").
aliases("tools:diracparser").
sources("src/tools/diracparser.cpp").
libraries(:mtxcommon, :magic, :matroska, :ebml, :expat, :iconv, :intl, :boost_regex).
libraries(:rpcrt4, :if => c?(:MINGW)).
create
#
# tools: ebml_validator
#
Application.new("src/tools/ebml_validator").
description("Build the ebml_validator executable").
aliases("tools:ebml_validator").
sources("src/tools/ebml_validator.cpp", "src/tools/element_info.cpp").
libraries(:mtxcommon, :magic, :matroska, :ebml, :expat, :iconv, :intl, :boost_regex).
libraries(:rpcrt4, :if => c?(:MINGW)).
create
#
# tools: vc1parser
#
Application.new("src/tools/vc1parser").
description("Build the vc1parser executable").
aliases("tools:vc1parser").
sources("src/tools/vc1parser.cpp").
libraries(:mtxcommon, :magic, :matroska, :ebml, :expat, :iconv, :intl, :boost_regex).
libraries(:rpcrt4, :if => c?(:MINGW)).
create
end

View File

@ -1,57 +0,0 @@
all_with_tools:
+make -C .. TOOLS=1
APPLICATIONS += src/tools/base64tool$(EXEEXT) src/tools/diracparser$(EXEEXT) src/tools/vc1parser$(EXEEXT) src/tools/ebml_validator$(EXEEXT)
ALL_SOURCES += $(wildcard src/tools/*.cpp)
vc1parser_SOURCES = src/tools/vc1parser.cpp
vc1parser_OBJECTS = $(patsubst %.cpp,%.o,$(vc1parser_SOURCES))
vc1parser_DEPENDENCIES = $(DEP_COMMON)
vc1parser_LDADD = -lmtxcommon $(MAGIC_LIBS) -lmatroska -lebml \
-lz $(COMPRESSION_LIBRARIES) -lexpat $(ICONV_LIBS) \
$(LIBINTL_LIBS) $(LIBRPCRT) $(BOOST_REGEX_LIB)
diracparser_SOURCES = src/tools/diracparser.cpp
diracparser_OBJECTS = $(patsubst %.cpp,%.o,$(diracparser_SOURCES))
diracparser_DEPENDENCIES = $(DEP_COMMON)
diracparser_LDADD = -lmtxcommon $(MAGIC_LIBS) -lmatroska -lebml \
-lz $(COMPRESSION_LIBRARIES) -lexpat $(ICONV_LIBS) \
$(LIBINTL_LIBS) $(LIBRPCRT) $(BOOST_REGEX_LIB)
base64tool_SOURCES = src/tools/base64tool.cpp
base64tool_OBJECTS = $(patsubst %.cpp,%.o,$(base64tool_SOURCES))
base64tool_DEPENDENCIES += $(DEP_COMMON)
base64tool_LDADD = -lmtxcommon $(MAGIC_LIBS) -lmatroska -lebml -lexpat $(ICONV_LIBS) \
$(LIBINTL_LIBS) $(LIBRPCRT) $(BOOST_REGEX_LIB)
ebml_validator_SOURCES = src/tools/ebml_validator.cpp src/tools/element_info.cpp
ebml_validator_OBJECTS = $(patsubst %.cpp,%.o,$(ebml_validator_SOURCES))
ebml_validator_DEPENDENCIES = $(DEP_COMMON)
ebml_validator_LDADD = -lmtxcommon $(MAGIC_LIBS) -lmatroska -lebml \
-lz $(COMPRESSION_LIBRARIES) -lexpat $(ICONV_LIBS) \
$(LIBINTL_LIBS) $(LIBRPCRT) $(BOOST_REGEX_LIB)
base64tool: src/tools/base64tool$(EXEEXT)
src/tools/base64tool$(EXEEXT): $(base64tool_OBJECTS) $(base64tool_DEPENDENCIES)
@echo ' LINK ' $@
$(Q)$(LINK) -o $@ $(base64tool_OBJECTS) $(base64tool_LDADD)
diracparser: src/tools/diracparser$(EXEEXT)
src/tools/diracparser$(EXEEXT): $(diracparser_OBJECTS) $(diracparser_DEPENDENCIES)
@echo ' LINK ' $@
$(Q)$(LINK) -o $@ $(diracparser_OBJECTS) $(diracparser_LDADD)
vc1parser: src/tools/vc1parser$(EXEEXT)
src/tools/vc1parser$(EXEEXT): $(vc1parser_OBJECTS) $(vc1parser_DEPENDENCIES)
@echo ' LINK ' $@
$(Q)$(LINK) -o $@ $(vc1parser_OBJECTS) $(vc1parser_LDADD)
ebml_validator: src/tools/ebml_validator$(EXEEXT)
src/tools/ebml_validator$(EXEEXT): $(ebml_validator_OBJECTS) $(ebml_validator_DEPENDENCIES)
@echo ' LINK ' $@
$(Q)$(LINK) -o $@ $(ebml_validator_OBJECTS) $(ebml_validator_LDADD)

6
src/tools/Rakefile Normal file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env rake
# -*- mode: ruby; -*-
$build_tools = true
import File.dirname(__FILE__) + "/../../Rakefile"