1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-23 03:03:02 +01:00

Merge pull request #7 from jin-eld/update-build-system

Update build system
This commit is contained in:
Sean Qureshi 2013-08-23 19:49:35 -07:00
commit c78d8bc854
5 changed files with 178 additions and 120 deletions

View File

@ -28,14 +28,13 @@ before_script:
- git clone https://github.com/irungentoo/ProjectTox-Core.git toxcore - git clone https://github.com/irungentoo/ProjectTox-Core.git toxcore
- cd toxcore - cd toxcore
- mkdir build - autoreconf -i
- cd build - ./configure
- cmake .. - make -j2
- make toxcore -j2 - sudo make install
- cd ../..
script: script:
- autoreconf -i - autoreconf -i
- ./configure --with-libtoxcore-headers=$TRAVIS_BUILD_DIR/toxcore/core --with-libtoxcore-libs=$TRAVIS_BUILD_DIR/toxcore/build/core - ./configure
- make -j2 - make -j2
notifications: notifications:
email: false email: false

View File

@ -20,6 +20,10 @@ LIBTOXCORE_SEARCH_LIBS=
LIBSODIUM_SEARCH_HEADERS= LIBSODIUM_SEARCH_HEADERS=
LIBSODIUM_SEARCH_LIBS= LIBSODIUM_SEARCH_LIBS=
LIBTOXCORE_FOUND="no"
NCURSES_FOUND="no"
NCURSES_WIDECHAR_SUPPORT="no"
AC_ARG_WITH(dependency-search, AC_ARG_WITH(dependency-search,
AC_HELP_STRING([--with-dependency-search=DIR], AC_HELP_STRING([--with-dependency-search=DIR],
[search for dependencies in DIR, i.e. look for libraries in [search for dependencies in DIR, i.e. look for libraries in
@ -38,7 +42,7 @@ fi
AC_ARG_WITH(libtoxcore-headers, AC_ARG_WITH(libtoxcore-headers,
AC_HELP_STRING([--with-libtoxcore-headers=DIR], AC_HELP_STRING([--with-libtoxcore-headers=DIR],
[search for libtoxcore header files in DIR]), [search for libtoxcore header files in DIR/tox]),
[ [
LIBTOXCORE_SEARCH_HEADERS="$withval" LIBTOXCORE_SEARCH_HEADERS="$withval"
AC_MSG_NOTICE([Will search for libtoxcore header files in $withval]) AC_MSG_NOTICE([Will search for libtoxcore header files in $withval])
@ -108,17 +112,19 @@ AC_CHECK_FUNCS(
# pkg-config based tests # pkg-config based tests
PKG_PROG_PKG_CONFIG PKG_PROG_PKG_CONFIG
NCURSES_WIDECHAR_SUPPORT="yes"
if test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG"; then
if test "$WIN32" != "xyes"; then if test "$WIN32" != "xyes"; then
PKG_CHECK_MODULES([NCURSES], [ncursesw], PKG_CHECK_MODULES([NCURSES], [ncursesw],
[], [
NCURSES_FOUND="yes"
NCURSES_WIDECHAR_SUPPORT="yes"
],
[ [
NCURSES_WIDECHAR_SUPPORT="no" NCURSES_WIDECHAR_SUPPORT="no"
PKG_CHECK_MODULES([NCURSES], [ncurses], PKG_CHECK_MODULES([NCURSES], [ncurses],
[], [],
[ [
AC_MSG_ERROR([required library ncursesw was not found on your system: $NCURSES_PKG_ERRORS]) AC_MSG_WARN([$NCURSES_PKG_ERRORS])
]) ])
]) ])
fi fi
@ -126,8 +132,77 @@ else
AC_MSG_WARN([pkg-config was not found on your sytem]) AC_MSG_WARN([pkg-config was not found on your sytem])
fi fi
if (test "x$NCURSES_FOUND" = "xno") && (test "$WIN32" != "xyes"); then
AC_PATH_PROG([CURSES_CONFIG], [ncursesw5-config], [no])
if test "x$CURSES_CONFIG" != "xno"; then
AC_MSG_CHECKING(ncurses cflags)
NCURSES_CFLAGS=`${CURSES_CONFIG} --cflags`
AC_MSG_RESULT($NCURSES_CFLAGS)
if (test -z "$PKG_CONFIG") || (test "x$WIN32" = "xyes"); then AC_MSG_CHECKING(ncurses libraries)
NCURSES_LIBS=`${CURSES_CONFIG} --libs`
AC_MSG_RESULT($NCURSES_LIBS)
AC_SUBST(NCURSES_CFLAGS)
AC_SUBST(NCURSES_LIBS)
NCURSES_FOUND="yes"
NCURSES_WIDECHAR_SUPPORT="yes"
fi
fi
if (test "x$NCURSES_FOUND" = "xno") && (test "$WIN32" != "xyes"); then
AC_PATH_PROG([CURSES_CONFIG], [ncursesw5.4-config], [no])
if test "x$CURSES_CONFIG" != "xno"; then
AC_MSG_CHECKING(ncurses cflags)
NCURSES_CFLAGS=`${CURSES_CONFIG} --cflags`
AC_MSG_RESULT($NCURSES_CFLAGS)
AC_MSG_CHECKING(ncurses libraries)
NCURSES_LIBS=`${CURSES_CONFIG} --libs`
AC_MSG_RESULT($NCURSES_LIBS)
AC_SUBST(NCURSES_CFLAGS)
AC_SUBST(NCURSES_LIBS)
NCURSES_FOUND="yes"
NCURSES_WIDECHAR_SUPPORT="yes"
fi
fi
if (test "x$NCURSES_FOUND" = "xno") && (test "$WIN32" != "xyes"); then
AC_PATH_PROG([CURSES_CONFIG], [ncurses5-config], [no])
if test "x$CURSES_CONFIG" != "xno"; then
AC_MSG_CHECKING(ncurses cflags)
NCURSES_CFLAGS=`${CURSES_CONFIG} --cflags`
AC_MSG_RESULT($NCURSES_CFLAGS)
AC_MSG_CHECKING(ncurses libraries)
NCURSES_LIBS=`${CURSES_CONFIG} --libs`
AC_MSG_RESULT($NCURSES_LIBS)
AC_SUBST(NCURSES_CFLAGS)
AC_SUBST(NCURSES_LIBS)
NCURSES_FOUND="yes"
fi
fi
if (test "x$NCURSES_FOUND" = "xno") && (test "$WIN32" != "xyes"); then
AC_PATH_PROG([CURSES_CONFIG], [ncurses5.4-config], [no])
if test "x$CURSES_CONFIG" != "xno"; then
AC_MSG_CHECKING(ncurses cflags)
NCURSES_CFLAGS=`${CURSES_CONFIG} --cflags`
AC_MSG_RESULT($NCURSES_CFLAGS)
AC_MSG_CHECKING(ncurses libraries)
NCURSES_LIBS=`${CURSES_CONFIG} --libs`
AC_MSG_RESULT($NCURSES_LIBS)
AC_SUBST(NCURSES_CFLAGS)
AC_SUBST(NCURSES_LIBS)
NCURSES_FOUND="yes"
fi
fi
if test "x$NCURSES_FOUND" = "xno"; then
AC_CHECK_HEADER([curses.h], AC_CHECK_HEADER([curses.h],
[], [],
[ [
@ -156,11 +231,15 @@ if (test -z "$PKG_CONFIG") || (test "x$WIN32" = "xyes"); then
) )
else else
AC_CHECK_LIB([ncursesw], [get_wch], AC_CHECK_LIB([ncursesw], [get_wch],
[], [
NCURSES_WIDECHAR_SUPPORT="yes"
],
[ [
unset ac_cv_lib_ncursesw_get_wch unset ac_cv_lib_ncursesw_get_wch
AC_CHECK_LIB([ncursesw], [get_wch], AC_CHECK_LIB([ncursesw], [get_wch],
[], [
NCURSES_WIDECHAR_SUPPORT="yes"
],
[ [
NCURSES_WIDECHAR_SUPPORT="no" NCURSES_WIDECHAR_SUPPORT="no"
AC_CHECK_LIB([ncurses], [clear], AC_CHECK_LIB([ncurses], [clear],
@ -188,120 +267,100 @@ if (test -z "$PKG_CONFIG") || (test "x$WIN32" = "xyes"); then
fi fi
fi fi
# sodium is included by Tox headers so we kind of need to know where it is if test -n "$PKG_CONFIG"; then
LIBSODIUM_CFLAGS= PKG_CHECK_MODULES(LIBTOXCORE, [libtoxcore],
CFLAGS_SAVE="$CFLAGS"
CPPFLAGS_SAVE="$CPPFLAGS"
if test -n "$LIBSODIUM_SEARCH_HEADERS"; then
CFLAGS="$CFLAGS -I$LIBSODIUM_SEARCH_HEADERS"
CPPFLAGS="$CFLAGS -I$LIBSODIUM_SEARCH_HEADERS"
AC_CHECK_HEADER(sodium.h,
[ [
LIBSODIUM_CFLAGS="-I$LIBSODIUM_SEARCH_HEADERS" LIBTOXCORE_FOUND="yes"
], ],
[ [
AC_MSG_ERROR([header files for required library libsodium was not found in requested location $LIBSODIUM_SEARCH_HEADERS]) AC_MSG_WARN([required library libsodium was not found in requested location $LIBSODIUM_SEARCH_LIBS])
] ])
)
else
AC_CHECK_HEADER(sodium.h,
[],
[
AC_MSG_ERROR([header files for required library libsodium was not found on your system, please check http://download.libsodium.org/libsodium/releases/])
]
)
fi
CFLAGS="$CFLAGS_SAVE"
CPPFLAGS="$CPPFLAGS_SAVE"
AC_SUBST(LIBSODIUM_CFLAGS)
LIBSODIUM_LIBS=
LIBSODIUM_LDFLAGS=
LDFLAGS_SAVE="$LDFLAGS"
if test -n "$LIBSODIUM_SEARCH_LIBS"; then
LDFLAGS="$LDFLAGS -L$LIBSODIUM_SEARCH_LIBS"
AC_CHECK_LIB(sodium, randombytes_random,
[
LIBSODIUM_LDFLAGS="-L$LIBSODIUM_SEARCH_LIBS"
LIBSODIUM_LIBS="-lsodium"
],
[
AC_MSG_ERROR([required library libsodium was not found in requested location $LIBSODIUM_SEARCH_LIBS])
]
)
else
AC_CHECK_LIB(sodium, randombytes_random,
[],
[
AC_MSG_ERROR([required library libsodium was not found on your system, please check http://download.libsodium.org/libsodium/releases/])
]
)
fi fi
LDFLAGS="$LDFLAGS_SAVE" if test "x$LIBTOXCORE_FOUND" = "xno"; then
AC_SUBST(LIBSODIUM_LIBS) LIBSODIUM_LIBS=
AC_SUBST(LIBSODIUM_LDFLAGS) LIBSODIUM_LDFLAGS=
LDFLAGS_SAVE="$LDFLAGS"
if test -n "$LIBSODIUM_SEARCH_LIBS"; then
LDFLAGS="$LDFLAGS -L$LIBSODIUM_SEARCH_LIBS"
AC_CHECK_LIB(sodium, randombytes_random,
[
LIBSODIUM_LDFLAGS="-L$LIBSODIUM_SEARCH_LIBS"
LIBSODIUM_LIBS="-lsodium"
],
[
AC_MSG_ERROR([required library libsodium was not found in requested location $LIBSODIUM_SEARCH_LIBS])
]
)
else
AC_CHECK_LIB(sodium, randombytes_random,
[],
[
AC_MSG_ERROR([required library libsodium was not found on your system, please check http://download.libsodium.org/libsodium/releases/])
]
)
fi
LDFLAGS="$LDFLAGS_SAVE"
AC_SUBST(LIBSODIUM_LIBS)
AC_SUBST(LIBSODIUM_LDFLAGS)
LIBTOXCORE_CFLAGS= LIBTOXCORE_CFLAGS=
CFLAGS_SAVE="$CFLAGS" CFLAGS_SAVE="$CFLAGS"
CPPFLAGS_SAVE="$CPPFLAGS" CPPFLAGS_SAVE="$CPPFLAGS"
if test -n "$LIBTOXCORE_SEARCH_HEADERS"; then if test -n "$LIBTOXCORE_SEARCH_HEADERS"; then
CFLAGS="$CFLAGS -I$LIBTOXCORE_SEARCH_HEADERS $LIBSODIUM_CFLAGS" CFLAGS="$CFLAGS -I$LIBTOXCORE_SEARCH_HEADERS"
CPPFLAGS="$CPPFLAGS -I$LIBTOXCORE_SEARCH_HEADERS $LIBSODIUM_CFLAGS" CPPFLAGS="$CPPFLAGS -I$LIBTOXCORE_SEARCH_HEADERS"
AC_CHECK_HEADER([tox.h], AC_CHECK_HEADER([tox/tox.h],
[ [
LIBTOXCORE_CFLAGS="-I$LIBTOXCORE_SEARCH_HEADERS" LIBTOXCORE_CFLAGS="-I$LIBTOXCORE_SEARCH_HEADERS"
], ],
[ [
AC_MSG_ERROR([headers for the toxcore library were not found on your system]) AC_MSG_ERROR([headers for the toxcore library were not found on your system])
] ]
) )
else else
CFLAGS="$CFLAGS $LIBSODIUM_CFLAGS" AC_CHECK_HEADER([tox/tox.h],
CPPFLAGS="$CPPFLAGS $LIBSODIUM_CFLAGS" [],
AC_CHECK_HEADER([tox.h], [
[], AC_MSG_ERROR([headers for the toxcore library were not found on your system])
[ ],
AC_MSG_ERROR([headers for the toxcore library were not found on your system]) )
] fi
) CFLAGS="$CFLAGS_SAVE"
CPPFLAGS="$CPPFLAGS_SAVE"
AC_SUBST(LIBTOXCORE_CFLAGS)
LIBTOXCORE_LIBS=
LIBTOXCORE_LDFLAGS=
LDFLAGS_SAVE="$LDFLAGS"
if test -n "$LIBTOXCORE_SEARCH_LIBS"; then
LDFLAGS="$LDFLAGS $LIBSODIUM_LDFLAGS -L$LIBTOXCORE_SEARCH_LIBS $LIBSODIUM_LIBS"
AC_CHECK_LIB([toxcore], [tox_new],
[
LIBTOXCORE_LDFLAGS="-L$LIBTOXCORE_SEARCH_LIBS"
LIBTOXCORE_LIBS="-ltoxcore"
],
[
AC_MSG_ERROR([required library toxcore was not found on your system])
]
)
else
LDFLAGS="$LDFLAGS $LIBSODIUM_LDFLAGS $LIBSODIUM_LIBS"
AC_CHECK_LIB([toxcore], [tox_new],
[],
[
AC_MSG_ERROR([required library toxcore was not found on your system])
]
)
fi
LDFLAGS="$LDFLAGS_SAVE"
AC_SUBST(LIBTOXCORE_LIBS)
AC_SUBST(LIBTOXCORE_LDFLAGS)
fi fi
CFLAGS="$CFLAGS_SAVE"
CPPFLAGS="$CPPFLAGS_SAVE"
AC_SUBST(LIBTOXCORE_CFLAGS)
LIBTOXCORE_LIBS=
LIBTOXCORE_LDFLAGS=
LDFLAGS_SAVE="$LDFLAGS"
if test -n "$LIBTOXCORE_SEARCH_LIBS"; then
LDFLAGS="$LDFLAGS $LIBSODIUM_LDFLAGS -L$LIBTOXCORE_SEARCH_LIBS $LIBSODIUM_LIBS"
AC_CHECK_LIB([toxcore], [tox_new],
[
LIBTOXCORE_LDFLAGS="-L$LIBTOXCORE_SEARCH_LIBS"
LIBTOXCORE_LIBS="-ltoxcore"
],
[
AC_MSG_ERROR([required library toxcore was not found on your system])
]
)
else
LDFLAGS="$LDFLAGS $LIBSODIUM_LDFLAGS $LIBSODIUM_LIBS"
AC_CHECK_LIB([toxcore], [tox_new],
[],
[
AC_MSG_ERROR([required library toxcore was not found on your system])
]
)
fi
LDFLAGS="$LDFLAGS_SAVE"
AC_SUBST(LIBTOXCORE_LIBS)
AC_SUBST(LIBTOXCORE_LDFLAGS)
TOXIC_VERSION="$PACKAGE_VERSION" TOXIC_VERSION="$PACKAGE_VERSION"
AC_PATH_PROG([GIT], [git], [no]) AC_PATH_PROG([GIT], [git], [no])

View File

@ -10,7 +10,7 @@
#include <stdint.h> #include <stdint.h>
#include <ctype.h> #include <ctype.h>
#include "tox.h" #include <tox/tox.h>
#include "friendlist.h" #include "friendlist.h"

View File

@ -25,7 +25,7 @@
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif
#include "tox.h" #include <tox/tox.h>
#include "configdir.h" #include "configdir.h"
#include "toxic_windows.h" #include "toxic_windows.h"

View File

@ -10,7 +10,7 @@
#include <wctype.h> #include <wctype.h>
#include <wchar.h> #include <wchar.h>
#include "tox.h" #include <tox/tox.h>
#define MAX_WINDOWS_NUM 32 #define MAX_WINDOWS_NUM 32
#define MAX_FRIENDS_NUM 100 #define MAX_FRIENDS_NUM 100