Jon Ludlam
2011-Nov-25 20:49 UTC
[Pkg-xen-devel] [PATCH 6/7] Create 2 ocaml packages, libxen-4.1-ocaml and libxen-4.1-ocaml-dev.
V4 of the patch, incorporating Bastian's suggestions. Jon --- xen/debian/patches/series | 1 + xen/debian/patches/tools-ocaml-fix-build.diff | 81 +++++++++++++++++++++++++ xen/debian/rules | 5 ++ xen/debian/rules.real | 39 ++++++++++++ xen/debian/templates/control.main.in | 16 +++++ xen/debian/templates/control.source.in | 5 +- 6 files changed, 146 insertions(+), 1 deletions(-) create mode 100644 xen/debian/patches/tools-ocaml-fix-build.diff diff --git a/xen/debian/patches/series b/xen/debian/patches/series index 8f816da..a576794 100644 --- a/xen/debian/patches/series +++ b/xen/debian/patches/series @@ -57,3 +57,4 @@ tools-ocaml-fix-xc-dependencies.diff tools-ocaml-remove-uuid.diff tools-ocaml-remove-log.diff tools-ocaml-fix-xc.diff +tools-ocaml-fix-build.diff diff --git a/xen/debian/patches/tools-ocaml-fix-build.diff b/xen/debian/patches/tools-ocaml-fix-build.diff new file mode 100644 index 0000000..48fa095 --- /dev/null +++ b/xen/debian/patches/tools-ocaml-fix-build.diff @@ -0,0 +1,81 @@ +Fix the build of the ocaml libraries + +Signed-off-by: Jon Ludlam <jonathan.ludlam at eu.citrix.com> + +--- a/tools/ocaml/Makefile.rules ++++ b/tools/ocaml/Makefile.rules +@@ -58,14 +58,8 @@ + + # define a library target <name>.cmxa and <name>.cma + define OCAML_LIBRARY_template +- $(1).cmxa: lib$(1)_stubs.a $(foreach obj,$($(1)_OBJS),$(obj).cmx) +- $(call mk-caml-lib-native,$$@, -cclib -l$(1)_stubs $(foreach lib,$(LIBS_$(1)),-cclib $(lib)), $(foreach obj,$($(1)_OBJS),$(obj).cmx)) +- $(1).cma: $(foreach obj,$($(1)_OBJS),$(obj).cmo) +- $(call mk-caml-lib-bytecode,$$@, -dllib dll$(1)_stubs.so -cclib -l$(1)_stubs, $$+) +- $(1)_stubs.a: $(foreach obj,$$($(1)_C_OBJS),$(obj).o) +- $(call mk-caml-stubs,$$@, $$+) +- lib$(1)_stubs.a: $(foreach obj,$($(1)_C_OBJS),$(obj).o) +- $(call mk-caml-lib-stubs,$$@, $$+, $(LIBS_$(1))) ++ $(1).cma: $(foreach obj,$($(1)_OBJS),$(obj).cmx $(obj).cmo) $(foreach obj,$($(1)_C_OBJS),$(obj).o) ++ $(OCAMLMKLIB) -o $1 -oc $(1)_stubs $(foreach obj,$($(1)_OBJS),$(obj).cmx $(obj).cmo) $(foreach obj,$($(1)_C_OBJS),$(obj).o) $(foreach lib, $(LIBS_$(1)_SYSTEM), -cclib $(lib)) $(foreach arg,$(LIBS_$(1)),-ldopt $(arg)) + endef + + define OCAML_NOC_LIBRARY_template +--- a/tools/ocaml/libs/xc/Makefile ++++ b/tools/ocaml/libs/xc/Makefile +@@ -9,7 +9,8 @@ + INTF = xenctrl.cmi + LIBS = xenctrl.cma xenctrl.cmxa + +-LIBS_xenctrl = -L$(XEN_ROOT)/tools/libxc -lxenctrl -lxenguest ++LIBS_xenctrl = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) ++LIBS_xenctrl_SYSTEM = $(LDLIBS_libxenctrl_SYSTEM) $(LDLIBS_libxenguest_SYSTEM) + + xenctrl_OBJS = $(OBJS) + xenctrl_C_OBJS = xenctrl_stubs +--- a/tools/ocaml/xenstored/Makefile ++++ b/tools/ocaml/xenstored/Makefile +@@ -36,7 +36,9 @@ + -ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/eventchn $(OCAML_TOPLEVEL)/libs/eventchn/xeneventchn.cmxa \ + -ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xc $(OCAML_TOPLEVEL)/libs/xc/xenctrl.cmxa \ + -ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xb $(OCAML_TOPLEVEL)/libs/xb/xenbus.cmxa \ +- -ccopt -L -ccopt $(XEN_ROOT)/tools/libxc ++ -ccopt -L -ccopt $(XEN_ROOT)/tools/libxc \ ++ $(foreach obj, $(LDLIBS_libxenctrl), -ccopt $(obj)) \ ++ $(foreach obj, $(LDLIBS_libxenguest), -ccopt $(obj)) + + PROGRAMS = oxenstored + +--- a/tools/ocaml/libs/eventchn/Makefile ++++ b/tools/ocaml/libs/eventchn/Makefile +@@ -7,6 +7,7 @@ + LIBS = xeneventchn.cma xeneventchn.cmxa + + LIBS_xeneventchn = $(LDLIBS_libxenctrl) ++LIBS_xeneventchn_SYSTEM = $(LDLIBS_libxenctrl_SYSTEM) + + all: $(INTF) $(LIBS) $(PROGRAMS) + +--- a/tools/Rules.mk ++++ b/tools/Rules.mk +@@ -21,9 +21,11 @@ + + CFLAGS_libxenctrl = -I$(XEN_LIBXC) $(CFLAGS_include) + LDLIBS_libxenctrl = $(XEN_LIBXC)/libxenctrl-$(XEN_VERSION).so $(DLOPEN_LIBS) ++LDLIBS_libxenctrl_SYSTEM = -lxenctrl-$(XEN_VERSION) + + CFLAGS_libxenguest = -I$(XEN_LIBXC) $(CFLAGS_include) + LDLIBS_libxenguest = $(XEN_LIBXC)/libxenguest-$(XEN_VERSION).so ++LDLIBS_libxenguest_SYSTEM = -lxenguest-$(XEN_VERSION) + + CFLAGS_libxenstore = -I$(XEN_XENSTORE) $(CFLAGS_include) + LDLIBS_libxenstore = -L$(XEN_XENSTORE) -lxenstore +@@ -58,7 +60,7 @@ + LDFLAGS += $(shell getconf LFS_LDFLAGS) + endif + +-# Xen tools build is currently incompatible with ld --as-needed ++ + LDFLAGS += -Wl,--no-as-needed + + # 32-bit x86 does not perform well with -ve segment accesses on Xen. diff --git a/xen/debian/rules b/xen/debian/rules index aade4fb..91f9b1d 100755 --- a/xen/debian/rules +++ b/xen/debian/rules @@ -14,6 +14,11 @@ VERSION_BINNMU := $(shell echo "$(VERSION)" | sed -ne 's,.*\+b\(.*\)$$,\1,p') stamp = [ -d $(dir $@) ] || mkdir $(dir $@); touch $@ include debian/rules.defs +ifneq ($(wildcard /usr/share/ocaml/ocamlvars.mk),/usr/share/ocaml/ocamlvars.mk) + $(error /usr/share/ocaml/ocamlvars.mk not found - please install dh-ocaml) +else + include /usr/share/ocaml/ocamlvars.mk +endif setup: debian/control $(STAMPS_DIR)/setup-base $(STAMPS_DIR)/setup-base: diff --git a/xen/debian/rules.real b/xen/debian/rules.real index f4656f8..b99b999 100644 --- a/xen/debian/rules.real +++ b/xen/debian/rules.real @@ -1,7 +1,11 @@ +include /usr/share/ocaml/ocamlvars.mk + DEB_HOST_ARCH := $(shell dpkg-architecture -a$(ARCH) -qDEB_HOST_ARCH) DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -a$(ARCH) -qDEB_HOST_GNU_TYPE) DEB_BUILD_ARCH := $(shell dpkg-architecture -a$(ARCH) -qDEB_BUILD_ARCH) +GENCONTROL_ARGS := -VF:OCamlABI="$(OCAML_ABI)" + export DH_OPTIONS setup_env := env -u ARCH -u FLAVOUR -u VERSION -u MAKEFLAGS @@ -18,6 +22,8 @@ binary-arch-arch: install-libxen-dev_$(ARCH) binary-arch-arch: install-libxenstore_$(ARCH) binary-arch-arch: install-utils_$(ARCH) binary-arch-arch: install-xenstore-utils_$(ARCH) +binary-arch-arch: install-lib-ocaml-dev_$(ARCH) +binary-arch-arch: install-lib-ocaml_$(ARCH) binary-arch-flavour: install-hypervisor_$(ARCH)_$(FLAVOUR) binary-indep: install-docs @@ -71,6 +77,7 @@ $(STAMPS_DIR)/install-utils_$(ARCH): CONFIG = \ XEN_COMPILE_ARCH=$(XEN_ARCH) \ XEN_TARGET_ARCH=$(XEN_ARCH) \ XEN_VERSION=$(VERSION) \ + OCAMLDESTDIR=$(CURDIR)/$(BUILD_DIR)/install-utils_$(ARCH)_ocaml/$(OCAML_STDLIB_DIR) \ PYTHON=$(shell pyversions -r) $(STAMPS_DIR)/build-utils_$(ARCH): DIR=$(BUILD_DIR)/build-utils_$(ARCH) @@ -82,6 +89,7 @@ $(STAMPS_DIR)/install-utils_$(ARCH): DIR = $(BUILD_DIR)/build-utils_$(ARCH) $(STAMPS_DIR)/install-utils_$(ARCH): INSTALL_DIR = $(BUILD_DIR)/install-utils_$(ARCH) $(STAMPS_DIR)/install-utils_$(ARCH): $(STAMPS_DIR)/build-utils_$(ARCH) @rm -rf $(INSTALL_DIR) + mkdir -p $(INSTALL_DIR)_ocaml/$(OCAML_DLL_DIR) +$(MAKE_CLEAN) -C $(DIR)/tools install DESTDIR=$(CURDIR)/$(INSTALL_DIR) $(CONFIG) # hvmloader #strip --remove-section=.comment --remove-section=.note $(INSTALL_DIR)/usr/lib/xen*/boot/* @@ -144,6 +152,37 @@ install-libxen-dev_$(ARCH): $(STAMPS_DIR)/install-utils_$(ARCH) dh_shlibdeps +$(MAKE_SELF) install-base +install-lib-ocaml_$(ARCH): DIR = $(BUILD_DIR)/install-utils_$(ARCH)_ocaml +install-lib-ocaml_$(ARCH): PACKAGE_NAME = libxen-$(VERSION)-ocaml +install-lib-ocaml_$(ARCH): DH_OPTIONS = -p$(PACKAGE_NAME) +install-lib-ocaml_$(ARCH): $(STAMPS_DIR)/install-utils_$(ARCH) + dh_testdir + dh_testroot + dh_prep + dh_install --sourcedir=$(DIR) $(OCAML_STDLIB_DIR)/*/META + dh_install --sourcedir=$(DIR) $(OCAML_STDLIB_DIR)/*/*.cma + dh_install --sourcedir=$(DIR) $(OCAML_DLL_DIR)/* + dh_strip + dh_shlibdeps + dh_ocaml + +$(MAKE_SELF) install-base + +install-lib-ocaml-dev_$(ARCH): DIR = $(BUILD_DIR)/install-utils_$(ARCH)_ocaml +install-lib-ocaml-dev_$(ARCH): PACKAGE_NAME = libxen-$(VERSION)-ocaml-dev +install-lib-ocaml-dev_$(ARCH): DH_OPTIONS = -p$(PACKAGE_NAME) +install-lib-ocaml-dev_$(ARCH): $(STAMPS_DIR)/install-utils_$(ARCH) + dh_testdir + dh_testroot + dh_prep + dh_install --sourcedir=$(DIR) $(OCAML_STDLIB_DIR)/*/*.cmx + dh_install --sourcedir=$(DIR) $(OCAML_STDLIB_DIR)/*/*.cmxa + dh_install --sourcedir=$(DIR) $(OCAML_STDLIB_DIR)/*/*.cmi + dh_install --sourcedir=$(DIR) $(OCAML_STDLIB_DIR)/*/*.a + dh_strip + dh_shlibdeps + dh_ocaml + +$(MAKE_SELF) install-base + install-libxenstore_$(ARCH): DIR = $(BUILD_DIR)/install-utils_$(ARCH) install-libxenstore_$(ARCH): PACKAGE_NAME = libxenstore3.0 install-libxenstore_$(ARCH): DH_OPTIONS = -p$(PACKAGE_NAME) diff --git a/xen/debian/templates/control.main.in b/xen/debian/templates/control.main.in index 1bc913f..7e23fbd 100644 --- a/xen/debian/templates/control.main.in +++ b/xen/debian/templates/control.main.in @@ -33,3 +33,19 @@ Replaces: xen-utils-common (<= 3.1.0-1) Description: Xenstore utilities for Xen This package contains the Xenstore utilities. +Package: libxen- at version@-ocaml +Section: ocaml +Depends: ${shlibs:Depends}, ${misc:Depends}, ${ocaml:Depends} +Provides: ${ocaml:Provides} +Description: OCaml libraries for controlling Xen + This package contains the runtime libraries required for the ocaml bindings + to the Xen control libraries. + +Package: libxen- at version@-ocaml-dev +Section: ocaml +Depends: libxen- at version@-ocaml (= ${binary:Version}), ${shlibs:Depends}, ocaml-findlib (>= 1.1), ${misc:Depends}, ${ocaml:Depends}, libxen-dev +Provides: ${ocaml:Provides} +Description: OCaml libraries for controlling Xen (devel package) + This package contains the ocaml findlib packages for compiling applications + that are designed to control the Xen hypervisor. + diff --git a/xen/debian/templates/control.source.in b/xen/debian/templates/control.source.in index 388d251..6790bd2 100644 --- a/xen/debian/templates/control.source.in +++ b/xen/debian/templates/control.source.in @@ -17,7 +17,10 @@ Build-Depends: libpci-dev, pkg-config, uuid-dev, - zlib1g-dev + zlib1g-dev, + ocaml-nox (>= 3.11.1-3~), + dh-ocaml (>= 0.9~), + ocaml-findlib Build-Depends-Indep: graphviz, ghostscript, -- 1.7.5.4
Stéphane Glondu
2011-Nov-25 21:36 UTC
[Pkg-xen-devel] [PATCH 6/7] Create 2 ocaml packages, libxen-4.1-ocaml and libxen-4.1-ocaml-dev.
Le 25/11/2011 21:49, Jon Ludlam a ?crit :> +GENCONTROL_ARGS := -VF:OCamlABI="$(OCAML_ABI)"This should not be needed. It seems that you actually never answered: does dh_ocaml actually generates the dependency to ocaml-*-$ABI ?> + dh_install --sourcedir=$(DIR) $(OCAML_DLL_DIR)/*If there is a .so.owner in $(OCAML_DLL_DIR), it should not be installed... we usually call dh_install with -X.so.owner. Cheers, -- St?phane
Ian Campbell
2011-Nov-25 23:23 UTC
[Pkg-xen-devel] [PATCH 6/7] Create 2 ocaml packages, libxen-4.1-ocaml and libxen-4.1-ocaml-dev.
On Fri, 2011-11-25 at 20:49 +0000, Jon Ludlam wrote:> @@ -14,6 +14,11 @@ VERSION_BINNMU := $(shell echo "$(VERSION)" | sed > -ne 's,.*\+b\(.*\)$$,\1,p') > stamp = [ -d $(dir $@) ] || mkdir $(dir $@); touch $@ > > include debian/rules.defs > +ifneq > ($(wildcard /usr/share/ocaml/ocamlvars.mk),/usr/share/ocaml/ocamlvars.mk) > + $(error /usr/share/ocaml/ocamlvars.mk not found - please install > dh-ocaml) > +else > + include /usr/share/ocaml/ocamlvars.mk > +endif > > setup: debian/control $(STAMPS_DIR)/setup-baseSince you no longer need this for the pre-build generation of the control files you can rely on the build-deps to ensure this is provided and hence don't need the magic bits, just the include will do. Having said that since all the uses of the variables are now in rules.real do you even need this at all? Ian. -- Ian Campbell Democracy means simply the bludgeoning of the people by the people for the people. -- Oscar Wilde