[cmake] Add patch to fix FindPostgreSQL (bug 828467)
Orion Poplawski
orion at fedoraproject.org
Thu Jul 5 17:41:52 UTC 2012
commit d36d5aa1816183f960280345c51e30da1feae743
Author: Orion Poplawski <orion at cora.nwra.com>
Date: Thu Jul 5 11:41:51 2012 -0600
Add patch to fix FindPostgreSQL (bug 828467)
cmake-FindPostgreSQL.patch | 163 ++++++++++++++++++++++++++++++++++++++++++++
cmake.spec | 10 +++-
2 files changed, 172 insertions(+), 1 deletions(-)
---
diff --git a/cmake-FindPostgreSQL.patch b/cmake-FindPostgreSQL.patch
new file mode 100644
index 0000000..213eb14
--- /dev/null
+++ b/cmake-FindPostgreSQL.patch
@@ -0,0 +1,163 @@
+--- cmake-2.8.8/Modules/FindPostgreSQL.cmake 2012-04-18 20:10:54.000000000 +0200
++++ cmake-2.8.8/Modules/FindPostgreSQL.cmake 2012-07-04 23:05:30.532090522 +0200
+@@ -97,76 +97,101 @@ set( PostgreSQL_ROOT_DIRECTORIES
+ #
+ # Look for an installation.
+ #
+-find_path(PostgreSQL_INCLUDE_DIR
+- NAMES libpq-fe.h
++find_path(PostgreSQL_CONFIG_DIR
++ NAMES pg_config
+ PATHS
+ # Look in other places.
+ ${PostgreSQL_ROOT_DIRECTORIES}
+ PATH_SUFFIXES
+- pgsql
+- postgresql
+- include
++ ""
++ bin
+ # Help the user find it if we cannot.
+- DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}"
++ DOC "The ${PostgreSQL_ROOT_DIR_MESSAGE}"
+ )
+
+-find_path(PostgreSQL_TYPE_INCLUDE_DIR
+- NAMES catalog/pg_type.h
+- PATHS
+- # Look in other places.
+- ${PostgreSQL_ROOT_DIRECTORIES}
+- PATH_SUFFIXES
+- pgsql/server
+- postgresql/server
+- include/server
+- # Help the user find it if we cannot.
+- DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}"
+-)
++macro (fail_if)
++ if (${ARGV})
++ message (SEND_ERROR "Couldn't determine PostgreSQL configuration.")
++ unset (PostgreSQL_CONFIG_DIR)
++ break ()
++ endif ()
++endmacro ()
++
++macro (run_pg_config arg var)
++ execute_process(COMMAND ${PostgreSQL_CONFIG_DIR}/pg_config ${arg}
++ RESULT_VARIABLE pgsql_config_result
++ OUTPUT_VARIABLE ${var}
++ OUTPUT_STRIP_TRAILING_WHITESPACE)
++
++ fail_if (NOT ${pgsql_config_result} EQUAL 0 OR NOT ${var})
++endmacro ()
++
++foreach (once only)
++ fail_if (NOT PostgreSQL_CONFIG_DIR)
++
++ run_pg_config (--version PostgreSQL_VERSION_STRING)
++ string (REGEX REPLACE "^PostgreSQL (.*)$" "\\1"
++ PostgreSQL_VERSION_STRING "${PostgreSQL_VERSION_STRING}")
++ fail_if (NOT PostgreSQL_VERSION_STRING)
++
++ run_pg_config (--includedir PostgreSQL_INCLUDE_DIR)
++ fail_if (NOT EXISTS "${PostgreSQL_INCLUDE_DIR}/libpq-fe.h")
++
++ find_path(PostgreSQL_TYPE_INCLUDE_DIR
++ NAMES catalog/pg_type.h
++ PATHS ${PostgreSQL_INCLUDE_DIR}
++ PATH_SUFFIXES
++ pgsql/server
++ postgresql/server
++ include/server
++ # Help the user find it if we cannot.
++ DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}"
++ )
++ fail_if (NOT PostgreSQL_TYPE_INCLUDE_DIR)
++
++ set (PostgreSQL_INCLUDE_DIRS
++ ${PostgreSQL_INCLUDE_DIR} ${PostgreSQL_TYPE_INCLUDE_DIR})
++
++ run_pg_config (--libdir PostgreSQL_LIBRARY_DIRS)
++
++ # The PostgreSQL library.
++ set (PostgreSQL_LIBRARY_TO_FIND pq)
++ # Setting some more prefixes for the library
++ set (PostgreSQL_LIB_PREFIX "")
++ if (WIN32)
++ set (PostgreSQL_LIB_PREFIX ${PostgreSQL_LIB_PREFIX} "lib")
++ set (PostgreSQL_LIBRARY_TO_FIND ${PostgreSQL_LIB_PREFIX}${PostgreSQL_LIBRARY_TO_FIND})
++ endif()
++
++ find_library (PostgreSQL_LIBRARY_FOUND
++ NAMES ${PostgreSQL_LIBRARY_TO_FIND}
++ PATHS ${PostgreSQL_LIBRARY_DIRS}
++ PATH_SUFFIXES lib
++ )
++ fail_if (NOT PostgreSQL_LIBRARY_FOUND)
++ set (PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY_TO_FIND})
+
+-# The PostgreSQL library.
+-set (PostgreSQL_LIBRARY_TO_FIND pq)
+-# Setting some more prefixes for the library
+-set (PostgreSQL_LIB_PREFIX "")
+-if ( WIN32 )
+- set (PostgreSQL_LIB_PREFIX ${PostgreSQL_LIB_PREFIX} "lib")
+- set ( PostgreSQL_LIBRARY_TO_FIND ${PostgreSQL_LIB_PREFIX}${PostgreSQL_LIBRARY_TO_FIND})
+-endif()
+-
+-find_library( PostgreSQL_LIBRARY
+- NAMES ${PostgreSQL_LIBRARY_TO_FIND}
+- PATHS
+- ${PostgreSQL_ROOT_DIRECTORIES}
+- PATH_SUFFIXES
+- lib
+-)
+-get_filename_component(PostgreSQL_LIBRARY_DIR ${PostgreSQL_LIBRARY} PATH)
+-
+-if (PostgreSQL_INCLUDE_DIR AND EXISTS "${PostgreSQL_INCLUDE_DIR}/pg_config.h")
+- file(STRINGS "${PostgreSQL_INCLUDE_DIR}/pg_config.h" pgsql_version_str
+- REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"")
+-
+- string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*" "\\1"
+- PostgreSQL_VERSION_STRING "${pgsql_version_str}")
+- unset(pgsql_version_str)
+-endif()
++endforeach ()
+
+ # Did we find anything?
+-include(FindPackageHandleStandardArgs)
+-find_package_handle_standard_args(PostgreSQL
+- REQUIRED_VARS PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR
+- VERSION_VAR PostgreSQL_VERSION_STRING)
+-set( PostgreSQL_FOUND ${POSTGRESQL_FOUND})
++include (FindPackageHandleStandardArgs)
++find_package_handle_standard_args (PostgreSQL
++ REQUIRED_VARS
++ PostgreSQL_LIBRARY_DIRS
++ PostgreSQL_CONFIG_DIR
++ PostgreSQL_INCLUDE_DIRS
++ PostgreSQL_LIBRARIES
++ VERSION_VAR
++ PostgreSQL_VERSION_STRING
++)
++set (PostgreSQL_FOUND ${POSTGRESQL_FOUND})
+
+ # Now try to get the include and library path.
+-if(PostgreSQL_FOUND)
+-
+- set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR} ${PostgreSQL_TYPE_INCLUDE_DIR} )
+- set(PostgreSQL_LIBRARY_DIRS ${PostgreSQL_LIBRARY_DIR} )
+- set(PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY_TO_FIND})
+-
+- #message("Final PostgreSQL include dir: ${PostgreSQL_INCLUDE_DIRS}")
+- #message("Final PostgreSQL library dir: ${PostgreSQL_LIBRARY_DIRS}")
+- #message("Final PostgreSQL libraries: ${PostgreSQL_LIBRARIES}")
++if (PostgreSQL_FOUND)
++ message (STATUS "PostgreSQL include dirs: ${PostgreSQL_INCLUDE_DIRS}")
++ message (STATUS "PostgreSQL library dirs: ${PostgreSQL_LIBRARY_DIRS}")
++ message (STATUS "PostgreSQL libraries: ${PostgreSQL_LIBRARIES}")
+ endif(PostgreSQL_FOUND)
+
+-mark_as_advanced(PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR PostgreSQL_LIBRARY )
++mark_as_advanced (PostgreSQL_CONFIG_DIR PostgreSQL_LIB_DIR
++ PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR)
diff --git a/cmake.spec b/cmake.spec
index 0963b3a..c24add4 100644
--- a/cmake.spec
+++ b/cmake.spec
@@ -8,7 +8,7 @@
Name: cmake
Version: 2.8.8
-Release: 4%{?dist}
+Release: 5%{?dist}
Summary: Cross-platform make system
Group: Development/Tools
@@ -28,6 +28,10 @@ Patch1: cmake-pkgconfig.patch
# http://public.kitware.com/Bug/view.php?id=12965
# https://bugzilla.redhat.com/show_bug.cgi?id=822796
Patch2: cmake-findruby.patch
+# Patch to fix FindPostgreSQL
+# https://bugzilla.redhat.com/show_bug.cgi?id=828467
+# http://public.kitware.com/Bug/view.php?id=13378
+Patch3: cmake-FindPostgreSQL.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gcc-gfortran
@@ -79,6 +83,7 @@ The %{name}-gui package contains the Qt based GUI for CMake.
%patch0 -p1 -b .dcmtk
%patch1 -p1 -b .pkgconfig
%patch2 -p1 -b .findruby
+%patch3 -p1 -b .findpostgresql
%build
@@ -175,6 +180,9 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
%changelog
+* Thu Jul 5 2012 Orion Poplawski <orion at cora.nwra.com> 2.8.8-5
+- Add patch to fix FindPostgreSQL (bug 828467)
+
* Mon May 21 2012 Orion Poplawski <orion at cora.nwra.com> 2.8.8-4
- Add patch to fix FindRuby (bug 822796)
More information about the scm-commits
mailing list