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.5.2
Release:        1.2
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
Packager:   Alessandro de Oliveira Faria (A.K.A CABELO) <cabelo@opensuse.org>
BuildRequires: -post-build-checks -rpmlint-Factory -rpmlint-mini  -rpmlint
BuildRequires:  dos2unix
BuildRequires:  unzip
%if 0%{?suse_version}
BuildRequires:  fdupes
%endif
Requires:       java >= 1.6
# 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
%if 0%{?suse_version}
Recommends:     maven-jansi = %{version}
%endif

%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
* Fri Nov 10 2017 robert.munteanu@gmail.com
- Updated to upstream 3.5.2 release
* Mon May 29 2017 robert.munteanu@gmail.com
- Enable jansi integration as an arch-dependant package
* Mon May 29 2017 robert.munteanu@gmail.com
- Update to upstream 3.5.0 release
- jansi integration is disabled, for now
* Thu Nov 19 2015 robert.munteanu@gmail.com
- Updated to upstream 3.3.9 release
* Mon May  4 2015 robert.munteanu@gmail.com
- Updated to upstream 3.3.3 release
* Tue Mar 17 2015 robert.munteanu@gmail.com
- Updated to upstream 3.3.1 release
* Fri Feb 27 2015 astieger@suse.com
- change to verbatim upstream tarball
- add project keyring and verify source signature
* Thu Feb 12 2015 fifteenknots505@gmail.com
- satisfy rpmlint: W: non-conffile-in-etc
* Thu Feb 12 2015 fifteenknots505@gmail.com
- avoid rpmlint error:E: files-duplicated-waste
* Thu Jan 15 2015 robert.munteanu@gmail.com
- Updated to upstream 3.2.5 release
- Added basic bash completion
* Mon Dec 22 2014 robert.munteanu@gmail.com
- Updated to upstream 3.2.5 release ( 3.2.4 was skipped)
* Wed Nov 12 2014 michael@stroeder.com
- Updated to upstream 3.0.5 release
* Tue Sep 16 2014 fifteenknots505@gmail.com
- Fixed Requires
* Tue Sep 16 2014 fifteenknots505@gmail.com
- Fixed build for SLE11
- Bugfix broken dependencies on CentOS5
* Tue Aug 12 2014 robert.munteanu@gmail.com
- Updated to upstream 3.2.3 release
  * Switch access to Maven Central to HTTPS (MNG-5672)
* Thu Jun 26 2014 robert.munteanu@gmail.com
- Updated to upstream 3.2.2 release
  * Support version ranges in parent elements (MNG-2199)
  * Requiring multiple profile activation conditions to be true
    does not work (MNG-4565)
  * Support resolution of Import Scope POMs from Repo that
    contains a ${parameter} (MNG-5639)
  * Update maven-plugin-plugin:descriptor default binding from
    generate-resources phase to process-classes (MNG-5346)
  * ${maven.build.timestamp} should use UTC instead of local
    timezone (or be configurable) (MNG-5452)
  * Other bugfixes and improvements
* Sat May 10 2014 robert.munteanu@gmail.com
- Ran spec-cleaner
* Wed Feb 26 2014 robert.munteanu@gmail.com
- Updated to upstream 3.2.1 release
  * Transitive dependency excludes (MNG-2315)
  * Reactor changes
  * AbstractMavenLifecycleParticipant changes (MNG-5389)
  * New Builder interface (MNG-5575)
  * Continuous delivery friendly versions (MNG-5576)
  * Custom lifecycle mapping (MNG-5581)
* Mon Oct 28 2013 robert.munteanu@gmail.com
- Added bash command completion
* Mon Oct  7 2013 robert.munteanu@gmail.com
- Update to upstream 3.1.1 release
* Mon Jul 15 2013 robert.munteanu@gmail.com
- Update to upstream 3.1.0 release
* Sat Feb 23 2013 robert.munteanu@gmail.com
- Updated to upstream 3.0.5 release
  * [MNG-5430] - use wagon 2.4  ( fixes CVE-2013-0253 )
- Updated license to correct format
* Sun Jan 22 2012 robert.munteanu@gmail.com
- Removed the need for the M2_HOME variable
* Fri Jan 20 2012 robert.munteanu@gmail.com
- Updated to upstream 3.0.4 release
* Fri Mar  4 2011 robert.munteanu@gmail.com
- Updated to upstream 3.0.3 release
* Wed Jan 12 2011 robert.munteanu@gmail.com
- Updated to upstream 3.0.2 release
* Sat Nov 27 2010 robert.munteanu@gmail.com
- Updated to upstream 3.0.1 release
* Fri Oct  8 2010 robert.munteanu@gmail.com
- Updated to upstream 3.0 release
* Thu Sep 30 2010 robert.munteanu@gmail.com
- Updated to upstream 3.0-RC3 release
* Tue Aug 18 2009 robert.munteanu@gmail.com
- Updated to upstream 2.2.1 release