about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--.github/FUNDING.yml12
-rw-r--r--.travis.yml45
-rw-r--r--Brewfile.travis20
-rw-r--r--Dockerfile.arch58
-rw-r--r--Dockerfile.debian49
-rw-r--r--Dockerfile.tumbleweed (renamed from Dockerfile)28
-rwxr-xr-xbootstrap.sh2
-rw-r--r--src/command/cmd_funcs.c14
-rwxr-xr-xtravis-build.sh180
9 files changed, 266 insertions, 142 deletions
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 00000000..416b4ddb
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,12 @@
+# These are supported funding model platforms
+
+github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
+patreon: jubalh
+open_collective: # Replace with a single Open Collective username
+ko_fi: # Replace with a single Ko-fi username
+tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
+community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
+liberapay: # Replace with a single Liberapay username
+issuehunt: # Replace with a single IssueHunt username
+otechie: # Replace with a single Otechie username
+custom: # Replace with a single custom sponsorship URL
diff --git a/.travis.yml b/.travis.yml
index abdeaa98..ed87ab56 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,10 +1,47 @@
 sudo: required
-language: c
+language: bash
+
 services:
-  - docker
+  - docker # Linux tests are run in Docker containers.
+
+addons:
+  homebrew:
+    brewfile: Brewfile.travis # mac OS dependencies.
+    # libsignal-protocol-c is still not in the Travis CI Homebrew snapshot, the
+    # line below could be removed when the snapshot has been updated to speed up
+    # the OSX job.
+    update: true
+
+matrix:
+  include:
+    - os: linux
+      env: BUILD_FLAVOR=tumbleweed
+    - os: linux
+      env: BUILD_FLAVOR=debian
+    - os: linux
+      env: BUILD_FLAVOR=arch
+    - os: osx
+      env:
+        # Ensure that "keg-only" Homebrew versions are used.
+        - PKG_CONFIG_PATH="/usr/local/opt/ncurses/lib/pkgconfig:$PKG_CONFIG_PATH"
+        - PKG_CONFIG_PATH="/usr/local/opt/expat/lib/pkgconfig:$PKG_CONFIG_PATH"
+        - PKG_CONFIG_PATH="/usr/local/opt/curl/lib/pkgconfig:$PKG_CONFIG_PATH"
+        - PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig:$PKG_CONFIG_PATH"
+        - PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig:$PKG_CONFIG_PATH"
 
 before_install:
-  - docker build -f Dockerfile -t profanity .
+  - if [ "$TRAVIS_OS_NAME" = "linux" ]; then
+      docker build -f Dockerfile."$BUILD_FLAVOR" -t profanity .;
+    fi
 
 script:
-- docker run -it profanity ./travis-build.sh
+  - if [ "$TRAVIS_OS_NAME" = "linux" ]; then
+      docker run -it profanity ./travis-build.sh;
+    fi
+  - if [ "$TRAVIS_OS_NAME" = "osx" ]; then
+      ./travis-build.sh;
+    fi
+
+after_failure:
+  - cat ./config.log
+  - env
diff --git a/Brewfile.travis b/Brewfile.travis
new file mode 100644
index 00000000..e6743e03
--- /dev/null
+++ b/Brewfile.travis
@@ -0,0 +1,20 @@
+brew 'autoconf'
+brew 'autoconf-archive'
+brew 'automake'
+brew 'check'
+brew 'curl'
+brew 'expat'
+brew 'glib'
+brew 'gnutls'
+brew 'gpgme'
+brew 'gtk+'
+brew 'libffi'
+brew 'libotr'
+brew 'libsignal-protocol-c'
+brew 'libstrophe'
+brew 'libtool'
+brew 'ncurses'
+brew 'openssl'
+brew 'ossp-uuid'
+brew 'pkg-config'
+brew 'readline'
diff --git a/Dockerfile.arch b/Dockerfile.arch
new file mode 100644
index 00000000..4e0eee6d
--- /dev/null
+++ b/Dockerfile.arch
@@ -0,0 +1,58 @@
+FROM archlinux/base
+
+RUN pacman -Syu --noconfirm && pacman -S --needed --noconfirm \
+  autoconf \
+  autoconf-archive \
+  automake \
+  base-devel \
+  check \
+  cmake \
+  cmocka \
+  curl \
+  doxygen \
+  expat \
+  gcc \
+  git \
+  gpgme \
+  gtk2 \
+  libgcrypt \
+  libmicrohttpd \
+  libnotify \
+  libotr \
+  libtool \
+  libxss \
+  make \
+  openssl \
+  pkg-config \
+  python \
+  wget
+
+RUN mkdir -p /usr/src/{stabber,profanity}
+
+RUN useradd -mb /usr/src --shell=/bin/false aur && usermod -L aur
+USER aur
+
+WORKDIR /usr/src/aur
+RUN wget https://aur.archlinux.org/cgit/aur.git/snapshot/libstrophe-git.tar.gz
+RUN wget https://aur.archlinux.org/cgit/aur.git/snapshot/libsignal-protocol-c.tar.gz
+RUN tar -zxvf libstrophe-git.tar.gz
+RUN tar -zxvf libsignal-protocol-c.tar.gz
+RUN pushd libstrophe-git && makepkg && popd
+RUN pushd libsignal-protocol-c && makepkg && popd
+
+USER root
+
+RUN pacman -U --noconfirm libstrophe-git/libstrophe-git-*.pkg.tar.xz
+RUN pacman -U --noconfirm libsignal-protocol-c/libsignal-protocol-c-*.pkg.tar.xz
+
+WORKDIR /usr/src
+RUN git clone git://github.com/boothj5/stabber.git
+
+WORKDIR /usr/src/stabber
+RUN ./bootstrap.sh
+RUN ./configure --prefix=/usr --disable-dependency-tracking
+RUN make
+RUN make install
+
+WORKDIR /usr/src/profanity
+COPY . /usr/src/profanity
diff --git a/Dockerfile.debian b/Dockerfile.debian
new file mode 100644
index 00000000..29ceae80
--- /dev/null
+++ b/Dockerfile.debian
@@ -0,0 +1,49 @@
+# Build the latest Debian testing image
+FROM debian:testing
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+  autoconf \
+  autoconf-archive \
+  automake \
+  expect \
+  gcc \
+  git \
+  libcmocka-dev \
+  libcurl3-dev \
+  libgcrypt-dev \
+  libglib2.0-dev \
+  libgpgme11-dev \
+  libgtk2.0-dev \
+  libmicrohttpd-dev \
+  libncursesw5-dev \
+  libnotify-dev \
+  libotr5-dev \
+  libreadline-dev \
+  libsignal-protocol-c-dev \
+  libssl-dev \
+  libtool \
+  libxss-dev \
+  make \
+  pkg-config \
+  python-dev
+
+RUN mkdir -p /usr/src/{stabber,libmesode,profanity}
+WORKDIR /usr/src
+
+RUN git clone git://github.com/boothj5/stabber.git
+RUN git clone git://github.com/profanity-im/libmesode.git
+
+WORKDIR /usr/src/stabber
+RUN ./bootstrap.sh
+RUN ./configure --prefix=/usr --disable-dependency-tracking
+RUN make
+RUN make install
+
+WORKDIR /usr/src/libmesode
+RUN ./bootstrap.sh
+RUN ./configure --prefix=/usr
+RUN make
+RUN make install
+
+WORKDIR /usr/src/profanity
+COPY . /usr/src/profanity
diff --git a/Dockerfile b/Dockerfile.tumbleweed
index f0106b7f..9acf4cce 100644
--- a/Dockerfile
+++ b/Dockerfile.tumbleweed
@@ -5,35 +5,35 @@ FROM opensuse/tumbleweed
 # libmicrohttpd - for stabber
 # glibc-locale - to have en_US locale
 RUN zypper --non-interactive in --no-recommends \
-  git \
-  gcc \
   autoconf \
   autoconf-archive \
-  make \
   automake \
-  libtool \
+  expect-devel \
+  gcc \
+  git \
   glib2-devel \
+  glibc-locale \
   gtk2-devel \
-  expect-devel \
   libXss-devel \
+  libcmocka-devel \
   libcurl-devel \
   libexpat-devel \
+  libgcrypt-devel \
   libgpgme-devel \
   libmesode-devel \
+  libmicrohttpd-devel \
   libnotify-devel \
   libotr-devel \
+  libsignal-protocol-c-devel \
+  libtool \
   libuuid-devel \
-  libcmocka-devel \
+  make \
   ncurses-devel \
-  python3-devel \
-  python3 \
-  python-devel \
   python \
-  readline-devel \
-  libsignal-protocol-c-devel \
-  libgcrypt-devel \
-  libmicrohttpd-devel \
-  glibc-locale
+  python-devel \
+  python3 \
+  python3-devel \
+  readline-devel
 
 # https://github.com/openSUSE/docker-containers-build/issues/26
 ENV LANG en_US.UTF-8
diff --git a/bootstrap.sh b/bootstrap.sh
index abae7294..80624f20 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -1,4 +1,4 @@
 #!/bin/sh
 
 mkdir -p m4
-autoreconf -i $@
+autoreconf -i "$@"
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index ae3bda0b..9688cb09 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -6555,12 +6555,20 @@ cmd_autoconnect(ProfWin *window, const char *const command, gchar **args)
         prefs_set_string(PREF_CONNECT_ACCOUNT, NULL);
         cons_show("Autoconnect account disabled.");
     } else if (strcmp(args[0], "set") == 0) {
-        prefs_set_string(PREF_CONNECT_ACCOUNT, args[1]);
-        cons_show("Autoconnect account set to: %s.", args[1]);
+        if (args[1] == NULL || strlen(args[1]) == 0) {
+            cons_bad_cmd_usage(command);
+        } else {
+            if (accounts_account_exists(args[1])) {
+                prefs_set_string(PREF_CONNECT_ACCOUNT, args[1]);
+                cons_show("Autoconnect account set to: %s.", args[1]);
+            } else {
+                cons_show_error("Account '%s' does not exist.", args[1]);
+            }
+        }
     } else {
         cons_bad_cmd_usage(command);
     }
-    return true;
+    return TRUE;
 }
 
 gboolean
diff --git a/travis-build.sh b/travis-build.sh
index aa88105a..10ba684f 100755
--- a/travis-build.sh
+++ b/travis-build.sh
@@ -13,123 +13,63 @@ trap error_handler ERR
 
 ./bootstrap.sh
 
-echo
-echo "--> Building with ./configure --enable-notifications --enable-icons --enable-otr --enable-pgp --enable-omemo --enable-plugins --enable-c-plugins --enable-python-plugins --with-xscreensaver"
-echo
-./configure --enable-notifications --enable-icons --enable-otr --enable-pgp --enable-omemo --enable-plugins --enable-c-plugins --enable-python-plugins --with-xscreensaver
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-notifications --disable-icons --disable-otr --disable-pgp --disable-omemo --disable-plugins --disable-c-plugins --disable-python-plugins --without-xscreensaver"
-echo
-./configure --disable-notifications --disable-icons --disable-otr --disable-pgp --disable-omemo --disable-plugins --disable-c-plugins --disable-python-plugins --without-xscreensaver
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-notifications"
-echo
-./configure --disable-notifications
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-icons"
-echo
-./configure --disable-icons
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-otr"
-echo
-./configure --disable-otr
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-pgp"
-echo
-./configure --disable-pgp
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-omemo"
-echo
-./configure --disable-omemo
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-pgp --disable-otr"
-echo
-./configure --disable-pgp --disable-otr
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-pgp --disable-otr --disable-omemo"
-echo
-./configure --disable-pgp --disable-otr --disable-omemo
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-plugins"
-echo
-./configure --disable-plugins
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-python-plugins"
-echo
-./configure --disable-python-plugins
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-c-plugins"
-echo
-./configure --disable-c-plugins
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-c-plugins --disable-python-plugins"
-echo
-./configure --disable-c-plugins --disable-python-plugins
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --without-xscreensaver"
-echo
-./configure --without-xscreensaver
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure"
-echo
-./configure
-make
-make check
-./profanity -v
-make clean
+tests=()
+case $(uname | tr '[:upper:]' '[:lower:]') in
+    linux*)
+        tests=(
+        "--enable-notifications --enable-icons --enable-otr --enable-pgp
+        --enable-omemo --enable-plugins --enable-c-plugins
+        --enable-python-plugins --with-xscreensaver"
+        "--disable-notifications --disable-icons --disable-otr --disable-pgp
+        --disable-omemo --disable-plugins --disable-c-plugins
+        --disable-python-plugins --without-xscreensaver"
+        "--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"
+        "--without-xscreensaver"
+        "")
+        ;;
+    darwin*)
+        tests=(
+        "--enable-notifications --enable-icons --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"
+        "")
+        ;;
+esac
+
+for flags in "${tests[@]}"
+do
+    echo
+    echo "--> Building with ./configure $flags"
+    echo
+    # shellcheck disable=SC2086
+    ./configure $flags
+    make
+    ./profanity -v
+    make clean
+
+    echo "$flags"
+done