File activemq.spec of Package activemq
%define _libexecdir %{_prefix}/lib
Name: activemq
Version: 5.2.0
Release: 1
License: Apache License
Source0: apache-activemq-%{version}-bin.tar.gz
Source1: activemq.init
Patch0: conf-activemq.xml.diff
Patch1: conf-log4j.properties.diff
Group: Development/Libraries/Java
Summary: Enterprise Messaging and Integration Patterns provider
PreReq: %insserv_prereq %fillup_prereq
BuildRequires: fastjar sed
Requires: logrotate
Requires: jre => 1.6.0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Apache ActiveMQ is the most popular and powerful open source Enterprise Messaging and Integration Patterns provider.
Apache ActiveMQ is fast, supports many Cross Language Clients and Protocols, comes with easy to use Enterprise Integration Patterns and many advanced features while fully supporting JMS 1.1 and J2EE 1.4. Apache ActiveMQ is released under the Apache 2.0 License
%prep
%setup -q -n apache-activemq-%{version}
%patch0 -p1
%patch1 -p1
%build
%install
# move the files to a FHS std location
#mkdir -p %{buildroot}%{_datadir}/activemq
mkdir -p %{buildroot}%{_libexecdir}/activemq
mv bin %{buildroot}%{_libexecdir}/activemq
mv lib %{buildroot}%{_libexecdir}/activemq
mv webapps %{buildroot}%{_libexecdir}/activemq
# remove the non needed architectures
%{__rm} -rf %{buildroot}%{_libexecdir}/activemq/bin/macosx
%ifarch %ix86
%{__rm} -rf %{buildroot}%{_libexecdir}/activemq/bin/linux-x86-64
%endif
%ifarch x86_64
%{__rm} -rf %{buildroot}%{_libexecdir}/activemq/bin/linux-x86-32
%endif
mkdir -p %{buildroot}/var/lib/activemq
# no data dir, we will use /var/lib as it should be
rm -rf %{buildroot}%{_datadir}/activemq/data
# configuration to the right location
mkdir -p %{buildroot}/etc/activemq
mv conf %{buildroot}/etc/activemq
# make a symlink so the init script can find the binary no matter the arch
mkdir -p %{buildroot}%{_bindir}
%{__ln_s} %{_libexecdir}/activemq/bin/activemq %{buildroot}%{_bindir}/activemq
%{__ln_s} %{_libexecdir}/activemq/bin/activemq-admin %{buildroot}%{_bindir}/activemq-admin
# add the init files
mkdir -p %{buildroot}/etc/init.d
%{__install} -m 755 %{SOURCE1} %{buildroot}/etc/init.d/activemq
%{__mkdir_p} %{buildroot}/%{_sbindir}
ln -sf %{_sysconfdir}/init.d/activemq %{buildroot}/%{_sbindir}/rcactivemq
%clean
rm -rf %buildroot
%pre
/usr/sbin/useradd -d /opt/activemq --system -c "Apache ActiveMQ" -s /bin/bash activemq &>/dev/null ||:
%post
%{fillup_and_insserv activemq}
%preun
%stop_on_removal activemq
%postun
%restart_on_update activemq
%insserv_cleanup
%files
%defattr(-,root,root)
%doc LICENSE README.txt NOTICE WebConsole-README.txt user-guide.html docs/index.html
#%config /etc/activemq.confa
%dir %{_libexecdir}/activemq
%{_libexecdir}/activemq/*
%dir %{_sysconfdir}/activemq
%config %{_sysconfdir}/activemq/*
%attr(-,activemq,root) /var/lib/activemq
%{_sysconfdir}/init.d/activemq
%{_sbindir}/rcactivemq
%{_bindir}/activemq
%{_bindir}/activemq-admin
#%config %{_sysconfdir}/logrotate.d/activemq
#%{_localstatedir}/adm/fillup-templates/sysconfig.activemq
%changelog