1 # Maintainer: Andreas 'Segaja' Schleifer <segaja at archlinux dot org>
4 pkgname="ruby-${_gemname}"
7 pkgdesc='a module providing classes to handle Uniform Resource Identifiers'
9 url='https://github.com/ruby/uri'
10 license=('BSD' 'RUBY')
12 checkdepends=('ruby-rake')
14 source=("${url}/archive/refs/tags/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
15 sha512sums=('dc3049140edb5f29d5ea1a1cd1922ba137dbac7139bf5a59f2031f7434ed3ff51df0ad92f437c5401886e0a29e15ec8ea9ca7eb243c3b86c7316fa6a84d3862e')
18 cd "${_gemname}-${pkgver}"
20 # update gemspec/Gemfile to allow newer version of the dependencies
21 sed --in-place --regexp-extended 's|~>|>=|g' "${_gemname}.gemspec"
23 # we build based on a tar archive, not a git repo
24 sed --in-place --regexp-extended 's|git ls-files -z|find . -type f -not -path "*/\.git/*" -printf "%P\\\\0"|' "${_gemname}.gemspec"
28 cd "${_gemname}-${pkgver}"
30 gem build "${_gemname}.gemspec"
34 cd "${_gemname}-${pkgver}"
40 cd "${_gemname}-${pkgver}"
42 local _gemdir="$(gem env gemdir)"
43 local _platform="$(gem env platform | cut -d':' -f2)"
44 local _extension_api_version="$(ruby -e 'puts Gem.extension_api_version')"
48 --ignore-dependencies \
50 --install-dir "${pkgdir}/${_gemdir}" \
51 --bindir "${pkgdir}/usr/bin" \
52 "${_gemname}-${pkgver}.gem"
54 install --verbose --directory --mode=0755 \
55 "${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_platform}" \
56 "${pkgdir}${_gemdir}/specifications/default"
58 mv --verbose "${pkgdir}${_gemdir}/specifications/${_gemname}-${pkgver}.gemspec" "${pkgdir}${_gemdir}/specifications/default/${_gemname}-${pkgver}.gemspec"
59 mv --verbose "${pkgdir}${_gemdir}/gems/${_gemname}-${pkgver}/lib/${_gemname}.rb" "${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_gemname}.rb"
60 mv --verbose "${pkgdir}${_gemdir}/gems/${_gemname}-${pkgver}/lib/${_gemname}" "${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_gemname}"
62 # remove unrepreducible files
63 rm --force --recursive --verbose \
64 "${pkgdir}${_gemdir}/cache/" \
65 "${pkgdir}${_gemdir}/build_info/" \
66 "${pkgdir}${_gemdir}/extensions/" \
67 "${pkgdir}${_gemdir}/gems/" \
68 "${pkgdir}${_gemdir}/plugins/" \
69 "${pkgdir}${_gemdir}/doc/${_gemname}-${pkgver}/ri/ext/"
71 install --verbose -D --mode=0644 LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
72 install --verbose -D --mode=0644 *.md --target-directory "${pkgdir}/usr/share/doc/${pkgname}"