]> Kevux Git Server - fll/commitdiff
Update: Use regular grep rather than POSIX regex grep in package.sh build script.
authorKevin Day <Kevin@kevux.org>
Tue, 16 Dec 2025 00:18:42 +0000 (18:18 -0600)
committerKevin Day <Kevin@kevux.org>
Tue, 16 Dec 2025 00:18:42 +0000 (18:18 -0600)
Not every version of grep supports POSIX regex.
Use the uglier but better supported equivalent match strings to make the package script more portable.

build/scripts/package.sh

index c6ccb33674ff461de6f8231bc881ac7be32f8896..3f042d0ecd4b50396aa30225038b9eb39c32a3b5 100644 (file)
@@ -1503,16 +1503,16 @@ package_operation_create_config_stubs() {
 
   local language=
 
-  if [[ $(grep -shoP '^\s*\bbuild_language\b\s+c\s*$' ${package}data/build/settings) != "" ]] ; then
+  if [[ $(grep -sho '^[[:space:]]*\<build_language\>[[:space:]]\+c[[:space:]]*$' ${package}data/build/settings) != "" ]] ; then
     language="c"
-  elif [[  $(grep -shoP '^\s*\bbuild_language\b\s+c\+\+\s*$' ${package}data/build/settings) != "" ]] ; then
+  elif [[  $(grep -sho '^[[:space:]]*\<build_language\>[[:space:]]\+c++[[:space:]]*$' ${package}data/build/settings) != "" ]] ; then
     language="c++"
   else
     return 0
   fi
 
   if [[ ${language} == "c" && ! -f ${package}sources/c/config.c ]] ; then
-    if [[ $(grep -shoP '^\s*\bbuild_sources_program\b\s+\S' ${package}data/build/settings) != "" || $(grep -shoP '^\s*\bbuild_sources_library\b\s+\S' ${package}data/build/settings) != "" ]] ; then
+    if [[ $(grep -sho '^[[:space:]]*\<build_sources_program\>[[:space:]]\+[^[:space:]]' ${package}data/build/settings) != "" || $(grep -sho '^[[:space:]]*\<build_sources_library\>[[:space:]]\+[^[:space:]]' ${package}data/build/settings) != "" ]] ; then
       echo > ${package}sources/c/config.c &&
       echo "#include \"config.h\"" >> ${package}sources/c/config.c
 
@@ -1527,7 +1527,7 @@ package_operation_create_config_stubs() {
       fi
     fi
   elif [[ ${language} == "c++" && ! -f ${package}sources/c/config.cpp ]] ; then
-    if [[ $(grep -shoP '^\s*\bbuild_sources_program\b\s+\S' ${package}data/build/settings) != "" || $(grep -shoP '^\s*\bbuild_sources_library\b\s+\S' ${package}data/build/settings) != "" ]] ; then
+    if [[ $(grep -sho '^[[:space:]]*\<build_sources_program\>[[:space:]]\+[^[:space:]]' ${package}data/build/settings) != "" || $(grep -sho '^[[:space:]]*\<build_sources_library\>[[:space:]]\+[^[:space:]]' ${package}data/build/settings) != "" ]] ; then
       echo > ${package}sources/c++/config.cpp &&
       echo "#include \"config.h\"" >> ${package}sources/c++/config.cpp
 
@@ -1544,7 +1544,7 @@ package_operation_create_config_stubs() {
   fi
 
   if [[ ( ${language} == "c" && ! -f ${package}sources/c/config.h ) || ( ${language} == "c++" && ! -f ${package}sources/c++/config.h ) ]] ; then
-    if [[ $(grep -shoP '^\s*\bbuild_language\b\s+c\s*$' ${package}data/build/settings) != "" ]] ; then
+    if [[ $(grep -sho '^[[:space:]]*\<build_language\>[[:space:]]\+c[[:space:]]*$' ${package}data/build/settings) != "" ]] ; then
       echo > ${package}sources/c/config.h
 
       if [[ ${?} -ne 0 ]] ; then
@@ -2333,7 +2333,7 @@ package_operation_stand_alone() {
     fi
 
     if [[ -f ${package}data/build/dependencies ]] ; then
-      packages=$(grep -shoP '^\s*[^\s]+' ${package}data/build/dependencies* | sed -e 's|^[[:space:]]*||g')
+      packages=$(grep -sho '^[[:space:]]*[^[:space:]]\+' ${package}data/build/dependencies* | sed -e 's|^[[:space:]]*||g')
 
       if [[ ${packages} != "" ]] ; then
         for package_sub in ${packages} ; do