blob: b29355fb5836de788f65888910679d8eff50b470 (
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
|
# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
#
# secfixes:
# 3.1.2-r0:
# - CVE-2022-28738
# - CVE-2022-28739
# 3.0.3-r0:
# - CVE-2021-41817
# - CVE-2021-41816
# - CVE-2021-41819
# 2.7.4-r0:
# - CVE-2021-31799
# - CVE-2021-31810
# - CVE-2021-32066
# 2.7.3-r0:
# - CVE-2021-28965
# - CVE-2021-28966
# 2.7.2-r0:
# - CVE-2020-25613
# 2.6.6-r0:
# - CVE-2020-10663
# - CVE-2020-10933
# 2.6.5-r0:
# - CVE-2019-16255
# - CVE-2019-16254
# - CVE-2019-15845
# - CVE-2019-16201
# 2.5.2-r0:
# - CVE-2018-16395
# - CVE-2018-16396
# 2.5.1-r0:
# - CVE-2017-17742
# - CVE-2018-6914
# - CVE-2018-8777
# - CVE-2018-8778
# - CVE-2018-8779
# - CVE-2018-8780
# 2.4.2-r0:
# - CVE-2017-0898
# - CVE-2017-10784
# - CVE-2017-14033
# - CVE-2017-14064
# - CVE-2017-0899
# - CVE-2017-0900
# - CVE-2017-0901
# - CVE-2017-0902
# 2.4.3-r0:
# - CVE-2017-17405
#
pkgname=ruby
# When upgrading, upgrade also each ruby-<name> aport listed in file
# gems/bundled_gems. If some aport is missing or not in the main repo,
# create/move it.
pkgver=3.1.2
_abiver="${pkgver%.*}.0"
pkgrel=1
pkgdesc="An object-oriented language for quick and easy programming"
url="https://www.ruby-lang.org/"
arch="all"
license="Ruby AND BSD-2-Clause AND MIT"
depends="ca-certificates"
depends_dev="
$pkgname=$pkgver-r$pkgrel
$pkgname-rdoc=$pkgver-r$pkgrel
gmp-dev
libucontext-dev
"
makedepends="$depends_dev
autoconf
gdbm-dev
libffi-dev
linux-headers
openssl-dev>3
readline-dev
yaml-dev
zlib-dev
"
install="$pkgname.post-upgrade"
subpackages="$pkgname-dbg $pkgname-doc $pkgname-dev
$pkgname-rdoc::noarch
$pkgname-libs
$pkgname-full::noarch
"
source="https://cache.ruby-lang.org/pub/ruby/${pkgver%.*}/ruby-$pkgver.tar.gz
test_insns-lower-recursion-depth.patch
fix-get_main_stack.patch
dont-install-bundled-gems.patch
fix-riscv64-build.patch
"
replaces="ruby-gems"
# For backward compatibility (pre 3.x).
for _i in bigdecimal etc fiddle gdbm io-console irb json; do
provides="$provides ruby-$_i=$pkgver-r$pkgrel"
done
_gemdir="/usr/lib/ruby/gems/$_abiver"
_rubydir="/usr/lib/ruby/$_abiver"
_chost="${CHOST/-alpine-/-}"
case "$CARCH" in
x86) _arch="i386";;
*) _arch="$CARCH";;
esac
prepare() {
default_prepare
autoconf
# v2.7.1 - Of all the bootstraptest only test_fiber fails on s390x:
# test_fiber.rb bootstraptest.tmp.rb:8: [BUG] vm_call_cfunc: cfp consistency error (0x000003ffb63fefb0, 0x000003ffb42f5f58)
case "$CARCH" in
s390x) rm bootstraptest/test_fiber.rb;;
esac
local name ver; while read -r name ver _; do
case "$name=$ver" in
[a-z]*=[0-9]*.[0-9]*)
if ! apk add -qs "ruby-$name>=$ver" >/dev/null 2>&1; then
warning "bump package ruby-$name to version $ver"
fi
echo "ruby-$name>=$ver" >> "$srcdir"/.ruby-full.depends
esac
done < "$builddir"/gems/bundled_gems
}
build() {
# -fomit-frame-pointer makes ruby segfault, see gentoo bug #150413
# In many places aliasing rules are broken; play it safe
# as it's risky with newer compilers to leave it as it is.
# -O2 - ruby is a language runtime, so performance is crucial. Moreover,
# ruby 3.1.1 fails with Bus Error when compiled with -Os on armhf/armv7.
# This makes ruby-libs 7% bigger (13.4 -> 14.4 MiB).
export CFLAGS="${CFLAGS/-Os/-O2} -fno-omit-frame-pointer -fno-strict-aliasing"
export CPPFLAGS="${CPPFLAGS/-Os/-O2} -fno-omit-frame-pointer -fno-strict-aliasing"
# Needed for coroutine stuff
export LIBS="-lucontext"
# ruby saves path to install. we want use $PATH
export INSTALL=install
# the configure script does not detect isnan/isinf as macros
export ac_cv_func_isnan=yes
export ac_cv_func_isinf=yes
./configure \
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--with-sitedir=/usr/local/lib/site_ruby \
--with-search-path="/usr/lib/site_ruby/\$(ruby_ver)/$_arch-linux" \
--enable-pthread \
--disable-rpath \
--enable-shared \
--with-mantype=man
make
}
check() {
# https://bugs.ruby-lang.org/issues/18380
local disable_tests="-n !/TestAddressResolve#test_socket_getnameinfo_domain_blocking/"
case "$CARCH" in
x86 | armhf | armv7)
# TestReadline#test_interrupt_in_other_thread fails on 32 bit arches according
# to upstream, but the test is disabled just on Travis, not in test suite.
# https://bugs.ruby-lang.org/issues/18393
disable_tests="$disable_tests -n !/TestReadline#test_interrupt_in_other_thread/"
;;
esac
make test TESTS="$disable_tests"
}
package() {
make DESTDIR="$pkgdir" SUDO="" install
install -m 644 -D COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
cd "$pkgdir"
# Remove bundled gem bundler; it's provided by a separate aport/package
# ruby-bundler.
rm -rf ./$_rubydir/bundler
rm ./$_rubydir/bundler.rb
rm -rf ./$_gemdir/gems/bundler-*
rm ./$_gemdir/specifications/default/bundler-*.gemspec
rm usr/bin/bundle usr/bin/bundler
# Remove bundled CA certificates; they are provided by ca-certificates.
rm ./$_rubydir/rubygems/ssl_certs/*/*.pem
rmdir ./$_rubydir/rubygems/ssl_certs/* || true
rm -Rf ./$_gemdir/cache/*
if [ -d usr/local ]; then
local f=$(find usr/local -type f)
if [ -n "$f" ]; then
error "Found files in /usr/local:"
echo "$f"
return 1
fi
rm -r usr/local
fi
}
rdoc() {
pkgdesc="Ruby documentation tool"
license="Ruby"
depends="$pkgname"
amove $_rubydir/rdoc
amove $_gemdir/gems/rdoc-*
amove $_gemdir/specifications/default/rdoc-*
amove usr/bin/ri
amove usr/bin/rdoc
}
libs() {
pkgdesc="Libraries necessary to run Ruby"
depends=""
amove usr/lib
}
full() {
pkgdesc="Ruby with all bundled gems"
# bundler is bundled since Ruby 2.6, so include it in ruby-full despite
# that it's provided by a seprate aport/package.
depends="ruby ruby-rdoc ruby-bundler $(cat "$srcdir"/.ruby-full.depends)"
mkdir -p "$subpkgdir"
}
sha512sums="
9155d1150398eaea7c9954af61ecf8dfdb885cfcf63a67bbcf6c92e282cd3ccac0ff9234d039286a9623297b65197441438c37f707e31d270ce2fe11e8f38a44 ruby-3.1.2.tar.gz
16fc1f35aee327d1ecac420b091beaa53c675e0504d5a6932004f17ca68a2c38f57b053b0a3903696f2232c5add160d363e3972a962f7f7bcb52e4e998c7315d test_insns-lower-recursion-depth.patch
c1bc0c98fa90cba5d626a836de5e9504770bd56e5772eed2c3eb8337761a55fa71225d14ed7c3ff4191866a386174d151e95fa05a19b10165a179bbc736176e9 fix-get_main_stack.patch
facf2adaf25e1781cbe280b42430ca0cc61e7cdacbfcf1e1c7df1b4acb4bc70c444d79b95d6d0596a94dfa67d51ced342b6dc2ff20ac28977ca715154cc53fa5 dont-install-bundled-gems.patch
000530316af1fca007fe8cee694b59e2e801674bcc1a2ebea95e67745d4afc0ce66c902fdbc88ee847a4fbf55115b183cd803cbf7c98ef685938efb3e2b7c991 fix-riscv64-build.patch
"
|