# Contributor (Arch): Thomas Dziedzic # Contributor (Arch): Allan McRae # Contributor (Arch): John Proctor # Contributor (Arch): Jeramy Rutley # Maintainer: Omar Vega Ramos # Contributor: Daniel Milewski # Contributor: André Silva # Contributor: Luke Shumaker # Contributor: fauno # 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.7.1 _jsonver=2.3.0 pkgrel=1 pkgrel+=.parabola1 _srcrel=1 # increment this to rebuild the sourceball without bumping pkgver arch=(x86_64) arch+=(i686 armv7h) url='https://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=('79f98b1ea98e0b10ec79da1883e8fc84d48ffe5c09ae945cbebde94365e35a589d919aac965f74d70ca7e21370ecee631ac5a8f9c4eac61d62f5aa629f27bf31' '0cda44a77212748d9513e61314dfbc7c0cf82beebcc56eb8b043e4ada698bc475502100389b80fa5c9090341fd1c6d2841fc5c9332e520f1c8dd1084ca505379' 'cce1402a062ab5a065e7554ae23189cb9c8de0acc27a4c96db5a90a52cfce37fde8d128e95b997e6df05d327d2279a8368276820dfad8b744747ea619ad187ab' '9ff8a2ec9fdecd05fd506ed6f977dcd483e47611dc6bbe6c4622100a2071c0f6c7b3f813a94b73bebb9f0ed7fe9f6257289cdf971030ad525a3c8a0d065b09c2' '582017bd0f98878c0ac6f4625854422662d83ae6274a34762082a720052023780dceb17694b1f4e18d9a0dcbb525990341176eac31040aa63099a8b3a8d52071') prepare() { cd "$srcdir/json-${_jsonver}" # Modify 'json' so that it doesn't try to load (non-free!) 'json/ext' msg "applying json-libre.patch" rm -rf -- json.gemspec ext lib/json/ext* patch -p1 -i ../json-libre.patch # Now remove the json ext from the ruby sources cd "$srcdir/ruby-${pkgver}" msg "applying remove-json-ext.patch" rm -r ext/json test/json patch -p1 -i ../remove-json-ext.patch # and insert the json_pure lib instead msg "applying add-json_pure.patch" 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 rubygems ruby-irb) optdepends=( '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" }