summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1e26dd28128fb7d19eeeb43865d543474e1e3623 (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
#!/bin/bash
# Maintainer: Fredrick R. Brennan <copypaste@kittens.ph>
_pkgname=id3tag
pkgname=ruby-$_pkgname
pkgver=1.1.0
pkgrel=3
pkgdesc="Native Ruby ID3 tag reader that aims for 100% coverage of ID3v2.x and ID3v1.x standards"
arch=("any")
url="https://github.com/krists/id3tag"
license=('MIT')
checkdepends=(ruby-rspec)
depends=(ruby ruby-nokogiri)
source=("$pkgname-$pkgver.zip::https://github.com/krists/$_pkgname/archive/refs/tags/v$pkgver.zip")
b2sums=('70a4ac60683d8a9b5025e720370b4c8911352d48e6b48caeda231b33c983476d3caba019a4b2d3319ab32501c8a6b18ae5548e521d731a8c12146d82557e39cd')

# Most of this file comes from https://wiki.archlinux.org/title/Ruby_package_guidelines

prepare() {
  cd "${_pkgname}-${pkgver}"

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

build() {
  cd "${_pkgname}-${pkgver}"

  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}/extensions/" \
    -type f \
    \( \
      -iname "mkmf.log" -o \
      -iname "gem_make.out" \
    \) \
    -delete
}

check() {
  GEM_HOME="tmp_install/${_gemdir}" rspec
}

package() {
  cd "${_pkgname}-${pkgver}"

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

  install --verbose -D --mode=0644 LICENSE.txt --target-directory "${pkgdir}/usr/share/licenses/${pkgname}"
  install --verbose -D --mode=0644 *.md --target-directory "${pkgdir}/usr/share/doc/${pkgname}"
  mkdir -p "${pkgdir}/usr/share/doc/${pkgname}/standard_documents"
  install --verbose -D --mode=0644 standard_documents/* --target-directory "${pkgdir}/usr/share/doc/${pkgname}/standard_documents"
}

# vim: syntax=bash