Skip to content

Commit

Permalink
Add scripts for building .deb and .rpm packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
richardxia authored and michaeljclark committed Feb 7, 2018
1 parent 1b12800 commit 3bb94c4
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
services:
- docker

before_install:
- 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: ltStIEenLA7CgOv5Y48614kqf48d3zyPxsRDeT78dFSb/obmnMarafaYVjCWpn/1/NI3YLcEHkmrenousB/oU9d8GNIAK81pElBzzIEj0ZvFvpV/fS0+Dwk6N8EjWKbECkkeka2jL7B7ycGkkcHgd8VoCGsuMjNVFXetmxC5q1GRaXQ3Yh3xDXDmcQh402w3p/AR2sEo6cjZFUIfjHtVyTILKkMk1LQp5kdcHoAOJrFE5KNnCOJFutT51jJc+tp9IWNuqjNOcekMCgdYZ4i1BMGtBb2nqA1m4oZyECgnBD7HoB2swaRv9ro4HjHBnnuaaaOX03UTcGwY5i1ccQB0JDwjQruFR8LehqSoVHBUu+dvJ40XuhCIkAAQ/O9e27289p4Y2Zrsxd2W5fFIxUFCFMYqVG+LjKEpwYq0V+TTPTPx58pT749h2wAAuJH7YKVbbbIorzkmqcHuDr86PQ+60gfPbH76iUUcem39WDvEnVNywDPhNEOxgxJx6pVAHsJD15YAWChH+TbDQkXm4M5L+fghuoywoyESzO1JkckTjSYkGZd1ouhtNFKY8wKYPVXGBLXs0Agi6tF+gwKZfyi3gqDIXXD0eKqW4K2RvEtJQh1xt5s8zh826CdBxBEygOO0iIIuheDjOep/jl34NOi0WvfzxLbDaibGUhg52LCkgMQ=
file:
- verilator_${TRAVIS_TAG}_amd64.deb
- verilator-${TRAVIS_TAG}.x86_64.rpm
skip_cleanup: true
on:
repo: sifive/verilator
tags: true
11 changes: 11 additions & 0 deletions Dockerfile.centos
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM centos:7
RUN yum update -y && yum install -y \
autoconf \
bison \
flex \
gcc-c++ \
git \
rsync \
rpm-build \
make
WORKDIR /usr/src/app
8 changes: 8 additions & 0 deletions Dockerfile.ubuntu
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions README.pod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@

=pod

=head1 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.

=head1 NAME

This is the Verilator package README file.
Expand Down
25 changes: 25 additions & 0 deletions build-deb.sh
Original file line number Diff line number Diff line change
@@ -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 <rxia@sifive.com>
Depends: perl (>= 5.22.1)
Description: fast free Verilog simulator
EOF

dpkg-deb --build $pkg_dir
46 changes: 46 additions & 0 deletions build-rpm.sh
Original file line number Diff line number Diff line change
@@ -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 ./

0 comments on commit 3bb94c4

Please sign in to comment.