summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 354056b8b44954485868084eb8b8e8402c29bd01 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Maintainer: sourcesmith <sourcesmith 'at' homeport 'dot' org.uk> 
# Original Contributors: Sonic-Y3k <sonic.y3k@googlemail.com>
#                        Giancarlo Bianchi <giancarlobianchi76@gmail.com>
#                        Fortunato Ventre (voRia) <vorione@gmail.com>
#                        Custom Processing Unlimited (CPUnltd) <CPUnltd 'at' gmail 'dot' com>
_model=mg8100
pkgname=cnijfilter-${_model}series
pkgver=3.40
pkgrel=1
_pkgver=3.40-1
pkgdesc="Canon IJ Printer Driver (for ${_model} series)"
url="http://www.canon.co.uk/support/consumer_products/products/fax__multifunctionals/inkjet/pixma_mg_series/pixma_mg8150.aspx?type=drivers&os=LINUX"
arch=('i686' 'x86_64')
license=('custom')
depends=('cups' 'ghostscript' 'popt' 'gtk2')
makedepends=('autoconf>=2.13' 'automake>=1.6' 'findutils' 'gawk')
conflicts=('cnijfilter-common')
install=cnijfilter-mg8100.install
source=('http://files.canon-europe.com/files/soft40245/Software/cnijfilter-source-3.40-1.tar.gz'
        'build-fixes.patch'
        'cups.patch'
	'id.po.patch'
        'libpng.patch')
sha256sums=('a95dd4ca491a9e8acc3e4ee35cc84904680e82d89ff04a23dda1b0ccffbb8a7a'
            '2fac6cca681320ea248abb73a5d17c7a1f69176b594aeb2cb5c67bd4ace1fd37'
            '28a1cb7495b0e0689c1629d57130bcb020413431d6ffd0c1057cef2f7f16f72e'
            'df6ff8ef9d8bf825c170b3d5957a93eb7c20b6b4cc39a4944dc74d2852bef1a9'
            'd4b52edbb4cc6a56d93b176341277935357acc0c52ac48abcf0e7e7e9d3c0a7c')

if [ "$CARCH" == "x86_64" ]; then  
	_libdir=libs_bin64
else
	_libdir=libs_bin32
fi

prepare() {
    ## Patches
	msg "Applying patches"
	patch -p0 < build-fixes.patch
	patch -p0 < cups.patch
	patch -p0 < id.po.patch
	patch -p0 < libpng.patch
}

build() {
    CPPFLAGS="${CPPFLAGS} -O2"

    ## Compile ${_model} stuff
	# ppd file
	msg Configuring and making ppd.
	cd "${srcdir}/cnijfilter-source-${_pkgver}/ppd"
	./autogen.sh --prefix=/usr --enable-ppdpath=/usr/share/cups/model --program-suffix=${_model}
	make 
	# cnijfilter
	msg Configuring and making cnijfilter.
	cd "${srcdir}/cnijfilter-source-${_pkgver}/cnijfilter"
	./autogen.sh --prefix=/usr --enable-libpath=/usr/lib/bjlib --enable-binpath=/usr/bin --program-suffix=${_model}
	make 
	# lgmon
	msg Configuring and making lgmon.
	cd "${srcdir}/cnijfilter-source-${_pkgver}/lgmon"
	./autogen.sh --prefix=/usr --enable-progpath=/usr/bin --program-suffix=${_model}
	make 
	# cngpijmon
	msg Configuring and making cngpijmon.
	cd "${srcdir}/cnijfilter-source-${_pkgver}/cngpijmon"
	./autogen.sh --prefix=/usr --enable-progpath=/usr/bin --datadir=/usr/share --program-suffix=${_model}
	make 

	## Compile common stuff
	# libs
	msg Configuring and making libs.
	cd "${srcdir}/cnijfilter-source-${_pkgver}/libs"
	./autogen.sh --prefix=/usr
	make 
	# cngpij, pstocanonij, backend
	for _c in cngpij pstocanonij backend; do
		echo "Configuring and making ${_c}."
		cd "${srcdir}/cnijfilter-source-${_pkgver}/${_c}"
		./autogen.sh --prefix=/usr --enable-progpath=/usr/bin
		make 
	done
	# backendnet
	msg Configuring and making backendnet.
	cd "${srcdir}/cnijfilter-source-${_pkgver}/backendnet"
	./autogen.sh --prefix=/usr --enable-progpath=/usr/bin LDFLAGS="-L../../com/${_libdir}"
	make 
	# sm sub process
	msg Configuring and making cngpijmon/cnijnpr.
	cd "${srcdir}/cnijfilter-source-${_pkgver}/cngpijmon/cnijnpr"
	./autogen.sh --prefix=/usr LIBS="-ldl"
	make 
}

package() {
	# get id of printer model	
	_cmd=$(find ${srcdir}/cnijfilter-source-${_pkgver} -type f -name cif${_model}.conf -path '*[\d]*' -printf '%P' \
		| gawk -F/ '{print $1}')
	_id=${_cmd}
	echo ${pkgdir}
	

	for dir in ppd cnijfilter lgmon cngpijmon libs cngpij pstocanonij backend backendnet cngpijmon/cnijnpr; do
		cd "${srcdir}/cnijfilter-source-${_pkgver}/${dir}"
		make install DESTDIR="${pkgdir}" 
	done

	# Install ${_id} libraries
	install -d ${pkgdir}/usr/lib/
	cp -P ${srcdir}/cnijfilter-source-${_pkgver}/${_id}/${_libdir}/*so* ${pkgdir}/usr/lib/
	install -d ${pkgdir}/usr/lib/bjlib/
	install -m 644 ${srcdir}/cnijfilter-source-${_pkgver}/${_id}/database/* ${pkgdir}/usr/lib/bjlib/
	# Install common libraries
	cp -P ${srcdir}/cnijfilter-source-${_pkgver}/com/${_libdir}/*so* ${pkgdir}/usr/lib/
	install -m 666 ${srcdir}/cnijfilter-source-${_pkgver}/com/ini/* ${pkgdir}/usr/lib/bjlib/

	# Install license file
	cd ${srcdir}/cnijfilter-source-${_pkgver}
	install -d ${pkgdir}/usr/share/licenses/${pkgname}/
	install -m 644 LICENSE-* ${pkgdir}/usr/share/licenses/${pkgname}/
}