summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4b0e0784c5b6f8fd507dd6154c8e6a803913dcd2 (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
# 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=2
pkgdesc="bcrypt() is a sophisticated and secure hash algorithm designed by The OpenBSD project for hashing passwords. The bcrypt Ruby gem provides a simple wrapper for safely handling passwords"
arch=('x86_64')
url='https://github.com/bcrypt-ruby/bcrypt-ruby'
license=('MIT')
options=(!emptydirs)
depends=('glibc' 'ruby')
makedepends=('ruby-rake-compiler' '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
}

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"

  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}"
}