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 |
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root |
31 |
|
32 |
%description |
33 |
XSane is an X based interface for the SANE (Scanner Access Now Easy) |
34 |
library, which provides access to scanners, digital cameras, and other |
35 |
capture devices. XSane is written in GTK+ and provides control for |
36 |
performing the scan and then manipulating the captured image. |
37 |
|
38 |
You may install xsane-gimp if you want the GIMP plug-in. |
39 |
|
40 |
%package gimp |
41 |
Summary: GIMP plug-in which provides the SANE scanner interface |
42 |
Group: Graphics |
43 |
Requires: sane >= 1.0, %{name} >= %{version} |
44 |
|
45 |
%description gimp |
46 |
This package provides the regular XSane frontend for the SANE scanner |
47 |
interface, but it works as a GIMP 2.0 plug-in. You must have GIMP 2.0 (or |
48 |
newer) installed to use this package. |
49 |
|
50 |
|
51 |
%prep |
52 |
%setup -q |
53 |
%patch0 -p0 -b .www-browser |
54 |
%patch1 -p1 -b .desktop-file |
55 |
%patch2 -p0 -b .gcc44 |
56 |
|
57 |
%build |
58 |
%if %debug |
59 |
export DONT_STRIP=1 |
60 |
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} |
61 |
%else |
62 |
%configure2_5x --with-install-root=%{buildroot} |
63 |
%endif |
64 |
perl -pi -e 's#LDFLAGS = -L/usr/lib -Wl,-rpath,/usr/lib#LDFLAGS = -L/usr/lib -Wl#' src/Makefile |
65 |
##perl -pi -e 's#ja\.(po|gmo)##' po/Makefile |
66 |
%make |
67 |
mv src/xsane src/xsane-gimp |
68 |
|
69 |
make clean |
70 |
%if %debug |
71 |
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 |
72 |
%else |
73 |
%configure2_5x --with-install-root=%{buildroot} --disable-gimp |
74 |
%endif |
75 |
perl -pi -e 's#LDFLAGS = -L/usr/lib -Wl,-rpath,/usr/lib#LDFLAGS = -L/usr/lib -Wl#' src/Makefile |
76 |
##perl -pi -e 's#ja\.(po|gmo)##' po/Makefile |
77 |
%make |
78 |
|
79 |
%install |
80 |
|
81 |
rm -rf %{buildroot} |
82 |
|
83 |
%if %debug |
84 |
export DONT_STRIP=1 |
85 |
%endif |
86 |
|
87 |
%makeinstall_std |
88 |
install src/xsane-gimp %{buildroot}%{_bindir} |
89 |
%find_lang %{name} |
90 |
mkdir -p %{buildroot}%{_iconsdir}/hicolor/{48x48,32x32,16x16}/apps |
91 |
convert -scale 48 %{buildroot}/usr/share/pixmaps/xsane.xpm %{buildroot}%{_iconsdir}/hicolor/48x48/apps/%{name}.png |
92 |
convert -scale 32 %{buildroot}/usr/share/pixmaps/xsane.xpm %{buildroot}%{_iconsdir}/hicolor/32x32/apps/%{name}.png |
93 |
convert -scale 16 %{buildroot}/usr/share/pixmaps/xsane.xpm %{buildroot}%{_iconsdir}/hicolor/16x16/apps/%{name}.png |
94 |
|
95 |
# dynamic desktop support |
96 |
%define launchers /etc/dynamic/launchers/scanner |
97 |
mkdir -p %{buildroot}%{launchers} |
98 |
cat > %{buildroot}%{launchers}/%{name}.desktop << EOF |
99 |
[Desktop Entry] |
100 |
Name=XSane \$device |
101 |
Comment=XSane |
102 |
Exec=%_bindir/xsane |
103 |
Terminal=false |
104 |
Icon=%{name} |
105 |
Type=Application |
106 |
EOF |
107 |
|
108 |
%clean |
109 |
rm -fr %{buildroot} |
110 |
|
111 |
%files -f %{name}.lang |
112 |
%defattr(-,root,root) |
113 |
%doc xsane* |
114 |
%config(noreplace) %{launchers}/%{name}.desktop |
115 |
%{_bindir}/xsane |
116 |
%dir %{_datadir}/sane |
117 |
%{_datadir}/sane/* |
118 |
%{_mandir}/man1/* |
119 |
%{_datadir}/applications/%{name}.desktop |
120 |
%{_datadir}/pixmaps/%{name}.xpm |
121 |
%{_iconsdir}/hicolor/*/apps/* |
122 |
|
123 |
%post |
124 |
%if %mdkversion < 200900 |
125 |
%update_menus |
126 |
%endif |
127 |
update-alternatives --install %{launchers}/kde.desktop scanner.kde.dynamic %{launchers}/%{name}.desktop 30 |
128 |
update-alternatives --install %{launchers}/gnome.desktop scanner.gnome.dynamic %{launchers}/%{name}.desktop 30 |
129 |
|
130 |
%postun |
131 |
%if %mdkversion < 200900 |
132 |
%update_menus |
133 |
%endif |
134 |
|
135 |
if [ $1 = 0 ]; then |
136 |
update-alternatives --remove scanner.kde.dynamic %{launchers}/%{name}.desktop |
137 |
update-alternatives --remove scanner.gnome.dynamic %{launchers}/%{name}.desktop |
138 |
fi |
139 |
|
140 |
%files gimp |
141 |
%defattr(-,root,root) |
142 |
%doc xsane* |
143 |
%{_bindir}/xsane-gimp |
144 |
|
145 |
%post gimp |
146 |
if [ -d %_libdir/gimp ]; then |
147 |
GIMPDIR=`ls -d %_libdir/gimp/[012]*` |
148 |
[ -z "$GIMPDIR" ] && exit 0 |
149 |
for i in $GIMPDIR;do |
150 |
[ -d $i/plug-ins ] || mkdir -p $i/plug-ins |
151 |
%{__ln_s} -f %_bindir/xsane-gimp $i/plug-ins/xsane |
152 |
done |
153 |
fi |
154 |
|
155 |
%postun gimp |
156 |
if [ $1 = 0 ]; then |
157 |
if [ -d %_libdir/gimp ]; then |
158 |
GIMPDIR=`ls -d %_libdir/gimp/[012]*` |
159 |
[ -z "$GIMPDIR" ] && exit 0 |
160 |
for i in $GIMPDIR;do |
161 |
[ -d $i/plug-ins ] || mkdir -p $i/plug-ins |
162 |
%{__rm} -f $i/plug-ins/xsane |
163 |
done |
164 |
fi |
165 |
fi |
166 |
|
167 |
|