Summary:	A version control system
Summary(ja):	GNU Arch バージョンコントロールシステム
Name:		tla
Version:	1.3.5
Release:        1%{?_dist_release}
License:	GPLv2+
Group:		Development/Tools
URL:		http://www.gnu.org/software/gnu-arch/
Source0:	ftp://ftp.gnu.org/gnu/gnu-arch/%{name}-%{version}.tar.gz
Source1:	%{name}-generate-manpage.pl
Source2:	%{name}-gpg-check.1

Patch0:		%{name}-%{version}-alignment-hppa-sparc.patch
Patch1:		%{name}-%{version}-neon.patch
Patch2:		%{name}-%{version}-neon-327111.patch
Patch3:		%{name}-%{version}-posix.patch
Patch4:		%{name}-%{version}-remove-invariant.patch
Patch5:		%{name}-%{version}-segfault-ia64.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

Requires:	diffutils
Requires:	patch
Requires:	tar

BuildRequires:	check-devel
BuildRequires:	neon-devel

%description
GNU Arch 1 (also known as tla) is a revision control system, similar in
purpose to tools such as CVS, SCCS, and Subversion. It is used to keep track
of the changes made to a source tree and to help programmers combine and
otherwise manipulate changes made by multiple people or at different times.

TLA is a punning acronym that stands for either "true love, always" and "three
letter acronym".

%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1

# Build against neon-devel.
rm -rf ./src/libneon

# Suppress rpmlint error.
iconv --from-code ISO8859-1 --to-code UTF-8 ./src/tla/AUTHORS \
  --output AUTHORS.utf-8 && mv AUTHORS.utf-8 ./src/tla/AUTHORS
iconv --from-code ISO8859-1 --to-code UTF-8 ./src/tla/README \
  --output README.utf-8 && mv README.utf-8 ./src/tla/README

%build
# configure script and Makefiles are not generated by Autoconf/Automake.
mkdir -p ./build
pushd ./build
  ../src/configure \
  --prefix=%{_prefix} --with-install-link-tools=yes --with-cc=%{__cc}
  # Parallel make does not work.
  make CFLAGS="$RPM_OPT_FLAGS $(neon-config --cflags)"

  # Use only HTML and CSS files for documentation.
  # To be later listed against %doc.
  mkdir -p ./docs-tla
  pushd ./docs-tla
  find ../../src/docs-tla -name "*.css" -o -name "*.html" \
  | xargs tar --atime-preserve -cf- \
  | tar --atime-preserve -xf-
  popd
popd

# man page
mkdir -p ./debian/tmp
PATH="`pwd`/build/tla/tla:$PATH" perl %{SOURCE1} tla.1

%check
pushd ./build
  make test CFLAGS="$RPM_OPT_FLAGS $(neon-config --cflags)"
popd

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1

pushd ./build
  # Makefiles use destdir instead of DESTDIR.
  make install CFLAGS="$RPM_OPT_FLAGS $(neon-config --cflags)" \
  destdir=$RPM_BUILD_ROOT
popd

# man page
install -p -m644 ./debian/tmp/%{name}.1 $RPM_BUILD_ROOT%{_mandir}/man1
install -p -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man1

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%doc build/docs-tla/src/docs-tla
%doc src/tla/AUTHORS
%doc src/tla/README
%{_bindir}/make-links
%{_bindir}/%{name}
%{_bindir}/remove-links
%{_mandir}/man1/%{name}.1.gz
%{_mandir}/man1/%{name}-gpg-check.1.gz

%changelog
* Sun Aug 24 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 	1.3.5-1
- initial build for Vine Linux

* Sat Feb 09 2008 Debarshi Ray <rishi@fedoraproject.org> - 1.3.5-5
- Added 'BuildRequires: check-devel' for check stanza.

* Wed Dec 12 2007 Debarshi Ray <rishi@fedoraproject.org> - 1.3.5-4
- Added online manual page, and patches to fix alignment errors on HP-PA and
  SPARC and segmentation fault on IA-64 from Debian.
- Fixed sources to work with neon >= 0.27.2 for all distributions, except
  Fedora 7. Closes Red Hat Bugzilla bug #327111.

* Sun Nov 18 2007 Debarshi Ray <rishi@fedoraproject.org> - 1.3.5-3
- Resolved CVS merge conflicts for Fedora 7.

* Fri Nov 16 2007 Debarshi Ray <rishi@fedoraproject.org> - 1.3.5-2
- Changed value of License to GPLv2+.

* Sat Nov 10 2007 Debarshi Ray <rishi@fedoraproject.org> - 1.3.5-1
- Initial build. Imported SPEC from Rawhide.
- Added online manual page generator and patch to build against neon-devel
  from Debian.
- Added patch to test-dir-regexps.sh from SuSE.
- Removed call to invariant to prevent failure on ppc. Closes Red Hat Bugzilla
  bug #182742.
- Disabled parallel make to prevent failure.
