summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 66ffc77efdcc67c12301345a6a115cceb4fbd5d7 (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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# Maintainer: Carl Smedstad <carl.smedstad at protonmail dot com>
# Contributor: George Rawlinson <george@rawlinson.net.nz>
# Contributor: Daniel Nagy <danielnagy at gmx de>
# Contributor: kusakata <shohei atmark kusakata period com>

pkgname=fluentd
pkgver=1.16.4
_commit=9e4b91bb056fe93332918d1a9949cc5dfbd923fe
pkgrel=1
pkgdesc="Data collector designed to scale and simplify log management"
arch=(any)
url="https://github.com/fluent/fluentd"
license=(Apache-2.0)
depends=(
  ruby
  ruby-console
  ruby-cool.io
  ruby-http_parser.rb
  ruby-msgpack
  ruby-serverengine
  ruby-sigdump
  ruby-strptime
  ruby-tzinfo
  ruby-tzinfo-data
  ruby-webrick
  ruby-yajl-ruby
)
makedepends=(
  git
  rubygems
)
checkdepends=(
  inetutils
  procps-ng
  ruby-async
  ruby-async-http
  ruby-flexmock
  ruby-oj
  ruby-rake
  ruby-rr
  ruby-test-unit-rr
  ruby-timecop
)
optdepends=(
  'jemalloc: for a more efficient malloc implementation'
  'ruby-oj: for a faster json parser'
)
backup=(etc/fluent/fluentd.conf)
options=(!emptydirs)
install="$pkgname.install"
source=(
  "git+$url.git#commit=$_commit"
  "systemd.service"
  "tmpfiles.conf"
  "sysusers.conf"
  "unbundlify-tests.patch"
)
sha256sums=(
  'SKIP'
  'b02013a8e3895369df58557b813d260a11edf245c59afc1747971205f1b9e825'
  'ea811ec16a78cbe1248266bca6589ebaab54f75048288959641b8ef3a8ea7e1b'
  '8eca8af4df0ea2c0b954d8bf72029e7d2034b7e77f9be36d3d261630068f5674'
  '0b9b3cfb302fd849fd414e79bafe99a4009bb4dc8dcbd3a1a4b6ae7c87b653ce'
)

_archive="$pkgname"

pkgver() {
  cd "$_archive"

  git describe --tags | sed 's/^v//'
}

prepare() {
  cd "$_archive"

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

  patch --forward --strip=1 --input="$srcdir/unbundlify-tests.patch"
}

build() {
  cd "$_archive"

  local gemdir="$(gem env gemdir)"

  gem build "$pkgname.gemspec"

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

  # Remove unrepreducible files
  rm --force --recursive --verbose \
    "tmp_install/$gemdir/cache/" \
    "tmp_install/$gemdir/gems/$pkgname-$pkgver/vendor/" \
    "tmp_install/$gemdir/doc/$pkgname-$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"

  export TZ=UTC
  GEM_HOME="tmp_install/$(gem env gemdir)" rake test -v
}

package() {
  cd "$_archive"

  cp -a tmp_install/* "$pkgdir"

  install -Dm644 fluent.conf "$pkgdir/etc/fluent/fluentd.conf"

  install -Dm644 "$srcdir/systemd.service" "$pkgdir/usr/lib/systemd/system/$pkgname.service"
  install -Dm644 "$srcdir/sysusers.conf" "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"
  install -Dm644 "$srcdir/tmpfiles.conf" "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"

  install -Dm644 -t "$pkgdir/usr/share/doc/$pkgname" ./*.md
  cp -a -t "$pkgdir/usr/share/doc/$pkgname" example docs
}