mapserver 6.4.3

I'm not sure why I decided to try and get this done. All I wanted to do was
successfully close Homebrew/homebrew#46966 and here I am an hour later and having rewritten most
of the formula from scratch.

Closes Homebrew/homebrew#46966.

Closes Homebrew/legacy-homebrew#50431.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>

Closes #811.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
This commit is contained in:
Dominyk Tiller 2016-03-26 03:33:52 +00:00
parent f0853c0e50
commit 2909f1c848

View file

@ -1,8 +1,8 @@
class Mapserver < 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"
url "http://download.osgeo.org/mapserver/mapserver-6.4.3.tar.gz"
sha256 "1f432d4b44e7a0e4e9ce883b02c91c9a66314123028eebb0415144903b8de9c2"
bottle do
cellar :any
@ -18,115 +18,90 @@ class Mapserver < Formula
env :userpaths
depends_on "pkg-config" => :build
depends_on "cmake" => :build
depends_on "swig" => :build
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
depends_on "fribidi" => :optional
depends_on "fcgi" if build.with? "fastcgi"
def install
args = [
"--prefix=#{prefix}",
"--with-proj",
"--with-gdal",
"--with-ogr",
"--with-wfs"
]
args = std_cmake_args
args << "-DWITH_PROJ=ON" << "-DWITH_GDAL=ON" << "-DWITH_OGR=ON" << "-DWITH_WFS=ON"
args << "--with-geos" if build.with? "geos"
args << "--with-php=/usr/bin/php-config" if build.with? "php"
args << "--with-cairo" if build.with? "cairo"
# Install within our sandbox.
inreplace "mapscript/php/CMakeLists.txt", "${PHP5_EXTENSION_DIR}", lib/"php/extensions"
args << "-DWITH_PHP=ON" if build.with? "php"
# Install within our sandbox.
inreplace "mapscript/python/CMakeLists.txt" do |s|
s.gsub! "${PYTHON_SITE_PACKAGES}", lib/"python2.7/site-packages"
s.gsub! "${PYTHON_LIBRARIES}", "-Wl,-undefined,dynamic_lookup"
end
args << "-DWITH_PYTHON=ON"
# Using rpath on python module seems to cause problems if you attempt to
# import it with an interpreter it wasn't built against.
# 2): Library not loaded: @rpath/libmapserver.1.dylib
args << "-DCMAKE_SKIP_RPATH=ON"
# All of the below are on by default so need
# explicitly disabling if not requested.
if build.with? "geos"
args << "-DWITH_GEOS=ON"
else
args << "-DWITH_GEOS=OFF"
end
if build.with? "cairo"
args << "-WITH_CAIRO=ON"
else
args << "-DWITH_CAIRO=OFF"
end
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
args << "-DWITH_POSTGIS=ON"
else
args << "-DWITH_POSTGIS=OFF"
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'"
if build.with? "fastcgi"
args << "-DWITH_FCGI=ON"
else
args << "-DWITH_FCGI=OFF"
end
system "./configure", *args
system "make"
if build.with? "fribidi"
args << "-DWITH_FRIBIDI=ON"
else
args << "-DWITH_FRIBIDI=OFF"
end
install_args = []
install_args << "PHP_EXT_DIR=#{prefix}" if build.with? "php"
system "make", "install", *install_args
cd "mapscript/python" do
system "python", *Language::Python.setup_install_args(prefix)
mkdir "build" do
system "cmake", "..", *args
system "make", "install"
end
end
def caveats; <<-EOS.undent
The Mapserver CGI executable is #{bin}/mapserv
The Mapserver CGI executable is #{opt_bin}/mapserv
If you built the PHP option:
* Add the following line to php.ini:
extension="#{prefix}/php_mapscript.so"
extension="#{opt_lib}/php/extensions/php_mapscript.so"
* Execute "php -m"
* You should see MapScript in the module list
EOS
end
test do
system "#{bin}/mapserver-config", "--version"
system "#{bin}/legend"
end
end
__END__
--- a/mapscript/python/setup.py 2015-06-28 17:43:34.000000000 +0200
+++ b/mapscript/python/setup.py 2015-06-28 17:47:16.000000000 +0200
@@ -32,6 +32,11 @@
except ImportError:
import popen2
+def update_dirs(list1, list2):
+ for v in list2:
+ if v not in list1 and os.path.isdir(v):
+ list1.append(v)
+
#
# # Function needed to make unique lists.
def unique(list):
@@ -144,8 +149,12 @@
return get_config(option, config =self.mapserver_config)
def finalize_options(self):
+ if isinstance(self.include_dirs, str):
+ self.include_dirs = [path.strip() for path in self.include_dirs.strip().split(":")]
if self.include_dirs is None:
self.include_dirs = include_dirs
+
+ update_dirs(self.include_dirs, include_dirs)
includes = self.get_mapserver_config('includes')
includes = includes.split()
@@ -154,9 +163,13 @@
if item[2:] not in include_dirs:
self.include_dirs.append( item[2:] )
+ if isinstance(self.library_dirs, str):
+ self.library_dirs = [path.strip() for path in self.library_dirs.strip().split(":")]
if self.library_dirs is None:
self.library_dirs = library_dirs
+ update_dirs(self.library_dirs, library_dirs)
+
libs = self.get_mapserver_config('libs')
self.library_dirs = self.library_dirs + [x[2:] for x in libs.split() if x[:2] == "-L"]