source: trunk/dports/java/tomcat5/Portfile

Last change on this file was 97894, checked in by rmstonecipher@…, 5 years ago

audio/taglib upgraded version from 1.7.2 to 1.8, incremented revision of 19 dependent ports due to .dylib change

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