diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000000..072b611117e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +# Travis CI integration for p4c using Docker. + +services: + - docker + +install: + - docker build -t p4c . + +script: + - docker run -w /p4c/build p4c sh -c 'make check VERBOSE=1 -j8' + # We should enable this once 'make cpplint' comes back clean. + # - docker run -w /p4c/build p4c sh -c 'make cpplint' diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000000..813df85eb00 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM ubuntu:14.04 +MAINTAINER Seth Fowler + +# Install dependencies. +RUN apt-get update && \ + apt-get install -y \ + automake \ + bison \ + build-essential \ + flex \ + g++ \ + git \ + libboost-dev \ + libgc-dev \ + libgmp-dev \ + libtool \ + python2.7 \ + python-ipaddr \ + python-scapy \ + tcpdump + +# Copy entire repository. +COPY . /p4c/ +WORKDIR /p4c/ + +# Build. +RUN ./bootstrap.sh && \ + cd build && \ + make -j8 diff --git a/README.md b/README.md index 347c306556f..2075ac9fe60 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Build Status](https://travis-ci.org/p4lang/p4c.svg?branch=master)](https://travis-ci.org/p4lang/p4c) + This folder contains the C++ source code for the P4-16 compiler. This is a reference implementation of a compiler for the 2016 version of the P4 programming language, also called P4-16. The P4-16 draft spec @@ -125,6 +127,21 @@ make check -j4 We recommend using `clang++` with no optimizations for speeding up compilation and simplifying debugging. +# Docker + +A Dockerfile is included. You can generate an image which contains a copy of p4c +in `/p4c/build` by running: + +``` +docker build -t p4c . +``` + +On some platforms Docker limits the memory usage of any container, even +containers used during the `docker build` process. On macOS in particular the +default is 2GB, which is not enough to build p4c. Increase the memory limit to +at least 4GB via Docker preferences or you are likely to see "internal compiler +errors" from gcc which are caused by low memory. + ## Additional documentation More documentation is in [docs/README.md](docs/README.md)