]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fixed configure script use of sed on macOS. #427
authorNathan Moinvaziri <nathan@nathanm.com>
Sun, 19 Jan 2020 01:26:04 +0000 (17:26 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Fri, 7 Feb 2020 10:19:55 +0000 (11:19 +0100)
Added macOS configure build.

.github/workflows/configure.yml
configure

index 31f57e40963c0f4b1541e21e6ffb0b6a64c24433..84a45bb662323d63fea650883f8cb4801f76d691 100644 (file)
@@ -25,6 +25,7 @@ jobs:
           Ubuntu 18.04 Clang ARM HF Compat No Neon,
           Ubuntu 18.04 Clang AARCH64 Compat No Opt,
           Ubuntu 18.04 Clang AARCH64 Compat
+          macOS 10.14 GCC,
         ]
         include:
           - name: Ubuntu 18.04 Clang
@@ -127,6 +128,11 @@ jobs:
             asan-options: detect_leaks=0
             packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
 
+          - name: macOS 10.14 GCC
+            os: macOS-10.14
+            compiler: gcc
+            configure-args: --warn
+
     steps:
     - uses: actions/checkout@v1
 
index b0dd408c16cbbbd9045dbbf63a42d7184f3fdbfd..fc37ea7e11aed61abe4b403b17d554a687dfffdd 100755 (executable)
--- a/configure
+++ b/configure
@@ -1319,6 +1319,15 @@ echo ARCHDIR = ${ARCHDIR} >> configure.log
 echo ARCH_STATIC_OBJS = ${ARCH_STATIC_OBJS} >> configure.log
 echo ARCH_SHARED_OBJS = ${ARCH_SHARED_OBJS} >> configure.log
 
+# Handle sed incompatibilities when using -i
+replace_in_file() {
+  if [ "$OS" = 'Darwin' ]; then
+    sed -i '.tmp' -e "$1" "$2"
+  else
+    sed -i'.tmp' -e "$1" "$2"
+  fi
+}
+
 # update Makefile with the configure results
 
 INCLUDES="-I$SRCDIR"
@@ -1393,15 +1402,15 @@ for file in $(ls -1 $SRCDIR/*.c $SRCDIR/test/*.c $SRCDIR/test/fuzz/*.c $SRCDIR/$
 
     if grep -q "^$obj:" Makefile; then
         # Replace the existing line with a line with all dependences.
-        sed -i "s#$obj:.*#$obj: \$(SRCDIR)/$short_name $includes#g" Makefile
+        $(replace_in_file "s#$obj:.*#$obj: \$(SRCDIR)/$short_name $includes#g" Makefile)
 
         # Special case example64 and minigzip64.
         case "$obj" in
             example.o)
-                sed -i "s#example64.o:.*#example64.o: \$(SRCDIR)/$short_name $includes#g" Makefile
+                $(replace_in_file "s#example64.o:.*#example64.o: \$(SRCDIR)/$short_name $includes#g" Makefile)
                 ;;
             minigzip.o)
-                sed -i "s#minigzip64.o:.*#minigzip64.o: \$(SRCDIR)/$short_name $includes#g" Makefile
+                $(replace_in_file "s#minigzip64.o:.*#minigzip64.o: \$(SRCDIR)/$short_name $includes#g" Makefile)
                 ;;
         esac
     else
@@ -1418,7 +1427,7 @@ for file in $(ls -1 $SRCDIR/*.c $SRCDIR/test/*.c $SRCDIR/test/fuzz/*.c $SRCDIR/$
 
     if grep -q "^$lobj:" Makefile; then
         # Replace the existing line with a line with all dependences.
-        sed -i "s#$lobj:.*#$lobj: \$(SRCDIR)/$short_name $includes#g" Makefile
+        $(replace_in_file "s#$lobj:.*#$lobj: \$(SRCDIR)/$short_name $includes#g" Makefile)
     else
         # Append at the end of Makefile a new line with the header dependences.
         echo "$lobj: \$(SRCDIR)/$short_name $includes" >> Makefile
@@ -1465,7 +1474,7 @@ for file in $(ls -1 $SRCDIR/$ARCHDIR/*.c); do
     short_name=$(basename $file)
     if grep -q "^$obj:" $ARCHDIR/Makefile; then
         # Replace the existing line with a line with all dependences.
-        sed -i "s#$obj:.*#$obj: \$(SRCDIR)/$short_name $includes#g" $ARCHDIR/Makefile
+        $(replace_in_file "s#$obj:.*#$obj: \$(SRCDIR)/$short_name $includes#g" $ARCHDIR/Makefile)
     else
         # Append at the end of Makefile a new line with the header dependences.
         echo "$obj: \$(SRCDIR)/$short_name $includes" >> $ARCHDIR/Makefile
@@ -1473,7 +1482,7 @@ for file in $(ls -1 $SRCDIR/$ARCHDIR/*.c); do
 
     if grep -q "^$lobj:" $ARCHDIR/Makefile; then
         # Replace the existing line with a line with all dependences.
-        sed -i "s#$lobj:.*#$lobj: \$(SRCDIR)/$short_name $includes#g" $ARCHDIR/Makefile
+        $(replace_in_file "s#$lobj:.*#$lobj: \$(SRCDIR)/$short_name $includes#g" $ARCHDIR/Makefile)
     else
         # Append at the end of Makefile a new line with the header dependences.
         echo "$lobj: \$(SRCDIR)/$short_name $includes" >> $ARCHDIR/Makefile