There it can be reused by eclasses & ebuilds. --- gx86/eclass/autotools-multilib.eclass | 29 +------------------------- gx86/eclass/multilib-build.eclass | 38 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 28 deletions(-)
diff --git a/gx86/eclass/autotools-multilib.eclass b/gx86/eclass/autotools-multilib.eclass index 97abfe6..ff7e8b8 100644 --- a/gx86/eclass/autotools-multilib.eclass +++ b/gx86/eclass/autotools-multilib.eclass @@ -50,34 +50,7 @@ autotools-multilib_src_install() { autotools-utils_src_install # Make sure all headers are the same for each ABI. - autotools-multilib_cksum() { - find "${ED}"usr/include -type f \ - -exec cksum {} + | sort -k2 - } - - local cksum=$(autotools-multilib_cksum) - local cksum_file=${T}/.autotools-multilib_cksum - - if [[ -f ${cksum_file} ]]; then - local cksum_prev=$(< "${cksum_file}") - - if [[ ${cksum} != ${cksum_prev} ]]; then - echo "${cksum}" > "${cksum_file}.new" - - eerror "Header files have changed between ABIs." - - if type -p diff &>/dev/null; then - eerror "$(diff -du "${cksum_file}" "${cksum_file}.new")" - else - eerror "Old checksums in: ${cksum_file}" - eerror "New checksums in: ${cksum_file}.new" - fi - - die "Header checksum mismatch, aborting." - fi - else - echo "${cksum}" > "${cksum_file}" - fi + multilib_check_headers } multilib_foreach_abi autotools-multilib_secure_install diff --git a/gx86/eclass/multilib-build.eclass b/gx86/eclass/multilib-build.eclass index 4298a54..2b6c8b5 100644 --- a/gx86/eclass/multilib-build.eclass +++ b/gx86/eclass/multilib-build.eclass @@ -137,5 +137,43 @@ multilib_parallel_foreach_abi() { multijob_finish } +# @FUNCTION: multilib_check_headers +# @DESCRIPTION: +# Check whether the header files are consistent between ABIs. +# +# This function needs to be called after each ABI's installation phase. +# It obtains the header file checksums and compares them with previous +# runs (if any). Dies if header files differ. +multilib_check_headers() { + _multilib_header_cksum() { + find "${ED}"usr/include -type f \ + -exec cksum {} + | sort -k2 + } + + local cksum=$(_multilib_header_cksum) + local cksum_file=${T}/.multilib_header_cksum + + if [[ -f ${cksum_file} ]]; then + local cksum_prev=$(< "${cksum_file}") + + if [[ ${cksum} != ${cksum_prev} ]]; then + echo "${cksum}" > "${cksum_file}.new" + + eerror "Header files have changed between ABIs." + + if type -p diff &>/dev/null; then + eerror "$(diff -du "${cksum_file}" "${cksum_file}.new")" + else + eerror "Old checksums in: ${cksum_file}" + eerror "New checksums in: ${cksum_file}.new" + fi + + die "Header checksum mismatch, aborting." + fi + else + echo "${cksum}" > "${cksum_file}" + fi +} + _MULTILIB_BUILD=1 fi -- 1.8.1.2