[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: oasis patch that adds an .nobj.o target



Hi,

Thanks for that -- "ocamlbuild xen/sleep.xen" is working for me now
(modulo bugs which are obviously mine in origin)

I also think I'm beginning to get the hang of opam; 'switching' to
'system' to install stuff needed by oasis and then 'switching' back to
the xen toolchain for actual builds.

Cheers,
Dave

On Tue, Aug 28, 2012 at 11:37 PM, Anil Madhavapeddy <anil@xxxxxxxxxx> wrote:
> I've added in the Xen rules to OASIS now too, so that you can do 'ocamlbuild 
> sleep.xen' in ocaml-xenstore successfully.  My forked repository is at:
>
> https://github.com/avsm/oasis/tree/add-xen
>
> Dave, this works on ocaml-xenstore now if you regenerate myocamlbuild.ml with 
> this OASIS (but dont forget to move the existing myocamlbuild.ml out of the 
> way first).
>
> I'm figuring out how to add this as a plugin, so it'll only get added when 
> specified as 'Plugin: xen' in OASIS.   Also, we need the Executable field in 
> _oasis to build stuff with a .xen suffix.
>
> -anil
>
> On 27 Aug 2012, at 15:50, Anil Madhavapeddy <anil@xxxxxxxxxx> wrote:
>
>> This patch against darcs-oasis is sufficient to add a "native output obj" 
>> target that outputs a standalone object file.  Just one more little rule 
>> required to do the Xen objcopy/link, but this will also be useful for 
>> kFreeBSD too.  This one is mainly for Dave as he's working on ocaml-xenstore 
>> atm.
>>
>> I'll submit an upstreamable patch shortly and have a Xen plugin to OASIS 
>> that will make all our build pains waft away into a gentle summer breeze.
>>
>> -anil
>>
>> avsm@debian:~/src/darcs/oasis$ darcs diff
>> diff -rN -u old-oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml 
>> new-oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml
>> --- old-oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml        2012-08-24 
>> 18:45:09.249486856 +0100
>> +++ new-oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml        2012-08-24 
>> 18:45:09.301486856 +0100
>> @@ -165,6 +165,15 @@
>>             )
>>             t.lib_c;
>>
>> +          (* Add output_obj rules mapped to .nobj.o *)
>> +          let native_output_obj x =
>> +            OC.link_gen "cmx" "cmxa" !Options.ext_lib [!Options.ext_obj; 
>> "cmi"]
>> +              OC.ocamlopt_link_prog
>> +              (fun tags -> tags++"ocaml"++"link"++"byte"++"output_obj") x
>> +          in
>> +          rule "ocaml: cmx* and o* -> .nobj.o" ~prod:"%.nobj.o" 
>> ~deps:["%.cmx"; "%.o"]
>> +            (native_output_obj "%.cmx" "%.nobj.o");
>> +
>>             (* Add flags *)
>>             List.iter
>>             (fun (tags, cond_specs) ->
>> diff -rN -u old-oasis/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml 
>> new-oasis/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml
>> --- old-oasis/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml     2012-08-24 
>> 18:45:09.249486856 +0100
>> +++ new-oasis/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml     2012-08-24 
>> 18:45:09.301486856 +0100
>> @@ -86,6 +86,7 @@
>>
>>         (* When one link an OCaml library/binary/package, one should use 
>> -linkpkg *)
>>         flag ["ocaml"; "link"; "program"] & A"-linkpkg";
>> +        flag ["ocaml"; "link"; "output_obj"] & A"-linkpkg";
>>
>>         (* For each ocamlfind package one inject the -package option when
>>          * compiling, computing dependencies, generating documentation and
>> diff -rN -u old-oasis/src/plugins/ocamlbuild/OCamlbuildPlugin.ml 
>> new-oasis/src/plugins/ocamlbuild/OCamlbuildPlugin.ml
>> --- old-oasis/src/plugins/ocamlbuild/OCamlbuildPlugin.ml        2012-08-24 
>> 18:45:09.249486856 +0100
>> +++ new-oasis/src/plugins/ocamlbuild/OCamlbuildPlugin.ml        2012-08-24 
>> 18:45:09.301486856 +0100
>> @@ -158,9 +158,9 @@
>>                  let acc =
>>                    match bs.bs_compiled_object with
>>                      | Native ->
>> -                         (target ".native") :: acc
>> +                         (target ".native") :: (target ".nobj.o") ::  acc
>>                      | Best when bool_of_string (is_native ()) ->
>> -                         (target ".native") :: acc
>> +                         (target ".native") :: (target ".nobj.o") :: acc
>>                      | Byte
>>                      | Best ->
>>                          (target ".byte") :: acc
>> @@ -928,11 +928,11 @@
>>                    let ext =
>>                      match bs.bs_compiled_object with
>>                        | Best ->
>> -                           "{native,byte}"
>> +                           "{native,byte,nobj.o}"
>>                        | Byte ->
>>                            "byte"
>>                        | Native ->
>> -                           "native"
>> +                           "native,nobj.o"
>>                    in
>>                      prepend_bs_path bs
>>                        (OASISUnixPath.replace_extension
>



-- 
Dave Scott



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.