3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-05-25 11:26:22 +00:00

Migrate build system to CMake

See #5895 for details.

This commit does not include CI or documentation changes.
This commit is contained in:
Catherine 2026-05-12 05:33:04 +00:00
parent 9d0cdb8551
commit 9b087b4aa7
207 changed files with 5202 additions and 2294 deletions

View file

@ -1,47 +1,77 @@
{
description = "A nix flake for the Yosys synthesis suite";
description = "A Nix flake for the Yosys synthesis suite.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# This requires Nix >= 2.27.0.
self.submodules = true;
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
outputs =
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
(final: prev: {
yosys = final.callPackage ./nix/pkgs/yosys.nix {
src = self;
rev = (self.shortRev or self.dirtyShortRev or "unknown");
};
})
];
};
# TODO: don't override src when ./abc is empty
# which happens when the command used is `nix build` and not `nix build ?submodules=1`
abc-verifier = pkgs.abc-verifier;
yosys = pkgs.clangStdenv.mkDerivation {
name = "yosys";
src = ./. ;
buildInputs = with pkgs; [ clang bison flex libffi tcl readline python3 zlib git pkg-configUpstream llvmPackages.bintools ];
checkInputs = with pkgs; [ gtest ];
propagatedBuildInputs = [ abc-verifier ];
preConfigure = "make config-clang";
checkTarget = "unit-test";
installPhase = ''
make install PREFIX=$out ABCEXTERNAL=yosys-abc
ln -s ${abc-verifier}/bin/abc $out/bin/yosys-abc
'';
buildPhase = ''
make -j$(nproc) ABCEXTERNAL=yosys-abc
'';
meta = with pkgs.lib; {
description = "Yosys Open SYnthesis Suite";
homepage = "https://yosyshq.net/yosys/";
license = licenses.isc;
maintainers = with maintainers; [ ];
yosys-clang = pkgs.yosys.override { stdenv = pkgs.clangStdenv; };
win32Pkgs = pkgs.callPackage ./nix/cross/win32.nix { };
win64Pkgs = pkgs.callPackage ./nix/cross/win64.nix { };
mkShell =
t:
pkgs.mkShell.override { stdenv = t.stdenv; } {
inputsFrom = [
t
];
packages = with pkgs; [
llvmPackages.clang-tools
];
shellHook = ''
DRIVER_ROOT="${t.stdenv.cc}/bin"
export CLANGD_FLAGS="--query-driver $DRIVER_ROOT/$CC,$DRIVER_ROOT/$CXX"
'';
};
in
{
formatter = pkgs.nixfmt-tree;
devShells = rec {
shell = mkShell yosys-clang;
shell-gcc = mkShell pkgs.yosys;
shell-win32 = mkShell win32Pkgs.yosys;
shell-win64 = mkShell win64Pkgs.yosys;
default = shell;
};
in {
packages.default = yosys;
defaultPackage = yosys;
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ clang llvmPackages.bintools gcc bison flex libffi tcl readline python3 zlib git gtest abc-verifier verilog ];
packages = rec {
yosys = yosys-clang;
yosys-gcc = pkgs.yosys;
yosys-win32 = win32Pkgs.yosys;
yosys-win64 = win64Pkgs.yosys;
default = yosys;
};
}
);