mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
smtk2ssrf-mxe-build.sh: add a flag for git repo
Previous script would fail on git folders that pull from more than one repo. That's not a general case, but pretty usual for developers pulling/pushing to github. BTW in this cases, a lind git pull doesn't ensure we are pulling from the right repo. When run without flag, default to pull --rebase. At the same time introduce a tiny func to return a message and bail out after some command failures.
This commit is contained in:
parent
b14a522f4f
commit
49cbfdd72d
1 changed files with 17 additions and 14 deletions
|
@ -62,6 +62,15 @@ EXECDIR=$(pwd)
|
||||||
BASEDIR=$(cd "$EXECDIR/.."; pwd)
|
BASEDIR=$(cd "$EXECDIR/.."; pwd)
|
||||||
BUILDDIR=$(cd "$EXECDIR"; pwd)
|
BUILDDIR=$(cd "$EXECDIR"; pwd)
|
||||||
|
|
||||||
|
GITREPO=""
|
||||||
|
|
||||||
|
# Display an error message if we need to bail out
|
||||||
|
#
|
||||||
|
function aborting() {
|
||||||
|
echo -e "$RED----> $1. Aborting.$DEFAULT"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
echo -e "$BLUE-> $BUILDDIR$DEFAULT"
|
echo -e "$BLUE-> $BUILDDIR$DEFAULT"
|
||||||
|
|
||||||
if [[ ! -d "$BASEDIR"/mxe ]] ; then
|
if [[ ! -d "$BASEDIR"/mxe ]] ; then
|
||||||
|
@ -87,6 +96,8 @@ else
|
||||||
shift;;
|
shift;;
|
||||||
-d|--dir) DATADIR="$2"
|
-d|--dir) DATADIR="$2"
|
||||||
shift;;
|
shift;;
|
||||||
|
-r|--repo) GITREPO="$2"
|
||||||
|
shift;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
@ -134,11 +145,7 @@ if [ ! -f "$BASEDIR"/mxe/usr/i686-w64-mingw32.static/lib/libmdb.a ]; then
|
||||||
--enable-shared \
|
--enable-shared \
|
||||||
--disable-man \
|
--disable-man \
|
||||||
--disable-gmdb2
|
--disable-gmdb2
|
||||||
make $JOBS >/dev/null
|
make $JOBS >/dev/null || aborting "Building mdbtools failed."
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo -e "$RED---> Building mdbtools failed. Aborting ...$DEFAULT "
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
make install
|
make install
|
||||||
else
|
else
|
||||||
echo -e "$BLUE---> Prebuilt mxe mdbtools ... $DEFAULT"
|
echo -e "$BLUE---> Prebuilt mxe mdbtools ... $DEFAULT"
|
||||||
|
@ -148,19 +155,15 @@ fi
|
||||||
#
|
#
|
||||||
cd "$BASEDIR/subsurface"
|
cd "$BASEDIR/subsurface"
|
||||||
git reset --hard master && echo -e "$BLUE---> Uncommited changes to Subsurface (if any) dropped$DEFAULT"
|
git reset --hard master && echo -e "$BLUE---> Uncommited changes to Subsurface (if any) dropped$DEFAULT"
|
||||||
git pull "$(git remote -v |grep fetch |awk '{print $1}')" master
|
if [ ! -z "$GITREPO" ]; then
|
||||||
if [ $? -ne 0 ]; then
|
git pull --rebase "$GITREPO" master || aborting "git pull failed, Subsurface not updated"
|
||||||
echo -e "$RED---> git pull failed, Subsurface not updated$DEFAULT"
|
|
||||||
else
|
else
|
||||||
echo -e "$BLUE---> Subsurface updated$DEFAULT"
|
git pull --rebase || aborting "git pull failed, Subsurface not updated"
|
||||||
fi
|
fi
|
||||||
|
echo -e "$BLUE---> Subsurface updated$DEFAULT"
|
||||||
|
|
||||||
if [ "$SSRF_TAG" != "" ]; then
|
if [ "$SSRF_TAG" != "" ]; then
|
||||||
git checkout "$SSRF_TAG"
|
git checkout "$SSRF_TAG" || aborting "Failed to checkout Subsurface's $SSRF_TAG."
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo -e "$RED---> Failed to checkout Subsurface's $SSRF_TAG. Abort building. $DEFAULT"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Every thing is ok. Go on.
|
# Every thing is ok. Go on.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue