From 1ac90199e52c0db2a6a49790c68c3aeb319b1b2b Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 3 Oct 2018 15:56:27 +0200 Subject: [PATCH] build-system: fix libdivecomputer build on macOS In some Mac environments autotools somehow think that we have clock_gettime(), even though it isn't supported. Somehow the previous workaround stopped working as make ended up re-running ../configure and overwriting our change. This tries to work around that problem. Signed-off-by: Dirk Hohndel --- scripts/build.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index 21d1b2472..54c194b10 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -346,14 +346,22 @@ if [ ! -f ../configure ] ; then fi CFLAGS="$OLDER_MAC -I$INSTALL_ROOT/include $LIBDC_CFLAGS" ../configure --prefix=$INSTALL_ROOT --disable-examples if [ $PLATFORM = Darwin ] ; then - # it seems that on my Mac some of the configure tests for libdivecomputer - # pass even though the feature tested for is actually missing - # let's hack around that - sed -i .bak 's/^#define HAVE_CLOCK_GETTIME 1/\/* #undef HAVE_CLOCK_GETTIME *\//' config.h + # remove some copmpiler options that aren't supported on Mac + # otherwise the log gets very noisy for i in $(find . -name Makefile) do sed -i .bak 's/-Wrestrict//;s/-Wno-unused-but-set-variable//' $i done + # it seems that on my Mac some of the configure tests for libdivecomputer + # pass even though the feature tested for is actually missing + # let's hack around that + # touch config.status, recreate config.h and then disable HAVE_CLOCK_GETTIME + # this seems to work so that the Makefile doesn't re-run the + # configure process and overwrite all the changes we just made + touch config.status + make config.h + grep CLOCK_GETTIME config.h + sed -i .bak 's/^#define HAVE_CLOCK_GETTIME 1/#undef HAVE_CLOCK_GETTIME /' config.h fi make -j4 make install