Attachment 'install-dependencies.py'

Download

   1 #!/usr/bin/env python
   2 # This is designed for OSX Leopard. The URL links are up to date as of 5/6/2008
   3 # In theory if one of the URL's is out of date, you should only need to replace
   4 # the URL. The rest of the script should still function properly. Note that this
   5 # script installs dependencies, but not EMAN2 itself. Also, it is safe to rerun
   6 # this script, as it will do basic checks to avoid unnecessary recompilations.
   7 #
   8 # You will need to install Qt-Mac:
   9 #
  10 # ftp://ftp.trolltech.com/qt/source/qt-mac-opensource-4.4.0.dmg
  11 # 
  12 # Manually before running this script
  13 
  14 from urllib import urlopen
  15 from os import *
  16 
  17 ftg={ "setup":"http://peak.telecommunity.com/dist/ez_setup.py",
  18 #"png":"http://superb-east.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.28.tar.bz2",
  19 "jpeg":"http://www.ijg.org/files/jpegsrc.v6b.tar.gz",
  20 "gpg":"ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.9.tar.bz2",
  21 "sip":"http://www.riverbankcomputing.co.uk/static/Downloads/sip4/sip-4.7.4.tar.gz",
  22 "pyqt":"http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-mac-gpl-4.3.3.tar.gz",
  23 "fftw":"http://www.fftw.org/fftw-3.1.2.tar.gz",
  24 "gsl":"http://mirror.anl.gov/pub/gnu/gsl/gsl-1.11.tar.gz",
  25 "jam":"http://internap.dl.sourceforge.net/sourceforge/boost/boost-jam-3.1.16.tgz",
  26 "boost":"http://internap.dl.sourceforge.net/sourceforge/boost/boost_1_34_1.tar.bz2",
  27 "cmake":"http://www.cmake.org/files/v2.4/cmake-2.4.8.tar.gz",
  28 "hdf5":"ftp://ftp.hdfgroup.org/HDF5/current/src/hdf5-1.8.0.tar.gz",
  29 "tiff":"ftp://ftp.remotesensing.org/pub/libtiff/tiff-3.8.2.tar.gz",
  30 "pyopengl":"http://superb-east.dl.sourceforge.net/sourceforge/pyopengl/PyOpenGL-3.0.0b2.tar.gz"}
  31 
  32 fsp={}
  33 for i in ftg: fsp[i]=ftg[i].split("/")[-1]
  34 
  35 path=getenv("HOME")+"/EMAN2/src"
  36 try: makedirs(path)
  37 except: pass
  38 system("chown -R %s ~/EMAN2"%getenv("SUDO_USER"))
  39 
  40 chdir(path)
  41 print "Running in ",path
  42 
  43 for i in ftg:
  44 	if not access(fsp[i],R_OK) : 
  45 		print "Retrieving ",i
  46 		file(fsp[i],"w").write(urlopen(ftg[i]).read())
  47 	else: print "Already have ",i
  48 
  49 # easy setup
  50 if system("which ipython") :
  51 	system("python ez_setup.py")
  52 	system("easy_install ipython")
  53 	
  54 # fftw
  55 if not access("/usr/local/lib/libfftw3f.3.dylib",R_OK) :
  56 	system("tar xvzf "+fsp["fftw"])
  57 	system("cd %s; ./configure --enable-float --enable-shared --prefix=/usr/local; make; make install"%fsp["fftw"][:-7])
  58 
  59 # GSL
  60 if not access("/usr/local/lib/libgsl.dylib",R_OK):
  61 	system("tar xvzf "+fsp["gsl"])
  62 	system("cd %s; ./configure --prefix=/usr/local; make; make install"%fsp["gsl"][:-7])
  63 
  64 # jpg
  65 if not access("/usr/local/lib/libjpeg.a",R_OK):
  66 	system("tar xvzf "+fsp["jpeg"])
  67 	system("cd jpeg-6b; cp /usr/share/libtool/config.sub .; cp /usr/share/libtool/config.guess .; ./configure --enable-shared --enable-static --prefix=/usr/local; make; make install;ranlib /usr/local/lib/libjpeg.a")
  68 
  69 # tiff
  70 if not access("/usr/local/lib/libtiff.dylib",R_OK):
  71 	system("tar xvzf "+fsp["tiff"])
  72 	system("cd %s; ./configure --prefix=/usr/local; make; make install"%fsp["tiff"][:-7])
  73 
  74 # boost
  75 if system("which bjam") :
  76 	system("tar xvzf "+fsp["jam"])
  77 	system("cd %s; ./build.sh; cp bin.macosxx86/bjam /usr/local/bin/"%fsp["jam"][:-4])
  78 	
  79 	system("tar xvjf "+fsp["boost"])
  80 	system("cd %s; bjam --toolset=darwin install"%fsp["boost"][:-8])
  81 
  82 # HDF5
  83 if not access("/usr/local/lib/libhdf5.dylib",R_OK):
  84 	system("tar xvzf "+fsp["hdf5"])
  85 	system("cd %s; ./configure --prefix=/usr/local --with-default-api-version=v16; make; make install"%fsp["hdf5"][:-7])
  86 
  87 # cmake
  88 if not access("/usr/local/bin/cmake",R_OK):
  89 	system("tar xvzf "+fsp["cmake"])
  90 	system("cd %s; ./configure --prefix=/usr/local; make; make install"%fsp["cmake"][:-7])
  91 
  92 # SIP
  93 try: import sip
  94 except:
  95 	system("tar xvzf "+fsp["sip"])
  96 	system("cd %s; python configure.py; make; make install"%fsp["sip"][:-7])
  97 
  98 # PyQt
  99 try: import PyQt4
 100 except:
 101 	system("tar xvzf "+fsp["pyqt"])
 102 	system("cd %s; echo 'yes' | python configure.py; make; make install"%fsp["pyqt"][:-7])
 103 
 104 # PyOpenGL
 105 try: import OpenGL
 106 except:
 107 	system("tar xvzf "+fsp["pyopengl"])
 108 	system("cd %s; python setup.py install"%fsp["pyopengl"][:-7])
 109 
 110 try: import matplotlib
 111 except:
 112 	system("easy_install matplotlib")
 113 
 114 # GPG
 115 if not access("/usr/local/bin/gpg",R_OK) :
 116 	system("tar xvjf "+fsp["gpg"])
 117 	system("cd %s; ./configure --prefix=/usr/local; make; make install"%fsp["gpg"][:-8])

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.