1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-02-01 10:59:55 +00:00

converters/osm2pgrouting: fix build after databases/postgresql-libpqxx update

- Uses c++17 and patch CMakeLists.txt (required by databases/postgresql-libpqxx)
- Replace disconnect to close (libpqxx API change) in src/osm_elements/osm2pgrouting.cpp
- While I'm here remove post-install part and update CMakeLists.

Reported by:	pkg-fallout
This commit is contained in:
Loïc Bartoletti 2020-08-22 06:50:15 +00:00
parent 0103476eab
commit 2abcfc8e6b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=545741
3 changed files with 53 additions and 16 deletions

View File

@ -16,7 +16,7 @@ LIB_DEPENDS= libboost_system.so:devel/boost-libs \
libexpat.so:textproc/expat2 \
libpqxx.so:databases/postgresql-libpqxx
USES= cmake compiler:c++11-lang pgsql
USES= cmake compiler:c++17-lang pgsql
USE_GITHUB= yes
GH_ACCOUNT= pgRouting
@ -31,9 +31,4 @@ post-patch:
${WRKSRC}/src/utilities/prog_options.cpp \
${WRKSRC}/Readme.md
post-install:
@for cf in ${STAGEDIR}${PREFIX}/etc/${PORTNAME}/*.xml; do \
${MV} $${cf} $${cf}.sample; \
done
.include <bsd.port.mk>

View File

@ -1,23 +1,54 @@
--- CMakeLists.txt.orig 2019-01-11 07:48:53 UTC
--- CMakeLists.txt.orig 2020-08-20 05:32:18 UTC
+++ CMakeLists.txt
@@ -8,7 +8,7 @@ if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}
@@ -8,7 +8,8 @@ if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}
endif()
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
-SET(SHARE_DIR "${CMAKE_INSTALL_PREFIX}/share/osm2pgrouting")
+SET(SHARE_DIR "${CMAKE_INSTALL_PREFIX}/etc/osm2pgrouting")
+SET(DOC_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/osm2pgrouting")
+SET(ETC_DIR "${CMAKE_INSTALL_PREFIX}/etc/osm2pgrouting")
FIND_PACKAGE(PostgreSQL REQUIRED)
find_package(LibPQXX REQUIRED)
@@ -114,8 +114,10 @@ if(WIN32)
@@ -37,6 +38,7 @@ include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
+CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS GNU_CXX_MINIMUM_VERSION)
message(FATAL_ERROR "GCC version must be at least ${GNU_CXX_MINIMUM_VERSION}!
@@ -50,7 +52,10 @@ else()
message(STATUS "Unknown compiler minimum version for ${CMAKE_CXX_COMPILER_ID}")
endif()
-if(COMPILER_SUPPORTS_CXX14)
+if(COMPILER_SUPPORTS_CXX17)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
+ message(STATUS "Using -std=c++17.")
+elseif(COMPILER_SUPPORTS_CXX14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
message(STATUS "Using -std=c++14.")
elseif(COMPILER_SUPPORTS_CXX11)
@@ -114,14 +119,14 @@ if(WIN32)
endif()
INSTALL(FILES
- "${CMAKE_SOURCE_DIR}/COPYING"
"${CMAKE_SOURCE_DIR}/Readme.md"
+ DESTINATION "${CMAKE_INSTALL_PREFIX}/share/doc/osm2pgrouting")
+
+INSTALL(FILES
"${CMAKE_SOURCE_DIR}/mapconfig.xml"
"${CMAKE_SOURCE_DIR}/mapconfig_for_cars.xml"
"${CMAKE_SOURCE_DIR}/mapconfig_for_bicycles.xml"
- "${CMAKE_SOURCE_DIR}/mapconfig.xml"
- "${CMAKE_SOURCE_DIR}/mapconfig_for_cars.xml"
- "${CMAKE_SOURCE_DIR}/mapconfig_for_bicycles.xml"
- "${CMAKE_SOURCE_DIR}/mapconfig_for_pedestrian.xml"
- DESTINATION "${SHARE_DIR}")
+ DESTINATION "${DOC_DIR}")
-
+FOREACH(i mapconfig.xml mapconfig_for_cars.xml mapconfig_for_bicycles.xml mapconfig_for_pedestrian.xml)
+ INSTALL(FILES
+ "${CMAKE_SOURCE_DIR}/${i}"
+ RENAME ${i}.sample
+ DESTINATION "${ETC_DIR}")
+ENDFOREACH()
#INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
#TARGET_LINK_LIBRARIES( osm2pgrouting ${Boost_LIBRARIES} )

View File

@ -0,0 +1,11 @@
--- src/osm_elements/osm2pgrouting.cpp.orig 2020-08-20 05:44:56 UTC
+++ src/osm_elements/osm2pgrouting.cpp
@@ -140,7 +140,7 @@ int main(int argc, char* argv[]) {
cout << "Can't open database" << endl;
return 1;
}
- C.disconnect ();
+ C.close ();
}catch (const std::exception &e){
cerr << e.what() << std::endl;
return 1;