1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Add builds.sr.ht CI for OpenBSD

* Add .builds/openbsd.yml for builds.sr.ht
* Update travis-build.sh -> ci-build.sh with OpenBSD case
* Fix libdl check in configure.ac (OpenBSD has libdl built-in)
* Fix some minor issues found when compiling on OpenBSD with GCC (e.g.
  uninitialized variables)
This commit is contained in:
William Wennerström 2020-02-14 12:50:52 +01:00
parent ca3afa7e05
commit b267b065f5
No known key found for this signature in database
GPG Key ID: E1382990BEDD319B
6 changed files with 105 additions and 23 deletions

40
.builds/openbsd.yml Normal file
View File

@ -0,0 +1,40 @@
image: openbsd/6.6
packages:
- cmake
- gmake
- cmocka
- libtool
- automake-1.16.1
- pkgconf
- readline
- python-3.7.4
- autoconf-2.69p2
- autoconf-archive
- libmesode
- curl
- gpgme
- glib2
- gtk+2
- libotr
- libassuan
- libgpg-error
- libgcrypt
- libsignal-protocol-c
sources:
- https://github.com/profanity-im/profanity
environment:
LANG: en_US.UTF-8
tasks:
- symlink: |
doas ln -sf /usr/local/bin/python3.7 /usr/local/bin/python
doas ln -sf /usr/local/bin/python3.7-config /usr/local/bin/python-config
doas ln -sf /usr/local/bin/pydoc3.7 /usr/local/bin/pydoc
- build: |
export AUTOCONF_VERSION=2.69
export AUTOMAKE_VERSION=1.16
cd profanity
./ci-build.sh

View File

@ -36,10 +36,10 @@ before_install:
script: script:
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then - if [ "$TRAVIS_OS_NAME" = "linux" ]; then
docker run -it profanity ./travis-build.sh; docker run -it profanity ./ci-build.sh;
fi fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then - if [ "$TRAVIS_OS_NAME" = "osx" ]; then
./travis-build.sh; ./ci-build.sh;
fi fi
after_failure: after_failure:

View File

@ -1,12 +1,12 @@
#!/bin/bash #!/usr/bin/env bash
error_handler() error_handler()
{ {
ERR_CODE=$? ERR_CODE=$?
echo echo
echo "Error $ERR_CODE with command '$BASH_COMMAND' on line ${BASH_LINENO[0]}. Exiting." echo "Error ${ERR_CODE} with command '${BASH_COMMAND}' on line ${BASH_LINENO[0]}. Exiting."
echo echo
exit $ERR_CODE exit ${ERR_CODE}
} }
trap error_handler ERR trap error_handler ERR
@ -14,6 +14,9 @@ trap error_handler ERR
./bootstrap.sh ./bootstrap.sh
tests=() tests=()
MAKE="make"
CC="gcc"
case $(uname | tr '[:upper:]' '[:lower:]') in case $(uname | tr '[:upper:]' '[:lower:]') in
linux*) linux*)
tests=( tests=(
@ -38,6 +41,34 @@ case $(uname | tr '[:upper:]' '[:lower:]') in
"") "")
;; ;;
darwin*) darwin*)
tests=(
"--enable-notifications --enable-icons-and-clipboard --enable-otr --enable-pgp
--enable-omemo --enable-plugins --enable-c-plugins
--enable-python-plugins"
"--disable-notifications --disable-icons --disable-otr --disable-pgp
--disable-omemo --disable-plugins --disable-c-plugins
--disable-python-plugins"
"--disable-notifications"
"--disable-icons"
"--disable-otr"
"--disable-pgp"
"--disable-omemo"
"--disable-pgp --disable-otr"
"--disable-pgp --disable-otr --disable-omemo"
"--disable-plugins"
"--disable-python-plugins"
"--disable-c-plugins"
"--disable-c-plugins --disable-python-plugins"
"")
;;
openbsd*)
MAKE="gmake"
# TODO(#1231):
# `-std=gnu99 -fexec-charset=UTF-8` to silence:
# src/event/server_events.c:1453:19: error: universal character names are only valid in C++ and C99
# src/event/server_events.c:1454:19: error: universal character names are only valid in C++ and C99
CC="gcc -std=gnu99 -fexec-charset=UTF-8"
tests=( tests=(
"--enable-notifications --enable-icons-and-clipboard --enable-otr --enable-pgp "--enable-notifications --enable-icons-and-clipboard --enable-otr --enable-pgp
--enable-omemo --enable-plugins --enable-c-plugins --enable-omemo --enable-plugins --enable-c-plugins
@ -60,20 +91,22 @@ case $(uname | tr '[:upper:]' '[:lower:]') in
;; ;;
esac esac
for flags in "${tests[@]}" for features in "${tests[@]}"
do do
echo echo
echo "--> Building with ./configure $flags" echo "--> Building with ./configure ${features}"
echo echo
# shellcheck disable=SC2086 # shellcheck disable=SC2086
./configure $flags ./configure $features
make
make check $MAKE CC="${CC}"
$MAKE check
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then
cat ./test-suite.log cat ./test-suite.log
fi fi
./profanity -v
make clean
echo "$flags" ./profanity -v
$MAKE clean
done done

View File

@ -106,13 +106,17 @@ else
if test "x$enable_plugins" = xno; then if test "x$enable_plugins" = xno; then
AM_CONDITIONAL([BUILD_C_API], [false]) AM_CONDITIONAL([BUILD_C_API], [false])
elif test "x$enable_c_plugins" != xno; then elif test "x$enable_c_plugins" != xno; then
AC_CHECK_LIB([dl], [main], # libdl doesn't exist as a separate library in OpenBSD/FreeBSD and is
# provided in the standard libraries.
AS_IF([test "x$PLATFORM" = xopenbsd -o "x$PLATFORM" = xfreebsd],
[AM_CONDITIONAL([BUILD_C_API], [true]) AC_DEFINE([HAVE_C], [1], [C support])],
[AC_CHECK_LIB([dl], [main],
[AM_CONDITIONAL([BUILD_C_API], [true]) LIBS="$LIBS -ldl" AC_DEFINE([HAVE_C], [1], [C support])], [AM_CONDITIONAL([BUILD_C_API], [true]) LIBS="$LIBS -ldl" AC_DEFINE([HAVE_C], [1], [C support])],
[AS_IF( [AS_IF(
[test "x$enable_c_plugins" = xyes], [test "x$enable_c_plugins" = xyes],
[AC_MSG_ERROR([dl library needed to run C plugins])], [AC_MSG_ERROR([dl library needed to run C plugins])],
[AM_CONDITIONAL([BUILD_C_API], [false])]) [AM_CONDITIONAL([BUILD_C_API], [false])])
]) ])])
else else
AM_CONDITIONAL([BUILD_C_API], [false]) AM_CONDITIONAL([BUILD_C_API], [false])
fi fi

View File

@ -353,7 +353,7 @@ _rosterwin_contact(ProfLayoutSplit *layout, PContact contact)
} }
theme_item_t presence_colour = _get_roster_theme(theme_type, presence); theme_item_t presence_colour = _get_roster_theme(theme_type, presence);
int colour; int colour = 0;
if (prefs_get_boolean(PREF_ROSTER_COLOR_NICK)) { if (prefs_get_boolean(PREF_ROSTER_COLOR_NICK)) {
colour = theme_hash_attrs(name); colour = theme_hash_attrs(name);
wattron(layout->subwin, colour); wattron(layout->subwin, colour);
@ -1290,4 +1290,3 @@ _filter_contacts_with_presence(GSList *contacts, const char *const presence)
return filtered_contacts; return filtered_contacts;
} }

View File

@ -250,6 +250,7 @@ test_cmd_otr_theirfp_from_wintype(win_type_t wintype)
gchar *args[] = { "theirfp", NULL }; gchar *args[] = { "theirfp", NULL };
ProfWin window; ProfWin window;
window.type = wintype; window.type = wintype;
window.layout = NULL;
will_return(connection_get_status, JABBER_CONNECTED); will_return(connection_get_status, JABBER_CONNECTED);
@ -281,6 +282,7 @@ void cmd_otr_theirfp_shows_message_when_non_otr_chat_window(void **state)
ProfWin window; ProfWin window;
window.type = WIN_CHAT; window.type = WIN_CHAT;
window.layout = NULL;
ProfChatWin chatwin; ProfChatWin chatwin;
chatwin.window = window; chatwin.window = window;
chatwin.memcheck = PROFCHATWIN_MEMCHECK; chatwin.memcheck = PROFCHATWIN_MEMCHECK;
@ -307,6 +309,7 @@ void cmd_otr_theirfp_shows_fingerprint(void **state)
ProfWin window; ProfWin window;
window.type = WIN_CHAT; window.type = WIN_CHAT;
window.layout = NULL;
ProfChatWin chatwin; ProfChatWin chatwin;
chatwin.window = window; chatwin.window = window;
chatwin.barejid = recipient; chatwin.barejid = recipient;
@ -333,6 +336,7 @@ test_cmd_otr_start_from_wintype(win_type_t wintype)
gchar *args[] = { "start", NULL }; gchar *args[] = { "start", NULL };
ProfWin window; ProfWin window;
window.type = wintype; window.type = wintype;
window.layout = NULL;
will_return(connection_get_status, JABBER_CONNECTED); will_return(connection_get_status, JABBER_CONNECTED);
@ -366,6 +370,7 @@ void cmd_otr_start_shows_message_when_already_started(void **state)
ProfWin window; ProfWin window;
window.type = WIN_CHAT; window.type = WIN_CHAT;
window.layout = NULL;
ProfChatWin chatwin; ProfChatWin chatwin;
chatwin.window = window; chatwin.window = window;
chatwin.barejid = recipient; chatwin.barejid = recipient;
@ -389,6 +394,7 @@ void cmd_otr_start_shows_message_when_no_key(void **state)
ProfWin window; ProfWin window;
window.type = WIN_CHAT; window.type = WIN_CHAT;
window.layout = NULL;
ProfChatWin chatwin; ProfChatWin chatwin;
chatwin.window = window; chatwin.window = window;
chatwin.barejid = recipient; chatwin.barejid = recipient;