source: trunk/dports/java/tomcat5/Portfile @ 77248

Last change on this file since 77248 was 77248, checked in by blair@…, 10 years ago

tomcat5: whitespace cleanup.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.0 KB
Line 
1# $Id: Portfile 77248 2011-03-24 16:39:46Z blair@macports.org $
2
3PortSystem 1.0
4
5name                    tomcat5
6version                 5.5.25
7revision                1
8
9categories              java www
10maintainers             nomaintainer
11platforms               darwin
12
13description             Tomcat 5 HTTP Server and Java Servlet Container.
14long_description        Tomcat is the servlet container that is used in \
15                        the official Reference Implementation for the Java \
16                        Servlet and JavaServer Pages technologies.
17homepage                http://tomcat.apache.org/
18
19distname                apache-tomcat-${version}-src
20master_sites            apache:tomcat/tomcat-5/v${version}/src/
21checksums               md5 2d6cc9a16aceeef4ec3610cd782d5c9d \
22                        sha1 81ef41e25f805831aa63353f52e5b498c74a3414
23                                       
24patchfiles              patch-catalina.sh
25
26depends_build           bin:ant:apache-ant
27depends_lib             bin:java:kaffe \
28                        bin:jsvc:commons-daemon \
29                        port:jakarta-taglibs-standard-11 \
30                        port:commons-beanutils \
31                        port:commons-collections \
32                        port:commons-launcher \
33                        port:commons-daemon \
34                        port:commons-digester \
35                        port:commons-el \
36                        port:commons-logging \
37                        port:commons-modeler \
38                        port:commons-httpclient \
39                        port:commons-pool \
40                        port:commons-dbcp \
41                        port:commons-fileupload \
42                        port:commons-io \
43                        port:jakarta-regexp \
44                        port:xercesj \
45                        port:jakarta-log4j \
46                        port:mx4j \
47                        port:junit \
48                        port:jaxen \
49                        port:saxpath
50                               
51worksrcdir              ${distname}/build
52
53set javaLibs            ${prefix}/share/java
54set home                share/java/tomcat5
55set tomcatuser          www
56set tomcatgroup         www
57
58use_configure           no
59
60build.cmd               ant
61build.target            download dist compat
62build.args              [join "
63                                -Dbase.path=${worksrcpath}/Repository
64                                -Dnsis.exe=${worksrcpath}/.bogus
65                                -Dcommons-beanutils.jar=${javaLibs}/commons-beanutils.jar
66                                -Dcommons-collections.jar=${javaLibs}/commons-collections.jar
67                                -Dcommons-launcher.jar=${javaLibs}/commons-launcher.jar
68                                -Dcommons-daemon.jar=${javaLibs}/commons-daemon.jar
69                                -Dcommons-digester.jar=${javaLibs}/commons-digester.jar
70                                -Dcommons-el.jar=${javaLibs}/commons-el.jar
71                                -Dcommons-logging.jar=${javaLibs}/commons-logging.jar
72                                -Dcommons-logging-api.jar=${javaLibs}/commons-logging-api.jar
73                                -Dcommons-modeler.jar=${javaLibs}/commons-modeler.jar
74                                -Dcommons-httpclient.jar=${javaLibs}/commons-httpclient.jar
75                                -Dcommons-pool.jar=${javaLibs}/commons-pool.jar
76                                -Dcommons-dbcp.jar=${javaLibs}/commons-dbcp.jar
77                                -Dcommons-fileupload.jar=${javaLibs}/commons-fileupload.jar
78                                -Dregexp.jar=${javaLibs}/jakarta-regexp.jar
79                                -DxercesImpl.jar=${javaLibs}/xercesImpl.jar
80                                -Dxml-apis.jar=${javaLibs}/xml-apis.jar
81                                -Dlog4j.jar=${javaLibs}/jakarta-log4j.jar
82                                -Djmx.lib=${javaLibs}
83                                -Djunit.jar=${javaLibs}/junit.jar
84                                -Djaxen.jar=${javaLibs}/jaxen.jar
85                                -Dsaxpath.jar=${javaLibs}/saxpath.jar
86                                -Djasper.home=${worksrcpath}/../jasper
87                                "]
88#                               -Dstruts.lib=${javaLibs}/struts/lib
89
90# Remove compatibility for pre-JRE 1.5 systems
91variant nocompat {
92        build.target-delete compat
93}
94
95pre-build {
96        #
97        # Tomcat in this version requires ant 1.6.2.
98        # If the current version of ant is not at least 1.6.2 then
99        # tell the user and fail.
100        #
101        if { [string length [auto_execok ant]] } {
102                set verOutput [exec ant -version]
103                regexp {version (\d+(\.\d+)*)} $verOutput -> antVersion
104                if { [rpm-vercomp $antVersion "1.6.2"] < 0 } {
105                        return -code error "This version of tomcat requires ant version 1.6.2 or better. Please install a newer ant before proceeding."
106                }
107        }
108
109        # Make a bogus file to prevent nsis.exe from downloading
110        system "touch ${worksrcpath}/.bogus"
111}
112
113destroot {
114        set target ${destroot}${prefix}/${home}
115
116        # Ensure we've got needed directories
117        xinstall -m 755 -d \
118                ${destroot}${prefix}/share/java \
119                ${destroot}${prefix}/share/doc \
120                ${destroot}${prefix}/etc/rc.d
121               
122        # Create the tomcat user
123        addgroup ${tomcatgroup}
124        set gid [existsgroup ${tomcatgroup}]
125        adduser ${tomcatuser} gid=${gid} realname=Web Server
126       
127        # Install Tomcat
128        file copy ${worksrcpath}/dist ${target}
129       
130        # Add compat files as needed
131        if { ! [variant_isset nocompat] } {
132                system "tar -cf - -C ${worksrcpath}/compat . | tar xpf - -C ${target}"
133        }
134       
135        # Add the jstl libs to tomcat5/shared/lib so that they're available to all
136        xinstall -m 644 \
137                ${prefix}/share/java/jstl.jar \
138                ${prefix}/share/java/standard.jar \
139                ${target}/shared/lib
140               
141        # Remove unwanted files
142        foreach f [glob -directory ${target}/bin *.bat] { file delete $f }
143       
144        # Maintain empty directories
145        destroot.keepdirs-append \
146                ${target}/logs \
147                ${target}/temp \
148                ${target}/work \
149                ${target}/shared/classes \
150                ${target}/common/classes
151               
152        # Install our scripts
153        xinstall -m 755 \
154                ${filespath}/tomcatctl \
155                ${filespath}/conf_setup.sh \
156                ${filespath}/setenv.sh \
157                ${target}/bin
158        xinstall -m 755 \
159                ${filespath}/setenv.local \
160                ${target}/conf
161       
162        # Don't install startup script, as we're now generating a startupitem
163        #xinstall -m 755 ${filespath}/tomcat5.sh \
164        #        ${destroot}${prefix}/etc/rc.d
165        #reinplace s|TOMCATPREFIX=$|TOMCATPREFIX=${prefix}/${home}| ${destroot}${prefix}/etc/rc.d/tomcat5.sh
166               
167        # Add a symlink from bin directory to tomcatctl
168        system "cd ${destroot}${prefix}/bin && ln -s ../${home}/bin/tomcatctl"
169       
170        # Configure the scripts
171        reinplace s|PREFIX=$|PREFIX=${prefix}| ${target}/bin/tomcatctl
172        reinplace s|TOMCAT_USER=$|TOMCAT_USER=${tomcatuser}| ${target}/bin/tomcatctl
173       
174        # Rename certain files as .sample to avoid replacing them on update
175        # These will be "repaired" by conf_setup.sh on first run
176        foreach f         "
177                                catalina.policy
178                                catalina.properties
179                                server.xml
180                                tomcat-users.xml
181                                web.xml
182                                setenv.local
183                                " {
184                file rename ${target}/conf/${f} ${target}/conf/${f}.sample
185        }
186
187        # Fix ownership of some directories tomcat really needs to write to
188        system "chown -R ${tomcatuser}:${tomcatgroup} \
189                ${target}/conf \
190                ${target}/logs \
191                ${target}/temp \
192                ${target}/webapps \
193                ${target}/work"
194       
195        # Install the docs
196        file copy ${worksrcpath}/build/docs \
197                ${destroot}${prefix}/share/doc/${name}
198}
199
200
201post-install {
202        ui_msg "#"
203        ui_msg "# Configuration files in ${prefix}/${home}/conf have been"
204        ui_msg "# installed with a .sample extension so that they won't be replaced by a"
205        ui_msg "# port update. Each will be copied to its proper location during the"
206        ui_msg "# first startup of tomcat by catalina.sh or tomcatctl if you don't"
207        ui_msg "# do this yourself first. If this _is_ an update, you might do a diff to"
208        ui_msg "# verify that you're not missing anything in the newer .sample versions"
209        ui_msg "# of these files."
210        ui_msg "#"
211        ui_msg "# The script ${prefix}/${home}/bin/tomcatctl has been installed to"
212        ui_msg "# facilitate start and stop of tomcat using the jsvc utility, which allows you to"
213        ui_msg "# start tomcat as a true daemon process. Once tomcat has acquired its TCP socket,"
214        ui_msg "# jsvc will drop its root privileges and run as user ${tomcatuser}."
215        ui_msg "#"
216        ui_msg "# Under Apple Java, control over the Java version used to launch ${name} is"
217        ui_msg "# through the shell variable JAVA_JVM_VERSION. This variable should be set"
218        ui_msg "# to a java version such as 1.4, 1.5, or CurrentJDK (for the default version)."
219        ui_msg "# You may set JAVA_JVM_VERSION in ${prefix}/${home}/bin/setenv.sh."
220        ui_msg "#"
221}
222
223startupitem.create      yes
224startupitem.executable  "${prefix}/bin/tomcatctl" start
225startupitem.pidfile     clean "${prefix}/share/java/tomcat5/logs/${name}.pid"
226
227livecheck.type          regex
228livecheck.url           ${homepage}/download-55.cgi
229livecheck.regex         "apache-tomcat-(\\d+\\.\\d+(\\.\\d+)?)-src.tar.gz"
Note: See TracBrowser for help on using the repository browser.