Blob Blame History Raw
# Prevent brp-java-repack-jars from being run.
%define __jar_repack %{nil}

%global project felix
%global bundle org.apache.felix.framework
%global groupId org.apache.felix
%global artifactId %{bundle}

Name:    %{project}-framework
Version: 2.0.5
Release: 3%{?dist}
Summary: Apache Felix Framework

Group:   Development/Libraries
License: ASL 2.0
URL:     http://felix.apache.org
Source0: http://www.apache.org/dist/felix/%{bundle}-%{version}-project.tar.gz
Source1: %{name}.demap

# Remove <parent>
# Remove rat-maven-plugin
Patch0: %{bundle}-%{version}~pom.xml.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch

BuildRequires: java-devel >= 1:1.6.0
BuildRequires: jpackage-utils
BuildRequires: felix-osgi-compendium
BuildRequires: felix-osgi-core
BuildRequires: maven2
BuildRequires:    maven-compiler-plugin
BuildRequires:    maven-install-plugin
BuildRequires:    maven-invoker-plugin
BuildRequires:    maven-jar-plugin
BuildRequires:    maven-javadoc-plugin
BuildRequires:    maven-release-plugin
BuildRequires:    maven-resources-plugin
# TODO check availability and use new names
#BuildRequires:    maven-surefire-plugin
#BuildRequires:    maven-bundle-plugin
# instead of
BuildRequires:    maven-plugin-bundle
BuildRequires:    maven-surefire-maven-plugin

Requires: felix-osgi-compendium
Requires: felix-osgi-core
Requires: java >= 1:1.6.0

Requires(post):   jpackage-utils
Requires(postun): jpackage-utils

%description
Apache Felix Framework Interfaces and Classes.

%package javadoc
Group:          Documentation
Summary:        Javadoc for %{name}
Requires:       jpackage-utils

%description javadoc
API documentation for %{name}.

%global POM %{_mavenpomdir}/JPP.%{project}-%{name}.pom

%prep
%setup -q -n %{bundle}-%{version}
%patch0 -p1 -b .sav
# remove tests due to rat-maven-plugin is removed
%__rm -rf src/test/java/

%build
export MAVEN_REPO_LOCAL=$(pwd)/.m2/repository
%__mkdir_p $MAVEN_REPO_LOCAL
mvn-jpp -e \
        -Dmaven.repo.local=$MAVEN_REPO_LOCAL \
        -Dmaven2.jpp.depmap.file="%{SOURCE1}" \
        install javadoc:javadoc

%install
%__rm -rf %{buildroot}

# jars
install -d -m 0755 %{buildroot}%{_javadir}/%{project}
install -m 644 target/%{bundle}-%{version}.jar \
        %{buildroot}%{_javadir}/%{project}/%{bundle}-%{version}.jar

# versionless symlinks to jars
(cd %{buildroot}%{_javadir}/%{project} && for jar in *-%{version}*.jar; \
    do %__ln_s -f $jar `echo $jar| sed "s|-%{version}||g"`; done)

%add_to_maven_depmap %{groupId} %{artifactId} %{version} JPP/%{project} %{bundle}

# poms
install -d -m 755 %{buildroot}%{_mavenpomdir}
install -pm 644 pom.xml %{buildroot}%{POM}

# javadoc
install -d -m 0755 %{buildroot}%{_javadocdir}/%{name}-%{version}
%__cp -pr target/site/api*/* %{buildroot}%{_javadocdir}/%{name}-%{version}/
%__ln_s %{name}-%{version} %{buildroot}%{_javadocdir}/%{name}
%__rm -rf target/site/api*

%post
%update_maven_depmap

%postun
%update_maven_depmap

%clean
%__rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%doc LICENSE
%{_javadir}/%{project}/*
%{POM}
%config(noreplace) %{_mavendepmapfragdir}/%{name}

%files javadoc
%defattr(-,root,root,-)
%{_javadocdir}/%{name}-%{version}
%{_javadocdir}/%{name}
%doc LICENSE

%changelog
* Tue Jul 13 2010 Victor G. Vasilyev <victor.vasilyev@sun.com> 2.0.5-3
- BR: maven-invoker-plugin required for maven-javadoc-plugin
- Use new names of the maven plgins
- Add license file to independent subpackage javadoc

* Tue Jul 13 2010 Victor G. Vasilyev <victor.vasilyev@sun.com> 2.0.5-2
- Use maven instead of ant

* Tue Jun 22 2010 Victor G. Vasilyev <victor.vasilyev@sun.com> 2.0.5-1
- Release 2.0.5