packages apache-felix-osgi-compendium.spec
      Pages: < 1 >  DOWNLOAD      
%define        maven                      0
%define        javahome   /usr/lib/jvm/java
Name:          apache-felix-osgi-compendium
Version:       1.4.0
Release:       4mamba
Summary:       Felix OSGi R4 Compendium Bundle
Group:         Development/Libraries/Java
Vendor:        openmamba
Distribution:  openmamba
Packager:      gil <puntogil@...>
URL:           http://www.osgi.org/
Source0:       http://www.apache.org/dist/felix/org.osgi.compendium-%{version}-project.tar.gz
Source1:       maven2-2.2.0-settings.xml
Source2:       apache-felix-osgi-compendium-1.4.0-build.xml
Source3:       apache-felix-osgi-compendium-1.4.0-maven-build.properties
Source4:       apache-felix-osgi-compendium-1.4.0-maven-build.xml
License:       Apache Software License 2.0
BuildRequires: apache-ant
BuildRequires: apache-felix-javax-servlet
BuildRequires: apache-felix-osgi-core
BuildRequires: apache-felix-osgi-foundation
%if %maven
BuildRequires: apache-maven2
BuildRequires: apache-maven2-ant-plugin
BuildRequires: apache-maven2-compiler-plugin
BuildRequires: apache-maven2-jar-plugin
BuildRequires: apache-maven2-javadoc-plugin
BuildRequires: felix-maven-bundle-plugin
%endif
BuildRequires: java-easymock2
BuildRequires: java-junit48
BuildRequires: java-mockito17
BuildRequires: jpackage-utils
Requires:      apache-felix-javax-servlet
Requires:      apache-felix-osgi-core
Requires:      apache-felix-osgi-foundation
Requires:      java-easymock2
Requires:      java-mockito17
Requires:      java-openjdk
Requires:      jpackage-utils
BuildRoot:     %{_tmppath}/%{name}-%{version}-root

%description
OSGi Service Platform Release 4 Compendium Interfaces and Classes.

%package javadoc
Group:          Documentation
Summary:        Javadoc for %{name}

%description javadoc
OSGi Service Platform Release 4 Compendium Interfaces and Classes.

This package contains javadoc for %{name}.

%prep

%setup -q -n org.osgi.compendium-%{version}

chmod -R go=u-w *

for j in $(find . -name "*.jar"); do
	mv $j ${j}.no
done

%if %maven
	cp %{SOURCE1} settings.xml
	
	mkdir -p .m2/repository/JPP/maven2
	
	sed -i -e "s|<localRepository>__INTERNAL_REPO_PLACEHOLDER__</localRepository>|<localRepository>file://`pwd`/external_repo</localRepository>|g" settings.xml
	sed -i -e "s|<url>__EXTERNAL_REPO_PLACEHOLDER__</url>|<url>file://`pwd`/.m2/repository</url>|g" settings.xml
%else
	cp %{SOURCE2} build.xml
	cp %{SOURCE3} maven-build.properties
	cp %{SOURCE4} maven-build.xml
%endif

%build

export JAVA_HOME=%javahome
export MAVEN_REPO_LOCAL=$PWD/.m2/repository
export MAVEN_SETTINGS=$PWD/settings.xml

mkdir -p $MAVEN_REPO_LOCAL

%if %maven

	mkdir -p $MAVEN_REPO_LOCAL/junit/junit/4.0
	ln -sf $(build-classpath junit48) $MAVEN_REPO_LOCAL/junit/junit/4.0/junit-4.0.jar
	mkdir -p $MAVEN_REPO_LOCAL/org/easymock/easymock/2.4
	ln -sf %{_javadir}/easymock2.jar $MAVEN_REPO_LOCAL/org/easymock/easymock/2.4/easymock-2.4.jar
	mkdir -p $MAVEN_REPO_LOCAL/org/mockito/mockito-all/1.7
	ln -sf %{_javadir}/mockito17-all.jar $MAVEN_REPO_LOCAL/org/mockito/mockito-all/1.7/mockito-all-1.7.jar
	mkdir -p $MAVEN_REPO_LOCAL/org/apache/felix/org.osgi.core/1.4.0
	ln -sf %{_javadir}/felix/org.osgi.core.jar $MAVEN_REPO_LOCAL/org/apache/felix/org.osgi.core/1.4.0/org.osgi.core-1.4.0.jar
	mkdir -p $MAVEN_REPO_LOCAL/org/apache/felix/javax.servlet/1.0.0
	ln -sf %{_javadir}/felix/javax.servlet.jar $MAVEN_REPO_LOCAL/org/apache/felix/javax.servlet/1.0.0/javax.servlet-1.0.0.jar
	mkdir -p $MAVEN_REPO_LOCAL/org/apache/felix/org.osgi.foundation/1.2.0
	ln -sf %{_javadir}/felix/org.osgi.foundation.jar \
		$MAVEN_REPO_LOCAL/org/apache/felix/org.osgi.foundation/1.2.0/org.osgi.foundation-1.2.0.jar
	
	mkdir external_repo
	ln -s %{_javadir} external_repo/JPP


	mvn-jpp \
		-e \
		-s $MAVEN_SETTINGS \
		-Dmaven.test.failure.ignore=true \
		-Dmaven.repo.local=$MAVEN_REPO_LOCAL \
                -Dpackaging=bundle \
		ant:ant install javadoc:javadoc

%else
	export CLASSPATH=""
	CLASSPATH=$CLASSPATH:$(build-classpath felix/javax.servlet felix/org.osgi.core felix/org.osgi.foundation)
	CLASSPATH=$CLASSPATH:$(build-classpath junit48 easymock2 mockito17-all):target/classes:target/test-classes

	ant \
		-Duser.home=$PWD \
		-Dmaven.repo.local=$MAVEN_REPO_LOCAL \
		-Dmaven.settings.offline=true \
		-Dmaven.settings.interactiveMode=false \
		-Dbuild.sysclasspath=first \
		jar javadoc

%endif

%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"

mkdir -p %{buildroot}%{_javadir}/felix
mkdir -p %{buildroot}%{_datadir}/maven2/poms

install -pm 644 target/org.osgi.compendium-%{version}.jar \
	%{buildroot}%{_javadir}/felix/org.osgi.compendium-%{version}.jar

install -m 644 pom.xml %{buildroot}%{_datadir}/maven2/poms/JPP.felix-org.osgi.compendium.pom
%add_to_maven_depmap org.apache.felix org.osgi.compendium %{version} JPP/felix org.osgi.compendium

(
	cd %{buildroot}%{_javadir}/felix
	for jar in *-%{version}*; do
		ln -sf ${jar} `echo $jar| sed  "s|-%{version}||g"`
	done
)

mkdir -p %{buildroot}%{_javadocdir}/felix-osgi-compendium-%{version}
cp -pr target/site/apidocs/* %{buildroot}%{_javadocdir}/felix-osgi-compendium-%{version}
ln -s felix-osgi-compendium-%{version} %{buildroot}%{_javadocdir}/felix-osgi-compendium
rm -rf target/site/apidocs

%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"

%post
%update_maven_depmap

%postun
%update_maven_depmap

%files
%defattr(-,root,root)
%{_javadir}/felix/org.osgi.compendium-%{version}.jar
%{_javadir}/felix/org.osgi.compendium.jar
%{_mavendepmapfragdir}
%{_datadir}/maven2/poms
%doc LICENSE NOTICE

%files javadoc
%defattr(-,root,root)
%{_javadocdir}/felix-osgi-compendium-%{version}
%{_javadocdir}/felix-osgi-compendium
%doc doc/*

%changelog
* Mon Mar 28 2011 gil <puntogil@...> 1.4.0-4mamba
- rebuilt with java-openjdk support

* Fri Nov 26 2010 gil <puntogil@...> 1.4.0-3mamba
- rebuilt devel

* Mon Mar 15 2010 gil <puntogil@...> 1.4.0-2mamba
- edit spec file

* Sun Jan 03 2010 gil <puntogil@...> 1.4.0-1mamba
- package created by autospec