homebrew-core/Formula/mapserver.rb
2019-11-15 09:40:17 +01:00

80 lines
2.5 KiB
Ruby

class Mapserver < Formula
desc "Publish spatial data and interactive mapping apps to the web"
homepage "https://mapserver.org/"
url "https://download.osgeo.org/mapserver/mapserver-7.2.2.tar.gz"
sha256 "287f8dfe10961bc685bb87e118b7aa81382df907b2b3961d6559169b527ba95c"
revision 1
bottle do
cellar :any
sha256 "a0766db0af28e0fc1181977b58e337d9f37098ec7c99c909f4ba88b4a4a00744" => :catalina
sha256 "839df9547e4ed16993b02984c633eb16bbd6458c541584368d68a9257350acdd" => :mojave
sha256 "5ca1e07af0b5a8acce4ef5deb06b5ce7024a945e4233ddda8a94ad57bb01469b" => :high_sierra
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "swig@3" => :build
depends_on "cairo"
depends_on "fcgi"
depends_on "freetype"
depends_on "gd"
depends_on "gdal"
depends_on "geos"
depends_on "giflib"
depends_on "libpng"
depends_on "postgresql"
depends_on "proj"
depends_on "protobuf-c"
def install
# Harfbuzz support requires fribidi and fribidi support requires
# harfbuzz but fribidi currently fails to build with:
# fribidi-common.h:61:12: fatal error: 'glib.h' file not found
args = std_cmake_args + %w[
-DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python
-DWITH_CLIENT_WFS=ON
-DWITH_CLIENT_WMS=ON
-DWITH_CURL=ON
-DWITH_FCGI=ON
-DWITH_FRIBIDI=OFF
-DWITH_GDAL=ON
-DWITH_GEOS=ON
-DWITH_HARFBUZZ=OFF
-DWITH_KML=ON
-DWITH_OGR=ON
-DWITH_POSTGIS=ON
-DWITH_PROJ=ON
-DWITH_PYTHON=ON
-DWITH_SOS=ON
-DWITH_WFS=ON
-WITH_CAIRO=ON
]
# 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
inreplace "mapscript/php/CMakeLists.txt", "${PHP5_EXTENSION_DIR}", lib/"php/extensions"
# 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"
# Use Proj 6.0.0 compatibility headers
# https://github.com/mapserver/mapserver/issues/5766
ENV.append_to_cflags "-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H"
mkdir "build" do
system "cmake", "..", *args
system "make", "install"
end
end
test do
assert_match version.to_s, shell_output("#{bin}/mapserv -v")
system "python2.7", "-c", "import mapscript"
end
end