Blob Blame History Raw
%global namedreltag %{nil}
%global namedversion %{version}%{?namedreltag}
Name:          grizzly
Version:       2.3.2
Release:       2%{?dist}
Summary:       Java NIO Server Framework
Group:         Development/Libraries
# see Grizzly_THIRDPARTYLICENSEREADME.txt
License:       (CDDL or GPLv2 with exceptions) and BSD and ASL 2.0 and Public Domain
URL:           http://grizzly.java.net/
# git clone git://java.net/grizzly~git
# (cd grizzly~git/ && git archive --format=tar --prefix=grizzly-2.3.2/ 2_3_2 | xz > ../grizzly-2.3.2.tar.xz)
Source0:       %{name}-%{namedversion}.tar.xz
# forcing the use of required glassfish-servlet-api 3.1 apis 
Source1:       %{name}-2.3-beta8-depmap
# wget -O glassfish-LICENSE.txt https://svn.java.net/svn/glassfish~svn/tags/legal-1.1/src/main/resources/META-INF/LICENSE.txt
# grizzly package don't include the license file
Source2:       glassfish-LICENSE.txt
# require glassfish-servlet-api 3.1-b05
# add support for glassfish-servlet-api 3.1-b07
Patch0:        %{name}-2.3-beta9-WebappContext.patch
Patch1:        %{name}-2.3-beta9-ServletInputStreamImpl.patch
Patch2:        %{name}-2.3-rc4-ServletOutputStreamImpl.patch


BuildRequires: java-devel
BuildRequires: jvnet-parent

BuildRequires: felix-osgi-compendium
BuildRequires: felix-osgi-core
BuildRequires: glassfish-gmbal
BuildRequires: glassfish-servlet-api
# BuildRequires: jboss-servlet-3.0-api

# test deps
# BuildRequires: jersey
BuildRequires: junit

BuildRequires: maven-local
BuildRequires: maven-compiler-plugin
BuildRequires: maven-enforcer-plugin
BuildRequires: maven-install-plugin
BuildRequires: maven-istack-commons-plugin
BuildRequires: maven-jar-plugin
BuildRequires: maven-javadoc-plugin
BuildRequires: maven-plugin-build-helper
BuildRequires: maven-plugin-bundle
BuildRequires: maven-resources-plugin
BuildRequires: maven-source-plugin
BuildRequires: maven-surefire-plugin
BuildRequires: maven-surefire-provider-junit4
BuildRequires: maven-war-plugin

Requires:      glassfish-gmbal
Requires:      glassfish-servlet-api
# Requires:      jboss-servlet-3.0-api

Requires:      java
BuildArch:     noarch

# config

%description
Writing scalable server applications in the Java programming
language has always been difficult. Before the advent of the
Java New I/O API (NIO), thread management issues made it
impossible for a server to scale to thousands of users. The
Grizzly framework has been designed to help developers to take
advantage of the Java NIO API. Originally developed under the
GlassFish umbrella, the framework is now available as a
standalone project. Grizzly goals is to help developers to
build scalable and robust servers using NIO.

%package samples
Group:         Development/Libraries
Summary:       Grizzly samples
Requires:      %{name} = %{version}-%{release}

%description samples
This package contains samples for %{name}.

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

%description javadoc
This package contains javadoc for %{name}.

%prep
%setup -q -n %{name}-%{namedversion}
find . -name '*.jar' -delete
find . -name '*.class' -delete

%patch0 -p0
%patch1 -p0
%patch2 -p0

# unavailable deps
# com.agilejava.docbkx:docbkx-maven-plugin:jar:2.0.9
%pom_disable_module documentation/
# org.jvnet.maven-antrun-extended-plugin maven-antrun-extended-plugin
%pom_disable_module bundles extras
# com.sun.xml.ws jaxws-rt :2.2.5
%pom_disable_module http-server-jaxws extras

# org.ops4j maven-pax-plugin  1.5
%pom_disable_module grizzly-httpservice extras

# org.codehaus.mojo clirr-maven-plugin
# %%pom_disable_module bundles modules

# com.sun.xml.ws jaxws-rt 2.2.5
# org.glassfish.grizzly grizzly-http-server-jaxws
%pom_disable_module http-jaxws-samples samples

# remove internal libraries
%pom_disable_module websockets/chat samples

# org.glassfish.hk2 config-generator 2.1.57
%pom_disable_module config modules
%pom_remove_dep org.codehaus.mojo:cobertura-maven-plugin
%pom_remove_dep org.apache.felix:maven-bundle-plugin
%pom_remove_dep org.apache.maven:maven-plugin-tools-api
%pom_remove_dep org.glassfish.hk2:config-types
%pom_remove_dep org.glassfish.hk2:core
%pom_remove_dep org.glassfish.hk2:hk2-config
%pom_remove_dep org.glassfish.hk2:hk2-locator
%pom_remove_dep org.glassfish.hk2:osgi-adapter

%pom_xpath_remove "pom:build/pom:extensions/pom:extension[pom:artifactId = 'wagon-webdav']"

# jetty-npn https://bugzilla.redhat.com/show_bug.cgi?id=953055

# org.glassfish.main.common:glassfish-api:4.0-b72
# org.glassfish.main.common:internal-api:4.0-b72
# org.glassfish.grizzly:grizzly-npn-api:1.0
%pom_disable_module spdy modules

%pom_remove_dep org.glassfish.grizzly:documentation bom
%pom_remove_dep org.glassfish.grizzly:grizzly-comet-server bom
%pom_remove_dep org.glassfish.grizzly:grizzly-compression bom
%pom_remove_dep org.glassfish.grizzly:grizzly-config bom
%pom_remove_dep org.glassfish.grizzly:grizzly-core bom
%pom_remove_dep org.glassfish.grizzly:grizzly-http-all bom
%pom_remove_dep org.glassfish.grizzly:grizzly-http-server-core bom
%pom_remove_dep org.glassfish.grizzly:grizzly-http-server-jaxws bom
%pom_remove_dep org.glassfish.grizzly:grizzly-http-servlet-server bom
%pom_remove_dep org.glassfish.grizzly:grizzly-spdy bom
%pom_remove_dep org.glassfish.grizzly:grizzly-websockets-server bom
%pom_remove_dep org.glassfish.grizzly.osgi:grizzly-httpservice bom
%pom_remove_dep org.glassfish.grizzly.osgi:grizzly-httpservice-bundle bom

%pom_remove_plugin org.codehaus.mojo:clirr-maven-plugin
%pom_remove_plugin org.codehaus.mojo:findbugs-maven-plugin
%pom_remove_plugin org.glassfish.copyright:glassfish-copyright-maven-plugin
%pom_remove_plugin org.jvnet.maven-antrun-extended-plugin:maven-antrun-extended-plugin
%pom_remove_plugin org.sonatype.plugins:nexus-maven-plugin

# circular deps
%if 0
%pom_add_dep com.sun.jersey:jersey-servlet:'${jersey-version}':test modules/http-servlet
%else
%pom_remove_dep com.sun.jersey:jersey-client modules/http-servlet
%pom_remove_dep com.sun.jersey:jersey-server modules/http-servlet
rm -rf modules/http-servlet/src/test/java/filter/*
%endif

cp -p %{SOURCE2} LICENSE.txt
cp -p modules/grizzly/src/main/resources/Grizzly_THIRDPARTYLICENSEREADME.txt .
sed -i 's/\r//' LICENSE.txt Grizzly_THIRDPARTYLICENSEREADME.txt

sed -i 's|${artifactId}|${project.artifactId}|' $(find . -name "pom.xml")
sed -i 's|${version}|${project.version}|' $(find . -name "pom.xml")
sed -i 's|${pom.url}|${project.url}|' $(find . -name "pom.xml")
sed -i 's|${pom.version}|${project.version}|' $(find . -name "pom.xml")

%if %{?fedora} > 18
# fix aId for new istack-commons maven plugin
sed -i "s|<artifactId>maven-istack-commons-plugin|<artifactId>istack-commons-maven-plugin|" $(find . -name "pom.xml")
%endif

%build

mvn-rpmbuild -Dmaven.test.failure.ignore=true -Dmaven.local.depmap.file="%{SOURCE1}" install javadoc:aggregate

%install

mkdir -p %{buildroot}%{_mavenpomdir}
install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}-project.pom
%add_maven_depmap JPP.%{name}-%{name}-project.pom

install -pm 644 bom/pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}-bom.pom
%add_maven_depmap JPP.%{name}-%{name}-bom.pom

install -pm 644 extras/pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}-extras.pom
%add_maven_depmap JPP.%{name}-%{name}-extras.pom

mkdir -p %{buildroot}%{_javadir}/%{name}
# http-server-jaxws grizzly-httpservice
for ext in http-server-multipart \
  http-servlet-extras; do
  install -m 644 extras/${ext}/target/%{name}-${ext}-%{namedversion}.jar \
    %{buildroot}%{_javadir}/%{name}/%{name}-${ext}.jar
  install -pm 644 extras/${ext}/pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}-${ext}.pom
%add_maven_depmap JPP.%{name}-%{name}-${ext}.pom %{name}/%{name}-${ext}.jar
done

install -pm 644 modules/pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}-modules.pom
%add_maven_depmap JPP.%{name}-%{name}-modules.pom

# modules/config

install -m 644 modules/grizzly/target/grizzly-framework-%{namedversion}.jar \
  %{buildroot}%{_javadir}/%{name}/%{name}-framework.jar
(
  cd %{buildroot}%{_javadir}/%{name}
  ln -sf %{name}-framework.jar %{name}.jar
)
install -pm 644 modules/grizzly/pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}-framework.pom
%add_maven_depmap JPP.%{name}-%{name}-framework.pom %{name}/%{name}-framework.jar

# bundles spdy
for mod in comet \
  http \
  http-ajp \
  http-server \
  http-servlet \
  portunif \
  rcm \
  websockets; do
  install -m 644 modules/${mod}/target/%{name}-${mod}-%{namedversion}.jar \
    %{buildroot}%{_javadir}/%{name}/%{name}-${mod}.jar
  install -pm 644 modules/${mod}/pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}-${mod}.pom
%add_maven_depmap JPP.%{name}-%{name}-${mod}.pom %{name}/%{name}-${mod}.jar
done

install -pm 644 samples/pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}-samples.pom
%add_maven_depmap -f samples JPP.%{name}-%{name}-samples.pom

install -pm 644 samples/comet/pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}-comet-samples.pom
%add_maven_depmap -f samples JPP.%{name}-%{name}-comet-samples.pom
install -pm 644 samples/comet/comet-counter/target/%{name}-comet-counter.war \
    %{buildroot}%{_javadir}/%{name}/
install -pm 644 samples/comet/comet-counter/pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}-comet-counter.pom
%add_maven_depmap -f samples JPP.%{name}-%{name}-comet-counter.pom %{name}/%{name}-comet-counter.war

install -pm 644 samples/portunif/target/%{name}-portunif-samples-%{namedversion}.jar \
    %{buildroot}%{_javadir}/%{name}/%{name}-portunif-samples.jar
install -pm 644 samples/portunif/pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}-portunif-samples.pom
%add_maven_depmap -f samples JPP.%{name}-%{name}-portunif-samples.pom %{name}/%{name}-portunif-samples.jar

# websockets/chat
# http-jaxws-samples
for s in framework-samples \
  http-ajp-samples \
  http-multipart-samples \
  http-samples \
  http-server-samples; do
  install -pm 644 samples/${s}/target/%{name}-${s}-%{namedversion}.jar \
    %{buildroot}%{_javadir}/%{name}/%{name}-${s}.jar
  install -pm 644 samples/${s}/pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}-${s}.pom
  %add_maven_depmap -f samples JPP.%{name}-%{name}-${s}.pom %{name}/%{name}-${s}.jar
done

mkdir -p %{buildroot}%{_javadocdir}/%{name}
cp -rp target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}

%files
%dir %{_javadir}/%{name}
%{_javadir}/%{name}/%{name}*.jar
%{_mavenpomdir}/JPP.%{name}-%{name}-*.pom
%{_mavendepmapfragdir}/%{name}
%doc LICENSE.txt Grizzly_THIRDPARTYLICENSEREADME.txt

# config

%files samples
%{_javadir}/%{name}/%{name}-*-samples.jar
%{_javadir}/%{name}/%{name}-*.war
%{_mavenpomdir}/JPP.%{name}-%{name}-comet-counter.pom
%{_mavenpomdir}/JPP.%{name}-%{name}*-samples.pom
%{_mavendepmapfragdir}/%{name}-samples
%doc LICENSE.txt Grizzly_THIRDPARTYLICENSEREADME.txt

%files javadoc
%{_javadocdir}/%{name}
%doc LICENSE.txt Grizzly_THIRDPARTYLICENSEREADME.txt

%changelog
* Sat May 18 2013 gil cattaneo <puntogil@libero.it> 2.3.2-2
- fix aId for new istack-commons maven plugin

* Sat May 04 2013 gil cattaneo <puntogil@libero.it> 2.3.2-1
- update to 2.3.2

* Sat Apr 20 2013 gil cattaneo <puntogil@libero.it> 2.3.1-2
- fix License tag

* Wed Apr 17 2013 gil cattaneo <puntogil@libero.it> 2.3.1-1
- update to 2.3.1

* Thu Apr 11 2013 gil cattaneo <puntogil@libero.it> 2.3-1
- update to 2.3

* Wed Mar 13 2013 gil cattaneo <puntogil@libero.it> 2.3-0.1.rc4
- update to 2.3-rc4

* Fri Feb 22 2013 gil cattaneo <puntogil@libero.it> 2.3-0.1.beta9
- update to 2.3-beta9

* Thu Dec 13 2012 gil cattaneo <puntogil@libero.it> 2.3-0.1.beta8
- update to 2.3-beta8

* Wed Oct 24 2012 gil cattaneo <puntogil@libero.it> 2.3-0.1.beta6
- update to 2.3-beta6

* Mon Oct 22 2012 gil cattaneo <puntogil@libero.it> 2.2.19-1
- update to 2.2.19

* Wed Sep 19 2012 gil cattaneo <puntogil@libero.it> 2.2.18-1
- initial rpm