The configure-time compile test for libphonenumber fails unless C++17,
as set in both libphonenumber and abseil-cpp, is used.

Adjust the project's standard and make the configure test honour it.

Replace one usage of auto_ptr in the C++14 code base with unique_ptr;
should probably be done anyway if I read the references right.

Build-tested only.
No PLIST change.

Feedback? Objection? OK?

Index: Makefile
===================================================================
RCS file: /cvs/ports/databases/evolution-data-server/Makefile,v
retrieving revision 1.292
diff -u -p -r1.292 Makefile
--- Makefile    7 Jan 2023 10:01:17 -0000       1.292
+++ Makefile    6 Feb 2023 17:40:01 -0000
@@ -2,6 +2,7 @@ COMMENT=                unified backend for PIM progra
 
 GNOME_PROJECT=         evolution-data-server
 GNOME_VERSION=         3.46.3
+REVISION=              0
 
 CATEGORIES=            databases productivity
 
@@ -68,6 +69,7 @@ CFLAGS +=             -I${LOCALBASE}/include
 DEBUG_PACKAGES=                ${BUILD_PACKAGES}
 
 pre-configure:
+       sed -i /CMAKE_CXX_STANDARD/s,14,17, ${WRKSRC}/CMakeLists.txt
        sed -i 's,/usr/sbin/imapd,${LOCALBASE}/libexec/imapd,g' \
                ${WRKSRC}/src/camel/providers/imapx/camel-imapx-settings.c
 # don't pick up db_load from databases/db/v3
Index: patches/patch-cmake_modules_FindPhonenumber_cmake
===================================================================
RCS file: patches/patch-cmake_modules_FindPhonenumber_cmake
diff -N patches/patch-cmake_modules_FindPhonenumber_cmake
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-cmake_modules_FindPhonenumber_cmake   6 Feb 2023 16:10:34 
-0000
@@ -0,0 +1,25 @@
+abseil-cpp>=20230115.0 used by libphonenumber fails unless C++17 is used,
+but CMAKE_CXX_STANDARD has no effect on CheckCXXSourceCompiles().
+
+CMAKE_REQUIRED_FLAGS must not be passed globally as it effects all targets,
+including C files.
+
+Index: cmake/modules/FindPhonenumber.cmake
+--- cmake/modules/FindPhonenumber.cmake.orig
++++ cmake/modules/FindPhonenumber.cmake
+@@ -53,6 +53,7 @@ unset(optupper)
+ set(CMAKE_REQUIRED_DEFINITIONS ${PHONENUMBER_DEFINITIONS})
+ set(CMAKE_REQUIRED_INCLUDES ${PHONENUMBER_INCLUDE_DIRS})
+ 
++set(CMAKE_REQUIRED_FLAGS "-std=gnu++${CMAKE_CXX_STANDARD}")
+ foreach(lib boost_thread-mt boost_thread)
+       set(CMAKE_REQUIRED_LIBRARIES ${PHONENUMBER_LDFLAGS} -l${lib})
+       CHECK_CXX_SOURCE_COMPILES("#include <phonenumbers/phonenumberutil.h>
+@@ -67,6 +68,7 @@ foreach(lib boost_thread-mt boost_thread)
+               break()
+       endif(phone_number_with_${lib})
+ endforeach(lib)
++unset(CMAKE_REQUIRED_FLAGS)
+ 
+ if(NOT ENABLE_PHONENUMBER)
+       message(FATAL_ERROR "libphonenumber cannot be used. Use 
-DWITH_PHONENUMBER=PATH to specify the library prefix, or 
-DWITH_PHONENUMBER=OFF to disable it.")
Index: 
patches/patch-src_addressbook_libebook-contacts_e-phone-number-private_cpp
===================================================================
RCS file: 
patches/patch-src_addressbook_libebook-contacts_e-phone-number-private_cpp
diff -N 
patches/patch-src_addressbook_libebook-contacts_e-phone-number-private_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_addressbook_libebook-contacts_e-phone-number-private_cpp  
6 Feb 2023 17:38:31 -0000
@@ -0,0 +1,15 @@
+Replace auto_ptr (deprecated/removed in C++11/17 with unique_ptr to build with
+C++17 as demanded by abseil-cpp (through libphonenumber).
+
+Index: src/addressbook/libebook-contacts/e-phone-number-private.cpp
+--- src/addressbook/libebook-contacts/e-phone-number-private.cpp.orig
++++ src/addressbook/libebook-contacts/e-phone-number-private.cpp
+@@ -183,7 +183,7 @@ _e_phone_number_cxx_from_string (const gchar *phone_nu
+       g_return_val_if_fail (NULL != phone_number, NULL);
+ 
+       const std::string valid_region = _e_phone_number_cxx_make_region_code 
(region_code);
+-      std::auto_ptr<EPhoneNumber> parsed_number(new EPhoneNumber);
++      std::unique_ptr<EPhoneNumber> parsed_number(new EPhoneNumber);
+ 
+       if (!_e_phone_number_cxx_parse (
+               phone_number, valid_region, &parsed_number->priv, error))

Reply via email to