arch-pkgs/ruby-oj/PKGBUILD

58 lines
1.7 KiB
Bash

# Maintainer: George Rawlinson <george@rawlinson.net.nz>
pkgname=ruby-oj
_gemname="${pkgname#ruby-}"
pkgver=3.13.17
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=('584811e38c9bcef658b2d30a375f7461b8cae70dd6ed625120121132c6f5141270da7bbf744cd22d7099bff7217d226824b21bc92a8a44000f628b0ceb9f043d')
b2sums=('60cd8978adeec7fb46b57fc9d006e42c70eb2f238609c1acfdfefd234b9bbccefc52aad8f2637c5c733a1b4834b84c87f96fb35b41020558c6633a977b638664')
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"
}