Hello,

Following the introduction of header wrapping in autotools-multilib,
I'm submitting two patches: one providing a public API for it
in multilib-build, and the other one using it in multilib-minimal. Both
patches will be sent in reply to this mail.

The API consists of two functions: multilib_prepare_wrappers
and multilib_install_wrappers. Although currently they handle header
wrapping only, they could be theoretically extended to support more
kinds of wrappers.

Both functions take an optional <install-root> argument which defaults
to ${ED}. That argument is used for obtaining wrapped files and storing
the wrappers. However, it does not affect the temporary storage
location which is '${ED}/tmp' unconditionally.

Both functions use environment variables to obtain the list of files
to be wrapped. The MULTILIB_WRAPPED_HEADERS variable is used, the same
as in the initial approach. In future, more variables can be used to
support more kinds of wrappers.

The multilib_prepare_wrappers function needs to be called for each ABI
after the files for that ABI were installed, with the root to which
they were installed. It moves the necessary out of the root,
and prepares the wrapper in the temporary area.

The multilib_install_wrappers functions needs to be called once
after all the wrappers were prepared and they can be installed.
The wrappers are installed in the root passed to it, and temporary area
is cleaned.

That said, there are two generic approaches to wrapping:

a) install-and-wrap approach as used by the current eclasses:

  foo_install() {
    some_foo_install # installs to ${D}
    multilib_prepare_wrappers
  }
  multilib_foreach_abi foo_install
  multilib_install_wrappers

In this approach, each successive ABI potentially overwrites files
installed by the previous one. The wrapper preparation needs to follow
the install phase so that wrapped files are preserved in their original
form. Afterwards, wrappers are installed on top of the install.

b) install-then-merge approach:

  bar_install() {
    local myfakeroot=${ED}/_${ABI}
    some_bar_install "${myfakeroot}" # installs to the fake root
    multilib_prepare_wrappers "${myfakeroot}"
    multibuild_merge_root "${myfakeroot}" "${ED}"
  }
  multilib_parallel_foreach_abi bar_install
  multilib_install_wrappers

This time, all per-ABI installs are done in separate directories. This
allows them to be done in parallel. The wrapper preparation needs to be
done on the separate copies, then those can be merged onto the real
root.

-- 
Best regards,
Michał Górny

Attachment: signature.asc
Description: PGP signature

Reply via email to