Sophie

Sophie

distrib > Mageia > 5 > x86_64 > by-pkgid > 7f58c2ac8b47c8f0233071bf021e5edd > files > 6

jetty-9.2.1-4.mga5.src.rpm

# Copyright (c) 2000-2007, JPackage Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the
#    distribution.
# 3. Neither the name of the JPackage Project nor the names of its
#    contributors may be used to endorse or promote products derived
#    from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

%global jettyname   jetty
%global jtuid       110
%global username    %{name}
%global confdir     %{_sysconfdir}/%{name}
%global logdir      %{_localstatedir}/log/%{name}
%global homedir     %{_datadir}/%{name}
%global jettycachedir %{_localstatedir}/cache/%{name}
%global tempdir     %{jettycachedir}/temp
%global rundir      /run/%{name}
%global jettylibdir %{_localstatedir}/lib/%{name}
%global appdir      %{jettylibdir}/webapps


%global addver v20140609
%define bootstrap 0

# Conditionals to help breaking eclipse <-> jetty dependency cycle
# when bootstrapping for new architectures
%if ! %bootstrap
%bcond_without nosql
%bcond_without osgi
%bcond_without spring
# package without service files
%bcond_without service
%else
%bcond_with nosql
%bcond_with osgi
%bcond_with spring
%endif

Name:           jetty
Version:        9.2.1
Release:        %mkrel 4
Summary:        Java Webserver and Servlet Container
Group:          Development/Java

# Jetty is dual licensed under both ASL 2.0 and EPL 1.0, see NOTICE.txt
License:        ASL 2.0 or EPL
URL:            http://www.eclipse.org/jetty/
Source0:        http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/snapshot/jetty-%{version}.%{addver}.tar.gz
Source1:        jetty.sh
Source3:        jetty.logrotate
Source5:        %{name}.service
# MIT license text taken from Utf8Appendable.java
Source6:        LICENSE-MIT

BuildRequires:  geronimo-annotation
BuildRequires:  geronimo-jaspic-spec
BuildRequires:  jboss-transaction-1.2-api
BuildRequires:  jboss-websocket-1.0-api
BuildRequires:  glassfish-annotation-api
BuildRequires:  geronimo-parent-poms
BuildRequires:  glassfish-servlet-api
BuildRequires:  glassfish-el
BuildRequires:  glassfish-el-api
BuildRequires:  glassfish-jsp
BuildRequires:  glassfish-jsp-api
BuildRequires:  jakarta-taglibs-standard
BuildRequires:  java-devel >= 1:1.7.0
BuildRequires:  jpackage-utils
BuildRequires:  javapackages-tools >= 0.7.0
BuildRequires:  jvnet-parent
BuildRequires:  ant
BuildRequires:  maven-local
BuildRequires:  maven-dependency-plugin
BuildRequires:  maven-enforcer-plugin
BuildRequires:  maven-shade-plugin
BuildRequires:  maven-plugin-plugin
BuildRequires:  maven-war-plugin
BuildRequires:  exec-maven-plugin
BuildRequires:  objectweb-asm
BuildRequires:  slf4j
BuildRequires:  systemd-units
BuildRequires:  ecj
BuildRequires:  geronimo-parent-poms
BuildRequires:  maven-plugin-build-helper

%if %{with osgi}
BuildRequires:  eclipse-platform
BuildRequires:  eclipse-rcp
%endif
%if %{with nosql}
BuildRequires:  mongo-java-driver >= 2.6.5-4
%endif
%if %{with spring}
BuildRequires:  springframework-beans
%endif

BuildRequires:  javamail
BuildRequires:  jetty-parent
BuildRequires:  jetty-distribution-remote-resources
BuildRequires:  jetty-build-support
BuildRequires:  jetty-version-maven-plugin
BuildRequires:  jetty-toolchain
BuildRequires:  jetty-assembly-descriptors
BuildRequires:  jetty-test-policy
BuildRequires:  jetty-artifact-remote-resources
BuildRequires:  jetty-schemas

BuildArch:      noarch

Requires:       java-headless >= 1:1.7.0
Requires:       jpackage-utils
Requires:       jetty-client               = %{version}-%{release}
Requires:       jetty-annotations          = %{version}-%{release}
Requires:       jetty-client               = %{version}-%{release}
Requires:       jetty-continuation         = %{version}-%{release}
Requires:       jetty-deploy               = %{version}-%{release}
Requires:       jetty-http                 = %{version}-%{release}
Requires:       jetty-io                   = %{version}-%{release}
Requires:       jetty-jaas                 = %{version}-%{release}
Requires:       jetty-jmx                  = %{version}-%{release}
Requires:       jetty-jndi                 = %{version}-%{release}
Requires:       jetty-plus                 = %{version}-%{release}
Requires:       jetty-proxy                = %{version}-%{release}
Requires:       jetty-rewrite              = %{version}-%{release}
Requires:       jetty-security             = %{version}-%{release}
Requires:       jetty-server               = %{version}-%{release}
Requires:       jetty-servlet              = %{version}-%{release}
Requires:       jetty-servlets             = %{version}-%{release}
Requires:       jetty-start                = %{version}-%{release}
Requires:       jetty-util                 = %{version}-%{release}
Requires:       jetty-webapp               = %{version}-%{release}
Requires:       jetty-websocket-api        = %{version}-%{release}
Requires:       jetty-websocket-common     = %{version}-%{release}
Requires:       jetty-websocket-server     = %{version}-%{release}
Requires:       jetty-websocket-servlet    = %{version}-%{release}

# javax.servlet-api is provided by both glassfish-servlet-api and
# tomcat-servlet-3.0-api, but we need version 3.1
# this is a temporary solution, that should be removed when the duplicate
# provides problem is solved
Requires:       glassfish-servlet-api

Requires(pre):    shadow-utils
Requires(post):   systemd >= %{systemd_required_version}
Requires(post):   rpm-helper
Requires(post):   systemd-units
Requires(preun):  rpm-helper
Requires(preun):  systemd-units
Requires(postun): systemd-units


Provides:       group(%username) = %jtuid
Provides:       user(%username)  = %jtuid

Obsoletes: %{name}-manual < %{version}-%{release}

Obsoletes: %{name}-ajp < %{version}-%{release}
Obsoletes: %{name}-http-spi < %{version}-%{release}
Obsoletes: %{name}-nested < %{version}-%{release}
Obsoletes: %{name}-overlay-deployer < %{version}-%{release}
Obsoletes: %{name}-policy < %{version}-%{release}
Obsoletes: %{name}-websocket-mux-extension < %{version}-%{release}
Obsoletes: %{name}-runner < %{version}-%{release}
Obsoletes: %{name}-osgi-npn < %{version}-%{release}

%description
%global desc \
Jetty is a 100% Java HTTP Server and Servlet Container. This means that you\
do not need to configure and run a separate web server (like Apache) in order\
to use Java, servlets and JSPs to generate dynamic content. Jetty is a fully\
featured web server for static and dynamic content. Unlike separate\
server/container solutions, this means that your web server and web\
application run in the same process, without interconnection overheads\
and complications. Furthermore, as a pure java component, Jetty can be simply\
included in your application for demonstration, distribution or deployment.\
Jetty is available on all Java supported platforms.
%{desc}
%global extdesc %{desc}\
\
This package contains

%package        project
Summary:        POM files for Jetty

%description    project
%{extdesc} %{summary}.

%package        annotations
Summary:        annotations module for Jetty

%description    annotations
%{extdesc} %{summary}.

%package        ant
Summary:        ant module for Jetty

%description    ant
%{extdesc} %{summary}.

%package        client
Summary:        client module for Jetty

%description    client
%{extdesc} %{summary}.

%package        continuation
Summary:        continuation module for Jetty

%description    continuation
%{extdesc} %{summary}.

%package        deploy
Summary:        deploy module for Jetty

%description    deploy
%{extdesc} %{summary}.

%package fcgi-client
Summary:        FastCGI client module for Jetty

%description fcgi-client
%{extdesc} %{summary}.

%package fcgi-server
Summary:        FastCGI client module for Jetty

%description fcgi-server
%{extdesc} %{summary}.

%package        http
Summary:        http module for Jetty

%description    http
%{extdesc} %{summary}.

%package        http-spi
Summary:        http-spi module for Jetty

%description    http-spi
%{extdesc} %{summary}.

%package        io
Summary:        io module for Jetty
Obsoletes:      %{name}-websocket < %{version}-%{release}

%description    io
%{extdesc} %{summary}.

%package        jaas
Summary:        jaas module for Jetty

%description    jaas
%{extdesc} %{summary}.

%package        jaspi
Summary:        jaspi module for Jetty

%description    jaspi
%{extdesc} %{summary}.

%package        jmx
Summary:        jmx module for Jetty

%description    jmx
%{extdesc} %{summary}.

%package        jndi
Summary:        jndi module for Jetty

%description    jndi
%{extdesc} %{summary}.

%package        jsp
Summary:        jsp module for Jetty

%description    jsp
%{extdesc} %{summary}.

%package        jspc-maven-plugin
Summary:        jspc-maven-plugin module for Jetty

%description    jspc-maven-plugin
%{extdesc} %{summary}.

%package        maven-plugin
Summary:        maven-plugin module for Jetty

%description    maven-plugin
%{extdesc} %{summary}.

%package        monitor
Summary:        monitor module for Jetty

%description    monitor
%{extdesc} %{summary}.

%package        plus
Summary:        plus module for Jetty

%description    plus
%{extdesc} %{summary}.

%package        proxy
Summary:        proxy module for Jetty

%description    proxy
%{extdesc} %{summary}.

%package        rewrite
Summary:        rewrite module for Jetty

%description    rewrite
%{extdesc} %{summary}.

%package        security
Summary:        security module for Jetty

%description    security
%{extdesc} %{summary}.

%package        server
Summary:        server module for Jetty

%description    server
%{extdesc} %{summary}.

%package        servlet
Summary:        servlet module for Jetty

%description    servlet
%{extdesc} %{summary}.

%package        servlets
Summary:        servlets module for Jetty

%description    servlets
%{extdesc} %{summary}.

%if %{with spring}
%package        spring
Summary:        spring module for Jetty

%description    spring
%{extdesc} %{summary}.
%endif

%package        start
Summary:        start module for Jetty

%description    start
%{extdesc} %{summary}.

%package        util
Summary:        util module for Jetty
# Utf8Appendable.java is additionally under MIT license
License:        (ASL 2.0 or EPL) and MIT

%description    util
%{extdesc} %{summary}.

%package        util-ajax
Summary:        util-ajax module for Jetty

%description    util-ajax
%{extdesc} %{summary}.

%package        webapp
Summary:        webapp module for Jetty

%description    webapp
%{extdesc} %{summary}.

%package        xml
Summary:        xml module for Jetty

%description    xml
%{extdesc} %{summary}.

%package        websocket-api
Summary:        websocket-api module for Jetty

%description    websocket-api
%{extdesc} %{summary}.

%package        websocket-client
Summary:        websocket-client module for Jetty

%description    websocket-client
%{extdesc} %{summary}.

%package        websocket-common
Summary:        websocket-common module for Jetty

%description    websocket-common
%{extdesc} %{summary}.

%package        websocket-parent
Summary:        POM file for jetty-websocket

%description    websocket-parent
%{extdesc} %{summary}.

%package        websocket-server
Summary:        websocket-server module for Jetty

%description    websocket-server
%{extdesc} %{summary}.

%package        websocket-servlet
Summary:        websocket-servlet module for Jetty

%description    websocket-servlet
%{extdesc} %{summary}.

%package        javax-websocket-client-impl
Summary:        javax-websocket-client-impl module for Jetty

%description    javax-websocket-client-impl
%{extdesc} %{summary}.

%package        javax-websocket-server-impl
Summary:        javax-websocket-server-impl module for Jetty

%description    javax-websocket-server-impl
%{extdesc} %{summary}.

%if %{with nosql}
%package        nosql
Summary:        nosql module for Jetty

%description    nosql
%{extdesc} %{summary}.
%endif

%if %{with osgi}
%package        httpservice
Summary:        httpservice module for Jetty

%description    httpservice
%{extdesc} %{summary}.

%package        osgi-boot
Summary:        osgi-boot module for Jetty

%description    osgi-boot
%{extdesc} %{summary}.

%package        osgi-boot-warurl
Summary:        osgi-boot-warurl module for Jetty

%description    osgi-boot-warurl
%{extdesc} %{summary}.

%package        osgi-project
Summary:        osgi-project module for Jetty

%description    osgi-project
%{extdesc} %{summary}.

%package        osgi-boot-jsp
Summary:        osgi-boot-jsp module for Jetty

%description    osgi-boot-jsp
%{extdesc} %{summary}.

%endif # with osgi

%package        javadoc
Summary:        Javadoc for %{name}
Group:          Documentation
# some MIT-licensed code (from Utf8Appendable) is used to generate javadoc
License:        (ASL 2.0 or EPL) and MIT

%description    javadoc
%{summary}.

%prep
%setup -q -n %{jettyname}-%{version}.%{addver}
find . -name "*.?ar" -exec rm {} \;
find . -name "*.class" -exec rm {} \;

# Use proper groupId for apache ant
%pom_xpath_replace "pom:groupId[text()='ant']" "<groupId>org.apache.ant</groupId>" jetty-ant/pom.xml

%pom_remove_dep "javax.transaction:javax.transaction-api" jetty-plus
%pom_remove_dep "javax.transaction:javax.transaction-api" jetty-maven-plugin
%pom_remove_dep "javax.transaction:javax.transaction-api"
%pom_remove_dep "javax.transaction:javax.transaction-api" jetty-distribution
%pom_add_dep "org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec" jetty-plus
%pom_add_dep "org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec" jetty-maven-plugin
%pom_add_dep "org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec"
%pom_add_dep "org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec" jetty-distribution
%pom_remove_dep "org.glassfish:javax.el" jetty-jsp
%pom_remove_dep "org.glassfish:javax.el" jetty-distribution
%pom_add_dep "org.glassfish.web:javax.el" jetty-jsp
%pom_add_dep "org.glassfish.web:javax.el" jetty-distribution
%pom_remove_dep "org.eclipse.jetty.toolchain:jetty-jsp-jdt" jetty-distribution
%pom_remove_dep "com.sun.net.httpserver:http" jetty-http-spi

# licensing issues
%pom_remove_dep "org.glassfish.web:javax.servlet.jsp.jstl" jetty-jsp
%pom_remove_dep "org.glassfish.web:javax.servlet.jsp.jstl" jetty-distribution

%pom_remove_plugin ":clirr-maven-plugin" jetty-websocket
%pom_remove_plugin ":maven-eclipse-plugin" jetty-osgi

# jetty-runner bundles its dependencies
%pom_remove_plugin ":maven-dependency-plugin" jetty-runner

# it tries to execute start.jar, but can't find its config that wasn't
# installed yet
%pom_remove_plugin ":exec-maven-plugin" jetty-distribution

# txt artifact - not installable
%pom_remove_plugin ":jetty-version-maven-plugin"
%pom_xpath_remove "pom:artifactItem[pom:classifier='version']" jetty-distribution


# Disable test and example artifacts
# they need more dependencies then we have time for right now :-)
# and also xmvn currently doesn't support .war
%pom_disable_module tests
%pom_disable_module examples
%pom_disable_module jetty-quickstart
%pom_remove_dep :jetty-quickstart jetty-distribution
%pom_disable_module aggregates/jetty-all
%pom_disable_module test-jetty-osgi jetty-osgi/pom.xml
%pom_disable_module test-jetty-osgi-context jetty-osgi/pom.xml
%pom_disable_module test-jetty-osgi-webapp jetty-osgi/pom.xml

# Since tests are disabled, we don't have some jars
%pom_remove_dep :test-jetty-webapp jetty-distribution/pom.xml
%pom_remove_dep :test-proxy-webapp jetty-distribution/pom.xml
%pom_remove_dep :example-async-rest-webapp jetty-distribution/pom.xml
%pom_xpath_remove "pom:artifactItem[pom:artifactId[text()='test-jetty-webapp']]" jetty-distribution/pom.xml
%pom_xpath_remove "pom:artifactItem[pom:artifactId[text()='test-proxy-webapp']]" jetty-distribution/pom.xml
%pom_xpath_remove "pom:artifactItem[pom:artifactId[text()='example-async-rest-webapp']]" jetty-distribution/pom.xml
%pom_xpath_remove "pom:artifactItem[pom:artifactId[text()='test-jaas-webapp']]" jetty-distribution/pom.xml
%pom_xpath_remove "pom:artifactItem[pom:artifactId[text()='test-jndi-webapp']]" jetty-distribution/pom.xml
%pom_xpath_remove "pom:artifactItem[pom:artifactId[text()='test-spec-webapp']]" jetty-distribution/pom.xml

# Missing jars (jetty-setuid-java-1.0.0.jar,jetty-setuid-java-1.0.0-config.jar)
%pom_xpath_remove "pom:execution[pom:id[text()='unpack-setuid-config']]" jetty-distribution/pom.xml
%pom_xpath_remove "pom:execution[pom:id[text()='copy-setuid-deps']]" jetty-distribution/pom.xml
# test-jaas-webapp artifact is disabled
%pom_xpath_remove "pom:execution[pom:id[text()='unpack-test-jaas-config']]" jetty-distribution/pom.xml
%pom_xpath_remove "pom:execution[pom:id[text()='unpack-test-jndi-config']]" jetty-distribution/pom.xml
%pom_xpath_remove "pom:execution[pom:id[text()='unpack-test-spec-config']]" jetty-distribution/pom.xml

# We don't have this plugin yet
%pom_remove_plugin :findbugs-maven-plugin jetty-websocket/pom.xml

# enforcer plugin constantly complains
%pom_remove_plugin :maven-enforcer-plugin

# Prevents problem with "Reporting mojo's can only be called from
# ReportDocumentRender". Investigate proper fix some other time?
%pom_remove_plugin :maven-pmd-plugin

# License plugin may be useful for upstream, but it has no use in
# Fedora.
%pom_remove_plugin :maven-license-plugin

# Remove unpack-config-deps from distribution
#
# This is needed because original code used classifiers to select subset
# of artifacts. Unfortunately there seems to be a weird bug affecting even
# upstream maven when this goes outside of reactor resolver. Or perhaps
# this is a weird feature.
#
# Our resolver obviously can't handle this so we have to unpack these
# manually before building distribution
%pom_xpath_remove "pom:execution[pom:id[text()='unpack-config-deps']]" jetty-distribution

# Disable SPDY for now as there are missing dependencies. SPDY needs
# Next Protocol Negotiation TLS Extension (NPN) for OpenJDK 7 or
# greater. We don't have this extension in Fedora.
# See: http://wiki.eclipse.org/Jetty/Feature/NPN
%pom_disable_module jetty-spdy
%pom_remove_dep org.eclipse.jetty.spdy: jetty-distribution
%pom_disable_module jetty-alpn
%pom_disable_module jetty-osgi-alpn jetty-osgi
%pom_remove_dep :jetty-alpn-server jetty-distribution

# org.mortbay.jasper:apache-jsp
%pom_disable_module apache-jsp
%pom_disable_module apache-jstl
%pom_remove_dep :apache-jsp jetty-maven-plugin
%pom_remove_dep :apache-jsp jetty-jspc-maven-plugin
%pom_add_dep 'org.eclipse.jetty:jetty-jsp:${project.version}' jetty-jspc-maven-plugin
%pom_remove_dep :apache-jsp jetty-distribution
%pom_remove_dep :apache-jstl jetty-maven-plugin
%pom_remove_dep :apache-jstl jetty-jspc-maven-plugin
%pom_remove_dep :apache-jstl jetty-distribution

# Disable OSGi
%if %{without osgi}
%pom_disable_module jetty-osgi
%endif

# Disable NoSQL
%if %{without nosql}
%pom_disable_module jetty-nosql
%endif

# Disable Spring
%if %{without spring}
%pom_disable_module jetty-spring
%endif

%pom_remove_dep :org.eclipse.jdt.core jetty-jsp

cp %{SOURCE6} .

# the default location is not allowed by SELinux
sed -i '/<SystemProperty name="jetty.state"/d' \
    jetty-distribution/src/main/resources/etc/jetty-started.xml


# Looks like all CDDL licensed content in tarball has been replaced,
# we don't need to install this license
rm LICENSE-CONTRIBUTOR/CDDLv1.0.txt

%build
%mvn_package :jetty-distribution __noinstall
# Separate package for main POM file
%mvn_package :jetty-project project

%mvn_package :fcgi-parent __noinstall
%mvn_package :jetty-runner __noinstall

# we don't have all necessary dependencies to run tests
# missing test dep: org.eclipse.jetty.toolchain:jetty-test-helper
%mvn_build -f -s

cd jetty-distribution
rm -rf target/distribution
mkdir -p target/distribution
find .. -ipath '*target/*config.jar' | ( while read; do
  unzip $REPLY -x 'META-INF/*' -d target/distribution
done)

%install
%mvn_install

# dirs
install -dm 755 %{buildroot}%{_javadir}/%{name}
%if %{with service}
install -dm 755 %{buildroot}%{_bindir}
install -dm 755 %{buildroot}%{_sysconfdir}/logrotate.d
install -dm 755 %{buildroot}%{confdir}
install -dm 755 %{buildroot}%{homedir}/start.d
install -dm 755 %{buildroot}%{logdir}
install -dm 755 %{buildroot}%{rundir}
install -dm 755 %{buildroot}%{tempdir}
install -dm 755 %{buildroot}%{appdir}
install -dm 755 %{buildroot}%{_unitdir}

# systemd unit file
cp %{SOURCE5} %{buildroot}%{_unitdir}/

# main pkg
tar xvf jetty-distribution/target/%{name}-distribution-%{version}.%{addver}.tar.gz -C %{buildroot}%{homedir}
mv %{buildroot}%{homedir}/%{name}-distribution-%{version}.%{addver}/* %{buildroot}%{homedir}/
rmdir %{buildroot}%{homedir}/%{name}-distribution-%{version}.%{addver}
rm -f %{buildroot}%{homedir}/bin/*cygwin*

# copy previously extracted configuration
cp jetty-distribution/target/distribution/etc/* %{buildroot}%{homedir}/etc/
cp -r jetty-distribution/target/distribution/modules/* %{buildroot}%{homedir}/modules/

install -pm 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
echo '# Placeholder configuration file.  No default is provided.' > \
     %{buildroot}%{confdir}/jetty.conf

# make sure jetty knows where to look for jars
sed -i "1{s:^:lib=%{homedir}/lib\n:}" %{buildroot}%{homedir}/start.ini
mv %{buildroot}%{homedir}/start.ini %{buildroot}%{confdir}
ln -s %{confdir}/start.ini %{buildroot}%{homedir}

# purge bundled jars
find %{buildroot}%{homedir}/ -name '*.jar' -delete

# recreat tarball structure in lib
ln -sf $(build-classpath glassfish-servlet-api) \
       %{buildroot}%{homedir}/lib/servlet-api-3.1.jar

build-jar-repository %{buildroot}%{homedir}/lib/annotations \
                     objectweb-asm/asm-all geronimo-annotation

build-jar-repository %{buildroot}%{homedir}/lib/jndi javamail/mail

build-jar-repository %{buildroot}%{homedir}/lib/jsp glassfish-el-api \
           glassfish-el taglibs-core taglibs-standard glassfish-jsp \
           glassfish-jsp-api ecj

ln -sf $(build-classpath jboss-transaction-1.2-api) \
       %{buildroot}%{homedir}/lib/jndi/

for module in jetty-ant jetty-util jetty-jmx jetty-io jetty-http               \
jetty-continuation jetty-server jetty-xml jetty-security jetty-servlet         \
jetty-webapp jetty-websocket jetty-servlets jetty-util-ajax jetty-maven-plugin \
jetty-jspc-maven-plugin jetty-deploy jetty-start jetty-plus jetty-annotations  \
jetty-jndi jetty-jsp jetty-jaas jetty-spring jetty-client jetty-proxy          \
jetty-jaspi jetty-osgi jetty-rewrite jetty-nosql jetty-monitor    \
jetty-http-spi; do
        ln -s %{_javadir}/%{name}/$module.jar \
        %{buildroot}%{homedir}/lib/$module-%{version}.%{addver}.jar
done

for module in websocket-common websocket-api websocket-client websocket-server \
websocket-servlet javax-websocket-client-impl javax-websocket-server-impl; do
        ln -s %{_javadir}/%{name}/$module.jar \
        %{buildroot}%{homedir}/lib/websocket/$module-%{version}.%{addver}.jar
done

( cat << EO_RC
JAVA_HOME=/usr/lib/jvm/java
JAVA_OPTIONS=
JETTY_HOME=%{homedir}
JETTY_CONSOLE=%{logdir}/jetty-console.log
JETTY_PORT=8080
JETTY_RUN=%{_localstatedir}/run/%{name}
JETTY_PID=\$JETTY_RUN/jetty.pid
EO_RC
) > %{buildroot}%{homedir}/.jettyrc

mkdir -p %{buildroot}%{_prefix}/lib/tmpfiles.d
( cat << EOF
D /var/run/%{name} 0755 %username %{username} -
EOF
) > %{buildroot}%{_prefix}/lib/tmpfiles.d/%{name}.conf

rm -fr %{buildroot}%{homedir}/logs
ln -s %{logdir} %{buildroot}%{homedir}/logs

mv %{buildroot}%{homedir}/etc/* %{buildroot}/%{confdir}
rm -fr %{buildroot}%{homedir}/etc
ln -s %{confdir} %{buildroot}%{homedir}/etc

mv %{buildroot}%{homedir}/webapps/* %{buildroot}/%{appdir}
rm -fr %{buildroot}%{homedir}/webapps
ln -s %{appdir} %{buildroot}%{homedir}/webapps

rm %{buildroot}%{homedir}/*.txt  %{buildroot}%{homedir}/*.html

# Here jetty is going to put its runtime data.
# See: https://bugzilla.redhat.com/show_bug.cgi?id=845993
ln -sf %{rundir} %{buildroot}%{homedir}/work

# replace the startup script with ours
cp -p %{SOURCE1} %{buildroot}%{homedir}/bin/jetty.sh

ln -s lib/%{name}-start-%{version}.%{addver}.jar %{buildroot}%{homedir}/start.jar

%pre
# Add the "jetty" user and group
%_pre_useradd %{username} %{homedir} /sbin/nologin

%postun
%_postun_userdel %{username}

%post
%_tmpfilescreate %{name}
%_post_service %{name}

%preun
%_preun_service %{name}

%endif # with service

%files
%if %{with service}
%config(noreplace) %{_prefix}/lib/tmpfiles.d/%{name}.conf
%config(noreplace) %attr(644, root, root) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %{confdir}
%dir %{jettylibdir}
%dir %{jettycachedir}
%{homedir}
%attr(744, jetty, jetty) %{homedir}/bin/jetty.sh
%attr(755, jetty, jetty) %{logdir}
%attr(755, jetty, jetty) %{tempdir}
%ghost %dir %attr(755, jetty, jetty) %{rundir}
%{appdir}
%{_unitdir}/%{name}.service
%endif # with service
%dir %{_javadir}/%{name}

%files project -f .mfiles-project
%doc NOTICE.txt README.TXT VERSION.txt LICENSE-eplv10-aslv20.html LICENSE-CONTRIBUTOR

%files annotations -f .mfiles-jetty-annotations
%files ant -f .mfiles-jetty-ant
%files client -f .mfiles-jetty-client
%files continuation -f .mfiles-jetty-continuation
%files deploy -f .mfiles-jetty-deploy
%files fcgi-client -f .mfiles-fcgi-client
%files fcgi-server -f .mfiles-fcgi-server
%files http -f .mfiles-jetty-http
%files http-spi -f .mfiles-jetty-http-spi
%files io -f .mfiles-jetty-io
%files jaas -f .mfiles-jetty-jaas
%files jaspi -f .mfiles-jetty-jaspi
%files jmx -f .mfiles-jetty-jmx
%files jndi -f .mfiles-jetty-jndi
%files jsp -f .mfiles-jetty-jsp
%files jspc-maven-plugin -f .mfiles-jetty-jspc-maven-plugin
%files maven-plugin -f .mfiles-jetty-maven-plugin
%files monitor -f .mfiles-jetty-monitor
%files plus -f .mfiles-jetty-plus
%files proxy -f .mfiles-jetty-proxy
%files rewrite -f .mfiles-jetty-rewrite
%files security -f .mfiles-jetty-security
%files server -f .mfiles-jetty-server
%files servlet -f .mfiles-jetty-servlet
%files servlets -f .mfiles-jetty-servlets
%files start -f .mfiles-jetty-start
%files util -f .mfiles-jetty-util
%doc NOTICE.txt README.TXT VERSION.txt LICENSE-eplv10-aslv20.html LICENSE-CONTRIBUTOR
%doc LICENSE-MIT
%files util-ajax -f .mfiles-jetty-util-ajax
%files webapp -f .mfiles-jetty-webapp
%files xml -f .mfiles-jetty-xml
%files websocket-api -f .mfiles-websocket-api
%files websocket-client -f .mfiles-websocket-client
%files websocket-common -f .mfiles-websocket-common
%files websocket-parent -f .mfiles-websocket-parent
%files websocket-server -f .mfiles-websocket-server
%files websocket-servlet -f .mfiles-websocket-servlet
%files javax-websocket-client-impl -f .mfiles-javax-websocket-client-impl
%files javax-websocket-server-impl -f .mfiles-javax-websocket-server-impl

%if %{with nosql}
%files nosql -f .mfiles-jetty-nosql
%endif

%if %{with osgi}
%files httpservice -f .mfiles-jetty-httpservice
%files osgi-project -f .mfiles-jetty-osgi-project
%files osgi-boot -f .mfiles-jetty-osgi-boot
%files osgi-boot-warurl -f .mfiles-jetty-osgi-boot-warurl
%files osgi-boot-jsp -f .mfiles-jetty-osgi-boot-jsp
%endif

%if %{with spring}
%files spring -f .mfiles-jetty-spring
%endif

%files javadoc -f .mfiles-javadoc
%doc NOTICE.txt LICENSE*



%changelog
* Wed Dec 31 2014 luigiwalser <luigiwalser> 9.2.1-4.mga5
+ Revision: 807665
- use appropriate post/pre/postun/preun macros for mageia

* Sun Dec 28 2014 pterjan <pterjan> 9.2.1-3.mga5
+ Revision: 806789
- Fix tmpfile config path
- Fix groups
- Add missing BuildRequires
- Sync with Fedora 21 (and update to 9.2.1)

  + umeabot <umeabot>
    - Second Mageia 5 Mass Rebuild
    - Mageia 5 Mass Rebuild

* Tue Oct 22 2013 umeabot <umeabot> 9.0.6-2.mga4
+ Revision: 545440
- Mageia 4 Mass Rebuild

* Wed Oct 16 2013 dmorgan <dmorgan> 9.0.6-1.mga4
+ Revision: 501257
- New version

* Fri Sep 27 2013 dmorgan <dmorgan> 9.0.5-2.mga4
+ Revision: 488111
- Fix typo in requires

* Fri Sep 27 2013 dmorgan <dmorgan> 9.0.5-1.mga4
+ Revision: 487994
- New version

* Fri Sep 20 2013 dmorgan <dmorgan> 9.0.0-2.mga4
+ Revision: 482611
- Rebuild against new javapackages
- Update to upstream version 9.0.0

* Sat Jul 13 2013 dmorgan <dmorgan> 9.0.0-0.RC3.1.mga4
+ Revision: 453820
- Add glassfish-el deps
- New version 9.0.0 RC3
- New version 9.0.0 RC2
- New version
- New version

* Sun Jul 07 2013 dmorgan <dmorgan> 8.1.5-8.mga4
+ Revision: 451037
- Use file lists generated by improved add_maven_depmap macro

* Sat May 04 2013 anssi <anssi> 8.1.5-7.mga3
+ Revision: 412287
- add missing conflicts due to file moves

* Sun Mar 24 2013 colin <colin> 8.1.5-6.mga3
+ Revision: 404859
- Add systemd requires and general post/pre fixes (mga#9302)

* Sat Jan 19 2013 colin <colin> 8.1.5-5.mga3
+ Revision: 389818
- Don't bother ghosting the rundir (no other pkgs do this)

* Sat Jan 12 2013 umeabot <umeabot> 8.1.5-4.mga3
+ Revision: 355338
- Mass Rebuild - https://wiki.mageia.org/en/Feature:Mageia3MassRebuild

* Sun Nov 25 2012 colin <colin> 8.1.5-3.mga3
+ Revision: 321778
- Do not package tmpfiles conf in /etc
- Run systemd-tmpfiles --create on post install

* Wed Sep 12 2012 dmorgan <dmorgan> 8.1.5-2.mga3
+ Revision: 292897
- Fix deps

* Wed Sep 12 2012 dmorgan <dmorgan> 8.1.5-1.mga3
+ Revision: 292874
- New version

* Mon Jul 02 2012 dmorgan <dmorgan> 8.1.2-3.mga3
+ Revision: 266662
- Do not requires systemd-sysv

* Mon Jul 02 2012 dmorgan <dmorgan> 8.1.2-1.mga3
+ Revision: 266655
- Revert to stable8.1.2
- Update to jetty 8.1.4
- New version 8.1.2
  New sub packages ( server, osgi, ... )

* Sun Apr 29 2012 colin <colin> 6.1.26-14.mga2
+ Revision: 234252
- Add LSB headers to initscripts (mga#5262)

* Fri Feb 24 2012 gil <gil> 6.1.26-13.mga2
+ Revision: 214152
- corrected broken sed
- buid fix
- correctd geronimo-jta references
- added R geronimo-jta

* Fri Dec 09 2011 dmorgan <dmorgan> 6.1.26-12.mga2
+ Revision: 179641
- Add depmap for activation.jar
- Remove useless macros

* Fri Oct 21 2011 dmorgan <dmorgan> 6.1.26-10.mga2
+ Revision: 157129
- Fix groups
- Fix buildrequires
- Remove unused patches
- Adapt build for maven 3.x.

  + gil <gil>
    - rebuilt added maven-plugins sub package,jetty-annotations, jetty-naming,...
    - rebuilt added maven-plugins sub package,jetty-annotations, jetty-naming,...

* Fri May 27 2011 dmorgan <dmorgan> 6.1.26-8.mga1
+ Revision: 100586
- Add zip as buildrequires
- Fix build ( add tomcat6-lib as buildrequire)
- Fix userdel
- Create User/groups
- Fix buildrequires
- Relax requires on mx4j
- Rebuild after bootstrapping
- imported package jetty