# $Id: Portfile,v 1.8 2004/11/15 15:17:17 jberry Exp $ PortSystem 1.0 name tomcat5 version 5.5.4 categories java www maintainers jberry@opendarwin.org platforms darwin description Tomcat 5 HTTP Server and Java Servlet Container. long_description Tomcat is the servlet container that is used in the official \ Reference Implementation for the Java Servlet and JavaServer \ Pages technologies. homepage http://jakarta.apache.org/tomcat/ distname jakarta-tomcat-${version}-src master_sites apache:jakarta/tomcat-5/v${version}/src/ checksums md5 2fdfb34df8f670af2669d02fb6103a45 patchfiles patch-catalina.sh.diff \ patch-jk2.properties.diff depends_build bin:ant:apache-ant depends_lib bin:java:kaffe \ bin:jsvc:commons-daemon \ lib:pcre:pcre \ lib:XXX:jakarta-taglibs-standard-11 \ lib:XXX:commons-beanutils \ lib:XXX:commons-collections \ lib:XXX:commons-launcher \ lib:XXX:commons-daemon \ lib:XXX:commons-digester \ lib:XXX:commons-el \ lib:XXX:commons-logging \ lib:XXX:commons-modeler \ lib:XXX:jakarta-regexp \ lib:XXX:xercesj \ lib:XXX:jakarta-log4j \ lib:XXX:commons-httpclient \ lib:XXX:commons-pool \ lib:XXX:commons-dbcp \ lib:XXX:commons-fileupload \ lib:XXX:mx4j \ lib:XXX:junit \ lib:XXX:jaxen \ lib:XXX:saxpath \ lib:XXX:struts worksrcdir ${distname}/jakarta-tomcat-5 set javaLibs ${prefix}/share/java set home share/java/tomcat5 set tomcatuser www set tomcatgroup www use_configure no build.cmd ant build.target download dist build.args [join " -Dbase.path=${worksrcpath}/Repository -Dnsis.exe=${worksrcpath}/.bogus -Dcommons-beanutils.jar=${javaLibs}/commons-beanutils.jar -Dcommons-collections.jar=${javaLibs}/commons-collections.jar -Dcommons-launcher.jar=${javaLibs}/commons-launcher.jar -Dcommons-daemon.jar=${javaLibs}/commons-daemon.jar -Dcommons-digester.jar=${javaLibs}/commons-digester.jar -Dcommons-el.jar=${javaLibs}/commons-el.jar -Dcommons-logging.jar=${javaLibs}/commons-logging.jar -Dcommons-logging-api.jar=${javaLibs}/commons-logging-api.jar -Dcommons-modeler.jar=${javaLibs}/commons-modeler.jar -Dcommons-httpclient.jar=${javaLibs}/commons-httpclient.jar -Dcommons-pool.jar=${javaLibs}/commons-pool.jar -Dcommons-dbcp.jar=${javaLibs}/commons-dbcp.jar -Dcommons-fileupload.jar=${javaLibs}/commons-fileupload.jar -Dregexp.jar=${javaLibs}/jakarta-regexp.jar -DxercesImpl.jar=${javaLibs}/xercesImpl.jar -Dxml-apis.jar=${javaLibs}/xml-apis.jar -Dlog4j.jar=${javaLibs}/jakarta-log4j.jar -Djmx.jar=${javaLibs}/mx4j.jar -Djunit.jar=${javaLibs}/junit.jar -Djaxen.jar=${javaLibs}/jaxen-core.jar -Dsaxpath.jar=${javaLibs}/saxpath.jar -Dstruts.lib=${javaLibs}/struts/lib "] default_variants +compat # This variant provides compatibility with pre-JRE 1.5 systems variant compat { build.target-append compat } pre-build { # Make a bogus file to prevent nsis.exe from downloading system "touch ${worksrcpath}/.bogus" } destroot { set target ${destroot}${prefix}/${home} # Ensure we've got needed directories xinstall -m 755 -d \ ${destroot}${prefix}/share/java \ ${destroot}${prefix}/share/doc \ ${destroot}${prefix}/etc/rc.d # Create the tomcat user addgroup ${tomcatgroup} set gid [existsgroup ${tomcatgroup}] adduser ${tomcatgroup} gid=${gid} realname=Web Server # Install Tomcat file copy ${worksrcpath}/dist ${target} # Add compat files as needed if { [variant_isset compat] } { system "tar -cf - -C ${worksrcpath}/compat . | tar xpf - -C ${target}" } # Add the jstl libs to tomcat5/shared/lib so that they're available to all xinstall -m 644 \ ${prefix}/share/java/jstl.jar \ ${prefix}/share/java/standard.jar \ ${target}/shared/lib # Remove unwanted files foreach f [glob -directory ${target}/bin *.bat] { file delete $f } # Maintain empty directories destroot.keepdirs-append \ ${target}/logs \ ${target}/temp \ ${target}/work \ ${target}/shared/classes \ ${target}/common/classes # Install our scripts xinstall -m 755 \ ${filespath}/tomcatctl \ ${filespath}/conf_setup.sh \ ${filespath}/setenv.sh \ ${target}/bin xinstall -m 755 ${filespath}/tomcat5.sh \ ${destroot}${prefix}/etc/rc.d # Add a symlink from bin directory to tomcatctl system "cd ${destroot}${prefix}/bin && ln -s ../${home}/bin/tomcatctl" # Configure the scripts reinplace s|PREFIX=$|PREFIX=${prefix}| ${target}/bin/tomcatctl reinplace s|TOMCAT_USER=$|TOMCAT_USER=${tomcatuser}| ${target}/bin/tomcatctl reinplace s|TOMCATPREFIX=$|TOMCATPREFIX=${prefix}/${home}| ${destroot}${prefix}/etc/rc.d/tomcat5.sh # Rename certain files as .sample to avoid replacing them on update # These will be "repaired" by conf_setup.sh on first run foreach f " catalina.policy catalina.properties jk2.properties server.xml tomcat-users.xml web.xml " { file rename ${target}/conf/${f} ${target}/conf/${f}.sample } reinplace s|@@PREFIX@@|${prefix}|g ${target}/conf/jk2.properties.sample # Fix ownership of some directories tomcat really needs to write to system "chown -R ${tomcatuser}:${tomcatgroup} \ ${target}/conf \ ${target}/logs \ ${target}/temp \ ${target}/webapps \ ${target}/work" # Install the docs file copy ${worksrcpath}/build/docs \ ${destroot}${prefix}/share/doc/${name} } post-install { ui_msg "#" ui_msg "# Configuration files in ${prefix}/${home}/conf have been" ui_msg "# installed with a .sample extension so that they won't be replaced by a" ui_msg "# port update. Each will be copied to its proper location during the" ui_msg "# first startup of tomcat by catalina.sh or tomcatctl if you don't" ui_msg "# do this yourself first. If this _is_ an update, you might do a diff to" ui_msg "# verify that you're not missing anything in the newer .sample versions" ui_msg "# of these files." ui_msg "#" ui_msg "# The script ${prefix}/${home}/bin/tomcatctl has been installed to" ui_msg "# facilitate start and stop of tomcat using the jsvc utility, which allows you to" ui_msg "# start tomcat as a true daemon process. Once it has acquired its TCP socket," ui_msg "# jsvc will drop its root privileges and run as user ${tomcatuser}." ui_msg "#" }