+Summary: Web based photo album viewer and creator
+Summary(pl): Przegl±darka i generator albumów zdjêæ w postaci stron WWW
Name: gallery
-Version: 3.0
+Version: 1.5.2
Release: 1
License: GPL
-Source0: http://malekith.cnc.pl/bin/%{name}-%{version}.tar.gz
-Summary: SVGALib JPEG/GIF/PNG/... picture viewer.
-Summary(pl): Bazowana na SVGALibie przegl±darka do obrazków
-Group: Applications/Graphics
-Group(de): Applikationen/Grafik
-Group(pl): Aplikacje/Grafika
-Vendor: Micha³ Moskal <malekith@pld.org.pl>
-URL: http://malekith.topnet.pl/
-BuildRequires: perl
-BuildRequires: gawk
-BuildRequires: sed
-BuildRequires: svgalib-devel
-BuildRequires: aalib-devel
-BuildRequires: libpng-devel
-BuildRequires: libtiff-devel
-BuildRequires: libstdc++-devel
-BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+Group: Applications/Publishing
+Source0: http://dl.sourceforge.net/gallery/%{name}-%{version}.tar.gz
+# Source0-md5: 6156b335a712d5515c3cc84c6bcd77da
+Source1: http://dl.sourceforge.net/gallery/pl_PL-1.5.1.tar.gz
+# Source1-md5: efe8e359041c2c07463132ad0f7a8bea
+Source2: %{name}-apache.conf
+Patch0: %{name}-PLD.patch
+URL: http://gallery.sourceforge.net/
+BuildRequires: rpmbuild(macros) >= 1.268
+Requires: webapps
+Requires: php-gettext
+Requires: php >= 3:4.1.0
+#Suggests: apache(mod_rewrite)
+#Suggests: jhead
+#Suggests: jpegtran
+BuildArch: noarch
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%define _webapps /etc/webapps
+%define _webapp %{name}
+%define _sysconfdir %{_webapps}/%{_webapp}
+%define _appdir %{_datadir}/%{_webapp}
%description
-Picture viewer for several gfx formats (PNG, GIF, JPEG, TIFF, PCX,
-XPM, BMP, P?M, IFF-{IL,P}BM and othres). No X supported nor needed.
-Feauters include scaling, quantizing, sliedeshows and a *lot* of
-useless options. Even mouse is supported, it can be used for scaling
-and scrolling. Gallery can also display images in text-mode, using
-aalib.
+Gallery is a photo album that includes a config wizard and lets users
+create and maintain albums via an intuitive Web interface. Photo
+management includes automatic thumbnail creation, image resizing,
+rotation, ordering and more. Albums can have read, write, and caption
+permissions per individual.
%description -l pl
-Przegl±darka do obrazków w sporej liczbie formatów formatach (PNG,
-GIF, JPEG, TIFF, PCX, XPM, BMP, P?M, IFF-{IL,P}BM i inne). ¯adnych
-Xów. Obrazki mo¿na skalowaæ, kwantyzowaæ, robiæ slideshowy i wiele
-innych bezsensownych rzeczy. Gallery obs³uguje mysz. Mo¿e równie¿
-wy¶wietlaæ obrazki w trybie textowym u¿ywaj±c aaliba.
+Gallery jest albumem zdjêæ, który posiadaj kreatora konfiguracji i
+pozwala u¿ytkownikom tworzyæ i zarz±dzaæ albumami przez intuicyjny
+interfejs WWW. Zarz±dzanie zdjêciami umo¿liwia automatyczne tworzenie
+miniatur, zmianê wielko¶ci obrazów, obrót, zmianê kolejno¶ci
+wy¶wietlania, itp. Albumy mog± posiadaæ indywidualne uprawnienia.
+
+%package setup
+Summary: Gallery setup package
+Summary(pl): Pakiet do wstêpnej konfiguracji Gallery
+Group: Applications/WWW
+Requires: %{name} = %{version}-%{release}
+
+%description setup
+Install this package to configure initial Gallery installation. You
+should uninstall this package when you're done, as it considered
+insecure to keep the setup files in place.
+
+%description setup -l pl
+Ten pakiet nale¿y zainstalowaæ w celu wstêpnej konfiguracGallery Eventum po
+pierwszej instalacji. Potem nale¿y go odinstalowaæ, jako ¿e
+pozostawienie plików instalacyjnych mog³oby byæ niebezpieczne.
%prep
-%setup -q
+%setup -q -n %{name}
+%patch0 -p1
-%build
-%configure \
- --without-debug \
- --without-gziped-man \
- --with-polish-man \
- --with-aalib
-%{__make}
+tar zxf %{SOURCE1} -C locale
+rm -f LICENSE.txt *.bat
+cat > config.conf <<'EOF'
+Alias /gallery %{_appdir}
+<Directory %{_appdir}>
+ allow from all
+</Directory>
+EOF
%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_appdir},%{_sysconfdir},/var/lib/gallery/albums}
+
+cp -a *.{php,inc,sh} $RPM_BUILD_ROOT%{_appdir}
+cp -a classes contrib css docs help html html_wrap images $RPM_BUILD_ROOT%{_appdir}
+cp -a includes java js layout lib locale platform po skins tools $RPM_BUILD_ROOT%{_appdir}
+# in /var because of setup/resetadmin file
+cp -a setup $RPM_BUILD_ROOT/var/lib/gallery
+ln -s /var/lib/gallery/setup $RPM_BUILD_ROOT%{_appdir}
+rm -f $RPM_BUILD_ROOT%{_appdir}/{AUTHORS,ChangeLog*,README}
+install %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
+install %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
+touch $RPM_BUILD_ROOT%{_sysconfdir}/config.php
+touch $RPM_BUILD_ROOT%{_sysconfdir}/htaccess
+ln -s %{_sysconfdir}/htaccess $RPM_BUILD_ROOT%{_appdir}/.htaccess
+
+%clean
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT%{_mandir}/{man1,pl/man1}
-install -d $RPM_BUILD_ROOT%{_bindir}
-install -d $RPM_BUILD_ROOT%{_libdir}/gallery
+%triggerin -- apache1
+%webapp_register apache %{_webapp}
-install doc/gallery.man $RPM_BUILD_ROOT%{_mandir}/man1/gallery.1
-install doc/gallery-pl.man $RPM_BUILD_ROOT%{_mandir}/pl/man1/gallery.1
-install -m 755 src/gallery $RPM_BUILD_ROOT%{_bindir}
-install lib/* $RPM_BUILD_ROOT%{_libdir}/gallery
-%{__make} prefix=$RPM_BUILD_ROOT%{_prefix} -C po install
+%triggerun -- apache1
+%webapp_unregister apache %{_webapp}
-rm -f $RPM_BUILD_ROOT%{_libdir}/gallery/Makefile*
+%triggerin -- apache >= 2.0.0
+%webapp_register httpd %{_webapp}
-gzip -9nf doc/{AUTHORS,BETA-TESTERS,BUGS,CREDITS,INSTALL,NEWS} \
- doc/{README,README.pl,TODO}
+%triggerun -- apache >= 2.0.0
+%webapp_unregister httpd %{_webapp}
-%find_lang %{name}
+%triggerpostun -- %{name} < 1.5.2-0.13
+/usr/sbin/webapp register httpd %{_webapp}
+%service -q httpd reload
-%clean
-rm -rf $RPM_BUILD_ROOT
+%files
+%defattr(644,root,root,755)
+%doc AUTHORS ChangeLog* README
+%dir %attr(750,root,http) %{_sysconfdir}
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf
+%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.php
+%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/htaccess
+%dir %{_appdir}
+%dir /var/lib/gallery
+%dir %attr(770,root,http) /var/lib/gallery/albums
+%{_appdir}/.htaccess
+%{_appdir}/*.php
+%{_appdir}/*.inc
+%{_appdir}/classes
+%{_appdir}/contrib
+%{_appdir}/css
+%{_appdir}/docs
+%{_appdir}/html*
+%{_appdir}/help
+%{_appdir}/images
+%{_appdir}/includes
+%{_appdir}/java
+%{_appdir}/js
+%{_appdir}/layout
+%{_appdir}/lib
+%{_appdir}/platform
+%{_appdir}/po
+%{_appdir}/skins
+%{_appdir}/tools
+
+%dir %{_appdir}/locale
+%{_appdir}/locale/en_US
+%lang(pl) %{_appdir}/locale/pl_PL
-%files -f %{name}.lang
+%files setup
%defattr(644,root,root,755)
-%doc doc/{AUTHORS,BETA-TESTERS,BUGS,CREDITS,INSTALL,NEWS,README,TODO}.gz
-%doc %lang(pl) doc/README.pl.gz
-
-%attr(755, root, root) %{_bindir}/*
-%{_mandir}/man1/*
-%dir %{_libdir}/gallery
-%{_libdir}/gallery/message.jpg
-%attr(755, root, root) %{_libdir}/gallery/config-lynx
-%attr(755, root, root) %{_libdir}/gallery/gallery-bugreport
-%attr(755, root, root) %{_libdir}/gallery/lsd
+%attr(755,root,root) %{_appdir}/*.sh
+%{_appdir}/setup
+/var/lib/gallery/setup