recipes: Adjust 'docsdir' variable to be consistent with the current recipe format
[dragora.git] / recipes / ruby / ruby3 / recipe
blob5fced023ef1233386112443120abb17d62cf9939
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
18 set -e
20 program=ruby
21 version=3.0.3
22 pkgname=ruby3
23 release=1
25 # Define a category for the output of the package name
26 pkgcategory=ruby
28 tarname=${program}-${version}.tar.gz
30 # Remote source(s)
31 fetch="https://cache.ruby-lang.org/pub/ruby/${version%.*}/$tarname"
33 description="
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
45 docs="
46   BSDL CONTRIBUTING.md COPYING* ChangeLog GPL KNOWNBUGS.rb
47   LEGAL NEWS.md README*
49 docsdir="${docdir}/${pkgname}-${version}"
51 build()
53     unpack "${tardir}/$tarname"
55     cd "$srcdir"
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 .
65     ./configure \
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" \
70      $configure_args \
71      --libdir=/usr/lib${libSuffix} \
72      --mandir=$mandir \
73      --docdir=$docsdir \
74      --enable-shared \
75      --enable-ipv6 \
76      --enable-load-relative \
77      --with-mantype=man \
78      --with-sitedir=/usr/local/share/ruby \
79      --with-sitearchdir=/usr/local/lib${libSuffix}/ruby \
80      --without-compress-debug-sections \
81      --disable-rpath \
82      --build="$(gcc -dumpmachine)" \
83      ac_cv_func_isnan=yes \
84      ac_cv_func_isinf=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"
91     then
92         (
93             cd "${destdir}/$mandir"
94             find . -type f -exec lzip -9 {} +
95             find . -type l | while read -r file
96             do
97                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
98                 rm -- "$file"
99             done
100         )
101     fi
103     # Copy documentation
104     mkdir -p "${destdir}/$docsdir"
105     cp -p $docs "${destdir}/$docsdir"