blob: 261849ff0fe88f8872e1ef7f08295bbdcb34c122 (
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
|
# $NetBSD: Makefile.common,v 1.10 2002/12/07 02:38:58 schmonz Exp $
# FreeBSD: ports/Mk/bsd.ruby.mk,v 1.11 2000/11/16 17:59:40 knu Exp
# Makefile.common: ruby common makefile, based on FreeBSD's bsd.ruby.mk.
#
# [variables that each package can define]
#
# RUBY_PKGNAMEPREFIX - Common PKGNAMEPREFIX for ruby packages.
# (default: ruby${RUBY_SUFFIX}-)
# RUBY_VER - Set to the alternative short version of ruby in the
# form of `x.y' (see below for current value).
# RUBY_REQD - Set to required version of ruby in the form of
# `x.y.z'.
# USE_RUBY - Says that the package uses ruby for building and
# running.
# RUBY_BUILD_DEPENDS - Says that the package should build-depend on ruby.
# RUBY_DEPENDS - Says that the package should depend on ruby.
# USE_RUBY_EXTCONF - Says that the package uses extconf.rb to configure.
# Implies USE_RUBY.
# RUBY_EXTCONF - Set to the alternative name of extconf.rb (default:
# extconf.rb).
# RUBY_EXTCONF_SUBDIRS - Set to list of subdirectories, if multiple modules
# are included.
# USE_RUBY_SETUP - Says that the package uses setup.rb to configure and
# build. Implies USE_RUBY_AMSTD.
# RUBY_SETUP - Set to the alternative name of setup.rb (default:
# setup.rb).
# REPLACE_RUBY - Specify the files whose first line be replaced.
#
# [variables that each package should not define]
#
# RUBY - Full path of ruby executable.
# RUBY_ARCH - Directory name of architecture dependent libraries.
# RUBY_NAME - Ruby's name with trailing suffix.
# RUBY_VERSION - Full version of ruby without preview/beta suffix in
# the form of `x.y.z' (see below for current value).
# RUBY_SUFFIX - Suffix for ruby binaries and directories.
# _RUBY_SUFFIX - String to be used as RUBY_SUFFIX. Always
# ${RUBY_VER:S/.//}.
# RUBY_DISTNAME - DISTNAME for the standard ruby ports, i.e. the
# basename of the ruby distribution tarball.
# RUBY_WRKSRC - WRKSRC for the ruby package.
# RUBY_DISTINFO - DISTINFO file of base distribution.
# RUBY_SHLIBVER - Major version of libruby (see below for current
# value).
#
# RUBY_LIBDIR - Installation path for architecture independent
# libraries.
# RUBY_ARCHLIBDIR - Installation path for architecture dependent
# libraries.
# RUBY_SITELIBDIR - Installation path for site architecture independent
# libraries.
# RUBY_SITEARCHLIBDIR - Installation path for site architecture dependent
# libraries.
# RUBY_DOCDIR - Installation path for documents.
# RUBY_EXAMPLESDIR - Installation path for examples.
#
.include "../../mk/bsd.prefs.mk"
.ifndef RUBY_COMMON
RUBY_COMMON= # defined
RUBY_VER?= 1.6
RUBY?= ${LOCALBASE}/bin/${RUBY_NAME}
.if ${RUBY_VER} < 1.7
RUBY_VERSION?= 1.6.7
RUBY_SUFFIX?= # empty
.else
RUBY_VERSION?= 1.7 # current, not tested.
RUBY_SUFFIX?= ${_RUBY_SUFFIX}
.endif
RUBY_ARCH?= ${MACHINE_GNU_PLATFORM:S/--/-/}
RUBY_NAME?= ruby${RUBY_SUFFIX}
RUBY_DISTNAME?= ruby-${RUBY_VERSION}
RUBY_WRKSRC?= ${WRKDIR}/${RUBY_DISTNAME}
_RUBY_SUFFIX= ${RUBY_VER:S/.//}
RUBY_PKGNAMEPREFIX?= ruby${RUBY_SUFFIX}- # could be rb${RUBY_SUFFIX}-
RUBY_SHLIBVER?= ${RUBY_VERSION:S/.//}
RUBY_SHLIBMAJOR?= ${_RUBY_SUFFIX}
#CONFIGURE_TARGET?= ${RUBY_ARCH}
# Directories
RUBY_LIBDIR?= ${LOCALBASE}/lib/ruby/${RUBY_VER}
RUBY_ARCHLIBDIR?= ${RUBY_LIBDIR}/${RUBY_ARCH}
RUBY_SITELIBDIR?= ${LOCALBASE}/lib/ruby/site_ruby/${RUBY_VER}
RUBY_SITEARCHLIBDIR?= ${RUBY_SITELIBDIR}/${RUBY_ARCH}
RUBY_DOCDIR?= ${LOCALBASE}/share/doc/${RUBY_NAME}
RUBY_EXAMPLESDIR?= ${LOCALBASE}/share/examples/${RUBY_NAME}
# MAKE_ENV
MAKEFLAGS+= RUBY_VER=${RUBY_VER}
# PLIST
PLIST_RUBY_DIRS= RUBY_LIBDIR="${RUBY_LIBDIR}" \
RUBY_ARCHLIBDIR="${RUBY_ARCHLIBDIR}" \
RUBY_SITELIBDIR="${RUBY_SITELIBDIR}" \
RUBY_SITEARCHLIBDIR="${RUBY_SITEARCHLIBDIR}" \
RUBY_DOCDIR="${RUBY_DOCDIR}" \
RUBY_EXAMPLESDIR="${RUBY_EXAMPLESDIR}"
PLIST_SUBST+= RUBY_VERSION="${RUBY_VERSION}" \
RUBY_VER="${RUBY_VER}" \
RUBY_SHLIBVER="${RUBY_SHLIBVER}" \
RUBY_SHLIBMAJOR="${RUBY_SHLIBMAJOR}" \
RUBY_ARCH="${RUBY_ARCH}" \
_RUBY_SUFFIX="${_RUBY_SUFFIX}" \
RUBY_SUFFIX="${RUBY_SUFFIX}" \
RUBY_NAME="${RUBY_NAME}" \
${PLIST_RUBY_DIRS:S,DIR="${LOCALBASE}/,DIR=",}
# base digest checksum
RUBY_DISTINFO?= ${.CURDIR}/../../lang/ruby${RUBY_SUFFIX}-base/distinfo
# fix shebang lines
.if defined(REPLACE_RUBY) && !empty(REPLACE_RUBY)
pre-configure: replace-ruby
replace-ruby:
@for s in ${REPLACE_RUBY}; do \
case $${s} in \
/*) f=$${s};; \
*) f=${WRKSRC}/$${s};; \
esac; \
${ECHO_MSG} "===> Fixing the #! line of $${s}"; \
${SED} -e '1s| *[a-z0-9_/\.-][a-z0-9_/\.-]*/env *||g' \
-e '1s| *[a-z0-9_/\.-]*ruby|${RUBY}|' $$f > $$f.tmp; \
if ${CMP} -s $$f $$f.tmp; then \
${RM} $$f.tmp; \
else \
${MV} $$f.tmp $$f; \
fi; \
done
.endif
# extconf.rb
.if defined(USE_RUBY_EXTCONF)
USE_RUBY?= yes
RUBY_EXTCONF?= extconf.rb
CONFIGURE_ARGS+= --with-opt-dir="${LOCALBASE}"
do-configure: ruby-extconf-configure
.if defined(RUBY_EXTCONF_SUBDIRS)
ruby-extconf-configure:
.for d in ${RUBY_EXTCONF_SUBDIRS}
@${ECHO_MSG} "===> Running ${RUBY_EXTCONF} in ${d} to configure"
@cd ${WRKSRC}/${d}; \
${SETENV} ${CONFIGURE_ENV} ${RUBY} ${RUBY_EXTCONF} ${CONFIGURE_ARGS}
.endfor
.if !target(do-build)
do-build: ruby-extconf-build
ruby-extconf-build:
.for d in ${RUBY_EXTCONF_SUBDIRS}
@${ECHO_MSG} "===> Building ${d}"
@cd ${WRKSRC}/${d}; ${SETENV} ${MAKE_ENV} ${MAKE} ${ALL_TARGET}
.endfor
.endif
.if !target(do-install)
do-install: ruby-extconf-install
ruby-extconf-install:
.for d in ${RUBY_EXTCONF_SUBDIRS}
@${ECHO_MSG} "===> Installing ${d}"
@cd ${WRKSRC}/${d}; ${SETENV} ${MAKE_ENV} ${MAKE} ${INSTALL_TARGET}
.endfor
.endif
.else
ruby-extconf-configure:
@${ECHO_MSG} "===> Running ${RUBY_EXTCONF} to configure"
@cd ${WRKSRC}; \
${SETENV} ${CONFIGURE_ENV} ${RUBY} ${RUBY_EXTCONF} ${CONFIGURE_ARGS}
.endif
.endif
# setup.rb
.if defined(USE_RUBY_SETUP)
USE_RUBY?= yes
RUBY_SETUP?= setup.rb
.if !target(do-configure)
do-configure: ruby-setup-configure
ruby-setup-configure:
@${ECHO_MSG} "===> Running ${RUBY_SETUP} to configure"
@cd ${WRKSRC}; \
${SETENV} ${CONFIGURE_ENV} ${RUBY} ${RUBY_SETUP} config ${CONFIGURE_ARGS}
.endif
.if !target(do-build)
do-build: ruby-setup-build
ruby-setup-build:
@${ECHO_MSG} "===> Running ${RUBY_SETUP} to build"
@cd ${WRKSRC}; \
${SETENV} ${MAKE_ENV} ${RUBY} ${RUBY_SETUP} setup
.endif
.if !target(do-install)
do-install: ruby-setup-install
ruby-setup-install:
@${ECHO_MSG} "===> Running ${RUBY_SETUP} to ${INSTALL_TARGET}"
cd ${WRKSRC}; \
${SETENV} ${MAKE_ENV} ${RUBY} ${RUBY_SETUP} ${INSTALL_TARGET}
.endif
.endif
# RUBY_REQD
.if defined(RUBY_REQD)
_RUBY_REQD= ${RUBY_REQD:S/.//}
_RUBY_REQMAJOR= ${_RUBY_REQD:C/\.[0-9]+//}
.if ${_RUBY_REQD:M[0-9]*.[0-9]*} == ""
_RUBY_REQMINOR= 0
.else
_RUBY_REQMINOR= ${_RUBY_REQD:C/[0-9]+\.//}
.endif
_RUBY_VERSION= ${RUBY_VERSION:S/.//}
_RUBY_VERMAJOR= ${_RUBY_VERSION:C/\.[0-9]+//}
.if ${_RUBY_VERSION:M[0-9]*.[0-9]*} == ""
_RUBY_VERMINOR= 0
.else
_RUBY_VERMINOR= ${_RUBY_VERSION:C/[0-9]+\.//}
.endif
_RUBY_PROVIDED!= case `expr ${_RUBY_VERMAJOR} ">" ${_RUBY_REQMAJOR}` in \
1) ${ECHO} "ok"; exit 0;; \
esac ; \
case `expr ${_RUBY_VERMAJOR} "=" ${_RUBY_REQMAJOR}` in \
1) case `expr ${_RUBY_VERMINOR} ">=" ${_RUBY_REQMINOR}` in \
1) ${ECHO} "ok"; exit 0;; \
esac ;; \
esac; ${ECHO} "no"
.if ${_RUBY_PROVIDED} == "no"
PKG_FAIL_REASON+= "This package requires ruby ${RUBY_REQD} or later."
.endif
.else
RUBY_REQD?= ${RUBY_VERSION}
.endif
# USE_RUBY
.if defined(USE_RUBY)
RUBY_DEPENDS?= yes
.if ${RUBY_DEPENDS} != "no"
DEPENDS+= ${RUBY_PKGNAMEPREFIX}base>=${RUBY_REQD}:../../lang/ruby${RUBY_SUFFIX}-base
.else
RUBY_BUILD_DEPENDS?= yes
.if ${RUBY_BUILD_DEPENDS} != "no"
BUILD_DEPENDS+= ${RUBY_PKGNAMEPREFIX}base>=${RUBY_REQD}:../../lang/ruby${RUBY_SUFFIX}-base
.endif
.endif
.endif
.if defined(USE_RUBY_AMSTD)
.include "../../devel/ruby-amstd/Makefile.common"
.endif
MASTER_SITE_RUBY?= \
ftp://ftp.ruby-lang.org/pub/ruby/${RUBY_VER}/ \
ftp://ftp.zetabits.com/pub/lang/ruby/${RUBY_VER}/ \
ftp://ftp.fu-berlin.de/unix/languages/ruby/${RUBY_VER}/ \
ftp://ftp.chg.ru/pub/lang/ruby/${RUBY_VER}/ \
ftp://ftp.TokyoNet.AD.JP/pub/misc/ruby/${RUBY_VER}/ \
ftp://ftp.iij.ad.jp/pub/lang/ruby/${RUBY_VER}/ \
ftp://ftp.krnet.ne.jp/pub/ruby/${RUBY_VER}/ \
ftp://ftp.nctu.edu.tw/computer-languages/ruby/${RUBY_VER}/ \
ftp://mirror.nucba.ac.jp/mirror/ruby/${RUBY_VER}/
.endif
|