File maven.spec of Package maven
#
# spec file for package maven
#
# Copyright (c) 2015 SUSE LINUX 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/
#
Name: maven-jansi
Version: 3.6.0
Release: 0
Summary: Native JAnsi libraries bundled with Apache Maven
License: Apache-2.0
Group: Development/Tools/Building
Url: http://maven.apache.org
Source: http://www.eu.apache.org/dist/maven/maven-3/%{version}/binaries/apache-maven-%{version}-bin.tar.gz
Source1: mvn-bash-completion.sh
Source2: https://www.eu.apache.org/dist/maven/maven-3/%{version}/binaries/apache-maven-%{version}-bin.tar.gz.asc
Source3: https://www.apache.org/dist/maven/KEYS#/maven.keyring
Source4: %{name}-rpmlintrc
BuildRequires: dos2unix
BuildRequires: unzip
%if 0%{?suse_version}
BuildRequires: fdupes
%endif
Requires: java >= 1.7
# Bugfix broken dependencies
%if 0%{?centos_version} == 505 || 0%{?rhel_version} == 505
# maven needs /usr/bin/which to run, but that is not in util-linux on centos5
Requires: which
%endif
%if 0%{?suse_version} == 1110
# SLES-11: maven-wagon needs /usr/lib/libnss3.so, which is not installed by default
Requires: libnss3.so
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
These libraries are intended to be used only with Apache Maven and should
not be used by other packages.
%package -n maven
BuildArch: noarch
Summary: Maven is a software project management and comprehension tool
Recommends: maven-jansi = %{version}
%description -n maven
A software project management and comprehension tool.
Based on the concept of a project object model (POM), Maven can
manage a project's build, reporting and documentation from a
central piece of information
%prep
%setup -q -n apache-maven-%{version}
for winfile in conf/settings.xml bin/m2.conf lib/ext/README.txt; do
dos2unix $winfile
chmod a-x $winfile
done
%build
%install
%if 0%{?suse_version} == 1110
# SLE11: https://en.opensuse.org/openSUSE:Packaging_Java#bytecode_version_error
export NO_BRP_CHECK_BYTECODE_VERSION=true
%endif
install -d %{buildroot}%{_datadir}/java/maven/bin
install -p bin/m2.conf %{buildroot}%{_datadir}/java/maven/bin
install -p bin/mvn %{buildroot}%{_datadir}/java/maven/bin
install -p bin/mvnDebug %{buildroot}%{_datadir}/java/maven/bin
install -p bin/mvnyjp %{buildroot}%{_datadir}/java/maven/bin
install -d %{buildroot}%{_datadir}/java/maven/lib
# remove unapplicable jansi-native libs
rm -rf lib/jansi-native/{windows32,windows64,osx,freebsd32,freebsd64}
# keep native libraries for only the platform we build
%if "%{_arch}" == "x86_64"
rm -rf lib/jansi-native/linux32
# prevent debug sources from being created
find lib -name '*.so' | xargs strip
%else
%if "%{_arch}" == "i586"
rm -rf lib/jansi-native/linux64
# prevent debug sources from being created
find lib -name '*.so' | xargs strip
%else
rm -rf lib/jansi-native/linux*
%endif
%endif
cp -R lib/* %{buildroot}%{_datadir}/java/maven/lib
%if 0%{?suse_version}
# create hardlinks for license files to avoid rpmlint error:E: files-duplicated-waste
%fdupes %{buildroot}%{_datadir}/java/maven/lib
%endif
install -d %{buildroot}%{_datadir}/java/maven/conf
cp -R conf/* %{buildroot}%{_datadir}/java/maven/conf
install -d %{buildroot}%{_datadir}/java/maven/boot
install -p boot/* %{buildroot}%{_datadir}/java/maven/boot
install -d %{buildroot}%{_prefix}/bin
for binary in mvn mvnDebug mvnyjp; do
ln -s %{_datadir}/java/maven/bin/$binary %{buildroot}%{_bindir}/
done
install -d %{buildroot}%{_sysconfdir}/bash_completion.d/
install -p -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/bash_completion.d/mvn.sh
%files
%{_datadir}/java/maven/lib/jansi-native
%files -n maven
%defattr(-,root,root)
%dir %{_datadir}/java/maven
%{_datadir}/java/maven/bin
%{_datadir}/java/maven/boot
%{_datadir}/java/maven/conf
%dir %{_datadir}/java/maven/lib
%{_datadir}/java/maven/lib/*.jar
%{_datadir}/java/maven/lib/*.license
%{_datadir}/java/maven/lib/ext
%{_bindir}/mvn
%{_bindir}/mvnDebug
%{_bindir}/mvnyjp
%config %{_sysconfdir}/bash_completion.d/mvn.sh
%changelog