diff options
author | Tristan Gingold <tgingold@free.fr> | 2017-08-27 04:42:47 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2017-08-27 04:42:47 +0200 |
commit | babffb119ed9b7f8659083d120216d44340714ca (patch) | |
tree | 4d2c51feda1917da554f47e8d31e37faa6a0ad26 /dist/linux | |
parent | 8342d5af61fc7c936c3f1f8354f3332d47a636b1 (diff) | |
download | ghdl-babffb119ed9b7f8659083d120216d44340714ca.tar.gz ghdl-babffb119ed9b7f8659083d120216d44340714ca.tar.bz2 ghdl-babffb119ed9b7f8659083d120216d44340714ca.zip |
travis: add gpl packaging
Diffstat (limited to 'dist/linux')
-rwxr-xr-x | dist/linux/buildtest.sh | 116 | ||||
-rw-r--r-- | dist/linux/docker/build-stretch+mcode+gpl | 7 | ||||
-rwxr-xr-x | dist/linux/travis-ci.sh | 74 |
3 files changed, 131 insertions, 66 deletions
diff --git a/dist/linux/buildtest.sh b/dist/linux/buildtest.sh index a9116e4eb..696aa93bc 100755 --- a/dist/linux/buildtest.sh +++ b/dist/linux/buildtest.sh @@ -18,18 +18,18 @@ for arg in "$@"; do case "$arg" in "--color"|"-color") set -- "$@" "-c";; "--build"|"-build") set -- "$@" "-b";; - "--file"|"-file") set -- "$@" "-f";; - "--taskid"|"-taskid") set -- "$@" "-t";; + "--pkg"|"-pkg") set -- "$@" "-p";; + "--gpl"|"-gpl") set -- "$@" "-g";; *) set -- "$@" "$arg" esac done # Parse args -while getopts ":b:f:t:c" opt; do +while getopts ":b:p:cg" opt; do case $opt in c) enable_color;; b) BLD=$OPTARG ;; - f) PKG_FILE=$OPTARG;; - t) TASK=$OPTARG;; + p) PKG_NAME=$OPTARG;; + g) ISGPL=true;; \?) printf "$ANSI_RED[GHDL] Invalid option: -$OPTARG $ANSI_NOCOLOR\n" >&2 exit 1 ;; :) printf "$ANSI_RED[GHDL] Option -$OPTARG requires an argument. $ANSI_NOCOLOR\n" >&2 @@ -37,26 +37,40 @@ while getopts ":b:f:t:c" opt; do esac done -#--- - -printf "$ANSI_YELLOW[Prepare] $(pwd) $ANSI_NOCOLOR\n" -CDIR=$(pwd) -prefix="$CDIR/install-$BLD" -mkdir "$prefix" -mkdir "build-$BLD" -cd "build-$BLD" - #--- Env -echo "travis_fold:start:env.$TASK" +echo "travis_fold:start:env.docker" printf "$ANSI_YELLOW[Info] Environment $ANSI_NOCOLOR\n" env -echo "travis_fold:end:env.$TASK" +echo "travis_fold:end:env.docker" + +#--- GPL: gpl-ize sources + +if [ "$ISGPL" = "true" ]; then + echo "travis_fold:start:gpl.src" + printf "$ANSI_YELLOW[Source] create GPL sources $ANSI_NOCOLOR\n" + files=`echo *` + sed -e 's/@abs_srcdir@/./g' < Makefile.in > Makefile.tmp + make -f Makefile.tmp clean-pure-gpl + rm -f Makefile.tmp + mkdir ${PKG_NAME} + cp -pdrl $files ${PKG_NAME} + tar -zcf "${PKG_NAME}.tar.gz" ${PKG_NAME} + PKG_NAME="${PKG_NAME}-${BLD}" + echo "travis_fold:end:gpl.src" +fi #--- Configure -echo "travis_fold:start:configure.$TASK" +echo "travis_fold:start:configure" printf "$ANSI_YELLOW[GHDL] Configure $ANSI_NOCOLOR\n" + +CDIR=$(pwd) +prefix="$CDIR/install-$BLD" +mkdir "$prefix" +mkdir "build-$BLD" +cd "build-$BLD" + case "$BLD" in mcode) config_opts="" ;; @@ -70,34 +84,34 @@ case "$BLD" in echo "Check docker container!" exit 0;; *) - echo "$ANSI_RED[$TASK| GHDL - build] Unknown build $BLD $ANSI_NOCOLOR" + echo "$ANSI_RED[GHDL - build] Unknown build $BLD $ANSI_NOCOLOR" exit 1;; esac echo "../configure --prefix=$prefix $config_opts" ../configure "--prefix=$prefix" $config_opts -echo "travis_fold:end:configure.$TASK" +echo "travis_fold:end:configure" #--- make -echo "travis_fold:start:make.$TASK" +echo "travis_fold:start:make" travis_time_start printf "$ANSI_YELLOW[GHDL] Make $ANSI_NOCOLOR\n" make travis_time_finish -echo "travis_fold:end:make.$TASK" +echo "travis_fold:end:make" -echo "travis_fold:start:install.$TASK" +echo "travis_fold:start:install" printf "$ANSI_YELLOW[GHDL] Install $ANSI_NOCOLOR\n" make install cd .. -echo "travis_fold:end:install.$TASK" +echo "travis_fold:end:install" #--- package -echo "travis_fold:start:tar.$TASK" -printf "$ANSI_YELLOW[GHDL] Create package $ANSI_DARKCYAN$PKG_FILE $ANSI_NOCOLOR\n" -tar -zcvf "$PKG_FILE" -C "$prefix" . -echo "travis_fold:end:tar.$TASK" +echo "travis_fold:start:tar.bin" +printf "$ANSI_YELLOW[GHDL] Create package ${ANSI_DARKCYAN}${PKG_NAME}.tgz $ANSI_NOCOLOR\n" +tar -zcvf "${PKG_NAME}.tgz" -C "$prefix" . +echo "travis_fold:end:tar.bin" #--- test @@ -106,18 +120,17 @@ export GHDL="$prefix/bin/ghdl" cd testsuite failures="" -echo "travis_fold:start:tests.gna.$TASK" +echo "travis_fold:start:tests.sanity" travis_time_start -printf "$ANSI_YELLOW[Test] gna $ANSI_NOCOLOR\n" -cd gna -dirs=`./testsuite.sh --list-tests` -for d in $dirs; do +printf "$ANSI_YELLOW[Test] sanity $ANSI_NOCOLOR\n" +cd sanity +for d in [0-9]*; do cd $d if ./testsuite.sh > test.log 2>&1 ; then - echo "gna $d: ok" + echo "sanity $d: ok" # Don't disp log else - echo "${ANSI_RED}gna $d: failed${ANSI_NOCOLOR}" + echo "${ANSI_RED}sanity $d: failed${ANSI_NOCOLOR}" cat test.log failures="$failures $d" fi @@ -127,10 +140,36 @@ for d in $dirs; do done cd .. travis_time_finish -echo "travis_fold:end:tests.gna.$TASK" +echo "travis_fold:end:tests.sanity" [ "$failures" = "" ] || exit 1 -echo "travis_fold:start:tests.vests.$TASK" +if [ "$ISGPL" != "true" ]; then + echo "travis_fold:start:tests.gna" + travis_time_start + printf "$ANSI_YELLOW[Test] gna $ANSI_NOCOLOR\n" + cd gna + dirs=`./testsuite.sh --list-tests` + for d in $dirs; do + cd $d + if ./testsuite.sh > test.log 2>&1 ; then + echo "gna $d: ok" + # Don't disp log + else + echo "${ANSI_RED}gna $d: failed${ANSI_NOCOLOR}" + cat test.log + failures="$failures $d" + fi + cd .. + # Stop at the first failure + [ "$failures" = "" ] || break + done + cd .. + travis_time_finish + echo "travis_fold:end:tests.gna" + [ "$failures" = "" ] || exit 1 +fi + +echo "travis_fold:start:tests.vests" travis_time_start printf "$ANSI_YELLOW[Test] vests $ANSI_NOCOLOR\n" cd vests @@ -144,7 +183,7 @@ else fi cd .. travis_time_finish -echo "travis_fold:end:tests.vests.$TASK" +echo "travis_fold:end:tests.vests" [ "$failures" = "" ] || exit 1 $GHDL --version @@ -152,6 +191,5 @@ cd .. #--- -# Do not remove this line, and don't write anything below, since it is used to identify successful builds -echo "[$TASK|SUCCESSFUL]" +echo "[SUCCESSFUL]" touch build_ok diff --git a/dist/linux/docker/build-stretch+mcode+gpl b/dist/linux/docker/build-stretch+mcode+gpl new file mode 100644 index 000000000..2830f0769 --- /dev/null +++ b/dist/linux/docker/build-stretch+mcode+gpl @@ -0,0 +1,7 @@ +# Debian 9 +FROM debian:stretch-slim + +RUN apt-get update -qq \ + && apt-get -y install --no-install-recommends \ + gnat gcc make zlib1g-dev \ + && apt-get clean diff --git a/dist/linux/travis-ci.sh b/dist/linux/travis-ci.sh index a3eaf78df..659171d12 100755 --- a/dist/linux/travis-ci.sh +++ b/dist/linux/travis-ci.sh @@ -6,12 +6,17 @@ set -e . dist/ansi_color.sh #disable_color + # Display env (to debug) + echo -en "travis_fold:start:travis_env\r" printf "$ANSI_YELLOW[TRAVIS] Travis environment $ANSI_NOCOLOR\n" env | grep TRAVIS echo -en "travis_fold:end:travis_env\r" + +# Compute package name + PKG_SHORTCOMMIT="$(printf $TRAVIS_COMMIT | cut -c1-10)" PKG_VER=`grep Ghdl_Ver src/version.in | sed -e 's/.*"\(.*\)";/\1/'` PKG_TAG="$TRAVIS_TAG" @@ -19,45 +24,60 @@ if [ -z "$TRAVIS_TAG" ]; then PKG_TAG="$(date -u +%Y%m%d)-$PKG_SHORTCOMMIT"; fi -# OS-X +if [ "$IMAGE" = "" ]; then + echo "IMAGE not defined" + exit 1 +fi + +IFS='+' read -ra REFS <<< "$IMAGE" +DDIST=${REFS[0]} +DBLD=${REFS[1]} +DGPL=${REFS[2]} + +PKG_NAME="ghdl-${PKG_TAG}-${DBLD}-${DDIST}" +BUILD_CMD="./dist/linux/buildtest.sh $ENABLECOLOR -b $DBLD" +if [ "$DGPL" = "gpl" ]; then + BUILD_CMD="$BUILD_CMD --gpl" + PKG_NAME="ghdl-gpl-${PKG_TAG}" +fi +BUILD_CMD="${BUILD_CMD} -p $PKG_NAME" + +echo "build cmd: $BUILD_CMD" + +# Build if [ "$TRAVIS_OS_NAME" = "osx" ]; then + # Install gnat compiler (use cache) ./dist/macosx/install-ada.sh || exit 1 PATH=$PWD/gnat/bin:$PATH - DBLD=mcode - DDIST=macosx - ./dist/linux/buildtest.sh $ENABLECOLOR -t 0 -b "$DBLD" -f "ghdl-$PKG_TAG-$DBLD-$DDIST.tgz" - exit -fi -if [ "$DOCKER_IMAGE" = "" ]; then - echo "DOCKER_IMAGE not defined" - exit 1 -fi + bash -c "$BUILD_CMD" +else + # Assume linux -IFS='+' read -ra REFS <<< "$DOCKER_IMAGE" -DBLD=${REFS[1]} -DDIST=${REFS[0]} + # Create docker image + + . ./dist/linux/travis-utils.sh + + echo "travis_fold:start:create" + travis_time_start + printf "$ANSI_YELLOW[DOCKER build] Docker build $ANSI_NOCOLOR\n" -. ./dist/linux/travis-utils.sh + DOCKERFILE="dist/linux/docker/build-$IMAGE" -# Execute build and test in docker container -echo "travis_fold:start:create" -travis_time_start -printf "$ANSI_YELLOW[DOCKER build] Docker build $ANSI_NOCOLOR\n" + echo "dockerfile: $DOCKERFILE" + DOCKER_NAME=`echo $IMAGE | sed -e 's/+/-/g'` -DOCKERFILE="dist/linux/docker/build-$DOCKER_IMAGE" -DOCKERCMD="./dist/linux/buildtest.sh $ENABLECOLOR -t 0 -b $DBLD -f ghdl-${PKG_TAG}-${DBLD}-${DDIST}.tgz" + docker build -t $DOCKER_NAME - < $DOCKERFILE + travis_time_finish + echo "travis_fold:end:create" -echo "dockerfile: $DOCKERFILE" -echo "docker cmd: $DOCKERCMD" -DOCKER_NAME=`echo $DOCKER_IMAGE | sed -e 's/+/-/g'` -docker build -t $DOCKER_NAME - < $DOCKERFILE -travis_time_finish -echo "travis_fold:end:create" + # Run build+test in docker + + docker run --rm --tty --volume $(pwd):/work -w "/work" $DOCKER_NAME bash -c "$BUILD_CMD" +fi -docker run --rm --tty --volume $(pwd):/work -w "/work" $DOCKER_NAME bash -c "$DOCKERCMD" ls -l ghdl-* |