LogoopenSUSE Build Service > Projects
Sign Up | Log In

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

# spec file for package openfire
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/

%define         prefix /usr/share
%define 	homedir %{prefix}/openfire
%define		file_version 4_2_2

%if 0%{?suse_version} > 1210
%define has_systemd 1

Summary:	Openfire XMPP Server
Name:		openfire
Version:	4.2.2
Release:	0
License: 	Apache-2.0
Group: 		Productivity/Networking/Talk/Servers
URL: 		http://www.igniterealtime.org/
Source0: 	http://www.igniterealtime.org/downloadServlet?filename=openfire/openfire_src_%{file_version}.tar.gz
Source1:        %{name}.service
Patch0:         %{name}-sysvinit.patch
Patch2:         %{name}-subsys.patch
BuildRoot: 	%{_tmppath}/%{name}-%{version}-build
AutoReqProv: 	no
PreReq:		coreutils diffutils fillup grep sed
BuildRequires: 	java-devel = 1.8.0
BuildRequires: 	ant
BuildRequires: 	fdupes
BuildRequires:  xerces-j2-xml-apis xerces-j2-xml-resolver
%if 0%{?has_systemd}
BuildRequires:  systemd
PreReq:         %insserv_prereq
Requires: 	java = 1.8.0
BuildConflicts: java-9-openjdk-devel >= 1.9.0
BuildConflicts: java-10-openjdk-devel >= 10.0.0

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-2.0  
%description doc  
This package contains optional documentation provided in addition to  
this package's base documentation.  

%setup -q -n %{name}_src
%patch0 -p1
%patch2 -p1

# Build Tasks
cd build
# Default | openfire
ant -Dant.build.javac.source=1.8 -Dant.build.javac.target=1.8 openfire
# Specific Plugins
ant -Dant.build.javac.source=1.8 -Dant.build.javac.target=1.8 -Dplugin=search plugin
cd ..


# 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 -

# systemd vs SysVinit
mkdir -p %{buildroot}%{_sbindir}
%if 0%{?has_systemd}
  install -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
  ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
  # Set up the init script.
  mkdir -p %{buildroot}%{_sysconfdir}/init.d
  cp %{buildroot}%{homedir}/bin/extra/redhat/openfire %{buildroot}%{_sysconfdir}/init.d/openfire
  chmod 755 %{buildroot}%{_sysconfdir}/init.d/openfire
  mkdir -p %{buildroot}%{_sbindir}
  ln -s -f %{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name}
  # Set up the sysconfig file.
  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
# Make the startup script executable.
chmod 755 $RPM_BUILD_ROOT%{homedir}/bin/openfire.sh

# 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


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

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

%if 0%{?has_systemd}
%service_del_postun openfire.service
%restart_on_update openfire
# Force a happy exit even if openfire condrestart script didn't exit cleanly.
exit 0

%attr(750, daemon, daemon) %dir %{homedir}
%dir %{homedir}/bin
%attr(750, daemon, daemon) %{homedir}/bin/openfirectl
%config(noreplace) %{homedir}/bin/embedded-db.rc
%dir %{homedir}/conf
%config(noreplace) %{homedir}/conf/openfire.xml
%config(noreplace) %{homedir}/conf/crowd.properties
%config(noreplace) %{homedir}/conf/security.xml
%dir %{homedir}/lib
%dir %{homedir}/logs
%dir %{homedir}/plugins
%dir %{homedir}/plugins/admin
%dir %{homedir}/resources
%dir %{homedir}/resources/database
%dir %{homedir}/resources/database/upgrade
%dir %{homedir}/resources/database/upgrade/*
%dir %{homedir}/resources/i18n
%dir %{homedir}/resources/nativeAuth
%dir %{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
%if 0%{?has_systemd}
#%%config(noreplace) %%{_sysconfdir}/sysconfig/openfire
%config(noreplace) /var/adm/fillup-templates/sysconfig.openfire

%files doc
%doc documentation/docs/* LICENSE.html README.html changelog.html