recipe 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. # Build recipe for ruby.
  2. #
  3. # Copyright (c) 2019, 2021-2022 Matias Fonzo, <selk@dragora.org>.
  4. #
  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
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  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.
  16. # Exit immediately on any error
  17. set -e
  18. program=ruby
  19. version=3.0.3
  20. pkgname=ruby3
  21. release=1
  22. # Define a category for the output of the package name
  23. pkgcategory=ruby
  24. tarname=${program}-${version}.tar.gz
  25. # Remote source(s)
  26. fetch="https://cache.ruby-lang.org/pub/ruby/${version%.*}/$tarname"
  27. description="
  28. Ruby programming language.
  29. Ruby is a dynamic, open source programming language with a focus
  30. on simplicity and productivity. It has an elegant syntax that is
  31. natural to read and easy to write.
  32. "
  33. homepage=https://www.ruby-lang.org
  34. license="GPLv2+ | BSD + Custom declared files (see LEGAL)"
  35. # Source documentation
  36. docs="
  37. BSDL CONTRIBUTING.md COPYING* ChangeLog GPL KNOWNBUGS.rb
  38. LEGAL NEWS.md README*
  39. "
  40. docsdir="${docdir}/${pkgname}-${version}"
  41. build()
  42. {
  43. unpack "${tardir}/$tarname"
  44. cd "$srcdir"
  45. # Apply patches from "Alpine Linux"
  46. patch -Np1 -i "${worktree}/patches/ruby/test_insns-lower-recursion-depth.patch"
  47. patch -Np1 -i "${worktree}/patches/ruby/fix-get_main_stack.patch"
  48. patch -Np1 -i "${worktree}/patches/ruby/dont-install-bundled-gems.patch"
  49. # Set sane permissions
  50. chmod -R u+w,go-w,a+rX-s .
  51. ./configure \
  52. CPPFLAGS="$QICPPFLAGS -D_GNU_SOURCE -fno-omit-frame-pointer -fno-strict-aliasing" \
  53. CFLAGS="$QICFLAGS -fno-omit-frame-pointer -fno-strict-aliasing" \
  54. CXXFLAGS="$QICXXFLAGS -fno-omit-frame-pointer -fno-strict-aliasing" \
  55. LDFLAGS="$QILDFLAGS" INSTALL="install" \
  56. $configure_args \
  57. --libdir=/usr/lib${libSuffix} \
  58. --mandir=$mandir \
  59. --docdir=$docsdir \
  60. --enable-shared \
  61. --enable-ipv6 \
  62. --enable-load-relative \
  63. --with-mantype=man \
  64. --with-sitedir=/usr/local/share/ruby \
  65. --with-sitearchdir=/usr/local/lib${libSuffix}/ruby \
  66. --without-compress-debug-sections \
  67. --disable-rpath \
  68. --build="$(gcc -dumpmachine)" \
  69. ac_cv_func_isnan=yes \
  70. ac_cv_func_isinf=yes
  71. make -j${jobs} V=1 optflags="-O3"
  72. make -j${jobs} DESTDIR="$destdir" install
  73. # Compress and link man pages (if needed)
  74. if test -d "${destdir}/$mandir"
  75. then
  76. (
  77. cd "${destdir}/$mandir"
  78. find . -type f -exec lzip -9 {} +
  79. find . -type l | while read -r file
  80. do
  81. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  82. rm -- "$file"
  83. done
  84. )
  85. fi
  86. # Copy documentation
  87. mkdir -p "${destdir}/$docsdir"
  88. cp -p $docs "${destdir}/$docsdir"
  89. }