From 82b6604e2be5861fdecff8601c09d50f02bba9ec Mon Sep 17 00:00:00 2001 From: Las Safin Date: Mon, 16 Aug 2021 17:06:47 +0000 Subject: [PATCH] wip --- flake.lock | 27 +++++++++++ flake.nix | 80 +++++++++++++++++++++++++++++++ lefdef/src/def/def/CMakeLists.txt | 2 +- lefdef/src/lef/lef/CMakeLists.txt | 4 +- 4 files changed, 110 insertions(+), 3 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..c92ec499 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1628776130, + "narHash": "sha256-EyzdilgzoO8YCgck1lkOF1Bp+QVEazJBtuG5GkVY6xg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ad6e733d633802620b5eec9be91e837973eac18a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-21.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..94c9eb77 --- /dev/null +++ b/flake.nix @@ -0,0 +1,80 @@ +{ + description = "Coriolis is a free database, placement tool and routing tool for VLSI design."; + + # Nixpkgs / NixOS version to use. + inputs.nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-21.05"; + + outputs = { self, nixpkgs }: + let + + # Generate a user-friendly version numer. + version = builtins.substring 0 8 self.lastModifiedDate; + + # System types to support. + supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + + # Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'. + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + + # Nixpkgs instantiated for supported system types. + nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; overlays = [ self.overlay ]; }); + + coriolis = + { lib, stdenv, python2, cmake, boost, bison, flex, libxml2, rapidjson, which, qt4 }: + let boostWithPython = boost.override { enablePython = true; python = python2; }; in + stdenv.mkDerivation { + name = "coriolis-${version}"; + + src = ./.; + + postPatch = '' + patchShebangs . + export HOME=/build + mkdir -p /build/coriolis-2.x/src + dir="$PWD" + mv "$PWD" -T /build/coriolis-2.x/src/coriolis + ''; + + configurePhase = "runHook preConfigure; runHook postConfigure"; + + hardeningDisable = [ "format" ]; + + buildPhase = '' + runHook preBuild + ./bootstrap/ccb.py --project=coriolis --make="-j$NIX_BUILD_CORES install" + runHook postBuild + ''; + + installPhase = "true"; + + checkPhase = "true"; + + buildInputs = [ python2 boostWithPython libxml2 rapidjson qt4 ]; + nativeBuildInputs = [ cmake bison flex which ]; + + meta = with lib; { + description = "Coriolis is a free database, placement tool and routing tool for VLSI design."; + homepage = "http://coriolis.lip6.fr/"; + license = licenses.gpl3; + platforms = platforms.all; + }; + }; + + in + + rec { + overlay = final: prev: { + coriolis = final.callPackage coriolis {}; + }; + + packages = forAllSystems (system: + { + inherit (nixpkgsFor.${system}) coriolis; + }); + + defaultPackage = forAllSystems (system: self.packages.${system}.coriolis); + devShell = defaultPackage; + + hydraJobs.coriolis = self.defaultPackage; + }; +} diff --git a/lefdef/src/def/def/CMakeLists.txt b/lefdef/src/def/def/CMakeLists.txt index 227ff104..92aab5cf 100644 --- a/lefdef/src/def/def/CMakeLists.txt +++ b/lefdef/src/def/def/CMakeLists.txt @@ -81,7 +81,7 @@ add_custom_command ( OUTPUT def.tab.cpp DEPENDS ${DefParserGrammar} COMMAND ${BISON_EXECUTABLE} -v -p defyy -d ${DefParserGrammar} -o def.tab.cpp - COMMAND mv def.tab.hpp ${LEFDEF_SOURCE_DIR}/src/def/def/def.tab.h + COMMAND cp def.tab.hpp ${LEFDEF_SOURCE_DIR}/src/def/def/def.tab.h #COMMAND mv def.tab.cpp ${LEFDEF_SOURCE_DIR}/src/def/def/def.tab.cpp COMMENT "Generating DEF parser (bison)" ) diff --git a/lefdef/src/lef/lef/CMakeLists.txt b/lefdef/src/lef/lef/CMakeLists.txt index e347cf03..3cb07de1 100644 --- a/lefdef/src/lef/lef/CMakeLists.txt +++ b/lefdef/src/lef/lef/CMakeLists.txt @@ -61,8 +61,8 @@ add_custom_command ( OUTPUT lef.tab.cpp DEPENDS ${LefParserGrammar} COMMAND ${BISON_EXECUTABLE} -v -p lefyy -d ${LefParserGrammar} -o lef.tab.cpp - COMMAND mv lef.tab.hpp ${LEFDEF_SOURCE_DIR}/src/lef/lef/lef.tab.h - #COMMAND mv lef.tab.cpp ${LEFDEF_SOURCE_DIR}/src/lef/lef/lef.tab.cpp + COMMAND cp lef.tab.hpp ${LEFDEF_SOURCE_DIR}/src/lef/lef/lef.tab.h + #COMMAND mv lef.tab.cpp ${LEFDEF_SOURCE_DIR}/src/lef/lef/lef.tab.cpp COMMENT "Generating LEF parser (bison)" ) set_source_files_properties ( lef.tab.cpp GENERATED )