arch-pkgs/ruby-oj/PKGBUILD

58 lines
1.7 KiB
Text
Raw Normal View History

# Maintainer: George Rawlinson <george@rawlinson.net.nz>
_gemname=oj
pkgname=ruby-$_gemname
pkgver=3.13.11
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=('543e95118f3c9d5539fe2d2cc13090b5134ec17b2dc3bf602f6e441bb17c515b58abbc9405f492ea29ebd16f56cb4c30777a6857e94604e781e79629e6a08407')
b2sums=('a336de3f65cf08c12961783651e8d022585a5a792dc45940c12613f6190b19609985c9a8f536bb1ef1099472c6f911e2f77670e8d65d85231dbe922871055b65')
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"
}