# $Id: PKGBUILD 154769 2012-03-30 16:45:24Z pierre $
# Maintainer: Alexander Fehr <pizzapunk gmail com>
# Contributor: Andrew Simmons <andrew.simmons@gmail.com>

_pkgname=xarchiver
pkgname=xarchiver-libre
pkgver=0.5.2
pkgrel=5.1
pkgdesc="GTK+ frontend to various command line archivers"
arch=('i686' 'x86_64')
url="http://xarchiver.sourceforge.net"
license=('GPL')
groups=('xfce4-goodies')
depends=('gtk2' 'desktop-file-utils' 'hicolor-icon-theme')
makedepends=('intltool')
provides=("$_pkgname=$pkgver")
conflicts=("$_pkgname")
replacesk=("$_pkgname")
optdepends=('tar: TAR support'
            'gzip: GZIP support'
            'bzip2: BZIP2 support'
            'zip: ZIP support'
            'unzip: ZIP support'
            'unar: RAR support'
            'p7zip: 7z support'
            'arj: ARJ support'
            'lha: LHA support'
            'xz: LZMA support'
            'lzop: LZOP support')
options=('!libtool')
install=xarchiver.install
source=(http://downloads.sourceforge.net/xarchiver/xarchiver-$pkgver.tar.bz2
        # rpm2cpio.patch by Daniel Hokka Zakrisson
        # taken from https://bugzilla.redhat.com/show_bug.cgi?id=577480
        # sent upstream through
        # https://sourceforge.net/tracker/?func=detail&aid=3310768&group_id=140153&atid=745602
        xarchiver-0.5.2-rpm2cpio.patch
        # segfault-open-with.patch by Bastiaan Jacques
        # taken from https://bugzilla.redhat.com/show_bug.cgi?id=690012
        # sent upstream through
        # https://sourceforge.net/tracker/?func=detail&aid=3310778&group_id=140153&atid=745600
        xarchiver-0.5.2-segfault-open-with.patch
        # fix-7z-support.patch by taken from
        # https://sourceforge.net/tracker/?func=detail&aid=3137589&group_id=140153&atid=745602
        xarchiver-0.5.2-fix_7z_support.patch)
md5sums=('2bc7f06403cc6582dd4a8029ec9d038d'
         'd4a1accdbba2b50e5707097dd3548d7a'
         'f9036a44157b318cbc59ed012b04974b'
         '782f55c1f1021dc02c7739bf8a47336e')

build() {
  cd "$srcdir/xarchiver-$pkgver"
  #patches taken from: http://pkgs.fedoraproject.org/gitweb/?p=xarchiver.git
  patch -Np1 -i ../xarchiver-0.5.2-rpm2cpio.patch
  patch -Np1 -i ../xarchiver-0.5.2-segfault-open-with.patch
  patch -Np1 -i ../xarchiver-0.5.2-fix_7z_support.patch
  ./configure --prefix=/usr --libexecdir=/usr/lib/xfce4
  make
}

package() {
  cd "$srcdir/xarchiver-$pkgver"
  make DESTDIR="$pkgdir" install
}