From 14015c6c956cc5dd19263af8d060163060d6fa66 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lawrence=20Vel=C3=A1zquez?= <vq@larryv.me>
Date: Thu, 3 Jun 2021 21:03:22 -0400
Subject: [PATCH 1/6] Use strictly compliant POSIX BREs in build

- '\+' is not defined by the POSIX standard for basic regular
  expressions [*] and is matched literally by many grep(1) and sed(1)
  implementations. Replace with the equivalent '\{1,\}'. In sed(1)
  scripts that already use "," as a delimiter, change the delimiter to
  avoid conflicts.
- '\"' is not defined by the POSIX standard. Replace with '"'.

These changes are necessary to build on macOS.

  [*]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03
---
 icmake/scripts/catim       |  2 +-
 icmake/scripts/conversions | 36 ++++++++++++++++++------------------
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/icmake/scripts/catim b/icmake/scripts/catim
index 70670c5..9770695 100755
--- a/icmake/scripts/catim
+++ b/icmake/scripts/catim
@@ -12,7 +12,7 @@ while read line ; do
     if [ $? -ne 0 ] ; then
         echo "$line"
     else
-        line=`echo $line | sed 's|#include "ib/\([a-z]\+\).*|\1|'`
+        line=`echo $line | sed 's|#include "ib/\([a-z]\{1,\}\).*|\1|'`
         cat ib/$line
     fi
 done | sed ' 
diff --git a/icmake/scripts/conversions b/icmake/scripts/conversions
index 37e431d..cd49cdb 100644
--- a/icmake/scripts/conversions
+++ b/icmake/scripts/conversions
@@ -5,32 +5,32 @@ CONFIG=INSTALL.im
 
 ROOT=`echo ${ROOT}/ | sed 's,//,/,g' | sed 's,//,/,g'`
 
-EXTENSION=`grep '^#' $CONFIG | grep "#define[[:space:]]\+EXTENSION" | \
-            sed 's,.*EXTENSION[[:space:]]\+\"\([^"]*\)".*,'${ROOT}'\1,'`
+EXTENSION=`grep '^#' $CONFIG | grep "#define[[:space:]]\{1,\}EXTENSION" | \
+            sed 's|.*EXTENSION[[:space:]]\{1,\}"\([^"]*\)".*|'${ROOT}'\1|'`
 
-BINDIR=`grep "#define[[:space:]]\+BINDIR" $CONFIG | \
-            sed 's,.*BINDIR[[:space:]]\+\"\([^"]\+\)".*,'${ROOT}'\1,'`
+BINDIR=`grep "#define[[:space:]]\{1,\}BINDIR" $CONFIG | \
+            sed 's|.*BINDIR[[:space:]]\{1,\}"\([^"]\{1,\}\)".*|'${ROOT}'\1|'`
 
-SKELDIR=`grep "#define[[:space:]]\+SKELDIR" $CONFIG | \
-            sed 's,.*SKELDIR[[:space:]]\+\"\([^"]\+\)".*,'${ROOT}'\1,'`
+SKELDIR=`grep "#define[[:space:]]\{1,\}SKELDIR" $CONFIG | \
+            sed 's|.*SKELDIR[[:space:]]\{1,\}"\([^"]\{1,\}\)".*|'${ROOT}'\1|'`
 
-MANDIR=`grep "#define[[:space:]]\+MANDIR" $CONFIG | \
-            sed 's,.*MANDIR[[:space:]]\+\"\([^"]\+\)".*,'${ROOT}'\1,'`
+MANDIR=`grep "#define[[:space:]]\{1,\}MANDIR" $CONFIG | \
+            sed 's|.*MANDIR[[:space:]]\{1,\}"\([^"]\{1,\}\)".*|'${ROOT}'\1|'`
 
-LIBDIR=`grep "#define[[:space:]]\+LIBDIR" $CONFIG | \
-            sed 's,.*LIBDIR[[:space:]]\+\"\([^"]\+\)".*,'${ROOT}'\1,'`
+LIBDIR=`grep "#define[[:space:]]\{1,\}LIBDIR" $CONFIG | \
+            sed 's|.*LIBDIR[[:space:]]\{1,\}"\([^"]\{1,\}\)".*|'${ROOT}'\1|'`
 
-CONFDIR=`grep "#define[[:space:]]\+CONFDIR" $CONFIG | \
-            sed 's,.*CONFDIR[[:space:]]\+\"\([^"]\+\)".*,'${ROOT}'\1,'`
+CONFDIR=`grep "#define[[:space:]]\{1,\}CONFDIR" $CONFIG | \
+            sed 's|.*CONFDIR[[:space:]]\{1,\}"\([^"]\{1,\}\)".*|'${ROOT}'\1|'`
 
-DOCDIR=`grep "#define[[:space:]]\+DOCDIR" $CONFIG | \
-            sed 's,.*DOCDIR[[:space:]]\+\"\([^"]\+\)".*,'${ROOT}'\1,'`
+DOCDIR=`grep "#define[[:space:]]\{1,\}DOCDIR" $CONFIG | \
+            sed 's|.*DOCDIR[[:space:]]\{1,\}"\([^"]\{1,\}\)".*|'${ROOT}'\1|'`
 
-DOCDOCDIR=`grep "#define[[:space:]]\+DOCDOCDIR" $CONFIG | \
-            sed 's,.*DOCDOCDIR[[:space:]]\+\"\([^"]\+\)".*,'${ROOT}'\1,'`
+DOCDOCDIR=`grep "#define[[:space:]]\{1,\}DOCDOCDIR" $CONFIG | \
+            sed 's|.*DOCDOCDIR[[:space:]]\{1,\}"\([^"]\{1,\}\)".*|'${ROOT}'\1|'`
 
-# CPPFLAGS=`grep "#define[[:space:]]\+CPPFLAGS" $CONFIG | sed 's,^.[^"]*,,'`
+# CPPFLAGS=`grep "#define[[:space:]]\{1,\}CPPFLAGS" $CONFIG | sed 's,^.[^"]*,,'`
 
-# LDFLAGS=`grep "#define[[:space:]]\+LDFLAGS" $CONFIG | sed 's,^.[^"]*,,'`
+# LDFLAGS=`grep "#define[[:space:]]\{1,\}LDFLAGS" $CONFIG | sed 's,^.[^"]*,,'`
 
 
-- 
2.31.1

