summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2021-07-24 02:24:22 -0400
committerbill-auger <mr.j.spam.me@gmail.com>2021-07-24 02:43:07 -0400
commit60f547f8e15074cc1599dab66d2043edd0d4498f (patch)
tree7618149c1d6dad1f4177c5db851c8237d109d148
parente04da0b16166baa71c6e77691e9ccefea7e616a4 (diff)
[ruby2.7]: add package
-rw-r--r--libre/ruby2.7/PKGBUILD103
-rw-r--r--libre/ruby2.7/json-libre.patch32
-rw-r--r--libre/ruby2.7/ruby-add-json_pure.patch23
-rw-r--r--libre/ruby2.7/ruby-remove-json-ext.patch105
4 files changed, 263 insertions, 0 deletions
diff --git a/libre/ruby2.7/PKGBUILD b/libre/ruby2.7/PKGBUILD
new file mode 100644
index 000000000..e2dd77c17
--- /dev/null
+++ b/libre/ruby2.7/PKGBUILD
@@ -0,0 +1,103 @@
+# Contributor (arch): Thomas Dziedzic <gostrc@gmail.com>
+# Contributor: Allan McRae <allan@archlinux.org>
+# Contributor: John Proctor <jproctor@prium.net>
+# Contributor: 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=ruby2.7
+pkgver=2.7.3
+_json_ver=2.3.0
+pkgrel=1
+pkgrel+=.parabola1
+arch=(x86_64)
+arch+=(i686 armv7h)
+url='https://www.ruby-lang.org/en/'
+license=(BSD custom)
+license=(${license[*]/BSD/BSD2/})
+depends=(libxcrypt gdbm openssl libffi libyaml gmp zlib)
+optdepends=(
+ 'tk: for Ruby/TK'
+)
+makedepends=(tk)
+provides=(ruby)
+options=(!emptydirs)
+source=(https://cache.ruby-lang.org/pub/ruby/${pkgver:0:3}/ruby-${pkgver}.tar.xz)
+source+=(json-${_json_ver}.tar.gz::https://github.com/flori/json/archive/v${_json_ver}.tar.gz
+ json-libre.patch
+ ruby-remove-json-ext.patch
+ ruby-add-json_pure.patch)
+sha512sums=('b755d418b3bab2f9f6a8893afd13869269f17065643dde78b9e85ae3538a6d0617893db6e9c3908e00a40c7577a5c912a7c822d8f245cdcfb857be76dfb66c1e')
+sha512sums+=('0cda44a77212748d9513e61314dfbc7c0cf82beebcc56eb8b043e4ada698bc475502100389b80fa5c9090341fd1c6d2841fc5c9332e520f1c8dd1084ca505379'
+ '582017bd0f98878c0ac6f4625854422662d83ae6274a34762082a720052023780dceb17694b1f4e18d9a0dcbb525990341176eac31040aa63099a8b3a8d52071'
+ 'f952db3774f5eb5bc6c445b690262a883553b51f42dfdcc802c6de5bc2b2907d73472ede38d9d7a1b8efe8fc9cd00e64d986d78353f0a1c86497f71ebd522c48'
+ '9ff8a2ec9fdecd05fd506ed6f977dcd483e47611dc6bbe6c4622100a2071c0f6c7b3f813a94b73bebb9f0ed7fe9f6257289cdf971030ad525a3c8a0d065b09c2')
+
+
+prepare() {
+ cd "$srcdir/json-${_json_ver}"
+
+ # 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 ruby-remove-json-ext.patch"
+ rm -r ext/json test/json
+ patch -p1 -i ../ruby-remove-json-ext.patch
+
+ # and insert the json_pure lib instead
+ echo "applying ruby-add-json_pure.patch"
+ cp -r ../json-${_json_ver}/lib/* -t lib/
+ cp ../json-${_json_ver}/json_pure.gemspec -t lib/json/
+ cp -rT ../json-${_json_ver}/tests test/json
+ patch -p1 -i ../ruby-add-json_pure.patch
+
+ # Delete original json sources
+ cd "$srcdir"
+ rm -rf "json-${_json_ver}"
+}
+
+build() {
+ cd ruby-${pkgver}
+
+ ./configure \
+ --prefix=/usr \
+ --program-suffix=-2.7 \
+ --with-soname=ruby-2.7 \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --sharedstatedir=/var/lib \
+ --libexecdir=/usr/lib/ruby \
+ --enable-shared \
+ --disable-rpath \
+ --with-dbm-type=gdbm_compat \
+ --disable-install-doc
+
+ make
+}
+
+package() {
+ cd ruby-${pkgver}
+
+ make DESTDIR="${pkgdir}" install-nodoc
+
+ install -D -m644 COPYING "${pkgdir}/usr/share/licenses/ruby2.7/LICENSE"
+ install -D -m644 BSDL "${pkgdir}/usr/share/licenses/ruby2.7/BSDL"
+
+ # remove files conflicting with 'ruby' package
+ rm -r "$pkgdir"/usr/share/man/
+}
diff --git a/libre/ruby2.7/json-libre.patch b/libre/ruby2.7/json-libre.patch
new file mode 100644
index 000000000..04eced89d
--- /dev/null
+++ b/libre/ruby2.7/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.7/ruby-add-json_pure.patch b/libre/ruby2.7/ruby-add-json_pure.patch
new file mode 100644
index 000000000..5529cc58c
--- /dev/null
+++ b/libre/ruby2.7/ruby-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.7/ruby-remove-json-ext.patch b/libre/ruby2.7/ruby-remove-json-ext.patch
new file mode 100644
index 000000000..243d4fb3e
--- /dev/null
+++ b/libre/ruby2.7/ruby-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
+ monitor/lib
+ monitor/monitor.c
+ nkf/lib
+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