WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 4/5] integrate xen-ocaml-tools.hg with xen-unstable.h

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 4/5] integrate xen-ocaml-tools.hg with xen-unstable.hg - ocaml crosscompile
From: Alex Zeffertt <alex.zeffertt@xxxxxxxxxxxxx>
Date: Fri, 24 Apr 2009 13:03:17 +0100
Delivery-date: Fri, 24 Apr 2009 05:06:11 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.19 (X11/20090105)

Rebuild the ocaml runtime libraries with the options needed if they
are to be linked with object files created by ocamlc and the minios
kernel.

This is needed to build stubdoms written in ocaml.

Signed-off-by: Alex Zeffertt <alex.zeffertt@xxxxxxxxxxxxx>

diff -r b911671963e3 .hgignore
--- a/.hgignore Fri Apr 24 12:15:45 2009 +0100
+++ b/.hgignore Fri Apr 24 12:18:48 2009 +0100
@@ -99,6 +99,7 @@
 ^stubdom/pciutils-.*$
 ^stubdom/zlib-.*$
 ^stubdom/grub-.*$
+^stubdom/ocaml-.*$
 ^stubdom/lwip/
 ^stubdom/ioemu/
 ^tools/.*/build/lib.*/.*\.py$
diff -r b911671963e3 stubdom/Makefile
--- a/stubdom/Makefile  Fri Apr 24 12:15:45 2009 +0100
+++ b/stubdom/Makefile  Fri Apr 24 12:18:48 2009 +0100
@@ -26,6 +26,10 @@
 #GRUB_URL?=http://alpha.gnu.org/gnu/grub
 GRUB_URL?=$(XEN_EXTFILES_URL)
 GRUB_VERSION=0.97
+
+#OCAML_URL?=$(XEN_EXTFILES_URL)
+OCAML_URL?=http://caml.inria.fr/pub/distrib/ocaml-3.11
+OCAML_VERSION=3.11.0
 
 WGET=wget -c
 
@@ -164,6 +168,37 @@
        patch -d $@ -p0 < lwip.patch-cvs
        touch $@
 
+#############
+# Cross-ocaml
+#############
+
+CAMLLIB = $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib/ocaml
+OCAML_STAMPFILE=$(CAMLLIB)/.dirstamp
+
+ocaml-$(OCAML_VERSION).tar.gz:
+       $(WGET) $(OCAML_URL)/$@
+
+ocaml-$(XEN_TARGET_ARCH)/.dirstamp: ocaml-$(OCAML_VERSION).tar.gz ocaml.patch
+       tar xzf $<
+       cd ocaml-$(OCAML_VERSION) && patch -p0 < ../ocaml.patch
+       rm -rf ocaml-$(XEN_TARGET_ARCH)
+       mv ocaml-$(OCAML_VERSION) ocaml-$(XEN_TARGET_ARCH)
+       touch $@
+
+MINIOS_HASNOT=IPV6 INET_ATON
+
+.PHONY: cross-ocaml
+cross-ocaml: $(OCAML_STAMPFILE)
+$(OCAML_STAMPFILE): ocaml-$(XEN_TARGET_ARCH)/.dirstamp
+       cd ocaml-$(XEN_TARGET_ARCH) &&  ./configure -prefix 
$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf \
+               -no-pthread -no-shared-libs -no-tk -no-curses \
+               -cc "$(CC) -U_FORTIFY_SOURCE -fno-stack-protector"
+       $(foreach i,$(MINIOS_HASNOT),sed -i 's,^\(#define HAS_$(i)\),//\1,' 
ocaml-$(XEN_TARGET_ARCH)/config/s.h ; )
+       $(MAKE) -C ocaml-$(XEN_TARGET_ARCH) world
+       $(MAKE) -C ocaml-$(XEN_TARGET_ARCH) opt
+       $(MAKE) -C ocaml-$(XEN_TARGET_ARCH) install
+       touch $@
+
 #######
 # Links
 #######
@@ -254,7 +289,7 @@
 
 .PHONY: caml
 caml: $(CROSS_ROOT)
-       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@ 
LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
+       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@ 
LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
OCAMLC_CROSS_PREFIX=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/bin/
 
 ###
 # C
@@ -300,7 +335,6 @@
 ioemu-stubdom: mini-os-$(XEN_TARGET_ARCH)-ioemu lwip-$(XEN_TARGET_ARCH) libxc 
ioemu
        DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_QEMU 
$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(MINI_OS) 
OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
APP_OBJS="$(APP_OBJS)"
 
-CAMLLIB = $(shell ocamlc -where)
 .PHONY: caml-stubdom
 caml-stubdom: mini-os-$(XEN_TARGET_ARCH)-caml lwip-$(XEN_TARGET_ARCH) libxc 
caml
        DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_CAML 
$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(MINI_OS) 
OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
APP_OBJS="$(CURDIR)/caml/main-caml.o $(CURDIR)/caml/caml.o 
$(CAMLLIB)/libasmrun.a"
@@ -372,6 +406,7 @@
        rm -fr zlib-$(XEN_TARGET_ARCH) pciutils-$(XEN_TARGET_ARCH)
        rm -fr libxc-$(XEN_TARGET_ARCH) ioemu
        rm -f mk-headers-$(XEN_TARGET_ARCH)
+       rm -fr ocaml-$(XEN_TARGET_ARCH)
 
 # clean patched sources
 .PHONY: patchclean
@@ -388,6 +423,7 @@
        rm -f pciutils-$(LIBPCI_VERSION).tar.bz2
        rm -f grub-$(GRUB_VERSION).tar.gz
        rm -f lwip-$(LWIP_VERSION).tar.gz
+       rm -f ocaml-$(OCAML_VERSION).tar.gz
 
 .PHONY: distclean
 distclean: downloadclean
diff -r b911671963e3 stubdom/caml/Makefile
--- a/stubdom/caml/Makefile     Fri Apr 24 12:15:45 2009 +0100
+++ b/stubdom/caml/Makefile     Fri Apr 24 12:18:48 2009 +0100
@@ -2,11 +2,10 @@
 
 include $(XEN_ROOT)/Config.mk
 
-CAMLLIB = $(shell ocamlc -where)
+CAMLLIB = $(shell $(OCAMLC_CROSS_PREFIX)ocamlc -where)
 DEF_CPPFLAGS += -I$(CAMLLIB)
 
-OCAMLFIND=ocamlfind
-OCAMLOPT=ocamlopt
+OCAMLOPT=$(OCAMLC_CROSS_PREFIX)ocamlopt
 
 OBJS := hello.cmx
 LIBS := 
@@ -14,10 +13,10 @@
 all: main-caml.o caml.o
 
 %.cmx: %.ml
-       $(OCAMLFIND) $(OCAMLOPT) -c $< -o $@
+       $(OCAMLOPT) -c $< -o $@
 
 caml.o: $(OBJS)
-       $(OCAMLFIND) $(OCAMLOPT) $(LIBS) $^ -output-obj -o $@
+       $(OCAMLOPT) $(LIBS) $^ -output-obj -o $@
 
 clean:
        rm -f *.a *.o *.cmx *.cmi
diff -r b911671963e3 stubdom/ocaml.patch
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/stubdom/ocaml.patch       Fri Apr 24 12:18:48 2009 +0100
@@ -0,0 +1,19 @@
+--- byterun/Makefile.orig      2009-04-07 12:14:02.000000000 +0100
++++ byterun/Makefile   2009-04-07 12:13:50.000000000 +0100
+@@ -22,14 +22,14 @@
+ DOBJS=$(OBJS:.o=.d.o) instrtrace.d.o
+ PICOBJS=$(OBJS:.o=.pic.o)
+ 
+-#ifeq ($(SUPPORTS_SHARED_LIBRARIES),true)
++ifeq ($(SUPPORTS_SHARED_LIBRARIES),true)
+ 
+ all:: libcamlrun_shared.so
+ 
+ install::
+       cp libcamlrun_shared.so $(LIBDIR)/libcamlrun_shared.so
+ 
+-#endif
++endif
+ 
+ ocamlrun$(EXE): libcamlrun.a prims.o
+       $(MKEXE) $(BYTECCLINKOPTS) -o ocamlrun$(EXE) \

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 4/5] integrate xen-ocaml-tools.hg with xen-unstable.hg - ocaml crosscompile, Alex Zeffertt <=