Skip to content

Commit 4e640bd

Browse files
committed
patch 7.4.1104
Problem: Various problems building with MzScheme/Racket. Solution: Make it work with new versions of Racket. (Yukihiro Nakadaira, Ken Takata)
1 parent d125001 commit 4e640bd

8 files changed

Lines changed: 639 additions & 277 deletions

File tree

runtime/doc/if_mzsch.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ The MzScheme Interface to Vim *mzscheme* *MzScheme*
1313
5. mzeval() Vim function |mzscheme-mzeval|
1414
6. Using Function references |mzscheme-funcref|
1515
7. Dynamic loading |mzscheme-dynamic|
16+
8. MzScheme setup |mzscheme-setup|
1617

1718
{Vi does not have any of these commands}
1819

@@ -272,6 +273,9 @@ output then includes |+mzscheme/dyn|.
272273
This means that Vim will search for the MzScheme DLL files only when needed.
273274
When you don't use the MzScheme interface you don't need them, thus you can
274275
use Vim without these DLL files.
276+
NOTE: Newer version of MzScheme (Racket) require earlier (trampolined)
277+
initialisation via scheme_main_setup. So Vim always loads the MzScheme DLL at
278+
startup if possible.
275279

276280
To use the MzScheme interface the MzScheme DLLs must be in your search path.
277281
In a console window type "path" to see what directories are used.
@@ -282,5 +286,24 @@ For MzScheme version 209 they will be "libmzsch209_000.dll" and
282286
command, look for -DDYNAMIC_MZSCH_DLL="something" and
283287
-DDYNAMIC_MZGC_DLL="something" in the "Compilation" info.
284288

289+
For example, if MzScheme (Racket) is installed at C:\Racket63, you may need
290+
to set the environment variable as the following: >
291+
292+
PATH=%PATH%;C:\Racket63\lib
293+
PLTCOLLECTS=C:\Racket63\collects
294+
PLTCONFIGDIR=C:\Racket63\etc
295+
<
296+
==============================================================================
297+
8. MzScheme setup *mzscheme-setup*
298+
299+
Vim requires "racket/base" module for if_mzsch core (fallback to "scheme/base"
300+
if it doesn't exist), "r5rs" module for test and "raco ctool" command for
301+
building Vim. If MzScheme did not have them, you can install them with
302+
MzScheme's raco command:
303+
>
304+
raco pkg install scheme-lib # scheme/base module
305+
raco pkg install r5rs-lib # r5rs module
306+
raco pkg install cext-lib # raco ctool command
307+
<
285308
======================================================================
286309
vim:tw=78:ts=8:sts=4:ft=help:norl:

src/INSTALLpc.txt

Lines changed: 60 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Contents:
2424
5. Cross compiling for Win32 from a Linux machine
2525
6. Building with Python support
2626
7. Building with Python3 support
27-
8. Building with MzScheme support
27+
8. Building with MzScheme/Racket support
2828
9. Building with Lua support
2929
10. Building with Perl support
3030
11. Building with Ruby support
@@ -415,8 +415,10 @@ E.g. When using MSVC (as one line):
415415
PYTHON3=C:\Python34 DYNAMIC_PYTHON3=yes PYTHON3_VER=34
416416

417417

418-
8. Building with MzScheme support
419-
=================================
418+
8. Building with MzScheme/Racket support
419+
========================================
420+
421+
1) Building with MzScheme support
420422

421423
(written by Sergey Khorev <[email protected]>)
422424

@@ -451,31 +453,75 @@ After a successful build, these dlls can be freely removed, leaving them in
451453
%WINDOWS%\System32 only.
452454

453455

456+
2) Building with Racket support
457+
458+
MzScheme and PLT Scheme names have been rebranded as Racket. Vim with Racket
459+
(https://racket-lang.org/) support can be built with either MSVC or MinGW (or
460+
Cygwin).
461+
462+
You need to set the following variables:
463+
464+
MZSCHEME: Where Racket is installed.
465+
E.g. C:\Program Files (x86)\Racket
466+
DYNAMIC_MZSCHEME: Whether dynamic linking is used. Usually, set to yes.
467+
MZSCHEME_VER: Racket DLL version. E.g. 3m_9z0ds0 for Racket 6.3.
468+
MZSCHEME_COLLECTS: (Optional) Path of the collects directory used at
469+
runtime. Default: $(MZSCHEME)\collects
470+
User can override this with the PLTCOLLECTS environment
471+
variable.
472+
473+
E.g. When using MSVC (as one line):
474+
475+
nmake -f Make_mvc.mak
476+
MZSCHEME="C:\Program Files (x86)\Racket" DYNAMIC_MZSCHEME=yes
477+
MZSCHEME_VER=3m_9z0ds0
478+
479+
Or when using MinGW (as one line):
480+
481+
mingw32-make -f Make_ming.mak
482+
MZSCHEME='C:/Program\ Files\ (x86)/Racket' DYNAMIC_MZSCHEME=yes
483+
MZSCHEME_VER=3m_9z0ds0
484+
485+
Spaces should be escaped with '\'.
486+
487+
454488
9. Building with Lua support
455489
============================
456490

457-
Vim with Lua support can be built with either MSVC or MinGW (or Cygwin).
458-
You can use binaries from LuaBinaries.
459-
http://luabinaries.sourceforge.net/
491+
Vim with Lua support can be built with either MSVC or MinGW (or maybe Cygwin).
492+
You can use binaries from LuaBinaries: http://luabinaries.sourceforge.net/
493+
This also applies to when you get a Vim executable and don't build yourself,
494+
do the part up to "Build".
460495

461496
1) Download and install LuaBinaries
497+
462498
Go to the Download page of LuaBinaries:
463-
http://luabinaries.sourceforge.net/download.html
499+
http://luabinaries.sourceforge.net/download.html
464500

465501
Download lua-X.Y.Z_Win32_dllw4_lib.zip for x86 or
466-
lua-X.Y.Z_Win64_dllw4_lib.zip for x64. You can use them for both MSVC and
502+
lua-X.Y.Z_Win64_dllw4_lib.zip for x64. You can use them both for MSVC and
467503
MinGW.
468504

469505
Unpack it to a working directory. E.g. C:\projects\lua53.
470506
Lua's header files will be installed under the include directory.
471507

508+
Copy luaXY.dll to your Windows system directory. The system directory depends
509+
on your Windows bitness and Vim bitness:
510+
32-bit Vim on 32-bit Windows: C:\Windows\System32
511+
32-bit Vim on 64-bit Windows: C:\Windows\SysWOW64
512+
64-bit Vim on 64-bit Windows: C:\Windows\System32
513+
514+
Or another option is copying luaXY.dll to the directory where gvim.exe
515+
(or vim.exe) is.
516+
472517

473518
2) Build
474-
You need to set the following variables:
475519

476-
LUA: Where Lua is installed. E.g. C:\projects\lua53.
477-
DYNAMIC_LUA: Whether dynamic linking is used. Usually, set to yes.
478-
LUA_VER: Lua version. E.g. 53 for Lua 5.3.X.
520+
You need to set LUA, DYNAMIC_LUA and LUA_VER.
521+
522+
LUA: Where Lua's header files are installed. E.g. C:\projects\lua53.
523+
DYNAMIC_LUA: Whether dynamic linking is used. Set to yes.
524+
LUA_VER: Lua version. E.g. 53 for Lua 5.3.X.
479525

480526
E.g. When using MSVC (as one line):
481527

@@ -487,7 +533,8 @@ Or when using MinGW (as one line):
487533
mingw32-make -f Make_mingw.mak
488534
LUA=C:\projects\lua53 DYNAMIC_LUA=yes LUA_VER=53
489535

490-
Or when using Cygwin (as one line):
536+
537+
Or when using Cygwin (as one line) (untested):
491538

492539
make -f Make_cyg.mak
493540
LUA=/cygdrive/c/projects/lua53 DYNAMIC_LUA=yes LUA_VER=53

src/Make_cyg_ming.mak

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,26 +171,37 @@ ifndef MZSCHEME_VER
171171
MZSCHEME_VER=205_000
172172
endif
173173

174-
ifndef MZSCHEME_PRECISE_GC
175-
MZSCHEME_PRECISE_GC=no
176-
endif
177-
178174
# for version 4.x we need to generate byte-code for Scheme base
179175
ifndef MZSCHEME_GENERATE_BASE
180176
MZSCHEME_GENERATE_BASE=no
181177
endif
182178

183-
ifndef MZSCHEME_USE_RACKET
179+
ifneq ($(wildcard $(MZSCHEME)/lib/msvc/libmzsch$(MZSCHEME_VER).lib),)
184180
MZSCHEME_MAIN_LIB=mzsch
185181
else
186182
MZSCHEME_MAIN_LIB=racket
187183
endif
188184

185+
ifndef MZSCHEME_PRECISE_GC
186+
MZSCHEME_PRECISE_GC=no
187+
ifneq ($(wildcard $(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll),)
188+
ifeq ($(wildcard $(MZSCHEME)\lib\libmzgc$(MZSCHEME_VER).dll),)
189+
MZSCHEME_PRECISE_GC=yes
190+
endif
191+
else
192+
ifneq ($(wildcard $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib),)
193+
ifeq ($(wildcard $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib),)
194+
MZSCHEME_PRECISE_GC=yes
195+
endif
196+
endif
197+
endif
198+
endif
199+
189200
ifeq (no,$(DYNAMIC_MZSCHEME))
190201
ifeq (yes,$(MZSCHEME_PRECISE_GC))
191202
MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
192203
else
193-
MZSCHEME_LIB = -l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
204+
MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
194205
endif
195206
# the modern MinGW can dynamically link to dlls directly.
196207
# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
@@ -429,10 +440,21 @@ endif
429440
endif
430441

431442
ifdef MZSCHEME
432-
CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME)/collects\"
443+
ifndef MZSCHEME_COLLECTS
444+
MZSCHEME_COLLECTS=$(MZSCHEME)/collects
445+
ifeq (yes, $(UNDER_CYGWIN))
446+
MZSCHEME_COLLECTS:=$(shell cygpath -m $(MZSCHEME_COLLECTS) | sed -e 's/ /\\ /g')
447+
endif
448+
endif
449+
CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME_COLLECTS)\"
433450
ifeq (yes, $(DYNAMIC_MZSCHEME))
451+
ifeq (yes, $(MZSCHEME_PRECISE_GC))
452+
# Precise GC does not use separate dll
453+
CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\"
454+
else
434455
CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
435456
endif
457+
endif
436458
ifeq (yes, "$(MZSCHEME_DEBUG)")
437459
CFLAGS += -DMZSCHEME_FORCE_GC
438460
endif

src/Make_mvc.mak

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -755,43 +755,52 @@ PYTHON3_LIB = $(PYTHON3)\libs\python$(PYTHON3_VER).lib
755755
!ifndef MZSCHEME_VER
756756
MZSCHEME_VER = 205_000
757757
!endif
758-
CFLAGS = $(CFLAGS) -DFEAT_MZSCHEME -I $(MZSCHEME)\include
759-
!if EXIST("$(MZSCHEME)\collects\scheme\base.ss") \
760-
|| EXIST("$(MZSCHEME)\collects\scheme\base.rkt") \
761-
|| EXIST("$(MZSCHEME)\collects\racket\base.rkt")
762-
# for MzScheme >= 4 we need to include byte code for basic Scheme stuff
763-
MZSCHEME_EXTRA_DEP = mzscheme_base.c
764-
CFLAGS = $(CFLAGS) -DINCLUDE_MZSCHEME_BASE
758+
!ifndef MZSCHEME_COLLECTS
759+
MZSCHEME_COLLECTS=$(MZSCHEME)\collects
765760
!endif
761+
CFLAGS = $(CFLAGS) -DFEAT_MZSCHEME -I "$(MZSCHEME)\include"
766762
!if EXIST("$(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib")
767763
MZSCHEME_MAIN_LIB=mzsch
768764
!else
769765
MZSCHEME_MAIN_LIB=racket
770766
!endif
771-
!if EXIST("$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib") \
772-
&& !EXIST("$(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib")
767+
!if (EXIST("$(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll") \
768+
&& !EXIST("$(MZSCHEME)\lib\libmzgc$(MZSCHEME_VER).dll")) \
769+
|| (EXIST("$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib") \
770+
&& !EXIST("$(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib"))
773771
!message Building with Precise GC
774772
MZSCHEME_PRECISE_GC = yes
775773
CFLAGS = $(CFLAGS) -DMZ_PRECISE_GC
776774
!endif
777775
!if "$(DYNAMIC_MZSCHEME)" == "yes"
776+
!message MzScheme DLLs will be loaded dynamically
777+
CFLAGS = $(CFLAGS) -DDYNAMIC_MZSCHEME
778778
!if "$(MZSCHEME_PRECISE_GC)" == "yes"
779-
!error MzScheme with Precise GC cannot be loaded dynamically
779+
# Precise GC does not use separate dll
780+
CFLAGS = $(CFLAGS) \
781+
-DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" \
782+
-DDYNAMIC_MZGC_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\"
783+
!else
784+
CFLAGS = $(CFLAGS) \
785+
-DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" \
786+
-DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
780787
!endif
781-
!message MzScheme DLLs will be loaded dynamically
782-
CFLAGS = $(CFLAGS) -DDYNAMIC_MZSCHEME \
783-
-DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" \
784-
-DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
785788
!else
786789
!if "$(MZSCHEME_DEBUG)" == "yes"
787790
CFLAGS = $(CFLAGS) -DMZSCHEME_FORCE_GC
788791
!endif
789792
!if "$(MZSCHEME_PRECISE_GC)" == "yes"
790793
# Precise GC does not use separate dll
791-
MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib
794+
!if EXIST("$(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).def")
795+
# create .lib from .def
796+
MZSCHEME_LIB = lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib
797+
MZSCHEME_EXTRA_DEP = lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib
792798
!else
793-
MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib \
794-
$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib
799+
MZSCHEME_LIB = "$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib"
800+
!endif
801+
!else
802+
MZSCHEME_LIB = "$(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib" \
803+
"$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib"
795804
!endif
796805
!endif
797806
MZSCHEME_OBJ = $(OUTDIR)\if_mzsch.obj
@@ -1059,7 +1068,6 @@ clean:
10591068
- if exist dimm_i.c del dimm_i.c
10601069
- if exist dimm.tlb del dimm.tlb
10611070
- if exist dosinst.exe del dosinst.exe
1062-
- if exist mzscheme_base.c del mzscheme_base.c
10631071
cd xxd
10641072
$(MAKE) /NOLOGO -f Make_mvc.mak clean
10651073
cd ..
@@ -1172,13 +1180,10 @@ $(OUTDIR)/if_perlsfio.obj: $(OUTDIR) if_perlsfio.c $(INCL)
11721180

11731181
$(OUTDIR)/if_mzsch.obj: $(OUTDIR) if_mzsch.c if_mzsch.h $(INCL) $(MZSCHEME_EXTRA_DEP)
11741182
$(CC) $(CFLAGS) if_mzsch.c \
1175-
-DMZSCHEME_COLLECTS=\"$(MZSCHEME:\=\\)\\collects\"
1176-
mzscheme_base.c:
1177-
!IF "$(MZSCHEME_MAIN_LIB)" == "racket"
1178-
$(MZSCHEME)\raco ctool --c-mods mzscheme_base.c ++lib scheme/base
1179-
!ELSE
1180-
$(MZSCHEME)\mzc --c-mods mzscheme_base.c ++lib scheme/base
1181-
!ENDIF
1183+
-DMZSCHEME_COLLECTS="\"$(MZSCHEME_COLLECTS:\=\\)\""
1184+
1185+
lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib:
1186+
lib /DEF:"$(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).def"
11821187

11831188
$(OUTDIR)/if_python.obj: $(OUTDIR) if_python.c if_py_both.h $(INCL)
11841189
$(CC) $(CFLAGS) $(PYTHON_INC) if_python.c

0 commit comments

Comments
 (0)