aboutsummaryrefslogtreecommitdiffstats
path: root/build-aux/travis-build.sh
blob: d03cafde148bf3a679a5ab10bdb3d65cdec2c9f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash

set -ex

rm -rf build
mkdir -p build

MAKE_TARGET="${TARGET}"

if [[ "x${TARGET}" = xw* ]]; then
    unset CC
    export CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4"
    export CHOST="x86_64-w64-mingw32"
    [[ "x${TARGET}" = "xw32" ]] && export CHOST="i686-w64-mingw32"
    MAKE_TARGET="all"
else
    export CFLAGS="-Wall -g"
    export CONFIGURE_ARGS="--enable-tests --enable-valgrind"
fi

pushd build > /dev/null

../configure \
    ${CHOST:+--host=${CHOST} --target=${CHOST}} \
    --enable-ronn \
    --with-squareball=internal \
    --disable-silent-rules \
    ${CONFIGURE_ARGS}

popd > /dev/null

make -C build "${MAKE_TARGET}"

if [[ "x${TARGET}" = xw* ]]; then
    TARNAME="$(grep PACKAGE_TARNAME build/config.h | cut -d\" -f2)"
    VERSION="$(grep PACKAGE_VERSION build/config.h | cut -d\" -f2)"
    DEST_DIR="${TARNAME}-${VERSION}-${TARGET}"

    rm -rf "${DEST_DIR}"
    mkdir -p "${DEST_DIR}"

    cp build/.libs/blogc.exe "${DEST_DIR}/"
    cp LICENSE "${DEST_DIR}/"
    cp README.md "${DEST_DIR}/"

    zip "build/${DEST_DIR}.zip" "${DEST_DIR}"/*
fi