updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / brother-hl5040-cups / PKGBUILD
blob847ceb5cf72a665300ec7162e2ca0388951e912e
1 # Contributor: Joris Claassen <info at ebait org>
2 # Original contributor: Jonas E. Huber <info at hubjo org>
3
4 # The Brother printer drivers for CUPS are essentially only wrappers around 
5 # the LPR drivers. This package integrates both RPMs and thus facilitates the 
6 # whole process of installing both, LPR drivers and CUPS wrapper.
8 # While this PKGBUILD is specific for the drivers for the HL5040 laser printer,
9 # it should be easily adjustable for other Brother drivers. When I find the
10 # time, I'll write a little howto in the wiki or extend the existing one.  
11
12 # Don't hesitate to contact me if you have further questions or suggestions.
14 pkgname=brother-hl5040-cups
15 _cups=cupswrapperHL5040-1.0.2
16 _lpr=hl5040lpr-1.1.2
17 pkgver=1.0.2
18 pkgrel=1
19 pkgdesc="CUPS driver for HL-5040 laser printer, including underlying LPR driver."
20 url="http://solutions.brother.com/linux/en_us/"
21 arch=('i686' 'x86_64')
22 license=('GPL2' 'custom:brother')
23 depends=('cups' 'ghostscript' 'lib32-glibc' 'cpio')
24 makedepends=('rpmextract')
25 source=("http://www.brother.com/pub/bsc/linux/dlf/$_cups-1.i386.rpm"
26                 "http://www.brother.com/pub/bsc/linux/dlf/$_lpr-1.i386.rpm"
27                 'license.txt'
28                 'cupswrapper.patch'
29                 )
30 md5sums=('1ed0a8acbf5d5da5c3f8d6cee4f26c9c'
31          '0e412d243fb61d8db0b8c858c06989a9'
32          '73cf49a126378f8dc7e6f3b444a1ff57'
33          '5203761298aea4556b0b4af2f8e40775')
35 build() {
36         
37         # Clean up
38         rm -rf usr
39         rm -rf var
40         
41         # Install LPD driver
42         # =====================
43         # Note that some paths are changed in order to comply with the Arch packaging
44         # standard. You have to make these changes also in the patch for the CUPS wrapper!
45         
46         # Extracting RPM
47         cd $srcdir
48         rpmextract.sh "$_lpr-1.i386.rpm" || return 1
49         rm "$_lpr-1.i386.rpm"
50         
51         # Move into new directory structure
52         mkdir -p usr/share/ || return 1
53         mv usr/local/Brother usr/share/brother || return 1
54         rm -rf usr/local || return 1
55         
56         # Install the *custom* license for the LPR driver.
57         install -D -m644 license.txt usr/share/licenses/$pkgname/license.txt || return 1
58         
59         
60         # Install CUPS wrapper
61         # ====================
62         
63         # Extracting RPM
64         rpmextract.sh "$_cups-1.i386.rpm" || return 1
65         rm "$_cups-1.i386.rpm"
66         
67         # Move brcupsconfig to correct location
68         install -D usr/local/Brother/cupswrapper/brcupsconfig usr/share/brother/cupswrapper/brcupsconfig
69         
70         # Move script to main directory
71         mv "usr/local/Brother/cupswrapper/$_cups" . || return 1
72         rm -rf usr/local || return 1
73         
74         # The patch disables everything except the generation of the PPD and filter
75         # which are written into separate files in the CWD by executing the script.
76         patch < cupswrapper.patch
77         ./$_cups
79         # Install PPD and filter
80         install -D -m644 HL5040.ppd usr/share/cups/model/HL5040.ppd || return 1
81         install -D -m755 brlpdwrapperHL5040 usr/lib/cups/filter/brlpdwrapperHL5040 || return 1
82         
83         # Adapt paths where necessary
84         sed -i 's|/usr/local/Brother|/usr/share/brother|g' `grep -lr '/usr/local/Brother' ./` || return 1
85         
86         # Create and install the file 'brPrintList'. This file must exist and contain the name 
87         # of the printer in order to make CUPS settings work. Else, settings done in CUPS are
88         # not reflected in the file /usr/share/brother/inf/brHL5040rc and thus are not considered
89         # by the LPR driver that's doing the actual printing.
90         echo "HL5040" > brPrintList
91         install -D -m644 brPrintList usr/share/brother/inf/brPrintList
92         
93         # Clean up
94         rm HL5040.ppd
95         rm brlpdwrapperHL5040
96         rm brPrintList
97         
98         # Move everything into the pkg directory
99         find . | cpio -p -dum $pkgdir || return 1