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

Set FLEXDIR when bootstrapping flexlink #13723

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
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
8 changes: 3 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -645,17 +645,17 @@ flexlink.byte$(EXE): $(FLEXDLL_SOURCES)
OCAMLOPT='$(value BOOT_OCAMLC) $(USE_RUNTIME_PRIMS) $(USE_STDLIB)' \
flexlink.exe support
cp $(FLEXDLL_SOURCE_DIR)/flexlink.exe $@
cp $(addprefix $(FLEXDLL_SOURCE_DIR)/, $(FLEXDLL_OBJECTS)) $(ROOTDIR)

partialclean::
rm -f flexlink.byte flexlink.byte.exe
rm -f flexlink.byte flexlink.byte.exe flexdll_*.o flexdll_*.obj

$(BYTE_BINDIR)/flexlink$(EXE): \
boot/ocamlrun$(EXE) flexlink.byte$(EXE) | $(BYTE_BINDIR)
rm -f $@
# Start with a copy to ensure that the result is always executable
cp boot/ocamlrun$(EXE) $@
cat flexlink.byte$(EXE) >> $@
cp $(addprefix $(FLEXDLL_SOURCE_DIR)/, $(FLEXDLL_OBJECTS)) $(BYTE_BINDIR)

partialclean::
rm -f $(BYTE_BINDIR)/flexlink $(BYTE_BINDIR)/flexlink.exe
Expand Down Expand Up @@ -885,7 +885,6 @@ flexlink.opt$(EXE): \
cp $(FLEXDLL_SOURCE_DIR)/flexlink.exe $@
rm -f $(OPT_BINDIR)/flexlink$(EXE)
cd $(OPT_BINDIR); $(LN) $(call ROOT_FROM, $(OPT_BINDIR))/$@ flexlink$(EXE)
cp $(addprefix $(BYTE_BINDIR)/, $(FLEXDLL_OBJECTS)) $(OPT_BINDIR)

else

Expand Down Expand Up @@ -2802,8 +2801,7 @@ ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
flexlink.byte$(EXE) "$(INSTALL_BINDIR)"
endif # ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
$(MKDIR) "$(INSTALL_FLEXDLLDIR)"
$(INSTALL_DATA) $(addprefix $(BYTE_BINDIR)/, $(FLEXDLL_OBJECTS)) \
"$(INSTALL_FLEXDLLDIR)"
$(INSTALL_DATA) $(FLEXDLL_OBJECTS) "$(INSTALL_FLEXDLLDIR)"
endif # ifeq "$(BOOTSTRAPPING_FLEXDLL)" "true"
$(INSTALL_DATA) Makefile.config "$(INSTALL_LIBDIR)"
$(INSTALL_DATA) $(DOC_FILES) "$(INSTALL_DOCDIR)"
Expand Down
2 changes: 2 additions & 0 deletions Makefile.build_config.in
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ OC_NATIVE_COMPFLAGS = @oc_native_compflags@

OC_NATIVE_LINKFLAGS = -g

BUILD_TRIPLET = @build@

# Platform-dependent command to create symbolic links
LN = @ln@

Expand Down
22 changes: 21 additions & 1 deletion Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,29 @@ ifeq "$(BOOTSTRAPPING_FLEXDLL)" "true"
ifeq "$(filter $(REAL_ROOT_DIR)/$(BYTE_BINDIR), $(subst :, ,$(PATH)))" ""
export PATH := \
$(REAL_ROOT_DIR)/$(OPT_BINDIR):$(REAL_ROOT_DIR)/$(BYTE_BINDIR):$(PATH)
# $(BUILD_COMPANY_SYSTEM) is the last two parts of $(BUILD_TRIPLET)
BUILD_TRIPLET_FIELDS := $(subst -,$(SPACE),$(BUILD_TRIPLET))
BUILD_COMPANY_SYSTEM := $(subst $(SPACE),-,$\
$(wordlist 2, $(words $(BUILD_TRIPLET_FIELDS)), $(BUILD_TRIPLET_FIELDS)))
# Use the FLEXDIR environment variable to tell flexlink where the support
# objects are located. Passing this location using -I would defeat the whole
# purpose of the PATH-trick (bootstrapped flexlink is indistinguishable from
# an installed flexlink). flexlink also looks for the objects in the same
# directory as the executable, but this is slightly irritating as it requires
# copying them to both byte/bin/ and opt/bin/ but also doesn't work if
# opt/bin/flexlink.exe is a symlink to flexlink.opt.exe, as flexlink can end
# up looking in the directory for the target of the symlink, rather than the
# symlink itself.
ifeq "" "$(filter pc-msys pc-cygwin%, $(BUILD_COMPANY_SYSTEM))"
export FLEXDIR := $(REAL_ROOT_DIR)
else
export FLEXDIR := $(shell cygpath -w "$(REAL_ROOT_DIR)")
endif
undefine REAL_ROOT_DIR
undefine BUILD_TRIPLET_FIELDS
undefine BUILD_COMPANY_SYSTEM
endif
undefine REAL_ROOT_DIR
endif # ifeq "$(BOOTSTRAPPING_FLEXDLL)" "true"

# List of other libraries
ALL_OTHERLIBS = dynlink str systhreads unix runtime_events
Expand Down
3 changes: 1 addition & 2 deletions Makefile.cross
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,9 @@ cross-flexdll: | $(BYTE_BINDIR) $(OPT_BINDIR)
$(LN) flexlink.opt.exe flexlink.byte.exe
cp flexlink.byte.exe $(BYTE_BINDIR)/flexlink
cd $(BYTE_BINDIR) && $(LN) flexlink flexlink.exe
cp $(addprefix $(FLEXDLL_SOURCE_DIR)/, $(FLEXDLL_OBJECTS)) $(BYTE_BINDIR)
cp $(addprefix $(FLEXDLL_SOURCE_DIR)/, $(FLEXDLL_OBJECTS)) $(ROOTDIR)
cp flexlink.opt.exe $(OPT_BINDIR)/flexlink
cd $(OPT_BINDIR) && $(LN) flexlink flexlink.exe
cp $(addprefix $(FLEXDLL_SOURCE_DIR)/, $(FLEXDLL_OBJECTS)) $(OPT_BINDIR)

INSTALL_OVERRIDES=build_ocamldoc=false WITH_DEBUGGER= OCAMLRUN=ocamlrun

Expand Down
Loading