summaryrefslogtreecommitdiff
path: root/extra/xsane/PKGBUILD
blob: eee9d0a0e79df1183fa769d1a136204eef5455c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# $Id: PKGBUILD 203218 2014-01-05 19:22:33Z tpowa $
# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: Sarah Hay <sarahhay@mb.sympatico.ca>

pkgbase=xsane
pkgname=('xsane' 'xsane-gimp')
pkgver=0.999
pkgrel=1
arch=(i686 x86_64 mips64el)
url="http://www.xsane.org"
license=('GPL2')
makedepends=('gtk2' 'lcms' 'sane' 'zlib' 'libjpeg' 'gimp')
source=(http://www.xsane.org/download/$pkgname-$pkgver.tar.gz
	xsane-0.995-xdg-open.patch)
md5sums=('9927f21e1ab6ba96315e7f0e30746deb'
         '15541ff0ddc10acfa2059cf99d5478eb')

prepare() {
  cd "$srcdir/$pkgname-$pkgver"
  # fix use "xdg-open" instead of "netscape" to launch help browser - taken from Fedora
  patch -Np1 -i ${srcdir}/xsane-0.995-xdg-open.patch
  sed -i -e 's:png_ptr->jmpbuf:png_jmpbuf(png_ptr):' src/xsane-save.c
}

build() {
  cd "$srcdir/$pkgbase-$pkgver"

  ./configure --prefix=/usr \
    --mandir=/usr/share/man \
    --enable-gimp
  make
  mv src/xsane src/xsane-gimp

  # build again with gimp enabled
  make clean
  ./configure --prefix=/usr --sbindir=/usr/bin --mandir=/usr/share/man --disable-gimp
  make
}

package_xsane() {
  pkgdesc="A GTK-based X11 frontend for SANE and plugin for Gimp."
  install=$pkgname.install
  depends=('gtk2' 'lcms' 'sane' 'zlib' 'libjpeg')  
  optdepends=('xsane-gimp: for gimp plugin support')
  cd "$srcdir/$pkgbase-$pkgver"
  make DESTDIR="$pkgdir" install
}

package_xsane-gimp() {
  pkgdesc="XSane Gimp plugin"
  depends=('xsane' 'gimp')
  cd "$srcdir/$pkgbase-$pkgver"
  install -D -m755 src/xsane-gimp "${pkgdir}/usr/bin/xsane-gimp"

  ## For making Gimp Plugin available 
  mkdir -p "$pkgdir/usr/lib/gimp/2.0/plug-ins"
  ln -sf /usr/bin/xsane-gimp $pkgdir/usr/lib/gimp/2.0/plug-ins/xsane
  #cd "$pkgdir/usr/lib/gimp/2.0/plug-ins/"
  #/bin/ln -s ../../../../bin/xsane-gimp xsane

# http://cvs.fedoraproject.org/viewvc/rpms/xsane/devel/xsane.spec?revision=1.80&view=markup
# when makepkg will allow splitted pkg install file support we might change add a xsane-gimp.install file with the commands that are used by fedora, 
# gentoo has something similar
#%post gimp
#107 	if [ -x "%{_sbindir}/gimp-plugin-mgr" ]; then
#108 	%{_sbindir}/gimp-plugin-mgr --install xsane
#109 	fi
#110 	
#111 	%preun gimp
#112 	if [ $1 = 0 ]; then
#113 	if [ -x "%{_sbindir}/gimp-plugin-mgr" ]; then
#114 	%{_sbindir}/gimp-plugin-mgr --uninstall xsane
#115 	fi
#116 	fi 
}