From e17c96c8811a2a8a782fc1a428451c6f757af1cb Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Mon, 28 Apr 2008 22:27:03 +0000 Subject: [PATCH] Support for profiling (all libraries) enabled by custom config moved flapjax to ghcExecutables added haskelldb mysql added ghc darcs build (left in comments) svn path=/nixpkgs/trunk/; revision=11742 --- pkgs/development/compilers/ghcs/default.nix | 73 ++++++++++++++++++- pkgs/development/compilers/ghcs/patch | 55 ++++++++++++++ pkgs/lib/default.nix | 19 +++++ .../bleeding-edge-fetch-info/haskellnet.nix | 3 + pkgs/misc/ghc68extraLibs/default.nix | 42 +++++++++-- pkgs/misc/ghc68extraLibs/haskellnetPatch | 66 +++++++++++++++++ 6 files changed, 249 insertions(+), 9 deletions(-) create mode 100644 pkgs/development/compilers/ghcs/patch create mode 100644 pkgs/misc/bleeding-edge-fetch-info/haskellnet.nix create mode 100644 pkgs/misc/ghc68extraLibs/haskellnetPatch diff --git a/pkgs/development/compilers/ghcs/default.nix b/pkgs/development/compilers/ghcs/default.nix index f63dd489c1cb..8865ce78d03b 100644 --- a/pkgs/development/compilers/ghcs/default.nix +++ b/pkgs/development/compilers/ghcs/default.nix @@ -1,4 +1,5 @@ -{ ghcPkgUtil, gnum4, perl, ghcboot, stdenv, fetchurl, recurseIntoAttrs, gmp, readline, lib, hasktags, ctags } : + { ghcPkgUtil, gnum4, perl, ghcboot, stdenv, fetchurl, recurseIntoAttrs, gmp, readline, lib, hasktags, ctags + , sourceByName, autoconf, happy, alex ,automake, getConfig} : rec { /* What's in here? @@ -33,11 +34,11 @@ rec { #this only works for ghc-6.8 right now ghcAndLibraries = { version, src /* , core_libraries, extra_libraries */ - , extra_src }: + , extra_src, pass ? {} }: recurseIntoAttrs ( rec { inherit src extra_src version; - ghc = stdenv.mkDerivation { + ghc = stdenv.mkDerivation ( lib.mergeAttrsNoOverride {} pass { name = "ghc-"+version; inherit src ghcboot gmp version; @@ -61,6 +62,7 @@ rec { # now read the main package.conf and create a single package db file for each of them # Also create setup hook. + makeFlags = getConfig ["ghc" "makeFlags" ] ""; # note : I don't know yet wether it's a good idea to have RUNGHC.. It's faster # but you can't pass packages, can you? @@ -81,7 +83,7 @@ rec { echo \"RUNHGHC=\$RUNHGHC\" >> \$sh "; - }; + }); 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? @@ -186,6 +188,8 @@ rec { #sha256 = "1b1gvi7hc7sc0fkh29qvzzd5lgnlvdv3ayiak4mkfnzkahvmq85s"; }; + pass = { patches = ./patch; }; + extra_src = fetchurl { url = "http://www.haskell.org/ghc/dist/stable/dist/ghc-${version}-src-extralibs.tar.bz2"; sha256 = "044mpbzpkbxcnqhjnrnmjs00mr85057d123rrlz2vch795lxbkcn"; @@ -193,4 +197,65 @@ rec { #sha256 = "0py7d9nh3lkhjxr3yb3n9345d0hmzq79bi40al5rcr3sb84rnp9r"; }; }; + + # this works. commented out because I haven't uploaded all the bleeding edge source dist files. + #[> darcs version of ghc which is updated occasionally by Marc Weber + #ghc68darcs = ghcAndLibraries rec { + # version = "6.9"; + + # pass = { buildInputs = [ happy alex]; + # patches = ./patch; + # patchPhase = " + # unset patchPhase; patchPhase + # pwd + # sed 's/GhcWithJavaGen=NO/GhcWithJavaGen=YES/g' -i mk/config.mk.in + # "; + # }; + # [> each library is usually added using darcs-all get + # [> so I assemble and prepare the sources here + # src = stdenv.mkDerivation { + # name = "ghc-darcs-src-dist"; + # buildInputs = [autoconf automake]; + # core_libs = map (x : sourceByName "ghc_core_${x}") ["array" "base" "bytestring" "Cabal" "containers" "directory" "editline" "filepath" "ghc_prim" "haskell98" "hpc" "integer_gmp" "old_locale" "old_time" "packedstring" "pretty" "process" "random" "template_haskell" "unix" "Win32" ]; + # ghc = sourceByName "ghc"; + # phases = "buildPhase"; + # buildPhase = " + # echo unpacking ghc + # tar xfz \$ghc &> /dev/null + # cd nix_repsoitory_manager_tmp_dir/libraries + # for i in \$core_libs; do + # echo 'unpacking core_lib :' \$i + # tar xfz \$i &> /dev/null + # n=`basename \$i` + # n=\${n/ghc_core_/} + # if [ -f nix_repsoitory_manager_tmp_dir/*.ac ]; then + # cd nix_repsoitory_manager_tmp_dir + # echo ======================================================= + # echo \$n + # autoreconf + # cd .. + # fi + # mv nix_repsoitory_manager_tmp_dir \${n/.tar.gz/} + # done + # mv ghc_prim ghc-prim + # for i in integer-gmp old-locale old-time template-haskell; do + # mv \${i/-/_} $i + # done + # mkdir \$out + # cd .. + # autoreconf + # sh boot + # cd .. + # mv nix*/* \$out/ + # "; + # }; + + # [> TODO this is copied.. use dev versions as well here + # extra_src = fetchurl { + # url = "http://www.haskell.org/ghc/dist/stable/dist/ghc-${version}-src-extralibs.tar.bz2"; + # sha256 = "044mpbzpkbxcnqhjnrnmjs00mr85057d123rrlz2vch795lxbkcn"; + # [>url = http://www.haskell.org/ghc/dist/stable/dist/ghc-6.8.20070912-src-extralibs.tar.bz2; + # [>sha256 = "0py7d9nh3lkhjxr3yb3n9345d0hmzq79bi40al5rcr3sb84rnp9r"; + # }; + #}; } diff --git a/pkgs/development/compilers/ghcs/patch b/pkgs/development/compilers/ghcs/patch new file mode 100644 index 000000000000..e888413c67d2 --- /dev/null +++ b/pkgs/development/compilers/ghcs/patch @@ -0,0 +1,55 @@ +diff -rN -U3 old-ghc_package_db/compiler/package.conf.in new-ghc_package_db/compiler/package.conf.in +--- old-ghc_package_db/compiler/package.conf.in 2008-04-24 02:03:28.000000000 +0200 ++++ new-ghc_package_db/compiler/package.conf.in 2008-04-24 02:03:28.000000000 +0200 +@@ -10,7 +10,6 @@ + BasicTypes + BinIface + Binary +- BitSet + Bitmap + BuildTyCl + ByteCodeAsm +@@ -91,7 +90,6 @@ + Encoding + FastString + FastTypes +- FieldLabel + Finder + FiniteMap + FloatIn +@@ -121,7 +119,6 @@ + IfaceEnv + IfaceSyn + IfaceType +- IlxGen + Inst + InstEnv + Java +@@ -179,7 +176,6 @@ + RdrHsSyn + RdrName + RegAllocInfo +- RegisterAlloc + RnBinds + RnEnv + RnExpr +diff -rN -U3 old-ghc_package_db/mk/package.mk new-ghc_package_db/mk/package.mk +--- old-ghc_package_db/mk/package.mk 2008-04-24 02:03:26.000000000 +0200 ++++ new-ghc_package_db/mk/package.mk 2008-04-24 02:03:28.000000000 +0200 +@@ -61,6 +61,7 @@ + + package.conf.inplace : package.conf.in + $(CPP) $(RAWCPP_FLAGS) -P \ ++ $(if $(subst NO,,$(GhcWithJavaGen)),, -DJava= -D JavaGen= -DPrintJava= ) \ + -DIMPORT_DIR='"$(IMPORT_DIR_INPLACE)"' \ + -DLIB_DIR='"$(LIB_DIR_INPLACE)"' \ + -DINCLUDE_DIR='"$(INCLUDE_DIR_INPLACE)"' \ +@@ -74,6 +75,7 @@ + + install:: + $(CPP) $(RAWCPP_FLAGS) -P -DINSTALLING \ ++ $(if $(subst NO,,$(GhcWithJavaGen)),, -DJava= -D JavaGen= -DPrintJava= ) \ + -DIMPORT_DIR='"$(IMPORT_DIR_INSTALLED)"' \ + -DLIB_DIR='"$(LIB_DIR_INSTALLED)"' \ + -DINCLUDE_DIR='"$(INCLUDE_DIR_INSTALLED)"' \ + diff --git a/pkgs/lib/default.nix b/pkgs/lib/default.nix index 8093c67a6923..2efd1adddb10 100644 --- a/pkgs/lib/default.nix +++ b/pkgs/lib/default.nix @@ -396,6 +396,25 @@ rec { # eg { a = 7; } { a = [ 2 3 ]; } becomes { a = [ 7 2 3 ]; } mergeAttrsConcatenateValues = mergeAttrsWithFunc ( a : b : (toList a) ++ (toList b) ); + # merges attributes using //, if a name exisits in both attributes + # an error will be triggered unless its listed in mergeLists + # so you can mergeAttrsNoOverride { buildInputs = [a]; } { buildInputs = [a]; } {} to get + # { buildInputs = [a b]; } + # merging buildPhase does'nt really make sense. The cases will be rare where appending /prefixing will fit your needs? + # in these cases the first buildPhase will override the second one + mergeAttrsNoOverride = { mergeLists ? ["buildInputs" "propagatedBuildInputs"], + overrideSnd ? [ "buildPhase" ] + } : attrs1 : attrs2 : + fold (n: set : + setAttr set n ( if (__hasAttr n set) + then # merge + if elem n mergeLists # attribute contains list, merge them by concatenating + then (__getAttr n attrs2) ++ (__getAttr n attrs1) + else if elem n overrideSnd + then __getAttr n attrs1 + else throw "error mergeAttrsNoOverride, attribute ${n} given in both attributes - no merge func defined" + else __getAttr n attrs2 # add attribute not existing in attr1 + )) attrs1 (__attrNames attrs2); # returns atribute values as a list flattenAttrs = set : map ( attr : builtins.getAttr attr set) (attrNames set); mapIf = cond : f : fold ( x : l : if (cond x) then [(f x)] ++ l else l) []; diff --git a/pkgs/misc/bleeding-edge-fetch-info/haskellnet.nix b/pkgs/misc/bleeding-edge-fetch-info/haskellnet.nix new file mode 100644 index 000000000000..b5102f6d04d8 --- /dev/null +++ b/pkgs/misc/bleeding-edge-fetch-info/haskellnet.nix @@ -0,0 +1,3 @@ + args: with args; fetchurl { + url = http://mawercer.de/~nix/repos/haskellnet.tar.gz; + sha256 = "fde6f79b09d6cfbc6021aed9fa54ed186715a6eaacd4634f07554d4d3777f70d";} diff --git a/pkgs/misc/ghc68extraLibs/default.nix b/pkgs/misc/ghc68extraLibs/default.nix index d1f9602face8..2dc796c3cd31 100644 --- a/pkgs/misc/ghc68extraLibs/default.nix +++ b/pkgs/misc/ghc68extraLibs/default.nix @@ -29,10 +29,27 @@ rec { quickcheck = { name="QuickCheck-1.1.0.0"; srcDir="libraries/QuickCheck"; p_deps=[x.base x.random]; src = ghc.extra_src; }; tagsoup = { name = "tagsoup-0.4"; src = fetchurl { url = http://hackage.haskell.org/packages/archive/tagsoup/0.4/tagsoup-0.4.tar.gz; sha256 = "0rdy303qaw63la1fhw1z8h6k8cs33f71955pwlzxyx0n45g58hc7";}; p_deps = [ x.base x.mtl x.network ]; }; hxt = { name = "hxt-7.5"; src =fetchurl { url = http://hackage.haskell.org/packages/archive/hxt/7.5/hxt-7.5.tar.gz; sha256 ="00q6m90a4qm4d5cg1x9r6b7f0rszcf2y7ifzs9mvy9kmzfl5ga7n"; }; p_deps = [x.base x.haskell98 x.http_darcs x.hunit x.network x.parsec x.tagsoup ]; }; - - + haskellnet = { name = "HaskellNet-0.2"; src = sourceByName "haskellnet"; p_deps = [ x.base x.haskell98 x.network x.crypto x.mtl x.parsec x.time x.haxml x.bytestring x.pretty x.array x.dataenc x.containers x.old_locale x.old_time ]; + pass = { + patchPhase = " + patch -p1 < \$patch + sed -i 's/mtl/mtl, bytestring, pretty, array, dataenc, containers, old-locale, old-time/' *.cabal + "; + patch= ./haskellnetPatch ; + }; + }; + dataenc = { name = "dataenc-0.10.2"; src = fetchurl { url = http://hackage.haskell.org/packages/archive/dataenc/0.10.2/dataenc-0.10.2.tar.gz; sha256="1kl087994ajbwy65f24qjnz6wchlhmk5vkdw1506zzfbi5fr6x7r"; }; p_deps = [ x.base ]; }; # other pacakges (hackage etc) polyparse = { name = "polyparse-2.3"; src = fetchurl { url = http://hackage.haskell.org/packages/archive/polyparse/1.1/polyparse-1.1.tar.gz; sha256 = "0mrrk3hhfrn68xn5y4jfg4ba0pa08bj05l007862vrxyyb4bksl7"; }; p_deps = [ x.base x.haskell98 ]; }; + hsHaruPDF = { name = "HsHaruPDF-0.0.0"; src = fetchurl{url= "http://hackage.haskell.org/packages/archive/HsHaruPDF/0.0.0/HsHaruPDF-0.0.0.tar.gz"; sha256="1yifhxk1m3z2i7gaxgwlmk6cv2spbpx8fny4sn59ybca8wd9z7ps";}; p_deps = [ x.base x.haskell98 ]; + pass = { buildInputs = [ mysql zlib libpng ]; + patchPhase = " + sed 's/include-dirs:.*/include-dirs: haru/' -i HsHaruPDF.cabal + sed 's=extra-lib-dirs:.*=extra-lib-dirs: ${libpng}/lib ${zlib}/lib=' -i HsHaruPDF.cabal + "; + }; + }; + # hint = { name="hint-0.1"; src = fetchurl { url = "http://hackage.haskell.org/packages/archive/hint/0.1/hint-0.1.tar.gz"; sha256 = "1adydl2la4lxxl6zz24lm4vbdrsi4bkpppzxhpkkmzsjhhkpf2f9"; }; p_deps = [ x.base x.ghc x.haskellSrc x.mtl ]; }; timeout = { name="timeout-0.1.2"; src = fetchurl{ url = http://hackage.haskell.org/packages/archive/control-timeout/0.1.2/control-timeout-0.1.2.tar.gz; sha256 = "1g1x6c4dafckwcw48v83f3nm2sxv8kynwv8ib236ay913ycgayvg";}; p_deps = [ x.base x.time x.stm ]; }; parsec3 = { name="parsec-3.0.0"; p_deps=[ x.base x.mtl x.bytestring ]; src = fetchurl { url = "http://hackage.haskell.org/packages/archive/parsec/3.0.0/parsec-3.0.0.tar.gz"; sha256 = "0fqryy09y8h7z0hlayg5gpavghgwa0g3bldynwl17ks8l87ykj7a"; }; }; @@ -63,7 +80,7 @@ rec { src = sourceByName "hsql"; pass = { srcDir = "HSQL"; }; }; - hsqlMysqlDarcs = { name = "hsql-mysql-darcs"; srcDir = "MySQL"; src = sourceByName "pg_hsql"; p_deps = [ x.base x.hsqlDarcs x.old_time ]; + hsqlMysqlDarcs = { name = "hsql-mysql-darcs"; srcDir = "MySQL"; src = sourceByName "hsql"; p_deps = [ x.base x.hsqlDarcs x.old_time ]; pass = { buildInputs = [ mysql zlib ]; patchPhase = "echo \" extra-lib-dirs: ${zlib}/lib\" >> MySQL/hsql-mysql.cabal"; }; @@ -147,12 +164,13 @@ rec { name = "wxhaskel-${wxVersion}"; p_deps = [ x.haskell98 x.mtl x.bytestring x.parsec3 pkgconfig wxGTK ] ++ (with gtkLibs; [ glib pango gtk gnome.glib]); src = wxSrc; pass = { + profiling = if getConfig [ "ghc68" "profiling" ] false then "--hcprof" else ""; buildInputs = [ unzip ]; buildPhase = " createEmptyPackageDatabaseAndSetupHook export GHC_PACKAGE_PATH sed -e 's/which/type -p/g' configure - ./configure --prefix=\$out --package-conf=\$PACKAGE_DB + ./configure --prefix=\$out --package-conf=\$PACKAGE_DB \$profiling make ensureDir \$out make install @@ -187,8 +205,22 @@ rec { pass = { buildInputs = (with executables; [ happy alex ] ); }; }; - /* + # haskelldb + haskelldb = { name = "haskelldb-0.10"; src = fetchurl { url = "http://hackage.haskell.org/packages/archive/haskelldb/0.10/haskelldb-0.10.tar.gz"; sha256 = "1i4kgsgajr9cijg0a2c04rn1zqwiasfvdbvs8c5qm49vkbdzm7l5"; }; p_deps = [ x.base x.haskell98 x.mtl x.pretty x.old_time x.directory x.old_locale]; + pass = { patchPhase = "sed -i 's/mtl/mtl, pretty, old-time, directory, old-locale/' haskelldb.cabal + echo 'ghc-options: -O2 -fglasgow-exts -fallow-undecidable-instances' >> haskelldb.cabal"; }; + }; + #hsql drivers + haskelldbHsql = { name= "haskelldb-hsql--0.10"; src = fetchurl { url = http://hackage.haskell.org/packages/archive/haskelldb-hsql/0.10/haskelldb-hsql-0.10.tar.gz; sha256 = "0s3bjm080hzw23zjxr4412m81v408ll9y6gqb2yyw30n886ixzgh"; }; p_deps = [ x.base x.haskell98 x.mtl x.hsqlDarcs x.haskelldb x.old_time x.old_locale ]; + pass = { patchPhase = "sed -i 's/mtl/mtl, pretty, old-time, directory, old-locale/' haskelldb-hsql.cabal + echo 'ghc-options: -O2 -fglasgow-exts -fallow-undecidable-instances' >> haskelldb-hsql.cabal"; }; + }; + haskelldbHsqlMysql = { name= "haskelldb-hsql-mysql-0.10"; src = fetchurl { url = http://hackage.haskell.org/packages/archive/haskelldb-hsql-mysql/0.10/haskelldb-hsql-mysql-0.10.tar.gz; sha256 = "0nfgq0xn45rhwxr8jvawviqfhgvhqr56l7ki1d72605y34dfx7rw"; }; p_deps = [ x.base x.haskell98 x.mtl x.hsqlDarcs x.haskelldbHsql x.hsqlMysqlDarcs x.haskelldb ]; + }; + + + /* haskelldb-hsql-postgresql-0.10.tar.gz ######################################################################## 100.0% hash is 00nva5hhaknm5via4c1p2wj7ibyn6q874f0c3izjb9dk7rivfvgv diff --git a/pkgs/misc/ghc68extraLibs/haskellnetPatch b/pkgs/misc/ghc68extraLibs/haskellnetPatch new file mode 100644 index 000000000000..fd7a280683df --- /dev/null +++ b/pkgs/misc/ghc68extraLibs/haskellnetPatch @@ -0,0 +1,66 @@ +diff -rN -U3 old-pg_haskellnet/HaskellNet/Auth.hs new-pg_haskellnet/HaskellNet/Auth.hs +--- old-pg_haskellnet/HaskellNet/Auth.hs 2008-04-22 19:21:58.000000000 +0200 ++++ new-pg_haskellnet/HaskellNet/Auth.hs 2008-04-22 19:21:58.000000000 +0200 +@@ -21,6 +21,7 @@ + import Data.List + import Data.Bits + import Data.Array ++import Data.Maybe + + type UserName = String + type Password = String +@@ -41,7 +42,7 @@ + b64Encode = map (toEnum.fromEnum) . B64.encode . map (toEnum.fromEnum) + + b64Decode :: String -> String +-b64Decode = map (toEnum.fromEnum) . B64.decode . map (toEnum.fromEnum) ++b64Decode = map (toEnum.fromEnum) . fromJust . B64.decode . map (toEnum.fromEnum) + + showOctet :: [Octet] -> String + showOctet = concat . map hexChars +diff -rN -U3 old-pg_haskellnet/haskellnet.cabal new-pg_haskellnet/haskellnet.cabal +--- old-pg_haskellnet/haskellnet.cabal 2008-04-22 19:21:58.000000000 +0200 ++++ new-pg_haskellnet/haskellnet.cabal 2008-04-22 19:21:58.000000000 +0200 +@@ -3,7 +3,7 @@ + Author: Jun Mukai + License: BSD3 + Category: Network +-Build-Depends: base, haskell98, network, Crypto, mtl, parsec, time, HaXml ++Build-Depends: base, haskell98, network, Crypto, mtl, parsec, time, HaXml, bytestring, pretty, array, dataenc, containers, old-locale, old-time + Synopsis: network related libraries such as HTTP, POP3, SMTP + Exposed-modules: + Text.IMAPParsers, +diff -rN -U3 old-pg_haskellnet/Text/Atom.hs new-pg_haskellnet/Text/Atom.hs +--- old-pg_haskellnet/Text/Atom.hs 2008-04-22 19:21:58.000000000 +0200 ++++ new-pg_haskellnet/Text/Atom.hs 2008-04-22 19:21:58.000000000 +0200 +@@ -38,7 +38,8 @@ + import Data.Map (findWithDefault, insert, Map) + import qualified Data.Map as M + import Data.Monoid (Sum(..)) +-import Data.Time.LocalTime (LocalTime(..), TimeOfDay(..), ZonedTime(..), TimeZone(..), formatTime, minutesToTimeZone, utc) ++import Data.Time.Format (formatTime) ++import Data.Time.LocalTime (LocalTime(..), TimeOfDay(..), ZonedTime(..), TimeZone(..), minutesToTimeZone, utc) + import System.Locale (defaultTimeLocale) + import Data.Time.Calendar + import Text.XML.HaXml hiding (version) +@@ -55,7 +56,7 @@ + b64Encode :: String -> String + b64Encode = map e2e . B64.encode . map e2e + b64Decode :: String -> String +-b64Decode = map e2e . B64.decode . map e2e ++b64Decode = map e2e . fromJust . B64.decode . map e2e + + atomEscaper = mkXmlEscaper [('<', "lt"), ('>', "gt"), ('&', "amp"), ('"', "quot")] (`elem` "<>\"") + xEscape :: [Content] -> [Content] +diff -rN -U3 old-pg_haskellnet/Text/RSS.hs new-pg_haskellnet/Text/RSS.hs +--- old-pg_haskellnet/Text/RSS.hs 2008-04-22 19:21:58.000000000 +0200 ++++ new-pg_haskellnet/Text/RSS.hs 2008-04-22 19:21:58.000000000 +0200 +@@ -26,6 +26,7 @@ + import Data.Record + import Data.List (isPrefixOf) + import Data.Maybe ++import Data.Time.Format (formatTime) + import Data.Time.Calendar (fromGregorian) + import Data.Time.LocalTime + import System.Locale (defaultTimeLocale) +