-
Notifications
You must be signed in to change notification settings - Fork 126
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
A handful of improvements related to cross compiling #562
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since CC
and GMP_*_DIR
variables are set via $(LIB)/targets/$(TARGET)/vars
rather than directly in the mlton
script, then a corresponding changes should be made to the Makefile.binary
(https://github.com/MLton/mlton/blob/master/Makefile.binary#L69-L73), which allows for customizing those values when updating/installing a binary release. That can assume that TARGET
is self
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I've updated Makefile.binary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that is quite right. The Makefile.binary
is copied into a binary release as Makefile
to facilitate updating and installing a binary release. In particular, one uses the update
target to adjust things like CC
and GMP_LIB
if they are different on the client machine than on the build machine. For example, one might do something like make CC=/path/to/clang update
if the default cc
isn't a suitable C compiler on the client machine.
So, I think the diff to Makefile.binary
is more like:
.PHONY: update
update:
- $(CP) "$(SBIN)/mlton" "$(SBIN)/mlton.bak"
+ $(CP) "$(SLIB)/targets/self/vars" "$(SLIB)/targets/self/vars.bak"
$(SED) \
-e "s;^CC=.*;CC=\"$(CC)\";" \
-e "s;^GMP_INC_DIR=.*;GMP_INC_DIR=$(if $(WITH_GMP_INC_DIR),\"$(WITH_GMP_INC_DIR)\");" \
-e "s;^GMP_LIB_DIR=.*;GMP_LIB_DIR=$(if $(WITH_GMP_LIB_DIR),\"$(WITH_GMP_LIB_DIR)\");" \
- < "$(SBIN)/mlton.bak" > "$(SBIN)/mlton"
- chmod a+x "$(SBIN)/mlton"
- $(RM) "$(SBIN)/mlton.bak"
+ < "$(SLIB)/targets/self/vars.bak" > "$(SLIB)/targets/self/vars"
+ $(RM) "$(SLIB)/targets/self/vars.bak"
$(CP) "$(SLIB)/targets/self/constants" "$(SLIB)/targets/self/constants.bak"
$(SED) \
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! Thank you. I had it 100% backwards. It should be good now.
As defined in the standard, each of these macros are only defined if the platform supports that rounding mode. https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fenv.h.html
This will allow running mlton as a cross-compiler more easily, since the CC and GMP vars may be different between targets.
This makes it easier to build multiple per-target runtime targets and install them together.
This makes any `-target` flag get passed to get the right OBJPTR_REP for cross regressions.
This was split off of #550.