From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 687EF158090 for ; Mon, 16 May 2022 05:34:22 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 93FC6E08FE; Mon, 16 May 2022 05:34:21 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 80019E08FE for ; Mon, 16 May 2022 05:34:21 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id ABB38341B4D for ; Mon, 16 May 2022 05:34:20 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id C7EC8471 for ; Mon, 16 May 2022 05:34:18 +0000 (UTC) From: "Robin H. Johnson" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" Message-ID: <1652656435.1bb3cc10d51026ad500bc9cec883f1f2f0c445ec.robbat2@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: / X-VCS-Repository: proj/genkernel X-VCS-Files: gen_funcs.sh X-VCS-Directories: / X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: 1bb3cc10d51026ad500bc9cec883f1f2f0c445ec X-VCS-Branch: master Date: Mon, 16 May 2022 05:34:18 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: a7c23217-eb2c-420f-a315-8acad19d33ed X-Archives-Hash: df40336301b167334f092170e3b9dc49 commit: 1bb3cc10d51026ad500bc9cec883f1f2f0c445ec Author: orbea riseup net> AuthorDate: Sun May 15 22:49:21 2022 +0000 Commit: Robin H. Johnson gentoo org> CommitDate: Sun May 15 23:13:55 2022 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=1bb3cc10 gen_funcs: Add an install_exe function This helps when the build uses slibtool where the compiled binary output path differs from GNU libtool. Signed-off-by: orbea riseup.net> gen_funcs.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/gen_funcs.sh b/gen_funcs.sh index 500caf2..a4dc0e4 100755 --- a/gen_funcs.sh +++ b/gen_funcs.sh @@ -1974,6 +1974,29 @@ check_distfiles() { fi } +# @FUNCTION: install_exe +# @USAGE: +# @DESCRIPTION: +# Finds an executable binary file and installs it in cases where there may be +# similarly named shell wrapper scripts. This happens when GNU libtool creates +# an executable named 'foo' while slibtool creates '.libs/foo' and 'foo' is a +# shell script that should not be installed. +install_exe() { + local file="${1##*/}" + local dest="${2}" + + local dir + [[ "${1%/*}" == "${file}" ]] || dir="${1%/*}/" + + [[ -f "${dir}${file}" ]] || gen_die "File '${dir}${file}' does not exist!" + + # Ensure only the binaries are installed and not a similarly named wrapper script + find "${S}/${dir}" -type f -name "${file}" -print0 | + xargs -0 file | grep executable | grep ELF | cut -f 1 -d : | + xargs -I '{}' cp -a '{}' "${dest}" || + gen_die "Failed to copy '${S}/${dir}${file}' to '${dest}'!" +} + # @FUNCTION: expand_file # @USAGE: # @DESCRIPTION: