[add a bunch of external libraries to distribution and mechanism for pulling packages from hackage
John Meacham <john@repetae.net>**20100722011355
 Ignore-this: 8e9797965209b5323ce8fa2c844d15c7
] hunk ./Makefile.am 57
-JHC_LIBS =  jhc-1.0.hl base-1.0.hl haskell98-1.0.hl applicative-1.0.hl containers-0.2.0.hl
+JHC_LIBS =  jhc-1.0.hl base-1.0.hl haskell98-1.0.hl applicative-1.0.hl
+JHC_EXT_LIBS = containers-0.3.0.0.hl Diff-0.1.2.hl html-1.0.1.2.hl HUnit-1.2.2.1.hl pretty-1.0.1.1.hl \
+	safe-0.2.hl smallcheck-0.4.hl utility-ht-0.0.5.1.hl xhtml-3000.2.0.1.hl
hunk ./Makefile.am 63
-             lib/jhc lib/base lib/haskell98 lib/haskell98.cabal $(JHC_LIBS)    \
+             lib/jhc lib/base lib/haskell98 lib/haskell98.cabal $(JHC_LIBS) $(JHC_EXT_LIBS)   \
hunk ./Makefile.am 65
-	     src/StringTable/Atom.hsc jhc.spec lib/applicative/applicative.cabal lib/containers.cabal \
-	     manual.html lib/containers lib/applicative examples/HelloWorld.hs examples/Calendar.hs \
-	     src/FlagOpts.flags src/FlagDump.flags
+	     src/StringTable/Atom.hsc jhc.spec lib/applicative/applicative.cabal  \
+	     manual.html lib/applicative examples/HelloWorld.hs examples/Calendar.hs \
+	     src/FlagOpts.flags src/FlagDump.flags lib/ext
hunk ./Makefile.am 80
-	test -d lib/containers || darcs get --partial http://darcs.haskell.org/packages/containers --repodir=lib/containers
hunk ./Makefile.am 84
-install-data-hook: $(JHC_LIBS)
+install-data-hook: $(JHC_LIBS) $(JHC_EXT_LIBS)
hunk ./Makefile.am 88
-	for lib in $(JHC_LIBS); do  \
+	for lib in $(JHC_LIBS) $(JHC_EXT_LIBS); do  \
hunk ./Makefile.am 97
-	for lib in $(JHC_LIBS); do  \
+	for lib in $(JHC_LIBS) $(JHC_EXT_LIBS); do  \
hunk ./Makefile.am 244
-containers-0.2.0.hl: lib/containers.cabal base-1.0.hl applicative-1.0.hl
-	./jhc $(LIB_OPTIONS) -Isrc/data -Ilib/containers/include -ilib/containers -pjhc -pbase -papplicative -fcpp --build-hl $<  -o $@
-
hunk ./Makefile.am 286
-libs: $(JHC_LIBS)
+libs: $(JHC_LIBS) $(JHC_EXT_LIBS)
+
+$(JHC_EXT_LIBS): lib/ext/*.cabal
+	perl utils/build_extlibs.prl $^
+
+show_elibs: lib/ext/*.cabal
+	-perl utils/build_extlibs.prl -l $^
+
hunk ./lib/containers.cabal 1
-name:       containers
-version:    0.2.0.1
-license:    BSD3
-license-file:    LICENSE
-maintainer:    libraries@haskell.org
-bug-reports: http://hackage.haskell.org/trac/ghc/newticket?component=libraries%20%28other%29
-synopsis:   Assorted concrete container types
-category:   Data Structures
-description:
-        This package contains efficient general-purpose implementations
-        of various basic immutable container types.  The declared cost of
-        each operation is either worst-case or amortized, but remains
-        valid even if structures are shared.
-build-type: Simple
-extra-source-files: include/Typeable.h
-extensions: CPP
-
-exposed-modules:
-        Data.Graph
-        Data.IntMap
-        Data.IntSet
-        Data.Map
-        Data.Sequence
-        Data.Set
-        Data.Tree
-
rmfile ./lib/containers.cabal
adddir ./lib/ext
addfile ./lib/ext/Diff.cabal
hunk ./lib/ext/Diff.cabal 1
+name:                Diff
+version:             0.1.2
+synopsis:            O(ND) diff algorithm in haskell.
+description:         Basic implementation of the standard diff algorithm.
+exposed-modules:   Data.Algorithm.Diff
addfile ./lib/ext/HUnit.cabal
hunk ./lib/ext/HUnit.cabal 1
+Name:                   HUnit
+Version:                1.2.2.1
+options:                -fcpp
+Homepage:               http://hunit.sourceforge.net/
+Category:               Testing
+Synopsis:               A unit testing framework for Haskell
+Description:
+    HUnit is a unit testing framework for Haskell, inspired by the
+    JUnit tool for Java, see: <http://www.junit.org>.
+
+Exposed-Modules: Test.HUnit.Base,
+        Test.HUnit.Lang,
+        Test.HUnit.Terminal,
+        Test.HUnit.Text,
+        Test.HUnit
addfile ./lib/ext/containers.cabal
hunk ./lib/ext/containers.cabal 1
+name:       containers
+version:    0.3.0.0
+options:    -fcpp -Isrc/data -papplicative
+license:    BSD3
+license-file:    LICENSE
+maintainer:    libraries@haskell.org
+bug-reports: http://hackage.haskell.org/trac/ghc/newticket?component=libraries%20%28other%29
+synopsis:   Assorted concrete container types
+category:   Data Structures
+description:
+        This package contains efficient general-purpose implementations
+        of various basic immutable container types.  The declared cost of
+        each operation is either worst-case or amortized, but remains
+        valid even if structures are shared.
+build-type: Simple
+extra-source-files: include/Typeable.h
+extensions: CPP
+
+exposed-modules:
+        Data.Graph
+        Data.IntMap
+        Data.IntSet
+        Data.Map
+        Data.Sequence
+        Data.Set
+        Data.Tree
+
addfile ./lib/ext/containers.patch
hunk ./lib/ext/containers.patch 1
+Only in containers-0.3.0.0: containers.patch
+diff -ru containers-0.3.0.0/Data/Sequence.hs containers-0.3.0.0-new/Data/Sequence.hs
+--- containers-0.3.0.0/Data/Sequence.hs	2009-11-19 07:51:36.000000000 -0800
++++ containers-0.3.0.0-new/Data/Sequence.hs	2010-07-21 13:42:30.000000000 -0700
+@@ -1501,7 +1501,7 @@
+ 				foldrWithIndex g n xs)
+ #else
+ findIndicesL p xs = foldrWithIndex g [] xs where
+-g i x is = if p x then i:is else is
++    g i x is = if p x then i:is else is
+ #endif
+ 
+ {-# INLINE findIndicesR #-}
+@@ -1513,7 +1513,7 @@
+ 				foldlWithIndex g n xs)
+ #else
+ findIndicesR p xs = foldlWithIndex g [] xs where
+-g is i x = if p x then i:is else is
++    g is i x = if p x then i:is else is
+ #endif
+ 
+ ------------------------------------------------------------------------
addfile ./lib/ext/html.cabal
hunk ./lib/ext/html.cabal 1
+name:		html
+version:	1.0.1.2
+license:	BSD3
+license-file:	LICENSE
+maintainer:	libraries@haskell.org
+synopsis:	HTML combinator library
+category:       Web
+build-depends:  base>=2.0
+description:
+	This package contains a combinator library for constructing
+        HTML documents.
+build-type:     Simple
+exposed-modules:
+	Text.Html
+	Text.Html.BlockTable
+nhc98-options: -K2M
addfile ./lib/ext/pretty.cabal
hunk ./lib/ext/pretty.cabal 1
+name:		pretty
+version:	1.0.1.1
+synopsis:	Pretty-printing library
+category:       Text
+description:
+	This package contains John Hughes's pretty-printing library,
+        heavily modified by Simon Peyton Jones.
+Exposed-Modules:
+        Text.PrettyPrint
+        Text.PrettyPrint.HughesPJ
addfile ./lib/ext/safe.cabal
hunk ./lib/ext/safe.cabal 1
+Name:           safe
+Build-Type:     Simple
+Version:        0.2
+License:        BSD3
+License-File:   LICENSE
+Copyright:      2007-8, Neil Mitchell
+Maintainer:     ndmitchell@gmail.com
+Author:         Neil Mitchell
+Homepage:       http://www-users.cs.york.ac.uk/~ndm/safe/
+Build-Depends:  base
+Category:       Unclassified
+Synopsis:       Library for safe (pattern match free) functions
+Description:
+    Partial functions from the base library, such as @head@ and @!!@, modified
+    to return more descriptive error messages, programmer defined error messages,
+    @Maybe@ wrapped results and default values.
+
+    These functions can be used to reduce the number of unsafe pattern matches in
+    your code.
+Exposed-modules:
+        Safe
addfile ./lib/ext/smallcheck.cabal
hunk ./lib/ext/smallcheck.cabal 1
+Name:          smallcheck
+Version:       0.4
+Author:        Colin Runciman
+Synopsis:      Another lightweight testing library in Haskell.
+Description:   SmallCheck is similar to QuickCheck (Claessen and Hughes 2000-) but
+               instead of testing for a sample of randomly generated values, SmallCheck
+               tests properties for all the finitely many values up to some depth,
+               progressively increasing the depth used.
+
+Build-Depends: base, haskell98
+Exposed-modules:    Test.SmallCheck
addfile ./lib/ext/smallcheck.patch
hunk ./lib/ext/smallcheck.patch 1
+diff -ru smallcheck-0.4/Test/SmallCheck.hs smallcheck-0.4-new/Test/SmallCheck.hs
+--- smallcheck-0.4/Test/SmallCheck.hs	2008-05-23 07:04:15.000000000 -0700
++++ smallcheck-0.4-new/Test/SmallCheck.hs	2010-07-21 15:59:11.000000000 -0700
+@@ -428,5 +428,5 @@
+ progressReport i n x | n >= x = do
+   when i $ ( putStr (n' ++ replicate (length n') '\b') >>
+              hFlush stdout )
+-  where
++ where
+   n' = show n
addfile ./lib/ext/utility-ht.cabal
hunk ./lib/ext/utility-ht.cabal 1
+Name:             utility-ht
+Version:          0.0.5.1
+Author:           Henning Thielemann <haskell@henning-thielemann.de>
+Maintainer:       Henning Thielemann <haskell@henning-thielemann.de>
+Category:         Data, List
+Synopsis:         Various small helper functions for Lists, Maybes, Tuples, Functions
+Description:
+  Various small helper functions for Lists, Maybes, Tuples, Functions.
+  Some of these functions are improved implementations of standard functions.
+  They have the same name as their standard counterparts.
+
+  The package only contains functions
+  that do not require packages other than the base package.
+  Thus you do not risk a dependency avalanche by importing it.
+  However, further splitting the base package might invalidate this statement.
+
+Exposed-Modules:
+    Data.Bool.HT
+    Data.Eq.HT
+    Data.Function.HT
+    Data.List.HT
+    Data.List.Key
+    Data.List.Match
+    Data.Maybe.HT
+    Data.Ord.HT
+    Data.Record.HT
+    Data.String.HT
+    Data.Tuple.HT
+    Control.Monad.HT
+    Data.Strictness.HT
+    Text.Read.HT
+    Text.Show.HT
+
+Hidden-Modules:
+    Data.Bool.HT.Private
+    Data.List.HT.Private
+    Data.List.Key.Private
+    Data.List.Match.Private
+    Data.Function.HT.Private
+    Data.Record.HT.Private
+
addfile ./lib/ext/xhtml.cabal
hunk ./lib/ext/xhtml.cabal 1
+Name: xhtml
+Version: 3000.2.0.1
+Copyright: Bjorn Bringert 2004-2006, Andy Gill, and the Oregon Graduate
+           Institute of Science and Technology, 1999-2001
+Maintainer: bjorn@bringert.net
+Author: Bjorn Bringert
+License: BSD3
+License-file: LICENSE
+build-depends: base
+Extensions:
+Synopsis: An XHTML combinator library
+Description:
+ This package provides combinators for producing
+  XHTML 1.0, including the Strict, Transitional and Frameset variants.
+Build-Type: Simple
+Exposed-Modules:
+  Text.XHtml,
+  Text.XHtml.Frameset,
+  Text.XHtml.Strict,
+  Text.XHtml.Transitional,
+  Text.XHtml.Debug,
+  Text.XHtml.Table
+Hidden-modules:
+  Text.XHtml.Strict.Attributes,
+  Text.XHtml.Strict.Elements,
+  Text.XHtml.Frameset.Attributes,
+  Text.XHtml.Frameset.Elements,
+  Text.XHtml.Transitional.Attributes,
+  Text.XHtml.Transitional.Elements,
+  Text.XHtml.BlockTable,
+  Text.XHtml.Extras,
+  Text.XHtml.Internals
+ghc-options: -O2 -W
addfile ./utils/build_extlibs.prl
hunk ./utils/build_extlibs.prl 1
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use LWP::Simple;
+use Cwd;
+use Getopt::Std;
+
+our $opt_l;
+getopts('l') or die "unknown opt";
+
+
+
+my $tmpdir = "tmp/build";
+
+mkdir "tmp";
+mkdir "tmp/build";
+
+sub mysystem {
+    print( (join " ", @_), '\n');
+    system @_;
+}
+
+foreach my $fn (@ARGV) {
+    next unless $fn =~ /\.cabal$/;
+    my $patch = $fn;
+    $patch =~ s/\.cabal$/.patch/;
+    print "Processing $fn\n" unless $opt_l;
+    open my $fh, "<", $fn or die "$!: $fn";
+    my ($name,$version,$options);
+    $options = "";
+    while(<$fh>) {
+        $name = $1 if /^name:\s*(.*?)\s*$/i;
+        $version = $1 if /^version:\s*(.*?)\s*$/i;
+        $options = $1 if /^options:\s*(.*?)\s*$/i;
+    }
+    next unless $name;
+    next unless $version;
+
+    print("$name-$version.hl\n"),next if $opt_l;
+
+    print "Processing $fn, found $name-$version\n";
+    my $url = "http://hackage.haskell.org/packages/archive/$name/$version/$name-$version.tar.gz";
+    print "Fetching $url\n";
+    unless(-e "$tmpdir/$name-$version.tar.gz") {
+        getstore($url, "$tmpdir/$name-$version.tar.gz") or die "$!: $url";
+    }
+    mysystem "tar -zxv --directory $tmpdir -f $tmpdir/$name-$version.tar.gz" and die "$!: tar";
+    my $src = -d "$tmpdir/$name-$version/src" ? "/src" : "";
+    mysystem "patch -d $tmpdir/$name-$version -p1 < $patch" if -e $patch;
+    mysystem "./jhc $options --build-hl $fn -L. -i$tmpdir/$name-$version$src" and die "$!: jhc";
+}
+
+