From bd638a8ad6140db87851a86faae89e736e148f3d Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Thu, 1 Sep 2022 17:20:31 -0400 Subject: gnu: Delete mono and dependent packages. Fixes . * gnu/packages/mono.scm: Delete file. * gnu/packages/patches/mono-mdoc-timestamping.patch: Likewise. * gnu/local.mk (GNU_SYSTEM_MODULES): De-register module file. (dist_patch_DATA): Re-register patch file. * gnu/packages/game-development.scm (fna): Delete variable. * gnu/packages/gl.scm (mojoshader-cs): Likewise. * gnu/packages/sdl.scm (sdl2-cs): Likewise. --- gnu/local.mk | 2 -- 1 file changed, 2 deletions(-) (limited to 'gnu/local.mk') diff --git a/gnu/local.mk b/gnu/local.mk index 4532dac66d..9d08fd5b28 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -417,7 +417,6 @@ GNU_SYSTEM_MODULES = \ %D%/packages/moe.scm \ %D%/packages/motti.scm \ %D%/packages/monitoring.scm \ - %D%/packages/mono.scm \ %D%/packages/moreutils.scm \ %D%/packages/mpd.scm \ %D%/packages/mp3.scm \ @@ -1529,7 +1528,6 @@ dist_patch_DATA = \ %D%/packages/patches/mpg321-gcc-10.patch \ %D%/packages/patches/module-init-tools-moduledir.patch \ %D%/packages/patches/monero-use-system-miniupnpc.patch \ - %D%/packages/patches/mono-mdoc-timestamping.patch \ %D%/packages/patches/mosaicatcher-unbundle-htslib.patch \ %D%/packages/patches/mrrescue-support-love-11.patch \ %D%/packages/patches/mtools-mformat-uninitialized.patch \ -- cgit 1.4.1 From 3baeae63b6dbfb157bf49518a591a31f1b9a4561 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Wed, 17 Aug 2022 14:33:23 -0400 Subject: gnu: Add turbovnc. * gnu/packages/vnc.scm (turbovnc): New variable. * gnu/packages/patches/turbovnc-custom-paths.patch: New file. * gnu/packages/patches/turbovnc-find-system-packages.patch: Likewise. * gnu/local.mk (dist_patch_DATA): Register them. --- gnu/local.mk | 2 + gnu/packages/patches/turbovnc-custom-paths.patch | 299 +++++++++++++++++++++ .../patches/turbovnc-find-system-packages.patch | 51 ++++ gnu/packages/vnc.scm | 193 +++++++++++++ 4 files changed, 545 insertions(+) create mode 100644 gnu/packages/patches/turbovnc-custom-paths.patch create mode 100644 gnu/packages/patches/turbovnc-find-system-packages.patch (limited to 'gnu/local.mk') diff --git a/gnu/local.mk b/gnu/local.mk index 9d08fd5b28..1b3225d075 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1885,6 +1885,8 @@ dist_patch_DATA = \ %D%/packages/patches/trytond-add-guix_trytond_path.patch \ %D%/packages/patches/ttf2eot-cstddef.patch \ %D%/packages/patches/tup-unbundle-dependencies.patch \ + %D%/packages/patches/turbovnc-custom-paths.patch \ + %D%/packages/patches/turbovnc-find-system-packages.patch \ %D%/packages/patches/tuxpaint-stamps-path.patch \ %D%/packages/patches/twinkle-bcg729.patch \ %D%/packages/patches/u-boot-allow-disabling-openssl.patch \ diff --git a/gnu/packages/patches/turbovnc-custom-paths.patch b/gnu/packages/patches/turbovnc-custom-paths.patch new file mode 100644 index 0000000000..563009c927 --- /dev/null +++ b/gnu/packages/patches/turbovnc-custom-paths.patch @@ -0,0 +1,299 @@ +From c58cdb2b7fe72685f97dee5872336f32a40fa04a Mon Sep 17 00:00:00 2001 +From: DRC +Date: Tue, 23 Aug 2022 12:02:12 -0500 +Subject: [PATCH] Improve support for distribution-specific builds + +- Rename the DRI_DRIVER_PATH and SERVER_MISC_CONFIG_PATH CMake variables + to XORG_DRI_DRIVER_PATH and XORG_REGISTRY_PATH, respectively. + +- Introduce a new CMake variable (XORG_FONT_PATH) that allows the X.org + font path to be set statically for a particular build. + +- Remove the unused RGB_DB macro definition. (That macro hasn't been + used since TurboVNC 1.2.x.) + +- Introduce a new CMake variable (TVNC_STATIC_XORG_PATHS) that forces + Xvnc and vncserver to honor the paths set using the + XKB_BASE_DIRECTORY, XKB_BIN_DIRECTORY, XORG_DRI_DRIVER_PATH, + XORG_FONT_PATH, and XORG_REGISTRY_PATH CMake variables rather than + trying to determine the appropriate values of those paths at run time. + If enabled, this option disables the TurboVNC-specific -dridir, + -registrydir, and -xkbcompdir Xvnc command-line arguments. +--- + BUILDING.md | 25 +++++++++++++++++++ + unix/CMakeLists.txt | 9 +++++++ + unix/Xvnc/programs/Xserver/dix/CMakeLists.txt | 20 +++++++++------ + unix/Xvnc/programs/Xserver/dix/registry.c | 2 +- + unix/Xvnc/programs/Xserver/glx/CMakeLists.txt | 12 ++++----- + unix/Xvnc/programs/Xserver/glx/glxdricommon.c | 2 +- + unix/Xvnc/programs/Xserver/hw/vnc/init.c | 10 +++++++- + unix/Xvnc/programs/Xserver/xkb/xkbInit.c | 2 +- + unix/vncserver.in | 13 +++++++--- + 9 files changed, 73 insertions(+), 22 deletions(-) + +diff --git a/BUILDING.md b/BUILDING.md +index 99f190b2c..b11665f95 100644 +--- a/BUILDING.md ++++ b/BUILDING.md +@@ -181,6 +181,31 @@ directly with libssl and libcrypto by adding `-DTVNC_DLOPENSSL=0` to the CMake + command line. + + ++### Distribution-Specific Build ++ ++By default, the build system builds TurboVNC binaries that can run on multiple ++O/S distributions. This involves building some of the X.org dependencies, ++which are included in the TurboVNC source tree, and statically linking TurboVNC ++with those and other dependencies. Distribution-specific dynamically-linked ++TurboVNC binaries can instead be built by changing the values of the following ++CMake variables: ++ ++- `TJPEG_INCLUDE_DIR` ++- `TJPEG_LIBRARY` ++- `TVNC_DLOPENSSL` ++- `TVNC_STATIC_XORG_PATHS` ++- `TVNC_SYSTEMLIBS` ++- `TVNC_SYSTEMX11` ++- `XKB_BASE_DIRECTORY` ++- `XKB_BIN_DIRECTORY` ++- `XORG_DRI_DRIVER_PATH` ++- `XORG_FONT_PATH` ++- `XORG_REGISTRY_PATH` ++ ++Use `ccmake` or `cmake-gui`, as described below, to view documentation for ++those variables. ++ ++ + Build Recipes + ------------- + +diff --git a/unix/CMakeLists.txt b/unix/CMakeLists.txt +index 1db927c94..6ef830a8b 100644 +--- a/unix/CMakeLists.txt ++++ b/unix/CMakeLists.txt +@@ -74,6 +74,15 @@ option(TVNC_SYSTEMLIBS + boolean_number(TVNC_SYSTEMLIBS) + report_option(TVNC_SYSTEMLIBS "System zlib/bzip2/FreeType") + ++option(TVNC_STATIC_XORG_PATHS ++ "Force vncserver and Xvnc to use the XKB base directory, XKB binary directory, X.org DRI driver path, X.org font path, and X.org registry path specified in the XKB_BASE_DIRECTORY, XKB_BIN_DIRECTORY, XORG_DRI_DRIVER_PATH, XORG_FONT_PATH, and XORG_REGISTRY_PATH CMake variables rather than detecting the appropriate paths at run time" ++ OFF) ++boolean_number(TVNC_STATIC_XORG_PATHS) ++report_option(TVNC_STATIC_XORG_PATHS "Static X.org paths") ++if(TVNC_STATIC_XORG_PATHS) ++ add_definitions(-DTURBOVNC_STATIC_XORG_PATHS) ++endif() ++ + if(NOT TVNC_SYSTEMLIBS) + add_subdirectory(${CMAKE_SOURCE_DIR}/common ${CMAKE_BINARY_DIR}/common) + endif() +diff --git a/unix/Xvnc/programs/Xserver/dix/CMakeLists.txt b/unix/Xvnc/programs/Xserver/dix/CMakeLists.txt +index 784fc48d2..19a7b28c4 100644 +--- a/unix/Xvnc/programs/Xserver/dix/CMakeLists.txt ++++ b/unix/Xvnc/programs/Xserver/dix/CMakeLists.txt +@@ -1,18 +1,22 @@ + include_directories(../Xi ../composite ../damageext ../mi ../miext/sync + ../randr ../render ../xfixes) + +-add_definitions(-DRGB_DB=\"/usr/share/X11/rgb\" +- -DCOMPILEDDEFAULTFONTPATH=\"/usr/share/X11/fonts/misc/,/usr/share/X11/fonts/Type1/,/usr/share/X11/fonts/75dpi/,/usr/share/X11/fonts/100dpi/\") ++set(DEFAULT_XORG_FONT_PATH ++ "/usr/share/X11/fonts/misc/,/usr/share/X11/fonts/Type1/,/usr/share/X11/fonts/75dpi/,/usr/share/X11/fonts/100dpi/") ++set(XORG_FONT_PATH ${DEFAULT_XORG_FONT_PATH} CACHE STRING ++ "X.org font path (default: ${DEFAULT_XORG_FONT_PATH})") ++message(STATUS "XORG_FONT_PATH = ${XORG_FONT_PATH}") ++add_definitions(-DCOMPILEDDEFAULTFONTPATH=\"${XORG_FONT_PATH}\") + + if(BITS EQUAL 64) +- set(DEFAULT_SERVER_MISC_CONFIG_PATH "/usr/lib64/xorg") ++ set(DEFAULT_XORG_REGISTRY_PATH "/usr/lib64/xorg") + else() +- set(DEFAULT_SERVER_MISC_CONFIG_PATH "/usr/lib/xorg") ++ set(DEFAULT_XORG_REGISTRY_PATH "/usr/lib/xorg") + endif() +-set(SERVER_MISC_CONFIG_PATH ${DEFAULT_SERVER_MISC_CONFIG_PATH} CACHE PATH +- "Path to miscellaneous server config files (default: ${DEFAULT_SERVER_MISC_CONFIG_PATH})") +-message(STATUS "SERVER_MISC_CONFIG_PATH = ${SERVER_MISC_CONFIG_PATH}") +-add_definitions(-DSERVER_MISC_CONFIG_PATH=\"${SERVER_MISC_CONFIG_PATH}\") ++set(XORG_REGISTRY_PATH ${DEFAULT_XORG_REGISTRY_PATH} CACHE PATH ++ "X.org registry path, which contains protocol.txt (default: ${DEFAULT_XORG_REGISTRY_PATH})") ++message(STATUS "XORG_REGISTRY_PATH = ${XORG_REGISTRY_PATH}") ++add_definitions(-DSERVER_MISC_CONFIG_PATH=\"${XORG_REGISTRY_PATH}\") + + disable_compiler_warnings() + +diff --git a/unix/Xvnc/programs/Xserver/dix/registry.c b/unix/Xvnc/programs/Xserver/dix/registry.c +index de4bf8eaf..3e8039250 100644 +--- a/unix/Xvnc/programs/Xserver/dix/registry.c ++++ b/unix/Xvnc/programs/Xserver/dix/registry.c +@@ -33,7 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + #ifdef X_REGISTRY_REQUEST + #define CORE "X11" +-#ifdef TURBOVNC ++#if defined(TURBOVNC) && !defined(TURBOVNC_STATIC_XORG_PATHS) + char registry_path[PATH_MAX] = SERVER_MISC_CONFIG_PATH "/protocol.txt"; + #define FILENAME registry_path + #else +diff --git a/unix/Xvnc/programs/Xserver/glx/CMakeLists.txt b/unix/Xvnc/programs/Xserver/glx/CMakeLists.txt +index 45f4b9635..ff8b84f6c 100644 +--- a/unix/Xvnc/programs/Xserver/glx/CMakeLists.txt ++++ b/unix/Xvnc/programs/Xserver/glx/CMakeLists.txt +@@ -10,14 +10,14 @@ if(HAVE_BACKTRACE) + endif() + + if(BITS EQUAL 64) +- set(DEFAULT_DRI_DRIVER_PATH "/usr/lib64/dri") ++ set(DEFAULT_XORG_DRI_DRIVER_PATH "/usr/lib64/dri") + else() +- set(DEFAULT_DRI_DRIVER_PATH "/usr/lib/dri") ++ set(DEFAULT_XORG_DRI_DRIVER_PATH "/usr/lib/dri") + endif() +-set(DRI_DRIVER_PATH ${DEFAULT_DRI_DRIVER_PATH} CACHE PATH +- "Path to DRI drivers (default: ${DEFAULT_DRI_DRIVER_PATH})") +-message(STATUS "DRI_DRIVER_PATH = ${DRI_DRIVER_PATH}") +-add_definitions(-DDRI_DRIVER_PATH=\"${DRI_DRIVER_PATH}\") ++set(XORG_DRI_DRIVER_PATH ${DEFAULT_XORG_DRI_DRIVER_PATH} CACHE PATH ++ "X.org DRI driver path, which contains swrast_dri.so (default: ${DEFAULT_XORG_DRI_DRIVER_PATH})") ++message(STATUS "XORG_DRI_DRIVER_PATH = ${XORG_DRI_DRIVER_PATH}") ++add_definitions(-DDRI_DRIVER_PATH=\"${XORG_DRI_DRIVER_PATH}\") + + disable_compiler_warnings() + +diff --git a/unix/Xvnc/programs/Xserver/glx/glxdricommon.c b/unix/Xvnc/programs/Xserver/glx/glxdricommon.c +index be9352b5e..a16e1bcf9 100644 +--- a/unix/Xvnc/programs/Xserver/glx/glxdricommon.c ++++ b/unix/Xvnc/programs/Xserver/glx/glxdricommon.c +@@ -258,7 +258,7 @@ glxConvertConfigs(const __DRIcoreExtension * core, + return head.next; + } + +-#ifdef TURBOVNC ++#if defined(TURBOVNC) && !defined(TURBOVNC_STATIC_XORG_PATH) + char *dri_driver_path = DRI_DRIVER_PATH; + #else + static const char dri_driver_path[] = DRI_DRIVER_PATH; +diff --git a/unix/Xvnc/programs/Xserver/hw/vnc/init.c b/unix/Xvnc/programs/Xserver/hw/vnc/init.c +index 81fbfe8b5..c8ba83772 100644 +--- a/unix/Xvnc/programs/Xserver/hw/vnc/init.c ++++ b/unix/Xvnc/programs/Xserver/hw/vnc/init.c +@@ -103,7 +103,7 @@ from the X Consortium. + #ifdef GLXEXT + extern char *dri_driver_path; + #endif +-#ifdef X_REGISTRY_REQUEST ++#if defined(X_REGISTRY_REQUEST) && !defined(TURBOVNC_STATIC_XORG_PATHS) + extern char registry_path[PATH_MAX]; + #endif + +@@ -437,6 +437,7 @@ int ddxProcessArgument(int argc, char *argv[], int i) + return 2; + } + ++#ifndef TURBOVNC_STATIC_XORG_PATHS + if (strcasecmp(argv[i], "-dridir") == 0) { + #ifdef GLXEXT + REQUIRE_ARG(); +@@ -444,6 +445,7 @@ int ddxProcessArgument(int argc, char *argv[], int i) + #endif + return 2; + } ++#endif + + if (strcasecmp(argv[i], "-geometry") == 0) { + /* -geometry WxH or W0xH0+X0+Y0[,W1xH1+X1+Y1,...] */ +@@ -644,6 +646,7 @@ int ddxProcessArgument(int argc, char *argv[], int i) + + /***** TurboVNC miscellaneous options *****/ + ++#ifndef TURBOVNC_STATIC_XORG_PATHS + if (strcasecmp(argv[i], "-registrydir") == 0) { + #ifdef X_REGISTRY_REQUEST + REQUIRE_ARG(); +@@ -651,6 +654,7 @@ int ddxProcessArgument(int argc, char *argv[], int i) + #endif + return 2; + } ++#endif + + if (strcasecmp(argv[i], "-verbose") == 0) { + LogSetParameter(XLOG_VERBOSITY, X_DEBUG); +@@ -1672,7 +1676,9 @@ void ddxUseMsg(void) + ErrorF("\nTurboVNC display options\n"); + ErrorF("========================\n"); + ErrorF("-depth D set framebuffer depth\n"); ++#ifndef TURBOVNC_STATIC_XORG_PATHS + ErrorF("-dridir dir specify directory containing the swrast Mesa driver\n"); ++#endif + ErrorF("-geometry WxH set framebuffer width & height (single-screen)\n"); + ErrorF("-geometry W0xH0+X0+Y0[,W1xH1+X1+Y1,...,WnxHn+Xn+Yn]\n"); + ErrorF(" set multi-screen geometry (see man page)\n"); +@@ -1730,7 +1736,9 @@ void ddxUseMsg(void) + + ErrorF("\nTurboVNC miscellaneous options\n"); + ErrorF("==============================\n"); ++#ifndef TURBOVNC_STATIC_XORG_PATHS + ErrorF("-registrydir dir specify directory containing protocol.txt\n"); ++#endif + ErrorF("-verbose print all X.org errors, warnings, and messages\n"); + ErrorF("-version report Xvnc version on stderr\n\n"); + } +diff --git a/unix/Xvnc/programs/Xserver/xkb/xkbInit.c b/unix/Xvnc/programs/Xserver/xkb/xkbInit.c +index b63549f3d..ddd5ef7f2 100644 +--- a/unix/Xvnc/programs/Xserver/xkb/xkbInit.c ++++ b/unix/Xvnc/programs/Xserver/xkb/xkbInit.c +@@ -767,7 +767,7 @@ XkbProcessArguments(int argc, char *argv[], int i) + return -1; + } + } +-#ifdef TURBOVNC ++#if defined(TURBOVNC) && !defined(TURBOVNC_XORG_STATIC_PATHS) + else if (strncmp(argv[i], "-xkbcompdir", 11) == 0) { + if (++i < argc) { + #if !defined(WIN32) && !defined(__CYGWIN__) +diff --git a/unix/vncserver.in b/unix/vncserver.in +index 4ed8ef668..300ccbf88 100644 +--- a/unix/vncserver.in ++++ b/unix/vncserver.in +@@ -38,6 +38,7 @@ if ($slashndx >= 0) { + + $xauth = "xauth"; + $buildWebServer = @TVNC_BUILDWEBSERVER@; ++$staticXorgPaths = @TVNC_STATIC_XORG_PATHS@; + + &SanityCheck(); + +@@ -98,6 +99,8 @@ unless ($xauthorityFile) { + chop($host = `uname -n`); + chop($os = `uname`); + ++if (!$staticXorgPaths) { ++ + if (-d "/etc/X11/fontpath.d") { + $fontPath = "catalogue:/etc/X11/fontpath.d"; + } +@@ -195,6 +198,8 @@ foreach $_registrydir (@registrydirs) { + } + } + ++} # !$staticXorgPaths ++ + # Check command line options + + &ParseOptions("-geometry", 1, "-depth", 1, "-pixelformat", 1, "-name", 1, +@@ -447,11 +452,11 @@ $cmd .= " -rfbport $vncPort"; + $cmd .= " -fp $fontPath" if ($fontPath); + $cmd .= " -alr ".$autoLosslessRefresh if ($autoLosslessRefresh > 0.0); + $cmd .= " -deferupdate $deferUpdate"; +-$cmd .= " -xkbdir $xkbdir" if ($xkbdir); +-$cmd .= " -xkbcompdir $xkbcompdir" if ($xkbcompdir); ++$cmd .= " -xkbdir $xkbdir" if ($xkbdir && !$staticXorgPaths); ++$cmd .= " -xkbcompdir $xkbcompdir" if ($xkbcompdir && !$staticXorgPaths); + $cmd .= " -pamsession" if ($pamSession); +-$cmd .= " -dridir $dridir" if ($dridir); +-$cmd .= " -registrydir $registrydir" if ($registrydir); ++$cmd .= " -dridir $dridir" if ($dridir && !$staticXorgPaths); ++$cmd .= " -registrydir $registrydir" if ($registrydir && !$staticXorgPaths); + $cmd .= " -nomt" if (!$multiThread); + $cmd .= " -nthreads $numThreads" if ($numThreads); + $cmd .= " $serverArgs" if ($serverArgs); diff --git a/gnu/packages/patches/turbovnc-find-system-packages.patch b/gnu/packages/patches/turbovnc-find-system-packages.patch new file mode 100644 index 0000000000..a7e7364ee7 --- /dev/null +++ b/gnu/packages/patches/turbovnc-find-system-packages.patch @@ -0,0 +1,51 @@ +From b4e1ffcdbfe8dc98036a16022cbcc422385c1834 Mon Sep 17 00:00:00 2001 +From: DRC +Date: Tue, 23 Aug 2022 10:07:10 -0500 +Subject: [PATCH] Build: Find Xfont2/fontenc/Pixman using pkg-config + +... when TVNC_SYSTEMX11=1. Referring to #339, we can't assume that +these libraries will share include/library paths with libX11. This +commit reverts e9cb8665dc3822b33dc0ffc5571fce5a759e7cb9. + +Rebased on 3.0.1 by Maxim Cournoyer + +diff --git a/unix/Xvnc/CMakeLists.txt b/unix/Xvnc/CMakeLists.txt +index 064feda..293f794 100644 +--- a/unix/Xvnc/CMakeLists.txt ++++ b/unix/Xvnc/CMakeLists.txt +@@ -94,11 +94,13 @@ if(NOT TVNC_SYSTEMX11) + endif() + + if(TVNC_SYSTEMX11) ++ include(FindPkgConfig) ++ pkg_check_modules(X11_Xfont2 REQUIRED xfont2) ++ pkg_check_modules(X11_Fontenc REQUIRED fontenc) ++ pkg_check_modules(X11_Pixman REQUIRED pixman-1) + include_directories(${X11_X11_INCLUDE_PATH} ${X11_Xau_INCLUDE_PATH} +- ${X11_Xdmcp_INCLUDE_PATH} ${X11_Xkbfile_INCLUDE_PATH}) +- string(REGEX REPLACE "X11" "Xfont2" X11_Xfont2_LIB ${X11_X11_LIB}) +- string(REGEX REPLACE "X11" "fontenc" X11_Fontenc_LIB ${X11_X11_LIB}) +- string(REGEX REPLACE "X11" "pixman-1" X11_Pixman_LIB ${X11_X11_LIB}) ++ ${X11_Xdmcp_INCLUDE_PATH} ${X11_Xkbfile_INCLUDE_PATH} ++ ${X11_Xfont2_INCLUDEDIR} ${X11_Pixman_INCLUDEDIR}/pixman-1) + else() + include_directories(${CMAKE_CURRENT_BINARY_DIR}/X_include) + set(X11_Xau_LIB Xau) +diff --git a/unix/Xvnc/programs/Xserver/CMakeLists.txt b/unix/Xvnc/programs/Xserver/CMakeLists.txt +index 8c05d43..f8d8f76 100644 +--- a/unix/Xvnc/programs/Xserver/CMakeLists.txt ++++ b/unix/Xvnc/programs/Xserver/CMakeLists.txt +@@ -182,9 +182,10 @@ if(HAVE_MONOTONIC_CLOCK) + endif() + target_link_libraries(Xvnc dix mi vnc fb Xi composite mi damage damageext randr + record render os present Xext-server sync xfixes xkb ${X11_Xau_LIB} +- ${X11_Xdmcp_LIB} ${X11_Xfont2_LIB} ${X11_Fontenc_LIB} ${FREETYPE_LIBRARIES} +- ${X11_Pixman_LIB} sha1 ${TJPEG_LIBRARY} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} +- vncauth m pthread ${PAM_LIB} ${EXTRA_LIB}) ++ ${X11_Xdmcp_LIB} ${X11_Xfont2_LDFLAGS} ${X11_Fontenc_LDFLAGS} ++ ${FREETYPE_LIBRARIES} ${X11_Pixman_LDFLAGS} sha1 ${TJPEG_LIBRARY} ++ ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} vncauth m pthread ${PAM_LIB} ++ ${EXTRA_LIB}) + if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "(OpenBSD|FreeBSD|NetBSD|DragonFly)") + find_library(ICONV_LIBRARIES NAMES iconv) + target_link_libraries(Xvnc ${ICONV_LIBRARIES}) diff --git a/gnu/packages/vnc.scm b/gnu/packages/vnc.scm index c0fabe848b..84c84aec76 100644 --- a/gnu/packages/vnc.scm +++ b/gnu/packages/vnc.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2020 Marius Bakke ;;; Copyright © 2020 Vincent Legoll ;;; Copyright © 2021, 2022 Tobias Geerinckx-Rice +;;; Copyright © 2022 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -26,6 +27,7 @@ #:use-module (guix download) #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix gexp) #:use-module (guix packages) #:use-module (guix utils) #:use-module (gnu packages) @@ -37,17 +39,22 @@ #:use-module (gnu packages crypto) #:use-module (gnu packages cups) #:use-module (gnu packages fltk) + #:use-module (gnu packages fontutils) #:use-module (gnu packages freedesktop) #:use-module (gnu packages gettext) + #:use-module (gnu packages gl) #:use-module (gnu packages glib) #:use-module (gnu packages gnome) #:use-module (gnu packages gnupg) #:use-module (gnu packages gtk) + #:use-module (gnu packages guile) #:use-module (gnu packages image) + #:use-module (gnu packages java) #:use-module (gnu packages linux) #:use-module (gnu packages pcre) #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) + #:use-module (gnu packages python) #:use-module (gnu packages rdesktop) #:use-module (gnu packages sdl) #:use-module (gnu packages spice) @@ -318,6 +325,192 @@ and TLS encryption. This package installs the VNC server, a program that will enable users with VNC clients to log into a graphical session on the machine where the server is installed."))) +(define-public turbovnc + (package + (name "turbovnc") + (version "3.0.1") + (source + (origin + (method url-fetch) + (uri (string-append "mirror://sourceforge/turbovnc/" version + "/turbovnc-" version ".tar.gz")) + (modules '((guix build utils) + (ice-9 ftw) + (srfi srfi-26))) + (snippet + #~(begin + ;; There are a few bundled Java libraries, such as jsch and jzlib, + ;; bundled under java/com/jcraft/ as well as mindrot and spf4j, + ;; bundled under java/org. These are used by the 'vncviewer' + ;; program. The jsch copy is modified and integrates changes from + ;; https://github.com/mwiede/jsch, so cannot easily be un-bundled. + (define (directory? x) + (and=> (stat x #f) (compose (cut eq? 'directory <>) stat:type))) + + (define (delete-all-but directory . preserve) + (with-directory-excursion directory + (let* ((pred (negate (cut member <> (append '("." "..") + preserve)))) + (items (scandir "." pred))) + (for-each (lambda (item) + (if (directory? item) + (delete-file-recursively item) + (delete-file item))) + items)))) + + ;; d3des, rfb (headers) and turbojpeg-jni are small and not + ;; packaged in Guix, so preserve them. + (delete-all-but "common" "d3des" "rfb" "turbojpeg-jni") + ;; Delete bundled headers which aren't used. + (delete-all-but "unix/Xvnc/include" "tvnc_version.h.in") + ;; This 243 lines of code C library is used by + ;; unix/Xvnc/programs/Xserver/os/xsha1.c. + (delete-all-but "unix/Xvnc/lib" "CMakeLists.txt" "libsha1") + (delete-file-recursively "unix/Xvnc/extras"))) + (sha256 + (base32 + "182amp471qvr2cn2rbw97zpbkh9q7mf92w1r25cg4apx5k26m7c3")) + (patches (search-patches "turbovnc-find-system-packages.patch" + "turbovnc-custom-paths.patch")))) + (build-system cmake-build-system) + (arguments + (list + #:tests? #f ;no test suite + #:configure-flags + ;; Use system libraries. + #~(list "-DTVNC_SYSTEMLIBS=ON" + "-DTVNC_SYSTEMX11=ON" + "-DTVNC_DLOPENSSL=OFF" + (string-append "-DXORG_DRI_DRIVER_PATH=" + (search-input-directory %build-inputs "lib/dri")) + (string-append "-DXORG_FONT_PATH=" + "/run/current-system/profile/share/fonts/X11," + (string-append #$(this-package-input "font-alias") + "share/fonts/X11")) + (string-append "-DXORG_REGISTRY_PATH=" + (dirname (search-input-file + %build-inputs "lib/xorg/protocol.txt"))) + (string-append "-DXKB_BASE_DIRECTORY=" + (search-input-directory %build-inputs + "share/X11/xkb")) + (string-append "-DXKB_BIN_DIRECTORY=" + (dirname (search-input-file %build-inputs + "bin/xkbcomp"))) + ;; The default rule is 'xorg', which doesn't match the 'base' + ;; rule file installed by our version of xkeyboard-config. + ;; Without this change, running Xvnc would fail with the error + ;; "XKB: Failed to compile keymap" + "-DXKB_DFLT_RULES=base" + ;; Mimic xorg-server's "--with-xkb-output=/tmp" configuration. + "-DCOMPILEDDEFAULTFONTPATH=/tmp" + "-DTVNC_STATIC_XORG_PATHS=ON") + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'patch-vncviewer + (lambda* (#:key inputs #:allow-other-keys) + (define openjdk #$(this-package-input "openjdk")) + (substitute* "unix/vncviewer/vncviewer.in" + (("\\$BINDIR/../java/jre") + openjdk) + ;; Avoid resorting to grep and sed to locate libjawt.so. + (("^_TMP=.*") + (string-append "_TMP=" openjdk "/lib\n"))))) + (add-after 'unpack 'patch-xstartup.turbovnc + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "unix/xstartup.turbovnc" + (("DBUS_LAUNCH=[[:graph:]]+") + (format #f "DBUS_LAUNCH=~a" + (search-input-file inputs "bin/dbus-launch"))) + (("XSESSIONSDIR=[[:graph:]]+") + (format #f "XSESSIONSDIR=~a" + "/run/current-system/profile/share/xsessions")) + (("GREP=[[:graph:]]+") + (format #f "GREP=~a" + (search-input-file inputs "bin/grep"))) + (("SED=[[:graph:]]+") + (format #f "SED=~a" + (search-input-file inputs "bin/sed"))) + (("TVNC_SSHAGENT=[[:graph:]]+") + (format #f "TVNC_SSHAGENT=~a" + (search-input-file inputs "bin/ssh-agent"))) + (("TVNC_VGLRUN=\"vglrun" all) + (string-append "TVNC_VGLRUN=" + (search-input-file inputs "bin/vglrun") all))))) + (add-after 'install 'wrap-vncserver + (lambda* (#:key inputs outputs #:allow-other-keys) + (wrap-script (search-input-file outputs "bin/vncserver") + (list "PATH" 'prefix + (map (lambda (p) + (dirname (search-input-file inputs p))) + '("bin/uname" ;coreutils + "bin/xauth" + "bin/xdpyinfo")))))) + (add-after 'install 'wrap-xstartup.turbovnc + (lambda* (#:key inputs outputs #:allow-other-keys) + (wrap-script (search-input-file outputs "bin/xstartup.turbovnc") + (list "PATH" 'prefix + (map (lambda (p) + (dirname (search-input-file inputs p))) + '("bin/uname" ;coreutils + ;; These are used as the fallback when no desktop + ;; session was found. + "bin/twm" + "bin/xsetroot" + "bin/xterm"))))))))) + (native-inputs + (list `(,openjdk "jdk") + pkg-config + python)) + (inputs + (list dbus + font-alias + freetype + guile-3.0 + libfontenc + libjpeg-turbo + libx11 + libxdamage + libxext + libxfont2 + libxi + libxkbfile + linux-pam + mesa + openjdk + openssh + openssl + perl + pixman + twm + virtualgl + xauth + xdpyinfo + xkbcomp + xkeyboard-config + xorg-server + xorgproto + xsetroot + xterm + xtrans + zlib)) + (home-page "https://turbovnc.org/") + (synopsis "Highly-optimized VNC remote desktop software") + (description "TurboVNC is a high-speed version of VNC derived from +TightVNC, with which it remains compatible. It contains a variant of Tight +encoding that is tuned to maximize performance for image-intensive +applications (such as VirtualGL, video applications, and image editors) while +still providing excellent performance for other types of applications. Some +of its unique features are: +@itemize +@item a user-facing @command{vncserver} command; +@item the ability to capture keyboard keys even when not in full screen mode; +@item a full screen mode that is compatible with ratpoison* +@end itemize +*Although due to a quirk in Java, you'll want to set the +@env{_JAVA_AWT_WM_NONREPARENTING} environment variable when using it with +ratpoison.") + (license license:gpl2+))) + (define-public libvnc (package (name "libvnc") -- cgit 1.4.1 From 4176d47ef7561d1d3120538d71fe2f854cf7e452 Mon Sep 17 00:00:00 2001 From: Philip McGrath Date: Sat, 27 Aug 2022 14:55:42 -0400 Subject: gnu: stex: Fix read-only gifs and math directories. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Excplicitly set the user write bit when initializing the gifs or math directories from the skeletons installed in the store. See also upstream discussion at . This problem would be exposed by the upcoming changes to Racket's build system. * gnu/packages/patches/stex-copy-from-immutable-store.patch: New patch. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/chez.scm (stex-bootstrap)[patches]: Use it. Signed-off-by: Ludovic Courtès --- gnu/local.mk | 1 + gnu/packages/chez.scm | 3 ++ .../patches/stex-copy-from-immutable-store.patch | 41 ++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 gnu/packages/patches/stex-copy-from-immutable-store.patch (limited to 'gnu/local.mk') diff --git a/gnu/local.mk b/gnu/local.mk index 1b3225d075..3f9c8c02e8 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1828,6 +1828,7 @@ dist_patch_DATA = \ %D%/packages/patches/slim-reset.patch \ %D%/packages/patches/slim-login.patch \ %D%/packages/patches/slim-display.patch \ + %D%/packages/patches/stex-copy-from-immutable-store.patch \ %D%/packages/patches/syslinux-gcc10.patch \ %D%/packages/patches/syslinux-strip-gnu-property.patch \ %D%/packages/patches/snappy-add-O2-flag-in-CmakeLists.txt.patch \ diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm index 043f2ae47a..812d41fc5b 100644 --- a/gnu/packages/chez.scm +++ b/gnu/packages/chez.scm @@ -613,6 +613,9 @@ Chez Scheme."))) (sha256 (base32 "0n6dryv5j7cw2qmsj55wqb0ph901h83a2hl4j891ppxp0xx18nkp")) (file-name (git-file-name name version)) + (patches + ;; submitted upstream in https://github.com/dybvig/stex/pull/6 + (search-patches "stex-copy-from-immutable-store.patch")) (snippet #~(for-each delete-file '("sbin/install" "doc/stex.pdf" "doc/stex.html"))))) diff --git a/gnu/packages/patches/stex-copy-from-immutable-store.patch b/gnu/packages/patches/stex-copy-from-immutable-store.patch new file mode 100644 index 0000000000..4562e431c1 --- /dev/null +++ b/gnu/packages/patches/stex-copy-from-immutable-store.patch @@ -0,0 +1,41 @@ +From 9434b4a36646c036db8de326158056aa3293fb82 Mon Sep 17 00:00:00 2001 +From: Philip McGrath +Date: Thu, 28 Apr 2022 22:56:20 -0400 +Subject: [PATCH] fix read-only gifs and math directories + +An installed copy of stex might have all write permission bits removed, +even for the owner of the installed files: this is the case with Guix +package of stex, for example. If such an installation is used to +initialize the gifs or math directories (e.g. for an out-of-source +build), tar likewise creates them without write permissions, preventing +subdirectories from being created later. Set the user write bit +explicitly to avoid this problem. + Mf-stex + +Related to https://github.com/racket/racket/pull/4203 +--- + +Submitted upstream in https://github.com/dybvig/stex/pull/6 + + Mf-stex | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Mf-stex b/Mf-stex +index 09ec6f3..11fb214 100644 +--- a/Mf-stex ++++ b/Mf-stex +@@ -112,9 +112,11 @@ $(x).mathrun: gifs $(mathfiles) + + gifs: + (cd $(STEXLIB); tar -cf - gifs) | tar -xpf - ++ chmod u+w gifs + + math: + (cd $(STEXLIB); tar -cf - math) | tar -xpf - ++ chmod u+w math + + $(mathfiles): $(x).hthirdrun $(figps) + echo -n gifs= > $(mathfiles) +-- +2.32.0 + -- cgit 1.4.1 From 911768b6d5f4f1a3df58f025b4b07d63c8e729a8 Mon Sep 17 00:00:00 2001 From: Philip McGrath Date: Sat, 27 Aug 2022 14:55:45 -0400 Subject: gnu: racket: Adjust patch for "/bin/sh" in rktio. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use '_PATH_BSHELL' instead of a custom preprocessor macro. This may not be The Right Thing in the long term, but it at least avoids a proliferation of 'CPPFLAGS'. * gnu/packages/patches/racket-minimal-sh-via-rktio.patch: Rename to ... * gnu/packages/patches/racket-rktio-bin-sh.patch: ... this, and change to use '_PATH_BSHELL'. * gnu/local.mk (dist_patch_DATA): Update accordingly. * gnu/packages/racket.scm (%racket-origin)[patches]: Likewise. (racket-vm-common-configure-flags): Stop setting 'CPPFLAGS'. Change to a constant instead of a function, since we no longer need the delay. (racket-vm-cgc, racket-vm-bc, racket-vm-cs)[arguments]<#:configure-flags>: Update accordingly. [inputs]: Remove 'bash-minimal'. Signed-off-by: Ludovic Courtès --- gnu/local.mk | 2 +- .../patches/racket-minimal-sh-via-rktio.patch | 87 ---------------------- gnu/packages/patches/racket-rktio-bin-sh.patch | 85 +++++++++++++++++++++ gnu/packages/racket.scm | 15 ++-- 4 files changed, 91 insertions(+), 98 deletions(-) delete mode 100644 gnu/packages/patches/racket-minimal-sh-via-rktio.patch create mode 100644 gnu/packages/patches/racket-rktio-bin-sh.patch (limited to 'gnu/local.mk') diff --git a/gnu/local.mk b/gnu/local.mk index 3f9c8c02e8..8197f2bc83 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1774,7 +1774,7 @@ dist_patch_DATA = \ %D%/packages/patches/ripperx-missing-file.patch \ %D%/packages/patches/rpcbind-CVE-2017-8779.patch \ %D%/packages/patches/rtags-separate-rct.patch \ - %D%/packages/patches/racket-minimal-sh-via-rktio.patch \ + %D%/packages/patches/racket-rktio-bin-sh.patch \ %D%/packages/patches/remake-impure-dirs.patch \ %D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \ %D%/packages/patches/retroarch-LIBRETRO_DIRECTORY.patch \ diff --git a/gnu/packages/patches/racket-minimal-sh-via-rktio.patch b/gnu/packages/patches/racket-minimal-sh-via-rktio.patch deleted file mode 100644 index 6bc2ee8331..0000000000 --- a/gnu/packages/patches/racket-minimal-sh-via-rktio.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 3574b567c486d264d680a37586436c3b5a8cb978 Mon Sep 17 00:00:00 2001 -From: Philip McGrath -Date: Thu, 4 Mar 2021 04:11:50 -0500 -Subject: [PATCH] patch rktio_process for "/bin/sh" on Guix - -Racket provides the functions `system` and `process`, -which execute shell commands using `sh` (or `cmd` on Windows). -Racket assumes that `sh` can be found at "/bin/sh", -which is not necessarily true on Guix. - -This patch adds a special case for "/bin/sh" to `rktio_process`, -the C function that implements the core of `system`, `process`, -and related Racket functions. - -Guix should enable the special case by defining the C preprocessor -macro `GUIX_RKTIO_PATCH_BIN_SH` with the path to `sh` in the store. -If: - - 1. The `GUIX_RKTIO_PATCH_BIN_SH` macro is defined; and - - 2. `rktio_process` is called with the exact path "/bin/sh"; and - - 3. The path specified by `GUIX_RKTIO_PATCH_BIN_SH` does exists; - -then `rktio_process` will execute the file specified -by `GUIX_RKTIO_PATCH_BIN_SH` instead of "/bin/sh". - -Compared to previous attempts to patch the Racket sources, -making this change at the C level is both: - - - More comprehensive: it catches all attempts to execute "/bin/sh", - without having to track down the source of every occurance; and - - - Less intrusive: by guarding the special case with a C preprocessor - conditional and a runtime check that the file in the store exists, - we make it much less likely that it will "leak" out of Guix. ---- - racket/src/rktio/rktio_process.c | 21 ++++++++++++++++++++- - 1 file changed, 20 insertions(+), 1 deletion(-) - -diff --git a/racket/src/rktio/rktio_process.c b/racket/src/rktio/rktio_process.c -index 89202436c0..465ebdd5c5 100644 ---- a/racket/src/rktio/rktio_process.c -+++ b/racket/src/rktio/rktio_process.c -@@ -1224,12 +1224,14 @@ int rktio_process_allowed_flags(rktio_t *rktio) - /*========================================================================*/ - - rktio_process_result_t *rktio_process(rktio_t *rktio, -- const char *command, int argc, rktio_const_string_t *argv, -+ /* PATCHED for Guix (next line) */ -+ const char *_guix_orig_command, int argc, rktio_const_string_t *argv, - rktio_fd_t *stdout_fd, rktio_fd_t *stdin_fd, rktio_fd_t *stderr_fd, - rktio_process_t *group_proc, - const char *current_directory, rktio_envvars_t *envvars, - int flags) - { -+ const char *command; /* PATCHED for Guix */ - rktio_process_result_t *result; - intptr_t to_subprocess[2], from_subprocess[2], err_subprocess[2]; - int pid; -@@ -1255,6 +1257,23 @@ rktio_process_result_t *rktio_process(rktio_t *rktio, - int i; - #endif - -+/* BEGIN PATCH for Guix */ -+#if defined(GUIX_RKTIO_PATCH_BIN_SH) -+# define GUIX_AS_a_STR_HELPER(x) #x -+# define GUIX_AS_a_STR(x) GUIX_AS_a_STR_HELPER(x) -+ /* A level of indirection makes `#` work as needed: */ -+ command = -+ ((0 == strcmp(_guix_orig_command, "/bin/sh")) -+ && rktio_file_exists(rktio, GUIX_AS_a_STR(GUIX_RKTIO_PATCH_BIN_SH))) -+ ? GUIX_AS_a_STR(GUIX_RKTIO_PATCH_BIN_SH) -+ : _guix_orig_command; -+# undef GUIX_AS_a_STR -+# undef GUIX_AS_a_STR_HELPER -+#else -+ command = _guix_orig_command; -+#endif -+/* END PATCH for Guix */ -+ - /* avoid compiler warnings: */ - to_subprocess[0] = -1; - to_subprocess[1] = -1; --- -2.21.1 (Apple Git-122.3) - diff --git a/gnu/packages/patches/racket-rktio-bin-sh.patch b/gnu/packages/patches/racket-rktio-bin-sh.patch new file mode 100644 index 0000000000..ec6f0d9c56 --- /dev/null +++ b/gnu/packages/patches/racket-rktio-bin-sh.patch @@ -0,0 +1,85 @@ +From 6a553f24439fe64fd3a2f0b5902f00590ca4241f Mon Sep 17 00:00:00 2001 +From: Philip McGrath +Date: Thu, 4 Mar 2021 04:11:50 -0500 +Subject: [PATCH] rktio: patch rktio_process for "/bin/sh" on Guix + +Racket provides the functions `system` and `process`, +which execute shell commands using `sh` (or `cmd` on Windows). +Racket assumes that `sh` can be found at "/bin/sh", +which is not necessarily true on Guix. + +This patch adds a special case for "/bin/sh" to `rktio_process`, +the C function that implements the core of `system`, `process`, +and related Racket functions. + +If: + + 1. The nonstandard but ubiquitous macro `_PATH_BSHELL` from + is defined; and + + 2. `rktio_process` is called with the exact path "/bin/sh"; and + + 3. The file specified by `_PATH_BSHELL` exists; + +then `rktio_process` will execute the file specified by `_PATH_BSHELL` +instead of "/bin/sh". + +Checking that the path specified by `_PATH_BSHELL` exists safeguards +against obscure errors if attempting to use stand-alone executables +built by the patched Racket in non-Guix envoronments. +--- + racket/src/rktio/rktio_process.c | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +diff --git a/racket/src/rktio/rktio_process.c b/racket/src/rktio/rktio_process.c +index fafaf728c1..796ebc59ce 100644 +--- a/racket/src/rktio/rktio_process.c ++++ b/racket/src/rktio/rktio_process.c +@@ -9,6 +9,7 @@ + # include + # include + # include ++# include /* PATCHED for Guix */ + # ifdef USE_ULIMIT + # include + # endif +@@ -1301,12 +1302,14 @@ int rktio_process_allowed_flags(rktio_t *rktio) + /*========================================================================*/ + + rktio_process_result_t *rktio_process(rktio_t *rktio, +- const char *command, int argc, rktio_const_string_t *argv, ++ /* PATCHED for Guix (next line) */ ++ const char *_guix_orig_command, int argc, rktio_const_string_t *argv, + rktio_fd_t *stdout_fd, rktio_fd_t *stdin_fd, rktio_fd_t *stderr_fd, + rktio_process_t *group_proc, + const char *current_directory, rktio_envvars_t *envvars, + int flags) + { ++ const char *command; /* PATCHED for Guix */ + rktio_process_result_t *result; + intptr_t to_subprocess[2], from_subprocess[2], err_subprocess[2]; + int pid; +@@ -1333,6 +1336,18 @@ rktio_process_result_t *rktio_process(rktio_t *rktio, + int i; + #endif + ++/* BEGIN PATCH for Guix */ ++#if defined(_PATH_BSHELL) ++ command = ++ ((0 == strcmp(_guix_orig_command, "/bin/sh")) ++ && rktio_file_exists(rktio, _PATH_BSHELL)) ++ ? _PATH_BSHELL ++ : _guix_orig_command; ++#else ++ command = _guix_orig_command; ++#endif ++/* END PATCH for Guix */ ++ + /* avoid compiler warnings: */ + to_subprocess[0] = -1; + to_subprocess[1] = -1; + +base-commit: 9d228d16fb99c274c964e5bef93e97333888769f +-- +2.32.0 + diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm index 3399bcc3fe..319f63f9d2 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -36,7 +36,6 @@ #:use-module (ice-9 match) #:use-module (gnu packages) #:use-module (gnu packages autotools) - #:use-module (gnu packages bash) #:use-module (gnu packages chez) #:use-module (gnu packages compression) #:use-module (gnu packages databases) @@ -212,7 +211,7 @@ otherwise." (sha256 (base32 "0f9zyhdvbh4xsndrqjzl85j5ziz0rmqi676g9s1lw3h3skq2636h")) (file-name (git-file-name "racket" %racket-version)) - (patches (search-patches "racket-minimal-sh-via-rktio.patch")) + (patches (search-patches "racket-rktio-bin-sh.patch")) (modules '((guix build utils))) (snippet #~(begin @@ -232,8 +231,7 @@ otherwise." ;; Unbundle libffi. (delete-file-recursively "racket/src/bc/foreign/libffi"))))) -(define (racket-vm-common-configure-flags) - ;; under a lambda abstraction to avoid evaluating bash-minimal too early. +(define racket-vm-common-configure-flags #~`(,@(cond ((false-if-exception (search-input-file %build-inputs "/bin/libtool")) @@ -248,8 +246,6 @@ otherwise." (list (string-append "--enable-racket=" racket)))) (else '())) - ,(string-append "CPPFLAGS=-DGUIX_RKTIO_PATCH_BIN_SH=" - #$(file-append bash-minimal "/bin/sh")) "--disable-strip" ;; Using --enable-origtree lets us distinguish the VM from subsequent ;; layers and produces a build with the shape expected by tools such as @@ -267,7 +263,6 @@ otherwise." (version %racket-version) (source %racket-origin) (inputs (list ncurses ;; <- common to all variants (for #%terminal) - bash-minimal ;; <- common to all variants (for `system`) libffi)) ;; <- only for BC variants (native-inputs (list libtool)) ;; <- only for BC variants (outputs '("out" "debug")) @@ -276,7 +271,7 @@ otherwise." (list #:configure-flags #~(cons "--enable-cgcdefault" - #$(racket-vm-common-configure-flags)) + #$racket-vm-common-configure-flags) ;; Tests are in packages like racket-test-core and ;; main-distribution-test that aren't part of the main ;; distribution. @@ -359,7 +354,7 @@ code to use the 3M garbage collector.") (substitute-keyword-arguments (package-arguments racket-vm-cgc) ((#:configure-flags _ '()) #~(cons "--enable-bconly" - #$(racket-vm-common-configure-flags))))) + #$racket-vm-common-configure-flags)))) (synopsis "Racket BC [3M] implementation") (description "The Racket BC (``before Chez'' or ``bytecode'') implementation was the default before Racket 8.0. It uses a compiler written @@ -405,7 +400,7 @@ collector, 3M (``Moving Memory Manager'').") #$(this-package-native-input "chez-scheme-for-racket") "/bin/scheme") - #$(racket-vm-common-configure-flags))))) + #$racket-vm-common-configure-flags)))) (synopsis "Racket CS implementation") (description "The Racket CS implementation, which uses ``Chez Scheme'' as its core compiler and runtime system, has been the default Racket VM -- cgit 1.4.1 From 5142fba364a991fdb797208275d760033d09199b Mon Sep 17 00:00:00 2001 From: Philip McGrath Date: Sat, 27 Aug 2022 14:55:46 -0400 Subject: gnu: chez-scheme: Fix use of "/bin/sh". MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The unsuccessful attempt to execute "/bin/sh" by Chez Scheme's 'process' function seems to have caused parts of the Chez Scheme test suite to have been silently skipped. The issue was exposed by the upcoming changes to Racket's build system. * gnu/packages/patches/chez-scheme-bin-sh.patch, gnu/packages/patches/racket-chez-scheme-bin-sh.patch: New patches. * gnu/local.mk (dist_patch_DATA): Add them. * gnu/packages/racket.scm (%racket-origin)[patches]: Update accordingly. * gnu/packages/chez.scm (chez-scheme)[origin]: Likewise. Signed-off-by: Ludovic Courtès --- gnu/local.mk | 2 + gnu/packages/chez.scm | 1 + gnu/packages/patches/chez-scheme-bin-sh.patch | 76 ++++++++++++++++++++++ .../patches/racket-chez-scheme-bin-sh.patch | 76 ++++++++++++++++++++++ gnu/packages/racket.scm | 3 +- 5 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/chez-scheme-bin-sh.patch create mode 100644 gnu/packages/patches/racket-chez-scheme-bin-sh.patch (limited to 'gnu/local.mk') diff --git a/gnu/local.mk b/gnu/local.mk index 8197f2bc83..a8357338ef 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -939,6 +939,7 @@ dist_patch_DATA = \ %D%/packages/patches/calibre-remove-test-sqlite.patch \ %D%/packages/patches/calibre-remove-test-unrar.patch \ %D%/packages/patches/catdoc-CVE-2017-11110.patch \ + %D%/packages/patches/chez-scheme-bin-sh.patch \ %D%/packages/patches/circos-remove-findbin.patch \ %D%/packages/patches/cdparanoia-fpic.patch \ %D%/packages/patches/cdrkit-libre-cross-compile.patch \ @@ -1774,6 +1775,7 @@ dist_patch_DATA = \ %D%/packages/patches/ripperx-missing-file.patch \ %D%/packages/patches/rpcbind-CVE-2017-8779.patch \ %D%/packages/patches/rtags-separate-rct.patch \ + %D%/packages/patches/racket-chez-scheme-bin-sh.patch \ %D%/packages/patches/racket-rktio-bin-sh.patch \ %D%/packages/patches/remake-impure-dirs.patch \ %D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \ diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm index 812d41fc5b..c627c4d842 100644 --- a/gnu/packages/chez.scm +++ b/gnu/packages/chez.scm @@ -269,6 +269,7 @@ Otherwise, SYSTEM can use only the ``portable bytecode'' backends." (base32 "0xchqq8cm0ka5wgpn18sjs0hh15rc3nb7xrjqbbc9al3asq0d7gc")) (file-name (git-file-name name version)) + (patches (search-patches "chez-scheme-bin-sh.patch")) (snippet #~(begin (use-modules (guix build utils)) ;; TODO: consider putting this in a (guix ...) or diff --git a/gnu/packages/patches/chez-scheme-bin-sh.patch b/gnu/packages/patches/chez-scheme-bin-sh.patch new file mode 100644 index 0000000000..7650914f01 --- /dev/null +++ b/gnu/packages/patches/chez-scheme-bin-sh.patch @@ -0,0 +1,76 @@ +From 3c838e6a0c3214d95bf02048cddccfd1b69a679f Mon Sep 17 00:00:00 2001 +From: Philip McGrath +Date: Thu, 19 May 2022 13:41:56 -0400 +Subject: [PATCH] patch s_process for "/bin/sh" on Guix + +If: + + 1. The nonstandard but ubiquitous macro `_PATH_BSHELL` from + is defined; and + + 2. The path specified by `_PATH_BSHELL` exists; + +then `s_process` will call `execl` with the file specified by +`_PATH_BSHELL` instead of "/bin/sh". + +Checking that the path specified by `_PATH_BSHELL` exists safeguards +against obscure errors if attempting to use stand-alone executables +built by the patched Racket in non-Guix envoronments. + +This patch does not change the behavior of `s_system`, which relies +on `system` from the C library. +--- + c/prim5.c | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +diff --git a/c/prim5.c b/c/prim5.c +index 5a07893..bc2736c 100644 +--- a/c/prim5.c ++++ b/c/prim5.c +@@ -23,6 +23,12 @@ + #include + #include + ++/* BEGIN PATCH for Guix */ ++#ifndef WIN32 ++# include ++#endif ++/* END PATCH for Guix */ ++ + /* locally defined functions */ + static INT s_errno(void); + static iptr s_addr_in_heap(uptr x); +@@ -746,6 +752,17 @@ static ptr s_process(char *s, IBOOL stderrp) { + + INT tofds[2], fromfds[2], errfds[2]; + struct sigaction act, oint_act; ++ /* BEGIN PATCH for Guix */ ++#if defined(_PATH_BSHELL) ++ struct stat guix_stat_buf; ++ char *guix_sh = ++ (0 == stat(_PATH_BSHELL, &guix_stat_buf)) ++ ? _PATH_BSHELL ++ : "/bin/sh"; ++#else /* _PATH_BSHELL */ ++ char *guix_sh = "/bin/sh"; ++#endif ++ /* END PATCH for Guix */ + + if (pipe(tofds)) S_error("process","cannot open pipes"); + if (pipe(fromfds)) { +@@ -771,7 +788,9 @@ static ptr s_process(char *s, IBOOL stderrp) { + CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1); + CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1); + {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);} +- execl("/bin/sh", "/bin/sh", "-c", s, NULL); ++ /* BEGIN PATCH for Guix */ ++ execl(guix_sh, guix_sh, "-c", s, NULL); ++ /* END PATCH for Guix */ + _exit(1) /* only if execl fails */; + /*NOTREACHED*/ + } else { + +base-commit: 9df56e7b25bc523663eac3da24be33afc5f76c84 +-- +2.32.0 + diff --git a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch new file mode 100644 index 0000000000..65cf2f99f3 --- /dev/null +++ b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch @@ -0,0 +1,76 @@ +From e982b6687494bf071386c67be74e57a29cf4ce00 Mon Sep 17 00:00:00 2001 +From: Philip McGrath +Date: Wed, 24 Aug 2022 19:55:14 -0400 +Subject: [PATCH] Chez Scheme: patch s_process for "/bin/sh" on Guix + +If: + + 1. The nonstandard but ubiquitous macro `_PATH_BSHELL` from + is defined; and + + 2. The path specified by `_PATH_BSHELL` exists; + +then `s_process` will call `execl` with the file specified by +`_PATH_BSHELL` instead of "/bin/sh". + +Checking that the path specified by `_PATH_BSHELL` exists safeguards +against obscure errors if attempting to use stand-alone executables +built by the patched Racket in non-Guix envoronments. + +This patch does not change the behavior of `s_system`, which relies +on `system` from the C library. +--- + racket/src/ChezScheme/c/prim5.c | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +diff --git a/racket/src/ChezScheme/c/prim5.c b/racket/src/ChezScheme/c/prim5.c +index f5e3e345be..922421ca75 100644 +--- a/racket/src/ChezScheme/c/prim5.c ++++ b/racket/src/ChezScheme/c/prim5.c +@@ -22,6 +22,12 @@ + #include + #include + ++/* BEGIN PATCH for Guix */ ++#ifndef WIN32 ++# include ++#endif ++/* END PATCH for Guix */ ++ + /* locally defined functions */ + static INT s_errno PROTO((void)); + static IBOOL s_addr_in_heap PROTO((uptr x)); +@@ -856,6 +862,17 @@ static ptr s_process(s, stderrp) char *s; IBOOL stderrp; { + + INT tofds[2], fromfds[2], errfds[2]; + struct sigaction act, oint_act; ++ /* BEGIN PATCH for Guix */ ++#if defined(_PATH_BSHELL) ++ struct stat guix_stat_buf; ++ char *guix_sh = ++ (0 == stat(_PATH_BSHELL, &guix_stat_buf)) ++ ? _PATH_BSHELL ++ : "/bin/sh"; ++#else /* _PATH_BSHELL */ ++ char *guix_sh = "/bin/sh"; ++#endif ++ /* END PATCH for Guix */ + + if (pipe(tofds)) S_error("process","cannot open pipes"); + if (pipe(fromfds)) { +@@ -881,7 +898,9 @@ static ptr s_process(s, stderrp) char *s; IBOOL stderrp; { + CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1); + CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1); + {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);} +- execl("/bin/sh", "/bin/sh", "-c", s, NULL); ++ /* BEGIN PATCH for Guix */ ++ execl(guix_sh, guix_sh, "-c", s, NULL); ++ /* END PATCH for Guix */ + _exit(1) /* only if execl fails */; + /*NOTREACHED*/ + } else { + +base-commit: 9d228d16fb99c274c964e5bef93e97333888769f +-- +2.32.0 + diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm index 319f63f9d2..0f766e7850 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -211,7 +211,8 @@ otherwise." (sha256 (base32 "0f9zyhdvbh4xsndrqjzl85j5ziz0rmqi676g9s1lw3h3skq2636h")) (file-name (git-file-name "racket" %racket-version)) - (patches (search-patches "racket-rktio-bin-sh.patch")) + (patches (search-patches "racket-chez-scheme-bin-sh.patch" + "racket-rktio-bin-sh.patch")) (modules '((guix build utils))) (snippet #~(begin -- cgit 1.4.1 From 07a8440f502a1e864258417af37c25ca33e24dde Mon Sep 17 00:00:00 2001 From: Philip McGrath Date: Sat, 27 Aug 2022 14:55:47 -0400 Subject: gnu: Add Zuo. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/packages/patches/racket-backport-8.6-zuo.patch, gnu/packages/patches/racket-zuo-bin-sh.patch: New patches. * gnu/local.mk (dist_patch_DATA): Add them. * gnu/packages/racket.scm (%zuo-version): New variable. (zuo): New variable. Signed-off-by: Ludovic Courtès --- gnu/local.mk | 2 + gnu/packages/patches/racket-backport-8.6-zuo.patch | 481 +++++++++++++++++++++ gnu/packages/patches/racket-zuo-bin-sh.patch | 74 ++++ gnu/packages/racket.scm | 49 +++ 4 files changed, 606 insertions(+) create mode 100644 gnu/packages/patches/racket-backport-8.6-zuo.patch create mode 100644 gnu/packages/patches/racket-zuo-bin-sh.patch (limited to 'gnu/local.mk') diff --git a/gnu/local.mk b/gnu/local.mk index a8357338ef..e454189b8b 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1775,8 +1775,10 @@ dist_patch_DATA = \ %D%/packages/patches/ripperx-missing-file.patch \ %D%/packages/patches/rpcbind-CVE-2017-8779.patch \ %D%/packages/patches/rtags-separate-rct.patch \ + %D%/packages/patches/racket-backport-8.6-zuo.patch \ %D%/packages/patches/racket-chez-scheme-bin-sh.patch \ %D%/packages/patches/racket-rktio-bin-sh.patch \ + %D%/packages/patches/racket-zuo-bin-sh.patch \ %D%/packages/patches/remake-impure-dirs.patch \ %D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \ %D%/packages/patches/retroarch-LIBRETRO_DIRECTORY.patch \ diff --git a/gnu/packages/patches/racket-backport-8.6-zuo.patch b/gnu/packages/patches/racket-backport-8.6-zuo.patch new file mode 100644 index 0000000000..b86679b7ec --- /dev/null +++ b/gnu/packages/patches/racket-backport-8.6-zuo.patch @@ -0,0 +1,481 @@ +From 8761fc06b188b9ca2f4b7f2b7d1235075c44a321 Mon Sep 17 00:00:00 2001 +From: Matthew Flatt +Date: Sat, 23 Jul 2022 17:10:58 -0600 +Subject: [PATCH 1/4] Zuo: support cross compilation via `configure` and + `CC_FOR_BUILD` + +(cherry picked from commit 798a989ba6d1a30c491a3120b2c2f1570ecab911) +--- + racket/src/zuo/Makefile.in | 7 ++++++- + racket/src/zuo/README.md | 10 ++++++++++ + racket/src/zuo/configure | 15 +++++++++++++++ + racket/src/zuo/configure.ac | 11 +++++++++++ + 4 files changed, 42 insertions(+), 1 deletion(-) + +diff --git a/racket/src/zuo/Makefile.in b/racket/src/zuo/Makefile.in +index 5d16e145bf..747b584c5c 100644 +--- a/racket/src/zuo/Makefile.in ++++ b/racket/src/zuo/Makefile.in +@@ -17,6 +17,11 @@ CPPFLAGS = @CPPFLAGS@ + LDFLAGS = @LDFLAGS@ + LIBS = @LIBS@ + ++CC_FOR_BUILD = @CC_FOR_BUILD@ ++CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ ++LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ ++LIBS_FOR_BUILD = @LIBS_FOR_BUILD@ ++ + EMBED_LIBS = @EMBED_LIBS@ + + .PHONY: zuos-to-run-and-install +@@ -24,7 +29,7 @@ zuos-to-run-and-install: zuo + ./zuo . zuos-to-run-and-install + + zuo: $(srcdir)/zuo.c +- $(CC) $(CPPFLAGS) $(CFLAGS) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS) $(LIBS) ++ $(CC_FOR_BUILD) $(FLAGS_FOR_BUILD) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS_FOR_BUILD) $(LIBS_FOR_BUILD) + + .PHONY: check + check: zuo +diff --git a/racket/src/zuo/README.md b/racket/src/zuo/README.md +index 17c88ee9ec..3aad504b7e 100644 +--- a/racket/src/zuo/README.md ++++ b/racket/src/zuo/README.md +@@ -84,6 +84,16 @@ A boot image is machine-independent, whether in a stand-alone file or + embedded in `.c` source. + + ++Cross Compiling ++--------------- ++ ++If you use `./configure --host=...` to cross compile, then you will ++also need to add something like `CC_FOR_BUILD=cc` as a `./configure` ++argument to specify the compiler for a `zuo` to use on the build ++machine. If necessary, you can also specify `CFLAGS_FOR_BUILD`, ++`LDFLAGS_FOR_BUILD`, and/or `LIBS_FOR_BUILD`. ++ ++ + Embedding Zuo in Another Application + ------------------------------------ + +diff --git a/racket/src/zuo/configure b/racket/src/zuo/configure +index 1fa34a3fe8..575ce07d96 100755 +--- a/racket/src/zuo/configure ++++ b/racket/src/zuo/configure +@@ -589,6 +589,10 @@ enable_embed="zuo" + ac_subst_vars='LTLIBOBJS + LIBOBJS + EMBED_LIBS ++LIBS_FOR_BUILD ++LDFLAGS_FOR_BUILD ++CFLAGS_FOR_BUILD ++CC_FOR_BUILD + OBJEXT + EXEEXT + ac_ct_CC +@@ -2584,6 +2588,17 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ + ac_compiler_gnu=$ac_cv_c_compiler_gnu + + ++if test "${CC_FOR_BUILD}" = ""; then ++ CC_FOR_BUILD='$(CC) -O2' ++ CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)' ++ LDFLAGS_FOR_BUILD='$(LDFLAGS)' ++ LIBS_FOR_BUILD='$(LIBS)' ++fi ++ ++ ++ ++ ++ + + { $as_echo "$as_me:${as_lineno-$LINENO}: zuo libraries to embed: \"${EMBED_LIBS}\"" >&5 + $as_echo "$as_me: zuo libraries to embed: \"${EMBED_LIBS}\"" >&6;} +diff --git a/racket/src/zuo/configure.ac b/racket/src/zuo/configure.ac +index 89b3c6391d..598ff79629 100644 +--- a/racket/src/zuo/configure.ac ++++ b/racket/src/zuo/configure.ac +@@ -25,6 +25,17 @@ AS_IF([test "x$enable_embed" = xno], + AC_PROG_MAKE_SET() + AC_PROG_CC + ++if test "${CC_FOR_BUILD}" = ""; then ++ CC_FOR_BUILD='$(CC) -O2' ++ CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)' ++ LDFLAGS_FOR_BUILD='$(LDFLAGS)' ++ LIBS_FOR_BUILD='$(LIBS)' ++fi ++AC_SUBST(CC_FOR_BUILD) ++AC_SUBST(CFLAGS_FOR_BUILD) ++AC_SUBST(LDFLAGS_FOR_BUILD) ++AC_SUBST(LIBS_FOR_BUILD) ++ + AC_SUBST(EMBED_LIBS) + AC_MSG_NOTICE([zuo libraries to embed: "${EMBED_LIBS}"]) + +-- +2.32.0 + + +From f65194ea41eb472fbdd45d5f6c13eabe5e681704 Mon Sep 17 00:00:00 2001 +From: Matthew Flatt +Date: Sat, 23 Jul 2022 17:47:03 -0600 +Subject: [PATCH 2/4] Zuo: sort hash keys + +Printing in a sorted order is helpful to make things more +deterministic independent of symbol inputs. Making `hash-keys` +produce a sorted list generalizes that determinism. + +(cherry picked from commit 4e7ffd3b365d01c5d0993c0b3fd24c9623962edf) +--- + racket/src/zuo/build.zuo | 5 ++- + racket/src/zuo/tests/hash.zuo | 8 ++-- + racket/src/zuo/zuo-doc/lang-zuo.scrbl | 18 +++++++-- + racket/src/zuo/zuo.c | 57 ++++++++++++++++++++++++++- + 4 files changed, 78 insertions(+), 10 deletions(-) + +diff --git a/racket/src/zuo/build.zuo b/racket/src/zuo/build.zuo +index c1b5e8ce66..129240120a 100644 +--- a/racket/src/zuo/build.zuo ++++ b/racket/src/zuo/build.zuo +@@ -47,7 +47,10 @@ + (target (at-dir (add-exe name)) + (lambda (path token) + (rule (list image_zuo.c +- (input-data-target 'config config) ++ (input-data-target 'config (cons ++ lib-path ++ (map (lambda (key) (hash-ref config key)) ++ '(CC CPPFLAGS CFLAGS LDFLAGS LIBS)))) + (quote-module-path)) + (lambda () + (define l (split-path path)) +diff --git a/racket/src/zuo/tests/hash.zuo b/racket/src/zuo/tests/hash.zuo +index a35741c730..0d3d7f3af6 100644 +--- a/racket/src/zuo/tests/hash.zuo ++++ b/racket/src/zuo/tests/hash.zuo +@@ -35,9 +35,7 @@ + + (check (hash-keys (hash)) '()) + (check (hash-keys (hash 'a 1)) '(a)) +-(check (let ([keys (hash-keys (hash 'a 1 'b 2))]) +- (or (equal? keys '(a b)) +- (equal? keys '(b a))))) ++(check (hash-keys (hash 'a 1 'b 2)) '(a b)) ; always in order + (check (length (hash-keys (hash 'a 1 'b 2 'c 3))) 3) + (check (length (hash-keys (hash 'a 1 'b 2 'a 3))) 2) + (check-arg-fail (hash-keys 0) "not a hash table") +@@ -50,3 +48,7 @@ + (check (hash-keys-subset? (hash 'a 1 'b 2) (hash 'b 1)) #f) + (check-arg-fail (hash-keys-subset? 0 (hash)) "not a hash table") + (check-arg-fail (hash-keys-subset? (hash) 0) "not a hash table") ++ ++;; print sorts keys alphabetically: ++(check (~a (hash 'a 1 'b 2)) "#hash((a . 1) (b . 2))") ++(check (~a (hash 'b 2 'a 1)) "#hash((a . 1) (b . 2))") +diff --git a/racket/src/zuo/zuo-doc/lang-zuo.scrbl b/racket/src/zuo/zuo-doc/lang-zuo.scrbl +index 94641d041e..4605e47471 100644 +--- a/racket/src/zuo/zuo-doc/lang-zuo.scrbl ++++ b/racket/src/zuo/zuo-doc/lang-zuo.scrbl +@@ -538,10 +538,20 @@ support to convert the textual form back into a hash table value. + + Analogous to @realracket*[hash? hash hash-ref hash-set hash-remove + hash-keys hash-count hash-keys-subset?] from @racketmodname[racket]. +-Besides being constrained to symbol keys, there is one additional +-difference: the third argument to @racket[hash-ref], when supplied, +-is always used as a value to return if a key is missing, as +-opposed to a failure thunk.} ++ ++Besides being constrained to symbol keys, there are two additional ++differences: ++ ++@itemlist[ ++ ++ @item{the third argument to @racket[hash-ref], when supplied, is ++ always used as a value to return if a key is missing, as ++ opposed to a failure thunk; and} ++ ++ @item{the @racket[hash-keys] function returns interned keys sorted ++ alphabetically.} ++ ++]} + + + @section{Procedures} +diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c +index 2957d478af..88d5747326 100644 +--- a/racket/src/zuo/zuo.c ++++ b/racket/src/zuo/zuo.c +@@ -1298,6 +1298,59 @@ static zuo_t *zuo_trie_keys(zuo_t *trie_in, zuo_t *accum) { + return accum; + } + ++/*======================================================================*/ ++/* symbol-list sorting */ ++/*======================================================================*/ ++ ++/* merge sort used to make hash printing deterministic */ ++static zuo_t *zuo_symbol_list_sort(zuo_t *l_in) { ++ zuo_t *l, *left, *right, *first, *last; ++ zuo_uint_t len = 0, i; ++ ++ for (l = l_in, len = 0; l != z.o_null; l = _zuo_cdr(l)) ++ len++; ++ ++ if (len < 2) ++ return l_in; ++ ++ left = z.o_null; ++ for (l = l_in, i = len >> 1; i > 0; l = _zuo_cdr(l), i--) ++ left = zuo_cons(_zuo_car(l), left); ++ right = l; ++ ++ left = zuo_symbol_list_sort(left); ++ right = zuo_symbol_list_sort(right); ++ ++ first = last = z.o_null; ++ while ((left != z.o_null) && (right != z.o_null)) { ++ zuo_t *p; ++ ++ if (strcmp(ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(left))->str), ++ ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(right))->str)) ++ < 1) { ++ p = zuo_cons(_zuo_car(left), z.o_null); ++ left = _zuo_cdr(left); ++ } else { ++ p = zuo_cons(_zuo_car(right), z.o_null); ++ right = _zuo_cdr(right); ++ } ++ ++ if (first == z.o_null) ++ first = p; ++ else ++ ((zuo_pair_t *)last)->cdr = p; ++ last = p; ++ } ++ ++ ((zuo_pair_t *)last)->cdr = ((left != z.o_null) ? left : right); ++ ++ return first; ++} ++ ++static zuo_t *zuo_trie_sorted_keys(zuo_t *trie_in, zuo_t *accum) { ++ return zuo_symbol_list_sort(zuo_trie_keys(trie_in, accum)); ++} ++ + /*======================================================================*/ + /* terminal support */ + /*======================================================================*/ +@@ -1571,7 +1624,7 @@ static void zuo_out(zuo_out_t *out, zuo_t *obj, zuo_print_mode_t mode) { + out_string(out, "opaque"); + out_string(out, ">"); + } else if (obj->tag == zuo_trie_node_tag) { +- zuo_t *keys = zuo_trie_keys(obj, z.o_null); ++ zuo_t *keys = zuo_trie_sorted_keys(obj, z.o_null); + if (mode == zuo_print_mode) { + out_string(out, "(hash"); + if (keys != z.o_null) +@@ -2587,7 +2640,7 @@ static zuo_t *zuo_hash_remove(zuo_t *ht, zuo_t *sym) { + + static zuo_t *zuo_hash_keys(zuo_t *ht) { + check_hash("hash-keys", ht); +- return zuo_trie_keys(ht, z.o_null); ++ return zuo_trie_sorted_keys(ht, z.o_null); + } + + static zuo_t *zuo_hash_keys_subset_p(zuo_t *ht, zuo_t *ht2) { +-- +2.32.0 + + +From f2eecaa1dd875479d2cf51566223b3d0d7b9f738 Mon Sep 17 00:00:00 2001 +From: Matthew Flatt +Date: Sat, 23 Jul 2022 18:06:41 -0600 +Subject: [PATCH 3/4] Zuo: check for nul characters in `string->symbol` + +(cherry picked from commit e20022ccfad40d0ba2e77aa75bc4f775018c781f) +--- + racket/src/zuo/tests/symbol.zuo | 3 +++ + racket/src/zuo/zuo-doc/lang-zuo.scrbl | 4 ++- + racket/src/zuo/zuo.c | 37 +++++++++++++++++---------- + 3 files changed, 29 insertions(+), 15 deletions(-) + +diff --git a/racket/src/zuo/tests/symbol.zuo b/racket/src/zuo/tests/symbol.zuo +index 7775aeeb04..5600a89755 100644 +--- a/racket/src/zuo/tests/symbol.zuo ++++ b/racket/src/zuo/tests/symbol.zuo +@@ -19,3 +19,6 @@ + (check (not (equal? 'apple (string->uninterned-symbol "apple")))) + (check-arg-fail (string->symbol 'apple) not-string) + (check-arg-fail (string->uninterned-symbol 'apple) not-string) ++ ++(check-arg-fail (string->symbol "apple\0spice") "without a nul character") ++(check (symbol? (string->uninterned-symbol "apple\0spice"))) +diff --git a/racket/src/zuo/zuo-doc/lang-zuo.scrbl b/racket/src/zuo/zuo-doc/lang-zuo.scrbl +index 4605e47471..07dd5815b0 100644 +--- a/racket/src/zuo/zuo-doc/lang-zuo.scrbl ++++ b/racket/src/zuo/zuo-doc/lang-zuo.scrbl +@@ -500,7 +500,9 @@ back into Zuo. + )]{ + + Analogous to @realracket*[symbol? symbol->string string->symbol +-string->uninterned-symbol] from @racketmodname[racket].} ++string->uninterned-symbol] from @racketmodname[racket], but ++@racket[string->symbol] accepts only strings that do not contain the ++null character.} + + + @section{Hash Tables (Persistent Maps)} +diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c +index 88d5747326..17f161826d 100644 +--- a/racket/src/zuo/zuo.c ++++ b/racket/src/zuo/zuo.c +@@ -1323,7 +1323,7 @@ static zuo_t *zuo_symbol_list_sort(zuo_t *l_in) { + + first = last = z.o_null; + while ((left != z.o_null) && (right != z.o_null)) { +- zuo_t *p; ++ zuo_t *p, *s_left, *s_right; + + if (strcmp(ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(left))->str), + ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(right))->str)) +@@ -2573,8 +2573,28 @@ static zuo_t *zuo_substring(zuo_t *obj, zuo_t *start_i, zuo_t *end_i) { + return zuo_sized_string((const char *)&((zuo_string_t *)obj)->s[s_idx], e_idx - s_idx); + } + ++static int zuo_is_string_without_nul(zuo_t *obj) { ++ zuo_int_t i; ++ ++ if ((obj->tag != zuo_string_tag) ++ || ZUO_STRING_LEN(obj) == 0) ++ return 0; ++ ++ for (i = ZUO_STRING_LEN(obj); i--; ) { ++ if (((zuo_string_t *)obj)->s[i] == 0) ++ return 0; ++ } ++ ++ return 1; ++} ++ + static zuo_t *zuo_string_to_symbol(zuo_t *obj) { +- check_string("string->symbol", obj); ++ if (!zuo_is_string_without_nul(obj)) { ++ const char *who = "string->symbol"; ++ check_string(who, obj); ++ zuo_fail_arg(who, "string without a nul character", obj); ++ } ++ + return zuo_symbol_from_string(ZUO_STRING_PTR(obj), obj); + } + +@@ -3577,18 +3597,7 @@ static void *zuo_envvars_block(const char *who, zuo_t *envvars) + #endif + + static int zuo_is_path_string(zuo_t *obj) { +- zuo_int_t i; +- +- if ((obj->tag != zuo_string_tag) +- || ZUO_STRING_LEN(obj) == 0) +- return 0; +- +- for (i = ZUO_STRING_LEN(obj); i--; ) { +- if (((zuo_string_t *)obj)->s[i] == 0) +- return 0; +- } +- +- return 1; ++ return zuo_is_string_without_nul(obj); + } + + static zuo_t *zuo_path_string_p(zuo_t *obj) { +-- +2.32.0 + + +From de6618cb3819d25580e3cd400ea09c8cf4f673a9 Mon Sep 17 00:00:00 2001 +From: Matthew Flatt +Date: Sat, 23 Jul 2022 19:50:46 -0600 +Subject: [PATCH 4/4] Zuo: CPPFLAGS_FOR_BUILD, too + +(cherry picked from commit cf82706c4b298f654a04c4bc8d98dff39b62a2ac) +--- + racket/src/zuo/Makefile.in | 3 ++- + racket/src/zuo/configure | 5 ++++- + racket/src/zuo/configure.ac | 4 +++- + 3 files changed, 9 insertions(+), 3 deletions(-) + +diff --git a/racket/src/zuo/Makefile.in b/racket/src/zuo/Makefile.in +index 747b584c5c..0376c038a8 100644 +--- a/racket/src/zuo/Makefile.in ++++ b/racket/src/zuo/Makefile.in +@@ -19,6 +19,7 @@ LIBS = @LIBS@ + + CC_FOR_BUILD = @CC_FOR_BUILD@ + CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ ++CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ + LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ + LIBS_FOR_BUILD = @LIBS_FOR_BUILD@ + +@@ -29,7 +30,7 @@ zuos-to-run-and-install: zuo + ./zuo . zuos-to-run-and-install + + zuo: $(srcdir)/zuo.c +- $(CC_FOR_BUILD) $(FLAGS_FOR_BUILD) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS_FOR_BUILD) $(LIBS_FOR_BUILD) ++ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS_FOR_BUILD) $(LIBS_FOR_BUILD) + + .PHONY: check + check: zuo +diff --git a/racket/src/zuo/configure b/racket/src/zuo/configure +index 575ce07d96..7ac453e3bc 100755 +--- a/racket/src/zuo/configure ++++ b/racket/src/zuo/configure +@@ -591,6 +591,7 @@ LIBOBJS + EMBED_LIBS + LIBS_FOR_BUILD + LDFLAGS_FOR_BUILD ++CPPFLAGS_FOR_BUILD + CFLAGS_FOR_BUILD + CC_FOR_BUILD + OBJEXT +@@ -2590,7 +2591,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + if test "${CC_FOR_BUILD}" = ""; then + CC_FOR_BUILD='$(CC) -O2' +- CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)' ++ CPPFLAGS_FOR_BUILD='$(CPPFLAGS)' ++ CFLAGS_FOR_BUILD='$(CFLAGS)' + LDFLAGS_FOR_BUILD='$(LDFLAGS)' + LIBS_FOR_BUILD='$(LIBS)' + fi +@@ -2600,6 +2602,7 @@ fi + + + ++ + { $as_echo "$as_me:${as_lineno-$LINENO}: zuo libraries to embed: \"${EMBED_LIBS}\"" >&5 + $as_echo "$as_me: zuo libraries to embed: \"${EMBED_LIBS}\"" >&6;} + +diff --git a/racket/src/zuo/configure.ac b/racket/src/zuo/configure.ac +index 598ff79629..051ea0beb5 100644 +--- a/racket/src/zuo/configure.ac ++++ b/racket/src/zuo/configure.ac +@@ -27,12 +27,14 @@ AC_PROG_CC + + if test "${CC_FOR_BUILD}" = ""; then + CC_FOR_BUILD='$(CC) -O2' +- CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)' ++ CPPFLAGS_FOR_BUILD='$(CPPFLAGS)' ++ CFLAGS_FOR_BUILD='$(CFLAGS)' + LDFLAGS_FOR_BUILD='$(LDFLAGS)' + LIBS_FOR_BUILD='$(LIBS)' + fi + AC_SUBST(CC_FOR_BUILD) + AC_SUBST(CFLAGS_FOR_BUILD) ++AC_SUBST(CPPFLAGS_FOR_BUILD) + AC_SUBST(LDFLAGS_FOR_BUILD) + AC_SUBST(LIBS_FOR_BUILD) + +-- +2.32.0 + diff --git a/gnu/packages/patches/racket-zuo-bin-sh.patch b/gnu/packages/patches/racket-zuo-bin-sh.patch new file mode 100644 index 0000000000..bcdcb8e963 --- /dev/null +++ b/gnu/packages/patches/racket-zuo-bin-sh.patch @@ -0,0 +1,74 @@ +From 73d9b77a11b4516905caf579abb559736f715ea6 Mon Sep 17 00:00:00 2001 +From: Philip McGrath +Date: Mon, 11 Apr 2022 20:43:18 -0400 +Subject: [PATCH] Zuo: patch zuo_process for "/bin/sh" on Guix + +If: + + 1. The nonstandard but ubiquitous macro `_PATH_BSHELL` from + is defined; and + + 2. `zuo_process` is called with the exact path "/bin/sh"; and + + 3. The path specified by `_PATH_BSHELL` exists; + +then `zuo_process` will execute the file specified by `_PATH_BSHELL` +instead of "/bin/sh". + +Checking that the path specified by `_PATH_BSHELL` exists safeguards +against obscure errors if attempting to use stand-alone executables +built by the patched Racket in non-Guix envoronments. +--- + racket/src/zuo/zuo.c | 20 ++++++++++++++++++-- + 1 file changed, 18 insertions(+), 2 deletions(-) + +diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c +index 17f161826d..c4fb3929bb 100644 +--- a/racket/src/zuo/zuo.c ++++ b/racket/src/zuo/zuo.c +@@ -15,6 +15,7 @@ + #include + #include + #ifdef ZUO_UNIX ++# include /* PATCHED for Guix */ + # include + # include + # include +@@ -5730,7 +5731,10 @@ static void zuo_pipe(zuo_raw_handle_t *_r, zuo_raw_handle_t *_w) + zuo_t *zuo_process(zuo_t *command_and_args) + { + const char *who = "process"; +- zuo_t *command = _zuo_car(command_and_args); ++ /* BEGIN PATCH for Guix */ ++ zuo_t *_guix_orig_command = _zuo_car(command_and_args); ++ zuo_t *command; ++ /* END PATCH for Guix */ + zuo_t *args = _zuo_cdr(command_and_args), *rev_args = z.o_null; + zuo_t *options = z.o_empty_hash, *opt; + zuo_t *dir, *l, *p_handle, *result; +@@ -5741,7 +5745,19 @@ zuo_t *zuo_process(zuo_t *command_and_args) + void *env; + int as_child, exact_cmdline; + +- check_path_string(who, command); ++ /* BEGIN PATCH for Guix */ ++ check_path_string(who, _guix_orig_command); ++#if defined(_PATH_BSHELL) ++ command = ++ ((z.o_false == zuo_string_eql(_guix_orig_command, zuo_string("/bin/sh"))) ++ || (z.o_false == zuo_stat(zuo_string(_PATH_BSHELL), z.o_false, z.o_true))) ++ ? _guix_orig_command ++ : zuo_string(_PATH_BSHELL); ++#else ++ command = _guix_orig_command; ++#endif ++ /* END PATCH for Guix */ ++ + for (l = args; l->tag == zuo_pair_tag; l = _zuo_cdr(l)) { + zuo_t *a = _zuo_car(l); + if (a == z.o_null) { + +base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085 +-- +2.32.0 + diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm index 0f766e7850..70df5482fb 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -200,6 +200,7 @@ otherwise." racket-vm-bc)) (define %racket-version "8.5") ; Remember to update chez-scheme-for-racket! +(define %zuo-version "1.0") ; defined in racket/src/zuo/zuo.c (define %racket-commit (string-append "v" %racket-version)) (define %racket-origin @@ -232,6 +233,54 @@ otherwise." ;; Unbundle libffi. (delete-file-recursively "racket/src/bc/foreign/libffi"))))) + +(define-public zuo + (let ((revision #f)) + (package + (name "zuo") + (version (string-append %zuo-version + "-racket" + "8.6" + (if revision "-guix" "") + (or revision ""))) + (source + (origin + (inherit %racket-origin) + (uri (git-reference + (url "https://github.com/racket/racket") + (commit "v8.6"))) + (sha256 + (base32 "1yi36nr7zrdwrnvpmliirxxjz4pyfyhkar6yvk3rapvmg4q2vmnk")) + (patches (append (origin-patches %racket-origin) + (search-patches "racket-backport-8.6-zuo.patch" + "racket-zuo-bin-sh.patch"))) + (file-name (git-file-name "racket" "8.6")))) + (outputs '("out" "debug")) + (build-system gnu-build-system) + (arguments + (list + #:out-of-source? #t + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda args + (chdir "racket/src/zuo")))))) + (home-page "https://github.com/racket/zuo") + ;; ^ This is downstream of https://github.com/racket/racket, + ;; but it's designed to be a friendly landing place + (synopsis "Tiny Racket for build scripts") + (description "Zuo (作) is a tiny Racket with primitives for dealing +with files and running processes. It comes with a @command{make}-like +embedded DSL, which is used to build Racket itself. + +Zuo is a Racket variant in the sense that program files start with +@code{#lang}, and the module path after @code{#lang} determines the parsing +and expansion of the file content. That's how the @command{make}-like DSL is +defined, and even the base Zuo language is defined by layers of @code{#lang}s. +One of the early layers implements macros.") + (license (list license:asl2.0 license:expat))))) + + (define racket-vm-common-configure-flags #~`(,@(cond ((false-if-exception -- cgit 1.4.1