File jpackage-utils.spec of Package jpackage-utils
#
# spec file for package jpackage-utils
#
# Copyright (c) 2012 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 distver 1.7
%define section free
%global fj_version 0.3.1
Name: jpackage-utils
Version: 1.7.5
Release: 0
Summary: JPackage Utilities
License: BSD-3-Clause
Group: Development/Languages/Java
Url: http://www.jpackage.org/
Source0: %{name}-%{version}.tar.bz2
Source1: jpackage-utils-1.7.5-man-pages.tar.bz2
Source2: abs2rel.sh
Source3: abs2rel.lua
# fedora specific macros
Source8: https://fedorahosted.org/released/javapackages/javapackages-%{fj_version}.tar.xz
Source1000: jpackage-utils-rpmlintrc
Source1001: README.SUSE
#PATCH-FIX-SUSE: skip all macros which are in aaa_base package
Patch0: jpackage-utils-1.7.3-macros.patch
Patch1: jpackage-utils-own-mavendirs.patch
Patch2: jpackage-utils-prefer-jre.patch
Patch3: jpackage-utils-set-classpath.patch
Patch4: jpackage-utils-jnidir.patch
#PATCH-FIX-SUSE: in set_jvm_dirs call set_javacmd explicitelly and change
#JAVAVER_LIBDIR to JAVA_LIBDIR if it does not exists
Patch1000: jpackage-utils-jnidir-suse.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: xz
Requires: awk
Requires: coreutils
Requires: grep
Requires: python
Requires: python-xml
Requires: sed
# Fedora have splitted it into separate package, which seems not needed
# atm in SUSE, so let use Provides to stay compatible
Provides: javapackages-tools = %{fj_version}
%description
Utilities for the JPackage project <http://www.jpackage.org/>.
%prep
%setup -q -b 1 -a 8
%patch0 -b .sav
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch1000 -p1
cp -p %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE8} .
cp %{SOURCE1001} doc
%build
echo "JPackage release %{distver} (%{distribution}) for %{buildarch}" \
> etc/jpackage-release
%install
# Pull macros out of macros.jpackage and emulate them during install for
# smooth bootstrapping experience.
for dir in \
jvmdir jvmjardir jvmprivdir \
jvmlibdir jvmdatadir jvmsysconfdir \
jvmcommonlibdir jvmcommondatadir jvmcommonsysconfdir \
javadir jnidir javajnidir javadocdir mavenpomdir \
mavendepmapdir mavendepmapfragdir; do
export _${dir}=$(rpm --eval $(%{__grep} -E "^%_${dir}\b" \
misc/macros.jpackage | %{__awk} '{ print $2 }'))
done
install -dm 755 ${RPM_BUILD_ROOT}%{_bindir}
install -dm 755 ${RPM_BUILD_ROOT}%{_sysconfdir}/{java,rpm,init.d}
install -dm 755 ${RPM_BUILD_ROOT}%{_jvmdir}
install -dm 755 ${RPM_BUILD_ROOT}%{_jvmjardir}
install -dm 755 ${RPM_BUILD_ROOT}%{_jvmprivdir}
#install -dm 755 ${RPM_BUILD_ROOT}%{_jvmlibdir}
install -dm 755 ${RPM_BUILD_ROOT}${_jvmdatadir}
install -dm 755 ${RPM_BUILD_ROOT}${_jvmsysconfdir}
install -dm 755 ${RPM_BUILD_ROOT}${_jvmcommonlibdir}
install -dm 755 ${RPM_BUILD_ROOT}${_jvmcommondatadir}
install -dm 755 ${RPM_BUILD_ROOT}${_jvmcommonsysconfdir}
install -dm 755 ${RPM_BUILD_ROOT}%{_javadir}
install -dm 755 ${RPM_BUILD_ROOT}%{_javadir}-utils
install -dm 755 ${RPM_BUILD_ROOT}%{_javadir}-ext
install -dm 755 ${RPM_BUILD_ROOT}${_javadir}-{1.5.0,1.6.0,1.7.0,1.8.0}
install -dm 755 ${RPM_BUILD_ROOT}%{_jnidir}
install -dm 755 ${RPM_BUILD_ROOT}%{_jnidir}-ext
install -dm 755 ${RPM_BUILD_ROOT}%{_jnidir}-{1.5.0,1.6.0,1.7.0,1.8.0}
install -dm 755 ${RPM_BUILD_ROOT}${_javajnidir}
install -dm 755 ${RPM_BUILD_ROOT}%{_javadocdir}
install -dm 755 ${RPM_BUILD_ROOT}${_mavenpomdir}
install -dm 755 ${RPM_BUILD_ROOT}${_mavendepmapdir}
install -dm 755 ${RPM_BUILD_ROOT}${_mavendepmapfragdir}
install -dm 755 ${RPM_BUILD_ROOT}%{_bindir}
install -pm 755 bin/* ${RPM_BUILD_ROOT}%{_bindir}
install -pm 644 etc/font.properties ${RPM_BUILD_ROOT}%{_sysconfdir}/java
# Install abs2rel scripts
install -pm 755 abs2rel.sh ${RPM_BUILD_ROOT}%{_javadir}-utils
install -pm 644 abs2rel.lua ${RPM_BUILD_ROOT}%{_javadir}-utils
# Create an initial (empty) depmap
echo -e "<dependencies>\\n" > ${RPM_BUILD_ROOT}${_mavendepmapdir}/maven2-depmap.xml
echo -e "</dependencies>\\n" >> ${RPM_BUILD_ROOT}${_mavendepmapdir}/maven2-depmap.xml
cat > etc/java.conf << EOF
# System-wide Java configuration file -*- sh -*-
#
# JPackage Project <http://www.jpackage.org/>
# Location of jar files on the system
JAVA_LIBDIR=%{_javadir}
# Location of arch-specific jar files on the system
JNI_LIBDIR=%{_jnidir}
# Location for noarch jar files using arch-specifics jar files
JAVAJNI_LIBDIR=${_javajnidir}
# Root of all JVM installations
JVM_ROOT=%{_jvmdir}
# You can define a system-wide JVM root here if you're not using the default one
#JAVA_HOME=\$JVM_ROOT/java
#
# If you have the a base JRE package installed
# (e.g. java-1.6.0-openjdk):
#JAVA_HOME=\$JVM_ROOT/jre
#
# If you have the a devel JDK package installed
# (e.g. java-1.6.0-openjdk-devel):
#JAVA_HOME=\$JVM_ROOT/java
# Options to pass to the java interpreter
JAVACMD_OPTS=
EOF
install -pm 644 etc/java.conf ${RPM_BUILD_ROOT}%{_sysconfdir}/java
install -pm 644 etc/jpackage-release ${RPM_BUILD_ROOT}%{_sysconfdir}/java
install -pm 644 java-utils/* ${RPM_BUILD_ROOT}%{_javadir}-utils
install -pm 644 misc/macros.jpackage ${RPM_BUILD_ROOT}%{_sysconfdir}/rpm
install -dm 0755 ${RPM_BUILD_ROOT}%{_mandir}/man{1,5,7}
install -pm 644 man/*.1 ${RPM_BUILD_ROOT}%{_mandir}/man1
install -pm 644 man/*.5 ${RPM_BUILD_ROOT}%{_mandir}/man5
install -pm 644 man/*.7 ${RPM_BUILD_ROOT}%{_mandir}/man7
install -dm 0755 ${RPM_BUILD_ROOT}%{_javadir}-utils/xml
install -pm 644 xml/* ${RPM_BUILD_ROOT}%{_javadir}-utils/xml
# imported fedora-specific extensions
pushd javapackages-%{fj_version}
# Add the provides script
install -m0755 -D depgenerators/maven.prov $RPM_BUILD_ROOT%{_rpmconfigdir}/maven.prov
install -m0755 -D depgenerators/maven.req $RPM_BUILD_ROOT%{_rpmconfigdir}/maven.req
install -m0755 -D depgenerators/osgi.prov $RPM_BUILD_ROOT%{_rpmconfigdir}/osgi.prov
install -m0755 -D depgenerators/osgi.req $RPM_BUILD_ROOT%{_rpmconfigdir}/osgi.req
#XXX: skip the .req generators as we cannot fulfill deps in SUSE
sed -i '/requires/d' depgenerators/fileattrs/*attr
# Add the maven poms file attribute entry (rpm >= 4.9.0)
install -m0644 -D depgenerators/fileattrs/maven.attr \
$RPM_BUILD_ROOT%{_rpmconfigdir}/fileattrs/maven.attr
install -m0644 -D depgenerators/fileattrs/osgi.attr \
$RPM_BUILD_ROOT%{_rpmconfigdir}/fileattrs/osgi.attr
install -pm 644 macros.fjava ${RPM_BUILD_ROOT}%{_sysconfdir}/rpm
install -pm 644 scripts/maven_depmap.py ${RPM_BUILD_ROOT}%{_javadir}-utils/
popd
cat <<EOF > %{name}-%{version}.files
%{_bindir}/*
%{_mandir}/man1/*
%{_mandir}/man5/*
%{_mandir}/man7/*
# %dir %{_sysconfdir}/java
%dir %{_jvmdir}
%dir %{_jvmjardir}
%dir %{_jvmprivdir}
# %dir ${_jvmlibdir}
%dir ${_jvmdatadir}
%dir ${_jvmsysconfdir}
%dir ${_jvmcommonlibdir}
%dir ${_jvmcommondatadir}
%dir ${_jvmcommonsysconfdir}
%dir %{_javadir}
%dir %{_javadir}-*
%dir %{_jnidir}
%dir %{_jnidir}-*
%dir %{_javadocdir}
%dir ${_mavenpomdir}
%dir ${_mavendepmapdir}
%dir ${_mavendepmapfragdir}
%{_javadir}-utils/*
%{_rpmconfigdir}/*.prov
%{_rpmconfigdir}/*.req
%dir %{_rpmconfigdir}/fileattrs
%{_rpmconfigdir}/fileattrs/*.attr
%config %{_sysconfdir}/java/jpackage-release
%config(noreplace) %{_sysconfdir}/java/java.conf
%config(noreplace) %{_sysconfdir}/java/font.properties
%config(noreplace) %{_sysconfdir}/rpm/macros.jpackage
%config(noreplace) %{_sysconfdir}/rpm/macros.fjava
%config(noreplace) ${_mavendepmapdir}/maven2-depmap.xml
EOF
%files -f %{name}-%{version}.files
%defattr(-,root,root,-)
%doc LICENSE.txt HEADER.JPP doc/* etc/httpd-javadoc.conf
%dir %{_sysconfdir}/rpm
%attr(755,root,root) %{_bindir}/*
%changelog