1 # Build recipe for ruby.
3 # Copyright (c) 2019, 2021-2022 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Exit immediately on any error
25 # Define a category for the output of the package name
28 tarname=${program}-${version}.tar.gz
31 fetch="https://cache.ruby-lang.org/pub/ruby/${version%.*}/$tarname"
34 Ruby programming language.
36 Ruby is a dynamic, open source programming language with a focus
37 on simplicity and productivity. It has an elegant syntax that is
38 natural to read and easy to write.
41 homepage=https://www.ruby-lang.org
42 license="GPLv2+ | BSD + Custom declared files (see LEGAL)"
44 # Source documentation
46 BSDL CONTRIBUTING.md COPYING* ChangeLog GPL KNOWNBUGS.rb
49 docsdir="${docdir}/${pkgname}-${version}"
53 unpack "${tardir}/$tarname"
57 # Apply patches from "Alpine Linux"
58 patch -Np1 -i "${worktree}/patches/ruby/test_insns-lower-recursion-depth.patch"
59 patch -Np1 -i "${worktree}/patches/ruby/fix-get_main_stack.patch"
60 patch -Np1 -i "${worktree}/patches/ruby/dont-install-bundled-gems.patch"
62 # Set sane permissions
63 chmod -R u+w,go-w,a+rX-s .
66 CPPFLAGS="$QICPPFLAGS -D_GNU_SOURCE -fno-omit-frame-pointer -fno-strict-aliasing" \
67 CFLAGS="$QICFLAGS -fno-omit-frame-pointer -fno-strict-aliasing" \
68 CXXFLAGS="$QICXXFLAGS -fno-omit-frame-pointer -fno-strict-aliasing" \
69 LDFLAGS="$QILDFLAGS" INSTALL="install" \
71 --libdir=/usr/lib${libSuffix} \
76 --enable-load-relative \
78 --with-sitedir=/usr/local/share/ruby \
79 --with-sitearchdir=/usr/local/lib${libSuffix}/ruby \
80 --without-compress-debug-sections \
82 --build="$(gcc -dumpmachine)" \
83 ac_cv_func_isnan=yes \
86 make -j${jobs} V=1 optflags="-O3"
87 make -j${jobs} DESTDIR="$destdir" install
89 # Compress and link man pages (if needed)
90 if test -d "${destdir}/$mandir"
93 cd "${destdir}/$mandir"
94 find . -type f -exec lzip -9 {} +
95 find . -type l | while read -r file
97 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
104 mkdir -p "${destdir}/$docsdir"
105 cp -p $docs "${destdir}/$docsdir"