Package: llvm-dev Version: 2.6-6 Severity: normal Tags: patch
Hello, You can find a patch to create a package libllvm-ocaml-dev that contains the OCaml bindings as shipped by LLVM. I have added all the required glue to match the current OCaml packaging policy, including the use of dh_ocaml -- which helps to compute OCaml dependencies. I have also written a little META file to ease OCaml integration. The only "weird" fix is that llvm uses strange symlinks pointing to the $DESTDIR. I have fixed them but this is the weak part of the patch. I think this is something to discuss with upstream. I have built it without optimized compiler and in a pbuilder. Everything seems fine (well the pbuilder had problem with logwatch, but this is another topic). I hope you will be able to use it for the next upload. I am willing to support all things related to OCaml in LLVM, just drop me an email if you want. Regards Sylvain Le Gall -- System Information: Debian Release: squeeze/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 2.6.32-trunk-amd64 (SMP w/8 CPU cores) Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages llvm-dev depends on: ii libc6 2.10.2-3 Embedded GNU C Library: Shared lib ii libffi5 3.0.9-1 Foreign Function Interface library ii libgcc1 1:4.4.2-8 GCC support library ii libstdc++6 4.4.2-8 The GNU Standard C++ Library v3 ii llvm 2.6-6 Low-Level Virtual Machine (LLVM) llvm-dev recommends no packages. llvm-dev suggests no packages. -- no debconf information
diff -Nurd llvm-2.6.org/debian/control llvm-2.6/debian/control --- llvm-2.6.org/debian/control 2010-02-27 23:23:25.000000000 +0100 +++ llvm-2.6/debian/control 2010-02-28 23:04:34.000000000 +0100 @@ -6,8 +6,8 @@ Build-Depends: debhelper (>= 6.0.0), flex, bison, dejagnu, tcl8.4, expect, autoconf, automake1.9, perl, libtool, doxygen, chrpath, texinfo, sharutils, autotools-dev (>= 20060702.1), libffi-dev (>= 3.0.9), - lsb-release -Build-Conflicts: ocaml, ocaml-core, ocaml-nox + ocaml-nox (>= 3.11.2), ocaml-best-compilers | ocaml-nox, dh-ocaml (>= 0.9.1), + lsb-release, Standards-Version: 3.8.4 Homepage: http://www.llvm.org/ @@ -114,3 +114,22 @@ . This package contains the llvm source code. +Package: libllvm-ocaml-dev +Section: ocaml +Architecture: any +Suggests: llvm-doc +Depends: ${shlibs:Depends}, ${misc:Depends}, ${ocaml:Depends}, llvm-dev +Provides: ${ocaml:Provides} +Description: Low-Level Virtual Machine (LLVM) bindings for OCaml + The Low-Level Virtual Machine (LLVM) is a collection of libraries and + tools that make it easy to build compilers, optimizers, Just-In-Time + code generators, and many other compiler-related programs. LLVM + uses a single, language-independent virtual instruction set both + as an offline code representation (to communicate code between + compiler phases and to run-time systems) and as the compiler internal + representation (to analyze and transform programs). This persistent + code representation allows a common set of sophisticated compiler + techniques to be applied at compile-time, link-time, install-time, + run-time, or "idle-time" (between program runs). + . + This package provides the OCaml bindings to develop applications using llvm. diff -Nurd llvm-2.6.org/debian/control.in/libllvm-ocaml-dev llvm-2.6/debian/control.in/libllvm-ocaml-dev --- llvm-2.6.org/debian/control.in/libllvm-ocaml-dev 1970-01-01 01:00:00.000000000 +0100 +++ llvm-2.6/debian/control.in/libllvm-ocaml-dev 2010-02-28 19:28:06.000000000 +0100 @@ -0,0 +1,19 @@ +Package: libllvm-ocaml-dev +Section: ocaml +Architecture: any +Suggests: llvm-doc +Depends: ${shlibs:Depends}, ${misc:Depends}, ${ocaml:Depends}, llvm-dev +Provides: ${ocaml:Provides} +Description: Low-Level Virtual Machine (LLVM) bindings for OCaml + The Low-Level Virtual Machine (LLVM) is a collection of libraries and + tools that make it easy to build compilers, optimizers, Just-In-Time + code generators, and many other compiler-related programs. LLVM + uses a single, language-independent virtual instruction set both + as an offline code representation (to communicate code between + compiler phases and to run-time systems) and as the compiler internal + representation (to analyze and transform programs). This persistent + code representation allows a common set of sophisticated compiler + techniques to be applied at compile-time, link-time, install-time, + run-time, or "idle-time" (between program runs). + . + This package provides the OCaml bindings to develop applications using llvm. diff -Nurd llvm-2.6.org/debian/control.in/source llvm-2.6/debian/control.in/source --- llvm-2.6.org/debian/control.in/source 2010-02-27 23:23:25.000000000 +0100 +++ llvm-2.6/debian/control.in/source 2010-02-28 00:10:50.000000000 +0100 @@ -6,8 +6,8 @@ Build-Depends: debhelper (>= 6.0.0), flex, bison, dejagnu, tcl8.4, expect, autoconf, automake1.9, perl, libtool, doxygen, chrpath, texinfo, sharutils, autotools-dev (>= 20060702.1), libffi-dev (>= 3.0.9), - lsb-release @BUILDDEPS@ -Build-Conflicts: ocaml, ocaml-core, ocaml-nox + ocaml-nox (>= 3.11.2), ocaml-best-compilers | ocaml-nox, dh-ocaml (>= 0.9.1), + lsb-release, @BUILDDEPS@ Standards-Version: 3.8.4 Homepage: http://www.llvm.org/ diff -Nurd llvm-2.6.org/debian/debhelper.in/libllvm-ocaml-dev.dirs llvm-2.6/debian/debhelper.in/libllvm-ocaml-dev.dirs --- llvm-2.6.org/debian/debhelper.in/libllvm-ocaml-dev.dirs 1970-01-01 01:00:00.000000000 +0100 +++ llvm-2.6/debian/debhelper.in/libllvm-ocaml-dev.dirs 2010-02-28 03:07:49.000000000 +0100 @@ -0,0 +1 @@ +...@ocaml_stdlib_dir@/METAS diff -Nurd llvm-2.6.org/debian/debhelper.in/libllvm-ocaml-dev.doc-base llvm-2.6/debian/debhelper.in/libllvm-ocaml-dev.doc-base --- llvm-2.6.org/debian/debhelper.in/libllvm-ocaml-dev.doc-base 1970-01-01 01:00:00.000000000 +0100 +++ llvm-2.6/debian/debhelper.in/libllvm-ocaml-dev.doc-base 2010-02-28 01:00:50.000000000 +0100 @@ -0,0 +1,8 @@ +Document: libllvm-ocaml-dev-ocamldoc-api-reference +Title: Llvm OCamldoc API Reference +Abstract: API reference manual for libllvm-ocaml-dev (generated via OCamldoc) +Section: Programming/OCaml + +Format: HTML +Index: /usr/share/doc/libllvm-ocaml-dev/html/index.html +Files: /usr/share/doc/libllvm-ocaml-dev/html/* diff -Nurd llvm-2.6.org/debian/debhelper.in/libllvm-ocaml-dev.install llvm-2.6/debian/debhelper.in/libllvm-ocaml-dev.install --- llvm-2.6.org/debian/debhelper.in/libllvm-ocaml-dev.install 1970-01-01 01:00:00.000000000 +0100 +++ llvm-2.6/debian/debhelper.in/libllvm-ocaml-dev.install 2010-02-28 03:09:17.000000000 +0100 @@ -0,0 +1,2 @@ +debian/tmp/@OCAML_STDLIB_DIR@/llvm @OCAML_STDLIB_DIR@/ +debian/tmp/@PF@/docs/llvm/ocamldoc/html /usr/share/doc/libllvm-ocaml-dev/ diff -Nurd llvm-2.6.org/debian/debhelper.in/libllvm-ocaml-dev.META llvm-2.6/debian/debhelper.in/libllvm-ocaml-dev.META --- llvm-2.6.org/debian/debhelper.in/libllvm-ocaml-dev.META 1970-01-01 01:00:00.000000000 +0100 +++ llvm-2.6/debian/debhelper.in/libllvm-ocaml-dev.META 2010-02-28 02:17:28.000000000 +0100 @@ -0,0 +1,62 @@ +description = "Low Level Virtual Machine bindings" +version = "@UVERSION@" + +directory = "+llvm" + +archive(byte) = "llvm.cma" +archive(native) = "llvm.cmxa" +linkopts = "-cclib -lstdc++ -cclib -lllvm" + +package "executionengine" +( + requires = "llvm" + version = "@UVERSION@" + archive(native) = "llvm_executionengine.cmxa" + archive(byte) = "llvm_executionengine.cma" + linkopts = "-cclib -lllvm_executionengine" +) + +package "target" +( + requires = "llvm" + version = "@UVERSION@" + archive(native) = "llvm_target.cmxa" + archive(byte) = "llvm_target.cma" + linkopts = "-cclib -lllvm_target" +) + +package "scalar_opts" +( + requires = "llvm llvm.target" + version = "@UVERSION@" + archive(native) = "llvm_scalar_opts.cmxa" + archive(byte) = "llvm_scalar_opts.cma" + linkopts = "-cclib -lllvm_scalar_opts" +) + +package "analysis" +( + requires = "llvm" + version = "@UVERSION@" + archive(native) = "llvm_analysis.cmxa" + archive(byte) = "llvm_analysis.cma" + linkopts = "-cclib -lllvm_analysis" +) + +package "bitwriter" +( + requires = "llvm" + version = "@UVERSION@" + archive(native) = "llvm_bitwriter.cmxa" + archive(byte) = "llvm_bitwriter.cma" + linkopts = "-cclib -lllvm_bitwriter" +) + +package "bitreader" +( + requires = "llvm llvm.bitwriter" + version = "@UVERSION@" + archive(native) = "llvm_bitreader.cmxa" + archive(byte) = "llvm_bitreader.cma" + linkopts = "-cclib -lllvm_bitreader" +) diff -Nurd llvm-2.6.org/debian/packages.d/llvm.mk llvm-2.6/debian/packages.d/llvm.mk --- llvm-2.6.org/debian/packages.d/llvm.mk 2010-02-27 23:23:25.000000000 +0100 +++ llvm-2.6/debian/packages.d/llvm.mk 2010-02-28 03:08:32.000000000 +0100 @@ -1,5 +1,5 @@ builds := llvm-core llvm-tools -packages := llvm llvm-dev llvm-doc llvm-examples llvm-source +packages := llvm llvm-dev llvm-doc llvm-examples llvm-source libllvm-ocaml-dev ifneq (,$(findstring $(DEB_HOST_GNU_CPU),ia64 mips mipsel)) $(error unsupported processor) @@ -59,3 +59,8 @@ fi endef +define libllvm-ocaml-dev_extra_binary + if test "x$*" = "xlibllvm-ocaml-dev" ; then \ + cp $(D)/debian/$*.META $(D)/debian/$*/$(OCAML_STDLIB_DIR)/METAS/; \ + fi +endef diff -Nurd llvm-2.6.org/debian/rules.d/binary.mk llvm-2.6/debian/rules.d/binary.mk --- llvm-2.6.org/debian/rules.d/binary.mk 2010-02-27 23:23:25.000000000 +0100 +++ llvm-2.6/debian/rules.d/binary.mk 2010-02-28 20:03:38.000000000 +0100 @@ -2,13 +2,17 @@ binary-arch: $(addprefix $(binary-stamp)-,$(packages_arch)) binary-indep: $(addprefix $(binary-stamp)-,$(packages_indep)) binary: binary-arch binary-indep - dh_install --list-missing 2>&1 + dh_install --list-missing \ + -Xusr/lib/llvm/docs/llvm/html.tar.gz \ + -Xusr/lib/llvm/docs/llvm/ocamldoc.tar.gz 2>&1 debhelper-%: $(foreach f,$(notdir $(wildcard $(D)/debian/debhelper.in/$*.*)),\ sed -e "s;@PF@;$(PF);g" \ -e "s;@GCC_VERSION@;$(GCC_VERSION);g" \ -e "s;@LLVM_VERSION@;$(LLVM_VERSION);g" \ + -e "s;@OCAML_STDLIB_DIR@;$(OCAML_STDLIB_DIR);g" \ + -e "s;@UVERSION@;$(UVERSION);g" \ $(D)/debian/debhelper.in/$f > $(D)/debian/$f &&) : clean: clean-debhelper @@ -26,6 +30,7 @@ dh_installexamples -p$* dh_installman -p$* dh_installmime -p$* + dh_installdirs -p$* dh_install -p$* for dir in lib libexec bin ; \ do for i in $$(find $(D)/debian/$*/$(PF)/$$dir 2>/dev/null || echo -n) ; \ @@ -42,6 +47,7 @@ dh_fixperms -p$* dh_installdeb -p$* dh_shlibdeps -p$* + dh_ocaml -p$* dh_gencontrol -p$* dh_md5sums -p$* dh_builddeb -p$* diff -Nurd llvm-2.6.org/debian/rules.d/build.mk llvm-2.6/debian/rules.d/build.mk --- llvm-2.6.org/debian/rules.d/build.mk 2010-02-27 23:23:25.000000000 +0100 +++ llvm-2.6/debian/rules.d/build.mk 2010-02-28 02:57:52.000000000 +0100 @@ -32,6 +32,7 @@ dh_clean $(RM) $(D)/debian/log-check $(D)/debian/logwatch.pid $(RM) log-* missing + -$(RM) test/Bindings/Ocaml/*.cm[io] .PHONY: configure build install check clean clean-common @@ -49,6 +50,13 @@ $(install-stamp)-%: $(build-stamp)-% $(MAKE) -C $(builddir) $(MAKEOPTS) install DESTDIR=$(D)/debian/tmp $(call $*_extra_install) + # Fix links that point to install directory + find $(D)/debian/tmp -type l | \ + while read i; do \ + L=$$(readlink $$i); \ + L=$${L##$(D)/debian/tmp}; \ + ln -sf $$L $$i; \ + done touch $@ # llvm ---------------------- diff -Nurd llvm-2.6.org/debian/rules.d/vars.mk llvm-2.6/debian/rules.d/vars.mk --- llvm-2.6.org/debian/rules.d/vars.mk 2010-02-27 23:23:25.000000000 +0100 +++ llvm-2.6/debian/rules.d/vars.mk 2010-02-28 00:25:20.000000000 +0100 @@ -31,9 +31,12 @@ endif endif +include /usr/share/ocaml/ocamlvars.mk + confargs := \ --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \ - --with-pic --enable-pic --enable-optimized --enable-libffi + --with-pic --enable-pic --enable-optimized --enable-libffi \ + --with-ocaml-libdir=$(OCAML_STDLIB_DIR)/llvm with_check := no