packages java-cmlxom.spec
      Pages: < 1 >  DOWNLOAD      
%define        api_version           2.5
%define        maven                 0
Name:          java-cmlxom
Version:       2.5b1
Release:       2mamba
Summary:       Chemical Markup Language
Group:         Development/Libraries/Java
Vendor:        openmamba
Distribution:  openmamba
Packager:      Silvan Calarco <silvan.calarco@...>
URL:           http://cml.sourceforge.net/
Source0:       http://fastbull.dl.sourceforge.net/sourceforge/cml/cmlxom-%{api_version}-b1-src.tar.gz
Source1:       maven2-2.2.0-settings.xml
Source2:       java-cmlxom-2.5b1-autogeneratedfiles.tar.gz
Patch0:        java-cmlxom-2.5b1-maven-build_xml.patch
License:       Artistic License
## AUTOBUILDREQ-BEGIN
## AUTOBUILDREQ-END
BuildRequires: apache-ant
BuildRequires: apache-ant-junit
BuildRequires: apache-log4j
%if %maven
BuildRequires: apache-maven
BuildRequires: apache-maven-plugin-ant
BuildRequires: apache-maven-plugin-assembly
BuildRequires: apache-maven-plugin-compiler
BuildRequires: apache-maven-plugin-jar
BuildRequires: apache-maven-plugin-javadoc
BuildRequires: apache-maven-plugin-source
BuildRequires: maven-surefire-plugin
BuildRequires: maven-wagon-webdav
%endif
BuildRequires: java-dom4j
BuildRequires: java-dom
BuildRequires: java-jaxen
BuildRequires: java-junit45
BuildRequires: java-xom
BuildRequires: xalan-j2
BuildRequires: xerces-j2
BuildRequires: xml-commons-apis
BuildRoot:     %{_tmppath}/%{name}-%{version}-root

%description
A Java library for processing CML (Chemical Markup Language).

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

%description javadoc
A Java library for processing CML (Chemical Markup Language).

This package contains javadoc for %{name}.

%prep

%setup -q -n cmlxom-2.5-b1

%if ! %maven
%setup -q -n cmlxom-2.5-b1 -D -T -a 2
%patch0 -p1
%endif

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

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

%build
export JAVA_HOME=%{_jvmdir}/jdk
export MAVEN_REPO_LOCAL=$(pwd)/.m2/repository
export MAVEN_SETTINGS=$(pwd)/settings.xml

%if %maven
	mkdir -p $MAVEN_REPO_LOCAL
	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 \
		ant:ant
	
	mvn-jpp \
		-e \
		-s $MAVEN_SETTINGS \
		-Dmaven.test.failure.ignore=true \
		-Dmaven.repo.local=$MAVEN_REPO_LOCAL \
		install javadoc:javadoc
%else

	mkdir -p $MAVEN_REPO_LOCAL/junit/junit/4.0/
	ln -sf $(build-classpath junit45) $MAVEN_REPO_LOCAL/junit/junit/4.0/junit-4.0.jar
	mkdir -p $MAVEN_REPO_LOCAL/xom/xom/1.1/
	ln -sf $(build-classpath xom) $MAVEN_REPO_LOCAL/xom/xom/1.1/xom-1.1.jar
	mkdir -p $MAVEN_REPO_LOCAL/xerces/xmlParserAPIs/2.6.2/
	ln -sf $(build-classpath xerces-j2) $MAVEN_REPO_LOCAL/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar
	mkdir -p $MAVEN_REPO_LOCAL/xerces/xercesImpl/2.8.0/
	ln -sf $(build-classpath xercesImpl) $MAVEN_REPO_LOCAL/xerces/xercesImpl/2.8.0/xercesImpl-2.8.0.jar
	mkdir -p $MAVEN_REPO_LOCAL/xalan/xalan/2.7.0/
	ln -sf $(build-classpath xalan-j2) $MAVEN_REPO_LOCAL/xalan/xalan/2.7.0/xalan-2.7.0.jar
	mkdir -p $MAVEN_REPO_LOCAL/xml-apis/xml-apis/1.3.03/
	ln -sf $(build-classpath xml-commons-apis) $MAVEN_REPO_LOCAL/xml-apis/xml-apis/1.3.03/xml-apis-1.3.03.jar
	mkdir -p $MAVEN_REPO_LOCAL/jaxen/jaxen/1.1-beta-8/
	ln -sf $(build-classpath jaxen) $MAVEN_REPO_LOCAL/jaxen/jaxen/1.1-beta-8/jaxen-1.1-beta-8.jar
	mkdir -p $MAVEN_REPO_LOCAL/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar
	ln -sf $(build-classpath dom4j) $MAVEN_REPO_LOCAL/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar
	mkdir -p $MAVEN_REPO_LOCAL/jdom/jdom/1.0/
	ln -sf $(build-classpath jdom) $MAVEN_REPO_LOCAL/jdom/jdom/1.0/jdom-1.0.jar
	mkdir -p $MAVEN_REPO_LOCAL/log4j/log4j/1.2.13/
	ln -sf $(build-classpath log4j) $MAVEN_REPO_LOCAL/log4j/log4j/1.2.13/log4j-1.2.13.jar

	export CLASSPATH=$(build-classpath dom4j jaxen jdom junit45 log4j \
		xalan-j2 xercesImpl xml-commons-apis xom):/opt/java/ant/lib/ant/ant-junit-1.7.1.jar
	ant \
		-Duser.home=$(pwd) \
		-Dmaven.repo.local=$MAVEN_REPO_LOCAL \
		-Dmaven.settings.offline=true \
		-Dmaven.settings.interactiveMode=false \
		package javadoc

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

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

install -pm 644 pom.xml %{buildroot}%{_datadir}/maven2/poms/JPP-cmlxom.pom
%add_to_maven_depmap cml cmlxom %{api_version}-b1 JPP cmlxom

install -pm 644 target/cmlxom-%{api_version}-b1.jar \
            %{buildroot}%{_javadir}/cmlxom-%{api_version}.jar

(
	cd %{buildroot}%{_javadir}
	for jar in *-%{api_version}*; do
		ln -sf ${jar} ${jar/-%{api_version}/}
	done
)

mkdir -p %{buildroot}%{_javadocdir}/cmlxom-%{version}
cp -pr target/site/apidocs/* %{buildroot}%{_javadocdir}/cmlxom-%{version}
ln -s cmlxom-%{version} %{buildroot}%{_javadocdir}/cmlxom

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

%files
%defattr(-,root,root)
%{_javadir}/cmlxom-%{api_version}.jar
%{_javadir}/cmlxom.jar
%{_datadir}/maven2/poms
%{_mavendepmapfragdir}

%files javadoc
%defattr(-,root,root)
%{_javadocdir}/cmlxom-%{version}
%{_javadocdir}/cmlxom

%changelog
* Mon Sep 16 2013 Silvan Calarco <silvan.calarco@...> 2.5b1-2mamba
- rebuilt in devel

* Sat Apr 18 2009 gil <puntogil@...> 2.5b1-1mamba
- package created by autospec