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.14
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=('a58d58b83c1ce080120c667e096b3d0f3e409e279d31d0427b07293918596c38de13427c774d7eb512dc23977cf34b78d3cd79d9b3267bb477aa4aacde83af5e')
b2sums=('7902ddfde1c80632279d17d1e7e497f43de5c1c4abf6ce7fe84ce79a63bc5bf595575c71b2342b6c7016bf799f2e0a424e04c114df013dfe6d1d797bb8713435')
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"
}