A few notes:
This:
%prep
rm -rf $RPM_BUILD_ROOT
mkdir $RPM_BUILD_ROOT
is redundant because %prep does it automatically, simply use
%prep
Do not use
Prefix: /usr
because aMule is not relocatable (the paths for webserver HTML + GIF files and translations are hard-compiled in the executables). Instead, use
%define prefix /usr
This:
Provides: %{name}
is redundant because a package always provides itself, simply delete it
This:
CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" \
./configure --prefix=%{prefix} --enable-kad-compile ---enable-debug --disable-optimize
is nonsense because:
- --disable-optimize is overridden by RPM_OPT_FLAGS, remove one of them (you should remove --disable-optimize, see below)
- --enable-kad-compile does no longer exist, Kademlia is always compiled and cannot be disabled
- --enable-debug is useless if you strip the binaries because you compile the debug info which takes a lot of time and disk space just in order to strip it away later, so remove one of them (see below)
The other ./configure options are OK.
So you have to decide:
- whether to enable and keep debug info (no stripping) or disable it from the beginning on. You will probably want to disable it because otherwise the package will be 5 times larger.
- whether to enable or disable optimisation. You will probably want to enable it because disabling it is only useful for debugging, but debugging is only useful without stripping, so because you are using stripping, you can also use optimisation without any disadvantage.
This line:
cd $RPM_BUILD_ROOT
does nothing, you can remove it
This:
%clean
rm -rf $RPM_BUILD_ROOT
rm -rf $RPM_BUILD_DIR/file.list.%{name}
rm -rf $RPM_BUILD_DIR/file.list.%{name}.libs
rm -rf $RPM_BUILD_DIR/file.list.%{name}.files
rm -rf $RPM_BUILD_DIR/file.list.%{name}.files.tmp
rm -rf $RPM_BUILD_DIR/file.list.%{name}.dirs
looks very nonsensual because $RPM_BUILD_DIR is deleted anyway with the next build, so you can use this instead:
%clean
rm -rf $RPM_BUILD_ROOT
Your package will fail to build on x86_64 systems because of this:
%{_libdir}/xchat/plugins/xas.pl
It's OK by itself, but you also have to add
--libdir=%{_libdir}
to your ./configure line because otherwise xas.pl will end up in %{prefix}/lib which is different from %{_libdir} on x86_64 systems.
Furthermore, your package is not FHS compliant because it installs man pages to /usr/man. This is forbidden, so please add
--mandir=%{_mandir}
to your ./configure line and change this
%{_prefix}/man/*/*
to something like this:
%{_mandir}/*/*
The package installs various directories without adding them to the %files list which results in these directories remaining on the user's systems after uninstalling the package. Try to avoid that. I see at least one such thing with the translations. You should also use the %find_lang macro to avoid that. Please google for "max-rpm.pdf".
And finally, the documentation is installed to a default directory specified in the makefiles, you should use dynamic macros instead. To do that, you can use
make DESTDIR=$RPM_BUILD_ROOT install-strip \
docdir=%{_defaultdocdir}/%{name}
instead of just
make DESTDIR=$RPM_BUILD_ROOT install-strip
This will ensure that the documentation of your package is installed where all other packages install their documentation. If you do that, you must also change
%dir %{_datadir}/doc/%{name}-%{version}
%doc %{_datadir}/doc/%{name}-%{version}/*
to
%{_defaultdocdir}/%{name}
in the %files list.
I'd recommend to look at some other people's .spec files (preferably ones from distros, not from third parties because the latter ones are often problematic). You will find a lot of useful conventions, style guides etc. in them. And "max-rpm.pdf" is a must-read.