Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit-binary.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUngureanu Marius <marius.ungureanu@xamarin.com>2015-06-29 02:29:42 +0300
committerUngureanu Marius <marius.ungureanu@xamarin.com>2015-06-29 02:37:39 +0300
commitb715aa996d1fc1672dd9c2241cf634b808d0dcdf (patch)
treed3af9a90120970184c3554952a89750581c4e5c3
parent9c926f2032b40338a3a64c2c8e05ab9fecbdb7c0 (diff)
Update unix script.
-rwxr-xr-x[-rw-r--r--]build.libgit2.sh117
1 files changed, 95 insertions, 22 deletions
diff --git a/build.libgit2.sh b/build.libgit2.sh
index b948793..d0a4d88 100644..100755
--- a/build.libgit2.sh
+++ b/build.libgit2.sh
@@ -1,47 +1,120 @@
#!/bin/bash
+CURDIR=$(pwd)
LIBGIT2SHA=`cat ./libgit2_hash.txt`
SHORTSHA=${LIBGIT2SHA:0:7}
+OS=$(uname -s)
-if [[ -d external/libgit2/build ]]
+function check_newer_binaries {
+ pushd "$CURDIR/mac"
+ for i in libgit2-*.dylib;
+ do
+ OLD=$i
+ done
+ popd
+
+ if [[ -z $OLD || $OLD == libgit2-*.dylib ]]
+ then
+ return
+ fi
+
+ OLDSHA=${OLD:8:7}
+ pushd external/libgit2
+ git merge-base --is-ancestor "$LIBGIT2SHA" "$OLDSHA" && echo "Binaries are newer in output directory" && exit 0
+ popd
+}
+
+if [ "$OS" == "Darwin" ]
+then
+ BUILDDIR=mac
+else
+ BUILDDIR=external/libgit2/build
+fi
+
+if [[ -d "$BUILDDIR" ]]
then
- if [[ -n $(ls libgit2-${SHORTSHA}.*) ]]
+ if [[ "$BUILDDIR/libgit2-${SHORTSHA}.*" == "$BUILDDIR/libgit2-${SHORTSHA}." ]]
then
+ echo "Binaries are the same as in output directory."
exit 0
fi
fi
+if [ "$OS" == "Darwin" ]; then
+ check_newer_binaries
+
+ PKGPATH="./mac"
+ LIBEXT="dylib"
+
+ mkdir -p external/libssh2/build
+ pushd external/libssh2/build
+
+ cmake -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
+ -DBUILD_SHARED_LIBS:BOOL=ON \
+ -DENABLE_ZLIB_COMPRESSION:BOOL=ON \
+ -DCMAKE_OSX_ARCHITECTURES="i386" \
+ -DCMAKE_SKIP_RPATH=TRUE \
+ ..
+ cmake --build .
+
+ popd
+
+ mkdir -p $PKGPATH
+ cp external/libssh2/build/src/libssh2.dylib $PKGPATH/
+ install_name_tool -id libssh2.dylib $PKGPATH/libssh2.dylib
+fi
+
rm -rf external/libgit2/build
mkdir external/libgit2/build
pushd external/libgit2/build
-export _BINPATH=`pwd`
-
-cmake -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
- -DBUILD_CLAR:BOOL=OFF \
- -DUSE_SSH=ON \
- -DENABLE_TRACE=ON \
- -DLIBGIT2_FILENAME=git2-$SHORTSHA \
- -DCMAKE_OSX_ARCHITECTURES="i386" \
- -DCMAKE_SKIP_RPATH=TRUE
- ..
+if [ "$OS" == "Darwin" ]
+then
+ cmake -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
+ -DUSE_SSH=OFF \
+ -DBUILD_CLAR:BOOL=OFF \
+ -DENABLE_TRACE=ON \
+ -DLIBGIT2_FILENAME=git2-$SHORTSHA \
+ -DCMAKE_OSX_ARCHITECTURES="i386" \
+ -DCMAKE_SKIP_RPATH=TRUE \
+ -DLIBSSH2_FOUND=TRUE \
+ -DLIBSSH2_INCLUDE_DIRS="$CURDIR/external/libssh2/include" \
+ -DLIBSSH2_LIBRARY_DIRS="$CURDIR/external/libssh2/build/src" \
+ -DSSH_LIBRARIES="ssh2" \
+ -DHAVE_LIBSSH2_MEMORY_CREDENTIALS=TRUE \
+ ..
+else
+ cmake -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
+ -DBUILD_CLAR:BOOL=OFF \
+ -DUSE_SSH=ON \
+ -DENABLE_TRACE=ON \
+ -DLIBGIT2_FILENAME=git2-$SHORTSHA \
+ -DCMAKE_OSX_ARCHITECTURES="i386" \
+ -DCMAKE_SKIP_RPATH=TRUE \
+ ..
+fi
cmake --build .
popd
-OS=`uname`
-ARCH=`uname -m`
-
-if [ $OS == "Darwin" ]; then
- PKGPATH="./mac"
- LIBEXT="dylib"
-else
+if [ "$OS" != "Darwin" ]
+then
exit 0
fi
-git rm $PKGPATH/*
-mkdir -p $PKGPATH
+cp "external/libgit2/build/libgit2-$SHORTSHA.$LIBEXT" $PKGPATH/
+install_name_tool -change libssh2.1.dylib @loader_path/libssh2.dylib $PKGPATH/libssh2.dylib
+
+git stash save
+git pull
+
+check_newer_binaries
+
+git stash pop
+
+git add $PKGPATH
-cp external/libgit2/build/libgit2-$SHORTSHA.$LIBEXT $PKGPATH/
+git commit -m "Bumping OSX libgit2 to $LIBGIT2SHA"
+git push
exit $?