Add "make install" step to Travis build.

This commit is contained in:
iphydf 2016-08-11 13:49:49 +01:00
parent 11de2c222f
commit 35932b5381
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9
16 changed files with 250 additions and 80 deletions

View File

@ -2,14 +2,14 @@ language: c
matrix:
include:
- env: BUILD=hstox
- env: BUILD=hstox ENV=linux
language: haskell
ghc: 7.8
- env: BUILD=toxcore
- env: BUILD=toxcore ENV=linux
compiler: clang
- env: BUILD=toxcore
- env: BUILD=toxcore ENV=linux
compiler: gcc
- env: BUILD=autotools
- env: BUILD=autotools ENV=linux
compiler: clang
addons:
@ -24,25 +24,22 @@ addons:
cache:
directories:
# Although Travis documentation says not to rely on the value of $HOME, we
# rely on it here because cabal installs its packages there by default. If
# that ever changes, these values need to be updated.
# Note that we can't use shell expressions in these paths, so we can't ask
# cabal where its data is stored.
- $HOME/.cabal
- $HOME/.ghc
- $HOME/cache
install:
# Globally used environment variables.
- export CACHE_DIR=$HOME/cache
- export OPAMROOT=$CACHE_DIR/.opam
- export LD_LIBRARY_PATH=$CACHE_DIR/lib
- export PKG_CONFIG_PATH=$CACHE_DIR/lib/pkgconfig
- export ASTYLE=$CACHE_DIR/astyle/build/gcc/bin/astyle
# Install required packages.
- other/travis/${BUILD}-install
script:
- other/travis/${BUILD}-script
after_script:
- other/travis/${BUILD}-after_script
install: other/travis/${BUILD}-install
script: other/travis/${BUILD}-script
after_script: other/travis/${BUILD}-after_script
notifications:
irc: "chat.freenode.net#toktok-status"
branches:
only:
- master

View File

@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 2.8.6)
project(toxcore)
include(CTest)
# This version is for the entire project. All libraries (core, av, ...) move in
# versions in a synchronised way.
set(PROJECT_VERSION "0.0.0")
################################################################################
#
@ -15,32 +19,58 @@ find_package(PkgConfig REQUIRED)
find_package(Threads REQUIRED)
find_library(UTIL_LIBRARIES util)
find_library(RT_LIBRARIES rt)
find_library(RT_LIBRARIES rt)
pkg_search_module(CHECK REQUIRED check)
pkg_search_module(LIBCONFIG REQUIRED libconfig)
pkg_search_module(CHECK check)
pkg_search_module(LIBCONFIG libconfig)
pkg_search_module(LIBSODIUM REQUIRED libsodium)
pkg_search_module(OPUS REQUIRED opus)
pkg_search_module(VPX REQUIRED vpx)
link_directories(${CHECK_LIBRARY_DIRS})
link_directories(${LIBCONFIG_LIBRARY_DIRS})
if(CHECK_FOUND)
link_directories(${CHECK_LIBRARY_DIRS})
endif()
if(LIBCONFIG_FOUND)
link_directories(${LIBCONFIG_LIBRARY_DIRS})
endif()
link_directories(${LIBSODIUM_LIBRARY_DIRS})
link_directories(${OPUS_LIBRARY_DIRS})
link_directories(${VPX_LIBRARY_DIRS})
include_directories(${CHECK_INCLUDE_DIRS})
include_directories(${LIBCONFIG_INCLUDE_DIRS})
if(CHECK_FOUND)
include_directories(${CHECK_INCLUDE_DIRS})
endif()
if(LIBCONFIG_FOUND)
include_directories(${LIBCONFIG_INCLUDE_DIRS})
endif()
include_directories(${LIBSODIUM_INCLUDE_DIRS})
include_directories(${OPUS_INCLUDE_DIRS})
include_directories(${VPX_INCLUDE_DIRS})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CHECK_CFLAGS_OTHER}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCONFIG_CFLAGS_OTHER}")
if(CHECK_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CHECK_CFLAGS_OTHER}")
endif()
if(LIBCONFIG_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCONFIG_CFLAGS_OTHER}")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBSODIUM_CFLAGS_OTHER}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPUS_CFLAGS_OTHER}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VPX_CFLAGS_OTHER}")
# Users can call cmake -DLIBTYPE=STATIC or -DLIBTYPE=SHARED to override this.
if(NOT LIBTYPE)
if(WIN32)
# Our win32 builds are fully static, since we use the MXE cross compiling
# environment, which builds everything statically by default. Building
# shared libraries will result in multiple definition errors, since multiple
# tox libraries will link against libsodium and other libraries that are
# built statically in MXE.
set(LIBTYPE STATIC)
else()
set(LIBTYPE SHARED)
endif()
endif()
################################################################################
#
@ -48,7 +78,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VPX_CFLAGS_OTHER}")
#
################################################################################
add_library(toxcore SHARED
add_library(toxcore ${LIBTYPE}
toxcore/DHT.c
toxcore/LAN_discovery.c
toxcore/Messenger.c
@ -72,12 +102,20 @@ add_library(toxcore SHARED
toxcore/tox.c
toxcore/util.c)
target_link_libraries(toxcore ${LIBSODIUM_LIBRARIES})
target_link_libraries(toxcore ${LIBSODIUM_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
if(CMAKE_THREAD_LIBS_INIT)
set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} "-l${CMAKE_THREAD_LIBS_INIT}")
endif()
if(RT_LIBRARIES)
target_link_libraries(toxcore ${RT_LIBRARIES})
set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} "-lrt")
endif()
add_library(toxav SHARED
if(WIN32)
target_link_libraries(toxcore ws2_32 iphlpapi)
endif()
add_library(toxav ${LIBTYPE}
toxav/audio.c
toxav/bwcontroller.c
toxav/group.c
@ -91,12 +129,12 @@ target_link_libraries(toxav toxcore)
target_link_libraries(toxav ${OPUS_LIBRARIES})
target_link_libraries(toxav ${VPX_LIBRARIES})
add_library(toxdns SHARED
add_library(toxdns ${LIBTYPE}
toxdns/toxdns.c)
target_link_libraries(toxdns toxcore)
add_library(toxencryptsave SHARED
add_library(toxencryptsave ${LIBTYPE}
toxencryptsave/toxencryptsave.c)
target_link_libraries(toxencryptsave toxcore)
@ -115,8 +153,7 @@ function(auto_test target)
toxcore
toxav
toxencryptsave
${CHECK_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT})
${CHECK_LIBRARIES})
add_test(${target} auto_${target})
endif()
endfunction()
@ -143,20 +180,22 @@ auto_test(toxav_many_test)
#
################################################################################
add_executable(tox-bootstrapd
other/bootstrap_daemon/src/command_line_arguments.c
other/bootstrap_daemon/src/command_line_arguments.h
other/bootstrap_daemon/src/config.c
other/bootstrap_daemon/src/config_defaults.h
other/bootstrap_daemon/src/config.h
other/bootstrap_daemon/src/log.c
other/bootstrap_daemon/src/log.h
other/bootstrap_daemon/src/tox-bootstrapd.c
other/bootstrap_daemon/src/global.h
other/bootstrap_node_packets.c
other/bootstrap_node_packets.h)
if(LIBCONFIG_FOUND)
add_executable(tox-bootstrapd
other/bootstrap_daemon/src/command_line_arguments.c
other/bootstrap_daemon/src/command_line_arguments.h
other/bootstrap_daemon/src/config.c
other/bootstrap_daemon/src/config_defaults.h
other/bootstrap_daemon/src/config.h
other/bootstrap_daemon/src/log.c
other/bootstrap_daemon/src/log.h
other/bootstrap_daemon/src/tox-bootstrapd.c
other/bootstrap_daemon/src/global.h
other/bootstrap_node_packets.c
other/bootstrap_node_packets.h)
target_link_libraries(tox-bootstrapd toxcore ${LIBCONFIG_LIBRARIES})
target_link_libraries(tox-bootstrapd toxcore ${LIBCONFIG_LIBRARIES})
endif()
################################################################################
@ -165,23 +204,83 @@ target_link_libraries(tox-bootstrapd toxcore ${LIBCONFIG_LIBRARIES})
#
################################################################################
add_executable(nTox testing/nTox.c)
target_link_libraries(nTox toxcore ncurses ${CMAKE_THREAD_LIBS_INIT})
if(NOT WIN32)
add_executable(nTox testing/nTox.c)
target_link_libraries(nTox toxcore ncurses)
endif()
add_executable(DHT_test testing/DHT_test.c)
target_link_libraries(DHT_test toxcore ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(DHT_test toxcore)
add_executable(Messenger_test testing/Messenger_test.c)
target_link_libraries(Messenger_test toxcore ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(Messenger_test toxcore)
add_executable(dns3_test testing/dns3_test.c)
target_link_libraries(dns3_test toxdns ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(dns3_test toxdns)
add_executable(tox_sync testing/tox_sync.c)
target_link_libraries(tox_sync toxcore ${CMAKE_THREAD_LIBS_INIT})
if(NOT WIN32)
add_executable(tox_sync testing/tox_sync.c)
target_link_libraries(tox_sync toxcore)
endif()
add_executable(tox_shell testing/tox_shell.c)
target_link_libraries(tox_shell toxcore ${CMAKE_THREAD_LIBS_INIT} ${UTIL_LIBRARIES})
if(UTIL_LIBRARIES)
add_executable(tox_shell testing/tox_shell.c)
target_link_libraries(tox_shell toxcore ${UTIL_LIBRARIES})
endif()
add_executable(irc_syncbot testing/irc_syncbot.c)
target_link_libraries(irc_syncbot toxcore ${CMAKE_THREAD_LIBS_INIT})
if(NOT WIN32)
add_executable(irc_syncbot testing/irc_syncbot.c)
target_link_libraries(irc_syncbot toxcore)
endif()
################################################################################
#
# :: Installation and pkg-config.
#
################################################################################
configure_file(
"${CMAKE_SOURCE_DIR}/other/pkgconfig/toxav.pc.in"
"${CMAKE_BINARY_DIR}/toxav.pc"
@ONLY
)
configure_file(
"${CMAKE_SOURCE_DIR}/other/pkgconfig/toxcore.pc.in"
"${CMAKE_BINARY_DIR}/toxcore.pc"
@ONLY
)
configure_file(
"${CMAKE_SOURCE_DIR}/other/pkgconfig/toxdns.pc.in"
"${CMAKE_BINARY_DIR}/toxdns.pc"
@ONLY
)
configure_file(
"${CMAKE_SOURCE_DIR}/other/pkgconfig/toxencryptsave.pc.in"
"${CMAKE_BINARY_DIR}/toxencryptsave.pc"
@ONLY
)
install(FILES
${CMAKE_BINARY_DIR}/toxav.pc
${CMAKE_BINARY_DIR}/toxcore.pc
${CMAKE_BINARY_DIR}/toxdns.pc
${CMAKE_BINARY_DIR}/toxencryptsave.pc
DESTINATION "lib/pkgconfig")
install(TARGETS
toxav
toxcore
toxdns
toxencryptsave
DESTINATION "lib")
install(FILES
toxav/toxav.h
toxcore/tox.h
toxcore/tox_old.h
toxdns/toxdns.h
toxencryptsave/toxencryptsave.h
DESTINATION "include/tox")

View File

@ -0,0 +1,10 @@
prefix=@CMAKE_INSTALL_PREFIX@
libdir=${prefix}/lib
includedir=${prefix}/include
Name: toxav
Description: Tox A/V library
Requires: opus toxcore vpx
Version: @PROJECT_VERSION@
Libs: -L${libdir} -ltoxav @toxav_PKGCONFIG_LIBS@
Cflags: -I${includedir}

View File

@ -0,0 +1,10 @@
prefix=@CMAKE_INSTALL_PREFIX@
libdir=${prefix}/lib
includedir=${prefix}/include
Name: toxcore
Description: Tox protocol library
Requires: libsodium
Version: @PROJECT_VERSION@
Libs: -L${libdir} -ltoxcore @toxcore_PKGCONFIG_LIBS@
Cflags: -I${includedir}

View File

@ -0,0 +1,10 @@
prefix=@CMAKE_INSTALL_PREFIX@
libdir=${prefix}/lib
includedir=${prefix}/include
Name: toxdns
Description: Tox DNS3 library
Requires: toxcore
Version: @PROJECT_VERSION@
Libs: -L${libdir} -ltoxdns @toxdns_PKGCONFIG_LIBS@
Cflags: -I${includedir}

View File

@ -0,0 +1,10 @@
prefix=@CMAKE_INSTALL_PREFIX@
libdir=${prefix}/lib
includedir=${prefix}/include
Name: toxencryptsave
Description: Tox block encryption library
Requires: toxcore
Version: @PROJECT_VERSION@
Libs: -L${libdir} -ltoxencryptsave @toxencryptsave_PKGCONFIG_LIBS@
Cflags: -I${includedir}

View File

@ -1,3 +1,4 @@
#!/bin/sh
set -e -x
set -e -u -x
. other/travis/env-$ENV.sh

View File

@ -1,20 +1,27 @@
#!/bin/sh
set -e -x
set -e -u -x
. other/travis/env-$ENV.sh
# Build toxcore and run tests.
./autogen.sh
./configure \
RUN ./configure \
--with-libsodium-libs=$CACHE_DIR/lib \
--with-libsodium-headers=$CACHE_DIR/include \
--enable-daemon \
--enable-logging \
--enable-ntox
make -j `nproc`
# We use make instead of RUN $MAKE here, because the autotools build will only
# ever run natively on the Linux container, never on a Windows cross compilation
# docker instance or an OSX machine.
make -j`nproc`
# This doesn't currently work on Travis, because the autotools build is broken.
# It does not look up libsodium by pkg-config, so without the --with flags it
# won't find it. We don't care that much about distcheck at this point, but we
# do care whether it configures/builds at all, which is exercised by the make
# call above. Tests are executed by the cmake build.
make distcheck -j `nproc` || true
echo "*** make distcheck currently fails; see https://github.com/TokTok/toxcore/blob/master/other/travis/autotools-script#L16 ***"
make distcheck -j`nproc` \
|| echo "*** make distcheck has failed as expected; don't be alarmed ***"

10
other/travis/env-linux.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/sh
. other/travis/env.sh
RUN() {
"$@"
}
export CMAKE=cmake
export MAKE=make
export PREFIX=$PWD/_install

10
other/travis/env.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# Globally used environment variables.
export CACHE_DIR=$HOME/cache
export OPAMROOT=$CACHE_DIR/.opam
export LD_LIBRARY_PATH=$CACHE_DIR/lib
export PKG_CONFIG_PATH=$CACHE_DIR/lib/pkgconfig
export ASTYLE=$CACHE_DIR/astyle/build/gcc/bin/astyle
BUILD_DIR=_build

View File

@ -1,3 +1,4 @@
#!/bin/sh
set -e -x
set -e -u -x
. other/travis/env-$ENV.sh

View File

@ -1,7 +1,10 @@
#!/bin/sh
set -e -x
set -e -u -x
. other/travis/env-$ENV.sh
# An initial update is required or the cabal cache will be empty and no packages
# can be installed.
cabal update
# We need to install happy explicitly, otherwise setup-Simple-Cabal will fail to

View File

@ -1,5 +1,6 @@
#!/bin/sh
set -e -x
set -e -u -x
. other/travis/env-$ENV.sh
make -C ../hstox check-toxcore

View File

@ -1,6 +1,7 @@
#!/bin/sh
set -e -x
set -e -u -x
. other/travis/env-$ENV.sh
# Only submit coverage from the clang build. GCC and clang disagree slightly,
# so we arbitrarily choose the alphabetically first one for the report.

View File

@ -1,6 +1,7 @@
#!/bin/sh
set -e -x
set -e -u -x
. other/travis/env-$ENV.sh
# Set up opam.
opam init -y
@ -11,7 +12,7 @@ opam install -y ocamlfind ppx_deriving menhir
# Build apidsl.
git clone --depth=1 https://github.com/iphydf/apidsl ../apidsl
make -C ../apidsl
make -C ../apidsl -j`nproc`
# Install cpp-coveralls to upload test coverage results.
pip install --user cpp-coveralls
@ -20,7 +21,7 @@ pip install --user cpp-coveralls
[ -f $ASTYLE ] || {
wget -O ../astyle.tar.gz https://launchpad.net/ubuntu/+archive/primary/+files/astyle_2.05.1.orig.tar.gz
tar -xf ../astyle.tar.gz -C $CACHE_DIR
make -C $CACHE_DIR/astyle/build/gcc
make -C $CACHE_DIR/astyle/build/gcc -j`nproc`
}
# Install libsodium (not in ubuntu-precise).
@ -29,7 +30,7 @@ pip install --user cpp-coveralls
cd ../libsodium # pushd
./autogen.sh
./configure --prefix=$CACHE_DIR
make install -j3
make install -j`nproc`
cd - # popd
}
@ -40,7 +41,7 @@ pip install --user cpp-coveralls
autoreconf -fi
./configure --prefix=$CACHE_DIR
touch lib/scanner.l
make install -j3
make install -j`nproc`
cd - # popd
}
@ -50,6 +51,6 @@ pip install --user cpp-coveralls
cd ../opus # pushd
./autogen.sh
./configure --prefix=$CACHE_DIR
make install -j3
make install -j`nproc`
cd - # popd
}

View File

@ -1,8 +1,7 @@
#!/bin/sh
set -e -x
BUILD_DIR=_build
set -e -u -x
. other/travis/env-$ENV.sh
# Check if toxcore.h and toxav.h match apidsl tox.in.h and toxav.in.h.
../apidsl/_build/apigen.native other/apidsl/tox.in.h | $ASTYLE --options=other/astyle/astylerc > toxcore/tox.h
@ -13,9 +12,9 @@ git diff --exit-code
# Build toxcore and run tests.
export CFLAGS="-O0 -Wall -Wextra -fprofile-arcs -ftest-coverage -DTRAVIS_ENV=1"
cmake -B$BUILD_DIR -H.
RUN $CMAKE -B$BUILD_DIR -H. -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX
export CTEST_OUTPUT_ON_FAILURE=1
make -C $BUILD_DIR -j `nproc`
make -C $BUILD_DIR -j `nproc` test
RUN $MAKE -C $BUILD_DIR -j`nproc`
RUN $MAKE -C $BUILD_DIR -j`nproc` test