archrelease: copy trunk to community-any
[ArchLinux/community.git] / ruby-date / repos / community-x86_64 / PKGBUILD
blobda0e12b2e3c7c981d4618bd36fe33f9c9fa140d2
1 # Maintainer: Andreas 'Segaja' Schleifer <segaja at archlinux dot org>
3 _gemname='date'
4 pkgname="ruby-${_gemname}"
5 pkgver=3.2.2
6 pkgrel=4
7 pkgdesc='A subclass of Object includes Comparable module for handling dates'
8 arch=('x86_64')
9 url='https://github.com/ruby/date'
10 license=('BSD' 'RUBY')
11 depends=('ruby')
12 makedepends=('ruby-rake' 'ruby-rake-compiler')
13 options=('!emptydirs')
14 source=("${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
15 sha512sums=('5a640b550c9ea0c1fa24aa5d114ae9108fd568c8c38b20434168a92c886d66487065e0c6aedc7e55cbe59cc3338fd262ca601267ed0b55377c382fe0502e9604')
16 b2sums=('aedb4d5d43b1d7ac277bc6fd36651f36828be7a04f4eb75c45ea02bc56b3a403af9e8a26b23a9839c904ae455e6a02476fe83115d8c816f06168db6e0a788347')
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     --ignore-dependencies \
42     --no-user-install \
43     --install-dir "tmp_install/${_gemdir}" \
44     --bindir "tmp_install/usr/bin" \
45     "${_gemname}-${pkgver}.gem"
47   gem install \
48     --default \
49     --local \
50     --verbose \
51     --ignore-dependencies \
52     --no-user-install \
53     --install-dir "tmp_install_default/gemspec" \
54     --bindir "tmp_install_default/usr/bin" \
55     "${_gemname}-${pkgver}.gem"
57   mv --verbose "tmp_install${_gemdir}/specifications/${_gemname}-${pkgver}.gemspec" "tmp_install${_gemdir}/specifications/default/${_gemname}-${pkgver}.gemspec"
58   mv --verbose "tmp_install${_gemdir}/gems/${_gemname}-${pkgver}/lib/${_gemname}.rb" "tmp_install/usr/lib/ruby/${_extension_api_version}/${_gemname}.rb"
59   mv --verbose "tmp_install${_gemdir}/extensions/${_platform}/${_extension_api_version}/${_gemname}-${pkgver}/"* "tmp_install/usr/lib/ruby/${_extension_api_version}/${_platform}/"
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/" \
70     "tmp_install/usr/lib/ruby/${_extension_api_version}/${_platform}/"{gem.build_complete,gem_make.out,mkmf.log}
73 check() {
74   cd "${_gemname}-${pkgver}"
76   local _gemdir="$(gem env gemdir)"
78   GEM_HOME="tmp_install/${_gemdir}" rake test
81 package() {
82   cd "${_gemname}-${pkgver}"
84   cp --archive --verbose tmp_install/* "${pkgdir}"
86   install --verbose -D --mode=0644 LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
87   install --verbose -D --mode=0644 *.md --target-directory "${pkgdir}/usr/share/doc/${pkgname}"
90 # vim: tabstop=2 shiftwidth=2 expandtab: