From 0db3954a62634a940929ee8ab290867b48d13cf7 Mon Sep 17 00:00:00 2001 From: bill-auger Date: Tue, 20 Apr 2021 12:57:51 -0400 Subject: [ruby2.6]: add package --- libre/ruby2.6/PKGBUILD | 112 ++++++++++++++++++++++++++++++++++++ libre/ruby2.6/add-json_pure.patch | 23 ++++++++ libre/ruby2.6/json-libre.patch | 32 +++++++++++ libre/ruby2.6/remove-json-ext.patch | 105 +++++++++++++++++++++++++++++++++ 4 files changed, 272 insertions(+) create mode 100644 libre/ruby2.6/PKGBUILD create mode 100644 libre/ruby2.6/add-json_pure.patch create mode 100644 libre/ruby2.6/json-libre.patch create mode 100644 libre/ruby2.6/remove-json-ext.patch diff --git a/libre/ruby2.6/PKGBUILD b/libre/ruby2.6/PKGBUILD new file mode 100644 index 000000000..d0c8f3048 --- /dev/null +++ b/libre/ruby2.6/PKGBUILD @@ -0,0 +1,112 @@ +# Contributor (arch): Thomas Dziedzic +# Contributor: Allan McRae +# Contributor: John Proctor +# Contributor: 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 + + +_rubyver=2.6 +pkgname=ruby2.6 +pkgver=2.6.7 +_jsonver=2.1.0 +pkgrel=1 +pkgrel+=.parabola1 +arch=(x86_64) +arch+=(i686 armv7h) +url='http://www.ruby-lang.org/en/' +license=(BSD custom) +license=(${license[*]/BSD/BSD2/}) +depends=(gdbm openssl libffi libyaml gmp zlib) +optdepends=('tk: for Ruby/TK') +makedepends=(tk) # no docs +options=(!emptydirs) +source=(https://cache.ruby-lang.org/pub/ruby/${pkgver:0:3}/ruby-${pkgver}.tar.xz) +source+=(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=('ba6fc0a36af2a08cf1b008851e805f59ea1047724fc7b61d4bc674533b8f123cb12fa0969e9a3f57290477c0d75f974ca7e304836e4905bd96a737211df9bd21') +sha512sums+=('0cda44a77212748d9513e61314dfbc7c0cf82beebcc56eb8b043e4ada698bc475502100389b80fa5c9090341fd1c6d2841fc5c9332e520f1c8dd1084ca505379' + 'cce1402a062ab5a065e7554ae23189cb9c8de0acc27a4c96db5a90a52cfce37fde8d128e95b997e6df05d327d2279a8368276820dfad8b744747ea619ad187ab' + '9ff8a2ec9fdecd05fd506ed6f977dcd483e47611dc6bbe6c4622100a2071c0f6c7b3f813a94b73bebb9f0ed7fe9f6257289cdf971030ad525a3c8a0d065b09c2' + '582017bd0f98878c0ac6f4625854422662d83ae6274a34762082a720052023780dceb17694b1f4e18d9a0dcbb525990341176eac31040aa63099a8b3a8d52071') + +prepare() { + cd "$srcdir/json-${_jsonver}" + + # Modify 'json' so that it doesn't try to load (non-free!) 'json/ext' + echo "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}" + echo "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 + echo "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}" +} + +build() { + cd ruby-${pkgver} + + ./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 \ + --disable-install-doc + + make +} + +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" +} diff --git a/libre/ruby2.6/add-json_pure.patch b/libre/ruby2.6/add-json_pure.patch new file mode 100644 index 000000000..5529cc58c --- /dev/null +++ b/libre/ruby2.6/add-json_pure.patch @@ -0,0 +1,23 @@ +diff --git a/doc/maintainers.rdoc b/doc/maintainers.rdoc +index 268293a..8063bbf 100644 +--- a/doc/maintainers.rdoc ++++ b/doc/maintainers.rdoc +@@ -310,6 +310,9 @@ Zachary Scott (zzak) + Nobuyuki Nakada (nobu) + https://github.com/ruby/io-console + https://rubygems.org/gems/io-console ++[ext/json] ++ NARUSE, Yui (naruse), Hiroshi SHIBATA (hsbt) ++ https://github.com/flori/json + [ext/openssl] + Kazuki Yamaguchi (rhe) + https://github.com/ruby/openssl +diff --git a/lib/json/.document b/lib/json/.document +new file mode 100644 +index 0000000000..7ae6b614de +--- /dev/null ++++ b/lib/json/.document +@@ -0,0 +1,3 @@ ++*.rb ++add/*.rb ++pure/*.rb diff --git a/libre/ruby2.6/json-libre.patch b/libre/ruby2.6/json-libre.patch new file mode 100644 index 000000000..04eced89d --- /dev/null +++ b/libre/ruby2.6/json-libre.patch @@ -0,0 +1,32 @@ +--- a/lib/json.rb 2017-04-18 04:16:28.000000000 -0500 ++++ b/lib/json.rb 2018-01-07 12:54:09.516275320 -0500 +@@ -55,9 +55,5 @@ + module JSON + require 'json/version' + +- begin +- require 'json/ext' +- rescue LoadError +- require 'json/pure' +- end ++ require 'json/pure' + end +--- a/tests/test_helper.rb 2017-04-18 04:16:28.000000000 -0500 ++++ b/tests/test_helper.rb 2018-01-07 12:55:21.359687486 -0500 +@@ -1,14 +1,5 @@ +-case ENV['JSON'] +-when 'pure' +- $:.unshift 'lib' +- require 'json/pure' +-when 'ext' +- $:.unshift 'ext', 'lib' +- require 'json/ext' +-else +- $:.unshift 'ext', 'lib' +- require 'json' +-end ++$:.unshift 'lib' ++require 'json' + + require 'test/unit' + begin diff --git a/libre/ruby2.6/remove-json-ext.patch b/libre/ruby2.6/remove-json-ext.patch new file mode 100644 index 000000000..f7111f6fd --- /dev/null +++ b/libre/ruby2.6/remove-json-ext.patch @@ -0,0 +1,105 @@ +diff --git a/LEGAL b/LEGAL +index 565c4c9..0a7cc0f 100644 +--- a/LEGAL ++++ b/LEGAL +@@ -657,31 +657,6 @@ ext/digest/sha2/sha2.h:: + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +-ext/json/generator/generator.c:: +- +- The file contains the following copyright notice. +- +- >>> +- Copyright 2001-2004 Unicode, Inc. +- +- Disclaimer:: +- +- This source code is provided as is by Unicode, Inc. No claims are +- made as to fitness for any particular purpose. No warranties of any +- kind are expressed or implied. The recipient agrees to determine +- applicability of information provided. If this file has been +- purchased on magnetic or optical media from Unicode, Inc., the +- sole remedy for any claim will be exchange of defective media +- within 90 days of receipt. +- +- Limitations on Rights to Redistribute This Code:: +- +- Unicode, Inc. hereby grants the right to freely use the information +- supplied in this file in the creation of products supporting the +- Unicode Standard, and to make copies of this file in any form +- for internal or external distribution as long as this notice +- remains attached. +- + ext/nkf/nkf-utf8/config.h:: + ext/nkf/nkf-utf8/nkf.c:: + ext/nkf/nkf-utf8/utf8tbl.c:: +diff --git a/common.mk b/common.mk +index 3706aeb..9bf5627 100644 +--- a/common.mk ++++ b/common.mk +@@ -1026,8 +1026,7 @@ srcs-ext: $(EXT_SRCS) + realclean-srcs-ext:: + $(Q)$(RM) $(EXT_SRCS) + +-EXTRA_SRCS = $(srcdir)/ext/json/parser/parser.c \ +- $(srcdir)/ext/date/zonetab.h \ ++EXTRA_SRCS = $(srcdir)/ext/date/zonetab.h \ + $(empty) + + srcs-extra: $(EXTRA_SRCS) +@@ -1140,11 +1139,6 @@ $(srcdir)/ext/ripper/ripper.c: $(srcdir)/ext/ripper/tools/preproc.rb $(srcdir)/p + Q=$(Q) ECHO=$(ECHO) RM="$(RM)" BISON=$(YACC) top_srcdir=../.. srcdir=. VPATH="$${VPATH}" \ + RUBY="$(BASERUBY)" PATH_SEPARATOR="$(PATH_SEPARATOR)" + +-$(srcdir)/ext/json/parser/parser.c: $(srcdir)/ext/json/parser/parser.rl $(srcdir)/ext/json/parser/prereq.mk +- $(ECHO) generating $@ +- $(Q) $(CHDIR) $(@D) && $(exec) $(MAKE) -f prereq.mk $(mflags) \ +- Q=$(Q) ECHO=$(ECHO) top_srcdir=../../.. srcdir=. VPATH=../../.. BASERUBY="$(BASERUBY)" +- + $(srcdir)/ext/date/zonetab.h: $(srcdir)/ext/date/zonetab.list $(srcdir)/ext/date/prereq.mk + $(ECHO) generating $@ + $(Q) $(CHDIR) $(@D) && $(exec) $(MAKE) -f prereq.mk $(mflags) \ +diff --git a/doc/maintainers.rdoc b/doc/maintainers.rdoc +index 98de9f2..268293a 100644 +--- a/doc/maintainers.rdoc ++++ b/doc/maintainers.rdoc +@@ -310,10 +310,6 @@ Zachary Scott (zzak) + Nobuyuki Nakada (nobu) + https://github.com/ruby/io-console + https://rubygems.org/gems/io-console +-[ext/json] +- NARUSE, Yui (naruse), Hiroshi SHIBATA (hsbt) +- https://github.com/flori/json +- https://rubygems.org/gems/json + [ext/openssl] + Kazuki Yamaguchi (rhe) + https://github.com/ruby/openssl +diff --git a/ext/.document b/ext/.document +index 6a49157..97e5120 100644 +--- a/ext/.document ++++ b/ext/.document +@@ -27,9 +27,6 @@ gdbm/gdbm.c + io/console/console.c + io/nonblock/nonblock.c + io/wait/wait.c +-json/generator/generator.c +-json/lib +-json/parser/parser.c + nkf/lib + nkf/nkf.c + objspace/objspace.c +diff --git a/ext/Setup b/ext/Setup +index ac79c86..e1b8d40 100644 +--- a/ext/Setup ++++ b/ext/Setup +@@ -20,9 +20,6 @@ + #io/console + #io/nonblock + #io/wait +-#json +-#json/generator +-#json/parser + #nkf + #objspace + #openssl -- cgit v1.2.2