# Maintainer: Andreas 'Segaja' Schleifer <segaja at archlinux dot org>
_gemname='typeprof'
pkgname="ruby-${_gemname}"
pkgver=0.21.8
pkgrel=1
pkgdesc='An experimental type-level Ruby interpreter for testing and understanding Ruby code'
arch=('any')
url="https://github.com/ruby/${_gemname}"
license=('MIT')
depends=('ruby')
checkdepends=('git')
options=('!emptydirs')
source=("${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha512sums=('1c4e7ba04b3342d688976cd03e8c0181d94035284d8bb2a8b35aabad07252938d4ce4d4118128d6647bda2b36c01d4a14465859e1d79e8a3804fb7307d6d0fb9')
b2sums=('8fe8749e802ddc6dc94212f433acbd86bf2e9ddb96a62f1591606cde9748a52aff6287bac9139de4d4e6f55e85b03b309938329b1b0f3206b822ed9f073301b5')
prepare() {
cd "${_gemname}-${pkgver}"
# update gemspec/Gemfile to allow newer version of the dependencies
sed --in-place --regexp-extended 's|~>|>=|g' "${_gemname}.gemspec"
# we don't build from a git checkout
sed --in-place --regexp-extended 's|`git ls-files -z`\.split\("\\x0"\)|`find . -type f -not -path "*/\.git*" -printf "%P\\n"`\.split\("\\n"\)|' "${_gemname}.gemspec"
}
build() {
cd "${_gemname}-${pkgver}"
local _gemdir="$(gem env gemdir)"
gem build --verbose "${_gemname}.gemspec"
gem install \
--local \
--verbose \
--ignore-dependencies \
--no-user-install \
--install-dir "tmp_install${_gemdir}" \
--bindir "tmp_install/usr/bin" \
"${_gemname}-${pkgver}.gem"
# remove unrepreducible files
rm --force --recursive --verbose \
"tmp_install${_gemdir}/cache/" \
"tmp_install${_gemdir}/gems/${_gemname}-${pkgver}/vendor/" \
"tmp_install${_gemdir}/doc/${_gemname}-${pkgver}/ri/ext/"
find "tmp_install${_gemdir}/gems/" \
-type f \
\( \
-iname "*.o" -o \
-iname "*.c" -o \
-iname "*.so" -o \
-iname "*.time" -o \
-iname "gem.build_complete" -o \
-iname "Makefile" \
\) \
-delete
find "tmp_install${_gemdir}/extensions/" \
-type f \
\( \
-iname "mkmf.log" -o \
-iname "gem_make.out" \
\) \
-delete
}
# NOTE: see https://github.com/ruby/typeprof/issues/157
# check() {
# cd "${_gemname}-${pkgver}"
#
# local _gemdir="$(gem env gemdir)"
#
# GEM_HOME="tmp_install${_gemdir}" rake test
# }
package() {
cd "${_gemname}-${pkgver}"
cp --archive --verbose tmp_install/* "${pkgdir}"
install --verbose -D --mode=0644 LICENSE* --target-directory "${pkgdir}/usr/share/licenses/${pkgname}"
install --verbose -D --mode=0644 *.md --target-directory "${pkgdir}/usr/share/doc/${pkgname}"
}
# vim: tabstop=2 shiftwidth=2 expandtab: