Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use forward slashes and quoted OCaml strings #323

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ NEXT_RELEASE:

- Quote Makefile arguments to allow spaces in paths, especially on Windows.
Documented in #321 (#324 by Jonah Beckford)
- Use forward slashes and quoted OCaml strings to avoid unescaping
of Windows backslashes documented in #321
(#323 by Jonah Beckford)

0.14.2 (28 Sep 2022):
---------------------
Expand Down
26 changes: 14 additions & 12 deletions configure.make
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,15 @@ clean:
distclean:
rm -f Makefile.config src/ocamlbuild_config.ml

# Convert Makefile paths into Unix-style forward slashes. This avoids
# escaping backslashes when the Makefile prints into OCaml strings.
Makefile.config:
(echo "# This file was generated from configure.make"; \
echo ;\
echo "OCAML_PREFIX=$(OCAML_PREFIX)"; \
echo "OCAML_BINDIR=$(OCAML_BINDIR)"; \
echo "OCAML_LIBDIR=$(OCAML_LIBDIR)"; \
echo "OCAML_MANDIR=$(OCAML_MANDIR)"; \
echo "OCAML_PREFIX=$(shell printf '%s' '$(OCAML_PREFIX)' | tr '\' /)"; \
echo "OCAML_BINDIR=$(shell printf '%s' '$(OCAML_BINDIR)' | tr '\' /)"; \
echo "OCAML_LIBDIR=$(shell printf '%s' '$(OCAML_LIBDIR)' | tr '\' /)"; \
echo "OCAML_MANDIR=$(shell printf '%s' '$(OCAML_MANDIR)' | tr '\' /)"; \
echo ;\
echo "EXT_OBJ=$(EXT_OBJ)"; \
echo "EXT_ASM=$(EXT_ASM)"; \
Expand All @@ -83,19 +85,19 @@ Makefile.config:
echo "NATDYNLINK=$(NATDYNLINK)"; \
echo "SUPPORT_SHARED_LIBRARIES=$(SUPPORTS_SHARED_LIBRARIES)"; \
echo ;\
echo "PREFIX=$(OCAMLBUILD_PREFIX)"; \
echo "BINDIR=$(OCAMLBUILD_BINDIR)"; \
echo "LIBDIR=$(OCAMLBUILD_LIBDIR)"; \
echo "MANDIR=$(OCAMLBUILD_MANDIR)"; \
echo "PREFIX=$(shell printf '%s' '$(OCAMLBUILD_PREFIX)' | tr '\' /)"; \
echo "BINDIR=$(shell printf '%s' '$(OCAMLBUILD_BINDIR)' | tr '\' /)"; \
echo "LIBDIR=$(shell printf '%s' '$(OCAMLBUILD_LIBDIR)' | tr '\' /)"; \
echo "MANDIR=$(shell printf '%s' '$(OCAMLBUILD_MANDIR)' | tr '\' /)"; \
) > $@

src/ocamlbuild_config.ml:
(echo "(* This file was generated from ../configure.make *)"; \
echo ;\
echo 'let bindir = "$(OCAMLBUILD_BINDIR)"'; \
echo 'let libdir = "$(OCAMLBUILD_LIBDIR)"'; \
echo 'let ocaml_libdir = "$(abspath $(OCAML_LIBDIR))"'; \
echo 'let libdir_abs = "$(abspath $(OCAMLBUILD_LIBDIR))"'; \
echo 'let bindir = {|$(OCAMLBUILD_BINDIR)|}'; \
echo 'let libdir = {|$(OCAMLBUILD_LIBDIR)|}'; \
echo 'let ocaml_libdir = {|$(abspath $(OCAML_LIBDIR))|}'; \
echo 'let libdir_abs = {|$(abspath $(OCAMLBUILD_LIBDIR))|}'; \
echo 'let ocaml_native = $(OCAML_NATIVE)'; \
echo 'let ocaml_native_tools = $(OCAML_NATIVE_TOOLS)'; \
echo 'let supports_shared_libraries = $(SUPPORTS_SHARED_LIBRARIES)';\
Expand Down