Qgis version 1.3.0 - How to Download and Install on Mac OS X
Saturday the 20th of March, 2010

    version 1.3.0

      View the most recent changes for the qgis port at: qgis.darwinports.com/diff
      Scroll down toward the bottom of the page to get installation instructions for qgis.
      The raw portfile for qgis 1.3.0 is located here:
      http://qgis.darwinports.com/dports/gis/qgis/Portfile
      Find related portfiles with the unique DarwinPorts.com search feature.
      Check for any related Fink projects here: pdb.finkproject.org/pdb/package.php/qgis


      # -*- coding: utf-8; mode: tcl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=2:ts=2:sts=2
      The qgis Portfile 60454 2009-11-12 23:35:31Z ryandesign macports.org $

      PortSystem 1.0

      Name: qgis
      Version: 1.3.0
      Category: gis
      Maintainers: vince
      Description: QGIS is a user-friendly GIS based on Qt 4
      Long Description: QGIS is a GIS. It can visualize, inject data into PostGres/PostGIS, or serve as a Qt front-end to Grass. Extended with Python plugins, it can become a quite powerful GIS on its own.

      Platform: darwin
      license GPL

      Homepage: http://www.qgis.org/

      distname ${name}_${version}
      Master Sites: http://download.osgeo.org/qgis/src/

      Checksums: md5 c75d0912011fe41a4e4a316ea323f73a sha1 6c2f4cf5db8d5b513306465bfd160bdfa9a727af rmd160 c2ffd90468b7f9cd49d2ba878a6572e8f19e137a

      worksrcdir ${name}-${version}

      post-extract {
      system "cd ${worksrcpath} && mkdir build"
      }

      Patch Files: patch-spatialite_c.diff

      depends_build port:cmake

      depends_lib port:libiconv port:expat port:openssl port:proj port:geos port:gdal port:sqlite3 port:gsl

      # Python related stuff
      # Checks if Python framework is not buggy
      set Python_FRM "${frameworks_dir}/Python.framework"
      if {! [file exists ${Python_FRM}]} {
      ui_error "Qgis requires python"
      }

      set Pyver [exec python -V |& awk "{print \$2}"]
      # Eliminates minor (could also be done with strsed)
      set Pyversion [join [lrange [split ${Pyver} "."] 0 1] ""]
      set Pyverpath [join [lrange [split ${Pyver} "."] 0 1] "."]

      depends_lib-append port:py${Pyversion}-pyqt4


      configure.dir ${worksrcpath}/build
      configure.cmd cmake ..

      # Start with no configure arguments: override defaults
      configure.pre_args
      configure.args
      configure.universal_args


      Variant: postgis description "Build postgis support" {
      depends_lib-append port:postgis

      # Always choose latest installed postgresql version

      set PGSQL_DIR [lindex [lsort -dec [glob -d ${prefix}/lib postgresql*]] 0]
      configure.args-append "-DPOSTGRESQL_PREFIX=${PGSQL_DIR}"
      configure.args-append "-DPOSTGRES_CONFIG=${PGSQL_DIR}/bin/pg_config"
      }


      Variant: grass63 description "Build the grass (6.3) plugin" {

      depends_lib-append port:grass

      if {[file exists ${applications_dir}/GRASS-6.3.app]} {
      configure.args-append "-DGRASS_PREFIX=${applications_dir}/GRASS-6.3.app/Contents/MacOS"
      } else {
      configure.args-append "-DGRASS_PREFIX=${prefix}"
      }
      }


      Variant: grass64 description "Build the grass (6.4) plugin" {

      depends_lib-append port:grass64

      if {[file exists ${applications_dir}/GRASS-6.4.app]} {
      configure.args-append "-DGRASS_PREFIX=${applications_dir}/GRASS-6.4.app/Contents/MacOS"
      } else {
      configure.args-append "-DGRASS_PREFIX=${prefix}"
      }
      }


      Variant: universal description "Builds universal app" {
      set archs "-DCMAKE_OSX_ARCHITECTURES=\""

      foreach arch ${configure.universal_archs} {
      append archs ${arch} ";"
      }
      configure.args-append "${archs}\""
      set sysroot [lindex [exec ls /Developer/SDKs] end]
      configure.args-append "-DCMAKE_OSX_SYSROOT=/Developer/SDKs/${sysroot}"
      }

      # LLVM cannot be used (Seg. faults in spatialite.c)

      if {[string first llvm ${configure.cc}] != -1 || [string first llvm ${configure.cxx}] != -1} {

      ui_msg "Warning: Qgis cannot be compiled with LLVM, switching to GCC\n"
      set configure.cc gcc
      set configure.cxx g++
      }

      configure.args-append "-DCMAKE_CXX_COMPILER=${configure.cxx}"
      configure.args-append "-DCMAKE_C_COMPILER=${configure.cc}"
      configure.args-append "-DEXPAT_INCLUDE_DIR=${prefix}/include"
      configure.args-append "-DEXPAT_LIBRARY=${prefix}/lib/libexpat.dylib"
      configure.args-append "-DCMAKE_INSTALL_PREFIX=${applications_dir}"
      configure.args-append "-DGDAL_CONFIG=${prefix}/bin/gdal-config"
      configure.args-append "-DGDAL_INCLUDE_DIR=${prefix}/include"
      configure.args-append "-DGDAL_LIBRARY=${prefix}/lib/libgdal.dylib"
      configure.args-append "-DGEOS_CONFIG=${prefix}/bin/geos-config"
      configure.args-append "-DGEOS_INCLUDE_DIR=${prefix}/include"
      configure.args-append "-DGEOS_LIBRARY=${prefix}/lib/libgeos_c.dylib"
      configure.args-append "-DGEOS_LIB_NAME_WITH_PREFIX=-lgeos_c"
      configure.args-append "-DGSL_CONFIG=${prefix}/bin/gsl-config"
      configure.args-append "-DICONV_INCLUDE_DIR=${prefix}/include"
      configure.args-append "-DICONV_LIBRARY=${prefix}/lib/libiconv.dylib"
      configure.args-append "-DPROJ_INCLUDE_DIR=${prefix}/include"
      configure.args-append "-DPROJ_LIBRARY=${prefix}/lib/libproj.dylib"
      configure.args-append "-DOPENSSL_INCLUDE_DIR=${prefix}/include"
      configure.args-append "-DOPENSSL_LIBRARIES=${prefix}/lib/libssl.dylib"
      configure.args-append "-DPYTHON_INCLUDE_PATH=${Python_FRM}/Headers"
      configure.args-append "-DPYUIC4_PROGRAM=${prefix}/bin/pyuic4-${Pyverpath}"
      configure.args-append "-DPYRCC4_PROGRAM=${prefix}/bin/pyrcc4-${Pyverpath}"
      configure.args-append "-DSIP_BINARY_PATH=${Python_FRM}/Versions/${Pyverpath}/bin/sip"
      configure.args-append "-DSIP_INCLUDE_DIR=${Python_FRM}/Headers"
      configure.args-append "-DQT_QMAKE_EXECUTABLE=${prefix}/bin/qmake-mac"
      configure.args-append "-DCMAKE_BUILD_TYPE=Release"

      # This is a fake but don't ask me why it is needed
      configure.args-append "-DSVN_MARKER=/usr/bin/svnversion"

      # Patch for proper linking of our own Python framework
      post-configure {
      reinplace -E "s|g\\+\\+|g\\+\\+ -F${frameworks_dir}|" ${worksrcpath}/build/src/python/CMakeFiles/qgispython.dir/link.txt

      # Adapts for new Sip 4.6
      reinplace -E "s|sipClass(_\[^,\]+)|(sipWrapperType *) sipTypeAsPyTypeObject (sipType\\1)|" ${worksrcpath}/python/core/conversions.sip
      }

      # Setup Python stuff in order to gracefully link against -framework Python
      pre-build {
      if {! [file exists ${Python_FRM}/Headers]} {
      ui_msg "Patching (temporarily) the Python framework (See http://trac.macports.org/ticket/21614)"

      if {[variant_isset universal] && ${Pyversion} < 26} {
      ui_error "Universal build requires Python > 2.5"
      }

      system "cd ${Python_FRM} ; ln -s Versions/${Pyverpath}/include/python${Pyverpath} Headers ; ln -s Versions/${Pyverpath}/Python . ; ln -s Versions/${Pyverpath}/Resources . ; touch /private/tmp/qgis_pypatch"
      } else {
      # Checks for inconsistencies and set dependencies accordingly

      if {${Pyver} != [exec cat ${Python_FRM}/Headers/patchlevel.h | grep "PY_VERSION " | awk "{print \$3}" | sed "s/\\\"//g"]} {
      ui_error "Inconsistent Python framework installation."
      }
      }

      }

      use_parallel_build yes
      build.dir ${worksrcpath}/build

      post-destroot {
      if {[file exists /private/tmp/qgis_pypatch]} {
      ui_msg "Removing patched Framework"
      system "cd ${Python_FRM} ; rm -f Headers Python Resources ; rm -f /private/tmp/qgis_pypatch"
      }
      }

      destroot.target install

    If you haven't already installed Darwin Ports, you can find easy instructions for doing so at the main Darwin Ports page.

    Once Darwin Ports has been installed, in a terminal window and while online, type the following and hit return:


      %  cd /opt/local/bin/portslocation/dports/qgis
      % sudo port install qgis
      Password:
    You will then be prompted for your root password, which you should enter. You may have to wait for a few minutes while the software is retrieved from the network and installed for you. Y ou should see something that looks similar to:

      ---> Fetching qgis
      ---> Verifying checksum for qgis
      ---> Extracting qgis
      ---> Configuring qgis
      ---> Building qgis with target all
      ---> Staging qgis into destroot
      ---> Installing qgis
    - Make sure that you do not close the terminal window while Darwin Ports is working. Once the software has been installed, you can find further information about using qgis with these commands:
      %  man qgis
      % apropos qgis
      % which qgis
      % locate qgis

     Where to find more information:

    Darwin Ports



    Lightbox this page.