code:
Disable CPU optimizations not supported by all x86_64 systems.

--- a/cmake/modules/SIMDExt.cmake	2017-03-23 22:22:58.254071694 +0100
+++ b/cmake/modules/SIMDExt.cmake	2017-03-23 22:23:22.446848845 +0100
@@ -5,11 +5,6 @@
 # HAVE_ARM_NEON
 # HAVE_INTEL_SSE
 # HAVE_INTEL_SSE2
-# HAVE_INTEL_SSE3
-# HAVE_INTEL_SSSE3
-# HAVE_INTEL_PCLMUL
-# HAVE_INTEL_SSE4_1
-# HAVE_INTEL_SSE4_2
 #
 # SIMD_COMPILE_FLAGS
 #
@@ -85,26 +80,6 @@
       if(HAVE_INTEL_SSE2)
         set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse2")
       endif()
-      CHECK_C_COMPILER_FLAG(-msse3 HAVE_INTEL_SSE3)
-      if(HAVE_INTEL_SSE3)
-        set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse3")
-      endif()
-      CHECK_C_COMPILER_FLAG(-mssse3 HAVE_INTEL_SSSE3)
-      if(HAVE_INTEL_SSSE3)
-        set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mssse3")
-      endif()
-      CHECK_C_COMPILER_FLAG(-mpclmul HAVE_INTEL_PCLMUL)
-      if(HAVE_INTEL_PCLMUL)
-        set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mpclmul")
-      endif()
-      CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_INTEL_SSE4_1)
-      if(HAVE_INTEL_SSE4_1)
-        set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse4.1")
-      endif()
-      CHECK_C_COMPILER_FLAG(-msse4.2 HAVE_INTEL_SSE4_2)
-      if(HAVE_INTEL_SSE4_2)
-        set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse4.2")
-      endif()
     endif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64")
   endif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686|amd64|x86_64|AMD64")
 elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(powerpc|ppc)64le")


code:
From 2447e047b750c3371778beb487f881641a582e66 Mon Sep 17 00:00:00 2001
From: Philip McGrath <philip@philipmcgrath.com>
Date: Thu, 11 Mar 2021 18:17:47 -0500
Subject: [PATCH] avoid hard-coded paths for utilities in build scripts

Backported from
https://github.com/cisco/ChezScheme/commit/8f4633ce24ac6425b2ab13cc78026b1c9bb5361e

Specific changes:
  - `cc` -> `$(CC)`
  - `/bin/rm` -> `rm`
  - `/bin/ln` -> `ln`
  - `/bin/cp` -> `cp`
  - `/bin/echo` -> `echo`
  - in `makefiles/installsh`, add a case to find `true`
    at an unusual path or as a shell builtin

Co-authored-by: Andy Keep <akeep@robotman.org>
---
 LOG                                 | 12 ++++++++++++
 csug/gifs/Makefile                  |  8 ++++----
 csug/math/Makefile                  |  4 ++--
 examples/Makefile                   |  2 +-
 makefiles/Makefile-csug.in          |  6 +++---
 makefiles/Makefile-release_notes.in |  2 +-
 makefiles/Mf-install.in             |  4 ++--
 makefiles/installsh                 |  3 ++-
 mats/6.ms                           |  2 +-
 mats/Mf-a6fb                        |  4 ++--
 mats/Mf-a6le                        |  4 ++--
 mats/Mf-a6nb                        |  4 ++--
 mats/Mf-a6ob                        |  4 ++--
 mats/Mf-a6osx                       |  4 ++--
 mats/Mf-arm32le                     |  4 ++--
 mats/Mf-i3fb                        |  4 ++--
 mats/Mf-i3le                        |  4 ++--
 mats/Mf-i3nb                        |  4 ++--
 mats/Mf-i3ob                        |  4 ++--
 mats/Mf-i3osx                       |  4 ++--
 mats/Mf-i3qnx                       |  4 ++--
 mats/Mf-ppc32le                     |  4 ++--
 mats/Mf-ta6fb                       |  4 ++--
 mats/Mf-ta6le                       |  4 ++--
 mats/Mf-ta6nb                       |  4 ++--
 mats/Mf-ta6ob                       |  4 ++--
 mats/Mf-ta6osx                      |  4 ++--
 mats/Mf-ti3fb                       |  4 ++--
 mats/Mf-ti3le                       |  4 ++--
 mats/Mf-ti3nb                       |  4 ++--
 mats/Mf-ti3ob                       |  4 ++--
 mats/Mf-ti3osx                      |  4 ++--
 mats/Mf-tppc32le                    |  4 ++--
 mats/unix.ms                        |  4 ++--
 newrelease                          | 22 +++++++++++-----------
 pkg/Makefile                        |  2 +-
 release_notes/gifs/Makefile         |  6 +++---
 release_notes/math/Makefile         |  4 ++--
 s/Mf-base                           |  2 +-
 workarea                            | 10 +++++-----
 40 files changed, 101 insertions(+), 88 deletions(-)

diff --git a/LOG b/LOG
index e1631df..399104d 100644
--- a/LOG
+++ b/LOG
@@ -2119,3 +2119,15 @@
     bintar/Makefile rpm/Makefile pkg/Makefile wininstall/Makefile
     wininstall/a6nt.wxs wininstall/i3nt.wxs wininstall/ta6nt.wxs
     wininstall/ti3nt.wxs
+9.5.5 changes:
+- avoid hard-coded paths for utilities in build scripts
+    checkin csug/gifs/Makefile csug/math/Makefile examples/Makefile
+    makefiles/Makefile-csug.in makefiles/Makefile-release_notes.in
+    makefiles/Mf-install.in makefiles/installsh mats/6.ms mats/Mf-a6fb
+    mats/Mf-a6le mats/Mf-a6nb mats/Mf-a6ob mats/Mf-a6osx mats/Mf-arm32le
+    mats/Mf-i3fb mats/Mf-i3le mats/Mf-i3nb mats/Mf-i3ob mats/Mf-i3osx
+    mats/Mf-i3qnx mats/Mf-ppc32le mats/Mf-ta6fb mats/Mf-ta6le mats/Mf-ta6nb
+    mats/Mf-ta6ob mats/Mf-ta6osx mats/Mf-ti3fb mats/Mf-ti3le mats/Mf-ti3nb
+    mats/Mf-ti3ob mats/Mf-ti3osx mats/Mf-tppc32le mats/unix.ms newrelease
+    pkg/Makefile release_notes/gifs/Makefile release_notes/math/Makefile
+    s/Mf-base workarea
diff --git a/csug/gifs/Makefile b/csug/gifs/Makefile
index 8676e4c..4253ffd 100644
--- a/csug/gifs/Makefile
+++ b/csug/gifs/Makefile
@@ -18,7 +18,7 @@ density=-r90x90
           ${density} - |\
           pnmcrop |\
           ppmtogif -transparent white > $*.gif
-	/bin/rm -f $*.dvi $*.log *.aux
+	rm -f $*.dvi $*.log *.aux
 	test -f $*.gif && chmod 644 $*.gif

 # translate ps file to gif w/o transparent white background
@@ -28,7 +28,7 @@ density=-r90x90
           ${density} - |\
           pnmcrop |\
           ppmtogif > $*.gif
-	/bin/rm -f $*.dvi $*.log *.aux
+	rm -f $*.dvi $*.log *.aux
 	test -f $*.gif && chmod 644 $*.gif

 all: ${gifs}
@@ -57,7 +57,7 @@ ghostRightarrow.gif: Rightarrow.tex
           giftrans -g '#000000=#ffffff' |\
           giftopnm |\
           ppmtogif -transparent white > $*.gif
-	/bin/rm -f Rightarrow.dvi Rightarrow.log Rightarrow.aux
+	rm -f Rightarrow.dvi Rightarrow.log Rightarrow.aux
 	test -f $*.gif && chmod 644 $*.gif

-clean: ; /bin/rm -f *.gif Make.out
+clean: ; rm -f *.gif Make.out
diff --git a/csug/math/Makefile b/csug/math/Makefile
index 3385fdb..3392ea8 100644
--- a/csug/math/Makefile
+++ b/csug/math/Makefile
@@ -15,11 +15,11 @@ density=-r90x90
           ${density} - |\
           pnmcrop |\
           ppmtogif -transparent white > $*.gif
-	/bin/rm -f $*.dvi $*.log $*.aux
+	rm -f $*.dvi $*.log $*.aux
 	test -f $*.gif && chmod 644 $*.gif

 all: ${gifs}

 ${gifs}: mathmacros

-clean: ; /bin/rm -f *.gif Make.out
+clean: ; rm -f *.gif Make.out
diff --git a/examples/Makefile b/examples/Makefile
index b1b4e1d..3edfdd0 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -25,4 +25,4 @@ needed:	${obj}

 all: ; echo "(time (for-each compile-file (map symbol->string '(${src}))))" | ${Scheme}

-clean: ; /bin/rm -f $(obj) expr.md
+clean: ; rm -f $(obj) expr.md
diff --git a/makefiles/Makefile-csug.in b/makefiles/Makefile-csug.in
index df24092..6f8a8d9 100644
--- a/makefiles/Makefile-csug.in
+++ b/makefiles/Makefile-csug.in
@@ -29,7 +29,7 @@ install: target
 # thrice is not enough when starting from scratch
 logcheck1: $(x).thirdrun
 	@if [ -n "`grep 'Warning: Label(s) may have changed' $(x).log`" ] ; then\
-            /bin/rm -f $(x).thirdrun ;\
+            rm -f $(x).thirdrun ;\
             $(MAKE) $(x).thirdrun;\
          fi

@@ -55,7 +55,7 @@ stexsrc = csug.stex title.stex copyright.stex contents.stex\
 texsrc = ${stexsrc:%.stex=%.tex}

 title.tex contents.tex bibliography.tex:
-	/bin/rm -f $*.tex
+	rm -f $*.tex
 	echo "%%% DO NOT EDIT THIS FILE" > $*.tex
 	echo "%%% Edit the .stex version instead" >> $*.tex
 	echo "" >> $*.tex
@@ -147,7 +147,7 @@ code: $(stexsrc)
 	echo '(load "code" pretty-print)' | $(Scheme) -q

 $(x).clean:
-	-/bin/rm -f $(x).rfm $(x).sfm $(x).prefirstrun $(x).presecondrun\
+	-rm -f $(x).rfm $(x).sfm $(x).prefirstrun $(x).presecondrun\
                     $(x).prethirdrun $(x).ans\
                     $(x).hprefirstrun $(x).hpresecondrun $(x).hprethirdrun\
                     tspl.aux tspl.haux tspl.rfm tspl.idx in.hidx\
diff --git a/makefiles/Makefile-release_notes.in b/makefiles/Makefile-release_notes.in
index 4435b6f..64348a4 100644
--- a/makefiles/Makefile-release_notes.in
+++ b/makefiles/Makefile-release_notes.in
@@ -38,7 +38,7 @@ install: $x.pdf $x.html
 	$(INSTALL) -m 2755 -d $(installdir)/gifs
 	$(INSTALL) -m 0644 --ifdiff gifs/*.gif $(installdir)/gifs
 	$(INSTALL) -m 2755 -d $(installdir)/math
-	-/bin/rm -rf $(installdir)/$(mathdir)
+	-rm -rf $(installdir)/$(mathdir)
 	$(INSTALL) -m 2755 -d $(installdir)/$(mathdir)
 	if [ -e $(mathdir)/0.gif ] ; then $(INSTALL) -m 0644 $(mathdir)/*.gif $(installdir)/$(mathdir) ; fi

diff --git a/makefiles/Mf-install.in b/makefiles/Mf-install.in
index a702c34..c09043d 100644
--- a/makefiles/Mf-install.in
+++ b/makefiles/Mf-install.in
@@ -114,12 +114,12 @@ bininstall: ${Bin}
 libbininstall: ${LibBin}
 	$I -m 444 ${PetiteBoot} ${LibBin}/petite.boot
 	if [ "${InstallPetiteName}" != "petite" ]; then\
-          /bin/rm -f ${LibBin}/${InstallPetiteName}.boot;\
+          rm -f ${LibBin}/${InstallPetiteName}.boot;\
           ln -f ${LibBin}/petite.boot ${LibBin}/${InstallPetiteName}.boot;\
         fi
 	$I -m 444 ${SchemeBoot} ${LibBin}/scheme.boot;\
 	if [ "${InstallSchemeName}" != "scheme" ]; then\
-          /bin/rm -f ${LibBin}/${InstallSchemeName}.boot;\
+          rm -f ${LibBin}/${InstallSchemeName}.boot;\
           ln -f ${LibBin}/scheme.boot ${LibBin}/${InstallSchemeName}.boot;\
         fi
 	ln -f ${LibBin}/scheme.boot ${LibBin}/${InstallScriptName}.boot;
diff --git a/makefiles/installsh b/makefiles/installsh
index 48f1e46..95d85fb 100755
--- a/makefiles/installsh
+++ b/makefiles/installsh
@@ -1,7 +1,8 @@
 #! /bin/sh
 if [ -x /bin/true ]; then TRUE=/bin/true;
 elif [ -x /usr/bin/true ]; then TRUE=/usr/bin/true;
-else echo "Can't find /bin/true or /usr/bin/true" ; exit 1;
+elif command -v true &> /dev/null; then TRUE=true;
+else echo "Can't find /bin/true or /usr/bin/true and no true command" ; exit 1;
 fi

 while ${TRUE} ; do
diff --git a/mats/6.ms b/mats/6.ms
index 102f84b..e504230 100644
--- a/mats/6.ms
+++ b/mats/6.ms
@@ -2685,7 +2685,7 @@
       (begin
         (system "ln -s ../examples .")
         (load "examples/fatfib.ss" compile)
-        (system "/bin/rm examples")
+        (system "rm -f examples")
         #t))
   (or (windows?) (embedded?)
       (equal?
diff --git a/mats/Mf-a6fb b/mats/Mf-a6fb
index b16d1b6..ff9e687 100644
--- a/mats/Mf-a6fb
+++ b/mats/Mf-a6fb
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -fPIC -shared -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-a6le b/mats/Mf-a6le
index d6fee09..a3bda76 100644
--- a/mats/Mf-a6le
+++ b/mats/Mf-a6le
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -m64 -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -m64 -fPIC -shared -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-a6nb b/mats/Mf-a6nb
index 48187ef..0f7ac17 100644
--- a/mats/Mf-a6nb
+++ b/mats/Mf-a6nb
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -fPIC -shared -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-a6ob b/mats/Mf-a6ob
index 12758f3..0ffcccc 100644
--- a/mats/Mf-a6ob
+++ b/mats/Mf-a6ob
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -fPIC -shared -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-a6osx b/mats/Mf-a6osx
index f1dbf85..57bac22 100644
--- a/mats/Mf-a6osx
+++ b/mats/Mf-a6osx
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -m64 -dynamiclib -undefined dynamic_lookup -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -m64 -dynamiclib -undefined dynamic_lookup -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-arm32le b/mats/Mf-arm32le
index f33a665..83896eb 100644
--- a/mats/Mf-arm32le
+++ b/mats/Mf-arm32le
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -fPIC -fomit-frame-pointer -shared -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -fPIC -fomit-frame-pointer -shared -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-i3fb b/mats/Mf-i3fb
index 150cedb..1e4e8fc 100644
--- a/mats/Mf-i3fb
+++ b/mats/Mf-i3fb
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -fPIC -shared -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-i3le b/mats/Mf-i3le
index 8f521c8..b248620 100644
--- a/mats/Mf-i3le
+++ b/mats/Mf-i3le
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -m32 -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -m32 -fPIC -shared -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-i3nb b/mats/Mf-i3nb
index e81f6ff..8afeb5c 100644
--- a/mats/Mf-i3nb
+++ b/mats/Mf-i3nb
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -fPIC -shared -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-i3ob b/mats/Mf-i3ob
index 4e3ee1b..fcd4dee 100644
--- a/mats/Mf-i3ob
+++ b/mats/Mf-i3ob
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -fPIC -shared -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-i3osx b/mats/Mf-i3osx
index 53c7d4a..a55f6ee 100644
--- a/mats/Mf-i3osx
+++ b/mats/Mf-i3osx
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -m32 -dynamiclib -undefined dynamic_lookup -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -m32 -dynamiclib -undefined dynamic_lookup -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-i3qnx b/mats/Mf-i3qnx
index 724f2db..3e1437a 100644
--- a/mats/Mf-i3qnx
+++ b/mats/Mf-i3qnx
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -m32 -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -m32 -fPIC -shared -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-ppc32le b/mats/Mf-ppc32le
index 28151a8..547ca00 100644
--- a/mats/Mf-ppc32le
+++ b/mats/Mf-ppc32le
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -m32 -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -m32 -fPIC -shared -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-ta6fb b/mats/Mf-ta6fb
index 921d609..5ed233e 100644
--- a/mats/Mf-ta6fb
+++ b/mats/Mf-ta6fb
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-ta6le b/mats/Mf-ta6le
index cd014ec..21c686a 100644
--- a/mats/Mf-ta6le
+++ b/mats/Mf-ta6le
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -m64 -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -m64 -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-ta6nb b/mats/Mf-ta6nb
index 6b1929d..9b9b898 100644
--- a/mats/Mf-ta6nb
+++ b/mats/Mf-ta6nb
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-ta6ob b/mats/Mf-ta6ob
index a7aee91..8f25aed 100644
--- a/mats/Mf-ta6ob
+++ b/mats/Mf-ta6ob
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-ta6osx b/mats/Mf-ta6osx
index 42da5d7..0dd386f 100644
--- a/mats/Mf-ta6osx
+++ b/mats/Mf-ta6osx
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -m64 -pthread -dynamiclib -undefined dynamic_lookup -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -m64 -pthread -dynamiclib -undefined dynamic_lookup -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-ti3fb b/mats/Mf-ti3fb
index c891145..56bf7d3 100644
--- a/mats/Mf-ti3fb
+++ b/mats/Mf-ti3fb
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-ti3le b/mats/Mf-ti3le
index 12e77b8..22b4148 100644
--- a/mats/Mf-ti3le
+++ b/mats/Mf-ti3le
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -m32 -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -m32 -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-ti3nb b/mats/Mf-ti3nb
index 028c652..573946e 100644
--- a/mats/Mf-ti3nb
+++ b/mats/Mf-ti3nb
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-ti3ob b/mats/Mf-ti3ob
index 8a4741c..4472b60 100644
--- a/mats/Mf-ti3ob
+++ b/mats/Mf-ti3ob
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-ti3osx b/mats/Mf-ti3osx
index 6913c34..9273b44 100644
--- a/mats/Mf-ti3osx
+++ b/mats/Mf-ti3osx
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -m32 -pthread -dynamiclib -undefined dynamic_lookup -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -m32 -pthread -dynamiclib -undefined dynamic_lookup -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/Mf-tppc32le b/mats/Mf-tppc32le
index a12b515..8b9d9f0 100644
--- a/mats/Mf-tppc32le
+++ b/mats/Mf-tppc32le
@@ -21,7 +21,7 @@ fobj = foreign1.so
 include Mf-base

 foreign1.so: ${fsrc} ../boot/$m/scheme.h
-	cc -m32 -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}
+	$(CC) -m32 -pthread -fPIC -shared -I${Include} -o foreign1.so ${fsrc}

 cat_flush: cat_flush.c
-	cc -o cat_flush cat_flush.c
+	$(CC) -o cat_flush cat_flush.c
diff --git a/mats/unix.ms b/mats/unix.ms
index cfba3e7..db7f6f9 100644
--- a/mats/unix.ms
+++ b/mats/unix.ms
@@ -72,8 +72,8 @@
   (mat system
     (eqv? (with-output-to-file "testfile.ss" void '(replace)) (void))
     (begin
-      (system (format "~:[~;/pkg~]/bin/rm testfile.ss" (embedded?)))
-      (system (format "~:[~;/pkg~]/bin/echo hello > testfile.ss" (embedded?)))
+      (system "rm -f testfile.ss")
+      (system "echo hello > testfile.ss")
       (let ([p (open-input-file "testfile.ss")])
         (and (eq? (read p) 'hello)
              (begin (close-input-port p) #t))))
diff --git a/newrelease b/newrelease
index e903956..2d06740 100755
--- a/newrelease
+++ b/newrelease
@@ -75,13 +75,13 @@ if ($status != 0) exit 1

 cd $W

-/bin/rm -f BUILDING
+rm -f BUILDING
 sed -e "s/Chez Scheme Version [^ ]*/Chez Scheme Version $R/" \
     -e "s/Copyright 1984-.... /Copyright 1984-`date +%Y` /" \
     ../BUILDING > BUILDING
 set updatedfiles = ($updatedfiles BUILDING)

-/bin/rm -f NOTICE
+rm -f NOTICE
 sed -e "s/Chez Scheme Version [^ ]*/Chez Scheme Version $R/" \
     -e "s/Copyright 1984-.... /Copyright 1984-`date +%Y` /" \
     ../NOTICE > NOTICE
@@ -92,19 +92,19 @@ sed -e "s/csv[0-9]\.[0-9]\(\.[0-9]\)*/csv$R/" ../makefiles/Mf-install.in > makef
 sed -e "s/csug[0-9]\.[0-9]/csug$MR.$mR/" -e "s/csug[0-9]_[0-9]/csug$MR""_$mR/" ../makefiles/Makefile-csug.in > makefiles/Makefile-csug.in
 set updatedfiles = ($updatedfiles makefiles/Mf-install.in makefiles/Makefile-csug.in)

-/bin/rm scheme.1.in
+rm -f scheme.1.in
 sed -e "s/Chez Scheme Version [0-9]\.[0-9]\(\.[0-9]\)* .* [0-9][0-9]*/Chez Scheme Version $R `date +'%B %Y'`/" \
     -e "s/Copyright .* Cisco Systems, Inc./Copyright `date +%Y` Cisco Systems, Inc./" \
   ../scheme.1.in > scheme.1.in
 set updatedfiles = ($updatedfiles scheme.1.in)

-/bin/rm -f c/Makefile.{,t}{i3,a6}nt
+rm -f c/Makefile.{,t}{i3,a6}nt
 foreach fn (c/Makefile.{,t}{a6,i3}nt)
   set updatedfiles = ($updatedfiles $fn)
   sed -e "s/csv[0-9][0-9][0-9]*/csv$ZR/g" ../$fn > $fn
 end

-/bin/rm -f mats/Mf-{,t}{i3,a6}nt
+rm -f mats/Mf-{,t}{i3,a6}nt
 foreach fn (mats/Mf-{,t}{a6,i3}nt)
   set updatedfiles = ($updatedfiles $fn)
   sed -e "s/csv[0-9][0-9][0-9]*/csv$ZR/g" ../$fn > $fn
@@ -123,11 +123,11 @@ sed -e "s/FILEVERSION .*/FILEVERSION $RCVERSION/"\
     -e "s/Copyright 1984-..../Copyright 1984-`date +%Y`/g" ../c/scheme.rc > c/scheme.rc
 set updatedfiles = ($updatedfiles c/scheme.rc)

-/bin/rm -f s/7.ss
+rm -f s/7.ss
 sed -e "s/nCopyright 1984-..../nCopyright 1984-`date +%Y`/g" ../s/7.ss > s/7.ss
 set updatedfiles = ($updatedfiles s/7.ss)

-/bin/rm -f s/cmacros.ss
+rm -f s/cmacros.ss
 set VNUM = `printf "%04x%02x%02x" $MR $mR $bR`
 sed -e "s/scheme-version #x......../scheme-version #x$VNUM/" ../s/cmacros.ss > s/cmacros.ss
 set updatedfiles = ($updatedfiles s/cmacros.ss)
@@ -146,17 +146,17 @@ sed -e "s/Revised\(.*\)for Chez Scheme Version [^ ]*<br>/Revised\1for Chez Schem
   ../csug/csug.stex > csug/csug.stex
 set updatedfiles = ($updatedfiles csug/copyright.stex csug/csug.stex)

-/bin/rm bintar/Makefile
+rm -f bintar/Makefile
 sed -e "s/^version = .*/version = $R/" \
     -e "s/csv[0-9][0-9][0-9]*/csv$ZR/g" \
   ../bintar/Makefile > bintar/Makefile
 set updatedfiles = ($updatedfiles bintar/Makefile)

-/bin/rm rpm/Makefile
+rm -f rpm/Makefile
 sed -e "s/^version = .*/version = $R/" ../rpm/Makefile > rpm/Makefile
 set updatedfiles = ($updatedfiles rpm/Makefile)

-/bin/rm pkg/Makefile
+rm -f pkg/Makefile
 sed -e "s/^version = .*/version = $R/" \
     -e "s/© .* Cisco Systems/\© `date +%Y` Cisco Systems/" \
      ../pkg/Makefile > pkg/Makefile
@@ -170,7 +170,7 @@ foreach fn (wininstall/{,t}{a6,i3}nt.wxs)
   sed -e "s/csv[0-9][0-9][0-9]*/csv$ZR/" ../$fn > $fn
 end

-/bin/rm LOG
+rm -f LOG
 cat ../LOG > LOG
 echo "" >> LOG
 echo "$R changes:" >> LOG
diff --git a/pkg/Makefile b/pkg/Makefile
index e0eef67..a3fe83f 100644
--- a/pkg/Makefile
+++ b/pkg/Makefile
@@ -39,7 +39,7 @@ $(PKG): $(BUILDROOT)/$(PKG)
           --package-path $(BUILDROOT)\
           $(PKG)
 	sudo chown $(DOTUSER):$(DOTGROUP) $(PKG)
-	sudo /bin/rm -rf $(RELEASE) $(BUILDROOT)
+	sudo rm -rf $(RELEASE) $(BUILDROOT)

 $(BUILDROOT)/$(PKG): $(PKGCONTENT)
 	sudo /usr/bin/pkgbuild\
diff --git a/release_notes/gifs/Makefile b/release_notes/gifs/Makefile
index 9572965..701d53a 100644
--- a/release_notes/gifs/Makefile
+++ b/release_notes/gifs/Makefile
@@ -15,7 +15,7 @@ density=-r90x90
           ${density} - |\
           pnmcrop |\
           ppmtogif -transparent white > $*.gif
-	/bin/rm -f $*.dvi $*.log *.aux
+	rm -f $*.dvi $*.log *.aux
 	test -f $*.gif && chmod 644 $*.gif

 all: ${gifs}
@@ -44,7 +44,7 @@ ghostRightarrow.gif: Rightarrow.tex
           giftrans -g '#000000=#ffffff' |\
           giftopnm |\
           ppmtogif -transparent white > $*.gif
-	/bin/rm -f Rightarrow.dvi Rightarrow.log Rightarrow.aux
+	rm -f Rightarrow.dvi Rightarrow.log Rightarrow.aux
 	test -f $*.gif && chmod 644 $*.gif

-clean: ; /bin/rm -f *.gif Make.out
+clean: ; rm -f *.gif Make.out
diff --git a/release_notes/math/Makefile b/release_notes/math/Makefile
index b3ffae3..9eca430 100644
--- a/release_notes/math/Makefile
+++ b/release_notes/math/Makefile
@@ -16,11 +16,11 @@ density=-r90x90
           ${density} - |\
           pnmcrop |\
           ppmtogif -transparent white > $*.gif
-	/bin/rm -f $*.dvi $*.log $*.aux
+	rm -f $*.dvi $*.log $*.aux
 	test -f $*.gif && chmod 644 $*.gif

 all: ${gifs}

 ${gifs}: mathmacros

-clean: ; /bin/rm -f *.gif Make.out
+clean: ; rm -f *.gif Make.out
diff --git a/s/Mf-base b/s/Mf-base
index c709608..40d816c 100644
--- a/s/Mf-base
+++ b/s/Mf-base
@@ -206,7 +206,7 @@ profiled:
 	$(MAKE) all loadspd=t bp=t PetiteBoot=../boot/$m/xpetite.boot SchemeBoot=../boot/$m/xscheme.boot
 	$(MAKE) prettyclean
 	$(MAKE) io.$m loadspd=t dumpbpd=t Scheme="../bin/$m/scheme -b ../boot/$m/xpetite.boot -b ../boot/$m/xscheme.boot"
-	/bin/rm -f ../boot/$m/xpetite.boot ../boot/$m/xscheme.boot
+	rm -f ../boot/$m/xpetite.boot ../boot/$m/xscheme.boot
 	$(MAKE) prettyclean
 	$(MAKE) all loadspd=t loadbpd=t

diff --git a/workarea b/workarea
index bacc712..0461919 100755
--- a/workarea
+++ b/workarea
@@ -70,9 +70,9 @@ esac

 if [ "$OS" = "Windows_NT" ]
 then
-    ln="/bin/cp -R"
+    ln="cp -R"
 else
-    ln="/bin/ln -s"
+    ln="ln -s"
 fi

 # This shell script creates a workarea for local modifications to the
@@ -102,7 +102,7 @@ workln()
 forceworkln()
 {
     if [ ! -e $2 ] ; then
-        /bin/ln -s $1 $2 2> /dev/null
+        ln -s $1 $2 2> /dev/null
     fi
 }

@@ -168,13 +168,13 @@ done
 # deep copy submodules where builds occur so changes don't propagate through symlinks
 for dir in `echo zlib` ; do
   if [ ! -e $W/$dir ] ; then
-    /bin/cp -R $dir $W/$dir
+    cp -R $dir $W/$dir
   fi
 done

 for dir in `echo lz4` ; do
   if [ ! -e $W/$dir ] ; then
-    /bin/cp -R $dir $W/$dir
+    cp -R $dir $W/$dir
   fi
 done

--
2.21.1 (Apple Git-122.3)

repo_name: maximed/guix

license: mit


code:
Taken from Debian, necessary for compilation on mips.

Patch to fix integer types problem by Goswin von Brederlow
<brederlo@informatik.uni-tuebingen.de> (#258444)
--- chmlib-0.39.orig/src/chm_lib.c
+++ chmlib-0.39/src/chm_lib.c
@@ -56,6 +56,7 @@

 #include "lzx.h"

+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #ifdef CHM_DEBUG
@@ -149,22 +150,9 @@
 typedef __int64                 Int64;
 typedef unsigned __int64        UInt64;

-/* I386, 32-bit, non-Windows */
-/* Sparc        */
-/* MIPS         */
-/* PPC          */
-#elif __i386__ || __sun || __sgi || __ppc__
-typedef unsigned char           UChar;
-typedef short                   Int16;
-typedef unsigned short          UInt16;
-typedef long                    Int32;
-typedef unsigned long           UInt32;
-typedef long long               Int64;
-typedef unsigned long long      UInt64;
-
 /* x86-64 */
 /* Note that these may be appropriate for other 64-bit machines. */
-#elif __x86_64__ || __ia64__
+#elif defined(__LP64__)
 typedef unsigned char           UChar;
 typedef short                   Int16;
 typedef unsigned short          UInt16;
@@ -173,10 +161,18 @@
 typedef long                    Int64;
 typedef unsigned long           UInt64;

+/* I386, 32-bit, non-Windows */
+/* Sparc        */
+/* MIPS         */
+/* PPC          */
 #else
-
-/* yielding an error is preferable to yielding incorrect behavior */
-#error "Please define the sized types for your platform in chm_lib.c"
+typedef unsigned char           UChar;
+typedef short                   Int16;
+typedef unsigned short          UInt16;
+typedef long                    Int32;
+typedef unsigned long           UInt32;
+typedef long long               Int64;
+typedef unsigned long long      UInt64;
 #endif

 /* GCC */


code:
This patch was created by Roel Janssen <roel@gnu.org>.

Circos uses paths relative to the "circos" script to find its Perl modules.
This patch removes that mechanism, and instead expects the 'Circos' modules
to be available in the global Perl path.

diff -crB circos-0.69-6/bin/circos circos-0.69-6-new/bin/circos
*** circos-0.69-6/bin/circos	2016-02-19 01:42:59.000000000 +0100
--- circos-0.69-6-new/bin/circos	2018-01-12 09:59:25.662731269 +0100
***************
*** 474,486 ****

  use strict;
  use warnings;
- use FindBin;
  use Getopt::Long qw(:config pass_through posix_default auto_abbrev);
  use Pod::Usage;

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
  use Circos;

  use Cwd;
--- 474,482 ----
diff -crB circos-0.69-6/lib/Circos/Colors.pm circos-0.69-6-new/lib/Circos/Colors.pm
*** circos-0.69-6/lib/Circos/Colors.pm	2015-03-17 01:25:43.000000000 +0100
--- circos-0.69-6-new/lib/Circos/Colors.pm	2018-01-12 10:10:39.174797379 +0100
***************
*** 49,55 ****

  use Carp qw( carp confess croak );
  use Digest::MD5 qw(md5_hex);
- use FindBin;
  use File::Basename;
  use File::Spec::Functions;
  use File::Temp qw(tempdir);
--- 49,54 ----
***************
*** 65,74 ****
  #use Time::HiRes qw(gettimeofday tv_interval);
  #use List::Util qw( max min );

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use POSIX qw(pow);

  use Circos::Configuration;
--- 64,69 ----
diff -crB circos-0.69-6/lib/Circos/Configuration.pm circos-0.69-6-new/lib/Circos/Configuration.pm
*** circos-0.69-6/lib/Circos/Configuration.pm	2015-03-17 22:11:01.000000000 +0100
--- circos-0.69-6-new/lib/Circos/Configuration.pm	2018-01-12 10:11:41.064008273 +0100
***************
*** 59,68 ****
  use Params::Validate qw(:all);
  use List::MoreUtils qw(uniq);

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Constants;
  use Circos::Debug;
  use Circos::Utils;
--- 59,64 ----
diff -crB circos-0.69-6/lib/Circos/DataPoint.pm circos-0.69-6-new/lib/Circos/DataPoint.pm
*** circos-0.69-6/lib/Circos/DataPoint.pm	2014-05-12 18:20:19.000000000 +0200
--- circos-0.69-6-new/lib/Circos/DataPoint.pm	2018-01-12 10:11:54.888270731 +0100
***************
*** 38,51 ****

  use Carp qw( carp confess croak );
  use Data::Dumper;
- use FindBin;
  use GD::Image;
  use Params::Validate qw(:all);

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Configuration; # qw(%CONF $DIMS);
  use Circos::Constants;
  use Circos::Debug;
--- 38,46 ----
diff -crB circos-0.69-6/lib/Circos/Debug.pm circos-0.69-6-new/lib/Circos/Debug.pm
*** circos-0.69-6/lib/Circos/Debug.pm	2015-03-24 01:26:13.000000000 +0100
--- circos-0.69-6-new/lib/Circos/Debug.pm	2018-01-12 10:12:07.192502006 +0100
***************
*** 63,75 ****

  use Carp qw( carp confess croak );
  use Data::Dumper;
- use FindBin;
  use Memoize;
  use List::MoreUtils qw(uniq);
  use Time::HiRes qw(gettimeofday tv_interval);
- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";

  use Circos::Constants;

--- 63,71 ----
diff -crB circos-0.69-6/lib/Circos/Division.pm circos-0.69-6-new/lib/Circos/Division.pm
*** circos-0.69-6/lib/Circos/Division.pm	2015-11-17 00:55:58.000000000 +0100
--- circos-0.69-6-new/lib/Circos/Division.pm	2018-01-12 10:12:21.544769084 +0100
***************
*** 37,52 ****
  our @EXPORT = qw();

  use Carp qw( carp confess croak );
- use FindBin;
  use GD;
  use Math::Round;
  use List::MoreUtils qw(uniq);
  use Params::Validate qw(:all);

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Configuration;
  use Circos::Constants;
  use Circos::Debug;
--- 37,47 ----
diff -crB circos-0.69-6/lib/Circos/Error.pm circos-0.69-6-new/lib/Circos/Error.pm
*** circos-0.69-6/lib/Circos/Error.pm	2015-03-17 22:46:36.000000000 +0100
--- circos-0.69-6-new/lib/Circos/Error.pm	2018-01-12 10:12:32.472970548 +0100
***************
*** 44,53 ****
  use Params::Validate;
  use Text::Format;

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Constants;
  use Circos::Debug;
  use Circos::Utils;
--- 44,49 ----
diff -crB circos-0.69-6/lib/Circos/Expression.pm circos-0.69-6-new/lib/Circos/Expression.pm
*** circos-0.69-6/lib/Circos/Expression.pm	2015-11-30 23:49:36.000000000 +0100
--- circos-0.69-6-new/lib/Circos/Expression.pm	2018-01-12 10:12:41.953144015 +0100
***************
*** 39,55 ****

  use Carp qw( carp confess croak );
  use Data::Dumper;
- use FindBin;
  use Params::Validate qw(:all);
  use Math::Round;
  use Math::VecStat qw(average);
  use List::Util qw(min max);
  use Text::Balanced qw(extract_bracketed);

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Configuration;
  use Circos::Constants;
  use Circos::Debug;
--- 39,50 ----
diff -crB circos-0.69-6/lib/Circos/Font.pm circos-0.69-6-new/lib/Circos/Font.pm
*** circos-0.69-6/lib/Circos/Font.pm	2014-05-12 18:20:19.000000000 +0200
--- circos-0.69-6-new/lib/Circos/Font.pm	2018-01-12 10:12:51.657320357 +0100
***************
*** 45,59 ****
  );

  use Carp qw( carp confess croak );
- use FindBin;
  use GD::Image;
  use Font::TTF::Font;
  use Params::Validate qw(:all);

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Configuration; # qw(%CONF $DIMS fetch_conf);
  use Circos::Constants;
  use Circos::Colors;
--- 45,54 ----
diff -crB circos-0.69-6/lib/Circos/Geometry.pm circos-0.69-6-new/lib/Circos/Geometry.pm
*** circos-0.69-6/lib/Circos/Geometry.pm	2014-05-12 18:20:19.000000000 +0200
--- circos-0.69-6-new/lib/Circos/Geometry.pm	2018-01-12 10:12:58.961452282 +0100
***************
*** 41,54 ****
  );

  use Carp qw( carp confess croak );
- use FindBin;
  use GD::Image;
  use Params::Validate qw(:all);

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Configuration; # qw(%CONF $DIMS fetch_conf);
  use Circos::Constants;
  use Circos::Debug;
--- 41,49 ----
diff -crB circos-0.69-6/lib/Circos/Heatmap.pm circos-0.69-6-new/lib/Circos/Heatmap.pm
*** circos-0.69-6/lib/Circos/Heatmap.pm	2016-03-30 22:08:12.000000000 +0200
--- circos-0.69-6-new/lib/Circos/Heatmap.pm	2018-01-12 10:13:09.953649538 +0100
***************
*** 24,40 ****
  use Carp qw( carp confess croak );
  use Clone;
  use Data::Dumper;
- use FindBin;
  use GD::Image;
  use Math::VecStat qw(min max);
  use Params::Validate qw(:all);
  use List::MoreUtils qw(uniq);
  use Regexp::Common qw(number);

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Configuration;
  use Circos::Constants;
  use Circos::Colors;
--- 24,35 ----
diff -crB circos-0.69-6/lib/Circos/Ideogram.pm circos-0.69-6-new/lib/Circos/Ideogram.pm
*** circos-0.69-6/lib/Circos/Ideogram.pm	2015-11-17 01:18:53.000000000 +0100
--- circos-0.69-6-new/lib/Circos/Ideogram.pm	2018-01-12 10:13:22.045864798 +0100
***************
*** 40,46 ****

  use Carp qw( carp confess croak );
  use Cwd;
- use FindBin;
  use File::Spec::Functions;
  use Math::Round;
  use Math::VecStat qw(max);
--- 40,45 ----
***************
*** 50,59 ****

  use POSIX qw(floor ceil);

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Configuration;
  use Circos::Constants;
  use Circos::Debug;
--- 49,54 ----
diff -crB circos-0.69-6/lib/Circos/Image.pm circos-0.69-6-new/lib/Circos/Image.pm
*** circos-0.69-6/lib/Circos/Image.pm	2014-05-12 18:20:19.000000000 +0200
--- circos-0.69-6-new/lib/Circos/Image.pm	2018-01-12 10:13:31.094024696 +0100
***************
*** 45,58 ****
  );

  use Carp qw( carp confess croak );
- use FindBin;
  use GD::Image;
  use Params::Validate qw(:all);

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Configuration;
  use Circos::Colors;
  use Circos::Constants;
--- 45,53 ----
diff -crB circos-0.69-6/lib/Circos/IO.pm circos-0.69-6-new/lib/Circos/IO.pm
*** circos-0.69-6/lib/Circos/IO.pm	2015-12-03 05:51:11.000000000 +0100
--- circos-0.69-6-new/lib/Circos/IO.pm	2018-01-12 10:13:41.686210640 +0100
***************
*** 39,45 ****
  use Carp qw( carp confess croak );
  use Storable qw(dclone);
  use Cwd;
- use FindBin;
  use Data::Dumper;
  use File::Spec::Functions;
  use Math::Round;
--- 39,44 ----
***************
*** 49,58 ****

  use POSIX qw(floor ceil);

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Constants;
  use Circos::Colors;
  use Circos::Configuration;
--- 48,53 ----
diff -crB circos-0.69-6/lib/Circos/Karyotype.pm circos-0.69-6-new/lib/Circos/Karyotype.pm
*** circos-0.69-6/lib/Circos/Karyotype.pm	2014-09-09 00:15:58.000000000 +0200
--- circos-0.69-6-new/lib/Circos/Karyotype.pm	2018-01-12 10:13:53.318413330 +0100
***************
*** 38,44 ****

  use Carp qw( carp confess croak );
  use Cwd;
- use FindBin;
  use Math::Round;
  use Math::VecStat qw(max);
  use Params::Validate qw(:all);
--- 38,43 ----
***************
*** 48,57 ****
  #use Regexp::Common qw(number);
  #use POSIX qw(floor ceil);

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Configuration;
  use Circos::Constants;
  use Circos::Debug;
--- 47,52 ----
diff -crB circos-0.69-6/lib/Circos/PNG.pm circos-0.69-6-new/lib/Circos/PNG.pm
*** circos-0.69-6/lib/Circos/PNG.pm	2014-09-17 05:33:06.000000000 +0200
--- circos-0.69-6-new/lib/Circos/PNG.pm	2018-01-12 10:14:31.011059637 +0100
***************
*** 37,51 ****
  our @EXPORT = qw();

  use Carp qw( carp confess croak );
- use FindBin;
  use GD;
  use Math::VecStat qw(min max);
  use Params::Validate qw(:all);

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Configuration;
  use Circos::Colors;
  use Circos::Constants;
--- 37,46 ----
diff -crB circos-0.69-6/lib/Circos/Rule.pm circos-0.69-6-new/lib/Circos/Rule.pm
*** circos-0.69-6/lib/Circos/Rule.pm	2014-10-02 01:14:25.000000000 +0200
--- circos-0.69-6-new/lib/Circos/Rule.pm	2018-01-12 10:14:38.195181067 +0100
***************
*** 38,51 ****

  use Carp qw( carp confess croak );
  use Data::Dumper;
- use FindBin;
  use GD::Image;
  use Params::Validate qw(:all);

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Configuration; # qw(%CONF $DIMS);
  use Circos::Constants;
  use Circos::DataPoint;
--- 38,46 ----
diff -crB circos-0.69-6/lib/Circos/SVG.pm circos-0.69-6-new/lib/Circos/SVG.pm
*** circos-0.69-6/lib/Circos/SVG.pm	2015-11-30 23:23:52.000000000 +0100
--- circos-0.69-6-new/lib/Circos/SVG.pm	2018-01-12 10:14:47.803342631 +0100
***************
*** 26,39 ****
  							 );

  use Carp qw( carp confess croak );
- use FindBin;
  use GD::Image;
  use Params::Validate qw(:all);

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Configuration;
  use Circos::Colors;
  use Circos::Constants;
--- 26,34 ----
diff -crB circos-0.69-6/lib/Circos/Text.pm circos-0.69-6-new/lib/Circos/Text.pm
*** circos-0.69-6/lib/Circos/Text.pm	2014-05-12 18:20:19.000000000 +0200
--- circos-0.69-6-new/lib/Circos/Text.pm	2018-01-12 10:14:57.083497772 +0100
***************
*** 42,55 ****
  );

  use Carp qw( carp confess croak );
- use FindBin;
  use GD::Image;
  use Params::Validate qw(:all);

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Configuration; # qw(%CONF $DIMS);
  use Circos::Constants;
  use Circos::Colors;
--- 42,50 ----
diff -crB circos-0.69-6/lib/Circos/Track/Highlight.pm circos-0.69-6-new/lib/Circos/Track/Highlight.pm
*** circos-0.69-6/lib/Circos/Track/Highlight.pm	2014-10-01 00:43:27.000000000 +0200
--- circos-0.69-6-new/lib/Circos/Track/Highlight.pm	2018-01-12 10:15:06.795659206 +0100
***************
*** 37,50 ****
  our @EXPORT = qw();

  use Carp qw( carp confess croak );
- use FindBin;
  use GD::Image;
  use Params::Validate qw(:all);

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Configuration; # qw(%CONF $DIMS);
  use Circos::Constants;
  #use Circos::Colors;
--- 37,45 ----
diff -crB circos-0.69-6/lib/Circos/Track/Link.pm circos-0.69-6-new/lib/Circos/Track/Link.pm
*** circos-0.69-6/lib/Circos/Track/Link.pm	2014-05-12 18:20:19.000000000 +0200
--- circos-0.69-6-new/lib/Circos/Track/Link.pm	2018-01-12 10:15:17.387834198 +0100
***************
*** 37,50 ****
  our @EXPORT = qw();

  use Carp qw( carp confess croak );
- use FindBin;
  use GD::Image;
  use Params::Validate qw(:all);

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Configuration; # qw(%CONF $DIMS);
  use Circos::Constants;
  #use Circos::Colors;
--- 37,45 ----
diff -crB circos-0.69-6/lib/Circos/Track.pm circos-0.69-6-new/lib/Circos/Track.pm
*** circos-0.69-6/lib/Circos/Track.pm	2014-09-16 05:31:46.000000000 +0200
--- circos-0.69-6-new/lib/Circos/Track.pm	2018-01-12 10:15:29.628035063 +0100
***************
*** 41,56 ****

  use Carp qw( carp confess croak );
  use Data::Dumper;
- use FindBin;
  use GD::Image;
  use List::MoreUtils qw(uniq);
  use Math::VecStat qw(min max);
  use Params::Validate qw(:all);
  use Regexp::Common;
  use Statistics::Basic qw(average stddev);
- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";

  use Circos::Configuration; # qw(%CONF $DIMS);
  use Circos::Constants;
--- 41,52 ----
diff -crB circos-0.69-6/lib/Circos/Unit.pm circos-0.69-6-new/lib/Circos/Unit.pm
*** circos-0.69-6/lib/Circos/Unit.pm	2014-05-12 18:20:19.000000000 +0200
--- circos-0.69-6-new/lib/Circos/Unit.pm	2018-01-12 10:15:37.892169871 +0100
***************
*** 46,60 ****
  );

  use Carp qw( carp confess croak );
- use FindBin;
  use Data::Dumper;
  use Params::Validate qw(:all);
  use Regexp::Common qw(number);

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Configuration qw(%CONF $DIMS);
  use Circos::Constants;
  use Circos::Debug;
--- 46,55 ----
diff -crB circos-0.69-6/lib/Circos/URL.pm circos-0.69-6-new/lib/Circos/URL.pm
*** circos-0.69-6/lib/Circos/URL.pm	2014-05-12 18:20:19.000000000 +0200
--- circos-0.69-6-new/lib/Circos/URL.pm	2018-01-12 10:15:46.092303006 +0100
***************
*** 39,52 ****
  );

  use Carp qw( carp confess croak );
- use FindBin;
  use GD;
  use Params::Validate qw(:all);

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Configuration;
  #use Circos::Colors;
  use Circos::Constants;
--- 39,47 ----
diff -crB circos-0.69-6/lib/Circos/Utils.pm circos-0.69-6-new/lib/Circos/Utils.pm
*** circos-0.69-6/lib/Circos/Utils.pm	2014-10-01 21:36:19.000000000 +0200
--- circos-0.69-6-new/lib/Circos/Utils.pm	2018-01-12 10:16:11.576712858 +0100
***************
*** 105,114 ****

  use POSIX qw(floor ceil);

- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";
-
  use Circos::Constants;
  use Circos::Debug;
  use Circos::Error;
--- 105,110 ----
diff -crB circos-0.69-6/lib/Circos.pm circos-0.69-6-new/lib/Circos.pm
*** circos-0.69-6/lib/Circos.pm	2016-06-25 00:19:27.000000000 +0200
--- circos-0.69-6-new/lib/Circos.pm	2018-01-12 10:16:35.801097176 +0100
***************
*** 49,57 ****

  use strict;
  use warnings;
- use lib "$FindBin::RealBin";
- use lib "$FindBin::RealBin/../lib";
- use lib "$FindBin::RealBin/lib";

  BEGIN {
  	require Circos::Modules;
--- 49,54 ----


code:
Search for ASDF configuration files first in user directories, and then in
Guix profiles.

diff -ru a/asdf-3.3.4.lisp b/asdf-3.3.4.lisp
--- a/asdf-3.3.4.lisp	2020-02-14 20:16:22.000000000 +0100
+++ b/asdf-3.3.4.lisp	2020-12-05 11:09:56.066229482 +0100
@@ -12535,10 +12535,15 @@
     (find-preferred-file (system-config-pathnames *output-translations-file*)
                          :direction direction))
   (defun user-output-translations-directory-pathname (&key (direction :input))
-    (xdg-config-pathname *output-translations-directory* direction))
-  (defun system-output-translations-directory-pathname (&key (direction :input))
-    (find-preferred-file (system-config-pathnames *output-translations-directory*)
+    (find-preferred-file (list (xdg-config-home *output-translations-directory*))
                          :direction direction))
+  (defun system-output-translations-directory-pathname (&key (direction :input))
+    `(:output-translations
+      ,@(loop :for dir :in (filter-pathname-set
+                            (xdg-config-dirs
+                             "common-lisp/asdf-output-translations.conf.d/"))
+              :collect `(:include ,dir))
+      :inherit-configuration))
   (defun environment-output-translations ()
     (getenv "ASDF_OUTPUT_TRANSLATIONS"))

@@ -12921,10 +12926,15 @@
     (find-preferred-file (system-config-pathnames *source-registry-file*)
                          :direction direction))
   (defun user-source-registry-directory (&key (direction :input))
-    (xdg-config-pathname *source-registry-directory* direction))
-  (defun system-source-registry-directory (&key (direction :input))
-    (find-preferred-file (system-config-pathnames *source-registry-directory*)
+    (find-preferred-file (list (xdg-config-home *source-registry-directory*))
                          :direction direction))
+  (defun system-source-registry-directory (&key (direction :input))
+    `(:source-registry
+      ,@(loop :for dir :in (filter-pathname-set
+                            (xdg-config-dirs
+                             "common-lisp/source-registry.conf.d/"))
+              :collect `(:include ,dir))
+      :inherit-configuration))
   (defun environment-source-registry ()
     (getenv "CL_SOURCE_REGISTRY"))


code:
Our llvm does not contain a single top-level library, so consult llvm-config
for the libraries that need to be linked against.

--- clamav-0.100.2/libclamav/c++/configure.ac	2018-09-19 14:29:07.000000000 -0500
+++ clamav-0.100.2/libclamav/c++/configure.ac	2018-10-06 21:45:09.377249158 -0500
@@ -105,7 +105,7 @@

     if test "x$llvm_linking" = "xdynamic"; then
         AC_SUBST(LLVMCONFIG_LDFLAGS, [`$llvmconfig --ldflags`])
-        AC_SUBST(LLVMCONFIG_LIBS, [-lLLVM-$llvmver])
+        AC_SUBST(LLVMCONFIG_LIBS, [`$llvmconfig --libs $llvmcomp`])
         AC_SUBST(LLVMCONFIG_LIBFILES, [])
     else
         if test $llvmver_test -ge 350; then


code:
From: Tobias Geerinckx-Rice <me@tobias.gr>
Date: Sat, 03 Oct 2020 22:10:20 +0200
Subject: gnu: clamav: Add support for system tomsfastmath.

Adjusted from the original for clamav 0.103.0:

From 756ff89526b5ffaa7a4f49b1bbecf2ecbd6f85f9 Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Date: Wed, 11 Mar 2015 20:03:15 +0100
Subject: add support for system tomsfastmath

Patch-Name: add-support-for-system-tomsfastmath.patch
---
 configure.ac                           |    2 ++
 libclamav/Makefile.am                  |   10 ++++++++--
 libclamav/bignum.h                     |    6 +++++-
 libclamav/xdp.c                        |    2 +-
 m4/reorganization/libs/tomsfastmath.m4 |   12 ++++++++++++
 5 files changed, 28 insertions(+), 4 deletions(-)
 create mode 100644 m4/reorganization/libs/tomsfastmath.m4

diff -Naur a/configure.ac b/configure.ac
--- a/configure.ac	1970-01-01 01:00:01.000000000 +0100
+++ b/configure.ac	2020-10-03 22:04:00.535448352 +0200
@@ -94,6 +94,7 @@
 m4_include([m4/reorganization/libs/json.m4])
 m4_include([m4/reorganization/libs/pcre.m4])
 m4_include([m4/reorganization/libs/libmspack.m4])
+m4_include([m4/reorganization/libs/tomsfastmath.m4])

 if test "x$use_internal_mspack" = "xno"; then
     mspack_msg="External, $LIBMSPACK_CFLAGS $LIBMSPACK_LIBS"
@@ -361,6 +362,7 @@
 fi
 CL_MSG_STATUS([yara        ],[$enable_yara],[$enable_yara])
 CL_MSG_STATUS([fts         ],[yes],[$lfs_fts_msg])
+CL_MSG_STATUS([tomsfastmath],[yes],[$tomsfastmath_msg])

 # Yep, downgrading the compiler avoids the bug too:
diff -Naur a/libclamav/bignum.h b/libclamav/bignum.h
--- a/libclamav/bignum.h	1970-01-01 01:00:01.000000000 +0100
+++ b/libclamav/bignum.h	2020-10-03 22:04:00.535448352 +0200
@@ -1,9 +1,13 @@
 #ifndef BIGNUM_H_
 #define BIGNUM_H_

+#if HAVE_SYSTEM_TOMSFASTMATH
+#include <tfm.h>
+#else
 #define TFM_CHECK
-
 #include "bignum_fast.h"
+#endif
+
 typedef fp_int mp_int;
 #define mp_cmp fp_cmp
 #define mp_toradix_n(a, b, c, d) fp_toradix_n(a, b, c, d)
diff -Naur a/libclamav/Makefile.am b/libclamav/Makefile.am
--- a/libclamav/Makefile.am	1970-01-01 01:00:01.000000000 +0100
+++ b/libclamav/Makefile.am	2020-10-03 22:06:42.705447754 +0200
@@ -588,8 +588,10 @@
 	yara_clam.h
 endif

-libclamav_la_SOURCES += bignum.h\
-	bignum_fast.h\
+libclamav_la_SOURCES += bignum.h
+
+if !SYSTEM_TOMSFASTMATH
+libclamav_la_SOURCES += bignum_fast.h\
 	tomsfastmath/addsub/fp_add.c\
 	tomsfastmath/addsub/fp_add_d.c\
 	tomsfastmath/addsub/fp_addmod.c\
@@ -671,6 +673,10 @@
 	tomsfastmath/sqr/fp_sqr_comba_generic.c\
 	tomsfastmath/sqr/fp_sqr_comba_small_set.c\
 	tomsfastmath/sqr/fp_sqrmod.c
+else
+libclamav_la_CFLAGS += $(TOMSFASTMATH_CFLAGS)
+libclamav_la_LIBADD += $(TOMSFASTMATH_LIBS)
+endif

 .PHONY2: version.h.tmp
 version.c: version.h
diff -Naur a/libclamav/xdp.c b/libclamav/xdp.c
--- a/libclamav/xdp.c	1970-01-01 01:00:01.000000000 +0100
+++ b/libclamav/xdp.c	2020-10-03 22:04:00.535448352 +0200
@@ -52,7 +52,7 @@
 #include "scanners.h"
 #include "conv.h"
 #include "xdp.h"
-#include "bignum_fast.h"
+#include "bignum.h"
 #include "filetypes.h"

 static char *dump_xdp(cli_ctx *ctx, const char *start, size_t sz);
diff -Naur a/m4/reorganization/libs/tomsfastmath.m4 b/m4/reorganization/libs/tomsfastmath.m4
--- a/m4/reorganization/libs/tomsfastmath.m4	1970-01-01 01:00:00.000000000 +0100
+++ b/m4/reorganization/libs/tomsfastmath.m4	2020-10-03 22:04:00.535448352 +0200
@@ -0,0 +1,12 @@
+dnl Check for system tomsfastmath
+PKG_CHECK_MODULES([TOMSFASTMATH], [tomsfastmath], [have_system_tomsfastmath=yes], [have_system_tomsfastmath=no])
+
+AM_CONDITIONAL([SYSTEM_TOMSFASTMATH], [test "x$have_system_tomsfastmath" = "xyes"])
+
+if test "x$have_system_tomsfastmath" = "xyes"; then
+    AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [1], [link against system-wide tomsfastmath library])
+    tomsfastmath_msg="External, $TOMSFASTMATH_CFLAGS $TOMSFASTMATH_LIBS"
+else
+    AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [0], [don't link against system-wide tomsfastmath library])
+    tomsfastmath_msg="Internal"
+fi


code:
Clang attempts to guess file names based on the OS and distro (yes!),
but unfortunately, that doesn't work for us.

This patch makes it easy to insert libc's $libdir so that Clang passes the
correct absolute file name of crt1.o etc. to 'ld'.  It also disables all
the distro-specific stuff and removes the hard-coded FHS directory names
to make sure Clang also works on non-Guix systems.

diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
index bff1ab10..79e1477e 100644
--- a/lib/Driver/ToolChains/Linux.cpp
+++ b/lib/Driver/ToolChains/Linux.cpp
@@ -240,6 +240,9 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
                          .str());
   }

+// Comment out the distro-specific tweaks so that they don't bite when
+// using Guix on a foreign distro.
+#if 0
   Distro Distro(D.getVFS(), Triple);

   if (Distro.IsAlpineLinux() || Triple.isAndroid()) {
@@ -306,6 +309,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)

   if (IsAndroid || Distro.IsOpenSUSE())
     ExtraOpts.push_back("--enable-new-dtags");
+#endif	// Guix

   // The selection of paths to try here is designed to match the patterns which
   // the GCC driver itself uses, as this is part of the GCC-compatible driver.
@@ -363,7 +367,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
     // the cross. Note that GCC does include some of these directories in some
     // configurations but this seems somewhere between questionable and simply
     // a bug.
-    if (StringRef(LibPath).startswith(SysRoot)) {
+    if (0) {
       addPathIfExists(D, LibPath + "/" + MultiarchTriple, Paths);
       addPathIfExists(D, LibPath + "/../" + OSLibDir, Paths);
     }
@@ -382,6 +386,8 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
   addPathIfExists(D, SysRoot + "/lib/" + MultiarchTriple, Paths);
   addPathIfExists(D, SysRoot + "/lib/../" + OSLibDir, Paths);

+// This requires the commented distro tweaks above.
+#if 0
   if (IsAndroid) {
     // Android sysroots contain a library directory for each supported OS
     // version as well as some unversioned libraries in the usual multiarch
@@ -410,10 +416,15 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
     addPathIfExists(D, SysRoot + "/" + OSLibDir + "/" + ABIName, Paths);
     addPathIfExists(D, SysRoot + "/usr/" + OSLibDir + "/" + ABIName, Paths);
   }
+#endif

   // Try walking via the GCC triple path in case of biarch or multiarch GCC
   // installations with strange symlinks.
   if (GCCInstallation.isValid()) {
+
+// The following code would end up adding things like
+// "/usr/lib/x86_64-unknown-linux-gnu/../../lib64" to the search path.
+#if 0
     addPathIfExists(D,
                     SysRoot + "/usr/lib/" + GCCInstallation.getTriple().str() +
                         "/../../" + OSLibDir,
@@ -426,6 +437,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
                              BiarchSibling.gccSuffix(),
                       Paths);
     }
+#endif

     // See comments above on the multilib variant for details of why this is
     // included even from outside the sysroot.
@@ -450,8 +462,9 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
   if (StringRef(D.Dir).startswith(SysRoot))
     addPathIfExists(D, D.Dir + "/../lib", Paths);

-  addPathIfExists(D, SysRoot + "/lib", Paths);
-  addPathIfExists(D, SysRoot + "/usr/lib", Paths);
+  // Add libc's lib/ directory to the search path, so that crt1.o, crti.o,
+  // and friends can be found.
+  addPathIfExists(D, "@GLIBC_LIBDIR@", Paths);
 }

 ToolChain::CXXStdlibType Linux::GetDefaultCXXStdlibType() const {


code:
Clang attempts to guess file names based on the OS and distro (yes!),
but unfortunately, that doesn't work for us.

This patch makes it easy to insert libc's $libdir so that Clang passes the
correct absolute file name of crt1.o etc. to 'ld'.  It also disables all
the distro-specific stuff and removes the hard-coded FHS directory names
to make sure Clang also works on non-Guix systems.

diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
--- a/lib/Driver/ToolChains/Gnu.cpp
+++ b/lib/Driver/ToolChains/Gnu.cpp
@@ -2797,7 +2797,7 @@ void Generic_GCC::AddMultilibPaths(const Driver &D,
     // the cross. Note that GCC does include some of these directories in some
     // configurations but this seems somewhere between questionable and simply
     // a bug.
-    if (StringRef(LibPath).startswith(SysRoot)) {
+    if (0) {
       addPathIfExists(D, LibPath + "/" + MultiarchTriple, Paths);
       addPathIfExists(D, LibPath + "/../" + OSLibDir, Paths);
     }
@@ -2811,6 +2811,10 @@ void Generic_GCC::AddMultiarchPaths(const Driver &D,
   // Try walking via the GCC triple path in case of biarch or multiarch GCC
   // installations with strange symlinks.
   if (GCCInstallation.isValid()) {
+
+// The following code would end up adding things like
+// "/usr/lib/x86_64-unknown-linux-gnu/../../lib64" to the search path.
+#if 0
     addPathIfExists(D,
                     SysRoot + "/usr/lib/" + GCCInstallation.getTriple().str() +
                         "/../../" + OSLibDir,
@@ -2823,6 +2827,7 @@ void Generic_GCC::AddMultiarchPaths(const Driver &D,
           D, GCCInstallation.getInstallPath() + BiarchSibling.gccSuffix(),
                       Paths);
     }
+#endif // Guix

     // See comments above on the multilib variant for details of why this is
     // included even from outside the sysroot.
diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
--- a/lib/Driver/ToolChains/Linux.cpp
+++ b/lib/Driver/ToolChains/Linux.cpp
@@ -219,6 +219,9 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)

   Generic_GCC::PushPPaths(PPaths);

+// Comment out the distro-specific tweaks so that they don't bite when
+// using Guix on a foreign distro.
+#if 0
   Distro Distro(D.getVFS(), Triple);

   if (Distro.IsAlpineLinux() || Triple.isAndroid()) {
@@ -284,6 +287,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)

   if (IsAndroid || Distro.IsOpenSUSE())
     ExtraOpts.push_back("--enable-new-dtags");
+#endif	// Guix

   // The selection of paths to try here is designed to match the patterns which
   // the GCC driver itself uses, as this is part of the GCC-compatible driver.
@@ -310,6 +314,8 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
   addPathIfExists(D, SysRoot + "/lib/" + MultiarchTriple, Paths);
   addPathIfExists(D, SysRoot + "/lib/../" + OSLibDir, Paths);

+// This requires the commented distro tweaks above.
+#if 0
   if (IsAndroid) {
     // Android sysroots contain a library directory for each supported OS
     // version as well as some unversioned libraries in the usual multiarch
@@ -338,6 +344,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
     addPathIfExists(D, SysRoot + "/" + OSLibDir + "/" + ABIName, Paths);
     addPathIfExists(D, SysRoot + "/usr/" + OSLibDir + "/" + ABIName, Paths);
   }
+#endif // Guix

   Generic_GCC::AddMultiarchPaths(D, SysRoot, OSLibDir, Paths);

@@ -349,8 +356,9 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
   if (StringRef(D.Dir).startswith(SysRoot))
     addPathIfExists(D, D.Dir + "/../lib", Paths);

-  addPathIfExists(D, SysRoot + "/lib", Paths);
-  addPathIfExists(D, SysRoot + "/usr/lib", Paths);
+  // Add libc's lib/ directory to the search path, so that crt1.o, crti.o,
+  // and friends can be found.
+  addPathIfExists(D, "@GLIBC_LIBDIR@", Paths);
 }

 ToolChain::CXXStdlibType Linux::GetDefaultCXXStdlibType() const {


code:
Help CMake locate the "tools-extra" directory.

Taken from <https://bugs.llvm.org/show_bug.cgi?id=49990#c3>.

diff --git a/clang-tools-extra/clangd/quality/CompletionModel.cmake b/clang-tools-extra/clangd/quality/CompletionModel.cmake
--- a/clangd/quality/CompletionModel.cmake
+++ b/clangd/quality/CompletionModel.cmake
@@ -5,7 +5,7 @@
 # will define a C++ class called ${cpp_class} - which may be a
 # namespace-qualified class name.
 function(gen_decision_forest model filename cpp_class)
-  set(model_compiler ${CMAKE_SOURCE_DIR}/../clang-tools-extra/clangd/quality/CompletionModelCodegen.py)
+  set(model_compiler ${CMAKE_CURRENT_LIST_DIR}/quality/CompletionModelCodegen.py)

   set(output_dir ${CMAKE_CURRENT_BINARY_DIR})
   set(header_file ${output_dir}/${filename}.h)


code:
Clang attempts to guess file names based on the OS and distro (yes!),
but unfortunately, that doesn't work for us.

This patch makes it easy to insert libc's $libdir so that Clang passes the
correct absolute file name of crt1.o etc. to 'ld'.  It also disables all
the distro-specific stuff and removes the hard-coded FHS directory names
to make sure Clang also works on non-GuixSD systems.

--- cfe-3.6.0.src/lib/Driver/ToolChains.cpp	2015-02-18 22:03:07.000000000 +0100
+++ cfe-3.6.0.src/lib/Driver/ToolChains.cpp	2015-06-19 16:37:20.459701044 +0200
@@ -2931,6 +2931,9 @@ Linux::Linux(const Driver &D, const llvm

   Linker = GetLinkerPath();

+  // Comment out the distro-specific tweaks so that they don't bite when
+  // using Guix on a foreign distro.
+#if 0
   Distro Distro = DetectDistro(Arch);

   if (IsOpenSUSE(Distro) || IsUbuntu(Distro)) {
@@ -2973,6 +2976,7 @@ Linux::Linux(const Driver &D, const llvm

   if (IsOpenSUSE(Distro))
     ExtraOpts.push_back("--enable-new-dtags");
+#endif

   // The selection of paths to try here is designed to match the patterns which
   // the GCC driver itself uses, as this is part of the GCC-compatible driver.
@@ -3043,14 +3047,12 @@ Linux::Linux(const Driver &D, const llvm
     addPathIfExists(D.Dir + "/../" + OSLibDir, Paths);
   }

-  addPathIfExists(SysRoot + "/lib/" + MultiarchTriple, Paths);
-  addPathIfExists(SysRoot + "/lib/../" + OSLibDir, Paths);
-  addPathIfExists(SysRoot + "/usr/lib/" + MultiarchTriple, Paths);
-  addPathIfExists(SysRoot + "/usr/lib/../" + OSLibDir, Paths);
-
   // Try walking via the GCC triple path in case of biarch or multiarch GCC
   // installations with strange symlinks.
   if (GCCInstallation.isValid()) {
+    // The following code would end up adding things like
+    // "/usr/lib/x86_64-unknown-linux-gnu/../../lib64" to the search path.
+#if 0
     addPathIfExists(SysRoot + "/usr/lib/" + GCCInstallation.getTriple().str() +
                     "/../../" + OSLibDir, Paths);

@@ -3060,6 +3062,7 @@ Linux::Linux(const Driver &D, const llvm
       addPathIfExists(GCCInstallation.getInstallPath() +
                       BiarchSibling.gccSuffix(), Paths);
     }
+#endif

     // See comments above on the multilib variant for details of why this is
     // included even from outside the sysroot.
@@ -3083,8 +3086,9 @@ Linux::Linux(const Driver &D, const llvm
   if (StringRef(D.Dir).startswith(SysRoot))
     addPathIfExists(D.Dir + "/../lib", Paths);

-  addPathIfExists(SysRoot + "/lib", Paths);
-  addPathIfExists(SysRoot + "/usr/lib", Paths);
+  // Add libc's lib/ directory to the search path, so that crt1.o, crti.o,
+  // and friends can be found.
+  addPathIfExists("@GLIBC_LIBDIR@", Paths);
 }

 bool Linux::HasNativeLLVMSupport() const {


code:
From d9d97cac3702b99a00cd113de98c41eb535d47ed Mon Sep 17 00:00:00 2001
From: Efraim Flashner <efraim@flashner.co.il>
Date: Sun, 14 Oct 2018 12:11:30 +0300
Subject: [PATCH] patch modified from the gcc patch series, also dealing with
 ustat.

---
 .../sanitizer_platform_limits_posix.cc            | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
index 29fea6e..570b9a5 100644
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -129,7 +129,6 @@
 #include <sys/statvfs.h>
 #include <sys/timex.h>
 #include <sys/user.h>
-#include <sys/ustat.h>
 #include <linux/cyclades.h>
 #include <linux/if_eql.h>
 #include <linux/if_plip.h>
@@ -222,7 +221,19 @@ namespace __sanitizer {
 #endif  // SANITIZER_LINUX || SANITIZER_FREEBSD

 #if SANITIZER_LINUX && !SANITIZER_ANDROID
-  unsigned struct_ustat_sz = sizeof(struct ustat);
+  // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
+  // has been removed from glibc 2.28.
+#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
+  || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
+  || defined(__x86_64__)
+#define SIZEOF_STRUCT_USTAT 32
+#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
+  || defined(__powerpc__) || defined(__s390__)
+#define SIZEOF_STRUCT_USTAT 20
+#else
+#error Unknown size of struct ustat
+#endif
+  unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
   unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
   unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
 #endif  // SANITIZER_LINUX && !SANITIZER_ANDROID
--
2.19.1


code:
Clang attempts to guess file names based on the OS and distro (yes!),
but unfortunately, that doesn't work for us.

This patch makes it easy to insert libc's $libdir so that Clang passes the
correct absolute file name of crt1.o etc. to 'ld'.  It also disables all
the distro-specific stuff and removes the hard-coded FHS directory names
to make sure Clang also works on non-GuixSD systems.

This patch makes slight adjustments over "clang-libc-search-path.patch" for
changes in clang 3.8.

--- cfe-3.8.0.src/lib/Driver/ToolChains.cpp
+++ cfe-3.8.0.src/lib/Driver/ToolChains.cpp
@@ -3661,6 +3661,9 @@
                          GCCInstallation.getTriple().str() + "/bin")
                        .str());

+  // Comment out the distro-specific tweaks so that they don't bite when
+  // using Guix on a foreign distro.
+#if 0
   Distro Distro = DetectDistro(D, Arch);

   if (IsOpenSUSE(Distro) || IsUbuntu(Distro)) {
@@ -3702,6 +3705,7 @@

   if (IsOpenSUSE(Distro))
     ExtraOpts.push_back("--enable-new-dtags");
+#endif

   // The selection of paths to try here is designed to match the patterns which
   // the GCC driver itself uses, as this is part of the GCC-compatible driver.
@@ -3771,14 +3775,12 @@
     addPathIfExists(D, D.Dir + "/../" + OSLibDir, Paths);
   }

-  addPathIfExists(D, SysRoot + "/lib/" + MultiarchTriple, Paths);
-  addPathIfExists(D, SysRoot + "/lib/../" + OSLibDir, Paths);
-  addPathIfExists(D, SysRoot + "/usr/lib/" + MultiarchTriple, Paths);
-  addPathIfExists(D, SysRoot + "/usr/lib/../" + OSLibDir, Paths);
-
   // Try walking via the GCC triple path in case of biarch or multiarch GCC
   // installations with strange symlinks.
   if (GCCInstallation.isValid()) {
+    // The following code would end up adding things like
+    // "/usr/lib/x86_64-unknown-linux-gnu/../../lib64" to the search path.
+#if 0
     addPathIfExists(D,
                     SysRoot + "/usr/lib/" + GCCInstallation.getTriple().str() +
                         "/../../" + OSLibDir,
@@ -3791,6 +3793,7 @@
                              BiarchSibling.gccSuffix(),
                       Paths);
     }
+#endif

     // See comments above on the multilib variant for details of why this is
     // included even from outside the sysroot.
@@ -3815,8 +3818,9 @@
   if (StringRef(D.Dir).startswith(SysRoot))
     addPathIfExists(D, D.Dir + "/../lib", Paths);

-  addPathIfExists(D, SysRoot + "/lib", Paths);
-  addPathIfExists(D, SysRoot + "/usr/lib", Paths);
+  // Add libc's lib/ directory to the search path, so that crt1.o, crti.o,
+  // and friends can be found.
+  addPathIfExists(D, "@GLIBC_LIBDIR@", Paths);
 }

 bool Linux::HasNativeLLVMSupport() const { return true; }


code:
Clang attempts to guess file names based on the OS and distro (yes!),
but unfortunately, that doesn't work for us.

This patch makes it easy to insert libc's $libdir so that Clang passes the
correct absolute file name of crt1.o etc. to 'ld'.  It also disables all
the distro-specific stuff and removes the hard-coded FHS directory names
to make sure Clang also works on non-GuixSD systems.

--- cfe-6.0.0.src/lib/Driver/ToolChains/Linux.cpp
+++ cfe-6.0.0.src/lib/Driver/ToolChains/Linux.cpp
@@ -207,7 +207,9 @@
   PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + "/../" +
                          GCCInstallation.getTriple().str() + "/bin")
                        .str());
-
+  // Comment out the distro-specific tweaks so that they don't bite when
+  // using Guix on a foreign distro.
+#if 0
   Distro Distro(D.getVFS());

   if (Distro.IsAlpineLinux()) {
@@ -255,6 +257,7 @@

   if (IsAndroid || Distro.IsOpenSUSE())
     ExtraOpts.push_back("--enable-new-dtags");
+#endif

   // The selection of paths to try here is designed to match the patterns which
   // the GCC driver itself uses, as this is part of the GCC-compatible driver.
@@ -329,14 +332,12 @@
     addPathIfExists(D, D.Dir + "/../" + OSLibDir, Paths);
   }

-  addPathIfExists(D, SysRoot + "/lib/" + MultiarchTriple, Paths);
-  addPathIfExists(D, SysRoot + "/lib/../" + OSLibDir, Paths);
-  addPathIfExists(D, SysRoot + "/usr/lib/" + MultiarchTriple, Paths);
-  addPathIfExists(D, SysRoot + "/usr/lib/../" + OSLibDir, Paths);
-
   // Try walking via the GCC triple path in case of biarch or multiarch GCC
   // installations with strange symlinks.
   if (GCCInstallation.isValid()) {
+    // The following code would end up adding things like
+    // "/usr/lib/x86_64-unknown-linux-gnu/../../lib64" to the search path.
+#if 0
     addPathIfExists(D,
                     SysRoot + "/usr/lib/" + GCCInstallation.getTriple().str() +
                         "/../../" + OSLibDir,
@@ -349,6 +350,7 @@
                              BiarchSibling.gccSuffix(),
                       Paths);
     }
+#endif

     // See comments above on the multilib variant for details of why this is
     // included even from outside the sysroot.
@@ -373,8 +375,9 @@
   if (StringRef(D.Dir).startswith(SysRoot))
     addPathIfExists(D, D.Dir + "/../lib", Paths);

-  addPathIfExists(D, SysRoot + "/lib", Paths);
-  addPathIfExists(D, SysRoot + "/usr/lib", Paths);
+  // Add libc's lib/ directory to the search path, so that crt1.o, crti.o,
+  // and friends can be found.
+  addPathIfExists(D, "@GLIBC_LIBDIR@", Paths);
 }

 bool Linux::HasNativeLLVMSupport() const { return true; }


code:
Clang attempts to guess file names based on the OS and distro (yes!),
but unfortunately, that doesn't work for us.

This patch makes it easy to insert libc's $libdir so that Clang passes the
correct absolute file name of crt1.o etc. to 'ld'.  It also disables all
the distro-specific stuff and removes the hard-coded FHS directory names
to make sure Clang also works on non-GuixSD systems.

--- a/lib/Driver/ToolChains/Linux.cpp
+++ b/lib/Driver/ToolChains/Linux.cpp
@@ -225,7 +225,9 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
   PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + "/../" +
                          GCCInstallation.getTriple().str() + "/bin")
                        .str());
-
+  // Comment out the distro-specific tweaks so that they don't bite when
+  // using Guix on a foreign distro.
+#if 0
   Distro Distro(D.getVFS());

   if (Distro.IsAlpineLinux()) {
@@ -284,6 +286,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)

   if (IsAndroid || Distro.IsOpenSUSE())
     ExtraOpts.push_back("--enable-new-dtags");
+#endif

   // The selection of paths to try here is designed to match the patterns which
   // the GCC driver itself uses, as this is part of the GCC-compatible driver.
@@ -342,7 +345,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
     // the cross. Note that GCC does include some of these directories in some
     // configurations but this seems somewhere between questionable and simply
     // a bug.
-    if (StringRef(LibPath).startswith(SysRoot)) {
+    if (0) {
       addPathIfExists(D, LibPath + "/" + MultiarchTriple, Paths);
       addPathIfExists(D, LibPath + "/../" + OSLibDir, Paths);
     }
@@ -361,6 +364,8 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
   addPathIfExists(D, SysRoot + "/lib/" + MultiarchTriple, Paths);
   addPathIfExists(D, SysRoot + "/lib/../" + OSLibDir, Paths);

+  // This requires the commented distro tweaks above.
+#if 0
   if (IsAndroid) {
     // Android sysroots contain a library directory for each supported OS
     // version as well as some unversioned libraries in the usual multiarch
@@ -389,10 +394,14 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
     addPathIfExists(D, SysRoot + "/" + OSLibDir + "/" + ABIName, Paths);
     addPathIfExists(D, SysRoot + "/usr/" + OSLibDir + "/" + ABIName, Paths);
   }
+#endif

   // Try walking via the GCC triple path in case of biarch or multiarch GCC
   // installations with strange symlinks.
   if (GCCInstallation.isValid()) {
+    // The following code would end up adding things like
+    // "/usr/lib/x86_64-unknown-linux-gnu/../../lib64" to the search path.
+#if 0
     addPathIfExists(D,
                     SysRoot + "/usr/lib/" + GCCInstallation.getTriple().str() +
                         "/../../" + OSLibDir,
@@ -405,6 +414,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
                              BiarchSibling.gccSuffix(),
                       Paths);
     }
+#endif

     // See comments above on the multilib variant for details of why this is
     // included even from outside the sysroot.
@@ -429,8 +439,9 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
   if (StringRef(D.Dir).startswith(SysRoot))
     addPathIfExists(D, D.Dir + "/../lib", Paths);

-  addPathIfExists(D, SysRoot + "/lib", Paths);
-  addPathIfExists(D, SysRoot + "/usr/lib", Paths);
+  // Add libc's lib/ directory to the search path, so that crt1.o, crti.o,
+  // and friends can be found.
+  addPathIfExists(D, "@GLIBC_LIBDIR@", Paths);
 }

 bool Linux::HasNativeLLVMSupport() const { return true; }


code:
Clang attempts to guess file names based on the OS and distro (yes!),
but unfortunately, that doesn't work for us.

This patch makes it easy to insert libc's $libdir so that Clang passes the
correct absolute file name of crt1.o etc. to 'ld'.  It also disables all
the distro-specific stuff and removes the hard-coded FHS directory names
to make sure Clang also works on non-GuixSD systems.

diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
--- a/lib/Driver/ToolChains/Linux.cpp
+++ b/lib/Driver/ToolChains/Linux.cpp
@@ -240,6 +240,9 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
                          .str());
   }

+// Comment out the distro-specific tweaks so that they don't bite when
+// using Guix on a foreign distro.
+#if 0
   Distro Distro(D.getVFS());

   if (Distro.IsAlpineLinux() || Triple.isAndroid()) {
@@ -306,6 +309,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)

   if (IsAndroid || Distro.IsOpenSUSE())
     ExtraOpts.push_back("--enable-new-dtags");
+#endif

   // The selection of paths to try here is designed to match the patterns which
   // the GCC driver itself uses, as this is part of the GCC-compatible driver.
@@ -363,7 +367,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
     // the cross. Note that GCC does include some of these directories in some
     // configurations but this seems somewhere between questionable and simply
     // a bug.
-    if (StringRef(LibPath).startswith(SysRoot)) {
+    if (0) {
       addPathIfExists(D, LibPath + "/" + MultiarchTriple, Paths);
       addPathIfExists(D, LibPath + "/../" + OSLibDir, Paths);
     }
@@ -382,6 +386,8 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
   addPathIfExists(D, SysRoot + "/lib/" + MultiarchTriple, Paths);
   addPathIfExists(D, SysRoot + "/lib/../" + OSLibDir, Paths);

+// This requires the commented distro tweaks above.
+#if 0
   if (IsAndroid) {
     // Android sysroots contain a library directory for each supported OS
     // version as well as some unversioned libraries in the usual multiarch
@@ -410,10 +416,15 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
     addPathIfExists(D, SysRoot + "/" + OSLibDir + "/" + ABIName, Paths);
     addPathIfExists(D, SysRoot + "/usr/" + OSLibDir + "/" + ABIName, Paths);
   }
+#endif

   // Try walking via the GCC triple path in case of biarch or multiarch GCC
   // installations with strange symlinks.
   if (GCCInstallation.isValid()) {
+
+// The following code would end up adding things like
+// "/usr/lib/x86_64-unknown-linux-gnu/../../lib64" to the search path.
+#if 0
     addPathIfExists(D,
                     SysRoot + "/usr/lib/" + GCCInstallation.getTriple().str() +
                         "/../../" + OSLibDir,
@@ -426,6 +437,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
                              BiarchSibling.gccSuffix(),
                       Paths);
     }
+#endif

     // See comments above on the multilib variant for details of why this is
     // included even from outside the sysroot.
@@ -450,8 +462,9 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
   if (StringRef(D.Dir).startswith(SysRoot))
     addPathIfExists(D, D.Dir + "/../lib", Paths);

-  addPathIfExists(D, SysRoot + "/lib", Paths);
-  addPathIfExists(D, SysRoot + "/usr/lib", Paths);
+  // Add libc's lib/ directory to the search path, so that crt1.o, crti.o,
+  // and friends can be found.
+  addPathIfExists(D, "@GLIBC_LIBDIR@", Paths);
 }

 ToolChain::CXXStdlibType Linux::GetDefaultCXXStdlibType() const {


code:
Adjust libsanitizer to ABI change in glibc 2.31.

Adapted to 3.x from this upstream commit:
https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce

--- a/lib/sanitizer_common/saniniitizer_platform_limits_posix.h.orig	2020-08-11 16:01:32.494882282 +0200 #
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h	2020-08-11 16:32:49.711383554 +0200
@@ -176,8 +176,7 @@
     unsigned long __unused1;
     unsigned long __unused2;
 #else
-    unsigned short mode;
-    unsigned short __pad1;
+    unsigned int mode;
     unsigned short __seq;
     unsigned short __pad2;
 #if defined(__x86_64__) && !defined(_LP64)
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc	2020-08-11 16:01:07.926821829 +0200
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc.orig	2020-08-11 16:01:03.698811421 +0200
@@ -1056,7 +1056,9 @@
 CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
+#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
 CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
+#endif

 CHECK_TYPE_SIZE(shmid_ds);
 CHECK_SIZE_AND_OFFSET(shmid_ds, shm_perm);


code:
Adjust libsanitizer to ABI change in glibc 2.31.

Adapted to 3.x from this upstream commit:
https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce

diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -1130,8 +1130,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
 #ifndef __GLIBC_PREREQ
 #define __GLIBC_PREREQ(x, y) 0
 #endif
-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
+#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
+/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
+   on many architectures.  */
 CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
 #endif

diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -188,17 +188,16 @@ namespace __sanitizer {
     unsigned __seq;
     u64 __unused1;
     u64 __unused2;
-#elif defined(__mips__) || defined(__aarch64__)
-    unsigned int mode;
-    unsigned short __seq;
-    unsigned short __pad1;
-    unsigned long __unused1;
-    unsigned long __unused2;
+#elif defined(__sparc__)
+  unsigned mode;
+  unsigned short __pad2;
+  unsigned short __seq;
+  unsigned long long __unused1;
+  unsigned long long __unused2;
 #else
-    unsigned short mode;
-    unsigned short __pad1;
-    unsigned short __seq;
-    unsigned short __pad2;
+  unsigned int mode;
+  unsigned short __seq;
+  unsigned short __pad2;
 #if defined(__x86_64__) && !defined(_LP64)
     u64 __unused1;
     u64 __unused2;


code:
Adjust libsanitizer to ABI change in glibc 2.31.

Adapted to 3.x from this upstream commit:
https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce

diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -1139,8 +1139,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
+#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
+/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
+   on many architectures.  */
 CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
 #endif

diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -194,17 +194,16 @@ namespace __sanitizer {
     unsigned __seq;
     u64 __unused1;
     u64 __unused2;
-#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__)
-    unsigned int mode;
-    unsigned short __seq;
-    unsigned short __pad1;
-    unsigned long __unused1;
-    unsigned long __unused2;
+#elif defined(__sparc__)
+  unsigned mode;
+  unsigned short __pad2;
+  unsigned short __seq;
+  unsigned long long __unused1;
+  unsigned long long __unused2;
 #else
-    unsigned short mode;
-    unsigned short __pad1;
-    unsigned short __seq;
-    unsigned short __pad2;
+  unsigned int mode;
+  unsigned short __seq;
+  unsigned short __pad2;
 #if defined(__x86_64__) && !defined(_LP64)
     u64 __unused1;
     u64 __unused2;


code:
Adjust libsanitizer to ABI change in glibc 2.31.

Taken from this upstream commit:
https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce

diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -1126,8 +1126,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
+#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
+/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
+   on many architectures.  */
 CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
 #endif

diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -203,28 +203,15 @@ namespace __sanitizer {
     u64 __unused1;
     u64 __unused2;
 #elif defined(__sparc__)
-#if defined(__arch64__)
-    unsigned mode;
-    unsigned short __pad1;
-#else
-    unsigned short __pad1;
-    unsigned short mode;
-    unsigned short __pad2;
-#endif
-    unsigned short __seq;
-    unsigned long long __unused1;
-    unsigned long long __unused2;
-#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__)
-    unsigned int mode;
-    unsigned short __seq;
-    unsigned short __pad1;
-    unsigned long __unused1;
-    unsigned long __unused2;
+  unsigned mode;
+  unsigned short __pad2;
+  unsigned short __seq;
+  unsigned long long __unused1;
+  unsigned long long __unused2;
 #else
-    unsigned short mode;
-    unsigned short __pad1;
-    unsigned short __seq;
-    unsigned short __pad2;
+  unsigned int mode;
+  unsigned short __seq;
+  unsigned short __pad2;
 #if defined(__x86_64__) && !defined(_LP64)
     u64 __unused1;
     u64 __unused2;


code:
This patch works around build issues in libsanitizer.  Note that we carry the
same patches for GCC since it includes the same libsanitizer.

Work around this build error on glibc 2.26:

  /tmp/guix-build-clang-runtime-3.5.2.drv-0/compiler-rt-3.5.2.src/lib/asan/asan_linux.cc: In function 'bool __asan::AsanInterceptsSignal(int)':
  /tmp/guix-build-clang-runtime-3.5.2.drv-0/compiler-rt-3.5.2.src/lib/asan/asan_linux.cc:224:20: error: 'SIGSEGV' was not declared in this scope

diff --git a/libsanitizer/asan/asan_linux.cc b/libsanitizer/asan/asan_linux.cc
index c504168..59087b9 100644
--- a/lib/asan/asan_linux.cc
+++ b/lib/asan/asan_linux.cc
@@ -29,6 +29,7 @@
 #include <dlfcn.h>
 #include <fcntl.h>
 #include <pthread.h>
+#include <signal.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <unwind.h>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Now, work around this other error:

  /tmp/guix-build-clang-runtime-3.5.2.drv-0/compiler-rt-3.5.2.src/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: In function 'int __sanitizer::TracerThread(void*)':
  /tmp/guix-build-clang-runtime-3.5.2.drv-0/compiler-rt-3.5.2.src/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc:239:22: error: aggregate 'sigaltstack handler_stack' has incomplete type and cannot be defined

diff --git a/lib/sanitizer_common/sanitizer_linux.cc b/lib/sanitizer_common/sanitizer_linux.cc
index 2cefa20..223d9c6 100644
--- a/lib/sanitizer_common/sanitizer_linux.cc
+++ b/lib/sanitizer_common/sanitizer_linux.cc
@@ -546,8 +546,7 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5) {
 }
 #endif

-uptr internal_sigaltstack(const struct sigaltstack *ss,
-                         struct sigaltstack *oss) {
+uptr internal_sigaltstack(const void *ss, void *oss) {
   return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss);
 }

diff --git a/lib/sanitizer_common/sanitizer_linux.h b/lib/sanitizer_common/sanitizer_linux.h
index 4497702..1594058 100644
--- a/lib/sanitizer_common/sanitizer_linux.h
+++ b/lib/sanitizer_common/sanitizer_linux.h
@@ -19,7 +19,6 @@
 #include "sanitizer_platform_limits_posix.h"

 struct link_map;  // Opaque type returned by dlopen().
-struct sigaltstack;

 namespace __sanitizer {
 // Dirent structure for getdents(). Note that this structure is different from
@@ -28,8 +27,7 @@ struct linux_dirent;

 // Syscall wrappers.
 uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count);
-uptr internal_sigaltstack(const struct sigaltstack* ss,
-                          struct sigaltstack* oss);
+uptr internal_sigaltstack(const void* ss, void* oss);
 uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
     __sanitizer_sigset_t *oldset);
 void internal_sigfillset(__sanitizer_sigset_t *set);
diff --git a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
index c919e4f..014162af 100644
--- a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
@@ -267,7 +267,7 @@ static int TracerThread(void* argument) {

   // Alternate stack for signal handling.
   InternalScopedBuffer<char> handler_stack_memory(kHandlerStackSize);
-  struct sigaltstack handler_stack;
+  stack_t handler_stack;
   internal_memset(&handler_stack, 0, sizeof(handler_stack));
   handler_stack.ss_sp = handler_stack_memory.data();
   handler_stack.ss_size = kHandlerStackSize;
diff --git a/lib/tsan/tsan_platform_linux.cc b/lib/tsan/tsan_platform_linux.cc
index 09cec5f..908f4fe 100644
--- a/lib/tsan/rtl/tsan_platform_linux.cc
+++ b/lib/tsan/rtl/tsan_platform_linux.cc
@@ -291,7 +291,7 @@ bool IsGlobalVar(uptr addr) {
 int ExtractResolvFDs(void *state, int *fds, int nfd) {
 #if SANITIZER_LINUX
   int cnt = 0;
-  __res_state *statp = (__res_state*)state;
+  struct __res_state *statp = (struct __res_state*)state;
   for (int i = 0; i < MAXNS && cnt < nfd; i++) {
     if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1)
       fds[cnt++] = statp->_u._ext.nssocks[i];
--
2.9.3


code:
Fix esan compilation against glibc 2.26:

  /tmp/guix-build-clang-runtime-3.9.1.drv-0/compiler-rt-3.9.1.src/lib/esan/esan_sideline_linux.cpp: In static member function ‘static int __esan::SidelineThread::runSideline(void*)’:
  /tmp/guix-build-clang-runtime-3.9.1.drv-0/compiler-rt-3.9.1.src/lib/esan/esan_sideline_linux.cpp:73:22: error: aggregate ‘__esan::SidelineThread::runSideline(void*)::sigaltstack SigAltStack’ has incomplete type and cannot be defined

Patch from <https://github.com/google/sanitizers/issues/822>.

index d04f5909d..bc272dfe4 100644
--- a/lib/esan/esan_sideline_linux.cpp
+++ b/lib/esan/esan_sideline_linux.cpp
@@ -70,7 +70,7 @@ int SidelineThread::runSideline(void *Arg) {

   // Set up a signal handler on an alternate stack for safety.
   InternalScopedBuffer<char> StackMap(SigAltStackSize);
-  struct sigaltstack SigAltStack;
+  stack_t SigAltStack;
   SigAltStack.ss_sp = StackMap.data();
   SigAltStack.ss_size = SigAltStackSize;
   SigAltStack.ss_flags = 0;


code:
This is modeled after the ia64 support. Aarch64 can be either big endian
or little endian, so we add the case for both.

---
 native/fdlibm/ieeefp.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/native/fdlibm/ieeefp.h b/native/fdlibm/ieeefp.h
index 1a9740f..73455c0 100644
--- a/native/fdlibm/ieeefp.h
+++ b/native/fdlibm/ieeefp.h
@@ -27,6 +27,14 @@
 #endif
 #endif

+#ifdef __aarch64__
+#ifdef __BIG_ENDIAN__
+#define __IEEE_BIG_ENDIAN
+#else
+#define __IEEE_LITTLE_ENDIAN
+#endif
+#endif
+
 #ifdef __hppa__
 #define __IEEE_BIG_ENDIAN
 #endif
--
2.16.3


code:
# Source: http://sourceforge.net/p/clucene/bugs/200/
diff -NaurpBb clucene-core-2.3.3.4/CMakeLists.txt clucene-core-2.3.3.4-mod/CMakeLists.txt
--- clucene-core-2.3.3.4/CMakeLists.txt	2011-03-17 03:21:07.000000000 +0300
+++ clucene-core-2.3.3.4-mod/CMakeLists.txt	2011-08-16 16:56:55.968268152 +0400
@@ -163,7 +163,7 @@ IF ( BUILD_CONTRIBS )
   SET(BUILD_CONTRIBS_LIB 1)
 ENDIF ( BUILD_CONTRIBS )
 IF ( BUILD_CONTRIBS_LIB )
-  ADD_SUBDIRECTORY (src/contribs-lib EXCLUDE_FROM_ALL)
+  ADD_SUBDIRECTORY (src/contribs-lib)
 ENDIF ( BUILD_CONTRIBS_LIB )

diff -NaurpBb clucene-core-2.3.3.4/src/contribs-lib/CMakeLists.txt clucene-core-2.3.3.4-mod/src/contribs-lib/CMakeLists.txt
--- clucene-core-2.3.3.4/src/contribs-lib/CMakeLists.txt	2011-03-17 03:21:07.000000000 +0300
+++ clucene-core-2.3.3.4-mod/src/contribs-lib/CMakeLists.txt	2011-08-16 17:14:13.499275499 +0400
@@ -106,9 +106,26 @@ add_library(clucene-contribs-lib SHARED
 )
 TARGET_LINK_LIBRARIES(clucene-contribs-lib ${clucene_contrib_extra_libs})

+#install public headers.
+FOREACH(file ${HEADERS})
+	get_filename_component(apath ${file} PATH)
+	get_filename_component(aname ${file} NAME)
+	file(RELATIVE_PATH relpath ${CMAKE_SOURCE_DIR}/src/contribs-lib ${apath})
+	IF ( NOT aname MATCHES "^_.*" )
+		install(FILES ${file}
+		        DESTINATION include/${relpath}
+		        COMPONENT development)
+	ENDIF ( NOT aname MATCHES "^_.*" )
+ENDFOREACH(file)
+
 #set properties on the libraries
 SET_TARGET_PROPERTIES(clucene-contribs-lib PROPERTIES
     VERSION ${CLUCENE_VERSION}
     SOVERSION ${CLUCENE_SOVERSION}
     COMPILE_DEFINITIONS_DEBUG _DEBUG
 )
+
+#and install library
+install(TARGETS clucene-contribs-lib
+        DESTINATION ${LIB_DESTINATION}
+        COMPONENT runtime )


code:
Taken from the Debian package.

From 7be4a19b76d98260cf95040a47935f854a4ba7a4 Mon Sep 17 00:00:00 2001
From: Valentin Rusu <kde@rusu.info>
Date: Sat, 17 Dec 2011 13:47:58 +0100
Subject: [PATCH] Fix .pc file by adding clucene-shared library

---
 src/core/libclucene-core.pc.cmake |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/src/core/libclucene-core.pc.cmake
+++ b/src/core/libclucene-core.pc.cmake
@@ -6,6 +6,6 @@ includedir=${prefix}/include:${prefix}/i
 Name: libclucene
 Description: CLucene - a C++ search engine, ported from the popular Apache Lucene
 Version: @CLUCENE_VERSION_MAJOR@.@CLUCENE_VERSION_MINOR@.@CLUCENE_VERSION_REVISION@.@CLUCENE_VERSION_PATCH@
-Libs: -L${prefix}/@LIB_DESTINATION@/ -lclucene-core
+Libs: -L${prefix}/@LIB_DESTINATION@/ -lclucene-core -lclucene-shared
 Cflags: -I${prefix}/include -I${prefix}/include/CLucene/ext
 ~


code:
By default commands such as "ctest" would not look for certificates
at all: <https://issues.guix.gnu.org/issue/37371>.

This changes CMake such that commands honor SSL_CERT_FILE and SSL_CERT_DIR
as well as /etc/ssl/certs.

--- cmake-3.13.1/Source/cmCurl.cxx	2019-09-10 17:27:36.926907260 +0200
+++ cmake-3.13.1/Source/cmCurl.cxx	2019-09-10 17:52:35.475903919 +0200
@@ -2,11 +2,8 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmCurl.h"

-#if !defined(CMAKE_USE_SYSTEM_CURL) && !defined(_WIN32) &&                    \
-  !defined(__APPLE__) && !defined(CURL_CA_BUNDLE) && !defined(CURL_CA_PATH)
 #  define CMAKE_FIND_CAFILE
 #  include "cmSystemTools.h"
-#endif
 #include "cmStringAlgorithms.h"

 // curl versions before 7.21.5 did not provide this error code
@@ -30,6 +27,19 @@
     ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, cafile);
     check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: ");
   }
+
+  /* Honor the usual environment variables.  */
+  else if (cmSystemTools::GetEnv("SSL_CERT_FILE", e)) {
+    ::CURLcode res =
+      ::curl_easy_setopt(curl, CURLOPT_CAINFO, e.c_str());
+    check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: ");
+  }
+  else if (cmSystemTools::GetEnv("SSL_CERT_DIR", e)) {
+    ::CURLcode res =
+      ::curl_easy_setopt(curl, CURLOPT_CAPATH, e.c_str());
+    check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: ");
+  }
+
 #ifdef CMAKE_FIND_CAFILE
 #  define CMAKE_CAFILE_FEDORA "/etc/pki/tls/certs/ca-bundle.crt"
   else if (cmSystemTools::FileExists(CMAKE_CAFILE_FEDORA, true)) {


code:
Remove dependencies on bundled zlib, pcre and expat.

diff --git a/Makefile.in b/Makefile.in
index 4360a26..80f9f59 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -210,8 +210,7 @@ coda_matlab_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
 @BUILD_MATLAB_TRUE@@SUBPACKAGE_MODE_FALSE@	-rpath \
 @BUILD_MATLAB_TRUE@@SUBPACKAGE_MODE_FALSE@	$(matlabmexexecdir)
 am__DEPENDENCIES_1 =
-libcoda_la_DEPENDENCIES = @LTLIBOBJS@ libexpat_internal.la \
-	libpcre_internal.la libz_internal.la $(am__DEPENDENCIES_1) \
+libcoda_la_DEPENDENCIES = @LTLIBOBJS@ $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1)
 am__libcoda_la_SOURCES_DIST = libcoda/coda-ascbin-cursor.c \
 	libcoda/coda-ascbin.h libcoda/coda-ascii-cursor.c \
@@ -306,8 +305,7 @@ libcoda_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(libcoda_la_LDFLAGS) $(LDFLAGS) -o $@
 @SUBPACKAGE_MODE_FALSE@am_libcoda_la_rpath = -rpath $(libdir)
-am__DEPENDENCIES_2 = @LTLIBOBJS@ libexpat_internal.la \
-	libpcre_internal.la libz_internal.la $(am__DEPENDENCIES_1) \
+am__DEPENDENCIES_2 = @LTLIBOBJS@ $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1)
 libcoda_internal_la_DEPENDENCIES = $(am__DEPENDENCIES_2)
 am__libcoda_internal_la_SOURCES_DIST = libcoda/coda-ascbin-cursor.c \
@@ -898,8 +896,8 @@ INSTALL_DATA_HOOK_TARGETS = $(am__append_1)
 UNINSTALL_HOOK_TARGETS =
 CLEAN_LOCAL_TARGETS = $(am__append_11)
 ALL_LOCAL_TARGETS =
-@SUBPACKAGE_MODE_FALSE@noinst_LTLIBRARIES = libcoda_internal.la libexpat_internal.la libpcre_internal.la libz_internal.la
-@SUBPACKAGE_MODE_TRUE@noinst_LTLIBRARIES = libcoda_internal.la libexpat_internal.la libpcre_internal.la libz_internal.la
+@SUBPACKAGE_MODE_FALSE@noinst_LTLIBRARIES = libcoda_internal.la
+@SUBPACKAGE_MODE_TRUE@noinst_LTLIBRARIES = libcoda_internal.la

 # libraries (+ related files)
 @SUBPACKAGE_MODE_FALSE@lib_LTLIBRARIES = libcoda.la
@@ -1048,7 +1046,7 @@ libcoda_hdf5_files = \

 libcoda_la_CPPFLAGS = -Ilibcoda/expat -I$(srcdir)/libcoda/expat -Ilibcoda/pcre -I$(srcdir)/libcoda/pcre -Ilibcoda/zlib -I$(srcdir)/libcoda/zlib $(AM_CPPFLAGS)
 libcoda_la_LDFLAGS = -no-undefined -version-info $(LIBCODA_CURRENT):$(LIBCODA_REVISION):$(LIBCODA_AGE)
-libcoda_la_LIBADD = @LTLIBOBJS@ libexpat_internal.la libpcre_internal.la libz_internal.la $(HDF4LIBS) $(HDF5LIBS)
+libcoda_la_LIBADD = @LTLIBOBJS@ $(HDF4LIBS) $(HDF5LIBS)
 libcoda_internal_la_SOURCES = libcoda/coda-ascbin-cursor.c \
 	libcoda/coda-ascbin.h libcoda/coda-ascii-cursor.c \
 	libcoda/coda-ascii-internal.h libcoda/coda-ascii.c \


code:
Disable creation of /var and /etc

--- a/Makefile.am	2020-03-08 16:57:09.511535600 +0100
+++ b/Makefile.am	2020-04-21 11:36:49.827182272 +0200
@@ -2376,16 +2376,6 @@
 endif

 install-exec-hook:
-	$(mkinstalldirs) $(DESTDIR)$(localstatedir)/run
-	$(mkinstalldirs) $(DESTDIR)$(localstatedir)/lib/$(PACKAGE_NAME)
-	$(mkinstalldirs) $(DESTDIR)$(localstatedir)/log
-	$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
-	if test -e $(DESTDIR)$(sysconfdir)/collectd.conf; \
-	then \
-		$(INSTALL) -m 0640 $(builddir)/src/collectd.conf $(DESTDIR)$(sysconfdir)/collectd.conf.pkg-orig; \
-	else \
-		$(INSTALL) -m 0640 $(builddir)/src/collectd.conf $(DESTDIR)$(sysconfdir)/collectd.conf; \
-	fi; \
 	$(mkinstalldirs) $(DESTDIR)$(cpkgdatadir)
 	$(INSTALL) -m 0644 $(srcdir)/src/types.db $(DESTDIR)$(cpkgdatadir)/types.db;
 	$(INSTALL) -m 0644 $(srcdir)/src/postgresql_default.conf \