Skip to content

Commit 205796f

Browse files
authored
Merge pull request #2353 from The-OpenROAD-Project-staging/time-independent-build
Time independent build
2 parents 74df8de + d4d13dc commit 205796f

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

docker/Dockerfile.builder

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ COPY --link tools tools
1919
ARG numThreads=$(nproc)
2020
2121
RUN echo "" > tools/yosys/abc/.gitcommit && \
22+
env CFLAGS="-D__TIME__=0 -D__DATE__=0 -D__TIMESTAMP__=0 -Wno-builtin-macro-redefined" \
23+
CXXFLAGS="-D__TIME__=0 -D__DATE__=0 -D__TIMESTAMP__=0 -Wno-builtin-macro-redefined" \
2224
./build_openroad.sh --no_init --local --threads ${numThreads}
2325

2426
FROM orfs-base

docker/Dockerfile.dev

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ COPY InstallerOpenROAD.sh \
1313
/tmp/installer/tools/OpenROAD/etc/DependencyInstaller.sh
1414

1515
ARG options=""
16+
ARG constantBuildDir="-constant-build-dir"
1617

17-
RUN ./DependencyInstaller.sh $options \
18+
RUN env CFLAGS="-D__TIME__=0 -D__DATE__=0 -D__TIMESTAMP__=0 -Wno-builtin-macro-redefined" \
19+
CXXFLAGS="-D__TIME__=0 -D__DATE__=0 -D__TIMESTAMP__=0 -Wno-builtin-macro-redefined" \
20+
./DependencyInstaller.sh $options $constantBuildDir \
1821
&& rm -rf /tmp/installer /tmp/* /var/tmp/* /var/lib/apt/lists/*
1922

2023
ARG fromImage

etc/DependencyInstaller.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,15 @@ _installCommon() {
3636
pip3 install --no-cache-dir --user -U $pkgs
3737
fi
3838

39-
baseDir=$(mktemp -d /tmp/DependencyInstaller-orfs-XXXXXX)
39+
if [[ "$constantBuildDir" == "true" ]]; then
40+
baseDir="/tmp/DependencyInstaller-ORFS"
41+
if [[ -d "$baseDir" ]]; then
42+
echo "[INFO] Removing old building directory $baseDir"
43+
fi
44+
mkdir -p "$baseDir"
45+
else
46+
baseDir=$(mktemp -d /tmp/DependencyInstaller-orfs-XXXXXX)
47+
fi
4048

4149
# Install Verilator
4250
verilatorPrefix=`realpath ${PREFIX:-"/usr/local"}`
@@ -239,6 +247,9 @@ Usage: $0
239247
# sudo or with root access.
240248
$0 -ci
241249
# Installs CI tools
250+
$0 -constant-build-dir
251+
# Use constant build directory, instead of
252+
# random one.
242253
EOF
243254
exit "${1:-1}"
244255
}
@@ -251,6 +262,7 @@ PREFIX=""
251262
option="all"
252263
# default isLocal
253264
isLocal="false"
265+
constantBuildDir="false"
254266
CI="no"
255267

256268
# default values, can be overwritten by cmdline args
@@ -284,6 +296,10 @@ while [ "$#" -gt 0 ]; do
284296
OR_INSTALLER_ARGS="${OR_INSTALLER_ARGS} $1"
285297
PREFIX=${1#*=}
286298
;;
299+
-constant-build-dir)
300+
OR_INSTALLER_ARGS="${OR_INSTALLER_ARGS} $1"
301+
constantBuildDir="true"
302+
;;
287303
*)
288304
echo "unknown option: ${1}" >&2
289305
_help

etc/DockerHelper.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ baseDir="$(pwd)"
99
org=openroad
1010

1111
DOCKER_CMD="docker"
12+
noConstantBuildDir=""
1213

1314
_help() {
1415
cat <<EOF
@@ -32,6 +33,7 @@ usage: $0 [CMD] [OPTIONS]
3233
-password=PASSWORD Password to loging at the docker registry.
3334
-ci Install CI tools in image
3435
-dry-run Do not push images to the repository
36+
-no-constant-build-dir Do not use constant build directory
3537
-h -help Show this message and exits
3638
3739
EOF
@@ -67,7 +69,7 @@ _setup() {
6769
fromImage="${FROM_IMAGE_OVERRIDE:-$osBaseImage}"
6870
cp tools/OpenROAD/etc/DependencyInstaller.sh etc/InstallerOpenROAD.sh
6971
context="etc"
70-
buildArgs="--build-arg options=${options}"
72+
buildArgs="--build-arg options=${options} ${noConstantBuildDir}"
7173
;;
7274
*)
7375
echo "Target ${target} not found" >&2
@@ -202,6 +204,9 @@ while [ "$#" -gt 0 ]; do
202204
-tag=* )
203205
tag="${1#*=}"
204206
;;
207+
-no-constant-build-dir )
208+
noConstantBuildDir="--build-arg constantBuildDir= "
209+
;;
205210
-os | -target | -threads | -username | -password | -tag )
206211
echo "${1} requires an argument" >&2
207212
_help

tools/OpenROAD

0 commit comments

Comments
 (0)