multilib.eclass: get_exeext for mingw/cygwin exe suffix, #588330
authorMichał Górny <mgorny@gentoo.org>
Thu, 21 Jul 2016 15:17:14 +0000 (17:17 +0200)
committerMichał Górny <mgorny@gentoo.org>
Sat, 3 Sep 2016 11:05:53 +0000 (13:05 +0200)
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

index 8c953871a65658d34995a7da94076308773e478a..a80511c2ee52d3b11fe7ef3b1c3b6d271d378188 100644 (file)
@@ -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: