add support for ghc6.5 and IntelMac
authoradam <adam@megacz.com>
Sun, 3 Sep 2006 07:48:53 +0000 (03:48 -0400)
committeradam <adam@megacz.com>
Sun, 3 Sep 2006 07:48:53 +0000 (03:48 -0400)
darcs-hash:20060903074853-5007d-e899d2a2ece0f8d4cffd78bdec5e903ea9f295bc.gz

Makefile
README.Haskell [new file with mode: 0644]
misc/jvm-bridge.intelmac1.patch [new file with mode: 0644]
misc/jvm-bridge.intelmac2.patch [new file with mode: 0644]
misc/jvm-bridge.intelmac2.patch+ [new file with mode: 0644]
misc/jvm-bridge.intelmac3 [new file with mode: 0644]
misc/jvm-bridge.patch [new file with mode: 0644]

index 25f6802..205b410 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -139,28 +139,46 @@ upload:
 ##   make runHaskellDemo JAVA_HOME=<java-home>
 ##
 
-prefix          := $(shell pwd)/prefix
-jvm-bridge-site := umn.dl.sourceforge.net
-jvm-bridge-url  := http://$(jvm-bridge-site)/sourceforge/jvm-bridge/haskell-jvm-bridge-0.3.tar.gz
-link            := -L$(prefix)/lib/ \
+ifeq ($(shell uname),Darwin)
+with_jvmdir = --with-jvmdir=/System/Library/Frameworks/JavaVM.framework/
+jvmlink     = -framework JavaVM -optl -fexceptions
+else
+with_jvmdir = --with-jvmdir=$(JAVA_HOME)
+jvmlink     = -ljava -ljvm -lverify
+endif
+
+prefix          = $(shell pwd)/prefix
+jvm-bridge-site = umn.dl.sourceforge.net
+jvm-bridge-url  = http://$(jvm-bridge-site)/sourceforge/jvm-bridge/haskell-jvm-bridge-0.3.tar.gz
+link            = -L$(prefix)/lib/ \
                    -L$(JAVA_HOME)/jre/lib/i386/ \
                    -L$(JAVA_HOME)/jre/lib/i386/client/ \
-                   -lstdc++ -lJVMBridge -lJVMInvocation -lHaskellJVMBridge -ljava -ljvm -lverify
-packages        := -package haskell98 -package base -package rts -package concurrent -package lang
-ghc             := ghc -fglasgow-exts $(packages) $(link) -i$(prefix)/imports/
-bin             := $(prefix)/bin/
+                   -lstdc++ -lJVMBridge -lJVMInvocation -lHaskellJVMBridge $(jvmlink)
+packages        = -package haskell98 -package base -package rts -package rts
+ghc             = ghc -fglasgow-exts $(packages) $(link) -i$(prefix)/imports/
+bin             = $(prefix)/bin/
 
 .jvm-bridge:
        mkdir -p $(prefix)/src
-       cd $(prefix)/src; curl $(jvm-bridge-url) | tar -xvzf -
 
-       cd $(prefix)/src/haskell-jvm-bridge-*/Native; ./configure --prefix=$(prefix) --with-jvmdir=$(JAVA_HOME)
-       cd $(prefix)/src/haskell-jvm-bridge-*/Native; make
-       cd $(prefix)/src/haskell-jvm-bridge-*/Native; make install
+       cd $(prefix)/src; \
+               curl $(jvm-bridge-url) | tar -xvzf -
 
-       cd $(prefix)/src/haskell-jvm-bridge-*/Haskell; ./configure --prefix=$(prefix) --with-jvmdir=$(JAVA_HOME)
-       cd $(prefix)/src/haskell-jvm-bridge-*/Haskell; make
-       cd $(prefix)/src/haskell-jvm-bridge-*/Haskell; make install
+       cd $(prefix)/src/haskell-jvm-bridge-*; \
+               patch -p0 < $(shell pwd)/misc/jvm-bridge.patch && \
+               patch -p0 < $(shell pwd)/misc/jvm-bridge.intelmac2.patch && \
+               (cd Native; autoreconf; true) && \
+               (cd Haskell; autoreconf; true)
+
+       cd $(prefix)/src/haskell-jvm-bridge-*/Native; \
+               ./configure --prefix=$(prefix) $(with_jvmdir) && \
+               make && \
+               make install
+
+       cd $(prefix)/src/haskell-jvm-bridge-*/Haskell; \
+               ./configure --prefix=$(prefix) $(with_jvmdir) && \
+               make && \
+               make install
 
        touch $@
 
@@ -189,4 +207,5 @@ bin/HaskellDemo: src/HaskellDemo.hs \
                bin/Class_edu_berkeley_sbp_Tree.o \
                bin/JVM_edu_berkeley_sbp_misc_HaskellHelper.o
        cd bin; $(ghc) -c ../src/HaskellDemo.hs -o HaskellDemo.o
+       cd bin; for A in *.hs; do $(ghc) -c $$A; done
        cd bin; $(ghc) -o HaskellDemo *.o
diff --git a/README.Haskell b/README.Haskell
new file mode 100644 (file)
index 0000000..8fa3ddd
--- /dev/null
@@ -0,0 +1,9 @@
+This repo contains experimental Haskell bindings; to try them, run:
+
+  make runHaskellDemo
+
+You need a fairly recent ghc 6.5; I recommend this one:
+
+  http://www.haskell.org/ghc/dist/current/dist/ghc-6.5.20060608-src.tar.bz2
+
+  - a
\ No newline at end of file
diff --git a/misc/jvm-bridge.intelmac1.patch b/misc/jvm-bridge.intelmac1.patch
new file mode 100644 (file)
index 0000000..43e29db
--- /dev/null
@@ -0,0 +1,21 @@
+--- Haskell/Makefile.am        2003-11-03 12:49:54.000000000 -0800
++++ Haskell/Makefile.am        2006-09-02 23:50:38.000000000 -0700
+@@ -3,7 +3,8 @@
+ JVMFILE                       = $(datadir)/current.jvm
+-HCPACKAGES            = -package lang -package concurrent
++#HCPACKAGES           = -package lang -package concurrent
++HCPACKAGES            = -package rts
+ HCIMPORTDIRS  = -i.
+ HCCOPTS                       = -I$(includedir_FIX) $${JVM_INCLUDES}
+ HCHOPTS                       = -fglasgow-exts -fallow-undecidable-instances -package-name $(GHCPACKAGENAME)
+@@ -14,7 +15,7 @@
+ CFLAGS                        = -I$(includedir_FIX) -I$(HC_INCDIR)
+-BOOTLDFLAGS           = -L$(libdir_FIX)/ -lJVMBridge -lJVMInvocation `echo "$${JVM_LDFLAGS}" | sed -e 's/  */ -optl/g;s/^/-optl/'` -lstdc++
++BOOTLDFLAGS           = -L$(libdir_FIX)/ -lJVMBridge -lJVMInvocation `echo "$${JVM_LDFLAGS}" | sed -e 's/  */ -optl/g;s/^/-optl/'` -lstdc++ -optl '-fexceptions' 
+ BOOTLDFLAGS           += `(test -f $(libdir_FIX)/libjvm_imp.a && echo " -L$(libdir_FIX) -ljvm_imp ") || echo ""`
+ BOOT_SRCS = \
diff --git a/misc/jvm-bridge.intelmac2.patch b/misc/jvm-bridge.intelmac2.patch
new file mode 100644 (file)
index 0000000..86f5fa9
--- /dev/null
@@ -0,0 +1,59 @@
+--- Haskell/Makefile.am        2006-09-02 23:50:38.000000000 -0700
++++ Haskell/Makefile.am        2003-11-03 12:49:54.000000000 -0800
+@@ -3,7 +3,8 @@
+ JVMFILE                       = $(datadir)/current.jvm
++#HCPACKAGES           = -package lang -package concurrent
++HCPACKAGES            = -package rts
+-HCPACKAGES            = -package lang -package concurrent
+ HCIMPORTDIRS  = -i.
+ HCCOPTS                       = -I$(includedir_FIX) $${JVM_INCLUDES}
+ HCHOPTS                       = -fglasgow-exts -fallow-undecidable-instances -package-name $(GHCPACKAGENAME)
+@@ -15,7 +14,7 @@
+ CFLAGS                        = -I$(includedir_FIX) -I$(HC_INCDIR)
++BOOTLDFLAGS           = -L$(libdir_FIX)/ -lJVMBridge -lJVMInvocation -framework JavaVM -optl -fexceptions  -lstdc++ -optl '-fexceptions' 
+-BOOTLDFLAGS           = -L$(libdir_FIX)/ -lJVMBridge -lJVMInvocation `echo "$${JVM_LDFLAGS}" | sed -e 's/  */ -optl/g;s/^/-optl/'` -lstdc++
+ BOOTLDFLAGS           += `(test -f $(libdir_FIX)/libjvm_imp.a && echo " -L$(libdir_FIX) -ljvm_imp ") || echo ""`
+ BOOT_SRCS = \
+diff -u ./MonadException.hs ../../haskell-jvm-bridge-0.3.RC1/Haskell/MonadException.hs
+--- Haskell/MonadException.hs  2006-09-02 23:42:19.000000000 -0700
++++ Haskell/MonadException.hs  2002-01-28 18:21:35.000000000 -0800
+@@ -20,7 +20,7 @@
+ module MonadException where
+       {
++      import Control.Exception as Exception;
+-      import Exception;
+       
+       -- much like MonadError, but without the fundep
+       class (Monad m) => MonadException ex m where
+diff -u ./TypedCallback.hs ../../haskell-jvm-bridge-0.3.RC1/Haskell/TypedCallback.hs
+--- Haskell/TypedCallback.hs   2006-09-02 23:43:13.000000000 -0700
++++ Haskell/TypedCallback.hs   2002-08-05 17:27:04.000000000 -0700
+@@ -33,8 +33,8 @@
+       import VMLayer;
+       import JavaLayer;
+       import BasicLayer;
++      import Control.Concurrent as Concurrent;
++      import Control.Exception as Exception;
+-      import Concurrent;
+-      import Exception;
+ {--
+       data CallbackClass t = MkCallbackClass JClass;
+diff -u ./TypedLayer.hs ../../haskell-jvm-bridge-0.3.RC1/Haskell/TypedLayer.hs
+--- Haskell/TypedLayer.hs      2006-09-02 23:44:06.000000000 -0700
++++ Haskell/TypedLayer.hs      2002-01-28 18:21:35.000000000 -0800
+@@ -60,7 +60,7 @@
+       import VMLayer;
+       import JavaLayer;
+       import BasicLayer;
++      import Control.Monad.Error;
+-      import MonadError;
+       runJavaClass :: (IsJVMMonad m) => ClassName -> [JString] -> m ();
+       runJavaClass className args = do
diff --git a/misc/jvm-bridge.intelmac2.patch+ b/misc/jvm-bridge.intelmac2.patch+
new file mode 100644 (file)
index 0000000..86f5fa9
--- /dev/null
@@ -0,0 +1,59 @@
+--- Haskell/Makefile.am        2006-09-02 23:50:38.000000000 -0700
++++ Haskell/Makefile.am        2003-11-03 12:49:54.000000000 -0800
+@@ -3,7 +3,8 @@
+ JVMFILE                       = $(datadir)/current.jvm
++#HCPACKAGES           = -package lang -package concurrent
++HCPACKAGES            = -package rts
+-HCPACKAGES            = -package lang -package concurrent
+ HCIMPORTDIRS  = -i.
+ HCCOPTS                       = -I$(includedir_FIX) $${JVM_INCLUDES}
+ HCHOPTS                       = -fglasgow-exts -fallow-undecidable-instances -package-name $(GHCPACKAGENAME)
+@@ -15,7 +14,7 @@
+ CFLAGS                        = -I$(includedir_FIX) -I$(HC_INCDIR)
++BOOTLDFLAGS           = -L$(libdir_FIX)/ -lJVMBridge -lJVMInvocation -framework JavaVM -optl -fexceptions  -lstdc++ -optl '-fexceptions' 
+-BOOTLDFLAGS           = -L$(libdir_FIX)/ -lJVMBridge -lJVMInvocation `echo "$${JVM_LDFLAGS}" | sed -e 's/  */ -optl/g;s/^/-optl/'` -lstdc++
+ BOOTLDFLAGS           += `(test -f $(libdir_FIX)/libjvm_imp.a && echo " -L$(libdir_FIX) -ljvm_imp ") || echo ""`
+ BOOT_SRCS = \
+diff -u ./MonadException.hs ../../haskell-jvm-bridge-0.3.RC1/Haskell/MonadException.hs
+--- Haskell/MonadException.hs  2006-09-02 23:42:19.000000000 -0700
++++ Haskell/MonadException.hs  2002-01-28 18:21:35.000000000 -0800
+@@ -20,7 +20,7 @@
+ module MonadException where
+       {
++      import Control.Exception as Exception;
+-      import Exception;
+       
+       -- much like MonadError, but without the fundep
+       class (Monad m) => MonadException ex m where
+diff -u ./TypedCallback.hs ../../haskell-jvm-bridge-0.3.RC1/Haskell/TypedCallback.hs
+--- Haskell/TypedCallback.hs   2006-09-02 23:43:13.000000000 -0700
++++ Haskell/TypedCallback.hs   2002-08-05 17:27:04.000000000 -0700
+@@ -33,8 +33,8 @@
+       import VMLayer;
+       import JavaLayer;
+       import BasicLayer;
++      import Control.Concurrent as Concurrent;
++      import Control.Exception as Exception;
+-      import Concurrent;
+-      import Exception;
+ {--
+       data CallbackClass t = MkCallbackClass JClass;
+diff -u ./TypedLayer.hs ../../haskell-jvm-bridge-0.3.RC1/Haskell/TypedLayer.hs
+--- Haskell/TypedLayer.hs      2006-09-02 23:44:06.000000000 -0700
++++ Haskell/TypedLayer.hs      2002-01-28 18:21:35.000000000 -0800
+@@ -60,7 +60,7 @@
+       import VMLayer;
+       import JavaLayer;
+       import BasicLayer;
++      import Control.Monad.Error;
+-      import MonadError;
+       runJavaClass :: (IsJVMMonad m) => ClassName -> [JString] -> m ();
+       runJavaClass className args = do
diff --git a/misc/jvm-bridge.intelmac3 b/misc/jvm-bridge.intelmac3
new file mode 100644 (file)
index 0000000..52e04ba
--- /dev/null
@@ -0,0 +1,11 @@
+--- Haskell/javavm.ghc-pkg.m4  2003-07-22 05:52:53.000000000 -0700
++++ Haskell/javavm.ghc-pkg.m4  2006-09-03 00:40:39.000000000 -0700
+@@ -31,7 +31,7 @@
+       extra_libraries  = ["stdc++","JVMBridge","JVMInvocation","HaskellJVMBridge"`'patsubst(patsubst(patsubst(JVM_LDFLAGS,`-framework[        ]+[^    ]+',`'),`-L[^   ]+',`'),`[      ]*-l\([^        ]+\)[   ]*',`,"\1"')],
+       include_dirs     = [],
+       c_includes       = [],
+-      package_deps     = ["lang","concurrent","haskell98"],
++      package_deps     = ["rts","haskell98"],
+       extra_ghc_opts   = ["-fglasgow-exts","-fallow-undecidable-instances"],
+       extra_cc_opts    = [],
+       extra_frameworks = [patsubst(patsubst(patsubst(patsubst(JVM_LDFLAGS,`-L[^       ]+[     ]*',`'),`-l[^   ]+[     ]*',`'),`-framework[    ]+\([^  ]+\)',``,"\1"''),`^,',`')],
diff --git a/misc/jvm-bridge.patch b/misc/jvm-bridge.patch
new file mode 100644 (file)
index 0000000..b45c074
--- /dev/null
@@ -0,0 +1,12 @@
+--- Native/configure.in        2006-09-02 15:34:01.000000000 -0700
++++ Native/configure.in        2006-09-02 15:33:11.000000000 -0700
+@@ -105,7 +105,7 @@
+ ],[DEBUG_CPPFLAGS=""])
+
+ # hack for Cygwin
+-CYGPATH=`which cygpath`
++type cygpath && CYGPATH=`which cygpath`
+
+ JVM=""
+ for TESTJVM in $(sed -e '/^#.*/ d' jvm.list | grep "${JVMFILTER}") ; do
+