]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Add build/ci_build.sh for automatic building on Travis CI, Jenkins, etc.
authorMartin Matuska <martin@matuska.org>
Fri, 14 Oct 2016 12:31:23 +0000 (14:31 +0200)
committerMartin Matuska <martin@matuska.org>
Fri, 14 Oct 2016 14:28:37 +0000 (16:28 +0200)
Add autotools build to .travis.yml
Downgrade minimal supported autoconf version to 2.68 (Travis CI)

.travis.yml
build/ci_build.sh [new file with mode: 0755]
configure.ac

index c9323986a92d897da0ca7a778b22f51eb44b512e..8abca99b754d9f2585ac9a8baa5c3fd56845b229 100644 (file)
@@ -3,18 +3,14 @@ sudo: true
 compiler:
   - gcc
   - clang
+env:
+  - BUILD_SYSTEM=cmake
+  - BUILD_SYSTEM=autotools
 before_install:
-  - sudo add-apt-repository ppa:kubuntu-ppa/backports -y
-  - sudo apt-get update -qq
+  - if [ "${BUILD_SYSTEM}" = "cmake" ]; then sudo add-apt-repository ppa:kubuntu-ppa/backports -y; fi
+  - if [ "${BUILD_SYSTEM}" = "cmake" ]; then sudo apt-get update -qq; fi
 install:
-  - sudo apt-get install -y cmake=2.8.12.2-0ubuntu1~ubuntu12.04.1~ppa2
+  - if [ "${BUILD_SYSTEM}" = "cmake" ]; then sudo apt-get install -y cmake=2.8.12.2-0ubuntu1~ubuntu12.04.1~ppa2; fi
   - sudo apt-get install -y libbz2-dev libzip-dev liblzma-dev
-before_script:
-  - BUILD_DIR=`pwd`/BUILD
-  - mkdir -p ${BUILD_DIR}
-  - cd ${BUILD_DIR}
-  - cmake ..
 script:
-  - cd ${BUILD_DIR}
-  - make
-  - make test
+  - build/ci_build.sh
diff --git a/build/ci_build.sh b/build/ci_build.sh
new file mode 100755 (executable)
index 0000000..624e09c
--- /dev/null
@@ -0,0 +1,103 @@
+#!/bin/sh
+#
+# Automated build and test of libarchive on CI systems
+#
+# Variables that can be passed via environment:
+# BUILD_SYSTEM=
+# BUILDDIR=
+# SRCDIR=
+# CONFIGURE_ARGS=
+# MAKE_ARGS=
+#
+
+ACTIONS=
+BUILD_SYSTEM="${BUILD_SYSTEM:-autotools}"
+CURDIR=`pwd`
+SRCDIR="${SRCDIR:-`pwd`}"
+RET=0
+
+usage () {
+       echo "Usage: $0 [-b autotools|cmake] [-a autogen|configure|build|test ] [ -a ... ] [ -d builddir ] [-s srcdir ]"
+}
+inputerror () {
+       echo $1
+       usage
+       exit 1
+}
+while getopts a:b:d:s: opt; do
+       case ${opt} in
+               a)
+                       case "${OPTARG}" in
+                               autogen) ;;
+                               configure) ;;
+                               build) ;;
+                               test) ;;
+                               *) inputerror "Invalid action (-a)" ;;
+                       esac
+                       ACTIONS="${ACTIONS} ${OPTARG}"
+               ;;
+               b) BUILD_SYSTEM="${OPTARG}"
+                       case "${BUILD_SYSTEM}" in
+                               autotools) ;;
+                               cmake) ;;
+                               *) inputerror "Invalid build system (-b)" ;;
+                       esac
+               ;;
+               d)
+                       BUILDDIR="${OPTARG}"
+               ;;
+               s)
+                       SRCDIR="${OPTARG}"
+                       if [ ! -f "${SRCDIR}/build/version" ]; then
+                               inputerror "Missing file: ${SRCDIR}/build/version"
+                       fi
+               ;;
+       esac
+done
+if [ -z "${ACTIONS}" ]; then
+       ACTIONS="autogen configure build test"
+fi
+if [ -z "${BUILD_SYSTEM}" ]; then
+       inputerror "Missing type (-t) parameter"
+fi
+if [ -z "${BUILDDIR}" ]; then
+       BUILDDIR="${CURDIR}/BUILD/${BUILD_SYSTEM}"
+fi
+mkdir -p "${BUILDDIR}"
+for action in ${ACTIONS}; do
+       cd "${BUILDDIR}"
+       case "${action}" in
+               autogen)
+                       case "${BUILD_SYSTEM}" in
+                               autotools)
+                                       cd "${SRCDIR}"
+                                       sh build/autogen.sh
+                                       RET="$?"
+                               ;;
+                       esac
+               ;;
+               configure)
+                       case "${BUILD_SYSTEM}" in
+                               autotools) "${SRCDIR}/configure" ${CONFIGURE_ARGS} ;;
+                               cmake) cmake ${CONFIGURE_ARGS} "${SRCDIR}" ;;
+                       esac
+                       RET="$?"
+               ;;
+               build)
+                       make ${MAKE_ARGS}
+                       RET="$?"
+               ;;
+               test)
+                       case "${BUILD_SYSTEM}" in
+                               autotools) make ${MAKE_ARGS} check ;;
+                               cmake) make ${MAKE_ARGS} test ;;
+                       esac
+                       RET="$?"
+               ;;
+       esac
+       if [ "${RET}" != "0" ]; then
+               exit "${RET}"
+       fi
+       cd "${CURDIR}"
+done
+exit "${RET}"
index fc82b0ef9d5fcf49fc94dabef26f8d4d23ff8332..3d1cda79debdee9afb7765c03ae1f53e9e3b66f4 100644 (file)
@@ -12,7 +12,7 @@ m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S())
 m4_define([BSDCPIO_VERSION_S],LIBARCHIVE_VERSION_S())
 m4_define([BSDCAT_VERSION_S],LIBARCHIVE_VERSION_S())
 
-AC_PREREQ([2.69])
+AC_PREREQ([2.68])
 
 #
 # Now starts the "real" configure script.