homebrew-core/Formula/mapserver.rb

78 lines
2.3 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.6.2.tar.gz"
sha256 "36768819f28024312f76a791085f3731d2cc451f7f0c9015c91c12b3929fe179"
revision 2
bottle do
sha256 cellar: :any, big_sur: "61a51430151b08d92ed11ad378114f7d0e3be31489de5cb6d649eeb941e4da12"
sha256 cellar: :any, catalina: "26b657d5c5d773d9aabc69ac74683c46f16639278169e5c588156f0b029fef3a"
sha256 cellar: :any, mojave: "c174209519db201cb9fd1b6336e122d6a23e33a7a18e9af92cb4372f64af72f0"
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"
depends_on "python@3.9"
uses_from_macos "curl"
def install
ENV.cxx11
args = std_cmake_args + %w[
-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_PYTHON=ON
-DWITH_SOS=ON
-DWITH_WFS=ON
]
args << "-DPYTHON_EXECUTABLE=#{Formula["python@3.9"].opt_bin/"python3"}"
args << "-DPHP_EXTENSION_DIR=#{lib}/php/extensions"
# Install within our sandbox
inreplace "mapscript/python/CMakeLists.txt" do |s|
s.gsub! "${PYTHON_LIBRARIES}", "-Wl,-undefined,dynamic_lookup"
end
# 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"
mkdir "build" do
system "cmake", "..", *args
system "make", "install"
cd "mapscript/python" do
system Formula["python@3.9"].opt_bin/"python3", *Language::Python.setup_install_args(prefix)
end
end
end
test do
assert_match version.to_s, shell_output("#{bin}/mapserv -v")
system Formula["python@3.9"].opt_bin/"python3", "-c", "import mapscript"
end
end