Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 537 lines (448 sloc) 20.473 kb
513c26a @mbunkus First version of a rake based build system
authored
1 #!/usr/bin/env rake
2 # -*- mode: ruby; -*-
3
4da568c @mbunkus Automatically set number of threads from environment variable
authored
4 # Change to base directory before doing anything
0ae2a02 @mbunkus Output make-style chdir messages
authored
5 if FileUtils.pwd != File.dirname(__FILE__)
6 new_dir = File.absolute_path(File.dirname(__FILE__))
7 puts "Entering directory `#{new_dir}'"
8 Dir.chdir new_dir
9 end
ac8c0b0 @mbunkus Added Rakefiles to nearly every subdirectory
authored
10
4da568c @mbunkus Automatically set number of threads from environment variable
authored
11 # Set number of threads to use if it is unset and we're running with
12 # drake
13 if Rake.application.options.respond_to?(:threads) && [nil, 0, 1].include?(Rake.application.options.threads) && !ENV['DRAKETHREADS'].nil?
14 Rake.application.options.threads = ENV['DRAKETHREADS'].to_i
15 end
16
513c26a @mbunkus First version of a rake based build system
authored
17 require "pp"
18
bbf395a @mbunkus Split up the Rakefile into smaller units
authored
19 require "rake.d/extensions"
20 require "rake.d/config"
21 require "rake.d/helpers"
22 require "rake.d/target"
23 require "rake.d/application"
24 require "rake.d/library"
513c26a @mbunkus First version of a rake based build system
authored
25
8d7fc27 @mbunkus Enable dependecies
authored
26 def setup_globals
6719857 @mbunkus Renamed a lot of global variables
authored
27 $programs = %w{mkvmerge mkvinfo mkvextract mkvpropedit}
28 $programs << "mmg" if c?(:USE_WXWIDGETS)
8265773 @mbunkus Build system for the 'src/tools' directory
authored
29 $tools = %w{base64tool diracparser ebml_validator vc1parser}
e7f8944 @mbunkus Allow to specify the name of mmg's executable upon installation
authored
30 $mmg_bin = c(:MMG_BIN)
31 $mmg_bin = "mmg" if $mmg_bin.empty?
6719857 @mbunkus Renamed a lot of global variables
authored
32
33 $application_subdirs = { "mmg" => "mmg/" }
34 $applications = $programs.collect { |name| "src/#{$application_subdirs[name]}#{name}" + c(:EXEEXT) }
35 $manpages = $programs.collect { |name| "doc/man/#{name}.1" }
36
37 $system_includes = "-I. -Ilib -Ilib/avilib-0.6.10 -Ilib/utf8-cpp/source -Isrc"
38 $system_libdirs = "-Llib/avilib-0.6.10 -Llib/librmff -Lsrc/common -Lsrc/input -Lsrc/output -Lsrc/mpegparser"
39
40 $source_directories = %w{lib/avilib-0.6.10 lib/librmff src src/input src/output src/common src/common/chapters src/common/strings src/common/tags src/common/xml
41 src/mmg src/mmg/header_editor src/mmg/options src/mmg/tabs src/extract src/propedit src/merge src/info src/mpegparser}
42 $all_sources = $source_directories.collect { |dir| FileList[ "#{dir}/*.c", "#{dir}/*.cpp" ].to_a }.flatten
43 $all_headers = $source_directories.collect { |dir| FileList[ "#{dir}/*.h", ].to_a }.flatten
44 $all_objects = $all_sources.collect { |file| file.ext('o') }
45
46 $top_srcdir = c(:top_srcdir)
47 $dependency_dir = "#{$top_srcdir}/rake.d/dependecy.d"
48
49 $languages = {
50 :applications => c(:TRANSLATIONS).split(/\s+/),
51 :manpages => c(:MANPAGES_TRANSLATIONS).split(/\s+/),
52 :guides => c(:GUIDE_TRANSLATIONS).split(/\s+/),
53 }
54
55 $translations = {
21f6b4d @mbunkus Dependency fix for man page translations
authored
56 :applications => $languages[:applications].collect { |language| "po/#{language}.mo" },
57 :guides => $languages[:guides].collect { |language| "doc/guide/#{language}/mkvmerge-gui.hhk" },
58 :manpages => !c?(:PO4A_WORKS) ? [] : $languages[:manpages].collect { |language| $manpages.collect { |manpage| manpage.gsub(/man\//, "man/#{language}/") } }.flatten,
6719857 @mbunkus Renamed a lot of global variables
authored
59 }
60
61 $available_languages = {
62 :applications => FileList[ "#{$top_srcdir }/po/*.po" ].collect { |name| File.basename name, '.po' },
63 :manpages => FileList[ "#{$top_srcdir }/doc/man/po4a/po/*.po" ].collect { |name| File.basename name, '.po' },
64 :guides => FileList[ "#{$top_srcdir }/doc/guide/*/mkvmerge-gui.html" ].collect { |name| File.basename File.dirname(name) },
65 }
8265773 @mbunkus Build system for the 'src/tools' directory
authored
66
67 $build_tools ||= c?(:TOOLS)
6b849d5 @mbunkus Don't let env vars override the required {c,cxx,ld}flags
authored
68
69 cflags_common = "-Wall -Wno-comment -Wno-strict-aliasing #{c(:OPTIMIZATION_CFLAGS)} -D_FILE_OFFSET_BITS=64 #{c(:EXTRA_CFLAGS)} #{c(:DEBUG_CFLAGS)} #{c(:PROFILING_CFLAGS)} #{c(:MATROSKA_CFLAGS)} #{c(:EBML_CFLAGS)} #{c(:USER_CPPFLAGS)} -DPACKAGE=\\\"#{c(:PACKAGE)}\\\" -DVERSION=\\\"#{c(:VERSION)}\\\" -DMTX_LOCALE_DIR=\\\"#{c(:localedir)}\\\" -DMTX_PKG_DATA_DIR=\\\"#{c(:pkgdatadir)}\\\""
70 ldflags_extra = c?(:MINGW) ? '' : "-Wl,--enable-auto-import"
71 $flags = {
72 :cflags => "#{cflags_common} #{c(:USER_CFLAGS)}",
73 :cxxflags => "#{cflags_common} #{c(:WXWIDGETS_CFLAGS)} #{c(:QT_CFLAGS)} #{c(:BOOST_CPPFLAGS)} #{c(:USER_CXXFLAGS)}",
74 :cppflags => "#{c(:USER_CPPFLAGS)}",
75 :ldflags => "#{c(:EXTRA_LDFLAGS)} #{c(:PROFILING_LIBS)} #{c(:USER_LDFLAGS)} #{c(:LDFLAGS_RPATHS)} #{c(:BOOST_LDFLAGS)}",
76 }
8d7fc27 @mbunkus Enable dependecies
authored
77 end
78
b98b950 @mbunkus Enable building the man pages
authored
79 def define_default_task
80 desc "Build everything"
0f64075 @mbunkus Enable building mmg's guide
authored
81
82 # The applications themselves
b98b950 @mbunkus Enable building the man pages
authored
83 targets = $applications.clone
0f64075 @mbunkus Enable building mmg's guide
authored
84
8265773 @mbunkus Build system for the 'src/tools' directory
authored
85 # Build the stuff in the 'src/tools' directory only if requested
86 targets << "apps:tools" if $build_tools
87
0f64075 @mbunkus Enable building mmg's guide
authored
88 # The tags file -- but only if it exists already
b98b950 @mbunkus Enable building the man pages
authored
89 targets << "TAGS" if File.exist? "TAGS"
90
91 # Build man pages and translations?
6719857 @mbunkus Renamed a lot of global variables
authored
92 targets += [ "manpages", "translations:manpages" ] if c?(:XSLTPROC_WORKS)
b98b950 @mbunkus Enable building the man pages
authored
93
fc5d41c @mbunkus Enable building the translations
authored
94 # Build translations for the programs
6719857 @mbunkus Renamed a lot of global variables
authored
95 targets << "translations:applications"
fc5d41c @mbunkus Enable building the translations
authored
96
0f64075 @mbunkus Enable building mmg's guide
authored
97 # The GUI help
6719857 @mbunkus Renamed a lot of global variables
authored
98 targets << "translations:guides"
0f64075 @mbunkus Enable building mmg's guide
authored
99
4a2c0e1 @mbunkus A friendly message signalling completion
authored
100 task :default => targets do
101 puts "Done. Enjoy :)"
102 end
b98b950 @mbunkus Enable building the man pages
authored
103 end
104
8d7fc27 @mbunkus Enable dependecies
authored
105 # main
106 read_config
107 adjust_config
108 setup_globals
109 import_dependencies
513c26a @mbunkus First version of a rake based build system
authored
110
111 # Default task
b98b950 @mbunkus Enable building the man pages
authored
112 define_default_task
513c26a @mbunkus First version of a rake based build system
authored
113
c17b4d8 @mbunkus Put tasks into namespaces
authored
114 desc "Build all applications"
115 task :apps => $applications
513c26a @mbunkus First version of a rake based build system
authored
116
117 # Store compiler block for re-use
118 cxx_compiler = lambda do |t|
119 cxxflags = case
120 when !c?(:LIBMTXCOMMONDLL) then ''
121 when /src\/common/.match(t.name) then c(:CXXFLAGS_SRC_COMMON)
122 else c(:CXXFLAGS_NO_SRC_COMMON)
123 end
124
789b258 @mbunkus Proper handling of precompiled header compilation
authored
125 # t.sources is empty for a 'file' task (common_pch.h.o).
126 sources = t.sources.empty? ? [ t.prerequisites.first ] : t.sources
8d7fc27 @mbunkus Enable dependecies
authored
127
6b849d5 @mbunkus Don't let env vars override the required {c,cxx,ld}flags
authored
128 runq " CXX #{sources.first}", "#{c(:CXX)} #{$flags[:cxxflags]} #{$system_includes} #{cxxflags} -c -MMD -o #{t.name} #{sources.join(" ")}", :allow_failure => true
8d7fc27 @mbunkus Enable dependecies
authored
129 handle_deps t.name, last_exit_code
513c26a @mbunkus First version of a rake based build system
authored
130 end
131
132 # Precompiled headers
133 if c?(:USE_PRECOMPILED_HEADERS)
67769eb @mbunkus Use the proper name for pre-compiled header files
authored
134 $all_objects.each { |name| file name => "src/common/common_pch.h.gch" }
135 file "src/common/common_pch.h.gch" => "src/common/common_pch.h", &cxx_compiler
513c26a @mbunkus First version of a rake based build system
authored
136 end
137
138 # Pattern rules
139 rule '.o' => '.cpp', &cxx_compiler
140
141 rule '.o' => '.c' do |t|
6b849d5 @mbunkus Don't let env vars override the required {c,cxx,ld}flags
authored
142 runq " CC #{t.source}", "#{c(:CC)} #{$flags[:cflags]} #{$system_includes} -c -MMD -o #{t.name} #{t.sources.join(" ")}", :allow_failure => true
8d7fc27 @mbunkus Enable dependecies
authored
143 handle_deps t.name, last_exit_code
513c26a @mbunkus First version of a rake based build system
authored
144 end
145
146 rule '.o' => '.rc' do |t|
8d7fc27 @mbunkus Enable dependecies
authored
147 runq " WINDRES #{t.source}", "#{c(:WINDRES)} #{c(:WXWIDGETS_INCLUDES)} -Isrc/mmg -o #{t.name} #{t.sources.join(" ")}"
513c26a @mbunkus First version of a rake based build system
authored
148 end
149
150 rule '.mo' => '.po' do |t|
8d7fc27 @mbunkus Enable dependecies
authored
151 runq " MSGFMT #{t.source}", "msgfmt -o #{t.name} #{t.sources.join(" ")}"
513c26a @mbunkus First version of a rake based build system
authored
152 end
153
154 # HTML help book stuff
155 rule '.hhk' => '.hhc' do |t|
8d7fc27 @mbunkus Enable dependecies
authored
156 runq " GREP #{t.source}", "#{c(:GREP)} -v 'name=\"ID\"' #{t.sources.join(" ")} > #{t.name}"
513c26a @mbunkus First version of a rake based build system
authored
157 end
158
159 # man pages from DocBook XML
160 rule '.1' => '.xml' do |t|
8d7fc27 @mbunkus Enable dependecies
authored
161 runq "XSLTPROC #{t.source}", "#{c(:XSLTPROC)} #{c(:XSLTPROC_FLAGS)} -o #{t.name} #{c(:DOCBOOK_MANPAGES_STYLESHEET)} #{t.sources.join(" ")}"
513c26a @mbunkus First version of a rake based build system
authored
162 end
163
164 # Qt files
165 rule '.h' => '.ui' do |t|
8d7fc27 @mbunkus Enable dependecies
authored
166 runq " UIC #{t.source}", "#{c(:UIC)} #{t.sources.join(" ")} > #{t.name}"
513c26a @mbunkus First version of a rake based build system
authored
167 end
168
169 rule '.moc.cpp' => '.h' do |t|
8d7fc27 @mbunkus Enable dependecies
authored
170 runq " MOC #{t.source}", "#{c(:MOC)} #{c(:QT_CFLAGS)} #{t.sources.join(" ")} > #{t.name}"
513c26a @mbunkus First version of a rake based build system
authored
171 end
172
e45db1a @mbunkus Tag file creation
authored
173 # Tag files
174 desc "Create tags file for Emacs"
175 task :tags => "TAGS"
176
177 file "TAGS" => $all_sources do |t|
178 runq ' ETAGS', "#{c(:ETAGS)} -o #{t.name} #{t.prerequisites.join(" ")}"
179 end
180
6719857 @mbunkus Renamed a lot of global variables
authored
181 task :manpages => $manpages
182
c17b4d8 @mbunkus Put tasks into namespaces
authored
183 # Translations for the programs
184 namespace :translations do
185 desc "Create a template for translating the programs"
186 task :pot => "po/mkvtoolnix.pot"
187 file "po/mkvtoolnix.pot" => $all_sources + $all_headers do |t|
188 runq 'XGETTEXT', <<-COMMAND
189 xgettext --keyword=YT --keyword=Y --keyword=Z --keyword=TIP --default-domain=mkvtoolnix --from-code=UTF-8 -s --omit-header -o #{t.name} #{t.prerequisites.join(" ")}
190 COMMAND
191 end
192
6719857 @mbunkus Renamed a lot of global variables
authored
193 [ :applications, :manpages, :guides ].each { |type| task type => $translations[type] }
194
21f6b4d @mbunkus Dependency fix for man page translations
authored
195 $available_languages[:manpages].each do |language|
196 $manpages.each do |manpage|
197 name = manpage.gsub(/man\//, "man/#{language}/")
dde97d8 @mbunkus Missing dependency for creating translated .xml files for man pages
authored
198 file name => [ name.ext('xml'), "doc/man/po4a/po/#{language}.po" ]
199 file name.ext('xml') => [ manpage.ext('.xml'), "doc/man/po4a/po/#{language}.po" ] do |t|
200 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}"
201 end
21f6b4d @mbunkus Dependency fix for man page translations
authored
202 end
203 end
204
249e819 @mbunkus manpage translation update targets
authored
205 desc "Update all translation files"
206 task :update => [ "translations:update:applications", "translations:update:manpages" ]
207
208 namespace :update do
209 desc "Update the program's translation files"
210 task :applications => [ "po/mkvtoolnix.pot", ] + $available_languages[:applications].collect { |language| "translations:update:applications:#{language}" }
211
212 namespace :applications do
213 $available_languages[:applications].each do |language|
214 task language => "po/mkvtoolnix.pot" do |t|
215 po = "po/#{language}.po"
216 tmp_file = "#{po}.new"
217 runq "MSGMERGE #{po}", "msgmerge -q -s --no-wrap #{po} po/mkvtoolnix.pot > #{tmp_file}", :allow_failure => true
218
219 exit_code = last_exit_code
220 if 0 != exit_code
221 File.unlink tmp_file
222 exit exit_code
223 end
c17b4d8 @mbunkus Put tasks into namespaces
authored
224
225 if %w{es nl ru uk zh_CN zh_TW}.include? language
249e819 @mbunkus manpage translation update targets
authored
226 adjust_to_poedit_style tmp_file, po
c17b4d8 @mbunkus Put tasks into namespaces
authored
227 else
249e819 @mbunkus manpage translation update targets
authored
228 FileUtils.mv tmp_file, po
c17b4d8 @mbunkus Put tasks into namespaces
authored
229 end
230 end
249e819 @mbunkus manpage translation update targets
authored
231 end
232 end
c17b4d8 @mbunkus Put tasks into namespaces
authored
233
249e819 @mbunkus manpage translation update targets
authored
234 desc "Update the man pages' translation files"
235 task :manpages do
236 runq " PO4A doc/man/po4a/po4a.cfg", "#{c(:PO4A)} #{c(:PO4A_FLAGS)} doc/man/po4a/po4a.cfg"
237 %w{nl}.each do |language|
238 name = "doc/man/po4a/po/#{language}.po"
239 FileUtils.cp name, "#{name}.tmp"
240 adjust_to_poedit_style "#{name}.tmp", name
c17b4d8 @mbunkus Put tasks into namespaces
authored
241 end
242 end
243 end
244
245 [ :stats, :statistics ].each_with_index do |name, idx|
246 desc "Generate statistics about translation coverage" if 0 == idx
247 task name do
248 FileList["po/*.po", "doc/man/po4a/po/*.po"].each do |name|
249 command = "msgfmt --statistics -o /dev/null #{name} 2>&1"
250 if ENV["V"].to_bool
251 runq " MSGFMT #{name}", command, :allow_failure => true
252 else
253 puts "#{name} : " + `#{command}`.split(/\n/).first
254 end
255 end
256 end
257 end
258 end
259
32ac14b @mbunkus Tasks for creating HTML files from man pages
authored
260 # HTMLO generation for the man pages
261 targets = ([ 'en' ] + $languages[:manpages]).collect do |language|
262 dir = language == 'en' ? '' : "/#{language}"
263 FileList[ "doc/man#{dir}/*.xml" ].collect { |name| "man2html:#{language}:#{File.basename(name, '.xml')}" }
264 end.flatten
265
266 %w{manpages-html man2html}.each_with_index do |task_name, idx|
267 desc "Create HTML files for the man pages" if 0 == idx
268 task task_name => targets
269 end
270
271 namespace :man2html do
272 ([ 'en' ] + $languages[:manpages]).collect do |language|
273 namespace language do
274 dir = language == 'en' ? '' : "/#{language}"
275 FileList[ "doc/man#{dir}/*.xml" ].each do |name|
276 task File.basename(name, '.xml') => %w{manpages translations:manpages} do
277 runq "XSLTPROC #{name}", "xsltproc --nonet -o #{name.ext('html')} /usr/share/xml/docbook/stylesheet/nwalsh/html/docbook.xsl #{name}"
278 end
279 end
280 end
281 end
282 end
283
c17b4d8 @mbunkus Put tasks into namespaces
authored
284 # Installation tasks
285 desc "Install all applications and support files"
385f862 @mbunkus Install tasks
authored
286 targets = [ "install:programs", "install:manpages", "install:translations:manpages", "install:translations:applications", "install:translations:guides" ]
287 targets << "install:shared" if c?(:USE_WXWIDGETS)
288 task :install => targets
289
290 namespace :install do
e7f8944 @mbunkus Allow to specify the name of mmg's executable upon installation
authored
291 application_name_mapper = lambda do |name|
292 base = File.basename name
293 base == "mmg" ? $mmg_bin : base
294 end
295
385f862 @mbunkus Install tasks
authored
296 task :programs => $applications do
297 install_dir :bindir
e7f8944 @mbunkus Allow to specify the name of mmg's executable upon installation
authored
298 $applications.each { |application| install_program "#{c(:bindir)}/#{application_name_mapper[application]}", application }
385f862 @mbunkus Install tasks
authored
299 end
300
301 task :shared do
302 install_dir :desktopdir, :mimepackagesdir
303 install_data :desktopdir, FileList[ "#{$top_srcdir}/share/desktop/*.desktop" ]
304 install_data :mimepackagesdir, FileList[ "#{$top_srcdir}/share/mime/*.xml" ]
305
306 FileList[ "#{$top_srcdir}/share/icons/*" ].collect { |dir| File.basename dir }.select { |dir| dir != "windows" }.each do |dir|
307 install_dir "#{c(:icondir)}/#{dir}/apps"
308 install_data "#{c(:icondir)}/#{dir}/apps/", FileList[ "#{$top_srcdir}/share/icons/#{dir}/*.png" ]
309 end
310 end
311
e7f8944 @mbunkus Allow to specify the name of mmg's executable upon installation
authored
312 man_page_name_mapper = lambda do |name|
313 base = File.basename name
314 base == "mmg.1" ? "#{$mmg_bin}.1" : base
315 end
316
385f862 @mbunkus Install tasks
authored
317 task :manpages => $manpages do
318 install_dir :man1dir
e7f8944 @mbunkus Allow to specify the name of mmg's executable upon installation
authored
319 $manpages.each { |manpage| install_data "#{c(:man1dir)}/#{man_page_name_mapper[manpage]}", manpage }
385f862 @mbunkus Install tasks
authored
320 end
321
322 namespace :translations do
323 task :applications do
6719857 @mbunkus Renamed a lot of global variables
authored
324 install_dir $languages[:applications].collect { |language| "#{c(:localedir)}/#{language}/LC_MESSAGES" }
325 $languages[:applications].each do |language|
385f862 @mbunkus Install tasks
authored
326 install_data "#{c(:localedir)}/#{language}/LC_MESSAGES/mkvtoolnix.mo", "po/#{language}.mo"
327 end
328 end
329
330 task :manpages do
6719857 @mbunkus Renamed a lot of global variables
authored
331 install_dir $languages[:manpages].collect { |language| "#{c(:mandir)}/#{language}/man1" }
332 $languages[:manpages].each do |language|
e7f8944 @mbunkus Allow to specify the name of mmg's executable upon installation
authored
333 $manpages.each { |manpage| install_data "#{c(:mandir)}/#{language}/man1/#{man_page_name_mapper[manpage]}", manpage.sub(/man\//, "man/#{language}/") }
385f862 @mbunkus Install tasks
authored
334 end
335 end
336
337 task :guides do
6719857 @mbunkus Renamed a lot of global variables
authored
338 install_dir :pkgdatadir, $languages[:guides].collect { |language| "#{c(:pkgdatadir)}/guide/#{language}/images" }
385f862 @mbunkus Install tasks
authored
339
6719857 @mbunkus Renamed a lot of global variables
authored
340 $languages[:guides].each do |language|
385f862 @mbunkus Install tasks
authored
341 install_data "#{c(:pkgdatadir)}/guide/#{language}/", FileList[ "#{$top_srcdir}/doc/guide/#{language}/mkvmerge-gui.*" ]
342 install_data "#{c(:pkgdatadir)}/guide/#{language}/images/", FileList[ "#{$top_srcdir}/doc/guide/#{language}/images/*.gif" ]
343 end
344 end
345 end
346 end
c17b4d8 @mbunkus Put tasks into namespaces
authored
347
513c26a @mbunkus First version of a rake based build system
authored
348 # Cleaning tasks
354d777 @mbunkus A couple of descriptions for tasks
authored
349 desc "Remove all compiled files"
513c26a @mbunkus First version of a rake based build system
authored
350 task :clean do
8265773 @mbunkus Build system for the 'src/tools' directory
authored
351 tools = $tools.collect { |name| "src/tools/#{name}" }.join " "
8d7fc27 @mbunkus Enable dependecies
authored
352 run <<-SHELL, :allow_failure => true
67769eb @mbunkus Use the proper name for pre-compiled header files
authored
353 rm -f *.o */*.o */*/*.o */lib*.a */*/lib*.a */*/*.gch po/*.mo
0f64075 @mbunkus Enable building mmg's guide
authored
354 */*.exe */*/*.exe */*/*.dll */*/*.dll.a doc/guide/*/*.hhk
513c26a @mbunkus First version of a rake based build system
authored
355 src/info/ui/*.h src/info/*.moc.cpp src/common/*/*.o
8265773 @mbunkus Build system for the 'src/tools' directory
authored
356 src/mmg/*/*.o #{$applications.join(" ")} #{tools}
513c26a @mbunkus First version of a rake based build system
authored
357 SHELL
358 end
359
c17b4d8 @mbunkus Put tasks into namespaces
authored
360 namespace :clean do
361 desc "Remove all compiled and generated files ('tarball' clean)"
362 task :dist => :clean do
8d7fc27 @mbunkus Enable dependecies
authored
363 run "rm -f config.h config.log config.cache build-config Makefile */Makefile */*/Makefile TAGS", :allow_failure => true
364 run "rm -rf #{$dependency_dir}", :allow_failure => true
513c26a @mbunkus First version of a rake based build system
authored
365 end
366
c17b4d8 @mbunkus Put tasks into namespaces
authored
367 desc "Remove all compiled and generated files ('git' clean)"
368 task :maintainer => "clean:dist" do
369 run "rm -f configure config.h.in", :allow_failure => true
370 end
513c26a @mbunkus First version of a rake based build system
authored
371
c17b4d8 @mbunkus Put tasks into namespaces
authored
372 desc "Remove all compiled libraries"
373 task :libs do
374 run "rm -f */lib*.a */*/lib*.a */*/*.dll */*/*.dll.a", :allow_failure => true
375 end
513c26a @mbunkus First version of a rake based build system
authored
376
c17b4d8 @mbunkus Put tasks into namespaces
authored
377 [:apps, :applications, :exe].each_with_index do |name, idx|
378 desc "Remove all compiled applications" if 0 == idx
379 task name do
380 run "rm -f #{$applications.join(" ")} */*.exe */*/*.exe", :allow_failure => true
381 end
513c26a @mbunkus First version of a rake based build system
authored
382 end
32ac14b @mbunkus Tasks for creating HTML files from man pages
authored
383
384 %w{manpages-html man2html}.each do |name|
385 task name do
386 run "rm -f doc/man/*.html doc/man/*/*.html"
387 end
388 end
513c26a @mbunkus First version of a rake based build system
authored
389 end
390
391 #
392 # avilib-0.6.10
393 # librmff
394 # spyder's MPEG parser
395 # src/common
396 # src/input
397 # src/output
398 #
399
400 [ { :name => 'avi', :dir => 'lib/avilib-0.6.10' },
401 { :name => 'rmff', :dir => 'lib/librmff' },
402 { :name => 'mpegparser', :dir => 'src/mpegparser' },
403 { :name => 'mtxcommon', :dir => [ 'src/common', 'src/common/chapters', 'src/common/strings', 'src/common/tags', 'src/common/xml' ] },
404 { :name => 'mtxinput', :dir => 'src/input' },
405 { :name => 'mtxoutput', :dir => 'src/output' },
406 ].each do |lib|
407 Library.
408 new("#{[ lib[:dir] ].flatten.first}/lib#{lib[:name]}").
76288e2 @mbunkus Fix for Ruby 1.8
authored
409 sources([ lib[:dir] ].flatten, :type => :dir).
513c26a @mbunkus First version of a rake based build system
authored
410 build_dll(lib[:name] == 'mtxcommon').
411 libraries(:iconv, :z, :compression, :matroska, :ebml, :expat, :rpcrt4).
412 create
413 end
414
415 #
416 # mkvmerge
417 #
418
419 Application.new("src/mkvmerge").
354d777 @mbunkus A couple of descriptions for tasks
authored
420 description("Build the mkvmerge executable").
513c26a @mbunkus First version of a rake based build system
authored
421 aliases(:mkvmerge).
422 sources("src/merge", :type => :dir).
423 sources("src/merge/resources.o", :if => c?(:MINGW)).
424 libraries(:mtxinput, :mtxoutput, :mtxcommon, :magic, :matroska, :ebml, :avi, :rmff, :mpegparser, :flac, :vorbis, :ogg, :z, :compression, :expat, :iconv, :intl,
425 :boost_regex, :boost_filesystem, :boost_system).
426 create
427
428 #
429 # mkvinfo
430 #
431
432 $mkvinfo_ui_files = FileList["src/info/ui/*.ui"].to_a
433 file "src/info/qt_ui.o" => $mkvinfo_ui_files
434
435 Application.new("src/mkvinfo").
354d777 @mbunkus A couple of descriptions for tasks
authored
436 description("Build the mkvinfo executable").
513c26a @mbunkus First version of a rake based build system
authored
437 aliases(:mkvinfo).
438 sources(FileList["src/info/*.cpp"].exclude("src/info/qt_ui.cpp", "src/info/wxwidgets_ui.cpp")).
439 sources("src/info/resources.o", :if => c?(:MINGW)).
70b6d33 @mbunkus Fixes for compilation with mingw
authored
440 libraries(:mtxcommon, :magic, :matroska, :ebml, :expat, :intl, :iconv, :boost_regex, :boost_filesystem, :boost_system).
513c26a @mbunkus First version of a rake based build system
authored
441 only_if(c?(:USE_QT)).
442 sources("src/info/qt_ui.cpp", "src/info/qt_ui.moc.cpp", "src/info/rightclick_tree_widget.moc.cpp", $mkvinfo_ui_files).
443 libraries(:qt).
444 only_if(!c?(:USE_QT) && c?(:USE_WXWIDGETS)).
445 sources("src/info/wxwidgets_ui.cpp").
446 libraries(:wxwidgets).
447 create
448
449 #
450 # mkvextract
451 #
452
453 Application.new("src/mkvextract").
354d777 @mbunkus A couple of descriptions for tasks
authored
454 description("Build the mkvpropedit executable").
513c26a @mbunkus First version of a rake based build system
authored
455 aliases(:mkvextract).
456 sources("src/extract", :type => :dir).
457 sources("src/extract/resources.o", :if => c?(:MINGW)).
458 libraries(:mtxcommon, :magic, :matroska, :ebml, :avi, :rmff, :vorbis, :ogg, :z, :compression, :expat, :iconv, :intl, :boost_regex, :boost_filesystem, :boost_system).
459 create
460
461 #
462 # mkvpropedit
463 #
464
465 Application.new("src/mkvpropedit").
354d777 @mbunkus A couple of descriptions for tasks
authored
466 description("Build the mkvpropedit executable").
513c26a @mbunkus First version of a rake based build system
authored
467 aliases(:mkvpropedit).
468 sources("src/propedit", :type => :dir).
469 sources("src/propedit/resources.o", :if => c?(:MINGW)).
470 libraries(:mtxcommon, :magic, :matroska, :ebml, :avi, :rmff, :vorbis, :ogg, :z, :compression, :expat, :iconv, :intl, :boost_regex, :boost_filesystem, :boost_system).
471 create
472
473 #
474 # mmg
475 #
476
477 if c?(:USE_WXWIDGETS)
478 Application.new("src/mmg/mmg").
354d777 @mbunkus A couple of descriptions for tasks
authored
479 description("Build the mmg executable").
513c26a @mbunkus First version of a rake based build system
authored
480 aliases(:mmg).
481 sources("src/mmg", "src/mmg/header_editor", "src/mmg/options", "src/mmg/tabs", :type => :dir).
70b6d33 @mbunkus Fixes for compilation with mingw
authored
482 sources("src/mmg/mmg-resources.o", :if => c?(:MINGW)).
513c26a @mbunkus First version of a rake based build system
authored
483 libraries(:mtxcommon, :magic, :matroska, :ebml, :avi, :rmff, :vorbis, :ogg, :z, :compression, :expat, :iconv, :intl, :wxwidgets,
484 :boost_regex, :boost_filesystem, :boost_system).
70b6d33 @mbunkus Fixes for compilation with mingw
authored
485 libraries(:ole32, :shell32, "-mwindows", :if => c?(:MINGW)).
513c26a @mbunkus First version of a rake based build system
authored
486 create
487 end
8265773 @mbunkus Build system for the 'src/tools' directory
authored
488
489 #
490 # Applications in src/tools
491 #
492 if $build_tools
493 namespace :apps do
494 task :tools => $tools.collect { |name| "apps:tools:#{name}" }
495 end
496
497 #
498 # tools: base64tool
499 #
500 Application.new("src/tools/base64tool").
501 description("Build the base64tool executable").
502 aliases("tools:base64tool").
503 sources("src/tools/base64tool.cpp").
504 libraries(:mtxcommon, :magic, :matroska, :ebml, :expat, :iconv, :intl, :boost_regex).
505 create
506
507 #
508 # tools: diracparser
509 #
510 Application.new("src/tools/diracparser").
511 description("Build the diracparser executable").
512 aliases("tools:diracparser").
513 sources("src/tools/diracparser.cpp").
514 libraries(:mtxcommon, :magic, :matroska, :ebml, :expat, :iconv, :intl, :boost_regex).
515 create
516
517 #
518 # tools: ebml_validator
519 #
520 Application.new("src/tools/ebml_validator").
521 description("Build the ebml_validator executable").
522 aliases("tools:ebml_validator").
523 sources("src/tools/ebml_validator.cpp", "src/tools/element_info.cpp").
524 libraries(:mtxcommon, :magic, :matroska, :ebml, :expat, :iconv, :intl, :boost_regex).
525 create
526
527 #
528 # tools: vc1parser
529 #
530 Application.new("src/tools/vc1parser").
531 description("Build the vc1parser executable").
532 aliases("tools:vc1parser").
533 sources("src/tools/vc1parser.cpp").
534 libraries(:mtxcommon, :magic, :matroska, :ebml, :expat, :iconv, :intl, :boost_regex).
535 create
536 end
Something went wrong with that request. Please try again.