ghdl: add support for llvm backend

Make the existing ghdl recipe more flexible, and introduce "ghdl_llvm"
as a package in addition to "ghdl_mcode".  This seems to specifically
require llvm 3.5, though.  The flavour is also encoded in the package name.

cc @viric
This commit is contained in:
timor 2016-08-10 16:00:12 +02:00
parent 97801380b0
commit ecbf44485b
2 changed files with 23 additions and 8 deletions

View File

@ -1,16 +1,26 @@
{ stdenv, fetchurl, gnat, zlib }: { stdenv, fetchurl, gnat, zlib, llvm_35, ncurses, clang, flavour ? "mcode" }:
# mcode only works on x86, while the llvm flavour works on both x86 and x86_64.
assert flavour == "llvm" || flavour == "mcode";
let let
inherit (stdenv.lib) optional;
inherit (stdenv.lib) optionals;
version = "0.33"; version = "0.33";
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "ghdl-mcode-${version}"; name = "ghdl-${flavour}-${version}";
src = fetchurl { src = fetchurl {
url = "https://github.com/tgingold/ghdl/archive/v${version}.tar.gz"; url = "https://github.com/tgingold/ghdl/archive/v${version}.tar.gz";
sha256 = "09yvgqyglbakd74v2dgr470clzm744i232nixyffcds55vkij5da"; sha256 = "09yvgqyglbakd74v2dgr470clzm744i232nixyffcds55vkij5da";
}; };
buildInputs = [ gnat zlib ]; buildInputs = [ gnat zlib ] ++ optionals (flavour == "llvm") [ clang ncurses ];
configureFlags = optional (flavour == "llvm") "--with-llvm=${llvm_35}";
patchPhase = '' patchPhase = ''
# Disable warnings-as-errors, because there are warnings (unused things) # Disable warnings-as-errors, because there are warnings (unused things)
@ -23,11 +33,10 @@ stdenv.mkDerivation rec {
meta = { meta = {
homepage = "http://sourceforge.net/p/ghdl-updates/wiki/Home/"; homepage = "http://sourceforge.net/p/ghdl-updates/wiki/Home/";
description = "Free VHDL simulator, mcode flavour"; description = "Free VHDL simulator";
maintainers = with stdenv.lib.maintainers; [viric]; maintainers = with stdenv.lib.maintainers; [viric];
# I think that mcode can only generate x86 code, platforms = with stdenv.lib.platforms; (if flavour == "llvm" then [ "i686-linux" "x86_64-linux" ]
# so it fails to link pieces on x86_64. else [ "i686-linux" ]);
platforms = with stdenv.lib.platforms; [ "i686-linux" ];
license = stdenv.lib.licenses.gpl2Plus; license = stdenv.lib.licenses.gpl2Plus;
}; };
} }

View File

@ -4710,7 +4710,13 @@ in
profiledCompiler = false; profiledCompiler = false;
}); });
ghdl_mcode = callPackage_i686 ../development/compilers/ghdl { }; ghdl_mcode = callPackage_i686 ../development/compilers/ghdl {
flavour = "mcode";
};
ghdl_llvm = callPackage ../development/compilers/ghdl {
flavour = "llvm";
};
gcl = callPackage ../development/compilers/gcl { gcl = callPackage ../development/compilers/gcl {
gmp = gmp4; gmp = gmp4;