summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorMarc Weber <marco-oweber@gmx.de>2008-02-13 11:15:08 +0000
committerMarc Weber <marco-oweber@gmx.de>2008-02-13 11:15:08 +0000
commitfe5caa2f0f896c0e806690610f111e6cff250d2d (patch)
tree1e3b8c1e8ae97a06ead17b0d60a0897e4bf23d93 /pkgs
parent9b81f2ae65b03382dd34d9a0eaf3a3775a53a01a (diff)
downloadnixpkgs-fe5caa2f0f896c0e806690610f111e6cff250d2d.tar
nixpkgs-fe5caa2f0f896c0e806690610f111e6cff250d2d.tar.gz
nixpkgs-fe5caa2f0f896c0e806690610f111e6cff250d2d.tar.bz2
nixpkgs-fe5caa2f0f896c0e806690610f111e6cff250d2d.tar.lz
nixpkgs-fe5caa2f0f896c0e806690610f111e6cff250d2d.tar.xz
nixpkgs-fe5caa2f0f896c0e806690610f111e6cff250d2d.tar.zst
nixpkgs-fe5caa2f0f896c0e806690610f111e6cff250d2d.zip
modified improved hasktags (can be removed when my changes are merged into ghc)
improved ghcs expression file Now you have tags for all libraries.
I still have to work on speed

svn path=/nixpkgs/trunk/; revision=10657
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/compilers/ghcs/default.nix203
-rw-r--r--pkgs/development/tools/misc/hasktags/default.nix24
-rw-r--r--pkgs/top-level/all-packages.nix20
3 files changed, 137 insertions, 110 deletions
diff --git a/pkgs/development/compilers/ghcs/default.nix b/pkgs/development/compilers/ghcs/default.nix
index a4c7c603cea..fbc2bdd1f9d 100644
--- a/pkgs/development/compilers/ghcs/default.nix
+++ b/pkgs/development/compilers/ghcs/default.nix
@@ -1,4 +1,6 @@
-{ ghcPkgUtil, gnum4, perl, ghcboot, stdenv, fetchurl, recurseIntoAttrs, gmp, readline, lib } : rec {
+{ ghcPkgUtil, gnum4, perl, ghcboot, stdenv, fetchurl, recurseIntoAttrs, gmp, readline, lib, annotatedDerivations, hasktags, ctags } : 
+with annotatedDerivations;
+rec {
   
   /* What's in here?
      Goal:  really pure GHC. This means put every library into its each package.conf
@@ -31,39 +33,9 @@
 
   */
 
-  # creates a nix package out of the single package.conf files created when after installing ghc (see nix_ghc_pkg_tool.hs)
-  packageByPackageDB = ghc : # ghc
-      name : 
-      packageconfpath : 
-      propagatedBuildInputs : 
-    stdenv.mkDerivation {
-    inherit name;
-    phases = "buildPhase fixupPhase";
-    buildInputs = [ ghcPkgUtil ];
-    propagatedBuildInputs = [ ghc ] ++ propagatedBuildInputs;
-    buildPhase = "setupHookRegisteringPackageDatabase \"${ghc}/${packageconfpath}\"";
-  };
-
-  # used to automatically get dependencies ( used for core_libs ) 
-  # TODO use kind of state and evaluate deps of a dep only once
-  resolveDeps = ghc : libs : 
-    let attrs = builtins.listToAttrs libs; in
-      rec {
-        # using undocumented feature that attribute can contain hyphens when using listToAttrs
-        # You should be able to get the attribute values using __getAttr
-        result = builtins.listToAttrs (map ( l : lib.nv l.name (
-                               packageByPackageDB ghc l.name 
-                                      ("lib/ghc-${ghc.version}/${l.name}.conf")
-                                      (map (n: builtins.getAttr n result) l.deps)
-                ) ) libs );
-      }.result;
-
-
-  
   #this only works for ghc-6.8 right now
   ghcAndLibraries = { version, src /* , core_libraries, extra_libraries  */
-                    , extra_src
-                    , alias_names }:
+                    , extra_src }:
                    recurseIntoAttrs ( rec {
     inherit src extra_src version;
 
@@ -113,41 +85,103 @@
       ";
     };
 
-    # Why this effort? If you want to use pretty-0.9 you can do this now without cabal choosing the 1.0 version hassle 
-    core_libs = resolveDeps ghc
-      [ { name = "Cabal-1.2.3.0"; deps = ["base-3.0.1.0" "pretty-1.0.0.0" "old-locale-1.0.0.0" "old-time-1.0.0.0" "directory-1.0.0.0" "unix-2.3.0.0" "process-1.0.0.0" "array-0.1.0.0" "containers-0.1.0.1" "rts-1.0" "filepath-1.1.0.0"];} #
-        { name = "array-0.1.0.0"; deps = ["base-3.0.1.0"];}
-        { name = "base-3.0.1.0"; deps = ["rts-1.0"];} #
-        { name = "bytestring-0.9.0.1"; deps = [ "base-3.0.1.0" "array-0.1.0.0" ];}
-        { name = "containers-0.1.0.1"; deps = [ "base-3.0.1.0" "array-0.1.0.0" ];}
-        { name = "directory-1.0.0.0"; deps = [ "base-3.0.1.0" "old-locale-1.0.0.0" "old-time-1.0.0.0" "filepath-1.1.0.0"];}
-        { name = "filepath-1.1.0.0"; deps = [ "base-3.0.1.0" ];} #
-        { name = "ghc-${version}"; deps = [ "base-3.0.1.0" "old-locale-1.0.0.0" "old-time-1.0.0.0" "filepath-1.1.0.0" "directory-1.0.0.0" "array-0.1.0.0" "containers-0.1.0.1" "hpc-0.5.0.0" "bytestring-0.9.0.1" "pretty-1.0.0.0" "packedstring-0.1.0.0" "template-haskell-2.2.0.0" "unix-2.3.0.0" "process-1.0.0.0" "readline-1.0.1.0" "Cabal-1.2.3.0" "random-1.0.0.0" "haskell98-1.0.1.0"];}
-        { name = "haskell98-1.0.1.0"; deps = [ "base-3.0.1.0" "old-locale-1.0.0.0" "old-time-1.0.0.0" "filepath-1.1.0.0" "directory-1.0.0.0" "random-1.0.0.0" "unix-2.3.0.0" "process-1.0.0.0" "array-0.1.0.0"];}
-        { name = "hpc-0.5.0.0"; deps = [ "base-3.0.1.0" "old-locale-1.0.0.0" "old-time-1.0.0.0" "filepath-1.1.0.0" "directory-1.0.0.0" "array-0.1.0.0" "containers-0.1.0.1"]; }
-        { name = "old-locale-1.0.0.0"; deps = [ "base-3.0.1.0"];}
-        { name = "old-time-1.0.0.0"; deps = [ "base-3.0.1.0" "old-locale-1.0.0.0" ];}
-        { name = "packedstring-0.1.0.0"; deps = [ "base-3.0.1.0" "array-0.1.0.0" ];}
-        { name = "pretty-1.0.0.0"; deps = [ "base-3.0.1.0" ];}
-        { name = "process-1.0.0.0"; deps = [ "base-3.0.1.0" "old-locale-1.0.0.0" "old-time-1.0.0.0" "filepath-1.1.0.0" "directory-1.0.0.0" "unix-2.3.0.0"];}
-        { name = "random-1.0.0.0"; deps = [ "base-3.0.1.0" "old-locale-1.0.0.0" "old-time-1.0.0.0"];}
-        { name = "readline-1.0.1.0"; deps = [ "base-3.0.1.0" "old-locale-1.0.0.0" "old-time-1.0.0.0" "filepath-1.1.0.0" "directory-1.0.0.0" "unix-2.3.0.0" "process-1.0.0.0" ];}
-        { name = "rts-1.0"; deps = [];} #
-        { name = "template-haskell-2.2.0.0"; deps = [ "base-3.0.1.0" "pretty-1.0.0.0" "array-0.1.0.0" "packedstring-0.1.0.0" "containers-0.1.0.1" ];}
-
-        { name = "unix-2.3.0.0"; deps = [ "base-3.0.1.0" "old-locale-1.0.0.0" "old-time-1.0.0.0" "filepath-1.1.0.0" "directory-1.0.0.0" ];}
-      ];
-
-
-    extra_libs = {}; # TODO ? at the moment outside of this package 
-
-    # contains core_libs { "base-3.0.1.0" = <derivation> ...
-    # and alias names      base = base-3.0.1.0
-    # (without version)  }
-    # to get a specific version  don't use set.xy-7 but (__getAttr "xy-7" set)
-    all_libs = let all = core_libs // extra_libs;
-        in all // ( builtins.listToAttrs ( lib.mapRecordFlatten (attr : v : lib.nv attr (__getAttr v all ) ) alias_names ) );
-  } );
+    core_libs = rec {
+        #   name (using lowercase letters everywhere because using installing packages having different capitalization is discouraged) - this way there is not that much to remember?
+
+        cabal_darcs_name = "cabal-darcs";
+
+        # introducing p here to speed things up.
+        # It merges derivations (defined below) and additional inputs. I hope that using as few nix functions as possible results in greates speed?
+        # unfortunately with x; won't work because it forces nix to evaluate all attributes of x which would lead to infinite recursion
+        pkgs = let x = derivations; in {
+            # ghc extra packages 
+          cabal = { name = "cabal-1.2.3.0"; srcDir = "libraries/Cabal";
+                          deps = [x.base x.pretty x.old_locale x.old_time
+                            x.directory x.unix x.process x.array x.containers
+                            x.rts x.filepath ]; };
+          array = { name = "array-0.1.0.0"; srcDir = "libraries/array";
+                          deps = [x.base ]; };
+          base = { name = "base-3.0.1.0"; srcDir = "libraries/base";
+                          deps = [x.rts ]; };
+          bytestring = { name = "bytestring-0.9.0.1"; srcDir = "libraries/bytestring";
+                          deps = [ x.base x.array ];};
+          containers = { name = "containers-0.1.0.1"; srcDir = "libraries/containers";
+                          deps = [ x.base x.array ];};
+          directory = { name = "directory-1.0.0.0"; srcDir = "libraries/directory";
+                          deps = [ x.base x.old_locale x.old_time x.filepath ];};
+          filepath = { name = "filepath-1.1.0.0"; srcDir = "libraries/filepath";
+                          deps = [ x.base ];};
+          ghc = { name = "ghc-${version}"; srcDir = "libraries/Cabal";
+                          deps = [ x.base x.old_locale x.old_time x.filepath
+                            x.directory x.array x.containers x.hpc x.bytestring
+                            x.pretty x.packedstring x.template_haskell x.unix
+                            x.process x.readline x.cabal x.random x.haskell98 ]; };
+          haskell98 = { name = "haskell98-1.0.1.0"; srcDir = "libraries/haskell98";
+                          deps = [ x.base x.old_locale x.old_time x.filepath
+                            x.directory x.random x.unix x.process x.array]; };
+          hpc = { name = "hpc-0.5.0.0"; srcDir = "libraries/hpc";
+                          deps = [ x.base x.old_locale x.old_time x.filepath
+                            x.directory x.array x.containers ]; };
+          old_locale = { name = "old-locale-1.0.0.0"; srcDir = "libraries/old-locale";
+                          deps = [ x.base ]; };
+          old_time = { name = "old-time-1.0.0.0"; srcDir = "libraries/old-time";
+                          deps = [ x.base x.old_locale ];};
+          packedstring = { name = "packedstring-0.1.0.0"; srcDir = "libraries/packedstring";
+                          deps = [ x.base x.array ];};
+          pretty = { name = "pretty-1.0.0.0"; srcDir = "libraries/pretty";
+                          deps = [ x.base ];};
+          process = { name = "process-1.0.0.0"; srcDir = "libraries/process";
+                          deps = [ x.base x.old_locale x.old_time x.filepath
+                            x.directory x.unix ]; };
+          random = { name = "random-1.0.0.0"; srcDir = "libraries/random";
+                          deps = [ x.base x.old_locale x.old_time ]; };
+          readline = { name = "readline-1.0.1.0"; srcDir = "libraries/readline";
+                          deps = [ x.base x.old_locale x.old_time x.filepath
+                            x.directory x.unix x.process ];};
+          rts = rec { 
+                  name = "rts-1.0"; srcDir = "rts"; # TODO: Doesn't have .hs files so I should use ctags if creating tags at all
+                  deps = [];
+                  createTagFiles = [
+                      { name = "${name}_haskell_tags";
+                        tagCmd = "${toString ctags}/bin/ctags -R .;mv tags \$TAG_FILE"; }
+                    ];
+          };
+          template_haskell = { name = "template-haskell-2.2.0.0"; srcDir = "libraries/template-haskell";
+                          deps = [ x.base x.pretty x.array x.packedstring x.containers ];};
+          unix = { name = "unix-2.3.0.0"; srcDir = "libraries/unix";
+                          deps = [ x.base x.old_locale x.old_time x.filepath x.directory ];};
+        };
+
+        toDerivation = attrs : with attrs;
+              rec {
+                inherit name;
+
+                #aDeps = concatLists ( catAttrs ( subsetmap id args [ "buildInputs" "propagatedBuildInputs" ] ) );
+                aDeps = deps;
+
+                # dummy derivation, only creates setup-hook for package database located in the ghc derivation 
+                aDeriv = stdenv.mkDerivation {
+                    inherit name;
+                    phases = "buildPhase fixupPhase";
+                    buildInputs = [ ghcPkgUtil ];
+                    propagatedBuildInputs = [ ghc ] ++ map delAnnotation  attrs.deps;
+                    buildPhase = "setupHookRegisteringPackageDatabase \"${ghc}/lib/ghc-${ghc.version}/${name}.conf\"";
+                };
+
+                sourceWithTags = {
+                  src = ghc.src;
+                  inherit srcDir;
+                  name = name + "-src-with-tags";
+                  createTagFiles = lib.maybeAttr "createTagFiles" [
+                      { name = "${name}_haskell_tags";
+                        tagCmd = "${toString hasktags}/bin/hasktags-modified --ctags `find . -type f -name \"*.*hs\"`; sort tags > \$TAG_FILE"; } 
+                    ] attrs;
+                };
+          };
+        derivations = with lib; builtins.listToAttrs (lib.concatLists ( lib.mapRecordFlatten 
+                  ( n : attrs : let d = (toDerivation attrs); in [ (nv n d) (nv attrs.name d) ] ) pkgs ) );
+    }.derivations;
+  });
 
   ghc68 = ghcAndLibraries rec {
     version = "6.8.2";
@@ -166,40 +200,5 @@
       #url = http://www.haskell.org/ghc/dist/stable/dist/ghc-6.8.20070912-src-extralibs.tar.bz2;
       #sha256 = "0py7d9nh3lkhjxr3yb3n9345d0hmzq79bi40al5rcr3sb84rnp9r";
     };
-
-    # to be able to use just array instead of array-0.1.0.0 (versions are likely to change, dependencies not that often)
-    alias_names = {
-      cabal = "Cabal-1.2.3.0";
-      array = "array-0.1.0.0";
-      base = "base-3.0.1.0";
-      bytestring = "bytestring-0.9.0.1";
-      containers = "containers-0.1.0.1";
-      directory = "directory-1.0.0.0";
-      filepath = "filepath-1.1.0.0";
-      haskell98 = "haskell98-1.0.1.0";
-      hpc = "hpc-0.5.0.0";
-      packedstring = "packedstring-0.1.0.0";
-      pretty = "pretty-1.0.0.0";
-      process = "process-1.0.0.0";
-      random = "random-1.0.0.0";
-      readline = "readline-1.0.1.0";
-      rts = "rts-1.0";
-      template = "template-haskell-2.2.0.0";
-      unix = "unix-2.3.0.0";
-      template_haskell = "template-haskell-2.2.0.0";
-      old_time = "old-time-1.0.0.0";
-      old_locale = "old-locale-1.0.0.0";
-    };
-
-    # this will change because of dependency hell :) 
-    #core_libraries = [ "Cabal" /* "Win32" */ "array" "base" "bytestring" "containers" 
-                       #"directory" "doc" "filepath" "haskell98" "hpc" "old-locale" "old-time"
-                       #"packedstring" "pretty" "process" "random" "readline" "stamp" 
-                       #"template-haskell" "unix" ];
-
-    #extra_libraries = [ "ALUT" "GLUT" "HGL" "HUnit" "ObjectIO" "OpenAL" "OpenGL" "QuickCheck" "X11" 
-                        #"arrows" "cgi" "fgl" "haskell-src" "html" "mtl" "network" "parallel" "parsec" 
-                        #"regex-base" "regex-compat" "regex-posix" "stm" "time" "xhtm" ];
-
   };
 }
diff --git a/pkgs/development/tools/misc/hasktags/default.nix b/pkgs/development/tools/misc/hasktags/default.nix
new file mode 100644
index 00000000000..613d028948f
--- /dev/null
+++ b/pkgs/development/tools/misc/hasktags/default.nix
@@ -0,0 +1,24 @@
+args:
+args.stdenv.mkDerivation {
+  name = "hasktags-modified";
+
+  src = args.fetchurl {
+    url = http://mawercer.de/hasktags.hs;
+    sha256 = "112k97g6mgvwa0a9zrq840mqxxw55cn422h1c134xb0fl29llig7";
+  };
+
+  buildInputs =(with args; [ghc]);
+
+  phases = "buildPhase";
+
+  # calling it hasktags-modified to not clash with the one distributed with ghc
+  buildPhase = "
+    ensureDir \$out/bin
+    ghc --make \$src -o \$out/bin/hasktags-modified
+  ";
+
+  meta = { 
+      # this can be removed again when somone comitts my changes into the distribution
+      description = "Marc's modified hasktags";
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index c2b426388f2..c0b1999c65d 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -1201,7 +1201,8 @@ rec {
      name = name + "-src-with-tags";
      createTagFiles = [
            { name = "${name}_haskell_tags";
-             tagCmd = "${toString ghcsAndLibs.ghc68.ghc}/bin/hasktags --ctags `find . -type f -name \"*.*hs\"`; sort tags > \$TAG_FILE"; }
+             # tagCmd = "${toString ghcsAndLibs.ghc68.ghc}/bin/hasktags --ctags `find . -type f -name \"*.*hs\"`; sort tags > \$TAG_FILE"; }
+             tagCmd = "${toString hasktags}/bin/hasktags-modified --ctags `find . -type f -name \"*.*hs\"`; sort tags > \$TAG_FILE"; }
       ];
     };
   };
@@ -1301,7 +1302,7 @@ rec {
                                        md5 = "fa6b24517f09aa16e972f087430967fd"; 
                                      };
                     };
-        happs_darcs = { name="HAppS-Server-darcs"; p_deps=[x.haxml x.parsec x.mtl
+        happs_server_darcs = { name="HAppS-Server-darcs"; p_deps=[x.haxml x.parsec x.mtl
                 x.network x.regex_compat x.hslogger x.happs_data_darcs
                   x.happs_util_darcs x.happs_state_darcs x.happs_ixset_darcs x.http_darcs
                   x.template_haskell x.xhtml x.html x.bytestring x.random
@@ -1310,7 +1311,7 @@ rec {
                     };
         # we need recent version of cabal (because only this supports --pkg-config propably) Thu Feb  7 14:54:07 CET 2008
         # is be added to buildInputs automatically
-        cabal_darcs = { name=cabal_darcs_name; p_deps = with ghc.all_libs; [base rts directory process pretty containers filepath];
+        cabal_darcs = { name=cabal_darcs_name; p_deps = with ghc.core_libs; [base rts directory process pretty containers filepath];
                   src = fetchdarcs { url = "http://darcs.haskell.org/cabal"; md5 = "8b0bc3c7f2676ce642f98b1568794cd6"; };
                 };
       };
@@ -1323,9 +1324,6 @@ rec {
             patches = if attrs ? patches then attrs.patches else [];
             # add cabal, take deps either from this list or from ghc.core_libs 
         }//( lib.subsetmap lib.id attrs [ "patchPhase" ] )) null;
-      #             "mtl-1.." = <the same deriv>
-      #           ...}
-      # containing the derivations defined here and in ghc.all_libs
       derivations = with lib; builtins.listToAttrs (lib.concatLists ( lib.mapRecordFlatten 
                 ( n : attrs : let d = (toDerivation attrs); in [ (nv n d) (nv attrs.name d) ] ) pkgs ) );
     }.derivations;
@@ -1346,11 +1344,11 @@ rec {
       libraries = # map ( a : __getAttr a (ghc68_extra_libs ghcsAndLibs.ghc68 ) ) [ "mtl" ];
         # core_libs  distributed with this ghc version
         #(lib.flattenAttrs ghcsAndLibs.ghc68.core_libs)
-          map ( a : __getAttr a ghcsAndLibs.ghc68.all_libs ) [ 
+          map ( a : __getAttr a ghcsAndLibs.ghc68.core_libs ) [ 
             "cabal" "array" "base" "bytestring" "containers" "containers" "directory"
             "filepath" "ghc-${ghc.version}" "haskell98" "hpc" "old_locale" "old_time"
             "old_time" "packedstring" "pretty" "process" "random" "readline" "rts"
-            "template" "unix" "template_haskell" ]
+            "template_haskell" "unix" "template_haskell" ]
         # some extra libs
 
            ++  (lib.flattenAttrs (ghc68_extra_libs ghcsAndLibs.ghc68) );
@@ -1869,6 +1867,12 @@ rec {
     inherit cabal perl;
   };
 
+  hasktags = import ../development/tools/misc/hasktags {
+    inherit fetchurl;
+    stdenv = stdenvUsingSetupNew2;
+    ghc = ghcsAndLibs.ghc68.ghc;
+  };
+
   help2man = import ../development/tools/misc/help2man {
     inherit fetchurl stdenv perl gettext perlLocaleGettext;
   };