Github messages for voidlinux
 help / color / mirror / Atom feed
From: Marie-Joseph <Marie-Joseph@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] racket: re-enable cross-compilation
Date: Tue, 04 Jan 2022 22:28:09 +0100	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-34853@inbox.vuxu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]

There is a new pull request by Marie-Joseph against master on the void-packages repository

https://github.com/Marie-Joseph/void-packages racket
https://github.com/void-linux/void-packages/pull/34853

racket: re-enable cross-compilation
* remove nocross
* expound precise arch support (based on Racket's Chez Scheme support)
* remove unneeded musl deps
* put documentation behind a switch (builds fine, takes too long for CI)

#### Testing the changes
- I tested the changes in this PR: **YES**

#### Local build testing
- I built this PR locally for these architectures:
  - aarch64-musl - native and cross
  - x86_64-musl - native

### Notes
Racket's architecture support is limited only by Chez Scheme. The Chez Scheme it uses supports all the architectures we do except MIPS and PowerPC64. However, when trying to cross-compile for PowerPC 32-bit musl, I found that an absolute boat load of dependencies had to be compiled first. This would make CI take way too long, so I've simply omitted all PowerPC platforms. It wasn't supported before anyway, so this is still progress.

I don't actually know for sure that building documentation would cause this to time out. However, I didn't want to risk it (it does take a really long time, I just didn't time it), and this still makes local Racket documentation more accessible than it was before. (I used local documentation heavily, so this is important to me.)


A patch file from https://github.com/void-linux/void-packages/pull/34853.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-racket-34853.patch --]
[-- Type: text/x-diff, Size: 3466 bytes --]

From 479eed894101ac9728ecfea5afd13a9882e0fe71 Mon Sep 17 00:00:00 2001
From: jts <jtsims@pm.me>
Date: Tue, 4 Jan 2022 21:18:42 +0000
Subject: [PATCH] racket: re-enable cross-compilation

* remove nocross
* expound precise arch support (based on Racket's ChezScheme support)
* remove unneeded musl deps
* put documentation behind a switch (builds fine, takes too long)
---
 srcpkgs/racket/template | 59 ++++++++++++++++++++++++++---------------
 1 file changed, 37 insertions(+), 22 deletions(-)

diff --git a/srcpkgs/racket/template b/srcpkgs/racket/template
index fa837398b7c9..94699fa05eb3 100644
--- a/srcpkgs/racket/template
+++ b/srcpkgs/racket/template
@@ -1,10 +1,14 @@
 # Template file for 'racket'
 pkgname=racket
 version=8.3
-revision=1
+revision=2
+archs="~mips* ~ppc*"
+wrksrc=${pkgname}-${version}
 build_wrksrc=src
 build_style=gnu-configure
-configure_args="--enable-useprefix --disable-docs"
+build_options="docs"
+desc_option_docs="Build documentation. Disabled by default for time."
+configure_args="--enable-useprefix $(vopt_enable docs)"
 hostmakedepends="gsfonts"
 makedepends="sqlite-devel gtk+3-devel"
 depends="gtk+3 libssl1.1"
@@ -15,28 +19,38 @@ homepage="http://racket-lang.org/"
 distfiles="http://mirror.racket-lang.org/installers/${version}/${pkgname}-${version}-src.tgz"
 checksum=33dd0c20846c7c5fdf84af2dc250f765104ed33b5091be152a9f68f1e2541457
 nostrip=yes
-nocross=yes
 
 if [ "$CROSS_BUILD" ]; then
-	configure_args+=" --enable-racket=/usr/bin/racket"
+	_chezscheme_path="${XBPS_BUILDDIR}/${wrksrc}/${build_wrksrc}"
+
+	configure_args+=" --enable-racket=/usr/bin/racket
+ --enable-scheme=${_chezscheme_path}"
 	hostmakedepends+=" racket sqlite-devel"
-fi
 
-case "$XBPS_TARGET_MACHINE" in
-ppc*)
-	broken="hangs or segfaults";;
-*-musl)
-	makedepends+=" libucontext-devel";;
-esac
+	# Build ChezScheme for the host so we can use it to build Racket
+	# Using "--enable-racket=auto" above selects the wrong compiler toolchain
+	pre_build() {
+		_correct_position=$(pwd) # Make sure we don't get lost
+		cd ${_chezscheme_path}/ChezScheme
 
-pre_configure() {
-	case "$XBPS_TARGET_MACHINE" in
-	*-musl)
-		export CFLAGS+=" -D_GNU_SOURCE"
-		export LIBS+=" -lucontext"
-		;;
-	esac
-}
+		# If this builds the wrong arch, Racket's automatic
+		# arch detection for the ChezScheme build has failed.
+		# See <Racket sourcedir>/src/ChezScheme/IMPLEMENTATION.md "Build System"
+		# and <Racket sourcedir>/src/ChezScheme/s/cmacros.ss "define-machine-types"
+		# for the "machine-type" variable that needs to be passed to rktboot/main.rkt
+		racket rktboot/main.rkt
+		env CC="gcc" \ # Make sure Chez builds natively
+		    AR="ar" \
+		    ARFLAGS="rc" \
+		    RANLIB="ranlib" \
+		    CFLAGS="-m64 -O2 -D_REENTRANT -pthread" \
+		    -LDFLAGS="-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -L/usr/lib -rdynamic" \
+		    ./configure --disable-curses --disable-x11
+		make
+
+		cd ${_correct_position}
+	}
+fi
 
 post_install() {
 	vlicense LICENSE-libscheme.txt
@@ -47,9 +61,10 @@ racket-doc_package() {
 	short_desc+=" - documentation"
 	depends="racket>=${version}_${revision}"
 	pkg_install() {
-		# Remove once --disable-doc can be removed
-		echo "Documentation currently not available." \
-			> ${DESTDIR}/usr/share/doc/racket/no-doc.txt
+		if [ ! "$build_option_docs" ]; then
+			echo "Build using xbps-src with '-o docs' for documentation." \
+				> ${DESTDIR}/usr/share/doc/racket/no-doc.txt
+		fi
 		vmove usr/share/doc/racket
 	}
 }

             reply	other threads:[~2022-01-04 21:28 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04 21:28 Marie-Joseph [this message]
2022-01-05  9:37 ` Marie-Joseph
2022-01-06  8:03 ` [PR PATCH] [Updated] " Marie-Joseph
2022-01-06  8:05 ` Marie-Joseph
2022-01-06 12:05 ` Marie-Joseph
2022-01-06 12:26 ` ericonr
2022-01-09 16:38 ` leahneukirchen
2022-01-09 17:14 ` q66
2022-01-09 17:15 ` q66
2022-01-09 17:16 ` q66
2022-01-09 17:24 ` leahneukirchen
2022-01-09 17:40 ` q66
2022-01-09 17:45 ` q66
2022-01-09 18:02 ` leahneukirchen
2022-01-10 22:43 ` Marie-Joseph
2022-01-10 22:49 ` Marie-Joseph
2022-01-10 22:55 ` Marie-Joseph
2022-01-10 23:07 ` Marie-Joseph
2022-01-10 23:13 ` Marie-Joseph
2022-01-14  1:03 ` Marie-Joseph
2022-01-14  2:41 ` q66
2022-01-14  8:21 ` [PR PATCH] [Updated] " Marie-Joseph
2022-01-14  8:25 ` Marie-Joseph
2022-01-14 16:46 ` leahneukirchen
2022-01-15  6:53 ` Marie-Joseph
2022-01-15  6:56 ` Marie-Joseph
2022-01-16 14:37 ` [PR PATCH] [Merged]: " leahneukirchen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-34853@inbox.vuxu.org \
    --to=marie-joseph@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).