Fetch libsignal-protocol-c when not a submodule (still using git)

This commit is contained in:
Marvin W 2017-03-23 17:30:15 +01:00
parent e6f89f8751
commit c95a400908
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A
3 changed files with 86 additions and 51 deletions

1
.gitmodules vendored
View file

@ -1,3 +1,4 @@
[submodule "libsignal-protocol-c"] [submodule "libsignal-protocol-c"]
path = plugins/signal-protocol/libsignal-protocol-c path = plugins/signal-protocol/libsignal-protocol-c
url = https://github.com/WhisperSystems/libsignal-protocol-c.git url = https://github.com/WhisperSystems/libsignal-protocol-c.git
branch = e59089a644ca747ed50442eb8804266618f11c0b

134
configure vendored
View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
OPTS=`getopt -o "h" --long prefix:,enable-plugin:,disable-plugin:,valac:,valac-flags:,lib-suffix:,help,disable-fast-vapi,no-debug -n './configure' -- "$@"` OPTS=`getopt -o "h" --long prefix:,enable-plugin:,disable-plugin:,valac:,valac-flags:,lib-suffix:,help,disable-fast-vapi,no-debug,fetch-only -n './configure' -- "$@"`
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
eval set -- "$OPTS" eval set -- "$OPTS"
@ -13,6 +13,7 @@ VALAC_FLAGS=
DISABLE_FAST_VAPI= DISABLE_FAST_VAPI=
LIB_SUFFIX= LIB_SUFFIX=
NO_DEBUG= NO_DEBUG=
FETCH_ONLY=
help() { help() {
cat << EOF cat << EOF
@ -32,82 +33,115 @@ Options:
--valac-flags=FLAGS Use FLAGS when invoking the vala compiler --valac-flags=FLAGS Use FLAGS when invoking the vala compiler
--disable-fast-vapi Disable the usage of Vala compilers fast-vapi feature. --disable-fast-vapi Disable the usage of Vala compilers fast-vapi feature.
--fetch-only Only fetch the files required to run ./configure without
network access later and exit
EOF EOF
} }
while true; do while true; do
case "$1" in case "$1" in
--prefix ) PREFIX="$2"; shift; shift ;; --prefix ) PREFIX="$2"; shift; shift ;;
--enable-plugin ) if [ "$ENABLED_PLUGINS" == "" ]; then ENABLED_PLUGINS="$2"; else ENABLED_PLUGINS="ENABLED_PLUGINS;$2"; fi; shift; shift ;; --enable-plugin ) if [ "$ENABLED_PLUGINS" == "" ]; then ENABLED_PLUGINS="$2"; else ENABLED_PLUGINS="ENABLED_PLUGINS;$2"; fi; shift; shift ;;
--disable-plugin ) if [ "$DISABLED_PLUGINS" == "" ]; then DISABLED_PLUGINS="$2"; else DISABLED_PLUGINS="DISABLED_PLUGINS;$2"; fi; shift; shift ;; --disable-plugin ) if [ "$DISABLED_PLUGINS" == "" ]; then DISABLED_PLUGINS="$2"; else DISABLED_PLUGINS="DISABLED_PLUGINS;$2"; fi; shift; shift ;;
--valac ) VALA_EXECUTABLE="$2"; shift; shift ;; --valac ) VALA_EXECUTABLE="$2"; shift; shift ;;
--valac-flags ) VALAC_FLAGS="$2"; shift; shift ;; --valac-flags ) VALAC_FLAGS="$2"; shift; shift ;;
--lib-suffix ) LIB_SUFFIX="$2"; shift; shift ;; --lib-suffix ) LIB_SUFFIX="$2"; shift; shift ;;
--disable-fast-vapi ) DISABLE_FAST_VAPI=yes; shift ;; --disable-fast-vapi ) DISABLE_FAST_VAPI=yes; shift ;;
--no-debug ) NO_DEBUG=yes; shift ;; --no-debug ) NO_DEBUG=yes; shift ;;
-h | --help ) help; exit 0 ;; --fetch-only ) FETCH_ONLY=yes; shift ;;
-- ) shift; break ;; -h | --help ) help; exit 0 ;;
* ) break ;; -- ) shift; break ;;
esac * ) break ;;
esac
done done
if [ -d ".git" ]; then
git submodule update --init 2>/dev/null
elif [ -x $(which git) ]; then
tmp=0
for i in $(cat .gitmodules | grep -n submodule | awk -F ':' '{print $1}') $(wc -l .gitmodules | awk '{print $1}'); do
if ! [ $tmp -eq 0 ]; then
name=$(cat .gitmodules | head -n $tmp | tail -n 1 | awk -F '"' '{print $2}')
def=$(cat .gitmodules | head -n $i | tail -n $(($i-$tmp)) | awk -F ' ' '{print $1 $2 $3}')
path=$(echo "$def" | grep '^path=' | awk -F '=' '{print $2}')
url=$(echo "$def" | grep '^url=' | awk -F '=' '{print $2}')
branch=$(echo "$def" | grep '^branch=' | awk -F '=' '{print $2}')
if ! ls "$path"/* >/dev/null 2>/dev/null; then
if ! [ -x $(which git) ]; then
echo "Failed retrieving missing files"
exit 5
fi
git clone "$url" "$path" 2>/dev/null
if [[ "$branch" != "" ]]; then
pushd "$path" > /dev/null
git checkout "$branch" 2>/dev/null
popd > /dev/null
fi
echo "Submodule path '$path': checked out '$branch' (via git clone)"
fi
fi
tmp=$i
done
fi
if [[ "$FETCH_ONLY" == "yes" ]]; then exit 0; fi
if [ ! -x "$(which cmake 2>/dev/null)" ] if [ ! -x "$(which cmake 2>/dev/null)" ]
then then
echo "-!- CMake required." echo "-!- CMake required."
exit 1 exit 1
fi fi
ninja_bin="$(which ninja-build 2>/dev/null)" ninja_bin="$(which ninja-build 2>/dev/null)"
if ! [ -x "$ninja_bin" ]; then if ! [ -x "$ninja_bin" ]; then
ninja_bin="$(which ninja 2>/dev/null)" ninja_bin="$(which ninja 2>/dev/null)"
fi fi
if [ -x "$ninja_bin" ]; then if [ -x "$ninja_bin" ]; then
ninja_version=$($ninja_bin --version 2>/dev/null) ninja_version=$($ninja_bin --version 2>/dev/null)
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "-- Found Ninja: $ninja_bin (found version \"$ninja_version\")" echo "-- Found Ninja: $ninja_bin (found version \"$ninja_version\")"
cmake_type="Ninja" cmake_type="Ninja"
exec_bin="$ninja_bin" exec_bin="$ninja_bin"
exec_command="$exec_bin" exec_command="$exec_bin"
elif [[ "/usr/sbin/ninja" == "$ninja_bin" ]]; then elif [[ "/usr/sbin/ninja" == "$ninja_bin" ]]; then
echo "-- Ninja at $ninja_bin is not usable. Did you install 'ninja' instead of 'ninja-build'?" echo "-- Ninja at $ninja_bin is not usable. Did you install 'ninja' instead of 'ninja-build'?"
fi fi
fi fi
if ! [ -x "$exec_bin" ]; then if ! [ -x "$exec_bin" ]; then
make_bin="$(which make 2>/dev/null)" make_bin="$(which make 2>/dev/null)"
if [ -x "$make_bin" ]; then if [ -x "$make_bin" ]; then
echo "-- Found Make: $make_bin" echo "-- Found Make: $make_bin"
cmake_type="Unix Makefiles" cmake_type="Unix Makefiles"
exec_bin="$make_bin" exec_bin="$make_bin"
exec_command="$exec_bin" exec_command="$exec_bin"
echo "-- Running with make. Using Ninja (ninja-build) might improve build experience." echo "-- Running with make. Using Ninja (ninja-build) might improve build experience."
fi fi
fi fi
if ! [ -x "$exec_bin" ]; then if ! [ -x "$exec_bin" ]; then
echo "-!- No compatible build system (Ninja, Make) found." echo "-!- No compatible build system (Ninja, Make) found."
exit 4 exit 4
fi fi
# TODO don't use git submodule
git submodule update --init --recursive
if [ -f ./build ] if [ -f ./build ]
then then
echo "-!- ./build file exists. ./configure can't continue" echo "-!- ./build file exists. ./configure can't continue"
exit 2 exit 2
fi fi
if [ -d build ] if [ -d build ]
then then
last_type=`cat build/.cmake_type` last_type=`cat build/.cmake_type`
if [ "$cmake_type" != "$last_type" ] if [ "$cmake_type" != "$last_type" ]
then then
echo "-- Using different build system, cleaning build system files" echo "-- Using different build system, cleaning build system files"
cd build cd build
rm -r CMakeCache.txt CMakeFiles rm -r CMakeCache.txt CMakeFiles
cd .. cd ..
fi fi
fi fi
mkdir -p build mkdir -p build
@ -135,4 +169,4 @@ default:
@sh -c "cd build; $exec_command \"\$@\"" @sh -c "cd build; $exec_command \"\$@\""
EOF EOF
echo "-- Configured. Type 'make' to build, 'make install' to install." echo "-- Configured. Type 'make' to build, 'make install' to install."

@ -1 +1 @@
Subproject commit 7d4b305691c59a12a3ff5b54a34d6f095f9b7910 Subproject commit e59089a644ca747ed50442eb8804266618f11c0b