source: trunk/dports/java/tomcat6/Portfile @ 77147

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

audio/taglib upgraded version from 1.6.3 to 1.7, incremented revision of 15 dependents

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