Subject: [PATCH] testing/racket: upgrade from 6.12 to 7.4

From: zaoqi <[email-masked]>
Date: Sun, 11 Aug 2019 01:02:27 +0800

---
 testing/racket/APKBUILD                   | 18 +++----
 testing/racket/libressl.patch             | 55 +++------------------
 testing/racket/makefile-fix-bashism.patch | 38 --------------
 testing/racket/musl-fixes.patch           | 11 +++--
 testing/racket/paxmark.patch              | 60 ++++++++++++-----------
 5 files changed, 53 insertions(+), 129 deletions(-)
 delete mode 100644 testing/racket/makefile-fix-bashism.patch

diff --git a/testing/racket/APKBUILD b/testing/racket/APKBUILD
index 343019ed..04bb7590 100644
--- a/testing/racket/APKBUILD
+++ b/testing/racket/APKBUILD
@@ -2,11 +2,11 @@
 # Maintainer: Jakub Jirutka <[email-masked]>
 #
 # TODO: Separate packages into subpackages?
-# TODO: Install even packages from the full tarball?
+# TODO: Add racket-full? Install even packages from the full tarball?
 # TODO: Figure out how to run tests.
 pkgname=racket
-pkgver=6.12
-pkgrel=3
+pkgver=7.4
+pkgrel=1
 pkgdesc="A general purpose programming language in the Lisp-Scheme family"
 url="https://racket-lang.org/"
 arch="all"
@@ -14,10 +14,9 @@ license="LGPL-3.0-or-later MIT"
 depends="ca-certificates libressl2.7-libcrypto libressl2.7-libssl"
 makedepends="chrpath libffi-dev libucontext-dev paxmark"
 subpackages="$pkgname-dev $pkgname-doc"
-source="https://download.racket-lang.org/releases/$pkgver/installers/$pkgname-minimal-$pkgver-src.tgz
+source="https://mirror.racket-lang.org/installers/$pkgver/$pkgname-minimal-$pkgver-src-builtpkgs.tgz
 	paxmark.patch
 	musl-fixes.patch
-	makefile-fix-bashism.patch
 	libressl.patch"
 builddir="$srcdir/$pkgname-$pkgver"
 
@@ -65,8 +64,7 @@ package() {
 	rm -Rf usr/share/applications
 }
 
-sha512sums="f342f0e475abb8ceb692cc66cde8d0741f0b106721210d427b569453ead642bbb951dd182378bcb468c53e170c2691cf05a64ccd49fc5a701ff24047874eb82a  racket-minimal-6.12-src.tgz
-ff7804e37cbab237921f7d4c334f6cbb2909e9284b7b2cec1dfd3e73ec189b8ecf0cb0cabd1abedb09020f2a57ad4c32088ea73e5cb71afdafce39a7a718b10c  paxmark.patch
-6af0ae984ac54f167f0513795905e9dc845e1c1554935f73958d4e21c5fad35eca791866cfdf94dfcee586ec28335d90520d769010c63cd6ab528e6be3f2c21c  musl-fixes.patch
-1a96718e6a065bd08f0ff046e799fd4d7657d99789b2cdda8cf7cdd8c2d91742dd34fb43f4c6fabde89a764e073bdecdd96e2caeee49feaac242d30b17d6422b  makefile-fix-bashism.patch
-780f9d0336acfe887a30ed044df93adbc4a09a5154b5edf034b225a7de350788077820d9f8cc633d2527015e30348bd7b083991e77caa88871ddc5cf899d07f3  libressl.patch"
+sha512sums="47730d7c33f213d4882f1a34089d23e4d3bdfac2e72f12f9ffe1e9ebef041576b2fd03b164fa5172c626735ba935da608ffc4c0cafbb8b02ce7538020d911e01  racket-minimal-7.4-src-builtpkgs.tgz
+9812acad82084d884b9944d5ed2e61b34b645d822c476c160b42b0d09f84c6292410457c13ae12cb44114ef26dab974f877573d6fef050449d97738b08aa411a  libressl.patch
+c0fc64b99b4fb97ecfb7ad6f2192af76c4473450a06cba2e12174d820d10c3a39b5734daa8b7212d36399df884bec8b3691557990068b02f440dd9c298e3db37  musl-fixes.patch
+e76287591274b01d8038f4c0425dbf804d6d1710bf91abf6dbbbcd6951fcf3df21476b6f28565b81878f479ff7018a362af3a7161496fd94690b5a0bede082cc  paxmark.patch"
diff --git a/testing/racket/libressl.patch b/testing/racket/libressl.patch
index 0b2e83b6..4456b430 100644
--- a/testing/racket/libressl.patch
+++ b/testing/racket/libressl.patch
@@ -1,53 +1,14 @@
-diff -ru racket-6.12.orig/collects/openssl/libcrypto.rkt racket-6.12/collects/openssl/libcrypto.rkt
---- racket-6.12.orig/collects/openssl/libcrypto.rkt	2017-01-07 15:34:14.000000000 +0200
-+++ racket-6.12/collects/openssl/libcrypto.rkt	2018-04-09 09:42:53.241968324 +0300
-@@ -37,7 +37,13 @@
-     ;; Other specific known versions
-     "1.0.1k" "1.0.1j" "1.0.1g" "1.0.1e"
+diff -ru racket-7.4.orig/collects/openssl/libcrypto.rkt racket-7.4/collects/openssl/libcrypto.rkt
+--- racket-7.4.orig/collects/openssl/libcrypto.rkt	2019-08-10 22:33:51.000000000 +0800
++++ racket-7.4/collects/openssl/libcrypto.rkt	2019-08-10 22:37:46.000000000 +0800
+@@ -48,6 +48,11 @@
      "1.0" "1.0.0" "1.0.0e" "1.0.0d" "1.0.0c" "1.0.0b" "1.0.0a"
--    "0.9.8e" "0.9.8b" "0.9.8" "0.9.7"))
-+    "0.9.8e" "0.9.8b" "0.9.8" "0.9.7"
-+
+     "0.9.8e" "0.9.8b" "0.9.8" "0.9.7"
+
 +    ;; LibreSSL
 +    "43"  ;; 2.7.2+
 +    "42"  ;; 2.6.3+
 +    "41"  ;; 2.5.5+
-+))
- 
- (define libcrypto-load-fail-reason #f)
- 
-diff -ru racket-6.12.orig/collects/openssl/libssl.rkt racket-6.12/collects/openssl/libssl.rkt
---- racket-6.12.orig/collects/openssl/libssl.rkt	2016-04-15 23:33:56.000000000 +0300
-+++ racket-6.12/collects/openssl/libssl.rkt	2018-04-09 09:43:20.028984576 +0300
-@@ -9,6 +9,25 @@
- (provide libssl
-          libssl-load-fail-reason)
- 
-+(define libssl-versions
-+  '(;; Versionless (eg from devel pkg)
-+    ""
-+
-+    ;; Compatibility-based version / SONAME
-+    "10"     ;; Fedora
-+    "1.0.0"  ;; Debian, Ubuntu
-+
-+    ;; Other specific known versions
-+    "1.0.1k" "1.0.1j" "1.0.1g" "1.0.1e"
-+    "1.0" "1.0.0" "1.0.0e" "1.0.0d" "1.0.0c" "1.0.0b" "1.0.0a"
-+    "0.9.8e" "0.9.8b" "0.9.8" "0.9.7"
-+
-+    ;; LibreSSL
-+    "45"  ;; 2.7.2+
-+    "44"  ;; 2.6.3+
-+    "43"  ;; 2.5.3+
-+))
 +
- (define libssl-load-fail-reason #f)
- 
- ;; We need to declare because they might be distributed with PLT Scheme
-@@ -28,4 +47,4 @@
-                         (lambda (x)
-                           (set! libssl-load-fail-reason (exn-message x))
-                           #f)])
--         (ffi-lib libssl-so openssl-lib-versions))))
-+         (ffi-lib libssl-so libssl-versions))))
+     ;; Known versions for *BSD variants
+     "111"))
diff --git a/testing/racket/makefile-fix-bashism.patch b/testing/racket/makefile-fix-bashism.patch
deleted file mode 100644
index 4f3ebbcf..00000000
--- a/testing/racket/makefile-fix-bashism.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 2ad51be9ccb1f0717732875edbb1bb0b33caa2a2 Mon Sep 17 00:00:00 2001
-From: Jakub Jirutka <[email-masked]>
-Date: Thu, 15 Mar 2018 01:24:49 +0100
-Subject: [PATCH] Fix bashism in Makefile for better portability
-
-Syntax `[[ "foo" != /* ]]` is not defined by POSIX Shell Command
-Language. It's supported only by ksh, Bash and ZSH. Other POSIX
-shells, such as ash or dash, does not support it.
-
-This patch replaces this problematic syntax with simple case statement
-that is supported by all POSIX-sh compatible shells, including (but not
-limited to) ash, bash, dash, ZSH.
-
-Upstream-Issue: https://github.com/racket/racket/pull/1990
----
- racket/src/Makefile.in | 9 ++++-----
- 1 file changed, 4 insertions(+), 5 deletions(-)
-
-diff --git a/racket/src/Makefile.in b/racket/src/Makefile.in
-index 76483c1793..24c2e5aeba 100644
---- a/src/Makefile.in
-+++ b/src/Makefile.in
-@@ -109,11 +109,10 @@ plain-install:
- 	$(MAKE) plain-install-@MAIN_VARIANT@
- 
- install-common-first:
--	if [ "$(DESTDIR)" != "" ]; then \
--          if [[ "$(DESTDIR)" != /* ]]; then \
--            echo "expected an absolute path for DESTDIR; given: $(DESTDIR)"; exit 1; \
--          fi; \
--        fi
-+	case "$(DESTDIR)" in \
-+	  "" | /*) ;; \
-+	  *) echo "expected an absolute path for DESTDIR; given: $(DESTDIR)"; exit 1;; \
-+        esac
- 	mkdir -p $(ALLDIRINFO)
- 
- install-common-middle:
diff --git a/testing/racket/musl-fixes.patch b/testing/racket/musl-fixes.patch
index 32eaad0c..30902317 100644
--- a/testing/racket/musl-fixes.patch
+++ b/testing/racket/musl-fixes.patch
@@ -14,13 +14,14 @@ Resources:
   * https://github.com/NixOS/nixpkgs/pull/31017
   * https://github.com/racket/racket/pull/1886
 
---- a/collects/compiler/private/xform.rkt
---- a/collects/compiler/private/xform.rkt
-@@ -924,6 +924,7 @@
+diff -ru racket-7.4.orig/collects/compiler/private/xform.rkt racket-7.4/collects/compiler/private/xform.rkt
+--- racket-7.4.orig/collects/compiler/private/xform.rkt	2019-08-10 22:33:51.000000000 +0800
++++ racket-7.4/collects/compiler/private/xform.rkt	2019-08-10 22:40:24.000000000 +0800
+@@ -930,6 +930,7 @@
                 |GetStdHandle| |__CFStringMakeConstantString|
                 _vswprintf_c
  	       malloc strdup
-+	       __FLOAT_BITS __DOUBLE_BITS ; musl
-                
++         __FLOAT_BITS __DOUBLE_BITS ; musl
+
                 scheme_make_small_bignum scheme_make_small_rational scheme_make_small_complex))
          (define non-functions-table
diff --git a/testing/racket/paxmark.patch b/testing/racket/paxmark.patch
index 6f70d086..f6ecf5cc 100644
--- a/testing/racket/paxmark.patch
+++ b/testing/racket/paxmark.patch
@@ -1,9 +1,10 @@
 This is nasty and quite desperate hack to make Racket built on system
 with Grsecurity/PaX. Downstream patch only.
 
+diff --git a/src/Makefile.in b/src/Makefile.in
 --- a/src/Makefile.in
 +++ b/src/Makefile.in
-@@ -28,9 +28,9 @@
+@@ -28,9 +28,9 @@ ICP = @ICP@
  # but it can also redirect to an existing Racket executable
  # that is the same as the version being built (which is
  # useful for cross-compilation, for example).
@@ -13,39 +14,51 @@ with Grsecurity/PaX. Downstream patch only.
 +RUN_THIS_RACKET_CGC = paxmark m racket/racket@CGC@ && racket/racket@CGC@
 +RUN_THIS_RACKET_MMM = paxmark m racket/racket@MMM@ && racket/racket@MMM@
 +RUN_THIS_RACKET_MAIN_VARIANT = paxmark m racket/racket@MAIN_VARIANT@ && racket/racket@MAIN_VARIANT@
- 
+
  ALLDIRINFO = "$(DESTDIR)$(bindir)" \
               "$(DESTDIR)$(collectsdir)" \
+diff --git a/src/lt/ltmain.sh b/src/lt/ltmain.sh
+--- a/src/lt/ltmain.sh
++++ b/src/lt/ltmain.sh
+@@ -5453,6 +5453,7 @@ else
+
+ 	*)
+ 	  $echo >> $output "\
++      paxmark m \"\$progdir/\$program\"
+       exec \"\$progdir/\$program\" \${1+\"\$@\"}
+ "
+ 	  ;;
+diff --git a/src/racket/Makefile.in b/src/racket/Makefile.in
 --- a/src/racket/Makefile.in
 +++ b/src/racket/Makefile.in
-@@ -46,8 +46,8 @@
- 
- # See ../../Makefile about RUN_RACKET_<X>, which 
+@@ -45,8 +45,8 @@ RACKET = racket
+
+ # See ../../Makefile about RUN_RACKET_<X>, which
  # typically redirects to RUN_THIS_RACKET_<X>:
 -RUN_THIS_RACKET_CGC = ./racket@CGC@
 -RUN_THIS_RACKET_MMM = ./racket@MMM@
 +RUN_THIS_RACKET_CGC = paxmark m ./racket@CGC@; ./racket@CGC@
 +RUN_THIS_RACKET_MMM = paxmark m ./racket@MMM@; ./racket@MMM@
- 
- MZSRC = $(srcdir)/src
- 
-@@ -199,6 +199,7 @@
- 
+
+ SETUP_BOOT = -O "info@compiler/cm" -l- setup @BOOT_MODE@ $(srcdir)/../setup-go.rkt ../compiled
+
+@@ -204,6 +204,7 @@ sproc.@LTO@: @GCDIR@/sproc.@LTO@
  racket@CGC@@NOT_OSX@@NOT_MINGW@: libracket.@LIBSFX@ libmzgc.@LIBSFX@ main.@LTO@ $(LIBRKTIO_FOR_LIB) $(SPECIALIZINGOBJECTS)
  	@MZLINKER@ -o racket@CGC@ main.@LTO@ $(SPECIALIZINGOBJECTS) libracket.@LIBSFX@ libmzgc.@LIBSFX@ $(LIBRKTIO_FOR_LIB) @LDFLAGS@ @LIBS@
+ 	@POST_LINKER@ racket@CGC@
 +	paxmark m racket@CGC@
- 
+
  mzcom@CGC@@NOT_MINGW@:
  	$(NOOP)
-@@ -402,6 +403,7 @@
+@@ -415,6 +416,7 @@ unix-install-cgc:
  	$(MAKE) unix-@INSTALL_LIBS_ENABLE@-libs-cgc
  	cd ..; $(ICP) racket/racket@CGC@ "$(DESTDIR)$(bindir)/racket@CGC_INSTALLED@"
  	cd ..; $(STRIP_DEBUG) "$(DESTDIR)$(bindir)/racket@CGC_INSTALLED@"
 +	cd ..; paxmark m "$(DESTDIR)$(bindir)/racket@CGC_INSTALLED@"
  	cd ..; cp racket/mzdyn.o "$(DESTDIR)$(libpltdir)/mzdyn.o"
  	@RUN_RACKET_CGC@ -cu "$(srcdir)/collects-path.rkt" "$(DESTDIR)$(bindir)/racket@CGC_INSTALLED@@EXE_SUFFIX@" $(DESTDIR)@COLLECTS_PATH@ $(DESTDIR)@CONFIG_PATH@
- 
-@@ -420,6 +422,7 @@
+
+@@ -433,6 +435,7 @@ unix-install-cgc-final:
  unix-install-3m:
  	cd ..; $(ICP) racket/racket@MMM@ "$(DESTDIR)$(bindir)/racket@MMM_INSTALLED@"
  	cd ..; $(STRIP_DEBUG) "$(DESTDIR)$(bindir)/racket@MMM_INSTALLED@"
@@ -53,25 +66,14 @@ with Grsecurity/PaX. Downstream patch only.
  	$(MAKE) unix-@INSTALL_LIBS_ENABLE@-libs-3m
  	cd ..; $(ICP) racket/mzdyn3m.o "$(DESTDIR)$(libpltdir)/mzdyn3m.o"
  	@RUN_RACKET_MMM@ -cu "$(srcdir)/collects-path.rkt" "$(DESTDIR)$(bindir)/racket@MMM_INSTALLED@@EXE_SUFFIX@" $(DESTDIR)@COLLECTS_PATH@ $(DESTDIR)@CONFIG_PATH@
+diff --git a/src/racket/gc2/Makefile.in b/src/racket/gc2/Makefile.in
 --- a/src/racket/gc2/Makefile.in
 +++ b/src/racket/gc2/Makefile.in
-@@ -522,6 +522,7 @@
- 
+@@ -588,6 +588,7 @@ EXTRA_OBJS_L = $(EXTRA_GMP) ../src/unwind.@LTO@ $(@FOREIGN_IF_USED@_OBJSLIB) $(L
  ../racket@MMM@@NOT_OSX@@NOT_MINGW@: main.@LTO@ ../libracket3m.@LIBSFX@ $(LIBRKTIO_FOR_LIB)
  	cd ..; @MZLINKER@ -o racket@MMM@ @PROFFLAGS@ gc2/main.@LTO@ libracket3m.@LIBSFX@ $(LIBRKTIO_UP_FOR_LIB) @LDFLAGS@ $(LIBS)
+ 	@POST_LINKER@ ../racket@MMM@
 +	paxmark m ../racket@MMM@
- 
+
  # The above "cd .." prevents a problem with libtool's generated script in --enable-shared mode,
  #  at least for Mac OS X. Beware of changing LIBS or LDFLAGS to inclucde something with a relative
-
---- a/src/lt/ltmain.sh
-+++ b/src/lt/ltmain.sh
-@@ -5453,6 +5453,7 @@
- 
- 	*)
- 	  $echo >> $output "\
-+      paxmark m \"\$progdir/\$program\"
-       exec \"\$progdir/\$program\" \${1+\"\$@\"}
- "
- 	  ;;
-	  ;;
-- 
2.22.0