changeset 1372:4c3f4e0e3194

improvements for packages: metis suitesparse
author Tony Theodore <tonyt@logyst.com>
date Tue, 16 Nov 2010 19:05:50 +0100
parents c9905856c931
children faa7f27b78db
files src/metis-undef-log2.patch src/metis.mk src/suitesparse.mk
diffstat 3 files changed, 48 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/src/metis-undef-log2.patch	Tue Nov 16 19:03:38 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-This file is part of mingw-cross-env.
-See doc/index.html for further information.
-
-diff urM a/metis-4.0/Lib/util.c b/metis-4.0/Lib/util.c
-*** a/metis-4.0/Lib/util.c	1998-11-30 17:26:50.000000000 +0100
---- b/metis-4.0/Lib/util.c	2010-06-21 23:32:33.783674276 +0200
-@@ -506,13 +506,3 @@
-    }
-  }
-  
-- /*************************************************************************
-- * This function returns the log2(x)
-- **************************************************************************/
-- int log2(int a)
-- {
--   int i;
-- 
--   for (i=1; a > 1; i++, a = a>>1);
--   return i-1;
-- }
-
-diff urM a/metis-4.0/Lib/proto.h b/metis-4.0/Lib/proto.h
-*** a/metis-4.0/Lib/proto.h	1998-11-30 17:26:50.000000000 +0100
---- b/metis-4.0/Lib/proto.h	2010-06-21 23:33:24.194921631 +0200
-@@ -459,4 +459,3 @@
-  void srand48(long);
-  int ispow2(int);
-  void InitRandom(int);
-- int log2(int);
-  
-  
--- a/src/metis.mk	Tue Nov 16 19:03:38 2010 +0100
+++ b/src/metis.mk	Tue Nov 16 19:05:50 2010 +0100
@@ -11,18 +11,28 @@
 $(PKG)_WEBSITE  := http://glaros.dtc.umn.edu
 $(PKG)_URL      := http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-4.0.tar.gz
 $(PKG)_DEPS     := gcc
+
 define $(PKG)_UPDATE
     wget -q -O- 'http://www.cise.ufl.edu/research/sparse/SuiteSparse/' | \
     $(SED) -n 's,.*metis-\([0-9]\.[0-9]\)\.tar.gz,\1,ip' | \
     head -1
 endef
 
-define $(PKG)_BUILD
-     cd '$(1)' && CHOST='$(TARGET)' 
-#    cd '$(1)' && CHOST='$(TARGET)' ./configure \
-#        --prefix='$(PREFIX)/$(TARGET)' \
-#        --static
-    $(MAKE) -C '$(1)' -j '$(JOBS)' 
+define $(PKG)_NO_BUILD
+    # Don't build metis here, build inline with suitesparse instead
+    # since it looks in an odd location for the headers
+    # Change this to $(PKG)_BUILD to actually build and install
+    $(SED) -i 's,cc,$(TARGET)-gcc,'        $(1)/Makefile.in
+    $(SED) -i 's,ar ,$(TARGET)-ar ,'       $(1)/Makefile.in
+    $(SED) -i 's,ranlib,$(TARGET)-ranlib,' $(1)/Makefile.in
+    $(MAKE) -C '$(1)/Lib'
+    $(INSTALL) -d '$(PREFIX)/$(TARGET)/lib'
+    $(INSTALL) -m664 '$(1)/libmetis.a'   '$(PREFIX)/$(TARGET)/lib/libmetis.a'
+    $(INSTALL) -d '$(PREFIX)/$(TARGET)/include/metis/Lib'
+    $(INSTALL) -m664 '$(1)/Lib/metis.h'  '$(PREFIX)/$(TARGET)/include/metis/Lib/metis.h'
+    $(INSTALL) -m664 '$(1)/Lib/defs.h'   '$(PREFIX)/$(TARGET)/include/metis/Lib/defs.h'
+    $(INSTALL) -m664 '$(1)/Lib/struct.h' '$(PREFIX)/$(TARGET)/include/metis/Lib/struct.h'
+    $(INSTALL) -m664 '$(1)/Lib/macros.h' '$(PREFIX)/$(TARGET)/include/metis/Lib/macros.h'
+    $(INSTALL) -m664 '$(1)/Lib/rename.h' '$(PREFIX)/$(TARGET)/include/metis/Lib/rename.h'
+    $(INSTALL) -m664 '$(1)/Lib/proto.h'  '$(PREFIX)/$(TARGET)/include/metis/Lib/proto.h'
 endef
-
-
--- a/src/suitesparse.mk	Tue Nov 16 19:03:38 2010 +0100
+++ b/src/suitesparse.mk	Tue Nov 16 19:05:50 2010 +0100
@@ -11,6 +11,7 @@
 $(PKG)_WEBSITE  := http://www.cise.ufl.edu/
 $(PKG)_URL      := http://www.cise.ufl.edu/research/sparse/SuiteSparse/SuiteSparse-3.4.0.tar.gz
 $(PKG)_DEPS     := gcc metis
+
 define $(PKG)_UPDATE
     wget -q -O- 'http://www.cise.ufl.edu/research/sparse/SuiteSparse/' | \
     $(SED) -n 's,.*SuiteSparse-\([0-9]\.[0-9]\.[0-9]\)\.tar.*,\1,ip' | \
@@ -18,11 +19,35 @@
 endef
 
 define $(PKG)_BUILD
-     cd '$(1)' && CHOST='$(TARGET)' 
-#    cd '$(1)' && CHOST='$(TARGET)' ./configure \
-#        --prefix='$(PREFIX)/$(TARGET)' \
-#        --static
-    $(MAKE) -C '$(1)' -j '$(JOBS)' 
+    
+    # If not building metis in it's makefile, then
+    # build it here since the config seems to expect it
+    cd '$(1)' && $(call UNPACK_PKG_ARCHIVE,metis)
+    $(SED) -i 's,cc,$(TARGET)-gcc,'        $(1)/$(metis_SUBDIR)/Makefile.in
+    $(SED) -i 's,ar ,$(TARGET)-ar ,'       $(1)/$(metis_SUBDIR)/Makefile.in
+    $(SED) -i 's,ranlib,$(TARGET)-ranlib,' $(1)/$(metis_SUBDIR)/Makefile.in
+    $(MAKE) -C '$(1)/$(metis_SUBDIR)/Lib' -j '$(JOBS)'
+
+    # Otherwise hack the config so it can find metis
+    #$(SED) -i 's,\(METIS_PATH = \)\(../../metis-4.0\),\1'$(PREFIX)/$(TARGET)/include/metis',' $(1)/UFconfig/UFconfig.mk
+    #$(SED) -i 's,\(METIS = \)\(../../metis-4.0/libmetis.a\),\1'$(PREFIX)/$(TARGET)/lib/libmetis.a',' $(1)/UFconfig/UFconfig.mk
+    
+    # use cross tools
+    $(SED) -i 's,cc,$(TARGET)-gcc,'        $(1)/UFconfig/UFconfig.mk
+    $(SED) -i 's,g++,$(TARGET)-g++,'       $(1)/UFconfig/UFconfig.mk
+    $(SED) -i 's,f77,$(TARGET)-gfortran,'  $(1)/UFconfig/UFconfig.mk
+    $(SED) -i 's,ar ,$(TARGET)-ar ,'       $(1)/UFconfig/UFconfig.mk
+    $(SED) -i 's,ranlib,$(TARGET)-ranlib,' $(1)/UFconfig/UFconfig.mk
+
+    # use BLAS from GSL since it's already part of mingw-cross-env
+    $(SED) -i 's,-lblas -lgfortran -lgfortranbegin -lg2c,-lgslcblas -lgfortran -lgfortranbegin,' $(1)/UFconfig/UFconfig.mk
+    
+    # however, we get linking errros
+    #$(MAKE) -C '$(1)' -j '$(JOBS)'
+
+    # CHOLMOD has no errors on it's own though, but seems to be missing a link step
+    $(MAKE) -C '$(1)/CHOLMOD/Lib' -j '$(JOBS)'
+
 endef