archrelease: copy trunk to community-any
[ArchLinux/community.git] / ruby-ipaddr / trunk / PKGBUILD
bloba358dfd500ddd645dc545bfeec43de1d1fa8d342
1 # Maintainer: Andreas 'Segaja' Schleifer <segaja at archlinux dot org>
3 _gemname='ipaddr'
4 pkgname="ruby-${_gemname}"
5 pkgver=1.2.4
6 pkgrel=3
7 pkgdesc='IPAddr provides a set of methods to manipulate an IP address. Both IPv4 and IPv6 are supported'
8 arch=('any')
9 url="https://github.com/ruby/${_gemname}"
10 license=('BSD' 'RUBY')
11 depends=('ruby')
12 checkdepends=('ruby-rake')
13 options=('!emptydirs')
14 source=("${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
15 sha512sums=('7287cd761d830d141ca122a2aefbc7d8f910e1e27c61be08f72a797283e71ab908396920fdacaa886401da0556e51861a86dd60d39a956c28025ea3592ba96f8')
16 b2sums=('018a97ff9199b1af2f5fc1baf4193c3d527822366a2df2814b301adb292978afd4f94f65259d928dfc428b25a986031b7c9f194221ebbd9e7b857238d4c5bb33')
18 prepare() {
19   cd "${_gemname}-${pkgver}"
21   # update gemspec/Gemfile to allow newer version of the dependencies
22   sed --in-place --regexp-extended 's|~>|>=|g' "${_gemname}.gemspec"
25 build() {
26   cd "${_gemname}-${pkgver}"
28   local _gemdir="$(gem env gemdir)"
29   local _platform="$(gem env platform | cut -d':' -f2)"
30   local _extension_api_version="$(ruby -e 'puts Gem.extension_api_version')"
32   install --verbose --directory --mode=0755 \
33     "tmp_install_default/gemspec/specifications/gems/${_gemname}-${pkgver}" \
34     "tmp_install/usr/lib/ruby/${_extension_api_version}/${_platform}" \
35     "tmp_install${_gemdir}/specifications/default"
37   gem build "${_gemname}.gemspec"
39   gem install \
40     --local \
41     --verbose \
42     --ignore-dependencies \
43     --no-user-install \
44     --install-dir "tmp_install/${_gemdir}" \
45     --bindir "tmp_install/usr/bin" \
46     "${_gemname}-${pkgver}.gem"
48   gem install \
49     --default \
50     --local \
51     --verbose \
52     --ignore-dependencies \
53     --no-user-install \
54     --install-dir "tmp_install_default/gemspec" \
55     --bindir "tmp_install_default/usr/bin" \
56     "${_gemname}-${pkgver}.gem"
58   mv --verbose "tmp_install_default/gemspec/specifications/default/${_gemname}-${pkgver}.gemspec" "tmp_install${_gemdir}/specifications/default/${_gemname}-${pkgver}.gemspec"
59   mv --verbose "tmp_install${_gemdir}/gems/${_gemname}-${pkgver}/lib/${_gemname}.rb" "tmp_install/usr/lib/ruby/${_extension_api_version}/${_gemname}.rb"
61   # remove unrepreducible files
62   rm --force --recursive --verbose \
63     "tmp_install${_gemdir}/cache/" \
64     "tmp_install${_gemdir}/build_info/" \
65     "tmp_install${_gemdir}/extensions/" \
66     "tmp_install${_gemdir}/gems/" \
67     "tmp_install${_gemdir}/plugins/" \
68     "tmp_install${_gemdir}/specifications/${_gemname}-${pkgver}.gemspec" \
69     "tmp_install${_gemdir}/doc/${_gemname}-${pkgver}/ri/ext/"
72 check() {
73   cd "${_gemname}-${pkgver}"
75   local _gemdir="$(gem env gemdir)"
77   GEM_HOME="tmp_install/${_gemdir}" rake test
80 package() {
81   cd "${_gemname}-${pkgver}"
83   cp --archive --verbose tmp_install/* "${pkgdir}"
85   install --verbose -D --mode=0644 LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
86   install --verbose -D --mode=0644 *.md --target-directory "${pkgdir}/usr/share/doc/${pkgname}"
89 # vim: tabstop=2 shiftwidth=2 expandtab: