# $Id: PKGBUILD 15639 2008-10-16 10:28:54Z douglas $
# Contributer: Jason Chu <jason@archlinux.org>
# Maintainer: Jason Chu <jason@archlinux.org>

pkgname=subversion
pkgver=1.5.3
pkgrel=5
pkgdesc="Replacement for CVS, another versioning system (svn)"
arch=(i686 x86_64)
license=('apache' 'bsd')
depends=('neon>=0.28.2-2' 'apr-util>=1.3.2-2')
makedepends=('heimdal>=1.2.1' 'db>=4.7' 'python>=2.5.2-4'
             'perl>=5.10.0-3'  'autoconf')
source=(http://svn.collab.net/tarballs/${pkgname}-${pkgver}.tar.gz
        svnserve svn svnserve.conf)

md5sums=('37533b0435caaa3e4e1be359389fcbb9'
         'c5a2e490b3e58c6bd2ca3a2e72b71845'
         'a0db6dd43af33952739b6ec089852630'
         'c459e299192552f61578f3438abf0664')
        
backup=('etc/xinetd.d/svn' 'etc/conf.d/svnserve')
url="http://subversion.tigris.org/"
provides=('svn')
options=('!makeflags' 'libtool')

md5sums=('6a57efcc9e487e9bffc554931c98d3a0'
         'c5a2e490b3e58c6bd2ca3a2e72b71845'
         'a0db6dd43af33952739b6ec089852630'
         'c459e299192552f61578f3438abf0664')

build() {
   cd $startdir/src/${pkgname}-${pkgver}


   #patch -Np1 -i $startdir/src/subversion-neon.patch

   #sed -e 's/\(NEON_ALLOWED_LIST=.* 0.26.4\)"/\1 0.27.2 0.28.0 0.28.1 0.28.2"/' -i configure.in

#   libtoolize --force --copy
#   aclocal -I build/ac-macros
#   autoconf

   autoreconf
   ./configure --prefix=/usr --with-apr=/usr --with-apr-util=/usr \
               --with-zlib=/usr --with-neon=/usr --disable-ldap

   (make external-all && make LT_LDFLAGS="-L$Fdestdir/usr/lib" local-all ) || return 1

   export LD_LIBRARY_PATH=$startdir/pkg/usr/lib:$LD_LIBRARY_PATH
   make DESTDIR=$startdir/pkg install || return 1

#   make DESTDIR=$startdir/pkg swig-py || return 1
#   make install-swig-py DESTDIR=$startdir/pkg || return 1

 #  mkdir -p $startdir/pkg/usr/lib/python2.5
 #  mv $startdir/pkg/usr/lib/svn-python/ $startdir/pkg/usr/lib/python2.5/site-packages


   mkdir -p $startdir/pkg/usr/share/subversion
   install -d -m 755 tools/hook-scripts $startdir/pkg/usr/share/subversion/
   rm -f $startdir/pkg/usr/share/subversion/hook-scripts/*.in

#   make DESTDIR=$startdir/pkg swig-pl || return 1
#   make install-swig-pl DESTDIR=$startdir/pkg INSTALLDIRS=vendor || return 1
   rm -f $startdir/pkg/usr/lib/perl5/vendor_perl/auto/SVN/_Core/.packlist
   rm -rf $startdir/pkg/usr/lib/perl5/core_perl

#   make DESTDIR=$startdir/pkg swig-rb || return 1
#   make install-swig-rb DESTDIR=$startdir/pkg  || return 1

#   make DESTDIR=$startdir/pkg javahl || return 1
#   make DESTDIR=$startdir/pkg install-javahl || return 1

   mkdir -p $startdir/pkg/etc/rc.d
   mkdir -p $startdir/pkg/etc/xinetd.d
   mkdir -p $startdir/pkg/etc/conf.d

   install -m 755 $startdir/src/svnserve $startdir/pkg/etc/rc.d
   install -m 644 $startdir/src/svn $startdir/pkg/etc/xinetd.d
   install -m 644 $startdir/src/svnserve.conf $startdir/pkg/etc/conf.d/svnserve
   install -m 755 $startdir/src/subversion-$pkgver/contrib/client-side/svnmerge/svnmerge.py $startdir/pkg/usr/bin/svnmerge
   install -D -m 644 $startdir/src/subversion-$pkgver/COPYING $startdir/pkg/usr/share/licenses/$pkgname/LICENSE

   #libtoolslay not all because of kdesdk
#   find ${startdir}/pkg/usr/lib/httpd/modules -name '*.la' -exec rm {} \;
#   find ${startdir}/pkg/usr/lib/ruby -name '*.la' -exec rm {} \;
#   find ${startdir}/pkg/usr/lib/python2.5 -name '*.la' -exec rm {} \;
}