PKGBUILD 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. # Maintainer: Luke T. Shumaker <lukeshu@parabola.nu>
  2. # Maintainer (arch): David Runge <dvzrv@archlinux.org>
  3. # Maintainer (arch): Andreas 'Segaja' Schleifer <segaja at archlinux dot org>
  4. # Parabola changes and rationale:
  5. # - generator.c contains non-free code from CVTUTF
  6. # https://labs.parabola.nu/issues/674
  7. # https://bugs.ruby-lang.org/issues/11844
  8. # https://github.com/flori/json/issues/277
  9. _name=json
  10. pkgname="ruby-json"
  11. pkgver=2.7.1
  12. pkgrel=1
  13. pkgdesc="JSON implementation for Ruby"
  14. arch=(x86_64)
  15. url="https://github.com/flori/json"
  16. license=(Ruby)
  17. depends=(
  18. glibc
  19. ruby
  20. )
  21. makedepends=(
  22. ragel
  23. ruby-rake
  24. ruby-rdoc
  25. )
  26. checkdepends=(
  27. ruby-test-unit
  28. ruby-test-unit-ruby-core
  29. )
  30. source=($url/archive/v$pkgver/$pkgname-$pkgver.tar.gz)
  31. sha512sums=('ce0a1399f0974e3919e85af9aa50e982a5e1adff7312f716033f6a19ce7044b046e037f19fcf43adaeff402c882bd0a3b045e93c245287a7f947754125eb39c6')
  32. b2sums=('f1339558107ee1f4b9a54b63d601c9c4a78ed1a4cc148c3c57d963d5536a1b8ced66dd7cd4b7ea9bc2c5ee5fcb3801c028671884484e16ea7d57d0a49e16f317')
  33. # Parabola: Mundane packaging considerations.
  34. arch+=(armv7h i686)
  35. pkgrel+=.parabola2
  36. makedepends+=(ruby-bootstraplib)
  37. # Parabola: Replace the CVTUTF code with a free implementation.
  38. # https://github.com/flori/json/pull/567
  39. _commit=6e75be64c896e093075ec99bf94a3f5fc576c283
  40. source=("ruby-json-${_commit}.tar.gz::https://github.com/parabola-gnulinuxlibre/ruby-json/archive/${_commit}.tar.gz")
  41. prepare() {
  42. mv "ruby-json-${_commit}" "$_name-$pkgver" # Parabola
  43. cd $_name-$pkgver
  44. # update gemspec/Gemfile to allow newer version of the dependencies
  45. sed -i -e 's|~>|>=|g' $_name.gemspec
  46. }
  47. build() {
  48. local gemdir="$(gem env gemdir)"
  49. local gem_install_options=(
  50. --local
  51. --verbose
  52. --ignore-dependencies
  53. --no-user-install
  54. --install-dir tmp_install/$gemdir
  55. --bindir tmp_install/usr/bin
  56. $_name-$pkgver.gem
  57. )
  58. local unrepro_files=(
  59. tmp_install/$gemdir/cache/
  60. tmp_install/$gemdir/gems/$_name-$pkgver/vendor/
  61. tmp_install/$gemdir/doc/$_name-$pkgver/ri/ext/
  62. )
  63. cd $_name-$pkgver
  64. gem build $_name.gemspec
  65. gem install "${gem_install_options[@]}"
  66. # remove unrepreducible files
  67. rm -frv "${unrepro_files[@]}"
  68. find tmp_install/$gemdir/gems/ \
  69. -type f \
  70. \( \
  71. -iname "*.o" -o \
  72. -iname "*.c" -o \
  73. -iname "*.so" -o \
  74. -iname "*.time" -o \
  75. -iname "gem.build_complete" -o \
  76. -iname "Makefile" \
  77. \) \
  78. -delete
  79. find tmp_install/$gemdir/extensions/ \
  80. -type f \
  81. \( \
  82. -iname "mkmf.log" -o \
  83. -iname "gem_make.out" \
  84. \) \
  85. -delete
  86. }
  87. check() {
  88. local gemdir="$(gem env gemdir)"
  89. cd $_name-$pkgver
  90. #GEM_HOME="tmp_install/$gemdir" rake test # Parabola: bootstrapping problem, idk
  91. }
  92. package() {
  93. cd $_name-$pkgver
  94. mv -v tmp_install/* "$pkgdir/"
  95. install -vDm 0644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
  96. install -vDm 0644 ./*.md -t "$pkgdir/usr/share/doc/$pkgname/"
  97. }