summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/chez-scheme-backport-configure.patch
blob: 584dcb3f0b800cf0fda6790568569fad4190908c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
From 24ab36374f2e366b6c939fffe8c129c8b0ae3b9c Mon Sep 17 00:00:00 2001
From: Philip McGrath <philip@philipmcgrath.com>
Date: Wed, 28 Feb 2024 19:41:22 -0500
Subject: [PATCH 1/2] Repairs and improvements for building with external
 dependencies (#807)

* configure: fix zlib and lz4 submodule checks

Conditionals to skip the submodule checks were using the wrong
variable names, so the checks were always skipped. The correct
behavior is to perform the check unless given `ZLIB=<zlib>` or
`LZ4=<lz4>`, as applicable.

* configure: support `ZUO=<zuo>`

Supplying `ZUO=<zuo>` skips the submodule check in `configure`
and configures the generated makefile not to build or remove Zuo.

* configure: support `STEXLIB=<stex>`

For compatibility with older scripts, when not explicitly configured,
continue to honor the `STEXLIB` environment variable at build time.

(cherry picked from commit b8838c3280ef10e115236d2f7ac9ae857f83e268)
---
 BUILDING              |  5 +++--
 build.zuo             | 13 +++++++++----
 configure             | 40 +++++++++++++++++++++++++++++++++-------
 makefiles/Makefile.in |  6 ++----
 4 files changed, 47 insertions(+), 17 deletions(-)

diff --git a/BUILDING b/BUILDING
index 7b3dc9c8..9e9a268b 100644
--- a/BUILDING
+++ b/BUILDING
@@ -149,7 +149,8 @@ information on the supported options.
 The generated makefile mostly just ensures that a `zuo` executable is
 built in a `bin` directory, and then it defers the actual build work
 to `zuo`, which uses the "main.zuo" file. If you have `zuo` installed,
-you can use `zuo` directly instead of `make`. In general, instead of
+you can use `zuo` directly instead of `make`: in that case, you may
+wish to use `./configure ZUO=<zuo>`. In general, instead of
 the command `make X` to build target `X` as described below, you can
 use `zuo . X` (or `bin/zuo . X` after `bin/zuo` is built).
 
@@ -333,7 +334,7 @@ The makefile supports several targets:
  * `make clean`
 
    Removes all built elements from the workarea, and then removes
-   `bin/zuo`.
+   `bin/zuo` (unless configured with `ZUO=<zuo>`).
 
 
 WINDOWS VIA COMMAND PROMPT
diff --git a/build.zuo b/build.zuo
index c21d2caa..c5896396 100644
--- a/build.zuo
+++ b/build.zuo
@@ -224,10 +224,15 @@
            token))
 
   (define stexlib
-    (let ((found (assoc "STEXLIB" (hash-ref (runtime-env) 'env))))
-      (if found
-          (cdr found)
-          (at-source "stex"))))
+    (let ([configured (hash-ref config 'STEXLIB "")]
+          [env (assoc "STEXLIB" (hash-ref (runtime-env) 'env))])
+      (cond
+        [(not (equal? "" configured))
+         configured]
+        [env
+         (cdr env)]
+        [else
+         (at-source "stex")])))
   (define stex-sources
     (source-tree stexlib))
 
diff --git a/configure b/configure
index 2b4b594e..782dd09b 100755
--- a/configure
+++ b/configure
@@ -93,6 +93,7 @@ default_warning_flags="-Wpointer-arith -Wall -Wextra -Wno-implicit-fallthrough"
 CFLAGS_ADD=
 zlibLib=
 LZ4Lib=
+STEXLIB=
 Kernel=KernelLib
 buildKernelOnly=no
 enableFrompb=yes
@@ -103,6 +104,7 @@ moreBootFiles=
 preloadBootFiles=
 alwaysUseBootFile=
 skipSubmoduleUpdate=
+zuoExternal=
 
 CONFIG_UNAME=`uname`
 
@@ -446,6 +448,12 @@ while [ $# != 0 ] ; do
     LZ4=*)
       LZ4Lib=`echo $1 | sed -e 's/^LZ4=//'`
       ;;
+    STEXLIB=*)
+      STEXLIB=`echo $1 | sed -e 's/^STEXLIB=//'`
+      ;;
+    ZUO=*)
+      zuoExternal=`echo $1 | sed -e 's/^ZUO=//'`
+      ;;
     *)
       echo "option '$1' unrecognized or missing an argument; try $0 --help"
       exit 1
@@ -672,6 +680,8 @@ if [ "$help" = "yes" ]; then
   echo "  STRIP=<strip>                     executable stripper"
   echo "  ZLIB=<lib>                        link to <lib> instead of own zlib"
   echo "  LZ4=<lib>                         link to <lib> instead of own LZ4"
+  echo "  STEXLIB=<stex>                    build docs with <stex> instead of own stex"
+  echo "  ZUO=<zuo>                         build with <zuo> instead of own Zuo"
   echo ""
   echo "Available machine types: $machs"
   echo ""
@@ -889,28 +899,39 @@ submod_instructions () {
     exit 1
 }
 
-if [ ! -f "$srcdir"/zuo/configure ] ; then
-    submod_instructions 'Source in "zuo" is missing'
+if [ "${zuoExternal}" = "" ] ; then
+    if [ ! -f "$srcdir"/zuo/configure ] ; then
+        submod_instructions 'Source in "zuo" is missing'
+    fi
+    ZUO="bin/zuo"
+    RM_ZUO="rm -f bin/zuo"
+    ZUO_TARGET="bin/zuo"
+else
+    ZUO="${zuoExternal}"
+    RM_ZUO="@echo 'Not cleaning external ${zuoExternal}'"
+    ZUO_TARGET="DoNotBuildZuo"
 fi
 
 if [ ! -f "$srcdir"/nanopass/nanopass.ss ] ; then
     submod_instructions 'Source in "nanopass" is missing'
 fi
 
-if [ "${zlibDep}" != "" ] ; then
+if [ "${zlibLib}" = "" ] ; then
     if [ ! -f "$srcdir"/zlib/configure ] ; then
         submod_instructions 'Source in "zlib" is missing'
     fi
 fi
 
-if [ "${LZ4Dep}" != "" ] ; then
+if [ "${LZ4Lib}" = "" ] ; then
     if [ ! -f "$srcdir"/lz4/lib/Makefile ] ; then
         submod_instructions 'Source in "lz4" is missing'
     fi
 fi
 
-if [ ! -f "$srcdir"/stex/Mf-stex ] ; then
-    submod_instructions 'Source in "stex" is missing'
+if [ "${STEXLIB}" = "" ] ; then
+    if [ ! -f "$srcdir"/stex/Mf-stex ] ; then
+        submod_instructions 'Source in "stex" is missing'
+    fi
 fi
 
 # more compile and link flags for c/Mf-unix and mats/Mf-unix
@@ -1083,7 +1104,7 @@ cp "$srcdir"/makefiles/buildmain.zuo main.zuo
 # Some idea, but in the workarea, so it refers to "workarea.zuo" here:
 cp "$srcdir"/makefiles/workmain.zuo $w/main.zuo
 
-# The content of "$w/Makefile" records configuration decisions,
+# The content of "$w/Mf-config" records configuration decisions,
 # and the Zuo build script takes it from there
 cat > $w/Mf-config << END
 srcdir=$srcdir
@@ -1119,6 +1140,7 @@ cursesLib=$cursesLib
 ncursesLib=$ncursesLib
 zlibLib=$zlibLib
 LZ4Lib=$LZ4Lib
+STEXLIB=$STEXLIB
 warningFlags=$warningFlags
 Kernel=$Kernel
 installscriptname=$installscriptname
@@ -1130,6 +1152,10 @@ preloadBootFiles=$preloadBootFiles
 alwaysUseBootFile=$alwaysUseBootFile
 relativeBootFiles=$relativeBootFiles
 
+ZUO=$ZUO
+RM_ZUO=$RM_ZUO
+ZUO_TARGET=$ZUO_TARGET
+
 InstallBin=$installbin
 InstallLib=$installlib
 InstallMan=$installman/man1
diff --git a/makefiles/Makefile.in b/makefiles/Makefile.in
index 3b95f065..0e3d307d 100644
--- a/makefiles/Makefile.in
+++ b/makefiles/Makefile.in
@@ -3,8 +3,6 @@ workarea=$(w)
 
 include $(workarea)/Mf-config
 
-ZUO=bin/zuo
-
 .PHONY: build
 build: $(ZUO)
 	+ $(ZUO) $(workarea) MAKE="$(MAKE)"
@@ -144,9 +142,9 @@ pkg: $(ZUO)
 .PHONY: clean
 clean: $(ZUO)
 	+ $(ZUO) $(workarea) clean MAKE="$(MAKE)"
-	rm -f bin/zuo
+	$(RM_ZUO)
 
 # Using `+` here means that $(ZUO) gets built even if `-n`/`--dry-run` is provided to `make`
-$(ZUO): $(srcdir)/zuo/zuo.c
+$(ZUO_TARGET): $(srcdir)/zuo/zuo.c
 	+ mkdir -p bin
 	+ $(CC_FOR_BUILD) -DZUO_LIB_PATH='"'"../zuo/lib"'"' -o $(ZUO) $(srcdir)/zuo/zuo.c

base-commit: 253230f7dfbb4fe777277d6bbf93f39f9567f086
-- 
2.41.0


From 665bccc1c074131e790879adc1436f8059801171 Mon Sep 17 00:00:00 2001
From: Matthew Flatt <mflatt@racket-lang.org>
Date: Sun, 17 Mar 2024 09:06:30 -0600
Subject: [PATCH 2/2] adjust `configure ZUO=<command>` support (#816)

Continuing from b8838c3280, adjust the generated makefile so the
supplied `<command>` is not a makefile dependency. That way, `ZUO=zuo`
works if `zuo` is installed and the current build directory is not the
source directory. (The `zuo` executable is a dependency in a real and
relevant sense, but not in the sense of dependencies that we normally
track in makefiles.)

Also adapt the makefile for the case that `ZUO=...` is not supplied
and the build directory is not the source directory, in which case
`ZUO_LIB_PATH` needs to be relative to the source directory.

Using `make ZUO=zuo` can also work, but in that case, `bin/zuo` is
still built as a dependency. It's possible that some portable makefile
magic could overcome that limitation, but it doesn't seem important.

(cherry picked from commit d327968f37cdf669d15a9ad6d356bbf92c502bb9)
---
 configure             |  3 ++
 makefiles/Makefile.in | 66 +++++++++++++++++++++----------------------
 2 files changed, 36 insertions(+), 33 deletions(-)

diff --git a/configure b/configure
index 782dd09b..9adae37a 100755
--- a/configure
+++ b/configure
@@ -904,10 +904,12 @@ if [ "${zuoExternal}" = "" ] ; then
         submod_instructions 'Source in "zuo" is missing'
     fi
     ZUO="bin/zuo"
+    ZUO_DEP="${ZUO}"
     RM_ZUO="rm -f bin/zuo"
     ZUO_TARGET="bin/zuo"
 else
     ZUO="${zuoExternal}"
+    ZUO_DEP=""
     RM_ZUO="@echo 'Not cleaning external ${zuoExternal}'"
     ZUO_TARGET="DoNotBuildZuo"
 fi
@@ -1153,6 +1155,7 @@ alwaysUseBootFile=$alwaysUseBootFile
 relativeBootFiles=$relativeBootFiles
 
 ZUO=$ZUO
+ZUO_DEP=$ZUO_DEP
 RM_ZUO=$RM_ZUO
 ZUO_TARGET=$ZUO_TARGET
 
diff --git a/makefiles/Makefile.in b/makefiles/Makefile.in
index 0e3d307d..fc8605a0 100644
--- a/makefiles/Makefile.in
+++ b/makefiles/Makefile.in
@@ -4,55 +4,55 @@ workarea=$(w)
 include $(workarea)/Mf-config
 
 .PHONY: build
-build: $(ZUO)
+build: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) MAKE="$(MAKE)"
 
 .PHONY: run
-run: $(ZUO)
+run: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) run
 
 .PHONY: kernel
-kernel: $(ZUO)
+kernel: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) kernel MAKE="$(MAKE)"
 
 .PHONY: install
-install: $(ZUO)
+install: $(ZUO_DEP)
 	$(ZUO) $(workarea) install MAKE="$(MAKE)"
 
 .PHONY: uninstall
-uninstall: $(ZUO)
+uninstall: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) uninstall MAKE="$(MAKE)"
 
 .PHONY: test-one
-test-one: $(ZUO)
+test-one: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) test-one MAKE="$(MAKE)"
 
 .PHONY: test-some-fast
-test-some-fast: $(ZUO)
+test-some-fast: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) test-some-fast MAKE="$(MAKE)"
 
 .PHONY: test-some
-test-some: $(ZUO)
+test-some: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) test-some MAKE="$(MAKE)"
 
 .PHONY: test
-test: $(ZUO)
+test: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) test MAKE="$(MAKE)"
 
 .PHONY: test-more
-test-more: $(ZUO)
+test-more: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) test-more MAKE="$(MAKE)"
 
 .PHONY: coverage
-coverage: $(ZUO)
+coverage: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) coverage MAKE="$(MAKE)"
 
 .PHONY: bootfiles
-bootfiles: $(ZUO)
+bootfiles: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) bootfiles MAKE="$(MAKE)"
 
 .PHONY: reset
-reset: $(ZUO)
+reset: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) reset MAKE="$(MAKE)"
 
 # Supply XM=<machine> to build boot files for <machine>
@@ -61,90 +61,90 @@ boot:
 	+ $(ZUO) $(workarea) boot "$(XM)" MAKE="$(MAKE)"
 
 # `<machine>.boot` as alias for `boot XM=<machine>`
-%.boot: $(ZUO)
+%.boot: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) boot $* MAKE="$(MAKE)"
 
 .PHONY: auto.boot
-auto.boot: $(ZUO)
+auto.boot: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) boot MAKE="$(MAKE)"
 
 SCHEME=scheme
 
 .PHONY: cross.boot
-cross.boot: $(ZUO)
+cross.boot: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) boot SCHEME="$(SCHEME)" MAKE="$(MAKE)"
 
 .PHONY: re.boot
-re.boot: $(ZUO)
+re.boot: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) reboot SCHEME="$(SCHEME)"
 
 # Supply XM=<machine> to build boot files for <machine>
 # with o=3 d=0 for the cross compiler, and only after
 # building the kernel for the configured machine
 .PHONY: bootquick
-bootquick: $(ZUO)
+bootquick: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) bootquick "$(XM)" MAKE="$(MAKE)"
 
 # `<machine>.bootquick` as alias for `boot XM=<machine>`
-%.bootquick: $(ZUO)
+%.bootquick: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) bootquick $* MAKE="$(MAKE)"
 
-auto.bootquick: $(ZUO)
+auto.bootquick: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) bootquick MAKE="$(MAKE)"
 
 # Supply XM=<machine>-<tag>.bootpbchunk to repackage boot files for
 # <machine> with pbchunk sources, including additional
 # boot files
 .PHONY: bootpbchunk
-bootpbchunk: $(ZUO)
+bootpbchunk: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) bootpbchunk "$(XM)" $(ARGS) MAKE="$(MAKE)"
 
 # `<machine>.bootpbchunk` as alias for `pbchunk XM=<machine>`
-%.bootpbchunk: $(ZUO)
+%.bootpbchunk: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) bootpbchunk $* $(ARGS) MAKE="$(MAKE)"
 
 .PHONY: docs
-docs: build $(ZUO)
+docs: build $(ZUO_DEP)
 	+ $(ZUO) $(workarea) docs MAKE="$(MAKE)"
 
 .PHONY: csug
-csug: build $(ZUO)
+csug: build $(ZUO_DEP)
 	+ $(ZUO) $(workarea) csug MAKE="$(MAKE)"
 
 .PHONY: release_notes
-release_notes: build $(ZUO)
+release_notes: build $(ZUO_DEP)
 	+ $(ZUO) $(workarea) release_notes MAKE="$(MAKE)"
 
 .PHONY: install-docs
-install-docs: build $(ZUO)
+install-docs: build $(ZUO_DEP)
 	+ $(ZUO) $(workarea) install-docs MAKE="$(MAKE)"
 
 .PHONY: install-csug
-install-csug: build $(ZUO)
+install-csug: build $(ZUO_DEP)
 	+ $(ZUO) $(workarea) install-csug MAKE="$(MAKE)"
 
 .PHONY: install-release_notes
-install-release_notes: build $(ZUO)
+install-release_notes: build $(ZUO_DEP)
 	+ $(ZUO) $(workarea) install-release_notes MAKE="$(MAKE)"
 
 .PHONY: bintar
-bintar: $(ZUO)
+bintar: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) bintar MAKE="$(MAKE)"
 
 .PHONY: rpm
-rpm: $(ZUO)
+rpm: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) rpm MAKE="$(MAKE)"
 
 .PHONY: pkg
-pkg: $(ZUO)
+pkg: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) pkg MAKE="$(MAKE)"
 
 .PHONY: clean
-clean: $(ZUO)
+clean: $(ZUO_DEP)
 	+ $(ZUO) $(workarea) clean MAKE="$(MAKE)"
 	$(RM_ZUO)
 
 # Using `+` here means that $(ZUO) gets built even if `-n`/`--dry-run` is provided to `make`
 $(ZUO_TARGET): $(srcdir)/zuo/zuo.c
 	+ mkdir -p bin
-	+ $(CC_FOR_BUILD) -DZUO_LIB_PATH='"'"../zuo/lib"'"' -o $(ZUO) $(srcdir)/zuo/zuo.c
+	+ $(CC_FOR_BUILD) -DZUO_LIB_PATH='"'"$(upsrcdir)/zuo/lib"'"' -o $(ZUO) $(srcdir)/zuo/zuo.c
-- 
2.41.0