packages htmlunit1.spec
      Pages: < 1 >  DOWNLOAD      
%define        maven   0
Name:          htmlunit1
Version:       1.14
Release:       3mamba
Summary:       a "GUI-Less browser for Java programs".
Group:         Development/Libraries/Java
Vendor:        openmamba
Distribution:  openmamba
Packager:      gil <puntogil@...>
URL:           http://htmlunit.sourceforge.net/
Source0:       http://fastbull.dl.sourceforge.net/sourceforge/htmlunit/htmlunit-%{version}-src.zip
Source1:       maven2-2.2.0-settings.xml
# files created with maven and subsequently modified
Source2:       htmlunit1-1.14-build.xml
Source3:       htmlunit1-1.14-maven-build.properties
Source4:       htmlunit1-1.14-maven-build.xml
Patch0:        htmlunit1-1.14-pom_xml.patch
# for cssparser >= 0.9.5 support (need 0.9.4)
Patch1:        htmlunit-1.14-Stylesheet.java
License:       Apache Software License Version 2.0
BuildRequires: apache-ant
BuildRequires: apache-log4j
%if %maven
BuildRequires: apache-maven
BuildRequires: apache-maven-antrun-plugin
BuildRequires: apache-maven-assembly-plugin
BuildRequires: apache-maven-changelog-plugin
BuildRequires: apache-maven-changes-plugin
BuildRequires: apache-maven-checkstyle-plugin
BuildRequires: apache-maven-compiler-plugin
BuildRequires: apache-maven-jar-plugin
BuildRequires: apache-maven-javadoc-plugin
BuildRequires: apache-maven-pmd-plugin
BuildRequires: apache-maven-site-plugin
BuildRequires: apache-maven-source-plugin
#BuildRequires: maven-jxr-plugin
#BuildRequires: maven-surefire-plugin
%endif
BuildRequires: jakarta-commons-codec
BuildRequires: jakarta-commons-codec-javadoc
BuildRequires: jakarta-commons-collections
BuildRequires: jakarta-commons-fileupload
BuildRequires: jakarta-commons-httpclient
BuildRequires: jakarta-commons-httpclient-javadoc
BuildRequires: jakarta-commons-io
BuildRequires: jakarta-commons-lang
BuildRequires: jakarta-commons-logging
BuildRequires: jakarta-commons-logging-javadoc
BuildRequires: java-cssparser94
BuildRequires: java-dom4j
BuildRequires: java-dom
BuildRequires: java-easymock2
BuildRequires: java-excalibur-avalon-framework
BuildRequires: java-excalibur-avalon-logkit
BuildRequires: java-freechart
BuildRequires: java-gnujaxp
BuildRequires: java-gsbase
BuildRequires: java-jaxen
BuildRequires: java-jaxen-javadoc
BuildRequires: java-junit3
BuildRequires: java-junitperf
BuildRequires: java-rhino16
# java-cssparser94 provides java-sac
#BuildRequires: java-sac
BuildRequires: java-slf4j
BuildRequires: java-xom
BuildRequires: java-jetty6-core
BuildRequires: java-jetty6-servlet-2.5-api
BuildRequires: nekohtml
BuildRequires: sun-java-javadoc
BuildRequires: xalan-j2
BuildRequires: xerces-j2
BuildRequires: xml-commons-apis
Requires:      jakarta-commons-codec
Requires:      jakarta-commons-collections
Requires:      jakarta-commons-httpclient
Requires:      jakarta-commons-io
Requires:      jakarta-commons-lang24
Requires:      jakarta-commons-logging
Requires:      java-cssparser94
Requires:      java-excalibur-avalon-framework
Requires:      nekohtml
Requires:      java-rhino
#Requires:      java-sac
Requires:      xalan-j2
Requires:      xerces-j2
BuildRoot:     %{_tmppath}/%{name}-%{version}-root

%description
HtmlUnit is a "browser for Java programs". It models the HTML
documents and provides an API that allows you to invoke pages,
fill forms, click links, etc. just like you do in your
"normal" browser.
It has fairly good JavaScript support (which gets continuously
improved) and is able to work even with quite complex AJAX
libraries simulating either Firefox or Internet Explorer
depending on the configuration you want to use.
It is typically used for testing purposes or to retrieve
information from web sites.

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

%description javadoc
HtmlUnit is a "browser for Java programs". It models the HTML
documents and provides an API that allows you to invoke pages,
fill forms, click links, etc. just like you do in your
"normal" browser.

This package contains javadoc for %{name}.

%prep

%setup -q -n htmlunit-%{version}
%patch0 -p1

sed -i "s|<version>2.3-20090531.103812-3</version>|<version>2.3</version>|" pom.xml

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
#%patch1
%endif

%build

export JAVA_HOME=/usr/lib/jvm/jdk-sun
export MAVEN_REPO_LOCAL=$(pwd)/.m2/repository
mkdir -p $MAVEN_REPO_LOCAL

%if %maven

	mkdir external_repo
	ln -s %{_javadir} external_repo/JPP
	
	mvn-jpp \
		-e \
		-s $(pwd)/settings.xml \
		-Dmaven.test.failure.ignore=true \
		-Dmaven.repo.local=$MAVEN_REPO_LOCAL \
		ant:ant install javadoc:javadoc test
%else

	export CLASSPATH=""
	CLASSPATH=$CLASSPATH:$(build-classpath commons-codec commons-collections commons-fileupload)
	CLASSPATH=$CLASSPATH:$(build-classpath commons-httpclient commons-io commons-lang commons-logging)
	CLASSPATH=$CLASSPATH:$(build-classpath cssparser94 dom4j easymock2 excalibur/avalon-framework excalibur/avalon-logkit)
	CLASSPATH=$CLASSPATH:$(build-classpath gnujaxp gsbase jaxen jdom jfreechart junitperf log4j nekohtml)
	CLASSPATH=$CLASSPATH:$(build-classpath rhino16 slf4j xalan-j2 xercesImpl xml-commons-apis xom)
	CLASSPATH=$CLASSPATH:$(build-classpath jetty6/jetty jetty6/jetty-util jetty6/servlet-2.5-api)
	CLASSPATH=$CLASSPATH:$(build-classpath junit-3.8.2):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 \
		-Dmaven.test.skip=true \
		-Dj2se.api=%{_javadocdir}/java \
		-Dcommons-logging.api.api=%{_javadocdir}/jakarta-commons-logging \
		-Dcommons-codec.api=%{_javadocdir}/jakarta-commons-codec \
		-Dcommons-httpclient.api=%{_javadocdir}/jakarta-commons-httpclient-3.1 \
		-Djaxen.api=%{_javadocdir}/jaxen \
		jar javadoc
%endif

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

mkdir -p %{buildroot}%{_javadir}
mkdir -p %{buildroot}%{_datadir}/maven2/poms
install -m 644 target/htmlunit-%{version}.jar \
	%{buildroot}%{_javadir}/htmlunit1-%{version}.jar

%add_to_maven_depmap net.sourceforge.htmlunit htmlunit %{version} JPP htmlunit1
install -m 644 pom.xml %{buildroot}%{_datadir}/maven2/poms/JPP-htmlunit-%{version}.pom

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

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

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

%files
%defattr(-,root,root)
%{_javadir}/htmlunit1-%{version}.jar
%{_javadir}/htmlunit1.jar
%{_datadir}/maven2/poms
%{_mavendepmapfragdir}
%doc LICENSE.txt

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

%changelog
* Mon Dec 13 2010 gil <puntogil@...> 1.14-3mamba
- ... add a changelog entry

* Wed Feb 10 2010 gil <puntogil@...> 1.14-2mamba
- rebuilt with ant

* Mon Jun 08 2009 gil <puntogil@...> 1.14-1mamba
- package created by autospec