On macOS Big Sur with Homebrew, I update swipl-devel from git source usually with a shell script (1), which works without problem except when CMAKE via the homebrew is updated, and (1) fails to update. In such case, I need (2) instead of (1). Although it is a small problem, but I would like to know a way to unify (1) and (2) so that it works no matter whether CMAKE via homebrew is updated or not.
Thanks.
(1)
% more ~/bin/update-swipl
#! /bin/sh
echo " updating swipl ..."
pushd ~/src/swipl-devel/build
git pull
echo "Continue ? (Y/n)"
stty raw -echo
char=`dd bs=1 count=1 2>/dev/null`
stty -raw echo
if [ $char == y ]
then
echo "Compiling SWI-Prolog."
continue
else
echo "No updates."
exit 0
fi
# only once
# cmake -DCMAKE_INSTALL_PREFIX=$HOME -G Ninja ..
ninja
ninja install
echo "\nDone: swipl built.\n"
popd;
exit 0
(2)
% more ~/bin/ninja-for-updated-cmake
#! /bin/sh
SWIBUILD=$HOME/src/swipl-devel/build
pushd $SWIBUILD
echo "git -C .. submodule update --init"
git -C .. submodule update --init
cmake -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -DCMAKE_INSTALL_PREFIX=$HOME -G Ninja .. && ninja && ninja install
popd
echo "Done: Ninja for updated Cmake.\n"