summaryrefslogtreecommitdiff
path: root/libre/ruby2.4/PKGBUILD
blob: 2e4a4f5457bbc1dd761f851c0d041ea0ebdcd14b (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
# Maintainer (Arch): Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor (Arch): Sergey Shatunov <me@prok.pw>
# Contributor (Arch): Jonne Haß <me@jhass.eu>
# Contributor (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: Omar Vega Ramos <ovruni@gnu.org.pe>

# Rationale for inclusion in [libre]: Problematic license of
# generator.c in bundled json extension.
#
# https://labs.parabola.nu/issues/674
# https://bugs.ruby-lang.org/issues/11844
# https://github.com/flori/json/issues/277

_rubyver=2.4
pkgname=ruby2.4
pkgver=${_rubyver}.3
_jsonver=2.0.4
pkgdesc='An object-oriented language for quick and easy programming'
pkgrel=1.parabola1
_srcrel=1 # increment this to rebuild the sourceball without bumping pkgver
arch=(i686 x86_64 armv7h)
url='http://www.ruby-lang.org/en/'
license=(BSD custom)
depends=(gdbm openssl libffi libyaml gmp zlib)
optdepends=('tk: for Ruby/TK')
makedepends=(doxygen graphviz ttf-dejavu tk)
options=(!emptydirs)
source=(https://repo.parabola.nu/other/ruby-libre/ruby-${pkgver}-libre${_srcrel}.tar.gz)
sha512sums=('bf754b0cc507d50530e64b16ff8c1a18d8dc657f00ec8e225e92f8cae8bfdf69b286c9acec70eb206883c2a3ad3ef0b593ce447441ac6893cac54f0194c40596')

mksource=(https://cache.ruby-lang.org/pub/ruby/${pkgver:0:3}/ruby-${pkgver}.tar.xz
          ruby-${pkgver}-remove-json-ext.patch
          ruby-${pkgver}-add-json_pure.patch
          json-${_jsonver}.tar.gz::https://github.com/flori/json/archive/v${_jsonver}.tar.gz
          json-${_jsonver}-libre.patch)
mksha512sums=('8bcf60c994a96787da5d743c66f5609a5a6d834d6d61243cdea7fd059197c3b10da43c99e5649be85e2f2329eedcbb1dd76e89ce3ac586be9056348f7449ed09'
              'a7b6a5a6da4861ee51f3e9a9064c39ef1e5f2efb7d969f20f93028acfa0eed0264c336fce2eb1c6a3bdcdc595ef2cf3441b5db7cd4eebf5f24e5cb4a19a7d915'
              '303172561a4ba54515fddfd9ea7e0c833e550b0ae5e9f331956f178f8c5e20aa0e3c4036251ddfd04312769ef7d71d83fde0afe64f6fa8e9052ca5a294c62927'
              '9f310b46184dec0499fd77a06d4ffade267e1a612b3f4401cf568ff10f9e096411e55498bcafdd6e9723b6c9176ac5041f68f3e3fbb9fa14cd8716bbd97b8a2a'
              '582017bd0f98878c0ac6f4625854422662d83ae6274a34762082a720052023780dceb17694b1f4e18d9a0dcbb525990341176eac31040aa63099a8b3a8d52071')

mksource() {
  # Start with the vanilla version of json
  cd "$srcdir/json-${_jsonver}"
  # Modify it so that 'json' doesn't try to load (non-free!) 'json/ext'
  rm -rf -- json.gemspec ext lib/json/ext*
  patch -p1 -i ../json-${_jsonver}-libre.patch

  # Now modify the ruby sources to include the json_pure lib instead
  # of the json ext
  cd "$srcdir/ruby-${pkgver}"
  # remove the json ext
  rm -rv ext/json test/json
  patch -p1 -i ../ruby-${pkgver}-remove-json-ext.patch
  # and insert the json_pure lib
  cp -r  ../json-${_jsonver}/lib/*             -t lib/
  cp     ../json-${_jsonver}/json_pure.gemspec -t lib/json/
  cp -rT ../json-${_jsonver}/tests                test/json
  patch -p1 -i ../ruby-${pkgver}-add-json_pure.patch

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

build() {
  cd ruby-${pkgver}

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

  make ruby
}

check() {
  cd ruby-${pkgver}

  make test
}

package() {
  cd ruby-${pkgver}

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

  install -dm755 $pkgdir/usr/bin
  install -dm755 $pkgdir/usr/lib

  for i in erb irb rdoc ri ruby testrb rake gem; do
    ln -s /opt/$pkgname/bin/$i-${_rubyver} $pkgdir/usr/bin/$i-${_rubyver}
    ln -s /opt/$pkgname/bin/$i-${_rubyver} $pkgdir/opt/$pkgname/bin/$i
  done

  ln -s /opt/$pkgname/lib/libruby.so.${_rubyver} $pkgdir/usr/lib/libruby.so.${_rubyver}

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