LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File openfire.spec of Package openfire (Project server:messaging)

# norootforbuild

Summary:	Openfire XMPP Server
Name:		openfire
Version:	3.9.1
Release:	2
Buildrequires: 	java >= 1.7.0
Buildrequires: 	ant java-devel fdupes
Requires: 	java >= 1.6.0
BuildRoot: 	%{_tmppath}/%{name}-%{version}-build
Source0: 	%{name}_src_3_9_1.tar.gz
Group: 		Productivity/Networking/Talk/Servers
License: 	Apache-2.0
AutoReqProv: 	no
URL: 		http://www.igniterealtime.org/

Patch0:         openfire-sysvinit.patch
Patch1:         openfire-java-1.7.patch
Patch2:         openfire-subsys.patch
Patch3:         openfire-3.6.4-self_signed_certificate.patch
Patch4:			openfire-systemd.patch


Prereq:		coreutils diffutils fillup grep sed
%if 0%{suse_version} < 1110
%define 	prefix /opt
%else
%define         prefix /usr/share
%endif
%define 	homedir %{prefix}/openfire

%description
Openfire is a leading Open Source, cross-platform IM server based on the
XMPP (Jabber) protocol. It has great performance, is easy to setup and use,
and delivers an innovative feature set.

%package doc  
Summary:    Openfire XMPP Server Documentation  
Group:      Documentation/Other  
License:    GPL  
  
%description doc  
This package contains optional documentation provided in addition to  
this package's base documentation.  

%prep
%setup -q -n %{name}_src
%patch0 -p1
#%%patch1 -p1
%patch2 -p1
#%%patch3 -p0
%patch4 -p1

%build
# Build Tasks
cd build
# Default | openfire
ant openfire
# Specific Plugins
ant -Dplugin=search plugin
cd ..

%install
export NO_BRP_CHECK_BYTECODE_VERSION=true

# Prep the install location.
mkdir -p $RPM_BUILD_ROOT%{prefix}

# Copy over the main install tree.
cp -R target/openfire $RPM_BUILD_ROOT%{homedir}

# Set up distributed JRE
#pushd $RPM_BUILD_ROOT%%{homedir}
#gzip -cd %%{SOURCE1} | tar xvf -
#popd

# Set up the init script.
mkdir -p $RPM_BUILD_ROOT/etc/init.d
cp $RPM_BUILD_ROOT%{homedir}/bin/extra/redhat/openfire $RPM_BUILD_ROOT/etc/init.d/openfire
chmod 755 $RPM_BUILD_ROOT/etc/init.d/openfire
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
ln -s -f %{_sysconfdir}/init.d/%{name} $RPM_BUILD_ROOT%{_sbindir}/rc%{name}

# Make the startup script executable.
chmod 755 $RPM_BUILD_ROOT%{homedir}/bin/openfire.sh

# Set up the sysconfig file.
#mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
#cp $RPM_BUILD_ROOT%%{homedir}/bin/extra/redhat/openfire-sysconfig $RPM_BUILD_ROOT/etc/sysconfig/openfire
mkdir -p $RPM_BUILD_ROOT%/var/adm/fillup-templates/
install -D $RPM_BUILD_ROOT%{homedir}/bin/extra/redhat/openfire-sysconfig $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.openfire
chmod -x $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.openfire

# Copy over the documentation | Not needed with the new openfire-doc package
#cp -R documentation $RPM_BUILD_ROOT%%{homedir}/documentation
#cp changelog.html $RPM_BUILD_ROOT%%{homedir}/
#cp LICENSE.html $RPM_BUILD_ROOT%%{homedir}/
#cp README.html $RPM_BUILD_ROOT%%{homedir}/

# Copy over the i18n files
cp -R resources/i18n $RPM_BUILD_ROOT%{homedir}/resources/i18n

# Make sure scripts are executable
chmod 755 $RPM_BUILD_ROOT%{homedir}/bin/extra/openfired
chmod 755 $RPM_BUILD_ROOT%{homedir}/bin/extra/redhat-postinstall.sh

# Move over the embedded db viewer pieces
mv $RPM_BUILD_ROOT%{homedir}/bin/extra/embedded-db.rc $RPM_BUILD_ROOT%{homedir}/bin
mv $RPM_BUILD_ROOT%{homedir}/bin/extra/embedded-db-viewer.sh $RPM_BUILD_ROOT%{homedir}/bin

# We don't really need any of these things.
rm -rf $RPM_BUILD_ROOT%{homedir}/bin/extra
rm -f $RPM_BUILD_ROOT%{homedir}/bin/*.bat
rm -rf $RPM_BUILD_ROOT%{homedir}/resources/nativeAuth/osx-ppc
rm -rf $RPM_BUILD_ROOT%{homedir}/resources/nativeAuth/solaris-sparc
rm -rf $RPM_BUILD_ROOT%{homedir}/resources/nativeAuth/win32-x86
rm -f $RPM_BUILD_ROOT%{homedir}/lib/*.dll
rm -rf $RPM_BUILD_ROOT%{homedir}/resources/spank

# Dont enable fdupes (on resources/security/) as it breaks the crypto store
# See: http://www.igniterealtime.org/issues/browse/OF-30
# For now disabled completely..
#%%fdupes -s $RPM_BUILD_ROOT

%clean
rm -rf $RPM_BUILD_ROOT

%preun
%stop_on_removal openfire
# Force a happy exit even if openfire shutdown script didn't exit cleanly.
exit 0


%post
%{fillup_and_insserv openfire}
# Force a happy exit even if openfire condrestart script didn't exit cleanly.
exit 0


%postun
%restart_on_update openfire
%insserv_cleanup
# Force a happy exit even if openfire condrestart script didn't exit cleanly.
exit 0


%files
%defattr(-,daemon,daemon)
%attr(750, daemon, daemon) %dir %{homedir}
%dir %{homedir}/bin
%{homedir}/bin/openfire.sh
%attr(750, daemon, daemon) %{homedir}/bin/openfirectl
%config(noreplace) %{homedir}/bin/embedded-db.rc
%{homedir}/bin/embedded-db-viewer.sh
%dir %{homedir}/conf
%config(noreplace) %{homedir}/conf/openfire.xml
%config(noreplace) %{homedir}/conf/crowd.properties
%dir %{homedir}/lib
%{homedir}/lib/*.jar
%{homedir}/lib/log4j.xml
%dir %{homedir}/logs
%dir %{homedir}/plugins
%{homedir}/plugins/search.jar
%dir %{homedir}/plugins/admin
%{homedir}/plugins/admin/*
%dir %{homedir}/resources
%dir %{homedir}/resources/database
%{homedir}/resources/database/*.sql
%dir %{homedir}/resources/database/upgrade
%dir %{homedir}/resources/database/upgrade/*
%{homedir}/resources/database/upgrade/*/*
%dir %{homedir}/resources/i18n
%{homedir}/resources/i18n/*
%dir %{homedir}/resources/nativeAuth
%dir %{homedir}/resources/nativeAuth/linux-i386
%{homedir}/resources/nativeAuth/linux-i386/*
%dir %{homedir}/resources/security
%config(noreplace) %{homedir}/resources/security/keystore
%config(noreplace) %{homedir}/resources/security/truststore
%config(noreplace) %{homedir}/resources/security/client.truststore
#%%doc %%{homedir}/documentation
#%%doc %%{homedir}/LICENSE.html 
#%%doc %%{homedir}/README.html 
#%%doc %%{homedir}/changelog.html
%{_sbindir}/rc%{name}
%{_sysconfdir}/init.d/openfire
#%%config(noreplace) %%{_sysconfdir}/sysconfig/openfire
%config(noreplace) /var/adm/fillup-templates/sysconfig.openfire
#%%{homedir}/jre

%files doc
%defattr(-,root,root)
%doc documentation/docs/* LICENSE.html README.html changelog.html

%changelog