From: Anton Mitrofanov Date: Tue, 14 Jul 2020 13:35:11 +0000 (+0200) Subject: configure: Add options for bash-completion install X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=375cc588225b235933f8eacf1201a609bf3d23a4;p=libx264 configure: Add options for bash-completion install --- diff --git a/Makefile b/Makefile index 1314dd91..730c4cd4 100644 --- a/Makefile +++ b/Makefile @@ -388,10 +388,6 @@ distclean: clean install-cli: cli $(INSTALL) -d $(DESTDIR)$(bindir) $(INSTALL) x264$(EXE) $(DESTDIR)$(bindir) -ifneq ($(BASHCOMPLETIONSDIR),) - $(INSTALL) -d $(DESTDIR)$(BASHCOMPLETIONSDIR) - $(INSTALL) -m 644 -T $(SRCPATH)/tools/bash-autocomplete.sh $(DESTDIR)$(BASHCOMPLETIONSDIR)/x264 -endif install-lib-dev: $(INSTALL) -d $(DESTDIR)$(includedir) $(DESTDIR)$(libdir)/pkgconfig @@ -414,6 +410,12 @@ else ifneq ($(SONAME),) $(INSTALL) -m 755 $(SONAME) $(DESTDIR)$(libdir) endif +install-bashcompletion: +ifneq ($(BASHCOMPLETIONSDIR),) + $(INSTALL) -d $(DESTDIR)$(BASHCOMPLETIONSDIR) + $(INSTALL) -m 644 -T $(SRCPATH)/tools/bash-autocomplete.sh $(DESTDIR)$(BASHCOMPLETIONSDIR)/x264 +endif + uninstall: rm -f $(DESTDIR)$(includedir)/x264.h $(DESTDIR)$(includedir)/x264_config.h $(DESTDIR)$(libdir)/libx264.a rm -f $(DESTDIR)$(bindir)/x264$(EXE) $(DESTDIR)$(libdir)/pkgconfig/x264.pc diff --git a/configure b/configure index 78aa1140..266fcffa 100755 --- a/configure +++ b/configure @@ -25,6 +25,9 @@ Configuration options: --system-libx264 use system libx264 instead of internal --enable-shared build shared library --enable-static build static library + --disable-bashcompletion disable installation of bash-completion script + --enable-bashcompletion force installation of bash-completion script + --bashcompletionsdir=DIR install bash-completion script in DIR [auto] --disable-opencl disable OpenCL features --disable-gpl disable GPL-only features --disable-thread disable multithreaded encoding @@ -363,6 +366,8 @@ cli="yes" cli_libx264="internal" shared="no" static="no" +bashcompletion="auto" +bashcompletionsdir="" avs="auto" lavf="auto" ffms="auto" @@ -439,6 +444,15 @@ for opt do --enable-static) static="yes" ;; + --disable-bashcompletion) + bashcompletion="no" + ;; + --enable-bashcompletion) + bashcompletion="yes" + ;; + --bashcompletionsdir=*) + bashcompletionsdir="$optarg" + ;; --disable-asm) asm="no" ;; @@ -1529,9 +1543,6 @@ fi if [ "$cli" = "yes" ]; then echo 'default: cli' >> config.mak echo 'install: install-cli' >> config.mak - if pkg_check bash-completion ; then - echo "BASHCOMPLETIONSDIR=$($PKGCONFIG --variable=completionsdir bash-completion)" >> config.mak - fi fi if [ "$shared" = "yes" ]; then @@ -1567,6 +1578,27 @@ if [ "$static" = "yes" ]; then echo 'install: install-lib-static' >> config.mak fi +if [ "$bashcompletion" = "auto" ]; then + if [ "$cli" = "no" ]; then + bashcompletion="no" + elif [[ -z "$bashcompletionsdir" && "$prefix" != "/usr" && "$prefix" != "/usr/"* ]]; then + bashcompletion="no" + fi +fi + +if [ "$bashcompletion" != "no" ]; then + if [ -z "$bashcompletionsdir" ] && pkg_check bash-completion ; then + bashcompletionsdir="$($PKGCONFIG --variable=completionsdir bash-completion)" + fi + if [ -n "$bashcompletionsdir" ]; then + bashcompletion="yes" + echo 'install: install-bashcompletion' >> config.mak + echo "BASHCOMPLETIONSDIR=$bashcompletionsdir" >> config.mak + else + bashcompletion="no" + fi +fi + cat > x264.pc << EOF prefix=$prefix exec_prefix=$exec_prefix @@ -1585,30 +1617,31 @@ filters="crop select_every" [ $swscale = yes ] && filters="resize $filters" cat > conftest.log <> config.log