Skip to contentSkip to conversation

tools/ocaml: Incremental build fixes

PATCH In review Andrew Cooper 3 participants 6 messages Aug 23, 2024

lore
Share & tools
lore
#0 lore raw

cover tools/ocaml: Incremental build fixes

Various extra build bugfixes found while reviewing the Stabilize Oxenstored's interface with series.

Andrew Cooper (3):
tools/ocaml: Drop OCAMLOPTFLAG_G invocation tools/ocaml: Drop o= rune
tools/ocaml: Fix the version embedded in META files

 tools/ocaml/Makefile.rules | 5 +++--
 tools/ocaml/common.make    | 7 ++-----
 2 files changed, 5 insertions(+), 7 deletions(-)

base-commit: 5231765a4e6528a3208e49885b9eeff42519a6c1

Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/3 tools/ocaml: Drop OCAMLOPTFLAG_G invocation

These days, ocamlopt -h asks you whether you meant --help instead, meaning that the $(shell ) invocation here isn't going end up containing '-g'.

Make it unconditional, like it is in OCAMLCFLAGS already.

---
CC: Christian Lindig <[email protected]>
CC: David Scott <[email protected]>
CC: Edwin Török <[email protected]>
CC: Rob Hoes <[email protected]>
CC: Andrii Sultanov <[email protected]>
CC: Anthony PERARD <[email protected]>

---
 tools/ocaml/common.make | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/ocaml/common.make +1 -2
index cc126b749f56..708d74617c8d 100644
@@ -11,8 +11,7 @@ OCAMLFIND ?= ocamlfind
 
 CFLAGS += -fPIC -I$(shell ocamlc -where)
 
-OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
-OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -w F -warn-error F
+OCAMLOPTFLAGS = -g -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -w F -warn-error F
 OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
 
 VERSION := 4.1
Signature · 1 line
2.39.2
#2 lore raw

PATCH 2/3 tools/ocaml: Drop o= rune

In reply to Andrew Cooper

This hides a shell redirection which is quite rude. It also opencodes $(move-if-changed) without the benefit of short-circuiting dependent logic when the content hasn't changed.

---
CC: Christian Lindig <[email protected]>
CC: David Scott <[email protected]>
CC: Edwin Török <[email protected]>
CC: Rob Hoes <[email protected]>
CC: Andrii Sultanov <[email protected]>
CC: Anthony PERARD <[email protected]>

---
 tools/ocaml/Makefile.rules | 5 +++--
 tools/ocaml/common.make    | 2 --
 2 files changed, 3 insertions(+), 4 deletions(-)
tools/ocaml/Makefile.rules +3 -2
index 5638193edf8a..5d534d8754bf 100644
@@ -40,13 +40,14 @@ ALL_OCAML_OBJS ?= $(OBJS)
 	$(call quiet-command, $(CC) $(CFLAGS) -c -o $@ $<,CC,$@)
 
 META: META.in
-	sed 's/@VERSION@/$(VERSION)/g' < $< $o
+	sed 's/@VERSION@/$(VERSION)/g' < $< > [email protected]
+	$(call move-if-changed,[email protected],$@)
 
 ALL_OCAML_OBJ_SOURCES=$(addsuffix .ml, $(ALL_OCAML_OBJS))
 
 ifneq ($(MAKECMDGOALS),clean)
 .ocamldep.make: $(ALL_OCAML_OBJ_SOURCES) Makefile $(OCAML_TOPLEVEL)/Makefile.rules
-	$(call quiet-command, $(OCAMLDEP) $(ALL_OCAML_OBJ_SOURCES) *.mli $o,MLDEP,)
+	$(call quiet-command, $(OCAMLDEP) $(ALL_OCAML_OBJ_SOURCES) *.mli > [email protected]; $(call move-if-changed,[email protected],$@),MLDEP,)
 endif
 
 clean: $(CLEAN_HOOKS)
tools/ocaml/common.make +0 -2
index 708d74617c8d..979cbe08459b 100644
@@ -17,5 +17,3 @@ OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
 VERSION := 4.1
 
 OCAMLDESTDIR ?= $(DESTDIR)$(shell $(OCAMLFIND) printconf destdir)
-
-o= >[email protected] && mv -f [email protected] $@
Signature · 1 line
2.39.2
#3 lore raw

PATCH 3/3 tools/ocaml: Fix the version embedded in META files

In reply to Andrew Cooper

Xen 4.1 is more than a decade stale now. Use the same mechanism as elsewhere in the tree to get the current version number.

---
CC: Christian Lindig <[email protected]>
CC: David Scott <[email protected]>
CC: Edwin Török <[email protected]>
CC: Rob Hoes <[email protected]>
CC: Andrii Sultanov <[email protected]>
CC: Anthony PERARD <[email protected]>

We could use autoconf for this, but it's rather more invasive and there's going to be a reasonable amount of churn in this area anyway.

---
 tools/ocaml/common.make | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/ocaml/common.make +1 -1
index 979cbe08459b..c7eefceeb42b 100644
@@ -14,6 +14,6 @@ CFLAGS += -fPIC -I$(shell ocamlc -where)
 OCAMLOPTFLAGS = -g -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -w F -warn-error F
 OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
 
-VERSION := 4.1
+VERSION := $(shell $(XEN_ROOT)/version.sh $(XEN_ROOT)/xen/Makefile)
 
 OCAMLDESTDIR ?= $(DESTDIR)$(shell $(OCAMLFIND) printconf destdir)
Signature · 1 line
2.39.2
Acked-by on the v1 series
#4 lore raw
In reply to Andrew Cooper
Quoted 12 lines · Andrew Cooper

Various extra build bugfixes found while reviewing the Stabilize Oxenstored's interface with series.

Andrew Cooper (3):
tools/ocaml: Drop OCAMLOPTFLAG_G invocation tools/ocaml: Drop o= rune
tools/ocaml: Fix the version embedded in META files

Quoted 9 lines

tools/ocaml/Makefile.rules | 5 +++--
tools/ocaml/common.make | 7 ++-----

2 files changed, 5 insertions(+), 7 deletions(-)

base-commit: 5231765a4e6528a3208e49885b9eeff42519a6c1

Signature · 1 line
2.39.2
Reviewed-by
#5 lore raw

The Makefile changes look fine to me as well.

Quoted 25 lines · Christian Lindig
Quoted 13 lines · Andrew Cooper

Various extra build bugfixes found while reviewing the Stabilize Oxenstored's interface with series.

Andrew Cooper (3):
tools/ocaml: Drop OCAMLOPTFLAG_G invocation tools/ocaml: Drop o= rune
tools/ocaml: Fix the version embedded in META files

Quoted 9 lines

tools/ocaml/Makefile.rules | 5 +++--
tools/ocaml/common.make | 7 ++-----

2 files changed, 5 insertions(+), 7 deletions(-)

base-commit: 5231765a4e6528a3208e49885b9eeff42519a6c1 --
2.39.2