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.
32 # NOTE: Several people used --prefix here for some reason. Don't do that!
33 # The internal FFmpeg library created during the build is installed under
34 # the build tree by default and should not be placed anywhere else!
35 # If you want to specify a custom location for the final install that
36 # should be done in mplayer_options.
40 def create_helpfile(filename
, text
):
41 if not path
.exists(filename
):
42 f
= open(filename
, 'w')
47 usage
= 'usage: %prog [options]'
48 parser
= OptionParser(usage
=usage
)
49 parser
.add_option('-s', '--shallow', action
='store_true',
50 help='only shallow git clone (uses less bandwidth)')
51 parser
.add_option('--init-optionfiles-only', action
='store_true',
52 help='do nothing but create initial option files')
53 parser
.set_defaults(shallow
=False, init_optionfiles_only
=False)
54 opts
, args
= parser
.parse_args()
59 create_helpfile('mplayer_options', mplayer_options
)
60 create_helpfile('ffmpeg_options', ffmpeg_options
)
61 create_helpfile('common_options', common_options
)
62 if opts
.init_optionfiles_only
:
65 # If this looks like a new install enable FFmpeg-mt by default.
66 # The ffmpeg/.git check is to catch updates from old versions with no
67 # explicit ffmpeg-mt-disabled.
68 if not path
.exists('ffmpeg-mt-enabled') \
69 and not path
.exists('ffmpeg-mt-disabled') \
70 and not path
.exists('ffmpeg/.git'):
71 open('ffmpeg-mt-enabled', 'w').close()
74 git
.shallow
= opts
.shallow
76 check_call('git submodule init'.split())
77 git
.submodule_clone('mplayer')
78 if path
.exists('ffmpeg-mt-enabled'):
79 git
.submodule_clone('ffmpeg-mt')
81 git
.submodule_clone('ffmpeg')
82 git
.submodule_clone('libass')
84 # Ensure sync, needed in addition what's done in submodule_clone() above
85 # at least if both ffmpeg and ffmpeg-mt dirs exist separately
87 check_call('git submodule sync'.split())
88 git
.foreach_module(cmd
)
89 # Init recursive submodules (libswscale under ffmpeg) - not trying to
90 # make this support shallow clones for now.
92 check_call('git submodule update --init'.split())
93 git
.foreach_submodule(cmd
)