]> git.puffer.fish Git - mirror/frr.git/commitdiff
build: make `sed` calls portable 9563/head
authorDavid Lamparter <equinox@opensourcerouting.org>
Thu, 2 Sep 2021 10:19:59 +0000 (12:19 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Thu, 2 Sep 2021 11:00:35 +0000 (13:00 +0200)
The `-i` option on sed isn't standard, and e.g. FreeBSD sed behaves
different regarding the parameter.  Avoid it.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
configure.ac

index cf1c1e499c6379e1bb382f3db33796e0fccd762d..917e791182adcb20ec44db91bdb7ce2e817b4094 100644 (file)
@@ -487,9 +487,12 @@ LT_INIT
 _LT_CONFIG_LIBTOOL([
   patch -N -i "${srcdir}/m4/libtool-whole-archive.patch" libtool >&AS_MESSAGE_LOG_FD || \
     AC_MSG_WARN([Could not patch libtool for static linking support.  Loading modules into a statically linked daemon will fail.])
-  sed -e 's%func_warning "relinking%true #\0%' -i libtool || true
-  sed -e 's%func_warning "remember to run%true #\0%' -i libtool || true
-  sed -e 's%func_warning ".*has not been installed in%true #\0%' -i libtool || true
+dnl the -i option is not POSIX sed and the BSDs implement it differently
+dnl cat'ing the output back instead of mv/cp keeps permissions on libtool intact
+  sed -e 's%func_warning "relinking%true #\0%'                   libtool > libtool.sed && cat libtool.sed > libtool
+  sed -e 's%func_warning "remember to run%true #\0%'             libtool > libtool.sed && cat libtool.sed > libtool
+  sed -e 's%func_warning ".*has not been installed in%true #\0%' libtool > libtool.sed && cat libtool.sed > libtool
+  test -f libtool.sed && rm libtool.sed
 ])
 if test "$enable_static_bin" = "yes"; then
   AC_LDFLAGS_EXEC="-static"
@@ -2659,8 +2662,9 @@ if test "$enable_rpath" = "yes" ; then
        true
 else
        # See https://old-en.opensuse.org/openSUSE:Packaging_Guidelines#Removing_Rpath
-       sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
-       sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
+       sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool > libtool.sed && cat libtool.sed > libtool
+       sed -e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g'         libtool > libtool.sed && cat libtool.sed > libtool
+       test -f libtool.sed && rm libtool.sed
 fi
 
 echo "