media-sound/go-musicfox: add 3.7.1, drop 3.7.0
[gentoo-zh.git] / media-gfx / scangearmp / scangearmp-1.60.ebuild
blobf5cfd8b8da26079c7c4ea8092ef5ed55330053bc
1 # Copyright 1999-2021 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 # Changelog since last bugzilla upload
6 # initial version
7 # updated to use cnijfilter-common-2.80 2008-01-12 by Victor Mataré
9 # 2010-03-19 GuS Version 3.20-r1
10 # Replaced dependency of non-existing dev-libs/libxml with
11 # dependency of >=dev-libs/libxml2-2.7.3-r2.
13 # 2010-03-20 GuS Version 3.20-r2
14 # Replaced dependency of non-existing virtual/ghostscript with
15 # dependency of app-text/ghostscript-gpl.
16 EAPI=7
18 inherit eutils flag-o-matic autotools multilib
20 DESCRIPTION="Canon InkJet Scanner Driver and ScanGear MP for Linux (Pixus/Pixma-Series)."
21 HOMEPAGE="http://support-au.canon.com.au/contents/AU/EN/0100303302.html"
22 RESTRICT="nomirror confcache"
24 SRC_URI="http://gdlp01.c-wss.com/gds/3/0100003033/01/scangearmp-source-1.60-1.tar.gz"
25 LICENSE="UNKNOWN" # GPL-2 source and proprietary binaries
27 SLOT="2"
28 KEYWORDS=""
29 IUSE="amd64
30 usb
31 mp250
32 mp280
33 mp495
34 mg5100
35 mg5200
36 mg6100
37 mg8100"
38 DEPEND=">=dev-libs/libusb-0.1.12-r5
39 >=media-libs/libpng-1.2.44
40 >=media-gfx/gimp-2.6.8
41 >=x11-libs/gtk+-2.20.1-r1
42 >=media-gfx/sane-backends-1.0.19-r2"
44 # Arrays of supported Printers, there IDs and compatible models
45 _pruse=("mp250" "mp280" "mp495" "mg5100" "mg5200" "mg6100" "mg8100")
46 _prname=(${_pruse[@]})
47 _prid=("356" "370" "369" "373" "374" "376" "377")
48 _prcomp=("mp250series" "mp280series" "mp495series" "mg5100series" "mg5200series" "mg6100series" "mg8100series")
49 _max=$((${#_pruse[@]}-1)) # used for iterating through these arrays
51 ###
52 # Standard Ebuild-functions
53 ###
55 src_unpack() {
56 unpack ${A}
57 mv "${PN}-source-${PV}-1" "${P}" || die # Correcting directory-structure
60 pkg_setup() {
61 if [ -z "$LINGUAS" ]; then # -z tests to see if the argument is empty
62 ewarn "You didn't specify 'LINGUAS' in your make.conf. Assuming"
63 ewarn "English localisation, i.e. 'LINGUAS=\"en\"'."
64 LINGUAS="en"
67 _prefix="/usr/local"
68 _bindir="${_prefix}/bin"
69 _libdir="/usr/$(get_libdir)" # either lib or lib32
70 _gimpdir="${_libdir}/gimp/2.0/plug-ins"
71 _udevdir="/etc/udev/rules.d"
73 einfo ""
74 einfo " USE-flags\t(description / probably compatible printers)"
75 einfo ""
76 einfo " amd64\t(basic support for this architecture)"
77 einfo " usb\t(connected using usb)"
78 _autochoose="true"
79 for i in `seq 0 ${_max}`; do
80 einfo " ${_pruse[$i]}\t${_prcomp[$i]}"
81 if (use ${_pruse[$i]}); then
82 _autochoose="false"
84 done
85 einfo ""
86 if (${_autochoose}); then
87 ewarn "You didn't specify any driver model (set it's USE-flag)."
88 einfo ""
89 einfo "As example:\tbasic MP140 support without maintenance tools"
90 einfo "\t\t -> USE=\"mp140\""
91 einfo ""
92 einfo "Press Ctrl+C to abort"
93 echo
94 ebeep
96 n=15
97 while [[ $n -gt 0 ]]; do
98 echo -en " Waiting $n seconds...\r"
99 sleep 1
100 (( n-- ))
101 done
105 src_prepare(){
106 cd scangearmp
108 sed -i 's/Z_BEST_SPEED/\ 1\ /g' src/scanfile.c
110 ( cd src && epatch "${FILESDIR}/fixcompile.patch" )
112 libtoolize -cfi
113 eautoreconf
116 src_configure(){
117 cd scangearmp || die
119 if use x86; then
120 LDFLAGS="-L$(pwd)/../com/libs_bin32"
121 elif use amd64 ; then
122 LDFLAGS="-L$(pwd)/../com/libs_bin64"
123 else
124 die "not supported arch"
127 econf LDFLAGS="${LDFLAGS}"
130 src_compile() {
132 cd scangearmp || die
134 make || die "Couldn't make scangearmp"
136 cd ..
139 src_install() {
140 mkdir -p "${D}${_bindir}" || die
141 mkdir -p "${D}${_libdir}/bjlib" || die
142 if use usb; then
143 mkdir -p "${D}${_udevdir}" || die
146 cd scangearmp || die
147 make DESTDIR="${D}" install || die "Couldn't make install scangearmp"
149 cd ..
151 for i in $(seq 0 ${_max}); do
152 if use ${_pruse[$i]} || ${_autochoose}; then
153 _pr=${_prname[$i]} _prid=${_prid[$i]}
155 done
157 # rm .1a and .a
158 rm -f "{$D}${_libdir}"/*.1a "{$D}${_libdir}"/*.a || die
160 # make symbolic link for gimp-plug-in
161 if [ -d "${_gimpdir}" ]; then
162 mkdir -p "${D}${_gimpdir}" || die
163 dosym "${_bindir}/scangearmp" "${_gimpdir}/scangearmp" || die
166 if use x86; then
167 cp -a "${_prid}"/libs_bin32/* "${D}${_libdir}" || die
168 cp -a com/libs_bin32/* "${D}${_libdir}" || die
169 else # amd54
170 cp -a ${_prid}/libs_bin64/* "${D}${_libdir}" || die
171 cp -a com/libs_bin64/* "${D}${_libdir}" || die
173 cp -a "${_prid}"/*.DAT "${D}${_libdir}"/bjlib || die
174 cp -a "${_prid}"/*.tbl "${D}${_libdir}"/bjlib || die
175 cp com/ini/canon_mfp_net.ini "${D}${_libdir}"/bjlib || die
176 chmod 644 "${D}${_libdir}"/bjlib/* || die
177 chmod 666 "${D}${_libdir}"/bjlib/canon_mfp_net.ini || die
179 # usb
180 if use usb; then
181 cp -a scangearmp/etc/80-canon_mfp.rules "${D}${_udevdir}" || die
182 chmod 644 "${D}${_udevdir}/80-canon_mfp.rules" || die
186 pkg_postinst() {
187 if use usb; then
188 if [ -x /sbin/udevadm ]; then
189 einfo ""
190 einfo "Reloading usb rules..."
191 /sbin/udevadm control --reload-rules 2> /dev/null
192 /sbin/udevadm trigger --action=add --subsystem-match=usb 2>/dev/null
193 else
194 einfo ""
195 einfo "Please, reload usb rules manually."
199 einfo ""
200 einfo "If you experience any problems, please visit:"
201 einfo " http://forums.gentoo.org/viewtopic-p-3217721.html"
202 einfo ""