File aMule.spec of Package aMule-git

# norootforbuild
%define src_name aMule-2.3.1

Name:		aMule
Summary:	another eMule file-sharing program
Version:	2.3.1
Release:	59.38
License:	GPL
Group:		Productivity/Networking/File-Sharing
URL:		http://www.amule.org
Source0:	%{src_name}.tar.bz2
Source100:	amule-daemon.sysconfig
Source101:	amule-daemon.init
Patch0:		fix-makefile-ldflags.patch
Patch1:		amule-fpermissive-error.patch
Patch2:		amule-buildfix-12.1.patch
Patch3:		AICH-memory_leak-fix_Delete_broken_seeds_files.patch
Patch4:		Add_more_client_name.patch
Patch5:		ServerUDP_DebugLog_LineC_to_LineN.patch
Patch6:		240-backports.diff
Patch7:		update-ja_po.diff
BuildRoot:	%{_tmppath}/%{name}-%{version}-build
BuildRequires:	autoconf fdupes automake
BuildRequires:	gcc-c++ libtool gd-devel libpng-devel libjpeg-devel libtiff-devel
BuildRequires:  libcryptopp-devel update-desktop-files
BuildRequires:  libupnp-devel libGeoIP-devel
BuildRequires:  binutils-devel
%if %suse_version >= 1120
BuildRequires:  libkde4-devel
%endif
BuildRequires:	wxWidgets-wxcontainer-devel >= 2.8.12

%description
aMule stand for another eMule file-sharing program, it is also
another fork of the xMule (former lMule) project. It connects 
to eDonkey2000 network, supports Linux, *BSD platforms, and has
a new vision of the GUI.

%package gui
License:        GPL
Summary:        gui for another eMule file-sharing program
Group:          Productivity/Networking/File-Sharing
Requires:	aMule = %{version}-%{release}
Requires:	GeoIP

%description gui
aMule stand for another eMule file-sharing program, it is also
another fork of the xMule (former lMule) project. It connects 
to eDonkey2000 network, supports Linux, *BSD platforms, and has
a new vision of the GUI.

%package daemon
License:        GPL
Summary:        daemon of another eMule file-sharing program
Group:          Productivity/Networking/File-Sharing
Requires:	GeoIP

%description daemon
aMule stand for another eMule file-sharing program, it is also
another fork of the xMule (former lMule) project.

%if %suse_version >= 1120
%package plasmamule
License:        GPL
Summary:        aMule Plasma Applet
Group:          Productivity/Networking/File-Sharing
Requires:       kdebase4-workspace
%kde4_runtime_requires

%description plasmamule
aMule stand for another eMule file-sharing program, it is also
another fork of the xMule (former lMule) project.
%endif

%prep
%setup -q -n %{src_name}
%patch0 -p0
%patch1 -p0
%patch2 -p0
%patch3 -p0
%patch4 -p0
%patch5 -p0
%patch6 -p1
%patch7 -p0

%build
export CFLAGS=${RPM_OPT_FLAGS/-O2/-Os}
export CXXFLAGS=${RPM_OPT_FLAGS/-O2/-Os}
touch NEWS README AUTHORS ChangeLog
autoreconf -fi
%configure \
  --enable-amulecmd \
  --enable-amule-gui \
  --enable-amule-daemon \
  --enable-webserver \
  --enable-cas \
  --enable-wxcas \
  --enable-alc \
  --enable-alcc \
  --enable-geoip \
  --enable-optimize \
%if %suse_version >= 1120
  --enable-plasmamule \
%endif
  --disable-debug \
  --disable-silent-rules \
  --with-denoise-level=0 \
  --enable-xas

make %{?_smp_mflags}

%install
%makeinstall docdir=%{_defaultdocdir}/aMule

%suse_update_desktop_file -i amule Network P2P
%suse_update_desktop_file  %buildroot/%_datadir/applications/alc.desktop
%suse_update_desktop_file  %buildroot/%_datadir/applications/amulegui.desktop
%suse_update_desktop_file  %buildroot/%_datadir/applications/wxcas.desktop

####
install -d -m 755 $RPM_BUILD_ROOT/var/adm/fillup-templates
install -m 644 %{SOURCE100} $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.amule-daemon
install -d -m 755 $RPM_BUILD_ROOT/etc/init.d
install -m 755 %{SOURCE101} $RPM_BUILD_ROOT/etc/init.d/amule-daemon
install -d -m 755 $RPM_BUILD_ROOT/var/cache/amule
rm -rf $RPM_BUILD_ROOT%{_datadir}/locale/ko_KR

%find_lang amule

%fdupes -s %buildroot
%__strip $RPM_BUILD_ROOT%{_bindir}/al*
%__strip $RPM_BUILD_ROOT%{_bindir}/am*
%__strip $RPM_BUILD_ROOT%{_bindir}/cas
%__strip $RPM_BUILD_ROOT%{_bindir}/ed2k
%__strip $RPM_BUILD_ROOT%{_bindir}/wxcas

%clean
rm -rf %{buildroot}

%pre daemon
/usr/sbin/useradd -r -o -g nogroup -u 55554 -s /bin/false -c "Amule daemon" -d /var/cache/amule amule 2> /dev/null || :

%post daemon
%{fillup_and_insserv amule-daemon}

%preun daemon
%stop_on_removal amule-daemon

%postun daemon
%restart_on_update amule-daemon
%{insserv_cleanup}
%verifyscript

%if %suse_version >= 1120
# %post plasmamule
# %mime-database-post

# %postun plasmamule
# %mime-database-postun
%endif

%files
%defattr(-,root,root)
%doc docs/AUTHORS docs/Changelog docs/README docs/license.txt
%doc %{_mandir}/*/*
%{_bindir}/alcc
%{_bindir}/amulecmd
%{_bindir}/amuleweb
%{_bindir}/autostart-xas
%{_bindir}/ed2k
%{_datadir}/amule/webserver

%dir %{_datadir}/amule
%dir %{_datadir}/man/tr
%dir %{_datadir}/man/hu
%dir %{_datadir}/man/ru

%files daemon
%defattr(-,root,root)
%{_bindir}/amuled
%config %{_initrddir}/amule-daemon
/var/adm/fillup-templates/sysconfig.amule-daemon
%attr(-,amule,nogroup)/var/cache/amule

%files gui -f amule.lang
%defattr(-,root,root)
%{_bindir}/alc
%{_bindir}/cas
%{_bindir}/amule
%{_bindir}/amulegui
%{_bindir}/wxcas
%{_libdir}/xchat/plugins/xas.pl
%{_datadir}/applications/*
%{_datadir}/pixmaps/*
%{_datadir}/amule/skins
%{_datadir}/cas/*
%dir %{_datadir}/cas
%dir %{_libdir}/xchat
%dir %{_libdir}/xchat/plugins
%{_datadir}/locale/*/LC_MESSAGES/*

%if %suse_version >= 1120
%files plasmamule
%defattr(-,root,root)
%{_bindir}/plasmamule-engine-feeder
%{_kde4_modulesdir}/plasma-applet-plasmamule.so
%{_kde4_modulesdir}/plasma-engine-plasmamule.so
%{_kde4_iconsdir}/hicolor/scalable/mimetypes/application-x-emulecollection.svg
%{_kde4_servicesdir}/ed2k.protocol
%{_kde4_servicesdir}/magnet.protocol
%{_kde4_servicesdir}/plasma-applet-plasmamule.desktop
%{_kde4_servicesdir}/plasma-engine-plasmamule.desktop
%{_datadir}/mime/amule.xml
%endif

%changelog
* Sun Feb 10 2013 y.kobayashi
- Add more client name
- ServerUDP DebugLog patch LineN to LineC
- Fixed AICH memory leak
* Sun Apr 22 2012 y.kobayashi
- Backpotrs 2.4.0-svn
- Update ja.po
* Sun Jun 12 2011 y.kobayashi
- enabled xchat plugin
* Sun May 08 2011 gryffus <gryffus@hkfree.org> 2.3.1
- enabled plasmamule plasmoid
* Sun Nov 29 2009 hillwood <hillwood@linuxfans.org> 2.2.6
- add a DLP patch , it can block Xunlei (removed)
* Mon Oct 05 2009 Andrea Florio <andrea@links2linux,de> 2.2.6
- new upstream version 2.2.6
* Mon May 18 2009 Andrea Florio <andrea@links2linux,de> 2.2.5
- new upstream version 2.2.5
* Thu Apr 16 2009 Andrea Florio <andrea@links2linux.de>
- update to upstream 2.2.4
* Mon Mar 23 2009 Andrea Florio <andrea@links2linux.de>
- added upnp support
* Fri Jan 02 2009 Andrea Florio <andrea@links2linux.de>
- update to upstream 2.2.3
* Sun Aug 17 2008 Quentin Denis <quentin@links2linux.de>
- update to upstream 2.2.2
* Thu Jun 12 2008 Quentin Denis <quentin@links2linux.de>
- update to upstream 2.2.1
- removed obsolete configure options (--disable-gsocket, --enable-unicode, --enable-utf8-systray)
* Mon Mar 24 2008 Quentin Denis <quentin@links2linux.de>
- update to svn 20080324
- added geoip support
- fixed some BuildRequires
* Sat May 12 2007 Detlef Reichelt <detlef@links2linux.de>
- update to CVS 20070507
* Sat May 03 2006 Quentin Denis <quentin@links2linux.de>
- update to 2.0.2
* Tue Mar 21 2006 Quentin Denis <quentin@links2linux.de>
- changed to -enable-amule-gui
* Sun Mar 19 2006 Quentin Denis <quentin@links2linux.de>
- update to version 2.1.1 - bugfix release
* Sat Jan 14 2006 Quentin Denis <quentin@links2linux.de>
- update to version 2.1.0 - the "I just teased you with this release till 2006" version
* Wed Jun 15 2005 Quentin Denis <quentin@links2linux.de>
- update to version 2.0.3 - the "Hell 2.0.3: Now with improved daemons!" version.
- added aMule Folder Icons from AdrienV
* Thu Jun 09 2005 Quentin Denis <quentin@links2linux.de>
- update to version 2.0.2
* Wed May 18 2005 Quentin Denis <quentin@links2linux.de>
- update to the hotfix release, codename 'The Woops, HotFix"" version.'
* Thu May 03 2005 Quentin Denis <quentin@links2linux.de>
- updated to the final release 2.0.0, codename 'The "Let's dedicate this to Tiku" version.'
* Thu Apr 21 2005 Quentin Denis <quentin@links2linux.de>
- enabled the amule-daemon
- added a new desktop-icon (Crystal)
* Wed Apr 06 2005 Quentin Denis <quentin@links2linux.de>
- update to rc8 on SuSE 9.3
* Tue Nov 22 2004 Quentin Denis <quentin@links2linux.de>
- update to rc7 with SuSE's 9.2 wxGTK
* Tue Oct 05 2004 Quentin Denis <quentin@links2linux.de>
- fixed wxWindows problems
* Mon Oct 04 2004 Quentin Denis <quentin@links2linux.de>
- update to version 2.0.0rc6
* Tue Dec 30 2003  deltaHF <deltahf@users.sourceforge.net>
- Removed statically link of libcurl, libssl and libcrypt for SuSE 8.2 and 9.0 rpms
* Thu Dec 18 2003 pure_ascii <pure_ascii@users.sourceforge.net>
- Call strip for the binaries
- Link libcurl, libssl and libcrypto statically
- better detection of wx-config
* Tue Dec 16 2003 pure_ascii <pure_ascii@users.sourceforge.net>
- Added patch to change optimisation to -Os (optimise for size)
- Fixed path for most doc files
* Sat Nov 29 2003 pure_ascii <pure_ascii@users.sourceforge.net>
- Initial revision