6 from optparse
import OptionParser
7 from subprocess
import check_call
9 from script
.helpers
import run_command
, GitWrapper
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').
19 """# You can place options for MPlayer configure in this file.
24 """# You can place options for FFmpeg configure in this file.
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.
34 def create_helpfile(filename
, text
):
35 if not path
.exists(filename
):
36 f
= open(filename
, 'w')
41 usage
= 'usage: %prog [options]'
42 parser
= OptionParser(usage
=usage
)
43 parser
.add_option('-s', '--shallow', action
='store_true',
44 help='only shallow git clone (uses less bandwidth)')
45 parser
.set_defaults(shallow
=False)
46 opts
, args
= parser
.parse_args()
51 create_helpfile('mplayer_options', mplayer_options
)
52 create_helpfile('ffmpeg_options', ffmpeg_options
)
53 create_helpfile('common_options', common_options
)
56 git
.shallow
= opts
.shallow
58 check_call('git submodule init'.split())
59 git
.submodule_clone('mplayer')
60 if path
.exists('ffmpeg-mt-enabled'):
61 git
.submodule_clone('ffmpeg-mt')
63 git
.submodule_clone('ffmpeg')
64 git
.submodule_clone('libass')
66 # Ensure sync, needed in addition what's done in submodule_clone() above
67 # at least if both ffmpeg and ffmpeg-mt dirs exist separately
69 check_call('git submodule sync'.split())
70 git
.foreach_module(cmd
)
71 # Init recursive submodules (libswscale under ffmpeg) - not trying to
72 # make this support shallow clones for now.
74 check_call('git submodule update --init'.split())
75 git
.foreach_submodule(cmd
)