/
Portfile
120 lines (99 loc) · 4.15 KB
/
Portfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# $Id: Portfile,v 1.2 2004/11/15 15:25:50 jberry Exp $
PortSystem 1.0
name mod_jk2
version 5.5.4
categories www java
maintainers jberry@opendarwin.org
platforms darwin
description Apache mod_jk2 remote server connector (from Tomcat).
long_description mod_jk2 provides a connection between apache2 and a remote \
server. It passes incoming requests on to the remote server \
for handling. Configurations may be mixed such that each \
server handles a particular type of request. mod_jk2 comes \
from the Java based Tomcat server, and is usually used with it.
homepage http://jakarta.apache.org/tomcat/connectors-doc/jk2/
distname jakarta-tomcat-${version}-src
master_sites apache:jakarta/tomcat-5/v${version}/src/
checksums md5 2fdfb34df8f670af2669d02fb6103a45
patchfiles patch-workers2.properties.minimal.diff
depends_build path:${prefix}/apache2/bin/httpd:apache2
worksrcdir ${distname}/jakarta-tomcat-connectors/jk/native2
# Try to determine a reasonable JAVA_HOME value
if { [llength [array get env "JAVA_HOME"]] > 0 } {
set javahome $env(JAVA_HOME)
} else {
set javahome ""
}
if { ![file isdirectory ${javahome}] } {
if { [variant_isset darwin] } {
if { [file isdirectory "/Library/Java/Home"] } {
set javahome "/Library/Java/Home"
}
}
}
if { ![file isdirectory ${javahome}] } {
error "This port needs a reasonable value for JAVA_HOME, but couldn't automatically determine one: please set the environment variable."
}
post-patch {
# Clean up the the buildconf script
reinplace s|libtoolize|glibtoolize| ${worksrcpath}/buildconf.sh
# Fix link
reinplace s|-lcrypt|| ${worksrcpath}/server/apache2/Makefile.in
}
pre-configure {
# Check to be sure the apache2 port has been updated, and
# warn the user if it hasn't been.
# In port versions prior to 2.0.52_1, apxs didn't know where libdir was.
# That information is needed by the jk2 configure script.
set apxs ${prefix}/apache2/bin/apxs
if { [file executable ${apxs}] } {
set libdir [exec ${apxs} -q LIBDIR]
if { 0 == [string length ${libdir}] || ![file isdirectory ${libdir}] } {
error "Your apache2 installation doesn't know where its library directory is. Please update your apache2 port."
}
}
# Build the jk2 configure file
file attributes ${worksrcpath}/buildconf.sh -permissions ug+x
system "cd ${worksrcpath} && ./buildconf.sh"
}
configure.args --with-pcre \
--with-apxs2=${prefix}/apache2/bin/apxs \
--with-jni \
--with-java-home=${javahome}
destroot {
# Install the jk2 connector for apache2
xinstall -m 755 -d \
${destroot}${prefix}/apache2/modules \
${destroot}${prefix}/apache2/conf
xinstall -m 644 \
${worksrcpath}/../build/jk2/apache2/mod_jk2.so \
${worksrcpath}/../build/jk2/apache2/libjkjni.so \
${destroot}${prefix}/apache2/modules
xinstall -m 644 ${worksrcpath}/../conf/workers2.properties.minimal \
${destroot}${prefix}/apache2/conf/workers2.properties.sample
}
post-install {
ui_msg "#"
ui_msg "# Example file ${prefix}/apache2/conf/workers2.properties.sample has"
ui_msg "# been installed to illustrate use of the jk2 connector between "
ui_msg "# apache2 and tomcat over a unix domain socket."
ui_msg "#"
ui_msg "# You will want to create a working copy of this file as workers2.properties"
ui_msg "# and configure the uri mappings within it, or using JkUriSet in httpd.conf."
ui_msg "#"
ui_msg "# If you're using Tomcat, note that you also need to configure the file"
ui_msg "# jk2.properties in tomcat5/conf (Tomcat should have installed a copy of this"
ui_msg "# file as jk2.properties.sample), or add appropriate attributes to the Connector"
ui_msg "# element in server.xml. Note that if you are going to use jk2.properties, you"
ui_msg "# now need to specify this in the Connector element in server.xml:"
ui_msg "#"
ui_msg "# <Connector protocol='AJP/1.3' port='8009'"
ui_msg "# enableLookups='false' redirectPort='8443'"
ui_msg "# propertiesFile='conf/jk2.properties'"
ui_msg "# />"
ui_msg "#"
ui_msg "# Be sure to also add the following line to your httpd.conf:"
ui_msg "#"
ui_msg "# LoadModule jk2_module modules/mod_jk2.so"
ui_msg "#"
}