# Contributor: Fabian Affolter # Maintainer: Jakub Jirutka pkgname=ruby-nokogiri _gemname=${pkgname#ruby-} pkgver=1.7.2 pkgrel=0 pkgdesc="An HTML, XML, SAX, and Reader parser" url="http://nokogiri.org/" arch="all" license="MIT" depends="ruby ruby-mini_portile2" makedepends="ruby-dev libxml2-dev libxslt-dev" checkdepends="ruby-minitest" source="https://rubygems.org/downloads/$_gemname-$pkgver.gem" builddir="$srcdir/$_gemname-$pkgver" options="!check" # FIXME: some tests fails due to encoding issues unpack() { default_unpack cd "$srcdir" gem unpack $_gemname-$pkgver.gem } prepare() { default_prepare cd "$builddir" # Generate gemspec (there's no gemspec in the source). gem specification -l --ruby "$srcdir"/$_gemname-$pkgver.gem \ > "$builddir"/$_gemname.gemspec # Remove bundled external libraries etc. sed -i \ -e 's|, "ports/archives/[^"][^"]*"||g' \ -e 's|, "ports/patches/[^"][^"]*"||g' \ -e '\@mini_portile@d' \ $_gemname.gemspec } build() { cd "$builddir" gem build $_gemname.gemspec gem install \ --local \ --install-dir dist \ --ignore-dependencies \ --no-document \ --verbose \ $_gemname-$pkgver.gem -- \ --use-system-libraries } check() { cd "$builddir"/dist/gems/$_gemname-$pkgver # Note: This is copied from Fedora package. export LANG=ja_JP.UTF-8 ruby -I.:lib:test:ext \ -e 'require "test/helper"' \ -e 'Dir.glob("test/**/test_*.rb") {|f| require f }' } package() { local gemdir="$pkgdir/$(ruby -rubygems -e 'puts Gem.default_dir')" cd "$builddir"/dist mkdir -p "$gemdir" cp -r bin extensions gems specifications "$gemdir"/ cd "$gemdir"/gems/$_gemname-$pkgver # Remove unnecessary files and rubbish... rm -r ext/ patches/ suppressions/ tasks/ test/ \ build_all test_all Rakefile .[a-z]* *.md *.rdoc *.txt *.yml || true } sha512sums="e688940340ff87001de79aecc2d971f0d23206f2eb05439eef3809ff6aec6c678c9b3eec28b1cdbe34e9e90bd9e19e9bee3f9c8afabb2c1d079d15b6fda74ddb nokogiri-1.7.2.gem"