1 # Build recipe for ruby.
3 # Copyright (c) 2019 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.
22 # Define a category for the output of the package name
25 tarname=${program}-${version}.tar.bz2
28 fetch="http://ftp.ruby-lang.org/pub/ruby/${version%.*}/$tarname"
31 Ruby programming language.
33 Ruby is a dynamic, open source programming language with a focus
34 on simplicity and productivity. It has an elegant syntax that is
35 natural to read and easy to write.
38 homepage=http://www.ruby-lang.org
39 license="GPLv2+ | BSD + Custom declared files (see LEGAL)"
41 # Source documentation
43 BSDL CONTRIBUTING.md COPYING* ChangeLog GPL KNOWNBUGS.rb
46 docsdir="${docdir}/${pkgname}-${version}"
52 unpack "${tardir}/$tarname"
56 # A patch to avoid installing platform-specific gems with binaries
57 # linked against Glibc (Thanks to "Alpine Linux")
58 patch -Np1 -i "${worktree}/patches/ruby/rubygems-avoid-platform-specific-gems.patch"
60 patch -Np1 -i "${worktree}/patches/ruby/fix-get_main_stack.patch"
61 patch -Np1 -i "${worktree}/patches/ruby/test_insns-lower-recursion-depth.patch"
62 patch -Np1 -i "${worktree}/patches/ruby/avoid-rdoc-hook-when-its-failed-to-load-rdoc-library.patch"
64 # Update for hosts based on musl
65 cp -f "${worktree}/archive/common/config.guess" tool/config.guess
66 cp -f "${worktree}/archive/common/config.sub" tool/config.sub
68 # Set sane permissions
69 chmod -R u+w,go-w,a+rX-s .
72 CPPFLAGS="-D_GNU_SOURCE -fno-omit-frame-pointer -fno-strict-aliasing" \
73 CFLAGS="$QICFLAGS -fno-omit-frame-pointer -fno-strict-aliasing" \
74 CXXFLAGS="$QICXXFLAGS -fno-omit-frame-pointer -fno-strict-aliasing" \
75 LDFLAGS="$QILDFLAGS" INSTALL="install" \
77 --libdir=/usr/lib${libSuffix} \
82 --enable-load-relative \
83 --with-sitedir=/usr/local/share/ruby \
84 --with-sitearchdir=/usr/local/lib${libSuffix}/ruby \
85 --without-compress-debug-sections \
87 --disable-install-doc \
88 --disable-install-rdoc \
89 --disable-install-capi \
90 --build="$(cc -dumpmachine)" \
91 ac_cv_func_isnan=yes \
94 make -j${jobs} V=1 optflags="-O2"
95 make -j${jobs} DESTDIR="$destdir" install
97 # Compress and link man pages (if needed)
98 if test -d "${destdir}/$mandir"
101 cd "${destdir}/$mandir"
102 find . -type f -exec lzip -9 '{}' +
103 find . -type l | while read -r file
105 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
112 mkdir -p "${destdir}${docsdir}"
113 cp -p $docs "${destdir}${docsdir}"/