recipe 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. # Build recipe for ruby.
  2. #
  3. # Copyright (c) 2019 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. program=ruby
  17. pkgname=ruby2
  18. version=2.6.5
  19. release=1
  20. # Set 'outdir' for a nice and well-organized output directory
  21. outdir="${outdir}/${arch}/ruby"
  22. tarname=${program}-${version}.tar.bz2
  23. # Remote source(s)
  24. fetch="http://ftp.ruby-lang.org/pub/ruby/${version%.*}/$tarname"
  25. description="
  26. Ruby programming language.
  27. Ruby is a dynamic, open source programming language with a focus
  28. on simplicity and productivity. It has an elegant syntax that is
  29. natural to read and easy to write.
  30. "
  31. homepage=http://www.ruby-lang.org
  32. license="GPLv2+ | BSD + Custom declared files (see LEGAL)"
  33. # Source documentation
  34. docs="
  35. BSDL CONTRIBUTING.md COPYING* ChangeLog GPL KNOWNBUGS.rb
  36. LEGAL NEWS README*
  37. "
  38. docsdir="${docdir}/${pkgname}-${version}"
  39. build()
  40. {
  41. set -e
  42. unpack "${tardir}/$tarname"
  43. cd "$srcdir"
  44. # A patch to avoid installing platform-specific gems with binaries
  45. # linked against Glibc (Thanks to "Alpine Linux")
  46. patch -Np1 -i "${worktree}/patches/ruby/rubygems-avoid-platform-specific-gems.patch"
  47. patch -Np1 -i "${worktree}/patches/ruby/fix-get_main_stack.patch"
  48. patch -Np1 -i "${worktree}/patches/ruby/test_insns-lower-recursion-depth.patch"
  49. patch -Np1 -i "${worktree}/patches/ruby/avoid-rdoc-hook-when-its-failed-to-load-rdoc-library.patch"
  50. # Update for hosts based on musl
  51. cp -f "${worktree}/archive/common/config.guess" tool/config.guess
  52. cp -f "${worktree}/archive/common/config.sub" tool/config.sub
  53. # Set sane permissions
  54. chmod -R u+w,go-w,a+rX-s .
  55. ./configure \
  56. CPPFLAGS="-D_GNU_SOURCE -fno-omit-frame-pointer -fno-strict-aliasing" \
  57. CFLAGS="$QICFLAGS -fno-omit-frame-pointer -fno-strict-aliasing" \
  58. CXXFLAGS="$QICXXFLAGS -fno-omit-frame-pointer -fno-strict-aliasing" \
  59. LDFLAGS="$QILDFLAGS" INSTALL="install" \
  60. $configure_args \
  61. --libdir=/usr/lib${libSuffix} \
  62. --mandir=$mandir \
  63. --docdir=$docsdir \
  64. --enable-shared \
  65. --enable-ipv6 \
  66. --enable-load-relative \
  67. --with-sitedir=/usr/local/share/ruby \
  68. --with-sitearchdir=/usr/local/lib${libSuffix}/ruby \
  69. --without-compress-debug-sections \
  70. --disable-rpath \
  71. --disable-install-doc \
  72. --disable-install-rdoc \
  73. --disable-install-capi \
  74. --build="$(cc -dumpmachine)" \
  75. ac_cv_func_isnan=yes \
  76. ac_cv_func_isinf=yes
  77. make -j${jobs} V=1 optflags="-O2"
  78. make -j${jobs} DESTDIR="$destdir" install
  79. # Compress and link man pages (if needed)
  80. if test -d "${destdir}/$mandir"
  81. then
  82. (
  83. cd "${destdir}/$mandir"
  84. find . -type f -exec lzip -9 '{}' +
  85. find . -type l | while read -r file
  86. do
  87. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  88. rm -- "$file"
  89. done
  90. )
  91. fi
  92. # Copy documentation
  93. mkdir -p "${destdir}${docsdir}"
  94. cp -p $docs "${destdir}${docsdir}"/
  95. }