-%define name boxes
-%define version 1.0
-%define release 1
-%define prefix /usr
-%define cfgfile %prefix/share/boxes
-
-%define nvr %{name}-%{version}-%{release}
-%define defbr /var/tmp/%{nvr}-build
-
-name: %name
-version: %version
-release: %release
-
-vendor: Thomas Jensen <boxes@home-of.tj>
-packager: Thomas Jensen <boxes@home-of.tj>
-
-summary: Draw any kind of box around some given text
-group: Utilities/Text
-
-copyright: GPL Version 2
-URL: http://home.pages.de/~jensen/boxes/
-
-source: http://home.pages.de/~jensen/boxes/download/%{name}-%{version}-src.tar.gz
-buildroot: %defbr
+Summary: Draw any kind of box around some given text
+Summary(pl): Rysowanie dowolnych ramek wokó³ podanego tekstu
+Name: boxes
+Version: 1.0.1
+Release: 1
+License: GPL
+Group: Applications/Text
+Vendor: Thomas Jensen <boxes@home-of.tj>
+Source0: http://boxes.thomasjensen.com/download/%{name}-%{version}.src.tar.gz
+# Source0-md5: 77935fb3b566755db798d678f945bd4d
+Patch0: %{name}-cflags.patch
+URL: http://boxes.thomasjensen.com/
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
-"boxes" can draw all kinds of boxes around its input text, ranging from a C
-comment box to complex ASCII art. These boxes may also be removed, even if
-they have been badly damaged by editing of the text inside. Since boxes may
-be open on any side, "boxes" can also be used to create regional comments in
-any programming language. With the help of an editor macro or mapping,
-damaged boxes can easily be repaired. New box designs of all sorts can
-easily be added and shared by appending to a free format configuration file.
-
-###########################################################################
-# useful macros
-###########################################################################
-%define cleanroot [ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" = "%defbuildroot" ] && rm -rf "$RPM_BUILD_ROOT"
-%define restorebins [ -f $RPM_BUILD_DIR/$RPM_PACKAGE_NAME.cpio ] && cpio -iv -I $RPM_BUILD_DIR/$RPM_PACKAGE_NAME.cpio
-###########################################################################
+"boxes" can draw all kinds of boxes around its input text, ranging
+from a C comment box to complex ASCII art. These boxes may also be
+removed, even if they have been badly damaged by editing of the text
+inside. Since boxes may be open on any side, "boxes" can also be used
+to create regional comments in any programming language. With the help
+of an editor macro or mapping, damaged boxes can easily be repaired.
+New box designs of all sorts can easily be added and shared by
+appending to a free format configuration file.
+
+%description -l pl
+Za pomoc± boxes mo¿na rysowaæ ró¿ne ramki wokó³ podanego tekstu,
+pocz±wszy od komentarzy C a skoñczywszy na skomplikowanym ascii art.
+Mo¿na równie¿ usuwaæ te ramki, nawet je¶li zosta³y powa¿nie uszkodzone
+edycj± znajduj±cego siê w nich tekstu. Poniewa¿ mog± byæ otwarte z
+ka¿dej strony, mo¿na ich u¿yæ do tworzenia lokalnych komentarzy w
+jakimkolwiek jêzyku programowania. Za pomoc± edytora makr lub
+mapowania mo¿na ³atwo naprawiæ uszkodzone ramki. Mo¿na równie¿ ³atwo
+dodaæ nowe rodzaje ramek ró¿nego rodzaju, do³±czaj±c je do pliku
+konfiguracyjnego o otwartym formacie.
%prep
-%setup
+%setup -q
+%patch0 -p1
%build
-rm doc/boxes.1
-rm src/boxes.h
-make GLOBALCONF=%cfgfile
+rm -f doc/boxes.1
+rm -f src/boxes.h
+%{__make} CFLAGS_ADDTL="%{rpmcflags}" GLOBALCONF="%{_sysconfdir}/boxes.conf"
%install
-mkdir -p $RPM_BUILD_ROOT/%prefix/bin
-mkdir -p $RPM_BUILD_ROOT/%prefix/man/man1
-mkdir -p $RPM_BUILD_ROOT/%prefix/share
-
-install -m 0755 src/boxes $RPM_BUILD_ROOT/%prefix/bin
-install -m 0644 doc/boxes.1 $RPM_BUILD_ROOT/%prefix/man/man1
-install -m 0644 boxes-config $RPM_BUILD_ROOT/%cfgfile
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1,%{_sysconfdir}}
-# write filelisting to /tmp
-find "$RPM_BUILD_ROOT" -type f -printf "/%P\n" > /tmp/FILES-%nvr
+install src/boxes $RPM_BUILD_ROOT%{_bindir}
+install doc/boxes.1 $RPM_BUILD_ROOT%{_mandir}/man1
+install boxes-config $RPM_BUILD_ROOT%{_sysconfdir}/boxes.conf
%clean
-# delete stuff
-[ "$RPM_BUILD_ROOT" = "%defbr" -a -d "%defbr" ] && rm -rf %defbr
+rm -rf $RPM_BUILD_ROOT
%files
-%defattr(-, root, root)
-/usr/bin/boxes
-/usr/man/man1/boxes.1
-%config /usr/share/boxes
-%doc COPYING README
+%defattr(644,root,root,755)
+%doc README
+%attr(755,root,root) %{_bindir}/*
+%{_mandir}/man1/*
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*