PKGBUILD 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. # Contributor: Thomas Dziedzic <gostrc@gmail.com>
  2. # Contributor: Allan McRae <allan@archlinux.org>
  3. # Contributor: John Proctor <jproctor@prium.net>
  4. # Contributor: Jeramy Rutley <jrutley@gmail.com>
  5. # Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
  6. # Contributor: Daniel Milewski <niitotantei@riseup.net>
  7. # Contributor: André Silva <emulatorman@hyperbola.info>
  8. # Contributor: Luke Shumaker <lukeshu@parabola.nu>
  9. # Contributor: fauno <fauno@parabola.nu>
  10. # Rationale for inclusion in [libre]: Problematic license of
  11. # generator.c in bundled json extension.
  12. #
  13. # https://labs.parabola.nu/issues/674
  14. # https://bugs.ruby-lang.org/issues/11844
  15. # https://github.com/flori/json/issues/277
  16. pkgname=(ruby ruby-docs)
  17. pkgver=2.7.0
  18. _jsonver=2.1.0
  19. pkgrel=1
  20. pkgrel+=.parabola2
  21. _srcrel=1 # increment this to rebuild the sourceball without bumping pkgver
  22. arch=(x86_64)
  23. arch+=(i686 armv7h)
  24. url='https://www.ruby-lang.org/en/'
  25. license=(BSD2 custom)
  26. makedepends=(gdbm openssl libffi doxygen graphviz libyaml ttf-dejavu tk)
  27. options=(!emptydirs)
  28. source=(https://cache.ruby-lang.org/pub/ruby/${pkgver:0:3}/ruby-${pkgver}.tar.xz
  29. json-${_jsonver}.tar.gz::https://github.com/flori/json/archive/v${_jsonver}.tar.gz
  30. remove-json-ext.patch
  31. add-json_pure.patch
  32. json-libre.patch)
  33. sha512sums=('dd5690c631bf3a2b76cdc06902bcd76a89713a045e136debab9b8a81ff8c433bbb254aa09e4014ca1cf85a69ff4bcb13de11da5e40c224e7268be43ef2194af7'
  34. '6019cc26a0919e4d39ae0bf737b51cd9a474c74a55d25f6931ac04d61826bb810d063190a80a29810e57d7457d1a247acd82fd78de2c4c01acb7d73ee9fde603'
  35. 'cce1402a062ab5a065e7554ae23189cb9c8de0acc27a4c96db5a90a52cfce37fde8d128e95b997e6df05d327d2279a8368276820dfad8b744747ea619ad187ab'
  36. '9ff8a2ec9fdecd05fd506ed6f977dcd483e47611dc6bbe6c4622100a2071c0f6c7b3f813a94b73bebb9f0ed7fe9f6257289cdf971030ad525a3c8a0d065b09c2'
  37. '582017bd0f98878c0ac6f4625854422662d83ae6274a34762082a720052023780dceb17694b1f4e18d9a0dcbb525990341176eac31040aa63099a8b3a8d52071')
  38. prepare() {
  39. cd "$srcdir/json-${_jsonver}"
  40. # Modify 'json' so that it doesn't try to load (non-free!) 'json/ext'
  41. msg "applying json-libre.patch"
  42. rm -rf -- json.gemspec ext lib/json/ext*
  43. patch -p1 -i ../json-libre.patch
  44. # Now remove the json ext from the ruby sources
  45. cd "$srcdir/ruby-${pkgver}"
  46. msg "applying remove-json-ext.patch"
  47. rm -r ext/json test/json
  48. patch -p1 -i ../remove-json-ext.patch
  49. # and insert the json_pure lib instead
  50. msg "applying add-json_pure.patch"
  51. cp -r ../json-${_jsonver}/lib/* -t lib/
  52. cp ../json-${_jsonver}/json_pure.gemspec -t lib/json/
  53. cp -rT ../json-${_jsonver}/tests test/json
  54. patch -p1 -i ../add-json_pure.patch
  55. # Clean up the original json sources
  56. cd "$srcdir"
  57. rm -rf "json-${_jsonver}"
  58. cd ruby-${pkgver}
  59. # remove bundled gems, we are going to ship them as separate packages
  60. rm -rf gems/
  61. }
  62. build() {
  63. cd ruby-${pkgver}
  64. ./configure \
  65. --prefix=/usr \
  66. --sysconfdir=/etc \
  67. --localstatedir=/var \
  68. --sharedstatedir=/var/lib \
  69. --libexecdir=/usr/lib/ruby \
  70. --enable-shared \
  71. --disable-rpath \
  72. --with-dbm-type=gdbm_compat
  73. make
  74. }
  75. check() {
  76. cd ruby-${pkgver}
  77. make test
  78. }
  79. package_ruby() {
  80. pkgdesc='An object-oriented language for quick and easy programming'
  81. depends=(gdbm openssl libffi libyaml gmp zlib ruby-irb)
  82. optdepends=(
  83. 'rubygems: For ruby packages'
  84. 'ruby-docs: Ruby documentation'
  85. 'tk: for Ruby/TK'
  86. )
  87. cd ruby-${pkgver}
  88. make DESTDIR="${pkgdir}" install-nodoc
  89. install -D -m644 COPYING "${pkgdir}/usr/share/licenses/ruby/LICENSE"
  90. install -D -m644 BSDL "${pkgdir}/usr/share/licenses/ruby/BSDL"
  91. rubyver=${pkgver:0:3}.0
  92. # remove rubygems as it shipped as a separate package
  93. rm -r "${pkgdir}"/usr/lib/ruby/${rubyver}/{rubygems,rubygems.rb}
  94. rm "${pkgdir}"/usr/bin/gem
  95. # remove bundler as it shipped as a separate package
  96. rm -r "${pkgdir}"/usr/lib/ruby/${rubyver}/{bundler,bundler.rb}
  97. rm "${pkgdir}"/usr/bin/{bundle,bundler}
  98. rm "${pkgdir}"/usr/lib/ruby/gems/${rubyver}/specifications/default/bundler-*.gemspec
  99. rm "${pkgdir}"/usr/share/man/man1/{bundle,bundle-*}.1
  100. # remove bundled rdoc gem
  101. rm -r "${pkgdir}"/usr/lib/ruby/${rubyver}/{rdoc,rdoc.rb}
  102. rm "${pkgdir}"/usr/bin/{rdoc,ri}
  103. rm "${pkgdir}"/usr/lib/ruby/gems/${rubyver}/specifications/default/rdoc-*.gemspec
  104. # remove irb as it is a separate package now
  105. rm -r "${pkgdir}"/usr/lib/ruby/${rubyver}/{irb,irb.rb}
  106. rm "${pkgdir}"/usr/bin/irb
  107. rm "${pkgdir}"/usr/lib/ruby/gems/${rubyver}/specifications/default/irb-*.gemspec
  108. rm "${pkgdir}"/usr/share/man/man1/irb.1
  109. # remove all bundled gems to avoid conflicts with ruby-* Arch packages
  110. rm -r "${pkgdir}"/usr/lib/ruby/gems/${rubyver}/gems/*
  111. }
  112. package_ruby-docs() {
  113. pkgdesc='Documentation files for ruby'
  114. cd ruby-${pkgver}
  115. make DESTDIR="${pkgdir}" install-doc install-capi
  116. install -D -m644 COPYING "${pkgdir}/usr/share/licenses/ruby-docs/LICENSE"
  117. install -D -m644 BSDL "${pkgdir}/usr/share/licenses/ruby-docs/BSDL"
  118. # sometimes it installs ruby/capi/doxygen_objdb_XXXXXXX.tmp;
  119. # otherwise /usr/share/doc is empty
  120. rm -rf "$pkgdir/usr/share/doc"
  121. }