Name:            cvs
Version:         1.11.23
Release:         53
Summary:         Version control system
License:         BSD and GPL+ and GPLv2+ and LGPLv2+ and zlib and Public Domain
URL:             http://cvs.nongnu.org/
Source0:         ftp://ftp.gnu.org/non-gnu/cvs/source/stable/%{version}/cvs-%{version}.tar.bz2
Source1:         cvs.xinetd
Source2:         cvs.pam
Source3:         cvs.sh
Source4:         cvs.csh
Source5:         cvs@.service
Source6:         cvs.socket
Source7:         cvs.target

Patch0:          cvs-1.11.23-cvspass.patch
Patch1:          cvs-1.11.19-extzlib.patch
Patch2:          cvs-1.11.19-netbsd-tag.patch
Patch3:          cvs-1.11.19-abortabort.patch
Patch4:          cvs-1.11.1p1-bs.patch
Patch5:          cvs-1.11.21-proxy.patch
Patch7:          cvs-1.11.19-logmsg.patch
Patch8:          cvs-1.11.19-tagname.patch
Patch9:          cvs-1.11.19-comp.patch
Patch11:         cvs-1.11.19-tmp.patch
Patch12:         cvs-1.11.21-pam.patch
Patch13:         cvs-1.11.21-diff.patch
Patch14:         cvs-1.11.21-diff-kk.patch
Patch15:         cvs-1.11.21-sort.patch
Patch17:         cvs-1.11.22-ipv6-proxy.patch
Patch19:         cvs-1.11.23-getline64.patch
Patch20:         cvs-1.11.22-stdinargs.patch
Patch21:         cvs-1.11.23-cve-2010-3846.patch
Patch22:         cvs-1.11.23-remove_undefined_date_from_cvs_1_header.patch
Patch23:         cvs-1.11.23-sanity.patch
Patch24:         cvs-1.11.23-make_make_check_sanity_testing_verbose.patch
Patch25:         cvs-1.11.23-Set-PAM_TTY-and-PAM_RHOST-on-PAM-authentication.patch
Patch26:         cvs-1.11.23-Back-port-KeywordExpand-configuration-keyword.patch
Patch27:         cvs-1.11.23-Allow-CVS-server-to-use-any-Kerberos-key-with-cvs-se.patch
Patch28:         cvs-1.11.23-Fix-proxy-response-parser.patch
Patch29:         cvs-1.11.23-doc-Add-mandatory-argument-to-sp.patch
Patch30:         cvs-1.11.23-crypt-2.diff
Patch31:         cvs-1.11.23-Pass-compilation-with-Wformat-security.patch
Patch32:         cvs-1.11.23-Fix-CVE-2017-12836.patch
Patch33:         cvs-1.11.23-Close-a-configuration-file-on-a-syntax-error.patch
Patch34:         cvs-1.11.23-Use-diff-label.patch

BuildRequires:   autoconf automake coreutils glibc-common gzip krb5-devel vim-minimal
BuildRequires:   libtool make pam-devel perl-generators systemd texinfo zlib-devel xinetd
Requires:        vim-minimal xinetd
%{?systemd_requires}

Provides:        cvs-inetd
Obsoletes:       cvs-inetd

%description
CVS is a version control system, an important component of Source Configuration
Management (SCM). Using it, you can record the history of sources files, and
documents. It fills a similar role to the free software RCS, PRCS, and Aegis packages.

%package 	     help
Summary:	     Documents for %{name}
Buildarch:	     noarch
Requires:	     man info
Provides:        cvs-doc
Obsoletes:       cvs-doc

%description     help
Man pages and other related documents.

%prep
%autosetup -n %{name}-%{version} -p1

%build
autoreconf --install
    PAM_CONFIG="--enable-pam"
    k5prefix=`krb5-config --prefix`
    CPPFLAGS=-I${k5prefix}/include/kerberosIV; export CPPFLAGS
    CFLAGS=-I${k5prefix}/include/kerberosIV; export CFLAGS
    LIBS="-lk5crypto"; export LIBS
    KRB_CONFIG="--with-gssapi --without-krb4 --enable-encryption"

%configure CFLAGS="$CFLAGS $RPM_OPT_FLAGS \
    -D_FILE_OFFSET_BITS=64 %-D_LARGEFILE64_SOURCE" \
    $PAM_CONFIG $KRB_CONFIG CSH=/bin/csh

%make_build

%install
%make_install

gzip %{buildroot}/%{_infodir}/cvs*

install -D -m 644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/xinetd.d/%{name}
mkdir -p %{buildroot}%{_localstatedir}/%{name}
install -D -m 644 %{SOURCE2} %{buildroot}/%{_sysconfdir}/pam.d/cvs
install -D -m 644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/profile.d/cvs.sh
install -D -m 644 %{SOURCE4} %{buildroot}/%{_sysconfdir}/profile.d/cvs.csh
install -p -m 644 -D %{SOURCE5} %{buildroot}%{_unitdir}/cvs\@.service
install -p -m 644 -D %{SOURCE6} %{buildroot}%{_unitdir}/cvs.socket
install -p -m 644 -D %{SOURCE7} %{buildroot}%{_unitdir}/cvs.target

%check
make check

%pre

%preun
%systemd_preun cvs.socket
%systemd_preun cvs.target

%post
%systemd_post cvs.socket

%postun
%systemd_postun_with_restart cvs.socket

%files
%defattr(-,root,root)
%license COPYING* AUTHORS
%doc BUGS DEVEL-CVS HACKING MINOR-BUGS NEWS PROJECTS TODO README
%config(noreplace) %{_sysconfdir}/pam.d/*
%config(noreplace) %{_sysconfdir}/profile.d/*
%config(noreplace) %{_sysconfdir}/xinetd.d/%{name}
%{_bindir}/cvs*
%dir %{_localstatedir}/%{name}
%{_unitdir}/*
%exclude %{_bindir}/rcs2log
%exclude %{_datadir}/%{name}

%files help
%license COPYING
%doc FAQ doc/RCSFILES doc/*.pdf
%{_mandir}/*/*
%{_infodir}/*.info*
%exclude %{_infodir}/dir

%changelog
* Tue Feb 11 2020 duyeyu <duyeyu@huawei.com> - 1.11.23-53
- Package init
