-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
145 lines (122 loc) · 5.62 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Copyright 2023 by the SpinalHDL Docker contributors
# SPDX-License-Identifier: GPL-3.0-only
#
# Author(s): Pavel Benacek <[email protected]>
# Leuenberger Niklaus <https://github.com/NikLeberg>
ARG UBUNTU_VERSION=22.04
FROM ubuntu:$UBUNTU_VERSION AS base
ENV DEBIAN_FRONTEND=noninteractive LANG=C.UTF-8 LC_ALL=C.UTF-8 PATH="$PATH:/opt/bin"
ARG COURSIER_CACHE_DEFAULT="/sbt/.cache/coursier/v1"
ARG SBT_OPTS_DEFAULT="-Dsbt.override.build.repos=true -Dsbt.boot.directory=/sbt/.sbt/boot -Dsbt.global.base=/sbt/.sbt -Dsbt.ivy.home=/sbt/.ivy2 -Duser.home=/sbt -Dsbt.global.localcache=/sbt/.sbt/cache"
ENV COURSIER_CACHE=$COURSIER_CACHE_DEFAULT
ENV SBT_OPTS=$SBT_OPTS_DEFAULT
ARG DEPS_RUNTIME="ca-certificates gnupg2 openjdk-17-jdk-headless ccache curl g++ gcc git libtcl8.6 python3 python3-pip python3-pip-whl libpython3-dev ssh locales make libgnat-10 iverilog libboost1.74-dev"
RUN apt-get update && \
apt-get install -y --no-install-recommends $DEPS_RUNTIME
FROM base AS build-symbiyosys
ENV PREFIX=/opt
ARG DEPS_YOSYS="autoconf build-essential clang cmake libffi-dev libreadline-dev pkg-config tcl-dev unzip flex bison gnat libz-dev"
RUN apt-get install -y --no-install-recommends $DEPS_YOSYS
ARG YOSYS_VERSION="yosys-0.41"
RUN git clone https://github.com/YosysHQ/yosys.git yosys && \
cd yosys && \
git checkout $YOSYS_VERSION && \
make PREFIX=$PREFIX -j$(nproc) && \
make PREFIX=$PREFIX install && \
cd .. && \
rm -Rf yosys
ARG SOLVERS_PATH="snapshot-20221212/ubuntu-22.04-bin.zip"
RUN mkdir solver && cd solver && \
curl -o solvers.zip -sL "https://github.com/GaloisInc/what4-solvers/releases/download/${SOLVERS_PATH}" && \
unzip solvers.zip && \
rm solvers.zip && \
chmod +x * && \
cp cvc4 $PREFIX/bin/cvc4 && \
cp cvc5 $PREFIX/bin/cvc5 && \
cp z3 $PREFIX/bin/z3 && \
cp yices $PREFIX/bin/yices && \
cp yices-smt2 $PREFIX/bin/yices-smt2 && \
cd .. && rm -rf solver
ARG BOOLECTOR_VERSION="3.2.2"
RUN curl -L "https://github.com/Boolector/boolector/archive/refs/tags/$BOOLECTOR_VERSION.tar.gz" \
| tar -xz \
&& cd boolector-$BOOLECTOR_VERSION \
&& ./contrib/setup-lingeling.sh \
&& ./contrib/setup-btor2tools.sh \
&& ./configure.sh --prefix $PREFIX \
&& make PREFIX=$PREFIX -C build -j$(nproc) \
&& make PREFIX=$PREFIX -C build install \
&& cd .. \
&& rm -Rf boolector-$BOOLECTOR_VERSION
ARG SYMBIYOSYS_VERSION="yosys-0.41"
RUN git clone https://github.com/YosysHQ/sby.git SymbiYosys && \
cd SymbiYosys && \
git checkout $SYMBIYOSYS_VERSION && \
make PREFIX=$PREFIX -j$(nproc) install && \
cd .. && \
rm -Rf SymbiYosys
ARG GHDL_VERSION="f5b887f"
RUN git clone https://github.com/ghdl/ghdl ghdl && \
cd ghdl && \
git checkout $GHDL_VERSION && \
mkdir build && \
cd build && \
../configure --prefix=$PREFIX && \
make && \
make install && \
cd ../.. && \
rm -Rf ghdl
ARG GHDL_PLUGIN_VERSION="0c4740a"
RUN git clone https://github.com/ghdl/ghdl-yosys-plugin.git ghdl-yosys-plugin && \
cd ghdl-yosys-plugin && \
git reset $GHDL_PLUGIN_VERSION --hard && \
make YOSYS_PREFIX=$PREFIX install && \
cd .. && \
rm -Rf ghdl-yosys-plugin
FROM base AS build-verilator
ENV PREFIX=/opt
ARG DEPS_VERILATOR="perl make autoconf g++ flex bison ccache libgoogle-perftools-dev numactl perl-doc libfl2 libfl-dev zlib1g zlib1g-dev"
RUN apt-get install -y --no-install-recommends $DEPS_VERILATOR
ARG VERILATOR_VERSION="v4.228"
RUN git clone https://github.com/verilator/verilator verilator && \
cd verilator && \
git checkout $VERILATOR_VERSION && \
autoconf && \
./configure --prefix $PREFIX && \
make PREFIX=$PREFIX -j$(nproc) && \
make PREFIX=$PREFIX install && \
cd ../.. && \
rm -Rf verilator
FROM base AS build-spinal
# # Add repos and install sbt
# RUN curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" \
# | gpg2 --dearmour -o /usr/share/keyrings/sdb-keyring.gpg \
# && echo "deb [arch=amd64 signed-by=/usr/share/keyrings/sdb-keyring.gpg] https://repo.scala-sbt.org/scalasbt/debian all main" \
# | tee /etc/apt/sources.list.d/sbt.list \
# && echo "deb [arch=amd64 signed-by=/usr/share/keyrings/sdb-keyring.gpg] https://repo.scala-sbt.org/scalasbt/debian /" \
# | tee /etc/apt/sources.list.d/sbt_old.list \
# && apt update && apt install sbt
ARG MILL_VERSION="0.10.9"
RUN \
curl -L -o /usr/local/bin/mill https://github.com/lihaoyi/mill/releases/download/$MILL_VERSION/$MILL_VERSION && \
chmod +x /usr/local/bin/mill && \
touch build.sc && \
mill -i resolve _ && \
rm build.sc
FROM base AS run
RUN pip install cocotb==1.8.1 cocotb-test click && \
pip cache purge
# Add repos and install sbt
RUN curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" \
| gpg2 --dearmour -o /usr/share/keyrings/sdb-keyring.gpg \
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/sdb-keyring.gpg] https://repo.scala-sbt.org/scalasbt/debian all main" \
| tee /etc/apt/sources.list.d/sbt.list \
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/sdb-keyring.gpg] https://repo.scala-sbt.org/scalasbt/debian /" \
| tee /etc/apt/sources.list.d/sbt_old.list \
&& apt update && apt install sbt && apt clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/*
RUN git config --system --add safe.directory '*'
COPY --from=build-symbiyosys /opt /opt
COPY --from=build-verilator /opt /opt
COPY --from=build-spinal /opt /opt
COPY --from=build-spinal /usr/local/bin/mill /opt/bin/mill
# COPY --from=build-spinal /sbt /sbt