From 479eed894101ac9728ecfea5afd13a9882e0fe71 Mon Sep 17 00:00:00 2001 From: jts 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 /src/ChezScheme/IMPLEMENTATION.md "Build System" + # and /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 } }