summaryrefslogtreecommitdiffstats
path: root/lang/ruby16_static/Makefile
blob: 316229eb7c5ea84c6b739cd0727a49d91738e4f7 (plain)
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# New ports collection makefile for:	ruby_static
# Date created:			19 February 2001
# Whom:				Akinori MUSHA aka knu <knu@idaemons.org>
#
# $FreeBSD$
#

PORTNAME=	ruby_static
PORTVERSION=	${RUBY_PORTVERSION}
PORTREVISION?= 1
CATEGORIES=	lang ruby ipv6
MASTER_SITES=	# none
DISTFILES=	# none

MAINTAINER=	knu@FreeBSD.org

BUILD_DEPENDS=	${NONEXISTENT}:${.CURDIR}/../../${RUBY_PORT}:patch

USE_RUBY=	yes

.include <bsd.port.pre.mk>

# Beware, because gdbm is under GPL, you must treat the whole binary
# as GPL says if you include gdbm in it.
EXT_PORTS=	archivers/ruby-zlib \
		databases/ruby-bdb1
_PORTSDIR=	${.CURDIR}/../..
_RUBY_PORTDIR=	${_PORTSDIR}/${RUBY_PORT}

LIB_DEPENDS+=	iconv.3:${PORTSDIR}/converters/libiconv

.if ${RUBY_VER} < 1.7
EXT_PORTS+=	${RUBY_SHIM18_PORT}
.else
EXT_PORTS+=	converters/ruby-iconv
.endif

.for p in ${EXT_PORTS}
BUILD_DEPENDS+=	${NONEXISTENT}:${_PORTSDIR}/${p}:patch
.endfor

.if defined(RUBY_VER)
.if ${RUBY_VER} > 1.6
NEWAUTOCONF=	yes
.endif
.endif

.if defined(NEWAUTOCONF)
BUILD_DEPENDS+=	autoconf:${PORTSDIR}/devel/autoconf
GNU_CONFIGURE=	yes
.else
USE_AUTOCONF=	yes
.endif

WRKSRC=		${RUBY_WRKSRC}

DESCR=		${_RUBY_PORTDIR}/pkg-descr

# You can build a totally statically linked binary by defining STATIC,
# although it is not capable of loading dynamic modules.

CONFIGURE_ENV=	XLDFLAGS="-L${LOCALBASE}/lib"
CONFIGURE_ARGS!=	cd ${_RUBY_PORTDIR} && ${MAKE} -V CONFIGURE_ARGS
.if defined(STATIC)
CONFIGURE_ARGS:=	${CONFIGURE_ARGS:N--enable-shared:M-*} \
			--with-static-linked-ext=yes \
			--with-opt-dir="${LOCALBASE}"
.else
CONFIGURE_ARGS:=	${CONFIGURE_ARGS:M-*} \
			--with-opt-dir="${LOCALBASE}"
.endif

MAKE_ENV=	LANG=C	# prevent bison 1.33 w/ gettext 0.10.35 from coredumping
MAKE_ARGS=	-j3

.if ${RUBY_VER} == ${RUBY_DEFAULT_VER}
IF_DEFAULT=	""
.else
IF_DEFAULT=	"@comment "
.endif

PLIST_SUB+=	IF_DEFAULT=${IF_DEFAULT}

do-fetch:
	@${DO_NADA}

.if defined(STATIC)
post-patch:
	${RUBY} -i -pe 'gsub /-rdynamic/, "-static"' ${WRKSRC}/configure.in
.endif

do-extract:
	${MKDIR} ${WRKDIR}
	${LN} -sf `cd ${_RUBY_PORTDIR} && ${MAKE} -V WRKSRC` ${WRKSRC}
.for p in ${EXT_PORTS}
	wrksrc=$$(cd ${_PORTSDIR}/${p} && ${MAKE} -V WRKSRC) ; \
	${FIND} -L $$wrksrc -name extconf.rb | \
	${XARGS} ${GREP} -l create_makefile | \
	while read extdir; do \
		extdir=$${extdir%/extconf.rb}; \
		case "$p" in \
		${RUBY_SHIM18_PORT) \
			m=$$(basename $$extdir); \
			case $$extdir in \
			*/racc/*) \
				${MKDIR} ${WRKSRC}/ext/racc; \
				m=racc/$${m} ;; \
			*/ext/features/ruby18/*) \
				${MKDIR} ${WRKSRC}/ext/features/ruby18; \
				m=features/ruby18/$${m}_ruby18 ;; \
			esac ;; \
		*) \
			m="${p:T:S,^ruby-,,}" ;; \
		esac; \
		${CP} -RPp $$extdir ${WRKSRC}/ext/$$m; \
		${TOUCH} ${WRKSRC}/ext/$$m/MANIFEST; \
	done
.endfor
.if defined(STATIC)
	${ECHO_CMD} "option nodynamic" > ${WRKSRC}/ext/Setup
.else
	${ECHO_CMD} "#option nodynamic" > ${WRKSRC}/ext/Setup
.endif
	cd ${WRKSRC}/ext; ${FIND} * -name extconf.rb | \
	${XARGS} ${GREP} -l create_makefile | \
	while read extdir; do \
		extdir=$${extdir%/extconf.rb}; \
		echo $$extdir; \
	done >> Setup

.if defined(NEWAUTOCONF)
pre-configure:
	cd ${WRKSRC}; autoconf
.endif

do-install:
	${INSTALL_PROGRAM} ${WRKSRC}/${RUBY_NAME} ${RUBY_WITH_SUFFIX}_s
.if ${RUBY_VER} == ${RUBY_DEFAULT_VER}
	${LN} -fs ruby${_RUBY_SUFFIX}_s ${RUBY_WITHOUT_SUFFIX}_s
.endif

.include <bsd.port.post.mk>
OpenPOWER on IntegriCloud