summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0e56017bf0392d9e7a39167403582bc35fda39fd (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Maintainer: Carl Smedstad <carl.smedstad at protonmail dot com>
# Contributor: Anatoly Bashmakov <anatoly at posteo dot net>

pkgname=ruby-prawn-table
_name=${pkgname#ruby-}
pkgver=0.2.2
pkgrel=5
pkgdesc="Provides support for tables in Prawn"
arch=(any)
url="https://github.com/prawnpdf/prawn-table"
license=(
  GPL2
  GPL3
  custom:RUBY
)
depends=(
  ruby
  ruby-prawn
)
makedepends=(
  ruby-yard
  rubygems
)
checkdepends=(
  ruby-mocha
  ruby-pdf-inspector
  ruby-rspec
  ruby-simplecov
)
options=(!emptydirs)
source=(
  "$url/archive/refs/tags/$pkgver.tar.gz"
  "remove-failing-tests.patch"
)
sha256sums=(
  '25f0bcdc6ffbb0ff3746f96d02e083cbbaf1c71cd928176a23b2bd5e77ccc377'
  '68873f4ea2242f16d1bc25c026c83739935133b907f272f9e3ddc4632037d492'
)

_archive="$_name-$pkgver"

prepare() {
  cd "$_archive"

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

  # sed --in-place '/rspec/d' "$_name.gemspec"
  sed --in-place '/prawn-manual_builder/d' "$_name.gemspec"
  sed --in-place 's/2.14.1/>= 2.15.1/' "$_name.gemspec"

  # Remove 5 failint tests - 4 of them due to depending on image not packaged
  # with Prawn, 1 due incompatible with recent rspec.
  patch --strip=1 --input="$srcdir/remove-failing-tests.patch"
}

build() {
  cd "$_archive"

  local _gemdir
  _gemdir="$(gem env gemdir)"

  gem build "$_name.gemspec"

  gem install \
    --local \
    --verbose \
    --ignore-dependencies \
    --no-user-install \
    --install-dir "tmp_install/$_gemdir" \
    --bindir "tmp_install/usr/bin" \
    "$_name-$pkgver.gem"

  # Remove unrepreducible files
  rm --force --recursive --verbose \
    "tmp_install/$_gemdir/cache/" \
    "tmp_install/$_gemdir/gems/$_name-$pkgver/vendor/" \
    "tmp_install/$_gemdir/doc/$_name-$pkgver/ri/ext/"

  find "tmp_install/$_gemdir/gems/" \
    -type f \
    \( \
    -iname "*.o" -o \
    -iname "*.c" -o \
    -iname "*.so" -o \
    -iname "*.time" -o \
    -iname "gem.build_complete" -o \
    -iname "Makefile" \
    \) \
    -delete

  find "tmp_install/$_gemdir/extensions/" \
    -type f \
    \( \
    -iname "mkmf.log" -o \
    -iname "gem_make.out" \
    \) \
    -delete
}

check() {
  cd "$_archive"

  # Avoid depending on rubocop
  # sed --in-place '/rubocop/d' Rakefile "$_name.gemspec"

  local _gemdir
  _gemdir="$(gem env gemdir)"

  GEM_HOME="tmp_install/$_gemdir" rspec
}

package() {
  cd "$_archive"

  cp --archive --verbose tmp_install/* "$pkgdir"

  install --verbose -D --mode=0644 COPYING --target-directory "$pkgdir/usr/share/licenses/$pkgname"
  install --verbose -D --mode=0644 LICENSE --target-directory "$pkgdir/usr/share/licenses/$pkgname"
  install --verbose -D --mode=0644 ./*.md --target-directory "$pkgdir/usr/share/doc/$pkgname"
}