commit:     9f670e5d23d09556e3b52916c896e2ea32508981
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 21 15:17:14 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Sep  3 11:05:53 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9f670e5d

multilib.eclass: get_exeext for mingw/cygwin exe suffix, #588330

Add a get_exeext function that can be used to obtain executable program
suffix specific to the platform, in line with get_libname and
get_modname. It is necessary to correctly reference built programs on
non-standard platforms where executables use some suffix (like .exe).

Original author: Gerhard Bräunlich

 eclass/multilib.eclass | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/eclass/multilib.eclass b/eclass/multilib.eclass
index 8c95387..a80511c 100644
--- a/eclass/multilib.eclass
+++ b/eclass/multilib.eclass
@@ -225,6 +225,20 @@ number_abis() {
        echo $#
 }
 
+# @FUNCTION: get_exeext
+# @DESCRIPTION:
+# Returns standard executable program suffix (null, .exe, etc.)
+# for the current platform identified by CHOST.
+#
+# Example:
+#     get_exeext
+#     Returns: null string (almost everywhere) || .exe (mingw*) || ...
+get_exeext() {
+       case ${CHOST} in
+               *-cygwin*|mingw*|*-mingw*)  echo ".exe";;
+       esac
+}
+
 # @FUNCTION: get_libname
 # @USAGE: [version]
 # @DESCRIPTION:

Reply via email to