diff --git a/.travis.yml b/.travis.yml index aeb2146eb..39543ad16 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,118 +1,23 @@ -# DESCRIPTION: Travis-CI config -# -# Copyright 2003-2020 by Wilson Snyder. This program is free software; you -# can redistribute it and/or modify it under the terms of either the GNU -# Lesser General Public License Version 3 or the Perl Artistic License -# Version 2.0. -# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 - -version: ~> 1.0 - -language: cpp - -cache: - directories: - - $HOME/.ccache - -env: - global: - - VERILATOR_ROOT=$TRAVIS_BUILD_DIR - -# The list and order of build stages -stages: - - build # Build Verilator - - test # Run tests +services: + - docker # Dump info about the environment for debugging before_install: - # To dump the script that Travis itself is executing, add 'cat $0' here - - cd "$TRAVIS_BUILD_DIR" # Skipping the git clone in later stages requires this - - export CCACHE_MAXSIZE=$(ci/travis-ccache-size.bash) # Set here after the 'cd' - - env | sort - - ls -lA . - - ls -lA bin - - g++ -E -dM -c -x c++ /dev/null | sort - - clang++ -E -dM -c -x c++ /dev/null | sort - -# Install all dependencies -install: - - ./ci/travis-install.bash - -before_script: - # ccache maintenance - - ./ci/travis-ccache-maint.bash - # On Focal, set the SystemC installation location - - | - if [ "$TRAVIS_DIST" = "focal" ]; then - export SYSTEMC_INCLUDE=/usr/include - export SYSTEMC_LIBDIR=/usr/lib/x86_64-linux-gnu - fi - -before_cache: - - ccache -s -z - -# All jobs run the same script -script: ./ci/travis-script.bash - -# Enumerate all the jobs -jobs: - include: - ############################################################################ - # Jobs in the 'build' stage - ############################################################################ - # GCC builds - - {stage: build, if: type = cron, os: linux, dist: trusty, compiler: gcc, workspaces: {create: {name: trusty-gcc, paths: .}}} - - {stage: build, if: type = cron, os: linux, dist: xenial, compiler: gcc, workspaces: {create: {name: xenial-gcc, paths: .}}} - - {stage: build, if: type = cron, os: linux, dist: bionic, compiler: gcc, workspaces: {create: {name: bionic-gcc, paths: .}}} - - {stage: build, os: linux, dist: focal, compiler: gcc, workspaces: {create: {name: focal-gcc, paths: .}}} - # Clang builds - - {stage: build, if: type = cron, os: linux, dist: xenial, compiler: clang, workspaces: {create: {name: xenial-clang, paths: .}}} - - {stage: build, os: linux, dist: focal, compiler: clang, workspaces: {create: {name: focal-clang, paths: .}}} - # Coverage build - - {stage: build, if: type = cron, os: linux, dist: focal, compiler: gcc, workspaces: {create: {name: coverage, paths: .}}, env: COVERAGE=1} - ############################################################################ - # Jobs in the 'test' stage - ############################################################################ - # GCC tests - - {stage: test, if: type = cron, os: linux, dist: trusty, compiler: gcc, workspaces: {use: trusty-gcc}, git: {clone: false}, env: TESTS=dist-vlt-0} - - {stage: test, if: type = cron, os: linux, dist: trusty, compiler: gcc, workspaces: {use: trusty-gcc}, git: {clone: false}, env: TESTS=dist-vlt-1} - - {stage: test, if: type = cron, os: linux, dist: trusty, compiler: gcc, workspaces: {use: trusty-gcc}, git: {clone: false}, env: TESTS=vltmt-0} - - {stage: test, if: type = cron, os: linux, dist: trusty, compiler: gcc, workspaces: {use: trusty-gcc}, git: {clone: false}, env: TESTS=vltmt-1} - - {stage: test, if: type = cron, os: linux, dist: xenial, compiler: gcc, workspaces: {use: xenial-gcc}, git: {clone: false}, env: TESTS=dist-vlt-0} - - {stage: test, if: type = cron, os: linux, dist: xenial, compiler: gcc, workspaces: {use: xenial-gcc}, git: {clone: false}, env: TESTS=dist-vlt-1} - - {stage: test, if: type = cron, os: linux, dist: xenial, compiler: gcc, workspaces: {use: xenial-gcc}, git: {clone: false}, env: TESTS=vltmt-0} - - {stage: test, if: type = cron, os: linux, dist: xenial, compiler: gcc, workspaces: {use: xenial-gcc}, git: {clone: false}, env: TESTS=vltmt-1} - - {stage: test, if: type = cron, os: linux, dist: bionic, compiler: gcc, workspaces: {use: bionic-gcc}, git: {clone: false}, env: TESTS=dist-vlt-0} - - {stage: test, if: type = cron, os: linux, dist: bionic, compiler: gcc, workspaces: {use: bionic-gcc}, git: {clone: false}, env: TESTS=dist-vlt-1} - - {stage: test, if: type = cron, os: linux, dist: bionic, compiler: gcc, workspaces: {use: bionic-gcc}, git: {clone: false}, env: TESTS=vltmt-0} - - {stage: test, if: type = cron, os: linux, dist: bionic, compiler: gcc, workspaces: {use: bionic-gcc}, git: {clone: false}, env: TESTS=vltmt-1} - - {stage: test, if: type != cron, os: linux, dist: focal, compiler: gcc, workspaces: {use: focal-gcc}, git: {clone: false}, env: TESTS=dist-vlt-0} - - {stage: test, if: type != cron, os: linux, dist: focal, compiler: gcc, workspaces: {use: focal-gcc}, git: {clone: false}, env: TESTS=dist-vlt-1} - - {stage: test, if: type = cron, os: linux, dist: focal, compiler: gcc, workspaces: {use: focal-gcc}, git: {clone: false}, env: TESTS=vltmt-0} - - {stage: test, if: type = cron, os: linux, dist: focal, compiler: gcc, workspaces: {use: focal-gcc}, git: {clone: false}, env: TESTS=vltmt-1} - # Clang tests - - {stage: test, if: type = cron, os: linux, dist: xenial, compiler: clang, workspaces: {use: xenial-clang}, git: {clone: false}, env: TESTS=dist-vlt-0} - - {stage: test, if: type = cron, os: linux, dist: xenial, compiler: clang, workspaces: {use: xenial-clang}, git: {clone: false}, env: TESTS=dist-vlt-1} - - {stage: test, if: type = cron, os: linux, dist: xenial, compiler: clang, workspaces: {use: xenial-clang}, git: {clone: false}, env: TESTS=vltmt-0} - - {stage: test, if: type = cron, os: linux, dist: xenial, compiler: clang, workspaces: {use: xenial-clang}, git: {clone: false}, env: TESTS=vltmt-1} - - {stage: test, if: type = cron, os: linux, dist: focal, compiler: clang, workspaces: {use: focal-clang}, git: {clone: false}, env: TESTS=dist-vlt-0} - - {stage: test, if: type = cron, os: linux, dist: focal, compiler: clang, workspaces: {use: focal-clang}, git: {clone: false}, env: TESTS=dist-vlt-1} - - {stage: test, if: type != cron, os: linux, dist: focal, compiler: clang, workspaces: {use: focal-clang}, git: {clone: false}, env: TESTS=vltmt-0} - - {stage: test, if: type != cron, os: linux, dist: focal, compiler: clang, workspaces: {use: focal-clang}, git: {clone: false}, env: TESTS=vltmt-1} - # Coverage tests - - {stage: test, if: type = cron, os: linux, dist: focal, compiler: gcc, workspaces: {use: coverage}, git: {clone: false}, env: TESTS=coverage-dist} - - {stage: test, if: type = cron, os: linux, dist: focal, compiler: gcc, workspaces: {use: coverage}, git: {clone: false}, env: TESTS=coverage-vlt-0} - - {stage: test, if: type = cron, os: linux, dist: focal, compiler: gcc, workspaces: {use: coverage}, git: {clone: false}, env: TESTS=coverage-vlt-1} - - {stage: test, if: type = cron, os: linux, dist: focal, compiler: gcc, workspaces: {use: coverage}, git: {clone: false}, env: TESTS=coverage-vlt-2} - - {stage: test, if: type = cron, os: linux, dist: focal, compiler: gcc, workspaces: {use: coverage}, git: {clone: false}, env: TESTS=coverage-vlt-3} - - {stage: test, if: type = cron, os: linux, dist: focal, compiler: gcc, workspaces: {use: coverage}, git: {clone: false}, env: TESTS=coverage-vltmt-0} - - {stage: test, if: type = cron, os: linux, dist: focal, compiler: gcc, workspaces: {use: coverage}, git: {clone: false}, env: TESTS=coverage-vltmt-1} - - {stage: test, if: type = cron, os: linux, dist: focal, compiler: gcc, workspaces: {use: coverage}, git: {clone: false}, env: TESTS=coverage-vltmt-2} - - {stage: test, if: type = cron, os: linux, dist: focal, compiler: gcc, workspaces: {use: coverage}, git: {clone: false}, env: TESTS=coverage-vltmt-3} - -notifications: - email: - if: repo = verilator/verilator - recipients: - - wsnyder@wsnyder.org - - todd.strader@gmail.com + - docker build -f Dockerfile.ubuntu -t verilator-ubuntu . + - docker build -f Dockerfile.centos -t verilator-centos . + +script: + - docker run --rm -e PACKAGE_VERSION=${TRAVIS_TAG:-0.0-UNTAGGED} -v $PWD:/usr/src/app verilator-ubuntu ./build-deb.sh + - docker run --rm -e PACKAGE_VERSION=${TRAVIS_TAG:-0.0-UNTAGGED} -v $PWD:/usr/src/app verilator-centos ./build-rpm.sh + +deploy: + provider: releases + api_key: + secure: "jr4NxwYNXdG7GfPbTwoIXUeY7NxPFbKfo29CW8tt67dBI+clIN/EhNJKQ05qtS5gvmGamVQxhD5rZ0g2Fb7crJSk3oI6196WcYLTNDvp2pl+IanYyPYRucQdAxwd7L0/uyaz9E74IGfr3tlzzDqvlUhOWEZC6cGiIHL0t2Fi6YRpMzes7o/E4T2TvzRvSs/mqYP4sWpeUjK7NjXjqlbHhOPEGxfTwgY+lglPRmNo4A1nYJK7Kv7uGQJ675ye6aF643uX15W/uwetdEUoa08ObF7GiIsLdiv7NXAZgohoqBXeqoRuax+Xc0af4xn+lD0ix4sFxTqOR/XXawjEeVCpQtFI4knTkMIwyDr78EabLu7efxvBaeIwT3ZPET0ayOLMfFUf0SG7pPMIkrmY8T4TVR2mwzodncn4Ym/rKg1HClI3Pf58B1/+fgnAmqbHfW4KFNrVzBd2/2F4Xz0GCZAB9OoeBmQb044Ixy7ccX/zVgcypLkrY/4mWjx7IMBHC4P8Xpepz7jheWZfBr+HS/aD3U6ErjOkELK/EbECKtO/NBEEQj2KanPsmHU4HhdexhIu1KYyjoq+1p8oczZb5uD4BgwprRZhVNJXlV71G5Rrz5DFT6U0MHkLWJe5QiZtZE+WPRAMrtJWTXFjjDSmEGyNlI10R/qvFiB09LTXDmtPH1Q=" + file: + - verilator_${TRAVIS_TAG}_amd64.deb + - verilator-${TRAVIS_TAG}.x86_64.rpm + skip_cleanup: true + on: + repo: sifive/verilator + tags: true diff --git a/Dockerfile.centos b/Dockerfile.centos new file mode 100644 index 000000000..ff3a5b549 --- /dev/null +++ b/Dockerfile.centos @@ -0,0 +1,15 @@ +FROM centos:7 +RUN yum update -y && yum install -y \ + autoconf \ + bison \ + flex \ + gcc-c++ \ + git \ + glibc-static \ + libstdc++-static \ + perl-version \ + perl-Digest-MD5 \ + rsync \ + rpm-build \ + make +WORKDIR /usr/src/app diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu new file mode 100644 index 000000000..4132f1417 --- /dev/null +++ b/Dockerfile.ubuntu @@ -0,0 +1,8 @@ +FROM ubuntu:16.04 +RUN apt-get update && apt-get install -y \ + autoconf \ + bison \ + flex \ + g++ \ + make +WORKDIR /usr/src/app diff --git a/README.adoc b/README.adoc index a77349e97..4162e2ce3 100644 --- a/README.adoc +++ b/README.adoc @@ -1,4 +1,27 @@ // Github doesn't render images unless absolute URL + += SIFIVE FORK NOTES +This is a fork of the Verilator project which adds some steps for automatically +creating .deb and .rpm packages from a release tag. Travis is configured to +run a build and upload a release to GitHub whenever a tag is created. You can +simply cherry-pick the latest commit on top of a real Verilator release and +create a tag from that. + +[source,sh] +---- +# Note: You should replace 4.028 with whichever version you are trying to use. +git remote add verilator git@github.com:verilator/verilator.git +git fetch verilator +git checkout v4.028 +git cherry-pick origin/master -X theirs +git tag 4.028-0sifive1 +git push origin 4.028-0sifive1 +---- + +For posterity, the old `master` branch from this SiFive fork with the old +instructions for performing a release is available at +https://github.com/sifive/verilator/tree/old-master-2018-02-02. + :!toc: ifdef::env-github[] diff --git a/build-deb.sh b/build-deb.sh new file mode 100755 index 000000000..4b1d56c90 --- /dev/null +++ b/build-deb.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -eux + +pkg_arch=amd64 +pkg_dir=$(realpath ./verilator_${PACKAGE_VERSION}_${pkg_arch}) + +autoconf +./configure +make clean +make +make test +make install DESTDIR=$pkg_dir + +mkdir $pkg_dir/DEBIAN +cat << EOF > $pkg_dir/DEBIAN/control +Package: verilator +Version: ${PACKAGE_VERSION} +Architecture: ${pkg_arch} +Maintainer: Richard Xia +Depends: perl (>= 5.22.1) +Description: fast free Verilog simulator +EOF + +dpkg-deb --build $pkg_dir diff --git a/build-rpm.sh b/build-rpm.sh new file mode 100755 index 000000000..1733ffcb5 --- /dev/null +++ b/build-rpm.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +set -eux + +pkg_arch=x86_64 +pkg_distro=centos +pkg_dir=$(realpath ./verilator_${PACKAGE_VERSION}_${pkg_arch}_${pkg_distro}) + +pkg_version=$(echo ${PACKAGE_VERSION} | cut -d- -f1) +pkg_release=$(echo ${PACKAGE_VERSION} | cut -d- -f2) + +autoconf +./configure +make clean +make +make test +make install DESTDIR=$pkg_dir + +cat << EOF > verilator.spec +Name: verilator +Version: ${pkg_version} +Release: ${pkg_release} +Requires: perl >= 5.2.11 +Summary: Verilog HDL simulator +License: Perl Artistic License and GNU Lesser General Public License + +%description +Verilog HDL simulator + +%prep + +%build + +%install +rsync -a ${pkg_dir}/ %buildroot/ + +%files +%defattr(0644, root,root) +%attr(0755, root,root) /usr/local/bin/verilator* +/usr/local/share/man/man1/verilator* +/usr/local/share/pkgconfig/verilator.pc +/usr/local/share/verilator/* +EOF + +rpmbuild -bb verilator.spec +cp /root/rpmbuild/RPMS/${pkg_arch}/verilator-${PACKAGE_VERSION}.${pkg_arch}.rpm ./