Daniele Moro | 7928055 | 2020-12-15 14:13:51 +0100 | [diff] [blame^] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | PROFILE=$1 |
| 6 | OTHER_FLAGS=$2 |
| 7 | |
| 8 | SRC_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" |
| 9 | |
| 10 | echo |
| 11 | echo "## Compiling profile ${PROFILE} in ${SRC_DIR}..." |
| 12 | |
| 13 | # Using stable-20210108 because stable doesn't support @p4runtime_translation annotations |
| 14 | dockerImage=opennetworking/p4c:stable-20210108 |
| 15 | dockerRun="docker run --rm -w ${SRC_DIR} -v ${SRC_DIR}:${SRC_DIR} ${dockerImage}" |
| 16 | |
| 17 | |
| 18 | # Generate BMv2 JSON and P4Info. |
| 19 | (set -x; ${dockerRun} p4c-bm2-ss --arch v1model \ |
| 20 | ${OTHER_FLAGS} \ |
| 21 | --p4runtime-files ${SRC_DIR}/${PROFILE}_p4info.txt ${PROFILE}.p4) |