/
Portfile
229 lines (194 loc) · 8.18 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
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
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup select 1.0
PortGroup openssl 1.0
PortGroup compiler_blacklist_versions 1.0
name ruby30
version 3.0.7
revision 0
categories lang ruby
maintainers {kimuraw @kimuraw} \
{fwright.net:fw @fhgwright} \
openmaintainer
platforms darwin
description Powerful and clean object-oriented scripting language
long_description Ruby is the interpreted scripting language for quick \
and easy object-oriented programming. It has many \
features to process text files and to do system \
management tasks (as in Perl). It is simple, \
straight-forward, extensible, and portable.
homepage https://www.ruby-lang.org/
license {Ruby BSD}
master_sites ruby:3.0
distname ruby-${version}
dist_subdir ruby30
checksums md5 147a3467facc704b5d479e809c131603 \
rmd160 93e4f030084b88330767bb8643ae1a4fe7ac618c \
sha1 ec95aee1364fc4d0ca0e8f83c525127016e05c86 \
sha256 2a3411977f2850431136b0fab8ad53af09fb74df2ee2f4fb7f11b378fe034388 \
size 21268288
# ruby/openssl does not support openssl-3
openssl.branch 1.1
depends_lib port:readline \
port:zlib \
port:libyaml \
port:libffi \
port:gdbm
depends_run port:ruby_select
depends_build port:pkgconfig port:cctools
depends_skip_archcheck pkgconfig
select.group ruby
select.file ${filespath}/ruby30
# Patches derived from MacPorts-enhanced GitHub fork at
# github.com/fhgwright/ruby
# patch-sources.diff: fixes for various issues.
# This includes the 'gem' versioning fix formerly handled via reinplace.
#
# This diff is from v3_0_7 vs. macports-3_0_7.
#
patchfiles-append patch-sources.diff
# patch-generated.diff: additional patches to generated files, which don't
# exist in the upstream git sources, and which must be patched after the
# source patches so that make doesn't regard them as outdated.
# At present, the only patched generated file is 'configure', to avoid
# the need to rerun autoconf, whose output has reproducibility issues.
#
# This diff is from tarball-3_0_7 vs. macports-tarball-3_0_7.
#
patchfiles-append patch-generated.diff
#-------------------------------------------------------------------------------
# Fix compilation on buildbots for 10.12 and earlier.
# Issue: 62183: error: use of undeclared identifier 'fmt'; did you mean 'fma'?
#
# This issue only appears in Xcode clang 9 (clang 900), not MacPorts clang 9
# (clang 901), so the blacklisting can be narrow.
#-------------------------------------------------------------------------------
compiler.blacklist-append \
{ clang >= 900 < 901 }
compiler.thread_local_storage yes
# At least one version of clang doesn't offer cstdbool (introduced in C++11)
# with -stdlib=libstc++ but still reports as C++14. This causes an include
# failure in include/ruby/internal/stdbool.h when built as C++. Setting the
# standard to C++03 removes the expectation that cstdbool is available.
#
# This has only been observed when building for 10.5, and in fact, ruby
# makes very little use of C++, and would probably be fine if this were
# unconditional. Nevertheless, we limit it to the failing case.
#
if {[string match *clang* ${configure.compiler}] \
&& ${configure.cxx_stdlib} eq "libstdc++"} {
configure.cxxflags-append -std=c++03
}
configure.args --enable-shared \
--enable-install-static-library \
--disable-install-doc \
--mandir="${prefix}/share/man" \
--enable-pthread \
--without-gmp \
--with-opt-dir="${prefix}" \
--program-suffix=3.0 \
--with-rubylibprefix="${prefix}/lib/ruby3.0" \
--with-openssl-dir=[openssl::install_area] \
--without-baseruby
# prefer Apple cctools to GNU binutils, build with binutils may fail.
configure.args-append AR=${prefix}/bin/ar RANLIB=${prefix}/bin/ranlib
# [NOTE] workaround for mismatch of sdk versions on macOS 11.x,
# such as MacOSX11.0.sdk (buildbot) <=> MacOSX11.1.sdk (user's Mac).
#
# see ruby27/Portfile
post-build {
if {${os.major} >= 20} {
# ruby saves its compile options (CFLAGS, LDFLAGS, ..) in "rbconfig.rb"
# at build, and uses the options when compiling binary extensions.
# rewrite MacOSX11.1.sdk -> MacOSX.sdk in rbconfig.rb
file copy ${worksrcpath}/rbconfig.rb ${worksrcpath}/rbconfig.rb.orig
reinplace -E -q {s|(/MacOSX)[0-9\.]+(\.sdk[\'\"]?[[:blank:]])|\1\2|g} \
${worksrcpath}/rbconfig.rb \
${worksrcpath}/ruby-3.0.pc
reinplace -E -q {s|(/MacOSX)[0-9\.]+(\.sdk[\'\"]?)$|\1\2|g} \
${worksrcpath}/rbconfig.rb \
${worksrcpath}/ruby-3.0.pc
}
}
# Add the architecture flag as required
if {[info exists build_arch] && ${build_arch} != ""} {
configure.args-append "--with-arch=${build_arch}"
}
post-patch {
# Ensure that generated files have clearly later mtimes than sources,
# to avoid gratuitous rebuilds by make.
# This is already nominally true based on the patching order, but
# one-second resolution on timestamps may cover it up.
#
# The list of files here should match the list of files patched by
# patch-generated.diff.
#
# Increment the mtime(s) by one second.
foreach genfile [list configure] {
set genfull ${worksrcpath}/${genfile}
file mtime ${genfull} [expr [file mtime ${genfull}] + 1]
}
}
post-destroot {
foreach type {site vendor} {
set libdir ${destroot}${prefix}/lib/ruby3.0/${type}_ruby/3.0.0
xinstall -m 0755 -d ${libdir}
foreach subdir [exec find ${libdir} -type d -empty] {
destroot.keepdirs-append ${subdir}
}
}
# install destination of commands from port:rb30-*
xinstall -m 0755 -d ${destroot}${prefix}/libexec/ruby3.0
destroot.keepdirs-append ${destroot}${prefix}/libexec/ruby3.0
}
notes-append "
To make this the default Ruby (i.e., the version run by\
the 'ruby', 'gem' or 'bundle' commands), run:
sudo port select --set ruby $name
"
variant doc description "Install rdoc indexes and C API documents" {
configure.args-delete --disable-install-doc
}
variant gmp description "use gmp" {
configure.args-delete --without-gmp
depends_lib-append port:gmp
}
variant jemalloc description "use jemalloc" {
configure.args-delete --without-jemalloc
configure.args-append --with-jemalloc
depends_lib-append port:jemalloc
}
variant universal {
# (Copied from ruby27)
# Disable parallel builds for Universal case
# See: https://trac.macports.org/ticket/24240
use_parallel_build no
# use ruby built-in universal mechanism.
configure.args-append --with-arch=[join ${universal_archs} ,]
# clear macports' universal flags
configure.universal_cflags
configure.universal_cppflags
configure.universal_cxxflags
configure.universal_ldflags
}
variant relative description "Enable relative loading of libraries to allow for relocation of binaries." {
#enable relative loading
configure.args-append --enable-load-relative
}
# legacy systems support
platform darwin {
if {${os.major} < 11} {
depends_build-append port:gmake
build.cmd ${prefix}/bin/gmake
configure.args-append --disable-dtrace
configure.cflags-append -std=c99
}
if {${os.major} == 8} {
configure.cppflags-append -DCPU_SUBTYPE_MASK=0xff000000
}
}
test.run yes
test.target check
livecheck.type regex
livecheck.url https://cache.ruby-lang.org/pub/ruby/3.0/
livecheck.regex ruby-(3\\.0\\.\\d+)[quotemeta ${extract.suffix}]