From 61be82ffd081936055f57c4836e7cc9964f07090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Fri, 15 Jan 2010 23:22:28 +0000 Subject: [PATCH] Updating the ghdl related expressions: - Adding ghdl with gcc 4.4 (with a patch I built for it to work) - Adding me as maintainer to both gccs and ghdl svn path=/nixpkgs/branches/stdenv-updates/; revision=19475 --- .../development/compilers/gcc-4.3/default.nix | 6 +- pkgs/development/compilers/gcc-4.4/builder.sh | 2 + .../development/compilers/gcc-4.4/default.nix | 45 ++++++++- .../compilers/gcc-4.4/ghdl-ortho-cflags.patch | 98 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 12 +++ 5 files changed, 160 insertions(+), 3 deletions(-) create mode 100644 pkgs/development/compilers/gcc-4.4/ghdl-ortho-cflags.patch diff --git a/pkgs/development/compilers/gcc-4.3/default.nix b/pkgs/development/compilers/gcc-4.3/default.nix index 6aa79625479..ca3577cab05 100644 --- a/pkgs/development/compilers/gcc-4.3/default.nix +++ b/pkgs/development/compilers/gcc-4.3/default.nix @@ -91,7 +91,7 @@ stdenv.mkDerivation ({ ++ (optional (zlib != null) zlib) ++ (optional (boehmgc != null) boehmgc) ++ (optionals (cross != null) [binutilsCross]) - ++ (optionals (langVhdl != null) [gnat]) + ++ (optionals langVhdl [gnat]) ; configureFlags = " @@ -130,6 +130,8 @@ stdenv.mkDerivation ({ homepage = "http://gcc.gnu.org/"; license = "GPL/LGPL"; description = "GNU Compiler Collection, 4.3.x"; + maintainers = with stdenv.lib.maintainers; [viric ludo]; + platforms = with stdenv.lib.platforms; linux; }; } // (if langJava then { @@ -168,6 +170,8 @@ stdenv.mkDerivation ({ homepage = "http://ghdl.free.fr/"; license = "GPLv2+"; description = "Complete VHDL simulator, using the GCC technology"; + maintainers = with stdenv.lib.maintainers; [viric]; + platforms = with stdenv.lib.platforms; linux; }; } else {})) diff --git a/pkgs/development/compilers/gcc-4.4/builder.sh b/pkgs/development/compilers/gcc-4.4/builder.sh index 45a8cc5394e..b9724e7ad50 100644 --- a/pkgs/development/compilers/gcc-4.4/builder.sh +++ b/pkgs/development/compilers/gcc-4.4/builder.sh @@ -155,6 +155,8 @@ postInstall() { ln -sfn g++ $i fi done + + eval "$postInstallGhdl" } diff --git a/pkgs/development/compilers/gcc-4.4/default.nix b/pkgs/development/compilers/gcc-4.4/default.nix index 26140ab6ae2..c0c4f6cda21 100644 --- a/pkgs/development/compilers/gcc-4.4/default.nix +++ b/pkgs/development/compilers/gcc-4.4/default.nix @@ -2,6 +2,7 @@ , langC ? true, langCC ? true, langFortran ? false, langTreelang ? false , langJava ? false , langAda ? false +, langVhdl ? false , profiledCompiler ? false , staticCompiler ? false , enableShared ? true @@ -21,12 +22,14 @@ , binutilsCross ? null , libcCross ? null , crossStageStatic ? true +, gnat ? null }: assert langTreelang -> bison != null && flex != null; assert langJava -> zip != null && unzip != null && zlib != null && boehmgc != null; assert langAda -> gnatboot != null; +assert langVhdl -> gnat != null; with stdenv.lib; @@ -103,7 +106,8 @@ stdenv.mkDerivation ({ ++ optional noSysDirs ./no-sys-dirs.patch # The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its # target libraries and tools. - ++ optional langAda ./gnat-cflags.patch; + ++ optional langAda ./gnat-cflags.patch + ++ optional langVhdl ./ghdl-ortho-cflags.patch; inherit noSysDirs profiledCompiler staticCompiler langJava crossStageStatic libcCross; @@ -118,6 +122,7 @@ stdenv.mkDerivation ({ ++ (optionals javaAwtGtk [gtk pkgconfig libart_lgpl] ++ xlibs) ++ (optionals (cross != null) [binutilsCross]) ++ (optionals langAda [gnatboot]) + ++ (optionals langVhdl [gnat]) ; configureFlags = " @@ -141,6 +146,7 @@ stdenv.mkDerivation ({ ++ optional langJava "java" ++ optional langTreelang "treelang" ++ optional langAda "ada" + ++ optional langVhdl "vhdl" ) ) } @@ -197,9 +203,44 @@ stdenv.mkDerivation ({ maintainers = [ # Add your name here! stdenv.lib.maintainers.ludo + stdenv.lib.maintainers.viric ]; # Volunteers needed for the {Cyg,Dar}win ports. platforms = stdenv.lib.platforms.linux; }; -}) +} +// (if langVhdl then rec { + name = "ghdl-0.29"; + + ghdlSrc = fetchurl { + url = "http://ghdl.free.fr/ghdl-0.29.tar.bz2"; + sha256 = "15mlinr1lwljwll9ampzcfcrk9bk0qpdks1kxlvb70xf9zhh2jva"; + }; + + # Ghdl has some timestamps checks, storing file timestamps in '.cf' files. + # As we will change the timestamps to 1970-01-01 00:00:01, we also set the + # content of that .cf to that value. This way ghdl does not complain on + # the installed object files from the basic libraries (ieee, ...) + postInstallGhdl = '' + pushd $out + find . -name "*.cf" -exec \ + sed 's/[0-9]*\.000" /19700101000001.000" /g' -i {} \; + popd + ''; + + postUnpack = '' + tar xvf ${ghdlSrc} + mv ghdl-*/vhdl gcc*/gcc + rm -Rf ghdl-* + ''; + + meta = { + homepage = "http://ghdl.free.fr/"; + license = "GPLv2+"; + description = "Complete VHDL simulator, using the GCC technology (gcc ${version})"; + maintainers = with stdenv.lib.maintainers; [viric]; + platforms = with stdenv.lib.platforms; linux; + }; + +} else {})) diff --git a/pkgs/development/compilers/gcc-4.4/ghdl-ortho-cflags.patch b/pkgs/development/compilers/gcc-4.4/ghdl-ortho-cflags.patch new file mode 100644 index 00000000000..44787feb305 --- /dev/null +++ b/pkgs/development/compilers/gcc-4.4/ghdl-ortho-cflags.patch @@ -0,0 +1,98 @@ +diff --git a/gcc/vhdl/Make-lang.in b/gcc/vhdl/Make-lang.in +index 8f481df..681ac59 100644 +--- a/gcc/vhdl/Make-lang.in ++++ b/gcc/vhdl/Make-lang.in +@@ -96,7 +96,7 @@ AGCC_GCCOBJ_DIR=../ + AGCC_INC_FLAGS=-I$(AGCC_GCCOBJ_DIR)/gcc -I$(AGCC_GCCSRC_DIR)/include \ + -I$(AGCC_GCCSRC_DIR)/gcc -I$(AGCC_GCCSRC_DIR)/gcc/config \ + -I$(AGCC_GCCSRC_DIR)/libcpp/include +-AGCC_CFLAGS=-g -Wall -DIN_GCC $(AGCC_INC_FLAGS) ++AGCC_CFLAGS=-g -Wall -DIN_GCC $(AGCC_INC_FLAGS) $(CFLAGS) $(INCLUDES) + + AGCC_LOCAL_OBJS=ortho-lang.o + +@@ -140,7 +140,7 @@ ghdl$(exeext): force + + # Ghdl libraries. + ghdllib: ghdl$(exeext) $(GCC_PASSES) force +- $(MAKE_IN_VHDL) GRT_FLAGS="-O -g" ghdllib ++ $(MAKE_IN_VHDL) GRT_FLAGS="-O -g $(CFLAGS)" ghdllib + + # Build hooks: + +diff --git a/gcc/vhdl/Makefile.in b/gcc/vhdl/Makefile.in +index d754c6c..07abc4a 100644 +--- a/gcc/vhdl/Makefile.in ++++ b/gcc/vhdl/Makefile.in +@@ -80,7 +80,8 @@ T_CPPFLAGS = + X_ADAFLAGS = + T_ADAFLAGS = + +-ADAC = $(CC) ++# Never use the bootstrapped compiler, as it may not be built for ada ++ADAC = gcc + + ECHO = echo + CHMOD = chmod +diff --git a/gcc/vhdl/ortho-lang.c b/gcc/vhdl/ortho-lang.c +index 84aeb92..8eddd42 100644 +--- a/gcc/vhdl/ortho-lang.c ++++ b/gcc/vhdl/ortho-lang.c +@@ -16,6 +16,7 @@ + #include "options.h" + #include "real.h" +-#include "tree-gimple.h" ++#include "gimple.h" ++#include "tree.h" + #include "function.h" + #include "cgraph.h" + #include "target.h" +@@ -680,38 +681,10 @@ type_for_mode (enum machine_mode mode, int unsignedp) + + const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; + +-/* Tree code classes. */ +- +-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, +- +-const enum tree_code_class tree_code_type[] = { +-#include "tree.def" +- 'x' +-}; +-#undef DEFTREECODE +- +-/* Table indexed by tree code giving number of expression +- operands beyond the fixed part of the node structure. +- Not used for types or decls. */ +- +-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, +- +-const unsigned char tree_code_length[] = { +-#include "tree.def" +- 0 +-}; +-#undef DEFTREECODE +- +-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) NAME, +-const char * const tree_code_name[] = { +-#include "tree.def" +- "@@dummy" +-}; +-#undef DEFTREECODE + + union lang_tree_node + GTY((desc ("0"), +- chain_next ("(union lang_tree_node *) GENERIC_NEXT (&%h.generic)"))) ++ chain_next ("(union lang_tree_node *) TREE_CHAIN (&%h.generic)"))) + { + union tree_node GTY ((tag ("0"))) generic; + }; +@@ -1162,7 +1135,7 @@ new_access_type (tree dtype) + res = make_node (POINTER_TYPE); + TREE_TYPE (res) = NULL_TREE; + /* Seems necessary. */ +- TYPE_MODE (res) = Pmode; ++ SET_TYPE_MODE (res, Pmode); + layout_type (res); + return res; + } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cc23bcde235..9af72d159b4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2005,6 +2005,18 @@ let enableMultilib = false; }); + # Not officially supported version for ghdl + ghdl_gcc44 = lowPrio (wrapGHDL (import ../development/compilers/gcc-4.4 { + inherit stdenv fetchurl texinfo gmp mpfr noSysDirs gnat gettext which + ppl cloogppl; + name = "ghdl"; + langVhdl = true; + langCC = false; + langC = false; + profiledCompiler = false; + enableMultilib = false; + })); + /* Broken; fails because of unability to find its own symbols during linking