updated on Thu Jan 12 08:01:00 UTC 2012
[aur-mirror.git] / scangearmp / PKGBUILD
blob4bbaa21a79e43bc17af7735efd708622c681d6a9
1 # Maintainer: Jonas Hörsch <coroa@online.de>
3 pkgname=scangearmp
4 pkgver=1.00
5 pkgrel=2
6 pkgdesc="Canon Scanner Driver (For PIXMA MP510 and possibly other Canon scanners)"
7 url="http://support-au.canon.com.au/contents/AU/EN/0900706603.html"
8 #url="http://software.canon-europe.com/software/0028482.asp"
9 arch=('i686' 'x86_64')
10 license=('custom')
11 depends=('sane' 'gtk2>=2.4.0' 'gimp>=2.0.0' 'libpng>=1.2.8' 'libusb>=0.1.12')
12 makedepends=('rpmextract' 'automake>=1.9.5' 'autoconf>=2.59')
13 source=("http://gdlp01.c-wss.com/gds/6/0900007066/02/${pkgname}-common-${pkgver}-2.src.rpm")
14 md5sums=('b2fcd29f2bb905df50c450a576657f01')
15 options=(docs)
16 install=${pkgname}.install
18 build() {
19         cd "${srcdir}"
20         rpmextract.sh "${pkgname}-common-${pkgver}-2.src.rpm" || return 1
21         tar xzf "${pkgname}-common-${pkgver}-2.tar.gz" || return 1
23         cd "${srcdir}/${pkgname}-common-${pkgver}"
25         install -d ${pkgdir}/usr/share/doc/${pkgname}
26         install -m644 LICENSE-scangearmp-1.00E.txt LICENSE-scangearmp-1.00J.txt ${pkgdir}/usr/share/doc/${pkgname}
27         install -m644 -D LICENSE-scangearmp-1.00E.txt ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
30         pushd "scangearmp"
31         echo Patching sane driver to use the right function names
32         sed -i -e 's|^//#define __USE_LIBSANE__$|#define __USE_LIBSANE__|' backend/canon_mfp.c
34         libtoolize --copy --force
35         ./autogen.sh --prefix=/usr --enable-libpath=/usr/lib LDFLAGS="-L$(pwd)/../libs_bin"
36         make || return 1
37         make DESTDIR="${pkgdir}/" install
39         install -d "${pkgdir}/etc/sane.d"
40         ln -sf "/usr/lib/bjlib/canon_mfp.conf" "${pkgdir}/etc/sane.d/canon_mfp.conf"
42         install -d "${pkgdir}/usr/lib/sane"
43         for i in ${pkgdir}/usr/lib/libsane-canon_mfp.*; do
44             ln -sf ${i#$pkgdir} ${pkgdir}/usr/lib/sane
45         done
47         install -m644 LICENSE README AUTHORS ChangeLog COPYING ${pkgdir}/usr/share/doc/${pkgname}
48         popd
51         # copy common library
52         pushd libs_bin
53         for i in *.so.*; do
54                 install -m755 "$i" "${pkgdir}/usr/lib"
55                 ln -sf "/usr/lib/$i" "${pkgdir}/usr/lib/${i%.so.*}.so"
56         done
57         popd
59         # copy *.tbl and *.dat
60         pushd 293
61         install -d "${pkgdir}/usr/lib/bjlib"
62         install -m0755 *.tbl *.dat "${pkgdir}/usr/lib/bjlib"
63         popd
65         # copy rules file
66         pushd scangearmp
67         install -d "${pkgdir}/etc/udev/rules.d"
68         # SYSFS{} in rules files is obsolete
69         sed -i -e "s|SYSFS|ATTRS|g" etc/*.rules
70         install -m0644 etc/*.rules "${pkgdir}/etc/udev/rules.d"
71         popd
73         # setup symlinks for gimp
74         GIMP2DIR1="/usr/lib/gimp/2.0/plug-ins"
75         GIMP2DIR2="/opt/gnome/lib/gimp/2.0/plug-ins"
77         if [ -d ${GIMP2DIR1} ]; then
78            install -d "${pkgdir}/${GIMP2DIR1}"
79            ln -sf /usr/bin/scangearmp "${pkgdir}/${GIMP2DIR1}/scangearmp"
80         elif [ -d ${GIMP2DIR2} ]; then
81            install -d "${pkgdir}/${GIMP2DIR2}"
82            ln -sf /usr/bin/scangearmp "${pkgdir}/${GIMP2DIR2}/scangearmp"
83         fi
85         unset GIMP2DIR1 GIMP2DIR2