Name:		bash-completion
Summary:	Programmable completion for Bash
Summary(ja):	bash のプログラム可能な補完拡張
Version:	2.11
Release:	1%{?_dist_release}
Group:		system
Distribution:	Vine Linux
Vendor:		Project Vine

License:	GPLv2+
URL:		https://github.com/scop/bash-completion
Source0:	https://github.com/scop/bash-completion/releases/download/%{version}/bash-completion-%{version}.tar.xz
Patch0:		%{name}-1.99-noblacklist.patch
# patch for apt-rpm
Patch1000:	bash-completion-2.11-apt-cache.patch

BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildArch:      noarch

%description
bash-completion is a collection of shell functions that take advantage of
the programmable completion feature of bash.

%description -l ja
bash-completion は bash のプログラム可能な補完機能を利用し、
高機能な補完機能を bash に提供するシェル関数集です。

使用にあたっては ~/.bashrc に以下の行を追加してください。
. /etc/profile.d/bash_completion.sh


%prep
%setup -q
%patch0 -p1
%patch1000 -p1


%build
autoreconf -fiv
%configure
%{__make} %{?_smp_mflags}

cat <<EOF >redefine_filedir
# This is a copy of the _filedir function in bash_completion, included
# and (re)defined separately here because some versions of Adobe
# Reader, if installed, are known to override this function with an
# incompatible version, causing various problems.
#
# https://bugzilla.redhat.com/677446
# http://forums.adobe.com/thread/745833
 
EOF
sed -ne '/^_filedir\s*(/,/^}/p' bash_completion >>redefine_filedir


%install
%{__rm} -rf %{buildroot}
%{__make} install DESTDIR=%{buildroot}
install -Dpm 644 redefine_filedir \
    %{buildroot}%{_sysconfdir}/bash_completion.d/redefine_filedir
 
#remove for vine
rm %{buildroot}%{_datadir}/bash-completion/completions/{cowsay,cowthink}


%clean
%{__rm} -rf %{buildroot}


%files
%defattr(-,root,root)
%license COPYING
%doc AUTHORS README.md doc/*.txt
%config %{_sysconfdir}/profile.d/bash_completion.sh
%{_sysconfdir}/bash_completion.d/
%{_datadir}/bash-completion/
%{_datadir}/pkgconfig/bash-completion.pc
%{_datadir}/cmake/bash-completion


%changelog
* Wed Mar 03 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.11-1
- new upstream release.
- dropped Source3.
- added Patch3 for apt-rpm.

* Fri Oct  6 2017 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.7-2
- new upstream release
  (2.7-1 was used for vl6)
- fix incorrect changelog date....

* Fri Dec 27 2013 TANAKA hiroaki <mosaicist@jcom.home.ne.jp> 2.1-2
- rebuild with gcc-4.8

* Tue May 28 2013 TANAKA hiroaki mosaicist@jcom.home.ne.jp > 2.1-1
- source update
- Don't install nmcli completion >= Vine7

* Wed Jul 25 2012 TANAKA hiroaki mosaicist@jcom.home.ne.jp > 2.0-1
- source update
- merge bash-completion-2.0-redefine_filedir.bash from bash-completion-2.0-1.fc17

* Tue Feb  7 2012 TANAKA hiroaki <mosaicist@par.odn.ne.jp> 1.99-1
- initial build for Vine Linux based on bash-completion-1.99-1.fc17.src.rpm