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