diff options
-rw-r--r-- | testing/racket/APKBUILD | 69 | ||||
-rw-r--r-- | testing/racket/makefile-fix-bashism.patch | 38 | ||||
-rw-r--r-- | testing/racket/musl-fixes.patch | 26 | ||||
-rw-r--r-- | testing/racket/paxmark.patch | 77 |
4 files changed, 210 insertions, 0 deletions
diff --git a/testing/racket/APKBUILD b/testing/racket/APKBUILD new file mode 100644 index 0000000000..45d76094af --- /dev/null +++ b/testing/racket/APKBUILD @@ -0,0 +1,69 @@ +# Contributor: Jakub Jirutka <jakub@jirutka.cz> +# Maintainer: Jakub Jirutka <jakub@jirutka.cz> +# +# TODO: Separate packages into subpackages? +# TODO: Install even packages from the full tarball? +# TODO: Figure out how to run tests. +pkgname=racket +pkgver=6.10.1 +pkgrel=0 +pkgdesc="A general purpose programming language in the Lisp-Scheme family" +url="https://racket-lang.org/" +arch="all" +license="LGPL-3.0-or-later MIT" +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 + paxmark.patch + musl-fixes.patch + makefile-fix-bashism.patch" +builddir="$srcdir/$pkgname-$pkgver" + +prepare() { + default_prepare + cd "$builddir" + + # Remove bundled libffi to be sure that system-provided is used. + rm -Rf src/foreign/libffi +} + +build() { + cd "$builddir"/src + + export CFLAGS="$CFLAGS -D_GNU_SOURCE" + export LDFLAGS="$LDFLAGS -lucontext" + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --target=$CTARGET \ + --prefix=/usr \ + --sysconfdir=/etc \ + --enable-shared \ + --disable-docs + make +} + +package() { + cd "$builddir"/src + + make install DESTDIR="$pkgdir" + + cd "$pkgdir" + + # Remove redundant RPATH. + chrpath -d usr/bin/racket usr/lib/racket/gracket + + # Needed when running on Grsecurity kernel. + paxmark m usr/bin/racket + paxmark m usr/lib/racket/gracket + + mkdir -p usr/share/licenses/$pkgname + mv usr/share/racket/COPYING* usr/share/licenses/$pkgname/ + + rm -Rf usr/share/applications +} + +sha512sums="d342e9e3f3736ad7472e4baf6ada5e0e849377fcfeda4e38d8c0d8b11520ce97be0f37cceca36d7436858fec5fa5fc669fbe7eb0d7f97acd5fee741253c01c49 racket-minimal-6.10.1-src.tgz +ff7804e37cbab237921f7d4c334f6cbb2909e9284b7b2cec1dfd3e73ec189b8ecf0cb0cabd1abedb09020f2a57ad4c32088ea73e5cb71afdafce39a7a718b10c paxmark.patch +6af0ae984ac54f167f0513795905e9dc845e1c1554935f73958d4e21c5fad35eca791866cfdf94dfcee586ec28335d90520d769010c63cd6ab528e6be3f2c21c musl-fixes.patch +1a96718e6a065bd08f0ff046e799fd4d7657d99789b2cdda8cf7cdd8c2d91742dd34fb43f4c6fabde89a764e073bdecdd96e2caeee49feaac242d30b17d6422b makefile-fix-bashism.patch" diff --git a/testing/racket/makefile-fix-bashism.patch b/testing/racket/makefile-fix-bashism.patch new file mode 100644 index 0000000000..4f3ebbcfdd --- /dev/null +++ b/testing/racket/makefile-fix-bashism.patch @@ -0,0 +1,38 @@ +From 2ad51be9ccb1f0717732875edbb1bb0b33caa2a2 Mon Sep 17 00:00:00 2001 +From: Jakub Jirutka <jakub@jirutka.cz> +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 new file mode 100644 index 0000000000..32eaad0c54 --- /dev/null +++ b/testing/racket/musl-fixes.patch @@ -0,0 +1,26 @@ +This patch fixes error: + + env XFORM_USE_PRECOMP=xsrc/precomp.h ../racketcgc -cqu ./xform.rkt --setup . --depends --cpp "gcc -E -I./.. -I./../include -I./../../rktio -I../../rktio -Os -fomit-frame-pointer -pthread -DUSE_SENORA_GC -DMZ_USES_SHARED_LIB " --keep-lines -o xsrc/future.c ./../src/future.c + Error [GCING] 234 in ./../src/bool.c: Function mz_long_double_eqv declared __xform_nongcing__, but includes a function call at __FLOAT_BITS. + Error [GCING] 270 in ./../src/bool.c: Function double_eqv declared __xform_nongcing__, but includes a function call at __FLOAT_BITS. + xform: Errors converting + context...: + src/racket/gc2/xform-collects/compiler/priva...:8:2: xform + src/racket/gc2/xform-collects/xform/xform-mo...: [running body] + src/racket/gc2/xform.rkt: [running body] + +Resources: + * https://github.com/racket/racket/issues/1638 + * 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 @@ + |GetStdHandle| |__CFStringMakeConstantString| + _vswprintf_c + malloc strdup ++ __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 new file mode 100644 index 0000000000..6f70d086a5 --- /dev/null +++ b/testing/racket/paxmark.patch @@ -0,0 +1,77 @@ +This is nasty and quite desperate hack to make Racket built on system +with Grsecurity/PaX. Downstream patch only. + +--- a/src/Makefile.in ++++ b/src/Makefile.in +@@ -28,9 +28,9 @@ + # 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). +-RUN_THIS_RACKET_CGC = racket/racket@CGC@ +-RUN_THIS_RACKET_MMM = racket/racket@MMM@ +-RUN_THIS_RACKET_MAIN_VARIANT = racket/racket@MAIN_VARIANT@ ++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)" \ +--- a/src/racket/Makefile.in ++++ b/src/racket/Makefile.in +@@ -46,8 +46,8 @@ + + # 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 @@ + + 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@ ++ paxmark m racket@CGC@ + + mzcom@CGC@@NOT_MINGW@: + $(NOOP) +@@ -402,6 +403,7 @@ + $(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 @@ + unix-install-3m: + cd ..; $(ICP) racket/racket@MMM@ "$(DESTDIR)$(bindir)/racket@MMM_INSTALLED@" + cd ..; $(STRIP_DEBUG) "$(DESTDIR)$(bindir)/racket@MMM_INSTALLED@" ++ cd ..; paxmark m "$(DESTDIR)$(bindir)/racket@MMM_INSTALLED@" + $(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@ +--- a/src/racket/gc2/Makefile.in ++++ b/src/racket/gc2/Makefile.in +@@ -522,6 +522,7 @@ + + ../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) ++ 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+\"\$@\"} + " + ;; + ;; |