Skip to content

Commit

Permalink
Migrate build system to Meson
Browse files Browse the repository at this point in the history
Meson provides a significant build speed up. It is also conceptually simpler
than autotools.
  • Loading branch information
npmccallum committed Apr 17, 2018
1 parent d844408 commit e7bc250
Show file tree
Hide file tree
Showing 18 changed files with 284 additions and 303 deletions.
34 changes: 34 additions & 0 deletions .travis.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash -ex

case "$1" in
before_install)
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
docker create \
--name=$TRAVIS_COMMIT -t \
-v `pwd`:/tmp/build \
-w /tmp/build \
$DISTRO /bin/cat
docker start $TRAVIS_COMMIT
fi
;;

after_script)
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
docker kill $TRAVIS_COMMIT
docker rm $TRAVIS_COMMIT
fi
;;

*)
if [ -x ./.travis.$1 ]; then
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
docker exec \
`bash <(curl -s https://codecov.io/env)` \
-e CC -e DISTRO \
$TRAVIS_COMMIT ./.travis.$1
else
./.travis.$1
fi
fi
;;
esac
23 changes: 7 additions & 16 deletions .travis.install
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash -ex

COMMON="automake autoconf libtool curl git make file bzip2 $CC"
COMMON="meson curl git make file bzip2 $CC"

case "$DISTRO" in
osx:*)
brew update
for pkg in jansson openssl zlib; do
for pkg in jansson openssl zlib meson; do
brew ls --versions $pkg || brew install $pkg
brew outdated $pkg || brew upgrade $pkg || true
done
Expand All @@ -29,31 +29,22 @@ case "$DISTRO" in
done

while ! apt-get -y install $COMMON \
build-essential pkg-config libssl-dev zlib1g-dev; do
build-essential pkg-config libssl-dev zlib1g-dev libjansson-dev; do
sleep 5
done
;;

fedora:*)
dnf -y clean all
dnf -y --setopt=deltarpm=0 update
dnf -y install $COMMON pkgconfig openssl-devel zlib-devel jansson-devel
dnf -y install $COMMON pkgconfig openssl-devel zlib-devel jansson-devel findutils
;;

centos:*)
LIBDIRPATH=--libdir=/usr/lib64
yum -y clean all
yum -y --setopt=deltarpm=0 update
yum -y install $COMMON pkgconfig openssl-devel zlib-devel
sed -i 's|libcrypto >= 1\.0\.2|libcrypto >= 1\.0\.1|' configure.ac
yum -y install epel-release
yum -y install $COMMON pkgconfig openssl-devel zlib-devel jansson-devel findutils gcc
sed -i 's|>=1\.0\.2|>=1\.0\.1|' meson.build
;;
esac

if [[ ! "$DISTRO" =~ ^fedora: ]] && [[ ! "$DISTRO" =~ ^osx: ]]; then
curl -s http://www.digip.org/jansson/releases/jansson-2.10.tar.bz2 | tar xvjC /tmp
pushd /tmp/jansson-2.10
./configure --prefix=/usr $LIBDIRPATH
make -j8
make install
popd
fi
31 changes: 19 additions & 12 deletions .travis.script
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
#!/bin/bash -ex

[[ ! "$DISTRO" =~ ^osx: ]] && export CFLAGS=-coverage
[[ ! "$DISTRO" =~ ^osx: ]] && export LDFLAGS=-lgcov
function findexe() {
while [ $# -gt 0 ]; do
while read -d: path; do
[ -f "$path/$1" -a -x "$path/$1" ] && echo "$path/$1" && return 0
done <<< "$PATH:"
shift
done
return 1
}

autoreconf -if
LC_ALL=`locale -a | grep -i '^en_US\.utf'` || LC_ALL=`locale -a | grep -i '^c\.utf'`
export LC_ALL

mkdir build
cd build

if ! ../configure --prefix=/usr --libdir=/usr/lib64 --disable-openmp; then
cat ./config.log
exit 1
fi
export CFLAGS="-g -coverage"

make -j8 -k check V=1 TESTS=

if ! make -j8 check; then
cat ./tests/test-suite.log
if ! meson ..; then
cat meson-logs/meson-log.txt >&2
exit 1
fi

bash <(curl -s https://codecov.io/bash)
ninja=`findexe ninja ninja-build`
"$ninja" test

bash <(curl -s https://codecov.io/bash) 2>&1 \
| egrep -v "has arcs (to entry|from exit) block"
46 changes: 8 additions & 38 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,17 @@ language: c

matrix:
include:
- osx_image: xcode8.1
- osx_image: xcode9.3
compiler: clang
os: osx
env:
- DISTRO=osx:xcode8.1
- DISTRO=osx:xcode9.3
- PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig:/usr/local/opt/zlib/lib/pkgconfig
- osx_image: xcode8
- osx_image: xcode8.3
compiler: clang
os: osx
env:
- DISTRO=osx:xcode8
- PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig:/usr/local/opt/zlib/lib/pkgconfig
- osx_image: xcode7.3
compiler: clang
os: osx
env:
- DISTRO=osx:xcode7.3
- PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig:/usr/local/opt/zlib/lib/pkgconfig
- osx_image: xcode6.4
compiler: clang
os: osx
env:
- DISTRO=osx:xcode6.4
- DISTRO=osx:xcode8.3
- PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig:/usr/local/opt/zlib/lib/pkgconfig

compiler:
Expand All @@ -42,26 +30,8 @@ env:
- DISTRO=debian:unstable
- DISTRO=debian:testing
- DISTRO=ubuntu:devel
- DISTRO=ubuntu:latest

before_install:
- >
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
docker create --name=jose -t -v `pwd`:/tmp/build -w /tmp/build $DISTRO /bin/cat
docker start jose
fi
install:
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then DOCKER="docker exec jose"; fi
- $DOCKER /usr/bin/env CC=$CC DISTRO=$DISTRO ./.travis.install

script:
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then DOCKER="docker exec jose"; fi
- $DOCKER /usr/bin/env CC=$CC DISTRO=$DISTRO ./.travis.script

after_script:
- >
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
docker kill jose
docker rm jose
fi
before_install: ./.travis.docker before_install
install: ./.travis.docker install
script: ./.travis.docker script
after_script: ./.travis.docker after_script
4 changes: 0 additions & 4 deletions Makefile.am

This file was deleted.

27 changes: 0 additions & 27 deletions cmd/Makefile.am

This file was deleted.

27 changes: 27 additions & 0 deletions cmd/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
executable(meson.project_name(),
'jose.c', 'jose.h',
'b64/b64.h',
'b64/dec.c',
'b64/enc.c',
'jwk/jwk.h',
'jwk/eql.c',
'jwk/exc.c',
'jwk/gen.c',
'jwk/pub.c',
'jwk/thp.c',
'jwk/use.c',
'jws/jws.h',
'jws/fmt.c',
'jws/sig.c',
'jws/ver.c',
'jwe/jwe.h',
'jwe/pwd.h',
'jwe/fmt.c',
'jwe/dec.c',
'jwe/enc.c',
'alg.c',
'fmt.c',
dependencies: jansson,
link_with: libjose,
install: true
)
65 changes: 0 additions & 65 deletions configure.ac

This file was deleted.

28 changes: 0 additions & 28 deletions doc/Makefile.am

This file was deleted.

25 changes: 25 additions & 0 deletions doc/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
install_man(
'ronn/jose.1',
'ronn/jose-alg.1',
'ronn/jose-fmt.1',
'ronn/jose-b64-dec.1',
'ronn/jose-b64-enc.1',
'ronn/jose-jwe-dec.1',
'ronn/jose-jwe-enc.1',
'ronn/jose-jwe-fmt.1',
'ronn/jose-jwk-exc.1',
'ronn/jose-jwk-gen.1',
'ronn/jose-jwk-pub.1',
'ronn/jose-jwk-thp.1',
'ronn/jose-jwk-use.1',
'ronn/jose-jws-fmt.1',
'ronn/jose-jws-sig.1',
'ronn/jose-jws-ver.1',
'doxygen/man/man3/jose_b64.3',
'doxygen/man/man3/jose_jwk.3',
'doxygen/man/man3/jose_jws.3',
'doxygen/man/man3/jose_cfg.3',
'doxygen/man/man3/jose_jwe.3',
'doxygen/man/man3/jose_io_t.3',
'doxygen/man/man3/jose_io.3',
)
12 changes: 0 additions & 12 deletions jose.pc.in

This file was deleted.

10 changes: 0 additions & 10 deletions jose/Makefile.am

This file was deleted.

Loading

0 comments on commit e7bc250

Please sign in to comment.