summaryrefslogtreecommitdiff
path: root/libre-testing/ruby/PKGBUILD
diff options
context:
space:
mode:
authorFreemor <freemor@freemor.ca>2019-05-24 08:42:33 -0300
committerFreemor <freemor@freemor.ca>2019-05-24 08:42:33 -0300
commite37e745aa9705938c10dc394a8fa3421907b5551 (patch)
tree2a8c129551481f5d3cf9b3bb76bd4abe84bc31cf /libre-testing/ruby/PKGBUILD
parentdf89ce36d9ba7244b7ecca622623aabfffbf56f0 (diff)
downloadabslibre-e37e745aa9705938c10dc394a8fa3421907b5551.tar.gz
abslibre-e37e745aa9705938c10dc394a8fa3421907b5551.tar.bz2
abslibre-e37e745aa9705938c10dc394a8fa3421907b5551.zip
[libre-testing/ruby] Move rubygems to an optional depend in preparation for your-system-sanity which will prevent the installation of rubygems as it is a TPPM
Diffstat (limited to 'libre-testing/ruby/PKGBUILD')
-rw-r--r--libre-testing/ruby/PKGBUILD150
1 files changed, 150 insertions, 0 deletions
diff --git a/libre-testing/ruby/PKGBUILD b/libre-testing/ruby/PKGBUILD
new file mode 100644
index 000000000..b56dd678f
--- /dev/null
+++ b/libre-testing/ruby/PKGBUILD
@@ -0,0 +1,150 @@
+# 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>
+# Contributor: Daniel Milewski <niitotantei@riseup.net>
+# Contributor: André Silva <emulatorman@hyperbola.info>
+# Contributor: Luke Shumaker <lukeshu@parabola.nu>
+# Contributor: fauno <fauno@parabola.nu>
+
+# 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
+
+
+pkgname=(ruby ruby-docs)
+pkgver=2.6.3
+_jsonver=2.1.0
+pkgrel=1
+pkgrel+=.par2
+_srcrel=1 # increment this to rebuild the sourceball without bumping pkgver
+arch=(x86_64)
+arch+=(i686 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://cache.ruby-lang.org/pub/ruby/${pkgver:0:3}/ruby-${pkgver}.tar.xz
+ json-${_jsonver}.tar.gz::https://github.com/flori/json/archive/v${_jsonver}.tar.gz
+ remove-json-ext.patch
+ add-json_pure.patch
+ json-libre.patch)
+sha512sums=('959a613f5cf5b3185a1d7a7ba0e1921166b3930f30461b391b1c9fcfe396f56dc3c736123dfc7b4e72c32a97dc5a1eb1fd7f09bcc3793a3c5526f6644ba421c8'
+ '6019cc26a0919e4d39ae0bf737b51cd9a474c74a55d25f6931ac04d61826bb810d063190a80a29810e57d7457d1a247acd82fd78de2c4c01acb7d73ee9fde603'
+ '412dff58c77f6cbc598bf49fb09cb416ad88635e9213acc60a1d103e5d093b2d80260c41e07fbc0634047c655756f5bdd8b2f5e59ae8e4b992b598b251b4c3e9'
+ '303172561a4ba54515fddfd9ea7e0c833e550b0ae5e9f331956f178f8c5e20aa0e3c4036251ddfd04312769ef7d71d83fde0afe64f6fa8e9052ca5a294c62927'
+ '582017bd0f98878c0ac6f4625854422662d83ae6274a34762082a720052023780dceb17694b1f4e18d9a0dcbb525990341176eac31040aa63099a8b3a8d52071')
+
+
+prepare() {
+ # 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-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 ../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 ../add-json_pure.patch
+
+ # Clean up the original json sources
+ cd "$srcdir"
+ rm -rf "json-${_jsonver}"
+
+ cd ruby-${pkgver}
+ # remove bundled gems, we are going to ship them as separate packages
+ rm -rf gems/
+}
+
+build() {
+ cd ruby-${pkgver}
+
+ ./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=(
+ 'rubygems: Ruby package manager'
+ 'ruby-docs: Ruby documentation'
+ 'tk: for Ruby/TK'
+ )
+
+ cd ruby-${pkgver}
+
+ make DESTDIR="${pkgdir}" install-nodoc
+
+ install -D -m644 COPYING "${pkgdir}/usr/share/licenses/ruby/LICENSE"
+ install -D -m644 BSDL "${pkgdir}/usr/share/licenses/ruby/BSDL"
+
+ rubyver=${pkgver:0:3}.0
+
+ # remove rubygems as it shipped as a separate package
+ rm -r "${pkgdir}"/usr/lib/ruby/${rubyver}/{rubygems,rubygems.rb}
+ rm "${pkgdir}"/usr/bin/gem
+
+ # remove bundler as it shipped as a separate package
+ rm -r "${pkgdir}"/usr/lib/ruby/${rubyver}/{bundler,bundler.rb}
+ rm "${pkgdir}"/usr/bin/{bundle,bundler}
+ rm "${pkgdir}"/usr/lib/ruby/gems/${rubyver}/specifications/default/bundler-*.gemspec
+ rm "${pkgdir}"/usr/share/man/man1/{bundle,bundle-*}.1
+
+ # remove bundled rdoc gem
+ rm -r "${pkgdir}"/usr/lib/ruby/${rubyver}/{rdoc,rdoc.rb}
+ rm "${pkgdir}"/usr/bin/{rdoc,ri}
+ rm "${pkgdir}"/usr/lib/ruby/gems/${rubyver}/specifications/default/rdoc-*.gemspec
+
+ # remove irb as it is a separate package now
+ rm -r "${pkgdir}"/usr/lib/ruby/${rubyver}/{irb,irb.rb}
+ rm "${pkgdir}"/usr/bin/irb
+ rm "${pkgdir}"/usr/lib/ruby/gems/${rubyver}/specifications/default/irb-*.gemspec
+ rm "${pkgdir}"/usr/share/man/man1/irb.1
+
+ # remove all bundled gems to avoid conflicts with ruby-* Arch packages
+ rm -r "${pkgdir}"/usr/lib/ruby/gems/${rubyver}/gems/*
+}
+
+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"
+
+ # sometimes it installs ruby/capi/doxygen_objdb_XXXXXXX.tmp;
+ # otherwise /usr/share/doc is empty
+ rm -rf "$pkgdir/usr/share/doc"
+}