[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 2d81c4f7 5/8: Simplify
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 2d81c4f7 5/8: Simplify |
Date: |
Fri, 24 Jun 2022 19:56:24 -0400 (EDT) |
branch: master
commit 2d81c4f7acfc2942fcefefd70f1b56f633576582
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Simplify
The posix ${parameter:[-=?+]...} substitutions are arcane enough to
present a barrier to comprehension, yet not powerful enough to perform
general pattern replacement. The simplest tool that works here is 'sed'.
---
set_toolchain.sh | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/set_toolchain.sh b/set_toolchain.sh
index 151cc0e3..5ed58ce2 100755
--- a/set_toolchain.sh
+++ b/set_toolchain.sh
@@ -86,6 +86,11 @@
# That remains the motivation for this design even though i686 builds
# are no longer supported.
+strip_colons()
+{
+ printf '%s' "$1" | sed -e 's/::*/:/g' -e's/::*$//'
+}
+
foo()
{
local lmi_build_type
@@ -118,8 +123,8 @@ esac
local minimal_path
minimal_path=${MINIMAL_PATH:-"/usr/bin:/bin:/usr/sbin:/sbin"}
- minimal_path="${clanggccbindir:+${clanggccbindir}:}""$minimal_path"
-export PATH="$localbindir":"$locallibdir":"$minimal_path"
+export PATH="$localbindir":"$locallibdir":"$clanggccbindir":"$minimal_path"
+PATH=$( strip_colons "$PATH" )
# It is okay to export these variables unconditionally.
@@ -151,7 +156,8 @@ case "$lmi_build_type" in
LD_LIBRARY_PATH=.
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$locallibdir"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$bindir"
-
LD_LIBRARY_PATH="$LD_LIBRARY_PATH${clanggcclibdir:+:${clanggcclibdir}}"
+ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$clanggcclibdir"
+ LD_LIBRARY_PATH=$( strip_colons "$LD_LIBRARY_PATH" )
# Nullify any leftover "wine" values: obligatorily for
# $EXEEXT and $PERFORM, and for $WINEPATH to ensure
# that native builds never depend upon it.
@@ -204,4 +210,5 @@ esac
foo
+unset -f strip_colons
unset -f foo
- [lmi-commits] [lmi] master updated (6030d119 -> ee23febb), Greg Chicares, 2022/06/24
- [lmi-commits] [lmi] master 2d81c4f7 5/8: Simplify,
Greg Chicares <=
- [lmi-commits] [lmi] master ee23febb 8/8: Raze clang as gcc is razed, Greg Chicares, 2022/06/24
- [lmi-commits] [lmi] master c850f2bc 4/8: Augment $LD_LIBRARY_PATH for clang, Greg Chicares, 2022/06/24
- [lmi-commits] [lmi] master e35ff020 7/8: Suggest a workaround for a potential problem, Greg Chicares, 2022/06/24
- [lmi-commits] [lmi] master fb4d6416 3/8: Rename a local variable, Greg Chicares, 2022/06/24
- [lmi-commits] [lmi] master 346f3037 6/8: Don't show a flag that's used only elsewhere, internally, Greg Chicares, 2022/06/24
- [lmi-commits] [lmi] master 601f829a 2/8: Find '*-config' scripts in gcc directories for clang, Greg Chicares, 2022/06/24
- [lmi-commits] [lmi] master d0c1f2c8 1/8: Localize a script variable, Greg Chicares, 2022/06/24