1 | # $Id$ |
---|
2 | |
---|
3 | PortSystem 1.0 |
---|
4 | |
---|
5 | name openamq |
---|
6 | version 1.2c4 |
---|
7 | categories net |
---|
8 | maintainers Jacobus.Geluk@gmail.com |
---|
9 | description A complete AMQP message queueing broker |
---|
10 | long_description ${description} |
---|
11 | |
---|
12 | homepage http://www.openamq.org |
---|
13 | |
---|
14 | platforms darwin |
---|
15 | |
---|
16 | master_sites http://www.openamq.org/download/ \ |
---|
17 | http://www.opensrcsystems.com/openamq/ |
---|
18 | |
---|
19 | distname OpenAMQ-${version} |
---|
20 | |
---|
21 | checksums md5 0eb6d4e5a7eb170274889f2469529af0 \ |
---|
22 | sha1 284294a99e41fb01dbc5baa6740517465c954c5c \ |
---|
23 | rmd160 a2a40243b563f9706c46f786e7ed82eab7264052 |
---|
24 | |
---|
25 | depends_lib port:gmake \ |
---|
26 | port:apr \ |
---|
27 | port:pcre |
---|
28 | |
---|
29 | patchfiles patch-base-2.2b1-smt-smt_socket_request.icl.diff \ |
---|
30 | patch-base-2.2b1-smt-smt_socket_request.c.diff \ |
---|
31 | patch-base-2.2b1-ipr-ipr_file.icl.diff \ |
---|
32 | patch-base-2.2b1-ipr-ipr_file.c.diff \ |
---|
33 | patch-foreign-1.1d7-boomake.diff \ |
---|
34 | patch-foreign-1.1d7-c-c.diff |
---|
35 | |
---|
36 | use_configure no |
---|
37 | |
---|
38 | set IBASE "${workpath}/ibase" |
---|
39 | set SH "/bin/sh" |
---|
40 | set BUILDSCRIPT "${workpath}/portbuild.sh" |
---|
41 | set DIR_FOREIGN "foreign-1.1d7" |
---|
42 | set DIR_BASE1 "base-1.2d7" |
---|
43 | set DIR_BASE2 "base-2.2b1" |
---|
44 | set DIR_GSL "gsl-4.0c19" |
---|
45 | set LOG_PATH "${prefix}/var/log/${name}" |
---|
46 | set BUILDDEBUG "no" |
---|
47 | |
---|
48 | variant debug description {Build OpenAMQ with debug symbols} { |
---|
49 | set BUILDDEBUG "yes" |
---|
50 | } |
---|
51 | |
---|
52 | proc arrow {line} { |
---|
53 | |
---|
54 | global UI_PREFIX |
---|
55 | |
---|
56 | ui_msg "${UI_PREFIX} ${line}" |
---|
57 | } |
---|
58 | |
---|
59 | # |
---|
60 | # Extract phase |
---|
61 | # |
---|
62 | pre-extract { |
---|
63 | |
---|
64 | system "rm -rf ${workpath}" |
---|
65 | system "mkdir -p ${workpath}" |
---|
66 | } |
---|
67 | |
---|
68 | post-extract { |
---|
69 | |
---|
70 | global IBASE DIR_FOREIGN |
---|
71 | |
---|
72 | arrow "Post Extract" |
---|
73 | # |
---|
74 | # Change work/OpenAMQ-${version}/OpenAMQ-${version} into |
---|
75 | # work/OpenAMQ-${version} |
---|
76 | # |
---|
77 | move ${workpath}/${distname}/${distname} ${workpath}/${distname}XX |
---|
78 | eval move [glob ${workpath}/${distname}/*] ${workpath} |
---|
79 | system "rm -rf ${workpath}/${distname}" |
---|
80 | move ${workpath}/${distname}XX ${workpath}/${distname} |
---|
81 | # |
---|
82 | # Do not use xinstall -d below since that generates verbose messages we |
---|
83 | # do not need here, we're not really installing anything... |
---|
84 | # |
---|
85 | system "mkdir -p ${IBASE}/bin" |
---|
86 | system "mkdir -p ${IBASE}/include" |
---|
87 | file copy "${workpath}/${DIR_FOREIGN}/apr/base_apr.h" "${IBASE}/include" |
---|
88 | |
---|
89 | arrow "Finished Post Extract" |
---|
90 | } |
---|
91 | |
---|
92 | # |
---|
93 | # Patch phase |
---|
94 | # |
---|
95 | proc patchBoomake {file} { |
---|
96 | |
---|
97 | ui_debug "Patching ${file}..." |
---|
98 | |
---|
99 | reinplace "s|Linux|Darwin|g" ${file} |
---|
100 | } |
---|
101 | |
---|
102 | proc patchCscript {file} { |
---|
103 | |
---|
104 | ui_debug "Patching ${file}..." |
---|
105 | |
---|
106 | reinplace "s|Linux|Darwin|g" ${file} |
---|
107 | reinplace "s|BOOM_SUPPORTS_MT=.*#|BOOM_SUPPORTS_MT=1 #|g" ${file} |
---|
108 | } |
---|
109 | |
---|
110 | proc patchFreeBSDHeader {file} { |
---|
111 | |
---|
112 | ui_debug "Patching ${file}..." |
---|
113 | |
---|
114 | reinplace "s|FreeBSD|Darwin|g" ${file} |
---|
115 | reinplace "s|FREEBSD|DARWIN|g" ${file} |
---|
116 | } |
---|
117 | |
---|
118 | proc patchServerConfig {file} { |
---|
119 | |
---|
120 | global LOG_PATH |
---|
121 | |
---|
122 | ui_debug "Patching ${file}..." |
---|
123 | |
---|
124 | reinplace "s|\"logs\"|\"${LOG_PATH}\"|g" ${file} |
---|
125 | reinplace "s|'logs'|'${LOG_PATH}'|g" ${file} |
---|
126 | reinplace "s|\"archive\"|\"${LOG_PATH}/archive\"|g" ${file} |
---|
127 | reinplace "s|'archive'|'${LOG_PATH}/archive'|g" ${file} |
---|
128 | } |
---|
129 | |
---|
130 | proc patchIprFile {file} { |
---|
131 | |
---|
132 | global prefix |
---|
133 | |
---|
134 | ui_debug "Patching ${file}..." |
---|
135 | |
---|
136 | set etcPath "${prefix}/etc" |
---|
137 | |
---|
138 | if {[string compare "${etcPath}" "/opt/local/etc"] == 0} { |
---|
139 | ui_info "We do not have te patch ${file}" |
---|
140 | } else { |
---|
141 | reinplace "s|/opt/local/etc|${etcPath}|g" ${file} |
---|
142 | } |
---|
143 | } |
---|
144 | |
---|
145 | post-patch { |
---|
146 | |
---|
147 | arrow "Post Patch patches" |
---|
148 | foreach file [exec find ${workpath} -type f -name boomake] { |
---|
149 | patchBoomake ${file} |
---|
150 | } |
---|
151 | foreach file [exec find ${workpath} -type f -name configure] { |
---|
152 | patchBoomake ${file} |
---|
153 | } |
---|
154 | foreach file [exec find ${workpath} -type f -name c] { |
---|
155 | patchCscript ${file} |
---|
156 | } |
---|
157 | foreach file [exec grep -lR __FreeBSD__ ${workpath}] { |
---|
158 | patchFreeBSDHeader ${file} |
---|
159 | } |
---|
160 | |
---|
161 | patchServerConfig ${workpath}/${distname}/server/amq_server_config.icl |
---|
162 | patchServerConfig ${workpath}/${distname}/server/amq_server_config.c |
---|
163 | |
---|
164 | patchIprFile ${workpath}/${distname}/${DIR_BASE2}/ipr/ipr_file.icl |
---|
165 | patchIprFile ${workpath}/${distname}/${DIR_BASE2}/ipr/ipr_file.c |
---|
166 | |
---|
167 | arrow "Post Patch patches finished" |
---|
168 | } |
---|
169 | |
---|
170 | # |
---|
171 | # Configure phase |
---|
172 | # |
---|
173 | configure {} |
---|
174 | |
---|
175 | # |
---|
176 | # Build phase |
---|
177 | # |
---|
178 | proc create-build-script-section {bs name} { |
---|
179 | |
---|
180 | global SH workpath |
---|
181 | |
---|
182 | puts $bs "cd ${workpath}/${name} > /dev/null 2>&1 || {" |
---|
183 | puts $bs " echo \"E: ${name} does not exist\" 1>&2" |
---|
184 | puts $bs " exit 1" |
---|
185 | puts $bs "}" |
---|
186 | puts $bs "${SH} ./boomake build test install || {" |
---|
187 | puts $bs " echo \"E: Build of ${name} failed\" 1>&2" |
---|
188 | puts $bs " exit 1" |
---|
189 | puts $bs "}" |
---|
190 | } |
---|
191 | |
---|
192 | proc create-build-script {} { |
---|
193 | |
---|
194 | global BUILDSCRIPT IBASE DIR_FOREIGN DIR_BASE1 DIR_BASE2 DIR_GSL BUILDDEBUG SH |
---|
195 | global workpath distname prefix os.platform portverbose porttrace macports |
---|
196 | |
---|
197 | arrow "Creating build script ${BUILDSCRIPT}" |
---|
198 | set bs [open ${BUILDSCRIPT} w] |
---|
199 | puts $bs "#!${SH}" |
---|
200 | puts $bs "echo \"Executing \$0 in directory \$(pwd)...\"" |
---|
201 | puts $bs "export UTYPE=\"Darwin\"" |
---|
202 | puts $bs "export MAKE=${prefix}/bin/gmake" |
---|
203 | puts $bs "export CC=/usr/bin/gcc" |
---|
204 | puts $bs "export CCNAME=\${CC}" |
---|
205 | puts $bs "export CXX=/usr/bin/g++" |
---|
206 | puts $bs "export CCPLUS=\${CXX}" |
---|
207 | puts $bs "export IBASE=${IBASE}" |
---|
208 | puts $bs "export PATH=\${IBASE}\bin:\${PATH}" |
---|
209 | puts $bs "export PATH=\${IBASE}:\${PATH}" |
---|
210 | puts $bs "export PATH=${workpath}/${DIR_FOREIGN}/_install/bin:\${PATH}" |
---|
211 | puts $bs "export BUILDDEBUG=\"[option BUILDDEBUG]\"" |
---|
212 | if {[tbool BUILDDEBUG]} { |
---|
213 | puts $bs "export BOOM_MODEL=\"mt,debug\"" |
---|
214 | } else { |
---|
215 | puts $bs "export BOOM_MODEL=\"mt,release\"" |
---|
216 | } |
---|
217 | puts $bs "export BOOM_MODEL_MT=1" |
---|
218 | puts $bs "export BOOM_SUPPORTS_MT=1" |
---|
219 | puts $bs "export BOOM_TRACE=1" |
---|
220 | puts $bs "export INCDIR=\${IBASE}/include" |
---|
221 | puts $bs "export LIBDIR=\${IBASE}/lib" |
---|
222 | puts $bs "export STDLIBS=\"-lm\"" |
---|
223 | puts $bs "export STDLIBS=\"\${STDLIBS} -lapr-1\"" |
---|
224 | puts $bs "export STDLIBS=\"\${STDLIBS} -laprutil-1\"" |
---|
225 | puts $bs "export STDLIBS=\"\${STDLIBS} -lpcre\"" |
---|
226 | puts $bs "export STDLIBS=\"\${STDLIBS} -L/opt/local/lib\"" |
---|
227 | puts $bs "export CCOPTS=\"-I/opt/local/include\"" |
---|
228 | puts $bs "export CCOPTS=\"\${CCOPTS} -I/opt/local/include/apr-1\"" |
---|
229 | puts $bs "export CCOPTS=\"\${CCOPTS} -Wall\"" |
---|
230 | puts $bs "export CCOPTS=\"\${CCOPTS} -pthread\"" |
---|
231 | puts $bs "export CCOPTS=\"\${CCOPTS} -D_REENTRANT\"" |
---|
232 | puts $bs "export CCOPTS=\"\${CCOPTS} -DICL_MEM_DEFAULT_DIRECT\"" |
---|
233 | puts $bs "export CCOPTS=\"\${CCOPTS} -D_GNU_SOURCE\"" |
---|
234 | puts $bs "export CCOPTS=\"\${CCOPTS} -D_LARGEFILE64_SOURCE\"" |
---|
235 | if {[string compare "${os.platform}" "darwin"] == 0} { |
---|
236 | puts $bs "export CCOPTS=\"\${CCOPTS} -D__Darwin__\"" |
---|
237 | } else { |
---|
238 | if {[string compare "${os.platform}" "freebsd"] == 0} { |
---|
239 | puts $bs "export CCOPTS=\"\${CCOPTS} -D__FreeBSD__\"" |
---|
240 | } else { |
---|
241 | ui_error "Unknown platform ${os.platform}" |
---|
242 | } |
---|
243 | } |
---|
244 | if {[tbool BUILDDEBUG]} { |
---|
245 | puts $bs "export CCDEBUG=\"-O\"" |
---|
246 | } else { |
---|
247 | puts $bs "export CCNODEBUG=\"-O2\"" |
---|
248 | } |
---|
249 | puts $bs "export LINKTYPE=after" |
---|
250 | if {! [tbool portverbose]} { |
---|
251 | puts $bs "export QUIET=yes" |
---|
252 | } else { |
---|
253 | puts $bs "export QUIET=no" |
---|
254 | } |
---|
255 | # |
---|
256 | # Since there seems no way to know if the -d option was given on the |
---|
257 | # port command line, we set VERBOSE to [option portverbose] although it |
---|
258 | # would be better if [option portdebug] would work. |
---|
259 | # |
---|
260 | puts $bs "export VERBOSE=[option portverbose]" |
---|
261 | |
---|
262 | # |
---|
263 | # The apr and pcre components in the foreignX directory are not used, we |
---|
264 | # simply install the apr & pcre ports. Some other foreign components are |
---|
265 | # still used, like "minizip"... |
---|
266 | # |
---|
267 | create-build-script-section $bs ${DIR_FOREIGN} |
---|
268 | create-build-script-section $bs ${DIR_BASE1} |
---|
269 | create-build-script-section $bs ${DIR_GSL} |
---|
270 | create-build-script-section $bs ${DIR_BASE2} |
---|
271 | create-build-script-section $bs ${distname} |
---|
272 | close $bs |
---|
273 | if {[tbool portverbose]} { |
---|
274 | arrow "Created build script:" |
---|
275 | system "cat ${BUILDSCRIPT}" |
---|
276 | } |
---|
277 | } |
---|
278 | |
---|
279 | proc execute-build-script {} { |
---|
280 | |
---|
281 | global BUILDSCRIPT SH |
---|
282 | |
---|
283 | arrow "Executing build script... ${BUILDSCRIPT}" |
---|
284 | set rc [system "${SH} ${BUILDSCRIPT}"] |
---|
285 | arrow "Executed build script" |
---|
286 | } |
---|
287 | |
---|
288 | pre-build { |
---|
289 | create-build-script |
---|
290 | } |
---|
291 | |
---|
292 | build { |
---|
293 | execute-build-script |
---|
294 | } |
---|
295 | |
---|
296 | # |
---|
297 | # Destroot phase |
---|
298 | # |
---|
299 | destroot.clean "yes" |
---|
300 | |
---|
301 | destroot { |
---|
302 | |
---|
303 | global IBASE |
---|
304 | |
---|
305 | set cp "cp -R" |
---|
306 | set mv "mv -v" |
---|
307 | set targetIBASE "${prefix}/share/${name}" |
---|
308 | set optlocalbin "${destroot}${prefix}/bin" |
---|
309 | set optlocaldoc "${destroot}${prefix}/share/doc/${name}" |
---|
310 | set optlocalinc "${destroot}${prefix}/include/${name}" |
---|
311 | set optlocallib "${destroot}${prefix}/lib/${name}" |
---|
312 | |
---|
313 | xinstall -m 755 -d ${destroot}${targetIBASE} |
---|
314 | |
---|
315 | ui_info "Copying all ${name} files into ${destroot}${targetIBASE}" |
---|
316 | system "${cp} ${IBASE}/ ${destroot}${targetIBASE}" |
---|
317 | |
---|
318 | ui_info "Creating links to the files in ${targetIBASE}" |
---|
319 | |
---|
320 | ui_debug "link to amq_client" |
---|
321 | ln -fs ${targetIBASE}/bin/amq_client ${optlocalbin} |
---|
322 | ui_debug "link to amq_server" |
---|
323 | ln -fs ${targetIBASE}/bin/amq_server ${optlocalbin} |
---|
324 | ui_debug "link to amq_shell" |
---|
325 | ln -fs ${targetIBASE}/bin/amq_shell ${optlocalbin} |
---|
326 | ui_debug "link to doc" |
---|
327 | ln -fs ${targetIBASE}/include ${optlocalinc} |
---|
328 | ui_debug "link to include" |
---|
329 | ln -fs ${targetIBASE}/include ${optlocalinc} |
---|
330 | ui_debug "link to lib" |
---|
331 | ln -fs ${targetIBASE}/lib ${optlocallib} |
---|
332 | |
---|
333 | xinstall -d ${destroot}${LOG_PATH}/archive |
---|
334 | touch ${destroot}${LOG_PATH}/archive/keepthis |
---|
335 | |
---|
336 | ui_info "Copying default configuration file to ${prefix}/etc" |
---|
337 | xinstall -m 644 \ |
---|
338 | ${IBASE}/bin/amq_server_base.cfg \ |
---|
339 | ${destroot}${prefix}/etc |
---|
340 | |
---|
341 | arrow "${distname} is installed in destroot ${destroot}!" |
---|
342 | } |
---|
343 | |
---|
344 | # |
---|
345 | # Test phase |
---|
346 | # |
---|
347 | test { |
---|
348 | # |
---|
349 | # We do not have to test since the OpenAMQ build scripts already |
---|
350 | # performed all tests. If it builds, it works. |
---|
351 | # |
---|
352 | } |
---|