ia64/xen-unstable

changeset 19623:e0221531d0e5

stubdom: 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@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue May 19 14:17:56 2009 +0100 (2009-05-19)
parents b4de3a393f21
children 6e286d08c4a9
files .hgignore stubdom/Makefile stubdom/caml/Makefile stubdom/ocaml.patch
line diff
     1.1 --- a/.hgignore	Tue May 19 14:15:43 2009 +0100
     1.2 +++ b/.hgignore	Tue May 19 14:17:56 2009 +0100
     1.3 @@ -99,6 +99,7 @@
     1.4  ^stubdom/pciutils-.*$
     1.5  ^stubdom/zlib-.*$
     1.6  ^stubdom/grub-.*$
     1.7 +^stubdom/ocaml-.*$
     1.8  ^stubdom/lwip/
     1.9  ^stubdom/ioemu/
    1.10  ^tools/.*/build/lib.*/.*\.py$
     2.1 --- a/stubdom/Makefile	Tue May 19 14:15:43 2009 +0100
     2.2 +++ b/stubdom/Makefile	Tue May 19 14:17:56 2009 +0100
     2.3 @@ -27,6 +27,10 @@ LWIP_VERSION=1.3.0
     2.4  GRUB_URL?=$(XEN_EXTFILES_URL)
     2.5  GRUB_VERSION=0.97
     2.6  
     2.7 +#OCAML_URL?=$(XEN_EXTFILES_URL)
     2.8 +OCAML_URL?=http://caml.inria.fr/pub/distrib/ocaml-3.11
     2.9 +OCAML_VERSION=3.11.0
    2.10 +
    2.11  WGET=wget -c
    2.12  
    2.13  GNU_TARGET_ARCH:=$(XEN_TARGET_ARCH)
    2.14 @@ -164,6 +168,37 @@ lwip-$(XEN_TARGET_ARCH): lwip-$(LWIP_VER
    2.15  	patch -d $@ -p0 < lwip.patch-cvs
    2.16  	touch $@
    2.17  
    2.18 +#############
    2.19 +# Cross-ocaml
    2.20 +#############
    2.21 +
    2.22 +CAMLLIB = $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib/ocaml
    2.23 +OCAML_STAMPFILE=$(CAMLLIB)/.dirstamp
    2.24 +
    2.25 +ocaml-$(OCAML_VERSION).tar.gz:
    2.26 +	$(WGET) $(OCAML_URL)/$@
    2.27 +
    2.28 +ocaml-$(XEN_TARGET_ARCH)/.dirstamp: ocaml-$(OCAML_VERSION).tar.gz ocaml.patch
    2.29 +	tar xzf $<
    2.30 +	cd ocaml-$(OCAML_VERSION) && patch -p0 < ../ocaml.patch
    2.31 +	rm -rf ocaml-$(XEN_TARGET_ARCH)
    2.32 +	mv ocaml-$(OCAML_VERSION) ocaml-$(XEN_TARGET_ARCH)
    2.33 +	touch $@
    2.34 +
    2.35 +MINIOS_HASNOT=IPV6 INET_ATON
    2.36 +
    2.37 +.PHONY: cross-ocaml
    2.38 +cross-ocaml: $(OCAML_STAMPFILE)
    2.39 +$(OCAML_STAMPFILE): ocaml-$(XEN_TARGET_ARCH)/.dirstamp
    2.40 +	cd ocaml-$(XEN_TARGET_ARCH) &&  ./configure -prefix $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf \
    2.41 +		-no-pthread -no-shared-libs -no-tk -no-curses \
    2.42 +		-cc "$(CC) -U_FORTIFY_SOURCE -fno-stack-protector"
    2.43 +	$(foreach i,$(MINIOS_HASNOT),sed -i 's,^\(#define HAS_$(i)\),//\1,' ocaml-$(XEN_TARGET_ARCH)/config/s.h ; )
    2.44 +	$(MAKE) -C ocaml-$(XEN_TARGET_ARCH) world
    2.45 +	$(MAKE) -C ocaml-$(XEN_TARGET_ARCH) opt
    2.46 +	$(MAKE) -C ocaml-$(XEN_TARGET_ARCH) install
    2.47 +	touch $@
    2.48 +
    2.49  #######
    2.50  # Links
    2.51  #######
    2.52 @@ -251,7 +286,7 @@ ioemu: cross-zlib cross-libpci libxc
    2.53  
    2.54  .PHONY: caml
    2.55  caml: $(CROSS_ROOT)
    2.56 -	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
    2.57 +	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/
    2.58  
    2.59  ###
    2.60  # C
    2.61 @@ -289,7 +324,6 @@ ioemu-stubdom: APP_OBJS=$(CURDIR)/ioemu/
    2.62  ioemu-stubdom: mini-os-$(XEN_TARGET_ARCH)-ioemu lwip-$(XEN_TARGET_ARCH) libxc ioemu
    2.63  	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)"
    2.64  
    2.65 -CAMLLIB = $(shell ocamlc -where)
    2.66  .PHONY: caml-stubdom
    2.67  caml-stubdom: mini-os-$(XEN_TARGET_ARCH)-caml lwip-$(XEN_TARGET_ARCH) libxc caml
    2.68  	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"
    2.69 @@ -351,6 +385,7 @@ crossclean: clean
    2.70  	rm -fr zlib-$(XEN_TARGET_ARCH) pciutils-$(XEN_TARGET_ARCH)
    2.71  	rm -fr libxc-$(XEN_TARGET_ARCH) ioemu
    2.72  	rm -f mk-headers-$(XEN_TARGET_ARCH)
    2.73 +	rm -fr ocaml-$(XEN_TARGET_ARCH)
    2.74  
    2.75  # clean patched sources
    2.76  .PHONY: patchclean
    2.77 @@ -367,6 +402,7 @@ downloadclean: patchclean
    2.78  	rm -f pciutils-$(LIBPCI_VERSION).tar.bz2
    2.79  	rm -f grub-$(GRUB_VERSION).tar.gz
    2.80  	rm -f lwip-$(LWIP_VERSION).tar.gz
    2.81 +	rm -f ocaml-$(OCAML_VERSION).tar.gz
    2.82  
    2.83  .PHONY: distclean
    2.84  distclean: downloadclean
     3.1 --- a/stubdom/caml/Makefile	Tue May 19 14:15:43 2009 +0100
     3.2 +++ b/stubdom/caml/Makefile	Tue May 19 14:17:56 2009 +0100
     3.3 @@ -2,11 +2,10 @@ XEN_ROOT = ../..
     3.4  
     3.5  include $(XEN_ROOT)/Config.mk
     3.6  
     3.7 -CAMLLIB = $(shell ocamlc -where)
     3.8 +CAMLLIB = $(shell $(OCAMLC_CROSS_PREFIX)ocamlc -where)
     3.9  DEF_CPPFLAGS += -I$(CAMLLIB)
    3.10  
    3.11 -OCAMLFIND=ocamlfind
    3.12 -OCAMLOPT=ocamlopt
    3.13 +OCAMLOPT=$(OCAMLC_CROSS_PREFIX)ocamlopt
    3.14  
    3.15  OBJS := hello.cmx
    3.16  LIBS := 
    3.17 @@ -14,10 +13,10 @@ LIBS :=
    3.18  all: main-caml.o caml.o
    3.19  
    3.20  %.cmx: %.ml
    3.21 -	$(OCAMLFIND) $(OCAMLOPT) -c $< -o $@
    3.22 +	$(OCAMLOPT) -c $< -o $@
    3.23  
    3.24  caml.o: $(OBJS)
    3.25 -	$(OCAMLFIND) $(OCAMLOPT) $(LIBS) $^ -output-obj -o $@
    3.26 +	$(OCAMLOPT) $(LIBS) $^ -output-obj -o $@
    3.27  
    3.28  clean:
    3.29  	rm -f *.a *.o *.cmx *.cmi
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/stubdom/ocaml.patch	Tue May 19 14:17:56 2009 +0100
     4.3 @@ -0,0 +1,19 @@
     4.4 +--- byterun/Makefile.orig	2009-04-07 12:14:02.000000000 +0100
     4.5 ++++ byterun/Makefile	2009-04-07 12:13:50.000000000 +0100
     4.6 +@@ -22,14 +22,14 @@
     4.7 + DOBJS=$(OBJS:.o=.d.o) instrtrace.d.o
     4.8 + PICOBJS=$(OBJS:.o=.pic.o)
     4.9 + 
    4.10 +-#ifeq ($(SUPPORTS_SHARED_LIBRARIES),true)
    4.11 ++ifeq ($(SUPPORTS_SHARED_LIBRARIES),true)
    4.12 + 
    4.13 + all:: libcamlrun_shared.so
    4.14 + 
    4.15 + install::
    4.16 + 	cp libcamlrun_shared.so $(LIBDIR)/libcamlrun_shared.so
    4.17 + 
    4.18 +-#endif
    4.19 ++endif
    4.20 + 
    4.21 + ocamlrun$(EXE): libcamlrun.a prims.o
    4.22 + 	$(MKEXE) $(BYTECCLINKOPTS) -o ocamlrun$(EXE) \