Skip to content

Instantly share code, notes, and snippets.

@sabman
Created July 21, 2010 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sabman/484446 to your computer and use it in GitHub Desktop.
Save sabman/484446 to your computer and use it in GitHub Desktop.
require 'formula'
class Gdal <Formula
url 'http://download.osgeo.org/gdal/gdal-1.7.2.tar.gz'
homepage 'http://www.gdal.org/'
md5 '05351f8cb61761ae579667e24a297fe6'
def options
[
['--with-pg', "Include PostgreSQL support."],
['--with-cfitsio', "Include FITS support."],
['--with-netcdf', "Include netCDF support."],
['--with-hdf5', "Include HDF5 support."],
['--with-jasper', "Include JPEG-2000 support via JasPer library."],
['--with-mysql', "Include MySQL support."],
['--with-xerces', "Use Xerces C++ parser."],
['--with-expat', "Use Expat XML parser."],
['--with-curl', "Include curl support."],
['--with-spatialite', "Include SpatiaLite support."],
['--with-sqlite3', "Use SQLite 3 library."],
['--with-ruby', "Include ruby bindings."],
['--with-python', "Include python bindings."]
]
end
depends_on 'libtiff'
depends_on 'giflib'
depends_on 'proj'
depends_on 'geos'
depends_on 'postgres' if ARGV.include? '--with-pg'
depends_on 'cfitsio' if ARGV.include? '--with-cfitsio'
depends_on 'netcdf' if ARGV.include? '--with-netcdf'
depends_on 'hdf5' if ARGV.include? '--with-hdf5'
depends_on 'jasper' if ARGV.include? '--with-jasper'
depends_on 'mysql' if ARGV.include? '--with-mysql'
depends_on 'xerces-c' if ARGV.include? '--with-xerces'
depends_on 'expat' if ARGV.include? '--with-expat'
depends_on 'libspatialite' if ARGV.include? '--with-spatialite'
depends_on 'sqlite' if ARGV.include? '--with-sqlite3'
depends_on 'swig' if ARGV.include? '--with-ruby' || ARGV.include? '--with-python'
def install
conf_args = ["--prefix=#{prefix}",
"--disable-debug",
"--disable-dependency-tracking",
"--with-pthreads",
"--with-local=#{prefix}",
"--with-png=/usr/X11",
"--without-grass",
"--without-libgrass",
"--without-pcraster",
"--without-ogdi",
"--without-fme",
"--without-hdf4",
"--without-ecw",
"--without-kakadu",
"--without-mrsid",
"--without-jp2mrsid",
"--without-msg",
"--without-bsb",
"--without-oci",
"--without-grib",
"--without-ingres",
"--without-odbc",
"--with-dods-support=no",
"--without-dwgdirect",
"--without-idb",
"--without-sde",
"--without-vfk",
"--without-epsilon",
"--without-pam",
"--without-macosx-framework",
"--without-perl",
"--without-php"
]
if ARGV.include? '--with-pg'
conf_args << "--with-pg=#{HOMEBREW_PREFIX}/bin/pg_config"
else
conf_args << "--without-pg"
end
if ARGV.include? '--with-cfitsio'
conf_args << "--with-cfitsio=#{HOMEBREW_PREFIX}"
else
conf_args << "--without-cfitsio"
end
if ARGV.include? '--with-netcdf'
conf_args << "--with-netcdf=#{HOMEBREW_PREFIX}"
else
conf_args << "--without-netcdf"
end
if ARGV.include? '--with-hdf5'
conf_args << "--with-hdf5=#{HOMEBREW_PREFIX}"
else
conf_args << "--without-hdf5"
end
if ARGV.include? '--with-jasper'
conf_args << "--with-jasper=#{HOMEBREW_PREFIX}"
else
conf_args << "--without-jasper"
end
if ARGV.include? '--with-mysql'
conf_args << "--with-mysql=#{HOMEBREW_PREFIX}/bin/mysql_config"
else
conf_args << "--without-mysql"
end
if ARGV.include? '--with-xerces'
conf_args << "--with-xerces=#{HOMEBREW_PREFIX}"
else
conf_args << "--without-xerces"
end
if ARGV.include? '--with-expat'
conf_args << "--with-expat=#{HOMEBREW_PREFIX}"
else
conf_args << "--without-expat"
end
if ARGV.include? '--with-curl'
conf_args << "--with-curl=/usr/bin/curl-config"
else
conf_args << "--without-curl"
end
if ARGV.include? '--with-libspatialite'
conf_args << "--with-spatialite=#{HOMEBREW_PREFIX}"
else
conf_args << "--without-spatialite"
end
if ARGV.include? '--with-sqlite3'
conf_args << "--with-sqlite3=#{HOMEBREW_PREFIX}"
else
conf_args << "--without-sqlite3"
end
if ARGV.include? '--with-ruby'
conf_args << "--with-ruby"
else
conf_args << "--without-ruby"
end
if ARGV.include? '--with-python'
conf_args << "--with-python"
else
conf_args << "--without-python"
end
system "./configure", *conf_args
system "make"
system "make install"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment