projects/aports·blob master · refs

241 lines · 6.6 KiB

1# Contributor: Carlo Landmeter <[email protected]>
2# Contributor: Jakub Jirutka <[email protected]>
3# Maintainer: Jakub Jirutka <[email protected]>
4pkgname=ruby
5# When upgrading, upgrade also each ruby-<name> aport listed in file
6# gems/bundled_gems. If some aport is missing or not in the main repo,
7# create/move it.
8pkgver=3.4.10
9_abiver="${pkgver%.*}.0"
10pkgrel=0
11pkgdesc="An object-oriented language for quick and easy programming"
12url="https://www.ruby-lang.org/"
13arch="all"
14license="Ruby AND BSD-2-Clause AND MIT"
15depends="ca-certificates"
16depends_dev="
17 $pkgname=$pkgver-r$pkgrel
18 $pkgname-rdoc=$pkgver-r$pkgrel
19 gmp-dev
20 libucontext-dev
21 "
22makedepends="$depends_dev
23 autoconf
24 cargo
25 gdbm-dev
26 libffi-dev
27 linux-headers
28 openssl-dev>3
29 readline-dev
30 yaml-dev
31 zlib-dev
32 "
33install="$pkgname.post-upgrade"
34subpackages="$pkgname-dbg $pkgname-doc $pkgname-dev
35 $pkgname-rdoc::noarch
36 $pkgname-libs
37 $pkgname-full::noarch
38 "
39source="https://cache.ruby-lang.org/pub/ruby/${pkgver%.*}/ruby-$pkgver.tar.gz
40 fix-get_main_stack.patch
41 dont-install-bundled-gems.patch
42 fix-riscv64-build.patch
43 skip-tests-failing-on-ppc64le.patch
44 "
45
46# secfixes:
47# 3.4.9-r0:
48# - CVE-2026-27820
49# 3.4.7-r0:
50# - CVE-2025-61594
51# 3.3.1-r0:
52# - CVE-2024-27282
53# - CVE-2024-27281
54# - CVE-2024-27280
55# 3.1.4-r0:
56# - CVE-2023-28755
57# - CVE-2023-28756
58# 3.1.3-r0:
59# - CVE-2021-33621
60# 3.1.2-r0:
61# - CVE-2022-28738
62# - CVE-2022-28739
63# 3.0.3-r0:
64# - CVE-2021-41817
65# - CVE-2021-41816
66# - CVE-2021-41819
67# 2.7.4-r0:
68# - CVE-2021-31799
69# - CVE-2021-31810
70# - CVE-2021-32066
71# 2.7.3-r0:
72# - CVE-2021-28965
73# - CVE-2021-28966
74# 2.7.2-r0:
75# - CVE-2020-25613
76# 2.6.6-r0:
77# - CVE-2020-10663
78# - CVE-2020-10933
79# 2.6.5-r0:
80# - CVE-2019-16255
81# - CVE-2019-16254
82# - CVE-2019-15845
83# - CVE-2019-16201
84# 2.5.2-r0:
85# - CVE-2018-16395
86# - CVE-2018-16396
87# 2.5.1-r0:
88# - CVE-2017-17742
89# - CVE-2018-6914
90# - CVE-2018-8777
91# - CVE-2018-8778
92# - CVE-2018-8779
93# - CVE-2018-8780
94# 2.4.2-r0:
95# - CVE-2017-0898
96# - CVE-2017-10784
97# - CVE-2017-14033
98# - CVE-2017-14064
99# - CVE-2017-0899
100# - CVE-2017-0900
101# - CVE-2017-0901
102# - CVE-2017-0902
103# 2.4.3-r0:
104# - CVE-2017-17405
105
106_gemdir="usr/lib/ruby/gems/$_abiver"
107_rubydir="usr/lib/ruby/$_abiver"
108
109prepare() {
110 default_prepare
111 autoconf
112
113 case "$CARCH" in
114 # v2.7.1 - Of all the bootstraptest only test_fiber fails on s390x:
115 # test_fiber.rb bootstraptest.tmp.rb:8: [BUG] vm_call_cfunc: cfp consistency error (0x000003ffb63fefb0, 0x000003ffb42f5f58)
116 # v3.4.3 - and also one assert in test_reactor (FIXME):
117 # bootstraptest.test_ractor.rb_1914_1381.rb:8:in 'block in <main>': uninitialized constant Benchmark (NameError)
118 s390x) rm bootstraptest/test_fiber.rb bootstraptest/test_ractor.rb;;
119
120 # v3.4.3 - One assert in test_reactor (#1287 test_ractor.rb:180) fails (FIXME):
121 # => nil (expected "[:ok, :ok, :ok]")
122 riscv64) rm bootstraptest/test_ractor.rb;;
123 esac
124
125 local name ver; while read -r name ver _; do
126 case "$name=$ver" in
127 [a-z]*=[0-9]*.[0-9]*)
128 if ! apk add -qs "ruby-$name>=$ver" >/dev/null 2>&1; then
129 warning "bump package ruby-$name to version $ver"
130 fi
131 echo "ruby-$name>=$ver" >> "$srcdir"/.ruby-full.depends
132 esac
133 done < "$builddir"/gems/bundled_gems
134}
135
136build() {
137 # -fomit-frame-pointer makes ruby segfault, see gentoo bug #150413
138 # In many places aliasing rules are broken; play it safe
139 # as it's risky with newer compilers to leave it as it is.
140 # -O2 - ruby is a language runtime, so performance is crucial. Moreover,
141 # ruby 3.1.1 fails with Bus Error when compiled with -Os on armhf/armv7.
142 # This makes ruby-libs 7% bigger (13.4 -> 14.4 MiB).
143 export CFLAGS="${CFLAGS/-Os/-O2} -fno-omit-frame-pointer -fno-strict-aliasing"
144 export CPPFLAGS="${CPPFLAGS/-Os/-O2} -fno-omit-frame-pointer -fno-strict-aliasing"
145
146 # Needed for coroutine stuff
147 export LIBS="-lucontext"
148
149 # ruby saves path to install. we want use $PATH
150 export INSTALL=install
151
152 # the configure script does not detect isnan/isinf as macros
153 export ac_cv_func_isnan=yes
154 export ac_cv_func_isinf=yes
155
156 ./configure \
157 --build=$CBUILD \
158 --host=$CHOST \
159 --prefix=/usr \
160 --sysconfdir=/etc \
161 --mandir=/usr/share/man \
162 --infodir=/usr/share/info \
163 --with-sitedir=/usr/local/lib/site_ruby \
164 --enable-pthread \
165 --disable-rpath \
166 --enable-shared \
167 --with-mantype=man
168 make
169}
170
171check() {
172 make test TESTOPTS="--verbose"
173}
174
175package() {
176 make DESTDIR="$pkgdir" SUDO="" install
177
178 install -m 644 -D COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
179
180 cd "$pkgdir"
181
182 # Remove bundled gem bundler; it's provided by a separate aport/package
183 # ruby-bundler.
184 rm -rf ./$_rubydir/bundler
185 rm ./$_rubydir/bundler.rb
186 rm -rf ./$_gemdir/gems/bundler-*
187 rm ./$_gemdir/specifications/default/bundler-*.gemspec
188 rm usr/bin/bundle usr/bin/bundler
189
190 # Remove bundled CA certificates; they are provided by ca-certificates.
191 rm ./$_rubydir/rubygems/ssl_certs/*/*.pem
192 rmdir ./$_rubydir/rubygems/ssl_certs/* || true
193
194 rm -Rf ./$_gemdir/cache/*
195
196 if [ -d usr/local ]; then
197 local f=$(find usr/local -type f)
198 if [ -n "$f" ]; then
199 error "Found files in /usr/local:"
200 echo "$f"
201 return 1
202 fi
203 rm -r usr/local
204 fi
205}
206
207rdoc() {
208 pkgdesc="Ruby documentation tool"
209 license="Ruby"
210 depends="$pkgname"
211
212 amove $_rubydir/rdoc
213 amove $_gemdir/gems/rdoc-*
214 amove $_gemdir/specifications/default/rdoc-*
215 amove usr/bin/ri
216 amove usr/bin/rdoc
217}
218
219libs() {
220 pkgdesc="Libraries necessary to run Ruby"
221 depends=""
222
223 amove usr/lib
224}
225
226full() {
227 pkgdesc="Ruby with all bundled gems"
228 # bundler is bundled since Ruby 2.6, so include it in ruby-full despite
229 # that it's provided by a seprate aport/package.
230 depends="ruby ruby-rdoc ruby-bundler $(cat "$srcdir"/.ruby-full.depends)"
231
232 mkdir -p "$subpkgdir"
233}
234
235sha512sums="
236493c9be80a78a4ddf983620295c79ae9f1c8e4c60da8237e12965fa6f95dda6548b3ff3cd311fe774cc8237e18ad2b2514dd029c46c8f4eabea6613a39d7745b ruby-3.4.10.tar.gz
23742cd45c1db089a1ae57834684479a502e357ddba82ead5fa34e64c13971e7ab7ad2919ddd60a104a817864dd3e2e35bdbedb679210eb41d82cab36a0687e43d4 fix-get_main_stack.patch
238a77da5e5eb7d60caf3f1cabb81e09b88dc505ddd746e34efd1908c0096621156d81cc65095b846ba9bdb66028891aefce883a43ddec6b56b5beb4aac5e4ee33f dont-install-bundled-gems.patch
239000530316af1fca007fe8cee694b59e2e801674bcc1a2ebea95e67745d4afc0ce66c902fdbc88ee847a4fbf55115b183cd803cbf7c98ef685938efb3e2b7c991 fix-riscv64-build.patch
2405e7e144cc51f20ece690d26f268ec845887484eab14fc9af98dad4ded0c50931855a466402c1babf8ba57029aaa68744cf830d7af060d37b4d585701a42d9189 skip-tests-failing-on-ppc64le.patch
241"