1 |
# Enable debug mode |
2 |
%define debug 0 |
3 |
|
4 |
Name: xsane |
5 |
Version: 0.997 |
6 |
Release: %mkrel 3 |
7 |
Summary: Frontend for the SANE scanner interface |
8 |
Group: Graphics |
9 |
URL: http://www.xsane.org/ |
10 |
Source: ftp://ftp.sane-project.org/pub/sane/xsane/%{name}-%version.tar.gz |
11 |
Patch0: xsane-0.99-browser.patch |
12 |
Patch1: xsane-desktop.patch |
13 |
Patch2: xsane-0.996-fix-gcc44.patch |
14 |
License: GPLv2+ |
15 |
Requires: libsane >= 1.0.4 |
16 |
# Contains "www-browser" script |
17 |
Requires: desktop-common-data |
18 |
# This is for the drakxtools so that they can install a GUI for scanning |
19 |
# but decide depending on the system environment which GUI actually to |
20 |
# install |
21 |
Provides: scanner-gui |
22 |
BuildRequires: sane-devel |
23 |
BuildRequires: libjpeg-devel |
24 |
BuildRequires: gimp-devel >= 2.0 |
25 |
BuildRequires: imagemagick |
26 |
BuildRequires: lcms-devel |
27 |
BuildRequires: libtiff-devel |
28 |
BuildRequires: libgphoto-devel |
29 |
BuildRequires: libv4l-devel |
30 |
|
31 |
%description |
32 |
XSane is an X based interface for the SANE (Scanner Access Now Easy) |
33 |
library, which provides access to scanners, digital cameras, and other |
34 |
capture devices. XSane is written in GTK+ and provides control for |
35 |
performing the scan and then manipulating the captured image. |
36 |
|
37 |
You may install xsane-gimp if you want the GIMP plug-in. |
38 |
|
39 |
%package gimp |
40 |
Summary: GIMP plug-in which provides the SANE scanner interface |
41 |
Group: Graphics |
42 |
Requires: sane >= 1.0, %{name} >= %{version} |
43 |
|
44 |
%description gimp |
45 |
This package provides the regular XSane frontend for the SANE scanner |
46 |
interface, but it works as a GIMP 2.0 plug-in. You must have GIMP 2.0 (or |
47 |
newer) installed to use this package. |
48 |
|
49 |
|
50 |
%prep |
51 |
%setup -q |
52 |
%patch0 -p0 -b .www-browser |
53 |
%patch1 -p1 -b .desktop-file |
54 |
%patch2 -p0 -b .gcc44 |
55 |
|
56 |
%build |
57 |
%if %debug |
58 |
export DONT_STRIP=1 |
59 |
CFLAGS="`echo %{optflags} |sed -e 's/-O3/-g/' |sed -e 's/-O2/-g/'`" CXXFLAGS="`echo %{optflags} |sed -e 's/-O3/-g/' |sed -e 's/-O2/-g/'`" %configure2_5x --with-install-root=%{buildroot} |
60 |
%else |
61 |
%configure2_5x --with-install-root=%{buildroot} |
62 |
%endif |
63 |
perl -pi -e 's#LDFLAGS = -L/usr/lib -Wl,-rpath,/usr/lib#LDFLAGS = -L/usr/lib -Wl#' src/Makefile |
64 |
##perl -pi -e 's#ja\.(po|gmo)##' po/Makefile |
65 |
%make |
66 |
mv src/xsane src/xsane-gimp |
67 |
|
68 |
make clean |
69 |
%if %debug |
70 |
CFLAGS="`echo %{optflags} |sed -e 's/-O3/-g/' |sed -e 's/-O2/-g/'`" CXXFLAGS="`echo %{optflags} |sed -e 's/-O3/-g/' |sed -e 's/-O2/-g/'`" %configure2_5x --with-install-root=%{buildroot} --disable-gimp |
71 |
%else |
72 |
%configure2_5x --with-install-root=%{buildroot} --disable-gimp |
73 |
%endif |
74 |
perl -pi -e 's#LDFLAGS = -L/usr/lib -Wl,-rpath,/usr/lib#LDFLAGS = -L/usr/lib -Wl#' src/Makefile |
75 |
##perl -pi -e 's#ja\.(po|gmo)##' po/Makefile |
76 |
%make |
77 |
|
78 |
%install |
79 |
|
80 |
rm -rf %{buildroot} |
81 |
|
82 |
%if %debug |
83 |
export DONT_STRIP=1 |
84 |
%endif |
85 |
|
86 |
%makeinstall_std |
87 |
install src/xsane-gimp %{buildroot}%{_bindir} |
88 |
%find_lang %{name} |
89 |
mkdir -p %{buildroot}%{_iconsdir}/hicolor/{48x48,32x32,16x16}/apps |
90 |
convert -scale 48 %{buildroot}/usr/share/pixmaps/xsane.xpm %{buildroot}%{_iconsdir}/hicolor/48x48/apps/%{name}.png |
91 |
convert -scale 32 %{buildroot}/usr/share/pixmaps/xsane.xpm %{buildroot}%{_iconsdir}/hicolor/32x32/apps/%{name}.png |
92 |
convert -scale 16 %{buildroot}/usr/share/pixmaps/xsane.xpm %{buildroot}%{_iconsdir}/hicolor/16x16/apps/%{name}.png |
93 |
|
94 |
# dynamic desktop support |
95 |
%define launchers /etc/dynamic/launchers/scanner |
96 |
mkdir -p %{buildroot}%{launchers} |
97 |
cat > %{buildroot}%{launchers}/%{name}.desktop << EOF |
98 |
[Desktop Entry] |
99 |
Name=XSane \$device |
100 |
Comment=XSane |
101 |
Exec=%_bindir/xsane |
102 |
Terminal=false |
103 |
Icon=%{name} |
104 |
Type=Application |
105 |
EOF |
106 |
|
107 |
%clean |
108 |
rm -fr %{buildroot} |
109 |
|
110 |
%files -f %{name}.lang |
111 |
%defattr(-,root,root) |
112 |
%doc xsane* |
113 |
%config(noreplace) %{launchers}/%{name}.desktop |
114 |
%{_bindir}/xsane |
115 |
%dir %{_datadir}/sane |
116 |
%{_datadir}/sane/* |
117 |
%{_mandir}/man1/* |
118 |
%{_datadir}/applications/%{name}.desktop |
119 |
%{_datadir}/pixmaps/%{name}.xpm |
120 |
%{_iconsdir}/hicolor/*/apps/* |
121 |
|
122 |
%post |
123 |
update-alternatives --install %{launchers}/kde.desktop scanner.kde.dynamic %{launchers}/%{name}.desktop 30 |
124 |
update-alternatives --install %{launchers}/gnome.desktop scanner.gnome.dynamic %{launchers}/%{name}.desktop 30 |
125 |
|
126 |
%postun |
127 |
if [ $1 = 0 ]; then |
128 |
update-alternatives --remove scanner.kde.dynamic %{launchers}/%{name}.desktop |
129 |
update-alternatives --remove scanner.gnome.dynamic %{launchers}/%{name}.desktop |
130 |
fi |
131 |
|
132 |
%files gimp |
133 |
%defattr(-,root,root) |
134 |
%doc xsane* |
135 |
%{_bindir}/xsane-gimp |
136 |
|
137 |
%post gimp |
138 |
if [ -d %_libdir/gimp ]; then |
139 |
GIMPDIR=`ls -d %_libdir/gimp/[012]*` |
140 |
[ -z "$GIMPDIR" ] && exit 0 |
141 |
for i in $GIMPDIR;do |
142 |
[ -d $i/plug-ins ] || mkdir -p $i/plug-ins |
143 |
%{__ln_s} -f %_bindir/xsane-gimp $i/plug-ins/xsane |
144 |
done |
145 |
fi |
146 |
|
147 |
%postun gimp |
148 |
if [ $1 = 0 ]; then |
149 |
if [ -d %_libdir/gimp ]; then |
150 |
GIMPDIR=`ls -d %_libdir/gimp/[012]*` |
151 |
[ -z "$GIMPDIR" ] && exit 0 |
152 |
for i in $GIMPDIR;do |
153 |
[ -d $i/plug-ins ] || mkdir -p $i/plug-ins |
154 |
%{__rm} -f $i/plug-ins/xsane |
155 |
done |
156 |
fi |
157 |
fi |
158 |
|
159 |
|