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 | |
parent | 8342d5af61fc7c936c3f1f8354f3332d47a636b1 (diff) | |
download | ghdl-babffb119ed9b7f8659083d120216d44340714ca.tar.gz ghdl-babffb119ed9b7f8659083d120216d44340714ca.tar.bz2 ghdl-babffb119ed9b7f8659083d120216d44340714ca.zip |
travis: add gpl packaging
-rw-r--r-- | .travis.yml | 14 | ||||
-rw-r--r-- | Makefile.in | 17 | ||||
-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 | ||||
-rwxr-xr-x | testsuite/testsuite.sh | 2 | ||||
-rwxr-xr-x | testsuite/vests/testsuite.sh | 6 |
7 files changed, 158 insertions, 78 deletions
diff --git a/.travis.yml b/.travis.yml index f18d0cb71..0d40d5d33 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,24 +10,30 @@ matrix: dist: trusty sudo: required services: docker - env: DOCKER_IMAGE=stretch+mcode + env: IMAGE=stretch+mcode - os: linux dist: trusty sudo: required services: docker - env: DOCKER_IMAGE=ubuntu14+mcode + env: IMAGE=stretch+mcode+gpl - os: linux dist: trusty sudo: required services: docker - env: DOCKER_IMAGE=ubuntu14+llvm-3.8 + env: IMAGE=ubuntu14+mcode - os: linux dist: trusty sudo: required services: docker - env: DOCKER_IMAGE=fedora26+mcode + env: IMAGE=ubuntu14+llvm-3.8 + - os: linux + dist: trusty + sudo: required + services: docker + env: IMAGE=fedora26+mcode - os: osx osx_image: xcode7.3 + env: IMAGE=macosx+mcode cache: directories: - gnat diff --git a/Makefile.in b/Makefile.in index 23770e800..77d14b878 100644 --- a/Makefile.in +++ b/Makefile.in @@ -408,10 +408,20 @@ install.vpi: all.vpi install.dirs LIBSRC_DIR:=$(srcdir)/libraries LIBDST_DIR:=$(libdirsuffix) -VHDLLIB_SUBDIRS= src/std src/ieee src/vital95 src/vital2000 src/synopsys src/mentor src/ieee2008 src/openieee \ +VHDLLIB_SUBDIRS_COMMON= src/std src/synopsys src/openieee \ v87/std v87/ieee v87/synopsys \ - v93/std v93/ieee v93/mentor v93/synopsys \ - v08/std v08/ieee v08/synopsys + v93/std v93/ieee v93/synopsys \ + v08/std + +VHDLLIB_SUBDIRS_FULL= src/ieee src/vital95 src/vital2000 src/mentor \ + src/ieee2008 \ + v93/mentor v08/ieee v08/synopsys + +ifeq ($(enable_openieee),false) +VHDLLIB_SUBDIRS=$(VHDLLIB_SUBDIRS_COMMON) $(VHDLLIB_SUBDIRS_FULL) +else +VHDLLIB_SUBDIRS=$(VHDLLIB_SUBDIRS_COMMON) +endif install.dirs: # Use -p to create parents and to avoid error if existing. @@ -422,6 +432,7 @@ install.dirs: $(MKDIR) -p $(DESTDIR)$(incdir) install.vhdllib: install.dirs +# Libraries (only if not empty) for d in $(VHDLLIB_SUBDIRS); do \ $(MKDIR) -p $(DESTDIR)$(VHDL_LIB_DIR)/$$d; \ $(INSTALL_DATA) -p \ 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-* diff --git a/testsuite/testsuite.sh b/testsuite/testsuite.sh index 43f6d369a..0720a629b 100755 --- a/testsuite/testsuite.sh +++ b/testsuite/testsuite.sh @@ -16,8 +16,6 @@ done if [ x$tests = x ]; then tests="gna vests"; fi -printf "$ANSI_BLUE[$TASK| GHDL - test] Sourced the testsuite environment $ANSI_NOCOLOR\n" - # The GNA testsuite: regression testsuite using reports/issues from gna.org do_gna() { cd gna diff --git a/testsuite/vests/testsuite.sh b/testsuite/vests/testsuite.sh index bb6ef76a1..655fcf007 100755 --- a/testsuite/vests/testsuite.sh +++ b/testsuite/vests/testsuite.sh @@ -191,13 +191,13 @@ deletelibs() { delete_lib utilities } -printf "$ANSI_BLUE[$TASK| GHDL - test] vests: ashenden $ANSI_NOCOLOR\n" +printf "$ANSI_BLUE[GHDL - test] vests: ashenden $ANSI_NOCOLOR\n" test_ashenden # Clean frequently the work library. do_inter_clean="yes" -printf "$ANSI_BLUE[$TASK| GHDL - test] vests: billowitch $ANSI_NOCOLOR\n" +printf "$ANSI_BLUE[GHDL - test] vests: billowitch $ANSI_NOCOLOR\n" test_billowitch -printf "$ANSI_BLUE[$TASK| GHDL - test] vests: delete libs $ANSI_NOCOLOR\n" +printf "$ANSI_BLUE[GHDL - test] vests: delete libs $ANSI_NOCOLOR\n" deletelibs # Remove io files created by tests |