mirror of https://github.com/mpv-player/mpv
build: generate and install zsh completion script
This commit is contained in:
parent
da27eceb85
commit
cc74bc3fec
10
old-makefile
10
old-makefile
|
@ -379,6 +379,9 @@ player/lua.c: player/lua/defaults.inc \
|
|||
player/lua/osc.inc \
|
||||
player/lua/options.inc
|
||||
|
||||
etc/_mpv: TOOLS/zsh.pl ./mpv
|
||||
./$< > $@
|
||||
|
||||
# ./configure must be rerun if it changed
|
||||
config.mak: configure
|
||||
@echo "############################################################"
|
||||
|
@ -450,12 +453,17 @@ install-mpv-config: etc/encoding-profiles.conf
|
|||
$(INSTALL) -d $(CONFDIR)
|
||||
$(INSTALL) -m 644 etc/encoding-profiles.conf $(CONFDIR)
|
||||
|
||||
install-data: install-mpv-icons install-mpv-desktop install-mpv-config
|
||||
install-mpv-zsh: etc/_mpv
|
||||
$(INSTALL) -d $(prefix)/share/zsh/vendor-completions
|
||||
$(INSTALL) -m 644 etc/_mpv $(prefix)/share/zsh/vendor-completions/
|
||||
|
||||
install-data: install-mpv-icons install-mpv-desktop install-mpv-config install-mpv-zsh
|
||||
|
||||
uninstall:
|
||||
$(RM) $(BINDIR)/mpv
|
||||
$(RM) $(MANDIR)/man1/mpv.1 $(MANDIR)/en/man1/mpv.1
|
||||
$(RM) $(prefix)/share/applications/mpv.desktop
|
||||
$(RM) $(prefix)/share/zsh/vendor-completions/_mpv
|
||||
$(RM) $(foreach size,$(ICONSIZES),$(prefix)/share/icons/hicolor/$(size)/apps/mpv.png)
|
||||
|
||||
clean:
|
||||
|
|
|
@ -9,6 +9,10 @@ def __matroska_cmd__(ctx, argument):
|
|||
return "${{BIN_PERL}} {0}/TOOLS/matroska.pl {1} ${{SRC}} > ${{TGT}}" \
|
||||
.format(ctx.srcnode.abspath(), argument)
|
||||
|
||||
def __zshcomp_cmd__(ctx, argument):
|
||||
return "${{BIN_PERL}} {0}/TOOLS/zsh.pl {1} > ${{TGT}}" \
|
||||
.format(ctx.srcnode.abspath(), argument)
|
||||
|
||||
def __file2string__(ctx, **kwargs):
|
||||
ctx(
|
||||
rule = __file2string_cmd__(ctx),
|
||||
|
@ -32,6 +36,15 @@ def __matroska_definitions__(ctx, **kwargs):
|
|||
**kwargs
|
||||
)
|
||||
|
||||
def __zshcomp__(ctx, **kwargs):
|
||||
ctx(
|
||||
rule = __zshcomp_cmd__(ctx, './mpv'),
|
||||
before = ("c",),
|
||||
name = os.path.basename(kwargs['target']),
|
||||
**kwargs
|
||||
)
|
||||
|
||||
BuildContext.file2string = __file2string__
|
||||
BuildContext.matroska_header = __matroska_header__
|
||||
BuildContext.matroska_definitions = __matroska_definitions__
|
||||
BuildContext.zshcomp = __zshcomp__
|
||||
|
|
4
wscript
4
wscript
|
@ -57,6 +57,10 @@ build_options = [
|
|||
'deps': [ 'dlopen' ],
|
||||
'default': 'disable',
|
||||
'func': check_true
|
||||
}, {
|
||||
'name': '--zsh-comp',
|
||||
'desc': 'zsh completion',
|
||||
'func': check_true,
|
||||
}, {
|
||||
'name': '--macosx-bundle',
|
||||
'desc': 'compilation of a Mac OS X Application bundle',
|
||||
|
|
|
@ -524,6 +524,12 @@ def build(ctx):
|
|||
if ctx.dependency_satisfied('pdf-build'):
|
||||
_build_pdf(ctx)
|
||||
|
||||
if ctx.dependency_satisfied('zsh-comp'):
|
||||
ctx.zshcomp(target = "etc/_mpv")
|
||||
ctx.install_files(
|
||||
ctx.env.DATADIR + '/zsh/vendor-completions',
|
||||
['etc/_mpv'])
|
||||
|
||||
ctx.install_files(
|
||||
ctx.env.DATADIR + '/applications',
|
||||
['etc/mpv.desktop'] )
|
||||
|
|
Loading…
Reference in New Issue