summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3779f0bea107971a4fbf18c2ca450c56f6bf9ce4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Maintainer: Michał Wojdyła < micwoj9292 at gmail dot com >
# Contributor: Colin Arnott <colin@urandom.co.uk>
# Contributor: Andreas 'Segaja' Schleifer <archlinux at segaja dot de>

_gemname='bcrypt'
pkgname="ruby-${_gemname}"
pkgver=3.1.20
pkgrel=4
pkgdesc="bcrypt-ruby is a Ruby binding for the OpenBSD bcrypt() password hashing algorithm, allowing you to easily store a secure hash of your users' passwords."
arch=('x86_64')
url='https://github.com/bcrypt-ruby/bcrypt-ruby'
license=('MIT')
options=(!emptydirs)
depends=('glibc' 'ruby')
makedepends=('ruby-rake-compiler' 'ruby-rdoc' 'ruby-rspec')
source=("${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha512sums=('a89e992a8684211fda22074269000475f7975dd41f05f9b1c2acd82e7a7e084134dc33c66053b315dc918f848330f2990545e7c806c17b69cdffbf2b382e0f4d')

prepare() {
  cd "bcrypt-ruby-${pkgver}"

  # we built based on a tar archive, not a git repo
  sed --in-place 's/git ls-files/find/' "${_gemname}.gemspec"

  # update gemspec/Gemfile to allow newer version of the dependencies
  sed --in-place --regexp-extended 's|~>|>=|g' "${_gemname}.gemspec"
}

build() {
  cd "bcrypt-ruby-${pkgver}"

  rake gem
}
check() {
  local _gemdir="$(gem env gemdir)"
  cd bcrypt-ruby-$pkgver
  # https://github.com/bcrypt-ruby/bcrypt-ruby/issues/244
  GEM_HOME="tmp_install/$_gemdir" rake || echo "Tests failed"
}
package() {
  cd "bcrypt-ruby-${pkgver}"

  local _gemdir="$(gem env gemdir)"

  gem install --ignore-dependencies --no-user-install --install-dir "${pkgdir}/${_gemdir}" --bindir "${pkgdir}/usr/bin" "pkg/${_gemname}-${pkgver}.gem" \
  -- --with-ldflags="-Wl,-z,shstk"

  rm "${pkgdir}/${_gemdir}/cache/${_gemname}-${pkgver}.gem"

  install -Dm 644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
  install -Dm 644 CHANGELOG README.md --target-directory "${pkgdir}/usr/share/doc/${pkgname}"
}