Fix vf_tcdump's compilation
[mplayer/kovensky.git] / build / init
blobf81fab9049d00cfb691a715220409207ef37b0c8
1 #!/usr/bin/env python
3 import os
4 from os import path
5 import sys
6 from optparse import OptionParser
7 from subprocess import check_call
9 from script.helpers import run_command, GitWrapper
11 option_helptext = \
12 """# Place each option on its own line. Empty lines and lines starting with '#'
13 # are ignored. The options do not need quoting, so you can have for example
14 # --extra-libs=-lfoo -lbar
15 # (and NOT --extra-libs='-lfoo -lbar').
16 """
18 mplayer_options = \
19 """# You can place options for MPlayer configure in this file.
21 """ + option_helptext
23 ffmpeg_options = \
24 """# You can place options for FFmpeg configure in this file.
26 """ + option_helptext
28 common_options = \
29 """# You can place options common for both MPlayer and FFmpeg configure in
30 # this file. This mainly makes sense for generic things like --cc.
32 """ + option_helptext
34 libass_options = \
35 """# You can place options for libass configure in this file.
37 """ + option_helptext
39 def create_helpfile(filename, text):
40 if not path.exists(filename):
41 f = open(filename, 'w')
42 f.write(text)
43 f.close()
45 def main():
46 usage = 'usage: %prog [options]'
47 parser = OptionParser(usage=usage)
48 parser.add_option('-s', '--shallow', action='store_true',
49 help='only shallow git clone (uses less bandwidth)')
50 parser.set_defaults(shallow=False)
51 opts, args = parser.parse_args()
52 if args:
53 parser.print_help()
54 sys.exit(1)
56 create_helpfile('mplayer_options', mplayer_options)
57 create_helpfile('ffmpeg_options', ffmpeg_options)
58 create_helpfile('common_options', common_options)
59 create_helpfile('libass_options', common_options)
61 os.chdir('..')
62 git = GitWrapper()
63 git.shallow = opts.shallow
65 check_call('git submodule init'.split())
66 if path.exists('build/ffmpeg-mt-enabled'):
67 git.submodule_clone('build/ffmpeg-mt')
68 else:
69 git.submodule_clone('build/ffmpeg')
70 git.submodule_clone('build/libass')
72 # Ensure sync, needed in addition what's done in submodule_clone() above
73 # at least if both ffmpeg and ffmpeg-mt dirs exist separately
74 def cmd():
75 check_call('git submodule sync'.split())
76 git.foreach_module(cmd)
77 # Init recursive submodules (libswscale under ffmpeg) - not trying to
78 # make this support shallow clones for now.
79 def cmd():
80 check_call('git submodule update --init'.split())
81 git.foreach_submodule(cmd)
83 main()