arch-pkgs/ruby-oj/PKGBUILD

57 lines
1.7 KiB
Bash

# Maintainer: George Rawlinson <george@rawlinson.net.nz>
pkgname=ruby-oj
_gemname="${pkgname#ruby-}"
pkgver=3.13.16
pkgrel=1
pkgdesc='The fastest JSON parser and object serializer'
arch=('x86_64')
url='https://github.com/ohler55/oj'
license=('MIT')
depends=('ruby')
makedepends=('ruby-rdoc')
options=(!emptydirs)
source=("https://rubygems.org/downloads/$_gemname-$pkgver.gem")
noextract=("$_gemname-$pkgver.gem")
sha512sums=('430259097231c9835b7ddce0f59669e3ba689f633bd3b5404ab0e9e5216564b5228e11d5bf9fbde4db4ae87d0923bd02034fb9dae427d82c6001aa602ffdbbb5')
b2sums=('8c23ba0d0d2b889a69e8431b810ecd1da74b8944e98e6f1c9967fef1b917dc6539c3dcd1ca2624d2c39bfa77ed9864aed451c8e3128086288322a93890c53b2b')
package() {
local _gemdir="$(ruby -e'puts Gem.default_dir')"
gem install \
--verbose \
--ignore-dependencies \
--no-document \
--no-user-install \
--install-dir "$pkgdir/$_gemdir" \
--bindir "$pkgdir/usr/bin" \
"$_gemname-$pkgver.gem"
# delete cache
cd "$pkgdir/$_gemdir"
rm -vrf cache
# delete unnecessary files & folders
rm -vrf "extensions/$CARCH-linux/$(basename $_gemdir)/$_gemname-$pkgver/gem_make.out"
cd "gems/$_gemname-$pkgver"
rm -vrf test ext
# move documentation
install -vd "$pkgdir/usr/share/doc/$pkgname"
mv -v *.md pages "$pkgdir/usr/share/doc/$pkgname"
# license
install -vd "$pkgdir/usr/share/licenses/$pkgname"
mv -v LICENSE "$pkgdir/usr/share/licenses/$pkgname"
# generate reproducible documentation
install -vd "$pkgdir/$_gemdir/doc/$_gemname-$pkgver"
cd "$pkgdir/$_gemdir/gems/$_gemname-$pkgver"
rdoc \
--format ri \
--output "$pkgdir$_gemdir/doc/$_gemname-$pkgver/ri" \
./lib
# delete unnecessary rdoc metadata file
rm -f "$pkgdir$_gemdir/doc/$_gemname-$pkgver/ri/created.rid"
}