%define neon_version 0.25.5
%define swig_version 1.3.29
%define apache_dir /usr

%define db_version 4.3.29

%define swigdirs swig_pydir=%{python_sitearch}/libsvn swig_pydir_extra=%{python_sitearch}/svn

# set to zero to avoid running test suite
%define make_check 0

Summary: Modern Version Control System
Summary(ja): モダンなバージョン管理システム
Name: subversion
Version: 1.6.15
Release: 1%{?_dist_release}
License: ASL 1.1
Group: Development/Tools
URL: http://subversion.apache.org/

SOURCE0: subversion-%{version}.tar.bz2
SOURCE1: subversion.conf
SOURCE2: httpd.davcheck.conf
SOURCE3: filter-requires.sh
Patch1: subversion-1.6.0-deplibs.patch
Patch3: subversion-1.6.1-rpath.patch
Patch6: subversion-1.5.0-pie.patch
Patch10: subversion-1.5.7-update-neon-m4.patch

Requires: db4 >= %{db_version}
Requires: expat
Requires: neon >= %{neon_version}
BuildRequires: apache2-devel
BuildRequires: apr-devel, apr-util-devel
BuildRequires: autoconf >= 2.53
BuildRequires: db4-devel >= %{db_version}
BuildRequires: expat-devel
BuildRequires: gdbm-devel
BuildRequires: libtool >= 1.4.2
BuildRequires: neon-devel >= %{neon_version}
BuildRequires: openssl-devel
BuildRequires: python
BuildRequires: python-devel
BuildRequires: swig >= %{swig_version}
BuildRequires: texinfo
BuildRequires: zlib-devel
BuildRequires: openldap-devel
BuildRequires: ruby >= 1.8.2
BuildRequires: ruby-devel >= 1.8.2
BuildRequires: perl >= 5.8.0
BuildRequires: sqlite3-devel
BuildRequires: krb5-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-root

%define __perl_requires %{SOURCE3}

%description
Subversion is a concurrent version control system which enables one
or more users to collaborate in developing and maintaining a
hierarchy of files and directories while keeping a history of all
changes.  Subversion only stores the differences between versions,
instead of every complete file.  Subversion is intended to be a
compelling replacement for CVS.

%package devel
Group: Development/Libraries
Summary: Development package for Subversion developers.
Requires: subversion = %{version}-%{release}
Requires: apr-devel, apr-util-devel
%description devel
The subversion-devel package includes the static libraries and include files
for developers interacting with the subversion package.

%package mod_dav_svn
Group: System Environment/Daemons
Summary: Apache server module for Subversion server.
Requires: httpd >= %{apache_version}
Requires: subversion = %{version}-%{release}
%description mod_dav_svn
The subversion-mod_dav_svn package adds the Subversion server Apache module to
the Apache directories and configuration.

%package tools
Group: Development/Tools
Summary: Tools for Subversion
BuildRequires: perl >= 5.8.0
Requires: perl >= 5.8.0
Requires: subversion = %{version}-%{release}

%description tools
Tools for Subversion.

%package perl
Group: Development/Libraries
Summary: Perl bindings to the Subversion libraries
Requires: subversion = %{version}-%{release}
Requires: perl >= 5.8.0

%description perl
This package includes the Perl bindings to the Subversion libraries.

%package ruby
Group: Development/Libraries
Summary: Ruby bindings to the Subversion libraries
Requires: subversion = %{version}-%{release}
Requires: ruby >= 1.8.2

%description ruby
This package includes the Ruby bindings to the Subversion libraries.

%package python
Group: Development/Libraries
Summary: Python bindings to the Subversion libraries
Requires: subversion = %{version}-%{release}, python

%description python
This package includes the Python bindings to the Subversion libraries.

%prep
%setup -q
%patch1 -p1 -b .deplibs
%patch3 -p1 -b .rpath
## comment out: 1.6.9-1
#%patch6 -p1 -b .pie
## comment out: 1.6.9-1
#%patch10 -p1 -b .nola

rm -rf neon apr apr-util db4

%build
./autogen.sh

# fix shebang lines, #111498
perl -pi -e 's|/usr/bin/env perl -w|/usr/bin/perl -w|' tools/hook-scripts/*.pl.in

# override weird -shrext from ruby
export svn_cv_ruby_link="%{__cc} -shared"
export svn_cv_ruby_sitedir_libsuffix=""
export svn_cv_ruby_sitedir_archsuffix=""

export CC=gcc CXX=g++ JAVA_HOME=%{jdk_path}
export CPPFLAGS="-DSVN_NEON_0_26 -DSVN_NEON_0_25"
%configure --with-apr=%{_prefix} --with-apr-util=%{_prefix} \
	--with-swig --with-neon=%{_prefix} \
	--with-ruby-sitedir=%{rarchdir} \
 	--with-apxs=%{_bindir}/apxs \
	--disable-mod-activation --disable-static --disable-neon-version-check
# 1.3.0 tarball ships with generated swig sources
make extraclean-swig-headers
make %{?_smp_mflags} all
make swig-py swig-py-lib %{swigdirs}
make swig-pl swig-pl-lib swig-rb swig-rb-lib


%install
echo %{rarchdir}
rm -rf $RPM_BUILD_ROOT
make install \
	install-swig-py \
	install-swig-pl-lib \
	install-swig-rb \
        DESTDIR=$RPM_BUILD_ROOT %{swigdirs}

make pure_vendor_install -C subversion/bindings/swig/perl/native \
	PERL_INSTALL_ROOT=$RPM_BUILD_ROOT
install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/subversion

# Add subversion.conf configuration file into httpd/conf.d directory.
install -m 755 -d $RPM_BUILD_ROOT/etc/apache2/conf.d
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/etc/apache2/conf.d

# Set up tools package files.
mkdir -p $RPM_BUILD_ROOT/usr/lib/subversion
cp -r tools $RPM_BUILD_ROOT/usr/lib/subversion

# Remove unpackaged files
rm -rf $RPM_BUILD_ROOT%{_includedir}/subversion-*/*.txt \
       $RPM_BUILD_ROOT%{python_sitearch}/*/*.{a,la} \
       $RPM_BUILD_ROOT%{_libdir}/*.la
       
# remove stuff produced with Perl modules
find $RPM_BUILD_ROOT -type f \
     -a \( -name .packlist -o \( -name '*.bs' -a -empty \) \) \
     -print0 | xargs -0 rm -f

# make Perl modules writable so they get stripped
find $RPM_BUILD_ROOT%{_libdir}/perl5 -type f -perm 555 -print0 |
     xargs -0 chmod 755

# unnecessary libraries for swig bindings
rm -f $RPM_BUILD_ROOT%{_libdir}/libsvn_swig_*.{so,la,a}

# Remove unnecessary ruby libraries
rm -f $RPM_BUILD_ROOT%{rarchdir}/svn/ext/*.*a

# Trim what goes in docdir
rm -rf tools/*/*.in tools/test-scripts
		       
# Rename authz_svn INSTALL doc for docdir
ln -f subversion/mod_authz_svn/INSTALL mod_authz_svn-INSTALL

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%post tools -p /sbin/ldconfig

%postun tools -p /sbin/ldconfig


%files
%defattr(-,root,root)
%doc BUGS CHANGES COMMITTERS COPYING HACKING INSTALL README
%doc subversion/LICENSE
%{_bindir}/*
%{_libdir}/libsvn_*.so.*
%{_localedir}/*/*/subversion.mo
%{_mandir}/man*/*
%dir %{_sysconfdir}/subversion
%exclude %{_mandir}/man*/*::*
%exclude %{_libdir}/libsvn_swig_perl*.so.*
%exclude %{_libdir}/libsvn_swig_py*.so.*
%exclude %{_libdir}/libsvn_swig_ruby*.so.*

%files devel
%defattr(-,root,root)
%{_includedir}/subversion-1
%{_libdir}/libsvn*.so
%exclude %{_libdir}/libsvn_swig_perl*.so.*
%exclude %{_libdir}/libsvn_swig_py*.so.*
%exclude %{_libdir}/libsvn_swig_ruby*.so.*

%files mod_dav_svn
%defattr(-,root,root)
%config(noreplace) /etc/apache2/conf.d/subversion.conf
%{apache_dir}/%{_lib}/apache2/modules/mod_*.*

%files tools
%defattr(-,root,root)
%{_prefix}/lib/subversion/tools

%files perl
%defattr(-,root,root,-)
%{perl_vendorarch}/auto/SVN
%{perl_vendorarch}/SVN
%{_libdir}/libsvn_swig_perl*
%{_mandir}/man*/*::*

%files ruby
%defattr(-,root,root,-)
%{_libdir}/libsvn_swig_ruby*
%{rarchdir}/svn

%files python
%defattr(-,root,root,-)
%{_libdir}/libsvn_swig_py*
%{python_sitearch}/libsvn
%{python_sitearch}/svn


%changelog
* Mon Nov 29 2010 IWAI, Masaharu <iwai@alib.jp> 1.6.15-1
- new upstream release

* Tue Mar  2 2010 IWAI, Masaharu <iwai@alib.jp> 1.6.9-2
- fix <BTS:VineLinux:941>
  - using rpm macro: rarchdir
  - export svn_cv_ruby_sitedir_libsuffix and svn_cv_ruby_sitedir_archsuffix
- using rpm macros: perl_vendorarch and python_sitearch
- add BuildRequires: sqlite3-devel krb5-devel

* Thu Feb 18 2010 IWAI, Masaharu <iwai@alib.jp> 1.6.9-1
- new upstream release
- update URL
- update deplibs patch (Patch1) from Fedora 1.6.9-2.fc13
- update rpath patch (Patch3) from Fedora 1.6.9-2.fc13
- stop applying pia patch (Patch6): sync Fedora 1.6.9-2.fc13
- stop applying update-neon-m4 patch (Patch10): sync Fedora 1.6.9-2.fc13

* Wed Aug 13 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.5.7-1
- new upstream release

* Fri Sep 05 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.5.2-1
- new upstream release

* Sun Jul 20 2008 Shu KONNO <owa@bg.wakwak.com> 1.4.6-2vl5
- rebuilt with python-2.5.2

* Sat Apr 19 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.4.6-1vl5
- new upstream release
- rebuild with neon-0.28.2
- dropped old-Patch10 by adding --disable-neon-version-check to %%configure
- added Patch6, 8, 9, 10 from Fedora Core
  * Thu Feb 21 2008 Lubomir Kundrak <lkundrak@redhat.com> 1.4.6-5
  - Correct install location of java stuff (#433295)
  * Wed Aug  8 2007 Joe Orton <jorton@redhat.com> 1.4.4-3
  - fix build with new glibc open()-as-macro
  - build all swig code in %%build, not %%install
  * Fri May 21 2004 Joe Orton <jorton@redhat.com> 1.0.3-2
  - build /usr/bin/* as PIEs

* Mon Feb 25 2008 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.4.3-0vl2
- rebuild with expat-2.0.1

* Sun May 20 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 1.4.3-0vl1
- new upstream release
- add Patch10 to build with neon.
  1.3.2-0vl5 does not support neon..

* Wed May 16 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 1.3.2-0vl4
- rebuild with new neon

* Thu May 10 2007 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.3.2-0vl3
- rebuilt with new toolchain and db4-4.3.x

* Sat Mar 31 2007 NAKAMURA Kenta <kenta@vinelinux.org> 1.3.2-0vl2
- modified %%files section for lib64 architecture

* Tue Aug 29 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.3.2-0vl1
- new upstream release
- rebuild with new openldap-2.3.24

* Sun May 28 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.3.1-0vl1
- new upstream release
- change Group to Develoment/Tools
- build with apr-1.2.7/apr-util-1.2.7
  - require apr/apr-util instead of apache2-apr
- build with swig-1.3.29
- split {perl,python,ruby} related files to subpackage.

* Tue Oct 18 2005 IWAI, Masaharu <iwai@alib.jp> 1.2.3-0vl1
- new upstream release
- add noreplace option for config file

* Sun Jan 30 2005 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 1.1.3-0vl3
- fix Requires and BuildPreReq.

* Sun Jan 23 2005 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 1.1.3-0vl2
- new upstream release.
- add swig-runtime to 'BuildPreReq:'.
- fix %%files.

* Sun Oct 17 2004 USAMI Kosuke <usami-k@yc5.so-net.ne.jp> - 1.0.6-0vl1.1
- require neon version 0.24.7 for ra_dav
- add BuildPreReq: openldap-devel
- replace BuildPreReq: httpd to BuildPreReq: apache2
- replace tools Requires: perl(:MODULE_COMPAT_version) to perl >= 5.8.0

* Wed Jul 21 2004 Kazuhisa TAKEI <takei@vinelinux.org> 1.0.6-0vl1
- new upstream release

* Tue Jun 22 2004 Kazuhisa TAKEI <takei@vinelinux.org> 1.0.5-0vl1
- new upstream release

* Fri Jun  4 2004 Kazuhisa TAKEI <takei@vinelinux.org> 1.0.4-0vl1
- new upstream release
- clean up specfile.

* Tue Nov 25 2003 Daisuke SUZUKI <daisuke@linux.or.jp> 0.32.1-0vl1
- new upstream release
- build with apache2-2.0.47

* Sun Mar 30 2003 Kazuhisa TAKEI <takei@vinelinux.org> 0.20.0-0vl1
- build Vine Linux

* Sat Mar 01 2003 David Summers <david@summersoft.fay.ar.us> 0.18.1-5173
- Enabled RA_DAV checking.
  Now requires httpd package to build because of RA_DAV tests.

* Sat Jan 18 2003 David Summers <david@summersoft.fay.ar.us> 0.16.1-4433
- Created tools package to hold the tools.

* Thu Jan 16 2003 David Summers <david@summersoft.fay.ar.us> 0.16.1-4405
- Now requires httpd >= 2.0.44-0.1 (APACHE_2_0_BRANCH) which contains the new
  version of APR/APR-UTILS as of 2003.01.15.
- Added svnversion command.

* Tue Dec 31 2002 David Summers <david@summersoft.fay.ar.us> 0.16.0-4218
- Create a svnadmin.static which is copied to svnadmin-version-release
  when the package is erased, so users can still dump/load their repositories
  even after they have upgraded the RPM package.

* Sat Dec 14 2002 David Summers <david@summersoft.fay.ar.us> 0.16.0-4128
- SWIG now builds so we can use cvs2svn.

* Fri Oct 04 2002 David Summers <david@summersoft.fay.ar.us> 0.14.3-3280
- Made cvs2svn conditional (at least until we can get it to build consistently
  and work).

* Sat Sep 21 2002 David Summers <david@summersoft.fay.ar.us> 0.14.3-3205
- Added SWIG dependencies to add cvs2svn capabilities.

* Fri Aug 16 2002 David Summers <david@summersoft.fay.ar.us> 0.14.1-2984
- Now requires neon-0.22.0.

* Thu Aug 15 2002 David Summers <david@summersoft.fay.ar.us> 0.14.1-2978
- Took out loading mod_dav_svn from subversion.spec file and put it in
  subversion.conf file which goes into the apache conf directory.
- Simplify what gets put into httpd.conf to only the include for the
  subversion.conf file.
  (Thanks to Scott Harrison <sharrison@users.sourceforge.net> for prompting
  me to do this).

* Thu Aug 08 2002 David Summers <david@summersoft.fay.ar.us> 0.14.0-2919
- Updated to APR/APR-UTIL 2002-08-08.

* Tue Jun 25 2002 David Summers <david@summersoft.fay.ar.us> 0.13.0-2332
- Updated to APACHE/APR/APR-UTIL 2002-06-25.
- Previous version had a few problems because of missing apache error/ files.

* Sun Jun 23 2002 David Summers <david@summersoft.fay.ar.us> 0.13.0-2318
- Updated to apache-2.0.40-0.3.
- Updated to subversion-0.13.1-2318.

* Tue Jun 18 2002 David Summers <david@summersoft.fay.ar.us> 0.13.0-2277
- Updated for RedHat 7.3 (autoconf253).
- Added a bunch of pre-requisites I didn't know were needed because I built a
  new machine that didn't have them already installed.
- Fixed installation of man and info documentation pages.

* Wed Mar 06 2002 David Summers <david@summersoft.fay.ar.us> 0.9.0-1447
- Back to apache-libapr* stuff, hopefully to stay.

* Sun Feb 24 2002 David Summers <david@summersoft.fay.ar.us> 0.9.0-1373
- Fixed expat.patch to not have to make so many changes by writing a small
  shell script that changes libexpat to -lexpat.

* Fri Feb 22 2002 Blair Zajac <blair@orcaware.com> 0.9.0-1364
- Updated to neon-0.19.2.

* Mon Feb 11 2002 David Summers <david@summersoft.fay.ar.us> 0.8.0-1250
- Back to using apr and apr-util separately from apache.

* Mon Feb 11 2002 David Summers <david@summersoft.fay.ar.us> 0.8.0-1232
- Updated to APR and APR-UTIL 2002.02.11.
- Updated to apache-2.0.32-0.2. (Requires apache-libapr and apache-libapr-util).
- Took out a (now non-existant) documentation file.
- Moved SPEC file changelog to after all package definitions.
  
* Sun Feb 03 2002 David Summers <david@summersoft.fay.ar.us> 0.8.0-1153
- Updated to neon-0.18.5.
- Broke up apache and apache-devel into apache-apr, apache-apr-devel,
  apache-apr-utils, and apache-apr-utils-devel.
- Updated apache to APR and APR-UTILS to 2002.02.03 version.

* Sat Feb 02 2002 David Summers <david@summersoft.fay.ar.us> 0.8.0-1147
- Now builds without the separate APR package as it is built into and
  "exported" from apache-2.0.31-0.3.

* Fri Feb 01 2002 David Summers <david@summersoft.fay.ar.us> 0.8.0-1132
- Took out patches to install procedure now not required because of fixes
  in rev 1130.

* Fri Feb 01 2002 David Summers <david@summersoft.fay.ar.us> 0.8.0-1129
- Added requirement for APR 0.2002.01.19 rev 2 where the /usr/bin/apr-config
  program was added.

* Sun Oct 28 2001 David Summers <david@summersoft.fay.ar.us>
- Release M5-r340: Added the subversion-server package.

* Fri Oct 26 2001 David Summers <david@summersoft.fay.ar.us>
- Release M5-r327: No longer need expat-lite. We can use the normal expat.

* Thu Sep 27 2001 David Summers <david@summersoft.fay.ar.us>
- Release M3-r117: Initial Version.

