Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 40 additions & 31 deletions pkgs/by-name/op/openroad/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
lib,
stdenv,
fetchFromGitHub,
yaml-cpp,

# nativeBuildInputs
bison,
Expand All @@ -13,12 +14,13 @@
libsForQt5,
pkg-config,
swig,
versionCheckHook,

# buildInputs
boost186, # 1.87.0 broken https://github.com/boostorg/asio/issues/442
cbc, # for clp
boost,
cbc,
cimg,
clp, # for or-tools
clp,
cudd,
eigen,
glpk,
Expand All @@ -28,7 +30,7 @@
or-tools,
pcre,
python3,
re2, # for or-tools
re2,
readline,
spdlog,
tcl,
Expand All @@ -39,16 +41,16 @@
llvmPackages,
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "openroad";
version = "2.0-unstable-2025-03-01";
version = "26Q1";

src = fetchFromGitHub {
owner = "The-OpenROAD-Project";
repo = "OpenROAD";
rev = "e794373d44ac5421f0633d8dda7e5c59e8fe79bf";
tag = finalAttrs.version;
fetchSubmodules = true;
hash = "sha256-a/X4FHkbiqHeblse2ZkLT56gYP+LCrAIZVCdsWF59jM=";
hash = "sha256-DMyoqDse9W6ahOajEINzFpgLsSKam/I1mQkRSSKepI8=";
};

nativeBuildInputs = [
Expand All @@ -64,7 +66,7 @@ stdenv.mkDerivation rec {
];

buildInputs = [
boost186
boost
cbc
cimg
clp
Expand All @@ -88,63 +90,70 @@ stdenv.mkDerivation rec {
tclPackages.tclreadline
yosys
zlib
yaml-cpp
]
++ lib.optionals stdenv.hostPlatform.isLinux [ xorg.libX11 ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ llvmPackages.openmp ];

postPatch = ''
patchShebangs --build etc/find_messages.py
# Disable two tests that are failing curently.
sed 's/^.*partition_gcd/# \0/g' -i src/par/test/CMakeLists.txt
# fix build with gcc15
patchShebangs etc/

# C++20 Fixes
sed -e '39i #include <cstdint>' -i src/gpl/src/placerBase.h
sed -e '37i #include <cstdint>' -i src/gpl/src/routeBase.h
''
# Disable failing PSM tests on aarch64
+ lib.optionalString stdenv.hostPlatform.isAarch64 ''
if [ -f src/psm/test/CMakeLists.txt ]; then
echo "Patching PSM tests for aarch64..."
sed -i -E 's/^[[:space:]]+(gcd_all_vss|gcd_em_test_vdd|insert_decap1|insert_decap_with_padding1)/ # \1/' src/psm/test/CMakeLists.txt
fi
'';

cmakeFlags = [
(lib.cmakeBool "ENABLE_TESTS" true)
# Disable tests on Darwin to avoid discovery timeouts during build
(lib.cmakeBool "ENABLE_TESTS" finalAttrs.finalPackage.doCheck)
(lib.cmakeBool "USE_SYSTEM_BOOST" true)
(lib.cmakeBool "USE_SYSTEM_ABC" false)
(lib.cmakeBool "ABC_SKIP_TESTS" true) # it attempts to download gtest
(lib.cmakeBool "ABC_SKIP_TESTS" true)
(lib.cmakeBool "USE_SYSTEM_OPENSTA" false)
(lib.cmakeFeature "OPENROAD_VERSION" "${version}_${src.rev}")
(lib.cmakeFeature "OPENROAD_VERSION" finalAttrs.version)
(lib.cmakeBool "CMAKE_RULE_MESSAGES" false)
(lib.cmakeFeature "TCL_HEADER" "${tcl}/include/tcl.h")
(lib.cmakeFeature "TCL_LIBRARY" "${tcl}/lib/libtcl${stdenv.hostPlatform.extensions.sharedLibrary}")
(lib.cmakeFeature "BOOST_ROOT" "${boost}")
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
(lib.cmakeFeature "CMAKE_CXX_FLAGS" "-DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED")
(lib.cmakeFeature "CMAKE_CXX_FLAGS" "-DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED -Wno-error=deprecated-declarations")
];

# Resynthesis needs access to the Yosys binaries.
qtWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [ yosys ]}" ];

# Upstream uses vendored package versions for some dependencies, so regression testing is prudent
# to see if there are any breaking changes in unstable that should be vendored as well.
doCheck = !stdenv.hostPlatform.isDarwin; # it seems to hang on darwin
# Some tests are unstable on Darwin
doCheck = !stdenv.hostPlatform.isDarwin;

checkPhase = ''
runHook preCheck
make test
../test/regression
runHook postCheck
'';

doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck

$out/bin/openroad -version
$out/bin/sta -version
nativeInstallCheckInputs = [
versionCheckHook
];

runHook postInstallCheck
'';
doInstallCheck = true;
versionCheckProgramArg = "-version";

meta = {
description = "OpenROAD's unified application implementing an RTL-to-GDS flow";
homepage = "https://theopenroadproject.org";
license = lib.licenses.bsd3;
mainProgram = "openroad";
maintainers = with lib.maintainers; [
trepetti
hzeller
];
platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
}
})
Loading