Use system provided libsignal-protocol-c by default

You can still compile in tree by using --with-libsignal-in-tree flag
This commit is contained in:
Marvin W 2020-01-21 21:30:21 +01:00
parent 4c3800c688
commit 55b148a0f7
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A
4 changed files with 51 additions and 40 deletions

View file

@ -6,7 +6,7 @@ env:
before_install: before_install:
- export USE_CCACHE=1 - export USE_CCACHE=1
- sudo apt-get update - sudo apt-get update
- sudo apt-get install -y cmake valac libgee-0.8-dev libsqlite3-dev libgtk-3-dev libnotify-dev libgpgme-dev libsoup2.4-dev libgcrypt20-dev libqrencode-dev - sudo apt-get install -y cmake valac libgee-0.8-dev libsqlite3-dev libgtk-3-dev libnotify-dev libgpgme-dev libsoup2.4-dev libgcrypt20-dev libqrencode-dev libsignal-protocol-c-dev
install: install:
- ./configure --with-tests $CONFIGURE_FLAGS - ./configure --with-tests $CONFIGURE_FLAGS
- make - make

View file

@ -1,10 +1,11 @@
include(PkgConfigWithFallback) include(PkgConfigWithFallback)
find_pkg_config_with_fallback(SignalProtocol find_pkg_config_with_fallback(SignalProtocol
PKG_CONFIG_NAME signal-protocol-c PKG_CONFIG_NAME libsignal-protocol-c
LIB_NAMES signal-protocol-c LIB_NAMES signal-protocol-c
INCLUDE_NAMES signal/signal_protocol.h INCLUDE_NAMES signal/signal_protocol.h
) )
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SignalProtocol find_package_handle_standard_args(SignalProtocol
REQUIRED_VARS SignalProtocol_LIBRARY) REQUIRED_VARS SignalProtocol_LIBRARY
VERSION_VAR SignalProtocol_VERSION)

75
configure vendored
View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
OPTS=`getopt -o "h" --long \ OPTS=`getopt -o "h" --long \
help,fetch-only,no-debug,disable-fast-vapi,with-tests,release,\ help,fetch-only,no-debug,disable-fast-vapi,with-tests,release,with-libsignal-in-tree,\
enable-plugin:,disable-plugin:,\ enable-plugin:,disable-plugin:,\
prefix:,program-prefix:,exec-prefix:,lib-suffix:,\ prefix:,program-prefix:,exec-prefix:,lib-suffix:,\
bindir:,libdir:,includedir:,datadir:,\ bindir:,libdir:,includedir:,datadir:,\
@ -17,6 +17,7 @@ eval set -- "$OPTS"
PREFIX=${PREFIX:-/usr/local} PREFIX=${PREFIX:-/usr/local}
ENABLED_PLUGINS= ENABLED_PLUGINS=
DISABLED_PLUGINS= DISABLED_PLUGINS=
BUILD_LIBSIGNAL_IN_TREE=
BUILD_TESTS= BUILD_TESTS=
BUILD_TYPE=Debug BUILD_TYPE=Debug
DISABLE_FAST_VAPI= DISABLE_FAST_VAPI=
@ -52,9 +53,11 @@ Configuration:
clean builds, but faster when doing incremental clean builds, but faster when doing incremental
builds (during development). builds (during development).
--fetch-only Only fetch the files required to run ./configure --fetch-only Only fetch the files required to run ./configure
without network access later and exit without network access later and exit.
--no-debug Build without debug symbols --no-debug Build without debug symbols
--release Configure to build an optimized release version --release Configure to build an optimized release version
--with-libsignal-in-tree Build libsignal-protocol-c in tree and link it
statically.
--with-tests Also build tests. --with-tests Also build tests.
Plugin configuration: Plugin configuration:
@ -110,6 +113,7 @@ while true; do
--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 ;;
--with-libsignal-in-tree ) BUILD_LIBSIGNAL_IN_TREE=yes; 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 ;;
--fetch-only ) FETCH_ONLY=yes; shift ;; --fetch-only ) FETCH_ONLY=yes; shift ;;
@ -141,44 +145,46 @@ while true; do
esac esac
done done
if [ -d ".git" ]; then if [ "$BUILD_LIBSIGNAL_IN_TREE" = "yes" ] || [ "$FETCH_ONLY" = "yes" ]; then
git submodule update --init 2>/dev/null if [ -d ".git" ]; then
else git submodule update --init 2>/dev/null
tmp=0 else
for i in $(cat .gitmodules | grep -n submodule | awk -F ':' '{print $1}') $(wc -l .gitmodules | awk '{print $1}'); do tmp=0
if ! [ $tmp -eq 0 ]; then for i in $(cat .gitmodules | grep -n submodule | awk -F ':' '{print $1}') $(wc -l .gitmodules | awk '{print $1}'); do
name=$(cat .gitmodules | head -n $tmp | tail -n 1 | awk -F '"' '{print $2}') if ! [ $tmp -eq 0 ]; then
def=$(cat .gitmodules | head -n $i | tail -n $(expr "$i" - "$tmp") | awk -F ' ' '{print $1 $2 $3}') name=$(cat .gitmodules | head -n $tmp | tail -n 1 | awk -F '"' '{print $2}')
path=$(echo "$def" | grep '^path=' | awk -F '=' '{print $2}') def=$(cat .gitmodules | head -n $i | tail -n $(expr "$i" - "$tmp") | awk -F ' ' '{print $1 $2 $3}')
url=$(echo "$def" | grep '^url=' | awk -F '=' '{print $2}') path=$(echo "$def" | grep '^path=' | awk -F '=' '{print $2}')
branch=$(echo "$def" | grep '^branch=' | 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 ! ls "$path"/* >/dev/null 2>/dev/null; then
git=$(which git) git=$(which git)
if ! [ $? -eq 0 ] || ! [ -x $git ]; then if ! [ $? -eq 0 ] || ! [ -x $git ]; then
echo "Failed retrieving missing files" echo "Failed retrieving missing files"
exit 5 exit 5
fi fi
res=$(git clone "$url" "$path" 2>&1) res=$(git clone "$url" "$path" 2>&1)
if ! [ $? -eq 0 ] || ! [ -d $path ]; then if ! [ $? -eq 0 ] || ! [ -d $path ]; then
echo "Failed retrieving missing files: $res"
exit 5
fi
if [ -n "$branch" ]; then
olddir="$(pwd)"
cd "$path"
res=$(git checkout "$branch" 2>&1)
if ! [ $? -eq 0 ]; then
echo "Failed retrieving missing files: $res" echo "Failed retrieving missing files: $res"
exit 5 exit 5
fi fi
cd "$olddir" if [ -n "$branch" ]; then
olddir="$(pwd)"
cd "$path"
res=$(git checkout "$branch" 2>&1)
if ! [ $? -eq 0 ]; then
echo "Failed retrieving missing files: $res"
exit 5
fi
cd "$olddir"
fi
echo "Submodule path '$path': checked out '$branch' (via git clone)"
fi fi
echo "Submodule path '$path': checked out '$branch' (via git clone)"
fi fi
fi tmp=$i
tmp=$i done
done fi
fi fi
if [ "$FETCH_ONLY" = "yes" ]; then exit 0; fi if [ "$FETCH_ONLY" = "yes" ]; then exit 0; fi
@ -256,6 +262,7 @@ cmake -G "$cmake_type" \
-DENABLED_PLUGINS="$ENABLED_PLUGINS" \ -DENABLED_PLUGINS="$ENABLED_PLUGINS" \
-DDISABLED_PLUGINS="$DISABLED_PLUGINS" \ -DDISABLED_PLUGINS="$DISABLED_PLUGINS" \
-DBUILD_TESTS="$BUILD_TESTS" \ -DBUILD_TESTS="$BUILD_TESTS" \
-DBUILD_LIBSIGNAL_IN_TREE="$BUILD_LIBSIGNAL_IN_TREE" \
-DVALA_EXECUTABLE="$VALAC" \ -DVALA_EXECUTABLE="$VALAC" \
-DCMAKE_VALA_FLAGS="$VALACFLAGS" \ -DCMAKE_VALA_FLAGS="$VALACFLAGS" \
-DDISABLE_FAST_VAPI="$DISABLE_FAST_VAPI" \ -DDISABLE_FAST_VAPI="$DISABLE_FAST_VAPI" \

View file

@ -28,8 +28,11 @@ GENERATE_HEADER
set(C_HEADERS_SRC "") set(C_HEADERS_SRC "")
set(C_HEADERS_TARGET "") set(C_HEADERS_TARGET "")
if((SHARED_SIGNAL_PROTOCOL) OR ($ENV{SHARED_SIGNAL_PROTOCOL})) if(NOT BUILD_LIBSIGNAL_IN_TREE)
find_package(SignalProtocol REQUIRED) # libsignal-protocol-c has a history of breaking compatibility on the patch level
# we'll have to check compatibility for every new release
# distro maintainers may update this dependency after compatibility tests
find_package(SignalProtocol 2.3.2 EXACT REQUIRED)
else() else()
add_subdirectory(libsignal-protocol-c EXCLUDE_FROM_ALL) add_subdirectory(libsignal-protocol-c EXCLUDE_FROM_ALL)
set_property(TARGET curve25519 PROPERTY POSITION_INDEPENDENT_CODE ON) set_property(TARGET curve25519 PROPERTY POSITION_INDEPENDENT_CODE ON)
@ -129,4 +132,4 @@ if(BUILD_TESTS)
add_executable(signal-protocol-vala-test ${SIGNAL_TEST_VALA_C}) add_executable(signal-protocol-vala-test ${SIGNAL_TEST_VALA_C})
add_dependencies(signal-protocol-vala-test signal-protocol-vala) add_dependencies(signal-protocol-vala-test signal-protocol-vala)
target_link_libraries(signal-protocol-vala-test signal-protocol-vala ${SIGNAL_PROTOCOL_PACKAGES}) target_link_libraries(signal-protocol-vala-test signal-protocol-vala ${SIGNAL_PROTOCOL_PACKAGES})
endif(BUILD_TESTS) endif(BUILD_TESTS)