Hi Carlos

I just adapted the pull request from christianurich on osgeo4mac.  2.10 for
github 2_10 branch compiles pefectly.  Attached is the rb

On Tue, Aug 18, 2015 at 11:17 PM, Pieter du Plooy <[email protected]>
wrote:

> Hi Carlos
>
> I just adapted the pull request from christianurich on osgeo4mac.  2.10
> for github 2_10 branch compiles pefectly.  Attached is the rb
>
> On Tue, Aug 18, 2015 at 10:53 PM, Carlos Grohmann <
> [email protected]> wrote:
>
>> For me, one way to increase the number of testers would be a working
>> homebrew formula for the development branch.
>>
>> So far, osgeo4mac has formulas for 2.6 and 2.8 (I tried compiling 2.8 but
>> it didn't worked). home-brew/science has 1.8 (!). So most mac users are
>> dependent on Kyngsburie's binaries.
>>
>> cheers
>>
>> Carlos
>>
>> On Tue, Aug 18, 2015 at 5:39 PM, Lene Fischer <[email protected]> wrote:
>>
>>> Hi,
>>> If you can set up a scheme with functions and perhaps dataset, I have
>>> students who attend our campus for 4 year and who would like to be a part
>>> of test team. What we need is schemes...
>>> And 40-50 of the students use Mac
>>> Regards
>>>
>>>
>>> Lene Fischer
>>> Associate Professor
>>>
>>> Department of Geosciences and Natural Resource Management
>>> University of Copenhagen
>>>
>>>
>>> MOB +45 40115084
>>> [email protected]
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> -----Oprindelig meddelelse-----
>>> Fra: [email protected] [mailto:
>>> [email protected]] På vegne af Nyall Dawson
>>> Sendt: 18. august 2015 21:21
>>> Til: John Helly
>>> Cc: qgis-user
>>> Emne: Re: [Qgis-user] [QGIS 2.10.1-Pisa, OSX 10.10.4] Raster colormap
>>> does not work
>>>
>>> On 16 August 2015 at 16:26, John Helly <[email protected]> wrote:
>>> > Hi.
>>> >
>>> > I've just installed QGIS 2.10.1-Pisa and find that the raster colormap
>>> > does not work. I've tested the same dataset on 2.6.1-Brighton and it
>>> > does work. Any ideas what might be wrong?  This is the distro from
>>> > Kyngchaos.
>>>
>>> This is now fixed in master, and I'll backport to 2.10.
>>>
>>> However, this issue highlights an important weakness in the QGIS release
>>> testing -- we need more OSX testers! This issue should have been picked up
>>> prior to release, but we have very few active developers who regularly use
>>> OSX. So it's up to you... if you rely on running QGIS on OSX we need your
>>> help with testing beta and nightly releases and providing timely feedback
>>> so these OSX specific issues can be fixed prior to release.
>>>
>>> Nyall
>>>
>>>
>>> >
>>> > J.
>>> >
>>> > --
>>> > John Helly, University of California, San Diego / San Diego
>>> > Supercomputer Center / Scripps Institution of Oceanography / 760 840
>>> > 8660 mobile / stonesteps (Skype) / stonesteps7 (iChat) /
>>> > http://www.sdsc.edu/~hellyj
>>> >
>>> >
>>> > _______________________________________________
>>> > Qgis-user mailing list
>>> > [email protected]
>>> > http://lists.osgeo.org/mailman/listinfo/qgis-user
>>> _______________________________________________
>>> Qgis-user mailing list
>>> [email protected]
>>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>> _______________________________________________
>>> Qgis-user mailing list
>>> [email protected]
>>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>>
>>
>>
>>
>> --
>> Prof. Carlos Henrique Grohmann
>> Institute of Energy and Environment - Univ. of São Paulo, Brazil
>> - Digital Terrain Analysis | GIS | Remote Sensing -
>>
>> http://carlosgrohmann.com
>> http://orcid.org/0000-0001-5073-5572
>> ________________
>> Can’t stop the signal.
>>
>> _______________________________________________
>> Qgis-user mailing list
>> [email protected]
>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>
>
>
require File.expand_path("../../Requirements/qgis_requirements",
                         Pathname.new(__FILE__).realpath)

class UnlinkedQGIS210 < UnlinkedQGIS
  fatal true
  def qgis_formula_name
    "qgis-210"
  end
  satisfy(:build_env => false) { no_linked_qgis[0] }
end

class Qgis210 < Formula
  homepage "http://www.qgis.org";
  url "https://github.com/qgis/QGIS/archive/final-2_10_1.tar.gz";
  sha1 "464a70aec28066468150beb77c8654d73bd86a46"
  revision 2


  head "https://github.com/qgis/QGIS.git";, :branch => "release-2_10"

  option "enable-isolation", "Isolate .app's environment to HOMEBREW_PREFIX, to coexist with other QGIS installs"
  option "with-debug", "Enable debug build, which outputs info to system.log or console"
  option "without-server", "Build without QGIS Server (qgis_mapserv.fcgi)"
  option "without-postgresql", "Build without current PostgreSQL client"
  option "with-globe", "Build with Globe plugin, based upon osgEarth"
  option "without-postgis", "Build without extra PostGIS geospatial database extender"
  option "without-grass", "Build without GRASS 6 integration plugin and Processing plugin support"
  option "with-grass7", "Build with GRASS 7 for Processing plugin"
  option "with-oracle", "Build extra Oracle geospatial database and raster support"
  option "with-orfeo", "Build extra Orfeo Toolbox for Processing plugin"
  option "with-r", "Build extra R for Processing plugin"
  option "with-saga-gis", "Build extra Saga GIS for Processing plugin"
  option "with-qt-mysql", "Build extra Qt MySQL plugin for eVis plugin"
  option "with-api-docs", "Build the API documentation with Doxygen and Graphviz"

  depends_on UnlinkedQGIS210

  # core qgis
  depends_on "cmake" => :build
  depends_on "bison" => :build
  if build.with? "api-docs"
    depends_on "graphviz" => [:build, "with-freetype"]
    depends_on "doxygen" => [:build, "with-dot"] # with graphviz support
  end
  depends_on (build.include? "enable-isolation" || MacOS.version < :lion ) ? "python" : :python
  depends_on "qt"
  depends_on "pyqt"
  depends_on SipBinary
  depends_on PyQtConfig
  depends_on "qscintilla2" # will probably be a C++ lib deps in near future
  depends_on "qwt"
  depends_on "qwtpolar"
  depends_on "gsl"
  depends_on "sqlite" # keg_only
  depends_on "expat" # keg_only
  depends_on "proj"
  depends_on "spatialindex"
  depends_on "fcgi" if build.with? "server"
  # use newer postgresql client than Apple's, also needed by `psycopg2`
  depends_on "postgresql" => :recommended

  # core providers
  depends_on "gdal"
  depends_on "postgis" => :recommended
  depends_on "oracle-client-sdk" if build.with? "oracle"
  # TODO: add MSSQL third-party support formula?, :optional

  # core plugins (c++ and python)
  if build.with? "grass"
    depends_on "grass-64"
    depends_on "gdal-grass64"
    depends_on "gettext"
  end

  if build.with? "globe"
    depends_on "open-scene-graph" => ["with-qt"]
    depends_on "homebrew/science/osgearth"
  end
  depends_on "gpsbabel" => [:recommended, "with-libusb"]
  # TODO: remove "pyspatialite" when PyPi package supports spatialite 4.x
  #       or DB Manager supports libspatialite >= 4.2.0 (with mod_spatialite)
  depends_on "pyspatialite" # for DB Manager
  depends_on "qt-mysql" => :optional # for eVis plugin (non-functional in 2.x?)

  # core processing plugin extras
  # see `postgis` and `grass` above
  depends_on "grass-70" if build.with? "grass7"
  depends_on "orfeo-42" if build.with? "orfeo"
  depends_on "homebrew/science/r" => :optional
  depends_on "saga-gis" => :optional
  # TODO: LASTools straight build (2 reporting tools), or via `wine` (10 tools)
  # TODO: Fusion from USFS (via `wine`?)

  resource "pyqgis-startup" do
    url "https://gist.githubusercontent.com/dakcarto/11385561/raw/7af66d0c8885a888831da6f12298a906484a1471/pyqgis_startup.py";
    sha1 "13d624e8ccc6bf072bbaeaf68cd6f7309abc1e74"
    version "2.0.0"
  end

  # patches that represent all backports to release-2_8 branch, since 2.8.0 tag, SHA1 (date)
  # see: https://github.com/qgis/QGIS/commits/release-2_8
  # stable do
  #   patch do
  #     # SHA1 (date) through SHA1 (date) minus windows-formatted patches
  #     url "https://gist.githubusercontent.com/dakcarto/715501d9fa5bae0b71ef/raw/79b9e217e6ea160a49f897f4bb40c6f76b424c04/qgis-28.diff";
  #     sha1 "8256aba4d4b06ca6bfbf54c71ada79972d957dc5"
  #   end
  # end

  def install
    # Set bundling level back to 0 (the default in all versions prior to 1.8.0)
    # so that no time and energy is wasted copying the Qt frameworks into QGIS.
    qwt_fw = Formula["qwt"].opt_lib/"qwt.framework"
    qwtpolar_fw = Formula["qwtpolar"].opt_lib/"qwtpolar.framework"
    dev_fw = lib/"qgis-dev"
    dev_fw.mkpath
    qsci_opt = Formula["qscintilla2"].opt_prefix
    args = std_cmake_args
    args << "-DCMAKE_BUILD_TYPE=RelWithDebInfo" if build.with? "debug" # override
    args += %W[
      -DBISON_EXECUTABLE=#{Formula["bison"].opt_bin}/bison
      -DENABLE_TESTS=FALSE
      -DQWT_INCLUDE_DIR=#{qwt_fw}/Headers
      -DQWT_LIBRARY=#{qwt_fw}/qwt
      -DQWTPOLAR_INCLUDE_DIR=#{qwtpolar_fw}/Headers
      -DQWTPOLAR_LIBRARY=#{qwtpolar_fw}/qwtpolar
      -DQSCINTILLA_INCLUDE_DIR=#{qsci_opt}/include
      -DQSCINTILLA_LIBRARY=#{qsci_opt}/lib/libqscintilla2.dylib
      -DQSCI_SIP_DIR=#{qsci_opt}/share/sip
      -DWITH_INTERNAL_QWTPOLAR=FALSE
      -DQGIS_MACAPP_BUNDLE=0
      -DQGIS_MACAPP_DEV_PREFIX='#{dev_fw}'
      -DQGIS_MACAPP_INSTALL_DEV=TRUE
      -DWITH_QSCIAPI=FALSE
      -DWITH_STAGED_PLUGINS=FALSE
    ]

    args << "-DPYTHON_EXECUTABLE='#{python_exec}'"
    # brewed python is used if installed
    if brewed_python?
      args << "-DPYTHON_CUSTOM_FRAMEWORK='#{brewed_python_framework}'"
    end

    # find git revision for HEAD build
    if build.head? && File.exists?("#{cached_download}/.git/index")
      args << "-DGITCOMMAND=#{Formula["git"].opt_bin}/git"
      args << "-DGIT_MARKER=#{cached_download}/.git/index"
    else
      args << "-DGIT_MARKER=''" # if git clone borked, or release tarball, ends up defined as 'exported'
    end

    args << "-DWITH_SERVER=#{build.with?("server") ? "TRUE" : "FALSE"}"
    if build.with? "server"
      fcgi_opt = Formula["fcgi"].opt_prefix
      args << "-DFCGI_INCLUDE_DIR=#{fcgi_opt}/include"
      args << "-DFCGI_LIBRARY=#{fcgi_opt}/lib/libfcgi.dylib"
    end

    args << "-DPOSTGRES_CONFIG=#{Formula["postgresql"].opt_bin}/pg_config" if build.with? "postgresql"

    args << "-DWITH_GRASS=#{build.with?("grass") ? "TRUE" : "FALSE"}"
    if build.with? "grass"
      # this is to build the GRASS Plugin, not for Processing plugin support
      grass = Formula["grass-64"]
      args << "-DGRASS_PREFIX='#{grass.opt_prefix}/grass-#{grass.version.to_s}'"
      # So that `libintl.h` can be found
      ENV.append "CXXFLAGS", "-I'#{Formula["gettext"].opt_include}'"
    end

    args << "-DWITH_GLOBE=#{build.with?("globe") ? "TRUE" : "FALSE"}"
    if build.with? "globe"
      osg = Formula["open-scene-graph"]
      opoo "`open-scene-graph` formula's keg not linked." unless osg.linked_keg.exist?
      # must be HOMEBREW_PREFIX/lib/osgPlugins-#.#.#, since all osg plugins are symlinked there
      args << "-DOSG_PLUGINS_PATH=#{HOMEBREW_PREFIX}/lib/osgPlugins-#{osg.version.to_s}"
    end

    args << "-DWITH_ORACLE=#{build.with?("oracle") ? "TRUE" : "FALSE"}"
    if build.with? "oracle"
      oracle_opt = Formula["oracle-client-sdk"].opt_prefix
      args << "-DOCI_INCLUDE_DIR=#{oracle_opt}/sdk/include"
      args << "-DOCI_LIBRARY=#{oracle_opt}/lib/libclntsh.dylib"
    end

    args << "-DWITH_APIDOC=#{build.with?("api-docs") ? "TRUE" : "FALSE"}"

    # Avoid ld: framework not found QtSql
    # (https://github.com/Homebrew/homebrew-science/issues/23)
    ENV.append "CXXFLAGS", "-F#{Formula["qt"].opt_lib}"

    # if using Homebrew's Python, make sure its components are always found first
    # see: https://github.com/Homebrew/homebrew/pull/28597
    ENV["PYTHONHOME"] = "#{brewed_python_framework}" if brewed_python?

    mkdir "build" do
      system "cmake", "..", *args
      #system "bbedit", "CMakeCache.txt"
      #raise
      system "make", "install"
    end

    # Update .app's bundle identifier, so Kyngchaos.com installer doesn't get confused
    inreplace prefix/"QGIS.app/Contents/Info.plist",
              "org.qgis.qgis2", "org.qgis.qgis2-hb#{build.head? ? "-dev" : ""}"

    py_lib = lib/"python2.7/site-packages"
    qgis_modules = prefix/"QGIS.app/Contents/Resources/python/qgis"
    py_lib.mkpath
    ln_s qgis_modules, py_lib/"qgis"

    ln_s "QGIS.app/Contents/MacOS/fcgi-bin", prefix/"fcgi-bin" if build.with? "server"

    doc.mkpath
    mv prefix/"QGIS.app/Contents/Resources/doc/api", doc/"api" if build.with? "api-docs"
    ln_s prefix/"QGIS.app/Contents/Resources/doc", doc/"doc"

    # copy PYQGIS_STARTUP file pyqgis_startup.py, even if not isolating (so tap can be untapped)
    # only works with QGIS > 2.0.1
    # doesn't need executable bit set, loaded by Python runner in QGIS
    libexec.install resource("pyqgis-startup")

    bin.mkdir
    touch "#{bin}/qgis" # so it will be linked into HOMEBREW_PREFIX
  end

  def post_install
    # configure environment variables for .app and launching binary directly.
    # having this in `post_intsall` allows it to be individually run *after* installation with:
    #    `brew postinstall -v qgis-XX` <-- where XX is formula version

    app = prefix/"QGIS.app"
    tab = Tab.for_formula(self)
    opts = tab.used_options
    bottle_poured = tab.poured_from_bottle

    # define default isolation env vars
    pthsep = File::PATH_SEPARATOR
    pypth = "#{python_site_packages}"
    pths = %W[#{HOMEBREW_PREFIX/"bin"} /usr/bin /bin /usr/sbin /sbin /opt/X11/bin /usr/X11/bin].join(pthsep)

    unless opts.include? "enable-isolation"
      pths = ORIGINAL_PATHS.join(pthsep)
      unless pths.include? HOMEBREW_PREFIX/"bin"
        pths = HOMEBREW_PREFIX/"bin" + pthsep + pths
      end
      pyenv = ENV["PYTHONPATH"]
      if pyenv
        pypth = (pyenv.include?(pypth)) ? pyenv : pypth + pthsep + pyenv
      end
    end

    # set install's lib/python2.7/site-packages first, so app will work if unlinked
    pypth = "#{lib}/python2.7/site-packages" + pthsep + pypth

    envars = {
      :PATH => "#{pths}",
      :PYTHONPATH => "#{pypth}",
      :GDAL_DRIVER_PATH => "#{HOMEBREW_PREFIX}/lib/gdalplugins"
    }

    proc_algs = "Contents/Resources/python/plugins/processing/algs"
    unless opts.include? "without-grass"
      grass = Formula["grass-64"]
      envars[:GRASS_PREFIX] = "#{grass.opt_prefix}/grass-#{grass.version.to_s}"
      begin
        inreplace app/"#{proc_algs}/grass/GrassUtils.py",
                  "/Applications/GRASS-6.4.app/Contents/MacOS",
                  HOMEBREW_PREFIX/"opt/grass-64/grass-base" unless bottle_poured
      rescue Utils::InreplaceError
        puts "GRASS 6 GrassUtils already updated"
      end

    end

    if opts.include? "with-grass7"
      begin
        inreplace app/"#{proc_algs}/grass7/Grass7Utils.py",
                  "/Applications/GRASS-7.0.app/Contents/MacOS",
                  HOMEBREW_PREFIX/"opt/grass-70/grass-base"
      rescue Utils::InreplaceError
        puts "GRASS 7 GrassUtils already updated"
      end
    end

    unless opts.include? "without-globe"
      osg = Formula["open-scene-graph"]
      envars[:OSG_LIBRARY_PATH] = "#{HOMEBREW_PREFIX}/lib/osgPlugins-#{osg.version.to_s}"
    end

    if opts.include? "enable-isolation"
      envars[:DYLD_FRAMEWORK_PATH] = "#{HOMEBREW_PREFIX}/Frameworks:/System/Library/Frameworks"
      versioned = %W[
        #{Formula["sqlite"].opt_lib}
        #{Formula["expat"].opt_lib}
        #{Formula["libxml2"].opt_lib}
        #{HOMEBREW_PREFIX}/lib
      ]
      envars[:DYLD_VERSIONED_LIBRARY_PATH] = versioned.join(pthsep)
    end
    if opts.include? "enable-isolation" or File.exist?("/Library/Frameworks/GDAL.framework")
      envars[:PYQGIS_STARTUP] = opt_libexec/"pyqgis_startup.py"
    end

    #envars.each { |key, value| puts "#{key.to_s}=#{value}" }
    #exit

    # add env vars to QGIS.app's Info.plist, in LSEnvironment section
    plst = app/"Contents/Info.plist"
    # first delete any LSEnvironment setting, ignoring errors
    # CAUTION!: may not be what you want, if .app already has LSEnvironment settings
    dflt = quiet_system "defaults read-type \"#{plst}\" LSEnvironment"
    system "defaults delete \"#{plst}\" LSEnvironment" if dflt
    kv = "{ "
    envars.each { |key, value| kv += "'#{key.to_s}' = '#{value}'; " }
    kv += "}"
    system "defaults write \"#{plst}\" LSEnvironment \"#{kv}\""
    # leave the plist readable; convert from binary to XML format
    system "plutil -convert xml1 -- \"#{plst}\""
    # update modification date on app bundle, or changes won't take effect
    touch "#{app}"

    # add env vars to launch script for QGIS app's binary
    qgis_bin = bin/"qgis"
    rm_f qgis_bin if File.exists?(qgis_bin) # install generates empty file
    bin_cmds = %W[#!/bin/sh\n]
    # setup shell-prepended env vars (may result in duplication of paths)
    envars[:PATH] = "#{HOMEBREW_PREFIX}/bin" + pthsep + "$PATH"
    envars[:PYTHONPATH] = "#{python_site_packages}" + pthsep + "$PYTHONPATH"
    envars.each { |key, value| bin_cmds << "export #{key.to_s}=#{value}" }
    bin_cmds << opt_prefix/"QGIS.app/Contents/MacOS/QGIS \"$@\""
    qgis_bin.write(bin_cmds.join("\n"))
    qgis_bin.chmod 0755
  end

  def caveats
    s = <<-EOS.undent
      Bottles support only Homebrew's Python

      QGIS is built as an application bundle. Environment variables for the
      Homebrew prefix are embedded in QGIS.app:
        #{opt_prefix}/QGIS.app

      You may also symlink QGIS.app into /Applications or ~/Applications:
        brew linkapps [--local]

      To directly run the `QGIS.app/Contents/MacOS/QGIS` binary use the wrapper
      script pre-defined with Homebrew prefix environment variables:
        #{opt_bin}/qgis

      NOTE: Your current PATH and PYTHONPATH environment variables are honored
            when launching via the wrapper script, while launching QGIS.app
            bundle they are not.

      For standalone Python development, set the following environment variable:
        export PYTHONPATH=#{python_site_packages}:$PYTHONPATH

      Developer frameworks are installed in:
        #{opt_lib}/qgis-dev
        NOTE: not symlinked to HOMEBREW_PREFIX/Frameworks, which affects isolation.
              Use dyld -F option in CPPFLAGS/LDFLAGS when building other software.

    EOS

    if build.include? "enable-isolation"
      s += <<-EOS.undent
        QGIS built with isolation enabled. This allows it to coexist with other
        types of installations of QGIS on your Mac. However, on versions >= 2.0.1,
        this also means Python modules installed in the *system* Python will NOT
        be available to Python processes within QGIS.app.

      EOS
    end

    # check for required run-time Python module dependencies
    # TODO: add "pyspatialite" when PyPi package supports spatialite 4.x
    xm = []
    %w[psycopg2 matplotlib pyparsing].each {
        |m| xm << m unless module_importable? m
    }
    unless xm.empty?
      s += <<-EOS.undent
        The following Python modules are needed by QGIS during run-time:

            #{xm.join(", ")}

        You can install manually, via installer package or with `pip` (if availble):

            pip install <module>  OR  pip-2.7 install <module>

      EOS
    end
    # TODO: remove this when libqscintilla.dylib becomes core build dependency?
    unless module_importable? "PyQt4.Qsci"
      s += <<-EOS.undent
        QScintilla Python module is needed by QGIS during run-time.
        Ensure `qscintilla2` formula is linked.

      EOS
    end

    s += <<-EOS.undent
      If you have built GRASS 6.4.x or 7.0.x support for the Processing plugin set
      the following in QGIS:
        Processing->Options: Providers->GRASS commands->GRASS folder to:
           #{HOMEBREW_PREFIX}/opt/grass-64/grass-base
        Processing->Options: Providers->GRASS GIS 7 commands->GRASS 7 folder to:
           #{HOMEBREW_PREFIX}/opt/grass-70/grass-base

    EOS

    s
  end

  private
  # python utils (deprecated in latest Homebrew)
  # see: https://github.com/Homebrew/homebrew/pull/24842

  #def osx_python?
  #  p = `python -c "import sys; print(sys.prefix)"`.strip
  #  p.start_with?("/System/Library/Frameworks/Python.framework")
  #end

  def brewed_python_framework
    HOMEBREW_PREFIX/"Frameworks/Python.framework/Versions/2.7"
  end

  def brewed_python_framework?
    brewed_python_framework.exist?
  end

  def brewed_python?
    Formula["python"].linked_keg.exist? and brewed_python_framework?
  end

  def python_exec
    if brewed_python?
      brewed_python_framework/"bin/python"
    else
      which("python")
    end
  end

  def python_incdir
    Pathname.new(`#{python_exec} -c "from distutils import sysconfig; print(sysconfig.get_python_inc())"`.strip)
  end

  def python_libdir
    Pathname.new(`#{python_exec} -c "from distutils import sysconfig; print(sysconfig.get_config_var('LIBPL'))"`.strip)
  end

  def python_site_packages
    HOMEBREW_PREFIX/"lib/python2.7/site-packages"
  end

  def module_importable?(mod)
    quiet_system python_exec, "-c", "import #{mod}"
  end
end
_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to