forked from hkrn/MMDAI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThorfile
More file actions
1478 lines (1272 loc) · 38.2 KB
/
Thorfile
File metadata and controls
1478 lines (1272 loc) · 38.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
require "rbconfig"
require "net/ftp"
require "net/https"
module Mmdai
module VCS
# included class must implement below methods
# * get_uri
# * get_directory_name
module SVN
include Thor::Actions
def checkout
if !options.key?("flag") then
run "svn checkout #{get_uri} #{File.dirname(__FILE__)}/#{get_directory_name}"
end
end
end # end of module SVN
# included class must implement below methods
# * get_uri
# * get_directory_name
# * get_tag_name
module Git
include Thor::Actions
def checkout
if !options.key?("flag") then
base = "#{File.dirname(__FILE__)}/#{get_directory_name}"
run "git clone #{get_uri} #{base}"
inside base do
run "git checkout #{get_tag_name}"
end
end
end
end # end of module Git
# included class must implement below methods
# * get_uri
# * get_directory_name
# * get_basename
# * get_filename
module Http
include Thor::Actions
def checkout
if !options.key?("flag") then
base = "#{File.dirname(__FILE__)}/#{get_directory_name}"
if not File.directory? base then
path = "#{File.dirname(__FILE__)}/#{get_filename}"
fetch_from_remote URI.parse(get_uri), path
run "tar xzf #{path}"
FileUtils.move "#{File.dirname(__FILE__)}/#{get_basename}", base
remove_file path
end
end
end
private
def fetch_from_remote(uri, path)
if uri.scheme === "http" or uri.scheme === "https" then
fetch_http uri, path
elsif uri.scheme === "ftp" then
fetch_ftp uri, path
else
raise ArgumentError, "Only http(s) or ftp is supported: #{uri}"
end
end
def fetch_ftp(uri, path)
Net::FTP.open uri.host do |ftp|
ftp.login
ftp.passive = true
ftp.chdir File.dirname uri.path
ftp.list File.basename(uri.path, ".tar.gz") + ".*"
ftp.getbinaryfile File.basename(uri.path), path
end
end
def fetch_http(uri, path, limit = 5)
raise ArgumentError, 'HTTP redirect too deep' if limit == 0
http = Net::HTTP.new uri.host
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
response = http.get uri.path
case response
when Net::HTTPRedirection
fetch_http URI.parse(response['location']), path, limit - 1
else
File.open path, "wb" do |writer|
writer.write response.body
end
end
end
end # end of module Http
end # end of module VCS
module Build
module Base
include Thor::Actions
INSTALL_ROOT_DIR = "install-root"
def get_build_directory(build_type)
"#{File.dirname(__FILE__)}/#{get_directory_name}/build-#{build_type.to_s}"
end
protected
def invoke_build(build_type, extra_options = {})
if options.key?("flag") then
print_build_options build_type, extra_options
puts
else
build_directory = get_build_directory build_type
build_options = get_build_options build_type, extra_options
empty_directory build_directory
start_build build_options, build_type, build_directory, extra_options
end
end
def invoke_clean
[ :debug, :release ].each do |build_type|
build_directory = get_build_directory build_type
start_clean build_directory
end
end
def make(argument = nil)
if argument == nil then
argument = "-j4"
end
run "make #{argument}"
end
def ninja_or_make(argument = nil)
if is_ninja? then
run "ninja #{argument}"
else
make(argument)
end
end
def is_ninja?
return ENV.key?("NINJA_BUILD")
end
def is_msvc?
return ENV.key?("VCINSTALLDIR")
end
def is_darwin?
return /^darwin/.match RbConfig::CONFIG["target_os"]
end
def is_executable?
return false
end
end # end of module Base
# included class must implement below methods
# * get_build_options
# * get_directory_name
# * get_arch_flag_for_configure
# * get_debug_flag_for_configure
# * run_msvc_build
module Configure
include Base
protected
def start_build(build_options, build_type, build_directory, extra_options)
configure = get_configure_string build_options, build_type
if is_darwin? then
[:i386, :x86_64].each do |arch|
arch_directory = "#{build_directory}_#{arch.to_s}"
arch_configure = configure
arch_configure += get_arch_flag_for_configure(arch)
arch_configure += " --prefix=#{arch_directory}"
inside arch_directory do
run arch_configure
make
make "install"
end
end
elsif is_msvc? then
run_msvc_build build_options, build_type, build_directory, extra_options
else
configure += "--prefix=#{build_directory}/#{INSTALL_ROOT_DIR}"
inside build_directory do
run configure
make
make "install"
end
end
end
def start_clean(build_directory)
[ :debug, :release ].each do |build_type|
build_directory = get_build_directory build_type
if is_darwin? then
[:i386, :x86_64].each do |arch|
arch_directory = "#{build_directory}_#{arch.to_s}"
inside arch_directory do
make "clean"
FileUtils.rmtree [ 'Makefile', INSTALL_ROOT_DIR ]
end
end
else
inside build_directory do
make "clean"
FileUtils.rmtree [ 'Makefile', INSTALL_ROOT_DIR ]
end
end
end
end
def get_configure_path
return "../configure"
end
def get_configure_string(build_options, build_type)
configure = get_configure_path
if build_type === :debug then
configure += " " + get_debug_flag_for_configure
end
configure += " "
return serialize_build_options(configure, build_options)
end
def serialize_build_options(configure, build_options)
build_options.each do |key, value|
if value.nil? then
configure += "--#{key.to_s.gsub(/_/, "-")} "
elsif value.is_a? Array
value.each do |item|
configure += "--#{key.to_s.gsub(/_/, "-")}=#{item} "
end
else
configure += "--#{key.to_s.gsub(/_/, "-")}=#{value} "
end
end
return configure
end
def make_universal_binaries(build_type, is_static)
if not is_darwin? then
return
end
base_path = "#{File.dirname(__FILE__)}/#{get_directory_name}/build-"
build_path = base_path + build_type.to_s
i386_directory = "#{build_path}_i386/lib"
x86_64_directory = "#{build_path}_x86_64/lib"
native_directory = "#{build_path}/#{INSTALL_ROOT_DIR}/lib"
empty_directory native_directory
target = is_static ? "*.a" : "*.dylib"
Dir.glob "#{i386_directory}/#{target}" do |library_path|
library = File.basename(library_path)
i386_library = [ i386_directory, library ].join('/')
x86_64_library = [ x86_64_directory, library ].join('/')
univ_library = [ native_directory, library ].join('/')
run "lipo -create -output #{univ_library} -arch i386 #{i386_library} -arch x86_64 #{x86_64_library}"
end
Dir.glob "#{native_directory}/*.#{target}" do |library_path|
File.unlink(library_path)
end
FileUtils.cp_r "#{build_path}_i386/include", "#{build_path}/#{INSTALL_ROOT_DIR}/include"
end
def print_build_options(build_type, extra_options = {})
puts get_configure_string get_build_options(build_type, extra_options), build_type
end
end # end of module Configure
# included class must implement below methods
# * get_build_options
# * get_directory_name
module CMake
include Base
protected
def start_build(build_options, build_type, build_directory, extra_options)
cmake = get_cmake build_options, build_type, build_directory, extra_options
inside build_directory do
run cmake
ninja_or_make
ninja_or_make "install"
end
end
def start_clean(build_directory)
inside build_directory do
ninja_or_make "clean"
FileUtils.rmtree [
'CMakeCache.txt',
'CMakeFiles',
'cmake_install.cmake',
'install_manifest.txt',
'Makefile',
INSTALL_ROOT_DIR
]
end
end
def get_cmake(build_options, build_type, build_directory, extra_options)
cmake = "cmake "
is_debug = build_type === :debug
build_options.merge!({
:build_shared_libs => (is_debug and not is_msvc?),
:cmake_build_type => (is_debug ? "Debug" : "Release"),
:cmake_c_flags => "",
:cmake_cxx_flags => "",
:cmake_install_prefix => "#{build_directory}/#{INSTALL_ROOT_DIR}",
:cmake_install_name_dir => "#{build_directory}/#{INSTALL_ROOT_DIR}/lib",
})
if build_type === :release and not is_msvc? then
add_cflags " -fvisibility=hidden -fvisibility-inlines-hidden", build_options
elsif build_type === :flascc then
add_cflags "-fno-rtti -O4", build_options
elsif build_type === :emscripten then
emscripten_path = ENV['EMSCRIPTEN']
cmake = "#{emscripten_path}/emconfigure cmake -DCMAKE_AR=#{emscripten_path}/emar "
elsif is_executable? then
build_options.delete :build_shared_libs
else
build_options[:library_output_path] = "#{build_directory}/lib"
end
if is_darwin? then
add_cflags " -F/Library/Frameworks -mmacosx-version-min=10.5", build_options
build_options[:cmake_osx_architectures] = "i386;x86_64"
end
return serialize_build_options cmake, build_options
end
def serialize_build_options(cmake, build_options)
build_options.each do |key, value|
cmake += "-D"
cmake += key.to_s.upcase
if !!value == value then
cmake += ":BOOL="
cmake += value ? "ON" : "OFF"
else
cmake += ":STRING='"
cmake += value
cmake += "'"
end
cmake += " "
end
if is_ninja? then
cmake += "-G Ninja "
end
cmake += ".."
return cmake
end
def print_build_options(build_type, extra_options = {})
puts get_cmake get_build_options(build_type, extra_options), build_type, nil, extra_options
end
def add_cflags(cflags, build_options)
build_options[:cmake_c_flags] += cflags
build_options[:cmake_cxx_flags] += cflags
end
end # end of module CMake
end # end of module Build
class Bullet < Thor
include Build::CMake
include VCS::SVN
desc "debug", "build bullet for debug"
method_options :flag => :boolean
def debug
checkout
invoke_build :debug
end
desc "release", "build bullet for release"
method_options :flag => :boolean
def release
checkout
invoke_build :release
end
desc "flascc", "build bullet for flascc (treats as release)"
method_options :flag => :boolean
def flascc
checkout
invoke_build :flascc
end
desc "emscripten", "build bullet for emscripten (treats as release)"
method_options :flag => :boolean
def emscripten
checkout
invoke_build :emscripten
end
desc "clean", "delete built bullet libraries"
def clean
invoke_clean
end
protected
def get_uri
return "http://bullet.googlecode.com/svn/tags/bullet-2.77"
end
def get_directory_name
return "bullet-src"
end
def get_build_options(build_type, extra_options)
return {
:build_demos => false,
:build_extras => false,
:install_libs => true
}
end
end # end of Bullet
class Assimp < Thor
include Build::CMake
include VCS::SVN
desc "debug", "build assimp for debug"
method_options :flag => :boolean
def debug
checkout
rewrite_cmake_file Regexp.compile("assimp\s+STATIC"), "assimp SHARED"
invoke_build :debug
end
desc "release", "build assimp for release"
method_options :flag => :boolean
def release
checkout
rewrite_cmake_file Regexp.compile("assimp\s+SHARED"), "assimp STATIC"
invoke_build :release
end
desc "flascc", "build assimp for flascc (treats as release)"
method_options :flag => :boolean
def flascc
checkout
invoke_build :flascc
end
desc "emscripten", "build bullet for emscripten (treats as release)"
method_options :flag => :boolean
def emscripten
checkout
invoke_build :emscripten
end
desc "clean", "delete built assimp libraries"
def clean
invoke_clean
end
protected
def get_uri
return "https://assimp.svn.sourceforge.net/svnroot/assimp/tags/2.0"
end
def get_directory_name
return "assimp-src"
end
def get_build_options(build_type, extra_options)
return {
:build_assimp_tools => false,
:enable_boost_workaround => true,
}
end
private
def rewrite_cmake_file(from, to)
path = "#{File.dirname(__FILE__)}/#{get_directory_name}/code/CMakeLists.txt"
gsub_file path, from, to
end
end # end of Assimp
class Libxml2 < Thor
include Build::Configure
include VCS::Http
desc "debug", "build libxml2 for debug"
method_options :flag => :boolean
def debug
checkout
invoke_build :debug
make_universal_binaries :debug, false
end
desc "release", "build libxml2 for release"
method_options :flag => :boolean
def release
checkout
invoke_build :release
make_universal_binaries :release, true
end
# use customized build rule
desc "clean", "delete built libxml2 libraries"
def clean
[ :debug, :release ].each do |build_type|
build_directory = get_build_directory build_type
inside build_directory do
make "clean"
FileUtils.rmtree [ 'Makefile', INSTALL_ROOT_DIR ]
end
end
end
protected
def get_uri
"ftp://xmlsoft.org/libxml2/#{get_filename}"
end
def get_basename
"libxml2-2.9.0"
end
def get_filename
"#{get_basename}.tar.gz"
end
def get_directory_name
return "libxml2-src"
end
def get_build_options(build_type, extra_options)
options = {
:without_iconv => nil,
:without_zlib => nil,
:without_python => nil,
:without_readline => nil,
:without_ftp => nil,
:without_html => nil,
:without_http => nil,
:without_c14n => nil,
:without_threads => nil,
:without_regexps => nil,
:without_valid => nil,
:without_xinclude => nil,
:without_xptr => nil,
:without_docbook => nil,
:without_push => nil,
:without_catalog => nil,
:without_schematron => nil,
:without_modules => nil
}
if build_type === :release then
options.merge!({
:disable_shared => nil,
:enable_static => nil
})
else
options.merge!({
:enable_shared => nil,
:disable_static => nil
})
end
return options
end
def get_arch_flag_for_configure(arch)
case arch
when :i386 then
return "CC='clang -m32'"
when :x86_64 then
return "CC='clang'"
else
return ""
end
end
def get_configure_path
return "../configure"
end
def get_debug_flag_for_configure
return ""
end
def get_directory_name
return "libxml2-src"
end
def run_msvc_build(build_options, build_type, build_directory, extra_options)
path = "#{File.dirname(__FILE__)}/#{get_directory_name}/win32"
inside path do
enable_debug = build_type === :debug ? "yes" : "no"
run "nmake /f Makefile.msvc clean"
run "cscript configure.js compiler=msvc prefix=..\\build-#{build_type}\\install-root debug=#{enable_debug} ftp=no http=no html=no catalog=no docb=no iconv=no icu=no iso8859x=no zlib=no lzma=no"
run "nmake /f Makefile.msvc"
run "nmake /f Makefile.msvc install"
end
end
end
class Zlib < Thor
include Build::CMake
include VCS::Http
desc "debug", "build zlib for debug"
method_options :flag => :boolean
def debug
checkout
invoke_build :debug
end
desc "release", "build zlib for release"
method_options :flag => :boolean
def release
checkout
invoke_build :release
end
desc "clean", "delete built zlib libraries"
def clean
invoke_clean
end
protected
def get_download_options
"http://prdownloads.sourceforge.net/libpng/zlib-1.2.7.tar.gz?download"
end
def get_basename
"zlib-1.2.7"
end
def get_filename
"#{get_basename}.tar.gz"
end
def get_build_options(build_type, extra_options)
return {}
end
def get_directory_name
return "zlib-src"
end
end
class Nvtt < Thor
include Build::CMake
include VCS::SVN
desc "debug", "build NVTT for debug"
method_options :flag => :boolean
def debug
checkout
invoke_build :debug
end
desc "release", "build NVTT for release"
method_options :flag => :boolean
def release
checkout
invoke_build :release
end
desc "flascc", "build NVTT for flascc (treats as release)"
method_options :flag => :boolean
def flascc
checkout
invoke_build :flascc
end
desc "emscripten", "build NVTT for emscripten (treats as release)"
method_options :flag => :boolean
def emscripten
checkout
invoke_build :emscripten
end
desc "clean", "delete built NVTT libraries"
def clean
invoke_clean
end
protected
def get_uri
return "http://nvidia-texture-tools.googlecode.com/svn/trunk"
end
def get_build_options(build_type, extra_options)
return {}
end
def get_directory_name
return "nvtt-src"
end
end # end of Nvtt
class Glew < Thor
include Build::Base
include VCS::Http
desc "debug", "build GLEW for debug"
method_options :flag => :boolean
def debug
checkout
start_build :debug, "debug"
end
desc "release", "build GLEW for release"
method_options :flag => :boolean
def release
checkout
start_build :release
end
desc "clean", "delete built GLEW libraries (do nothing)"
def clean
base = "#{File.dirname(__FILE__)}/#{get_directory_name}"
if is_msvc? then
inside "#{base}/build/vc10" do
run "msbuild glew.sln /t:clean"
end
else
inside base do
make "clean"
end
end
end
protected
def get_uri
"https://sourceforge.net/projects/glew/files/glew/1.9.0/glew-1.9.0.tgz/download"
end
def get_basename
"glew-1.9.0"
end
def get_filename
"glew-1.9.0.tgz"
end
def get_directory_name
return "glew-src"
end
private
def start_build(build_type, make_type = nil)
if !options.key?("flag") then
base = "#{File.dirname(__FILE__)}/#{get_directory_name}"
install_dir = "#{base}/build-#{build_type.to_s}/#{INSTALL_ROOT_DIR}"
rewrite_makefile base, build_type
inside base do
if is_msvc? then
inside "#{base}/build/vc10" do
run "msbuild glew.sln /t:build /p:configuration=#{build_type.to_s}"
end
else
ENV["GLEW_DEST"] = install_dir
make "uninstall"
make "clean"
make make_type
make "install"
delete_dynamic_libraries install_dir, build_type
end
end
end
end
def rewrite_makefile(base, build_type)
if is_darwin?
flags = "-arch i386 -arch x86_64"
config_file_to_rewrite = "#{base}/config/Makefile.darwin"
if build_type === :release then
gsub_file config_file_to_rewrite, Regexp.compile("^CFLAGS.EXTRA\s*=\s*-dynamic"),
"CFLAGS.EXTRA = #{flags} -dynamic"
gsub_file config_file_to_rewrite, Regexp.compile("^LDFLAGS.EXTRA\s*=\s*$"),
"LDFLAGS.EXTRA = #{flags}"
else
gsub_file config_file_to_rewrite, Regexp.compile("^CFLAGS.EXTRA\s*=\s*#{flags}\s*-dynamic"),
"CFLAGS.EXTRA = -dynamic"
gsub_file config_file_to_rewrite, Regexp.compile("^LDFLAGS.EXTRA\s*=\s*#{flags}$"),
"LDFLAGS.EXTRA = "
end
# disable stripping to create universal binary correctly
ENV["STRIP"] = ""
end
end
def delete_dynamic_libraries(install_dir, build_type)
# darwin cannot link GLEW (universalized) statically on release
if build_type === :release and not is_darwin? then
[ "lib", "lib64" ].each do |dir|
[ "so" ].each do |extension|
FileUtils.rmtree [ Dir.glob("#{install_dir}/#{dir}/libGLEW*.#{extension}*") ]
end
end
end
end
end # end of Glew
class Gli < Thor
include Build::Base
include VCS::Git
desc "debug", "build GLI for debug (doesn't build actually)"
def debug
checkout
end
desc "release", "build GLI for release (doesn't build actually)"
def release
checkout
end
desc "clean", "delete built GLM libraries (do nothing)"
def clean
end
protected
def get_uri
return "git://github.com/g-truc/gli.git"
end
def get_directory_name
return "gli-src"
end
def get_tag_name
return "0.4.1.0"
end
end # end of Gli
class Glm < Thor
include Build::Base
include VCS::Git
desc "debug", "build GLM for debug (doesn't build actually)"
def debug
checkout
end
desc "release", "build GLM for release (doesn't build actually)"
def release
checkout
end
desc "clean", "delete built GLM libraries (do nothing)"
def clean
end
protected
def get_uri
return "git://ogl-math.git.sourceforge.net/gitroot/ogl-math/ogl-math"
end
def get_directory_name
return "glm-src"
end
def get_tag_name
return "0.9.3.4"
end
end # end of Glm
class Libav < Thor
include Build::Configure
include VCS::Git
desc "debug", "build libav for debug"
method_options :flag => :boolean
def debug
checkout
invoke_build :debug
make_universal_binaries :debug, false
end
desc "release", "build libav for release"
method_options :flag => :boolean
def release
checkout
invoke_build :release
make_universal_binaries :release, false
end
desc "clean", "delete built libav libraries"
def clean
invoke_clean
end
protected
def get_uri
return "git://git.libav.org/libav.git"
end
def get_directory_name
return "libav-src"
end
def get_tag_name
return "v9.1"
end
def get_arch_flag_for_configure(arch)
case arch
when :i386 then
return "--arch=i386 --cc='clang -m32'"
when :x86_64 then
return "--arch=x86_64 --cc=clang"
else
return ""
end
end
def get_debug_flag_for_configure
return "--enable-debug=3 --disable-optimizations"
end
def get_build_options(build_type, extra_options)
return {
:enable_shared => nil,
:disable_static => nil,
:disable_avconv => nil,
:disable_avplay => nil,
:disable_avprobe => nil,
:disable_avserver => nil,
:disable_network => nil,
:disable_bzlib => nil,
:disable_libfreetype => nil,
:disable_libopenjpeg => nil,
:disable_decoders => nil,
:disable_decoder => ['h264'],
:enable_decoder => ['flac', 'h264', 'pcm_s16le'], # add h264 decoder (unused in app) to prevent link error
:disable_encoders => nil,
:enable_encoder => ['png', 'pcm_s16le', 'utvideo'],
:disable_parsers => nil,
:disable_demuxers => nil,
:enable_demuxer => ['aiff', 'flac', 'wav'],
:disable_muxers => nil,
:enable_muxer => ['avi', 'mov'],
:disable_protocols => nil,
:enable_protocol => ['file'],
:disable_filters => nil,
:disable_bsfs => nil,
:disable_indevs => nil,
:disable_outdevs => nil,
:enable_zlib => nil
}
end
end # end of Libav
class Icu < Thor
include Build::Configure
include VCS::Http
desc "debug", "build libICU for debug"
method_options :flag => :boolean
def debug
checkout
invoke_build :debug
end
desc "release", "build libICU for release"
method_options :flag => :boolean
def release
checkout
invoke_build :release
end
# use customized build rule
desc "clean", "delete built ICU libraries"
def clean
base = "#{File.dirname(__FILE__)}/#{get_directory_name}"
if is_msvc? then
inside "#{base}/source/allinone" do
run "msbuild allinone.sln /t:clean"
end
else
[ :debug, :release ].each do |build_type|
build_directory = get_build_directory build_type
inside build_directory do
make "clean"
FileUtils.rmtree [ 'Makefile', INSTALL_ROOT_DIR ]
end
end
end