Skip to content

Instantly share code, notes, and snippets.

@turboladen
Last active September 7, 2016 21:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save turboladen/1977f19a7664669868a3f86ed840b429 to your computer and use it in GitHub Desktop.
Save turboladen/1977f19a7664669868a3f86ed840b429 to your computer and use it in GitHub Desktop.
Homebrew formula for install mapserver 6.2.2
class OldMapserver < Formula
desc "Publish spatial data and interactive mapping apps to the web"
homepage "http://mapserver.org/"
url "http://download.osgeo.org/mapserver/mapserver-6.2.2.tar.gz"
sha256 "79b81286dde030704f59a668a19e5b01af27bb35d05b3daf91cefe06ca29ffd9"
bottle do
cellar :any
sha256 "8bfa96a50ee83117bd929afc4ed1c6ce3e9e82a7e6da6328e4ca500c4fbb096d" => :yosemite
sha256 "7ed6da72cbb724c1dfe92cc701bf292ddac02788dc7976f7a81e5e367b472262" => :mavericks
sha256 "28b3fbf520436359a81d6b0a6875c30cb6f8bdb147ebc14f5860f7cf2c61ad47" => :mountain_lion
end
option "with-fastcgi", "Build with fastcgi support"
option "with-geos", "Build support for GEOS spatial operations"
option "with-postgresql", "Build support for PostgreSQL as a data source"
env :userpaths
depends_on "freetype"
depends_on "libpng"
depends_on "swig" => :build
depends_on "giflib"
depends_on "gd"
depends_on "proj"
depends_on "gdal"
depends_on "geos" => :optional
depends_on "postgresql" => :optional unless MacOS.version >= :lion
depends_on "fcgi" if build.with? "fastcgi"
depends_on "cairo" => :optional
# This patch can be removed when this is merged https://github.com/mapserver/mapserver/pull/5113
patch :DATA
def install
args = [
"--prefix=#{prefix}",
"--with-proj",
"--with-gdal",
"--with-ogr",
"--with-wfs"
]
args << "--with-geos" if build.with? "geos"
args << "--with-cairo" if build.with? "cairo"
if build.with? "postgresql"
if MacOS.version >= :lion # Lion ships with PostgreSQL libs
args << "--with-postgis"
else
args << "--with-postgis=#{HOMEBREW_PREFIX}/bin/pg_config"
end
end
args << "--with-fastcgi=#{HOMEBREW_PREFIX}" if build.with? "fastcgi"
unless MacOS::CLT.installed?
inreplace "configure", "_JTOPDIR=`echo \"$_ACJNI_FOLLOWED\" | sed -e 's://*:/:g' -e 's:/[^/]*$::'`",
"_JTOPDIR='#{MacOS.sdk_path}/System/Library/Frameworks/JavaVM.framework/Headers'"
end
system "./configure", *args
system "make"
system "make", "install"
cd "mapscript/ruby" do
bin_ruby = ENV.fetch('MAPSCRIPT_RUBY', 'ruby')
puts "Installing with ruby: #{bin_ruby}"
system "#{bin_ruby} extconf.rb && make && make install"
end
end
def caveats; <<-EOS.undent
The Mapserver CGI executable is #{bin}/mapserv
EOS
end
test do
system "#{bin}/mapserver-config", "--version"
end
end
@turboladen
Copy link
Author

Use the MAPSCRIPT_RUBY env var to set the ruby for which to build the ruby extensions for:

MAPSCRIPT_RUBY=$(which ruby) brew install https://gist.github.com/turboladen/1977f19a7664669868a3f86ed840b429/raw/894513f8762d9447458b7ea7052aaf08b184e5ff/old_mapserver.rb --with-postgresql

@turboladen
Copy link
Author

This doesn't seem to be working with Ruby 2.3.x.

local git:master ❯ which ruby
/Users/sloveless/.rubies/ruby-2.3.1/bin/ruby
local git:master ❯ MAPSCRIPT_RUBY=$(which ruby) brew install https://gist.github.com/turboladen/1977f19a7664669868a3f86ed840b429/raw/894513f8762d9447458b7ea7052aaf08b184e5ff/old_mapserver.rb --with-postgresql
######################################################################## 100.0%
==> Downloading http://download.osgeo.org/mapserver/mapserver-6.2.2.tar.gz
Already downloaded: /Users/sloveless/Library/Caches/Homebrew/old_mapserver-6.2.2.tar.gz
==> Patching
==> ./configure --prefix=/usr/local/Cellar/old_mapserver/6.2.2 --with-proj --with-gdal --with-ogr --with-wfs --with-postgis
==> make
==> make install
Installing with ruby: /Users/sloveless/.rubies/ruby-2.3.1/bin/ruby
==> /Users/sloveless/.rubies/ruby-2.3.1/bin/ruby extconf.rb && make && make install
Last 15 lines from /Users/sloveless/Library/Logs/Homebrew/old_mapserver/04.ruby:
2016-09-07 14:40:24 -0700

/Users/sloveless/.rubies/ruby-2.3.1/bin/ruby extconf.rb && make && make install

mkmf.rb can't find header files for ruby at /Users/sloveless/.rubies/ruby-2.3.1/lib/ruby/include/ruby.h

Yet still works just fine with Ruby 2.2.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment