recipes: Rename 'pkghashtag' variable to 'pkgcategory'
[dragora.git] / recipes / ruby / ruby2 / recipe
blob020f96a75cf720b15619cfc3877c538929cef00f
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.
17 program=ruby
18 pkgname=ruby2
19 version=2.6.5
20 release=1
22 # Define a category for the output of the package name
23 pkgcategory=ruby
25 tarname=${program}-${version}.tar.bz2
27 # Remote source(s)
28 fetch="http://ftp.ruby-lang.org/pub/ruby/${version%.*}/$tarname"
30 description="
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
42 docs="
43   BSDL CONTRIBUTING.md COPYING* ChangeLog GPL KNOWNBUGS.rb
44   LEGAL NEWS README*
46 docsdir="${docdir}/${pkgname}-${version}"
48 build()
50     set -e
52     unpack "${tardir}/$tarname"
54     cd "$srcdir"
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 .
71     ./configure \
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" \
76      $configure_args \
77      --libdir=/usr/lib${libSuffix} \
78      --mandir=$mandir \
79      --docdir=$docsdir \
80      --enable-shared \
81      --enable-ipv6 \
82      --enable-load-relative \
83      --with-sitedir=/usr/local/share/ruby \
84      --with-sitearchdir=/usr/local/lib${libSuffix}/ruby \
85      --without-compress-debug-sections \
86      --disable-rpath \
87      --disable-install-doc \
88      --disable-install-rdoc \
89      --disable-install-capi \
90      --build="$(cc -dumpmachine)" \
91      ac_cv_func_isnan=yes \
92      ac_cv_func_isinf=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"
99     then
100         (
101             cd "${destdir}/$mandir"
102             find . -type f -exec lzip -9 '{}' +
103             find . -type l | while read -r file
104             do
105                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
106                 rm -- "$file"
107             done
108         )
109     fi
111     # Copy documentation
112     mkdir -p "${destdir}${docsdir}"
113     cp -p $docs "${destdir}${docsdir}"/