archrelease: copy trunk to community-any
[ArchLinux/community.git] / ruby-puma / trunk / PKGBUILD
blob82798db24a908311bf96a871df7463043d5fa5d3
1 # Maintainer: Andreas 'Segaja' Schleifer <archlinux at segaja dot de>
3 _gemname='puma'
4 pkgname="ruby-$_gemname"
5 pkgver=5.6.5
6 pkgrel=2
7 pkgdesc='A Ruby/Rack web server built for concurrency'
8 arch=('x86_64')
9 url='https://puma.io/'
10 license=('BSD-3-CLAUSE')
11 options=(!emptydirs)
12 depends=('ruby' 'ruby-nio4r' 'ruby-sd_notify')
13 makedepends=('ruby-bundler' 'ruby-minitest' 'ruby-minitest-proveit' 'ruby-minitest-retry' 'ruby-minitest-stub-const' 'ruby-rack' 'ruby-rake' 'ruby-rake-compiler' 'ruby-rdoc')
14 source=("https://github.com/puma/puma/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz"
15         "${pkgname}_fix_tests.patch")
16 sha512sums=('0ad41f3372732bdea6594a20b116ec4fc03a8a1d2ff807b3c315e7769aef4e5361ff775975575125002fbfc83315e6906fa8691ce666161bd8beee8c469289d8'
17             'da06b0dafb1ff45d79b3dff05c53334ba1ef2f4f8f8edd904d6418961da51e78f1dff5e1aee19154699651a8ea5c1241b8018eab3f1769fb163a3609b1ac5df0')
19 prepare() {
20   cd "${_gemname}-${pkgver}"
22   # remove some tests and fix others
23   patch --verbose --strip=1 --input="../${pkgname}_fix_tests.patch"
25   # we built based on a tar archive, not a git repo
26   sed --in-place 's/git ls-files/find/' "${_gemname}.gemspec"
28   # update gemspec/Gemfile to allow newer version of the deps
29   sed --in-place --regexp-extended 's|~>|>=|g' "${_gemname}.gemspec" Gemfile
31   # disable rubocop, we don't have that in our repos and it doesn't provide any benefits during building
32   sed --in-place '/rubocop/Id' Rakefile Gemfile
34   # disable m. Only required for debugging during development
35   sed --in-place "/'m'/d" Gemfile
37   # disable localhost. Only required for self-signed certificates during development
38   sed --in-place "/localhost/d" Gemfile
41 build() {
42   cd "${_gemname}-${pkgver}"
44   rake compile
45   rake build
48 check() {
49   cd "${_gemname}-${pkgver}"
51   # https://github.com/puma/puma/blob/master/CONTRIBUTING.md#file-limits
52   ulimit -Sn 5000
54   # some seeds cause random errors ( https://github.com/puma/puma/issues/2825 ) so we use a fixed seed
55   export TESTOPTS="--seed=21082"
57   rake test:all
60 package() {
61   cd "${_gemname}-${pkgver}"
63   local _gemdir="$(gem env gemdir)"
65   gem install \
66     --local \
67     --verbose \
68     --ignore-dependencies \
69     --no-user-install \
70     --install-dir "${pkgdir}/${_gemdir}" \
71     --bindir "${pkgdir}/usr/bin" \
72     "pkg/${_gemname}-${pkgver}.gem"
74   # remove unrepreducible files
75   rm --force --recursive --verbose \
76     "${pkgdir}/${_gemdir}/cache/" \
77     "${pkgdir}/${_gemdir}/gems/${_gemname}-${pkgver}/vendor/" \
78     "${pkgdir}/${_gemdir}/doc/${_gemname}-${pkgver}/ri/ext/"
80   find "${pkgdir}/${_gemdir}/gems/" \
81     -type f \
82     \( \
83       -iname "*.o" -o \
84       -iname "*.c" -o \
85       -iname "*.so" -o \
86       -iname "*.time" -o \
87       -iname "gem.build_complete" -o \
88       -iname "Makefile" \
89     \) \
90     -delete
92   find "${pkgdir}/${_gemdir}/extensions/" \
93     -type f \
94     \( \
95       -iname "mkmf.log" -o \
96       -iname "gem_make.out" \
97     \) \
98     -delete
100   install -D --mode=644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
101   install -D --mode=644 *.md --target-directory "${pkgdir}/usr/share/doc/${pkgname}"