summaryrefslogtreecommitdiff
path: root/libre/ruby/PKGBUILD
blob: a837f85b4489dc7450833a74361965ca683367b8 (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
# Maintainer (Arch): Thomas Dziedzic <gostrc@gmail.com>
# Contributor (Arch): Allan McRae <allan@archlinux.org>
# Contributor (Arch): John Proctor <jproctor@prium.net>
# Contributor (Arch): Jeramy Rutley <jrutley@gmail.com>

# Maintainer: fauno <fauno@parabola.nu>
# Contributor: Daniel Milewski <niitotantei@riseup.net>
# Contributor: André Silva <emulatorman@parabola.nu>
# Contributor: Luke Shumaker <lukeshu@parabola.nu>

pkgname=(ruby ruby-docs)
pkgver=2.4.1
_jsonver=1.8.1
pkgrel=3.parabola2
_srcrel=1 # increment this to rebuild the sourceball without bumping pkgver
arch=(i686 x86_64 armv7h)
url='http://www.ruby-lang.org/en/'
license=(BSD2 custom)
makedepends=(gdbm openssl libffi doxygen graphviz libyaml ttf-dejavu tk)
options=(!emptydirs)
source=(https://repo.parabola.nu/other/ruby-libre/ruby-${pkgver}-libre${_srcrel}.tar.gz
        gemrc)
sha1sums=('2f110797f2188c05231e4a5c11aa1a30493f2c0f'
          'dc536754c8fac2c3d82965c5a708cd8f79562d98')

mkdepends=('ruby') # for 'gem build'
mksource=(https://cache.ruby-lang.org/pub/ruby/${pkgver:0:3}/ruby-${pkgver}.tar.xz
          ruby-${pkgver:0:3}-libre.patch
          json-${_jsonver}.tar.gz::https://github.com/flori/json/archive/v${_jsonver}.tar.gz
          json-${_jsonver}-libre.patch)
mksha512sums=('e6fd290b6edd166348b70f0f1c56f7ed9d956c4c1eb91d97d0548041ca4196b9b75ec1ad35c745bdbfd4de195899093e7205d7f02b014ecf1c48e6f31cf25903'
              'fbb204bfbd1866b03f6e57b4d260fa8a62de9391d340ba081e8bf017b25f848b229ae54bedc2d4adff78e0195da400319aa3bf42716f1e67135895d436e7bdae'
              '58906415c3f9a573950fe9c0606f808c8b9b1198ac08cd995fbec03ab1e315a5cff504245958a303dabf0e0fb3466abfd35f3c3b536161f805f1abccc9f5ccb6'
              '3e3e2d48522fea84855e5305e08e7f8cc2ec7a2643c8882bc0a260c821ccdb16e70590d7ceec916d0d09297486b3c5bb6a1b4b31f670ec4ede72a429255db317')

mksource() {
  # First build a libre version of json-${_jsonver}.gem
  cd "$srcdir/json-${_jsonver}"
  rm -rf ext
  patch -p1 -i ../json-${_jsonver}-libre.patch
  gem build json.gemspec
  mv json-${_jsonver}.gem ..

  # Clean up the original json sources
  cd "$srcdir"
  rm -rf "json-${_jsonver}"

  # Modify the Ruby sources to use the json .gem we created above.
  cd "$srcdir/ruby-${pkgver}"
  # remove the supplied json version
  rm -rv ext/json test/json
  patch -p1 -i ../ruby-${pkgver:0:3}-libre.patch
  # and insert ours
  cp ../"json-${_jsonver}.gem" gems/
  mkdir -p gems/json-${_jsonver}
  cd gems/json-${_jsonver}
  bsdtar xqOf ../json-${_jsonver}.gem data.tar.gz | bsdtar xzf -
}

build() {
  cd ruby-${pkgver}

  PKG_CONFIG=/usr/bin/pkg-config ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --sharedstatedir=/var/lib \
    --libexecdir=/usr/lib/ruby \
    --enable-shared \
    --disable-rpath \
    --with-dbm-type=gdbm_compat

  make
}

check() {
  cd ruby-${pkgver}

  make test
}

package_ruby() {
  pkgdesc='An object-oriented language for quick and easy programming'
  depends=(gdbm openssl libffi libyaml gmp zlib)
  optdepends=(
      'ruby-docs: Ruby documentation'
      'tk: for Ruby/TK'
  )
  provides=(rubygems rake)
  conflicts=(rake)
  backup=(etc/gemrc)
  install=ruby.install

  cd ruby-${pkgver}

  make DESTDIR="${pkgdir}" install-nodoc

  install -D -m644 ${srcdir}/gemrc "${pkgdir}/etc/gemrc"

  install -D -m644 COPYING "${pkgdir}/usr/share/licenses/ruby/LICENSE"
  install -D -m644 BSDL "${pkgdir}/usr/share/licenses/ruby/BSDL"
}

package_ruby-docs() {
  pkgdesc='Documentation files for ruby'

  cd ruby-${pkgver}

  make DESTDIR="${pkgdir}" install-doc install-capi

  install -D -m644 COPYING "${pkgdir}/usr/share/licenses/ruby-docs/LICENSE"
  install -D -m644 BSDL "${pkgdir}/usr/share/licenses/ruby-docs/BSDL"
}