[76805] trunk/dports/gis/qgis/Portfile

vince at macports.org vince at macports.org
Wed Mar 9 00:14:32 PST 2011


Revision: 76805
          http://trac.macports.org/changeset/76805
Author:   vince at macports.org
Date:     2011-03-09 00:14:29 -0800 (Wed, 09 Mar 2011)
Log Message:
-----------
Solves some bugs:
- It is now possible to build against a python version which is not selected;
- It sets up a fake python framework in ${worksrcpath} instead of the true
  framework, which is cleaner and generated no side effects;
- Remove unused defined parameters.

Modified Paths:
--------------
    trunk/dports/gis/qgis/Portfile

Modified: trunk/dports/gis/qgis/Portfile
===================================================================
--- trunk/dports/gis/qgis/Portfile	2011-03-09 06:41:43 UTC (rev 76804)
+++ trunk/dports/gis/qgis/Portfile	2011-03-09 08:14:29 UTC (rev 76805)
@@ -32,10 +32,6 @@
 
 worksrcdir			${name}-${version}
 
-post-extract {
-					system "cd ${worksrcpath} && mkdir build"
-}
-
 patchfiles			patch-spatialite_c.diff \
 					patch-conversions_sip.diff
 
@@ -47,20 +43,79 @@
 					port:gdal \
 					port:sqlite3 \
 					port:gsl \
-					port:qwt \
+					port:qwt52 \
 					port:fcgi
 
+pre-extract {
+	# At least one python package must be specified
+	if {[lsearch [split ${portvariants} "+"] "python*"] == -1} {
+		ui_error		"Qgis requires python. Please select a variant."
+		exit 0
+	}	
+}
+
+post-extract {
+	system "cd ${worksrcpath} && mkdir build && mkdir Python.framework"
+}
+
+set Py_own_FRM	${worksrcpath}/Python.framework
+
 # Python related stuff
-# Checks if Python framework is not buggy
-set Python_FRM		"${frameworks_dir}/Python.framework"
-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
+variant python25 {	
+	depends_lib-append	port:py25-pyqt4
+	
+	configure.args-append "-DPYTHON_EXECUTABLE=${prefix}/bin/python2.5"
+	configure.args-append "-DPYUIC4_PROGRAM=${prefix}/bin/pyuic4-2.5"
+	configure.args-append "-DPYRCC4_PROGRAM=${prefix}/bin/pyrcc4-2.5"
+	configure.args-append \
+				"-DSIP_BINARY_PATH=${Py_own_FRM}/Versions/2.5/bin/sip"
+}
 
+variant python26 {
+	depends_lib-append	port:py26-pyqt4
+	
+	configure.args-append "-DPYTHON_EXECUTABLE=${prefix}/bin/python2.6"
+	configure.args-append "-DPYUIC4_PROGRAM=${prefix}/bin/pyuic4-2.6"
+	configure.args-append "-DPYRCC4_PROGRAM=${prefix}/bin/pyrcc4-2.6"
+	configure.args-append \
+				"-DSIP_BINARY_PATH=${Py_own_FRM}/Versions/2.6/bin/sip"
+
+}
+
+variant python27 {
+	depends_lib-append	port:py27-pyqt4
+	
+	configure.args-append "-DPYTHON_EXECUTABLE=${prefix}/bin/python2.7"
+	configure.args-append "-DPYUIC4_PROGRAM=${prefix}/bin/pyuic4-2.7"
+	configure.args-append "-DPYRCC4_PROGRAM=${prefix}/bin/pyrcc4-2.7"
+	configure.args-append \
+				"-DSIP_BINARY_PATH=${Py_own_FRM}/Versions/2.7/bin/sip"
+
+}
+
+variant python30 {
+	depends_lib-append	port:py30-pyqt4
+	
+	configure.args-append "-DPYTHON_EXECUTABLE=${prefix}/bin/python3.0"
+	configure.args-append "-DPYUIC4_PROGRAM=${prefix}/bin/pyuic4-3.0"
+	configure.args-append "-DPYRCC4_PROGRAM=${prefix}/bin/pyrcc4-3.0"
+	configure.args-append \
+				"-DSIP_BINARY_PATH=${Py_own_FRM}/Versions/3.0/bin/sip"
+
+}
+
+variant python31 {
+	depends_lib-append	port:py31-pyqt4
+	
+	configure.args-append "-DPYTHON_EXECUTABLE=${prefix}/bin/python3.1"
+	configure.args-append "-DPYUIC4_PROGRAM=${prefix}/bin/pyuic4-3.1"
+	configure.args-append "-DPYRCC4_PROGRAM=${prefix}/bin/pyrcc4-3.1"
+	configure.args-append \
+				"-DSIP_BINARY_PATH=${Py_own_FRM}/Versions/3.1/bin/sip"
+
+}
+
 # Overrides default
 configure.dir		${worksrcpath}/build									
 configure.cmd		cmake ..
@@ -73,7 +128,6 @@
 
 	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"
 }
 
@@ -104,75 +158,49 @@
 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		"-DPYTHON_EXECUTABLE=${prefix}/bin/python"
-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		${qt_cmake_defines}
+configure.args-append		"-DPYTHON_INCLUDE_PATH=${Py_own_FRM}/Headers"
+configure.args-append		"-DSIP_INCLUDE_DIR=${Py_own_FRM}/Headers"
 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"
 
-pre-extract {
-	if {![file exists ${Python_FRM}]} {
-		ui_error		"Qgis requires python" 
-	}
-}
 
 # Patch for proper linking of our own Python framework
 post-configure {
-	reinplace -E "s|(g\\+\\+\[^ ]+)|\\1 -F${frameworks_dir}|" \
+	reinplace -E "s|(^\[^ \]*)|\\1 -F${worksrcpath}|" \
 		${worksrcpath}/build/src/python/CMakeFiles/qgispython.dir/link.txt
 }
 
-# Setup Python stuff in order to gracefully link against -framework Python
+# 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."
-		}
+	set variantlist [split ${portvariants} "+"]
+	set Pyversion	[string replace [lindex ${variantlist} \
+						[lsearch $variantlist "python*"]] 0 5]
+	set Pyverpath	[join [split ${Pyversion} ""] .]
+
+	if {[variant_isset universal] && ${Pyversion} < 26} {
+		ui_error		"Universal build requires Python > 2.5"
+		exit 0
 	}
+
+	# Set up a fake framework in ${worksrcpath}/Python.framework
+	set Py_sys_FRM	"${frameworks_dir}/Python.framework/Versions/${Pyverpath}"
+
+	system	"cd ${Py_own_FRM} ; \
+			 rm -f Headers Python Resources ; \
+			 ln -s ${Py_sys_FRM}/include/python${Pyverpath} Headers ; \
+			 ln -s ${Py_sys_FRM}/Python . ; \
+			 ln -s ${Py_sys_FRM}/Resources . ;"
 }
 
 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
+destroot.target				install
\ No newline at end of file
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110309/81887c29/attachment.html>


More information about the macports-changes mailing list