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

Last change on this file since 81450 was 81450, checked in by ryandesign@…, 9 years ago

tomcat5: don't use .. components in patchfile; see #30451

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