123456789101112131415161718192021222324252627282930313233(* Copyright (c) 2016 David Kaloper Meršinjak. All rights reserved.
See LICENSE.md. *)openTopkgletbuild_arg=Cmd.(v"-plugin-tag"%"package(ocb-stubblr)")letbuild_cmdcos=Cmd.(Pkg.build_cmdcos%%build_arg)letcmdcosfiles=OS.Cmd.run@@Cmd.(%%)(build_cmdcos)(Cmd.of_listfiles)(* Vs Pkg.clib:
- .clib file can be generated;
- installs only the static part (libFOO.a);
- no ~lib_dst_dir;
- no source debugging support. *)letclib_static?(cond=false)clib=ifnotcondthenPkg.nothingelseletname=Fpath.(rem_extclib|>basename)inLog.on_error_msg~use:(fun()->Pkg.nothing)@@ifFpath.get_extclib=".clib"&&String.is_prefix~affix:"lib"namethenletbase=String.with_index_range~first:3nameanddir=Fpath.dirnameclibinOk(Pkg.lib~exts:Exts.c_libraryFpath.(dir//"lib"^base))elseR.error_msgf"%s: OCamlbuild .clib must be lib<base>.clib"clibletmirage?(xen=false)?(fs=false)path=lettpathtarget=let(dir,base)=Fpath.(dirnamepath,basenamepath)inlet(name,ext)=Fpath.(rem_extbase,get_extbase)inFpath.("X"//target//dir//name^"+"^target^ext)inPkg.flatten[clib_static~cond:xen(tpath"mirage-xen");clib_static~cond:fs(tpath"mirage-freestanding");]