File size: 4,372 Bytes
d664931
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# syntax=docker/dockerfile:1.7-labs

# Target with dependencies to build all flow tools from their sources.
# i.e., "./build_openroad.sh --local" from inside a docker container
# NOTE: don't use this file directly unless you know what you are doing,
# instead use etc/DockerHelper.sh

ARG fromImage=openroad/flow-ubuntu26.04-dev:latest
# Image holding the prebuilt tools/install of every tool except OpenROAD
# (a build of the orfs-tools target). By default they are built here.
ARG toolsImage=orfs-tools

FROM $fromImage AS orfs-base

WORKDIR /OpenROAD-flow-scripts
COPY --link dev_env.sh dev_env.sh
COPY --link build_openroad.sh build_openroad.sh

FROM orfs-base AS orfs-builder-base

# Add compiler wrapper scripts for reproducible builds
COPY --link etc/setup_compiler_wrappers.sh /tmp/
RUN sh /tmp/setup_compiler_wrappers.sh && rm /tmp/setup_compiler_wrappers.sh

# Prepend wrapper directory to PATH so they override system compilers
ENV PATH="/usr/local/bin/wrapped-cc:$PATH"

FROM orfs-builder-base AS orfs-tools-builder

# Exclude install so a local build's output (e.g. tools/install/OpenROAD)
# cannot leak into the image; the build below starts from an empty install.
COPY --link --exclude=OpenROAD --exclude=AutoTuner --exclude=install tools tools
COPY --link etc/kepler-formal etc/kepler-formal
ARG numThreads=$(nproc)
ARG verificPath=""

RUN <<EOF
set -e
echo "" > tools/yosys/abc/.gitcommit
if [ -n "${verificPath}" ]; then
    verificArgs="--with-verific ${verificPath}"
else
    verificArgs=""
fi
./build_openroad.sh --no_init \
                    --local \
                    --skip_openroad \
                    --threads ${numThreads} \
                    ${verificArgs}
if [ -n "${verificPath}" ]; then
    rm -rf "${verificPath}"
fi
EOF

# Collect LICENSE files from tool source trees into the install directory so
# they are available in the final image.
RUN find /OpenROAD-flow-scripts/tools \( -name "*LICENSE*" -o -name "*LICENSES*" \) \
    | grep -v '^/OpenROAD-flow-scripts/tools/install/' \
    | while IFS= read -r f; do \
        rel="${f#/OpenROAD-flow-scripts/tools/}"; \
        mkdir -p "/OpenROAD-flow-scripts/tools/install/licenses/$(dirname "$rel")"; \
        cp -r "$f" "/OpenROAD-flow-scripts/tools/install/licenses/$rel"; \
    done

# Yosys, kepler-formal and their licenses, without sources or build trees.
FROM orfs-base AS orfs-tools

COPY --link --from=orfs-tools-builder /OpenROAD-flow-scripts/tools/install tools/install

FROM $toolsImage AS tools

FROM orfs-builder-base AS orfs-openroad-builder

COPY --link --from=tools /OpenROAD-flow-scripts/tools/install tools/install
COPY --link tools/OpenROAD tools/OpenROAD
ARG numThreads=$(nproc)

RUN <<EOF
set -e
./build_openroad.sh --no_init \
                    --local \
                    --openroad_only \
                    --threads ${numThreads}
if [ ! -x tools/install/OpenROAD/bin/openroad ]; then
    echo "Error: tools/install/OpenROAD/bin/openroad is missing or not executable." >&2
    exit 1
fi
EOF

# tools/OpenROAD/openroad/sta is excluded because it is covered by a separate
# commercial license agreement.
RUN find /OpenROAD-flow-scripts/tools/OpenROAD \( -name "*LICENSE*" -o -name "*LICENSES*" \) \
    | grep -v '/OpenROAD/openroad/sta/' \
    | while IFS= read -r f; do \
        rel="${f#/OpenROAD-flow-scripts/tools/}"; \
        mkdir -p "/OpenROAD-flow-scripts/tools/install/licenses/$(dirname "$rel")"; \
        cp -r "$f" "/OpenROAD-flow-scripts/tools/install/licenses/$rel"; \
    done

FROM orfs-base

# The order for copying the directories is based on the frequency of changes (ascending order),
# and the layer size (descending order)
COPY --link docker docker
COPY --link flow/tutorials flow/tutorials
COPY --link docs docs
COPY --link flow/test flow/test
COPY --link flow/platforms flow/platforms
COPY --link flow/util flow/util
COPY --link flow/scripts flow/scripts
COPY --link flow/designs flow/designs
COPY --link tools/AutoTuner tools/AutoTuner
COPY --link tools/FakeRAM2.0 tools/FakeRAM2.0

COPY --link --from=orfs-openroad-builder /OpenROAD-flow-scripts/tools/install tools/install
COPY --link \
     --exclude=.git* --exclude=tools/ --exclude=docs/ --exclude=docker/ \
     --exclude=flow/designs --exclude=flow/platforms --exclude=flow/scripts \
     --exclude=flow/test --exclude=flow/tutorials --exclude=flow/util \
  . ./