[Libguestfs] [libnbd PATCH] build: allow OCaml programs using libnbd to be compiled against build dir

Laszlo Ersek lersek at redhat.com
Wed Sep 29 18:55:11 UTC 2021


On 09/27/21 10:00, Richard W.M. Jones wrote:
> On Mon, Sep 27, 2021 at 08:24:42AM +0200, Laszlo Ersek wrote:
>> Port libguestfs commit bf61bf7355d3 ("build: Allow OCaml programs using
>> libguestfs to be compiled against build dir.", 2020-03-12) to libnbd.
>>
>> This allows C+OCaml programs, such as virt-v2v, to find a just built, but
>> not installed, libnbd tree.
>>
>> Signed-off-by: Laszlo Ersek <lersek at redhat.com>
> 
> ACK

Pushed as commit bc408c8956b4.

Thanks!
Laszlo

> 
> Thanks,
> 
> Rich.
> 
>>  ocaml/Makefile.am | 17 +++++++++++++++++
>>  .gitignore        |  1 +
>>  run.in            |  2 ++
>>  3 files changed, 20 insertions(+)
>>
>> diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
>> index 1c7397a9da7a..b1ab80dd5fa5 100644
>> --- a/ocaml/Makefile.am
>> +++ b/ocaml/Makefile.am
>> @@ -161,4 +161,21 @@ install-data-hook:
>>  	  $(data_hook_files)
>>  	rm $(DESTDIR)$(OCAMLLIB)/nbd/libnbdocaml.a
>>  
>> +# This "tricks" ocamlfind into allowing us to compile other OCaml
>> +# programs against a locally compiled copy of the libnbd sources.
>> +# ocamlfind needs to see a directory called ‘nbd’ which contains
>> +# ‘META’.  The current directory is called ‘ocaml’, but if we make
>> +# this symlink then we can create the required directory structure.
>> +#
>> +# Note if you just want to use this, make sure you use
>> +# ‘../libnbd/run make’ in your other program and everything should
>> +# just work.
>> +CLEANFILES += nbd
>> +
>> +all-local: nbd
>> +
>> +nbd:
>> +	rm -f $@
>> +	$(LN_S) . $@
>> +
>>  endif HAVE_OCAML
>> diff --git a/.gitignore b/.gitignore
>> index 5fc596773ed4..55a5449a70e2 100644
>> --- a/.gitignore
>> +++ b/.gitignore
>> @@ -141,6 +141,7 @@ Makefile.in
>>  /ocaml/examples/.depend
>>  /ocaml/libnbd-ocaml.3
>>  /ocaml/libnbdocaml.a
>> +/ocaml/nbd
>>  /ocaml/nbd-c.c
>>  /ocaml/stamp-manpages
>>  /ocaml/stamp-mlnbd
>> diff --git a/run.in b/run.in
>> index 99c1f7ff0ff6..dda49228f949 100755
>> --- a/run.in
>> +++ b/run.in
>> @@ -100,6 +100,8 @@ export GODEBUG=cgocheck=2
>>  # Allow dependent packages to be compiled against local libnbd.
>>  prepend PKG_CONFIG_PATH "$b/lib/local"
>>  export PKG_CONFIG_PATH
>> +prepend OCAMLPATH "$b/ocaml"
>> +export OCAMLPATH
>>  
>>  # Do we have libtool?  If we have it then we can use it to make
>>  # running valgrind simpler.  However don't depend on it.
>> -- 
>> 2.19.1.3.g30247aa5d201
>>
>>
>> _______________________________________________
>> Libguestfs mailing list
>> Libguestfs at redhat.com
>> https://listman.redhat.com/mailman/listinfo/libguestfs
> 




More information about the Libguestfs mailing list