summaryrefslogtreecommitdiff
path: root/www/mod_ruby/Makefile
blob: 70c11deffdd29b41e278f518643301e22d927e8f (plain) (blame)
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
# Created by: Akinori MUSHA aka knu <knu@idaemons.org>
# $FreeBSD$

PORTNAME=	mod_ruby
PORTVERSION=	1.3.0
PORTREVISION=	3
CATEGORIES=	www ruby
MASTER_SITES=	ftp://ftp.dinoex.de/pub/FreeBSD/distfiles/
PKGNAMEPREFIX=	${APACHE_PKGNAMEPREFIX}
DIST_SUBDIR=	ruby

MAINTAINER=	dinoex@FreeBSD.org
COMMENT=	An Apache module that embeds Ruby interpreter within

MAKE_JOBS_SAFE=  yes

USE_APACHE=	22
USE_RUBY=	yes
USE_PERL5_BUILD=	yes

CONFIGURE_ARGS=	--with-apxs="${APXS}"
CFLAGS+=	-DONIG_ESCAPE_REGEX_T_COLLISION
MAKE_ARGS=	RUBY="${RUBY}"
INSTALL_TARGET=	site-install

RUBY_RD_FILES=	# empty

DOCS_EN=	COPYING ChangeLog LEGAL LICENSE.apreq NOTICE \
		README.en doc/default.css doc/*.en.*
DOCS_JA=	README.ja doc/default.css doc/*.ja.*

.include <bsd.port.pre.mk>

.if ${APACHE_VERSION} > 20
CONFIGURE_ARGS+=	--with-apr-includes="`${LOCALBASE}/bin/apr-1-config --includedir`"
.endif

do-configure:
	@cd ${WRKSRC}; ${SETENV} ${CONFIGURE_ENV} ${RUBY} ${RUBY_FLAGS} configure.rb ${CONFIGURE_ARGS}
.if !defined(WITHOUT_PTHREADS) && defined(WITH_PTHREADS)
# dirty hack to force mod_ruby.so linked with lpthread.so, otherwise unresolved
# symbols happen
	@${REINPLACE_CMD} -e 's|-pthread|-pthread -lpthread|' ${WRKSRC}/Makefile

PKGNAMESUFFIX=	-pthreads
.endif

post-install: doc-install
	${INSTALL_DATA} ${WRKSRC}/examples/httpd.conf `${APXS} -q SYSCONFDIR`/httpd.conf.${PORTNAME}
# Would be nice if we could use PLIST_SUB here..
	${REINPLACE_CMD} \
		-e 's,%%LIBEXECDIR%%,'`${APXS} -q LIBEXECDIR | ${SED} 's:${LOCALBASE}/::'`',g;' \
		-e 's,%%SYSCONFDIR%%,'`${APXS} -q SYSCONFDIR | ${SED} 's:${LOCALBASE}/::'`',g;' \
		${TMPPLIST}

doc-install:
.if !defined(NOPORTDOCS)
.if !defined(RUBY_NO_RD_HTML)
	cd ${WRKSRC}/doc; ${MAKE}
.endif
	${MKDIR} ${RUBY_MODDOCDIR}/ja
.for f in ${DOCS_EN}
	${INSTALL_DATA} ${WRKSRC}/${f} ${RUBY_MODDOCDIR}/
.endfor
.for f in ${DOCS_JA}
	${INSTALL_DATA} ${WRKSRC}/${f} ${RUBY_MODDOCDIR}/ja/
.endfor
.endif
	@${CAT} ${PKGMESSAGE}

.include <bsd.port.post.mk>