summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Toth <gentoo@jonas-toth.eu>2020-08-12 16:32:56 +0200
committerSam James <sam@gentoo.org>2020-09-13 05:31:05 +0000
commit57218032b025bf23f76a7053f3ddc2208b6e282e (patch)
treefed4c3a08a32efbfb085ad53a7a2ec27f998f8bf /dev-libs/date
parentapp-metrics/consul_exporter: 0.7.1 bump (diff)
downloadgentoo-57218032b025bf23f76a7053f3ddc2208b6e282e.tar.gz
gentoo-57218032b025bf23f76a7053f3ddc2208b6e282e.tar.bz2
gentoo-57218032b025bf23f76a7053f3ddc2208b6e282e.zip
dev-libs/date: add new 'date' C++ library
The 'date' library is voted into C++20 and Howard Hinnants implementation serves as a free standing library and foundation for the standardized library. Bug: https://bugs.gentoo.org/712236 Package-Manager: Portage-3.0.2, Repoman-2.3.23 Signed-off-by: Jonas Toth <gentoo@jonas-toth.eu> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-libs/date')
-rw-r--r--dev-libs/date/Manifest1
-rw-r--r--dev-libs/date/date-3.0.0.ebuild55
-rw-r--r--dev-libs/date/files/date-3.0.0-c-locale-export.patch90
-rw-r--r--dev-libs/date/files/date-3.0.0-version.patch15
-rw-r--r--dev-libs/date/metadata.xml20
5 files changed, 181 insertions, 0 deletions
diff --git a/dev-libs/date/Manifest b/dev-libs/date/Manifest
new file mode 100644
index 000000000000..168710ab4714
--- /dev/null
+++ b/dev-libs/date/Manifest
@@ -0,0 +1 @@
+DIST date-3.0.0.tar.gz 822623 BLAKE2B 438a7a5c153c7c2d695fefc95bbd474ef507af2cd8182d1e7d54d482b0128c3f9c57582ed5b40ef46d8f6f5539228d20322c684b1e1b418e5ade3b4871bf4ec1 SHA512 03ba0faef68e053aba888591b9350af1a043ef543825c80b1ca3f0dc0448697f56286e561f1a2a59e684680d7fc1e51fd24955c4cc222fe28db64f56037dc1aa
diff --git a/dev-libs/date/date-3.0.0.ebuild b/dev-libs/date/date-3.0.0.ebuild
new file mode 100644
index 000000000000..1b7acb557db0
--- /dev/null
+++ b/dev-libs/date/date-3.0.0.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit cmake
+
+DESCRIPTION="A date and time library based on the C++11/14/17 <chrono> header"
+HOMEPAGE="https://github.com/HowardHinnant/date"
+
+SRC_URI="https://github.com/HowardHinnant/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+KEYWORDS="~amd64"
+
+LICENSE="MIT"
+SLOT="0"
+IUSE="only-c-locale test"
+RESTRICT="!test? ( test )"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-c-locale-export.patch
+ "${FILESDIR}"/${P}-version.patch
+)
+
+src_prepare() {
+ # The test cases are implicitly generated with CMake code, that parses
+ # the file names for ".cpp" and ".fail.cpp". Renaming the source files
+ # disables the test.
+
+ # This test case fails due to a stdlibc++ bug.
+ # Upstream bug: https://github.com/HowardHinnant/date/issues/388
+ mv "test/date_test/parse.pass.cpp" "test/date_test/parse.disabled" || ewarn "Can not deactivate test case, test failure expected"
+
+ # This test case fails only when the CMAKE_BUILD_TYPE=Gentoo.
+ # The behaviour seems very strange, but does not appear with a
+ # "valid" build type.
+ # Upstream bug: https://github.com/HowardHinnant/date/issues/604
+ mv "test/clock_cast_test/local_t.pass.cpp" "test/clock_cast_test/local_t.disabled" || ewarn "Can not deactivate test case, test failure expected"
+
+ cmake_src_prepare
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DBUILD_TZ_LIB=ON
+ -DUSE_SYSTEM_TZ_DB=ON
+ -DENABLE_DATE_TESTING=$(usex test)
+ -DCOMPILE_WITH_C_LOCALE=$(usex only-c-locale)
+ )
+ cmake_src_configure
+}
+
+src_test() {
+ cd "${BUILD_DIR}" || die
+ ninja testit
+}
diff --git a/dev-libs/date/files/date-3.0.0-c-locale-export.patch b/dev-libs/date/files/date-3.0.0-c-locale-export.patch
new file mode 100644
index 000000000000..a4e5a9a93ef0
--- /dev/null
+++ b/dev-libs/date/files/date-3.0.0-c-locale-export.patch
@@ -0,0 +1,90 @@
+Fixes an compilation error when 'ONLY_C_LOCALE' is used to build the project.
+
+Upstream-Bug: https://github.com/HowardHinnant/date/issues/589
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -76,10 +76,25 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.15)
+ # public headers will get installed:
+ set_target_properties( date PROPERTIES PUBLIC_HEADER include/date/date.h )
+ endif ()
+-target_compile_definitions( date INTERFACE
+- #To workaround libstdc++ issue https://github.com/HowardHinnant/date/issues/388
+- ONLY_C_LOCALE=$<IF:$<BOOL:${COMPILE_WITH_C_LOCALE}>,1,0>
+- $<$<BOOL:${DISABLE_STRING_VIEW}>:HAS_STRING_VIEW=0> )
++
++# These used to be set with generator expressions,
++#
++# ONLY_C_LOCALE=$<IF:$<BOOL:${COMPILE_WITH_C_LOCALE}>,1,0>
++#
++# which expand in the output target file to, e.g.
++#
++# ONLY_C_LOCALE=$<IF:$<BOOL:FALSE>,1,0>
++#
++# This string is then (somtimes?) not correctly interpreted.
++if ( COMPILE_WITH_C_LOCALE )
++ # To workaround libstdc++ issue https://github.com/HowardHinnant/date/issues/388
++ target_compile_definitions( date INTERFACE ONLY_C_LOCALE=1 )
++else()
++ target_compile_definitions( date INTERFACE ONLY_C_LOCALE=0 )
++endif()
++if ( DISABLE_STRING_VIEW )
++ target_compile_definitions( date INTERFACE HAS_STRING_VIEW=0 )
++endif()
+
+ #[===================================================================[
+ tz (compiled) library
+@@ -89,27 +104,40 @@ if( BUILD_TZ_LIB )
+ target_sources( date-tz
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>$<INSTALL_INTERFACE:include>/date/tz.h
+- $<$<BOOL:${IOS}>:$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>$<INSTALL_INTERFACE:include>/date/ios.h>
+ PRIVATE
+ include/date/tz_private.h
+- $<$<BOOL:${IOS}>:src/ios.mm>
+ src/tz.cpp )
++ if ( IOS )
++ target_sources( date-tz
++ PUBLIC
++ $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>$<INSTALL_INTERFACE:include>/date/ios.h
++ PRIVATE
++ src/ios.mm )
++ endif()
+ add_library( date::tz ALIAS date-tz )
+ target_link_libraries( date-tz PUBLIC date )
+ target_include_directories( date-tz PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+ $<INSTALL_INTERFACE:include> )
+- target_compile_definitions( date-tz
+- PRIVATE
+- AUTO_DOWNLOAD=$<IF:$<OR:$<BOOL:${USE_SYSTEM_TZ_DB}>,$<BOOL:${MANUAL_TZ_DB}>>,0,1>
+- HAS_REMOTE_API=$<IF:$<OR:$<BOOL:${USE_SYSTEM_TZ_DB}>,$<BOOL:${MANUAL_TZ_DB}>>,0,1>
+- $<$<AND:$<BOOL:${WIN32}>,$<BOOL:${BUILD_SHARED_LIBS}>>:DATE_BUILD_DLL=1>
+- $<$<BOOL:${USE_TZ_DB_IN_DOT}>:INSTALL=.>
+- PUBLIC
+- USE_OS_TZDB=$<IF:$<AND:$<BOOL:${USE_SYSTEM_TZ_DB}>,$<NOT:$<BOOL:${WIN32}>>,$<NOT:$<BOOL:${MANUAL_TZ_DB}>>>,1,0>
+- INTERFACE
+- $<$<AND:$<BOOL:${WIN32}>,$<BOOL:${BUILD_SHARED_LIBS}>>:DATE_USE_DLL=1> )
++
++ if ( USE_SYSTEM_TZ_DB OR MANUAL_TZ_DB )
++ target_compile_definitions( date-tz PRIVATE AUTO_DOWNLOAD=0 HAS_REMOTE_API=0 )
++ else()
++ target_compile_definitions( date-tz PRIVATE AUTO_DOWNLOAD=1 HAS_REMOTE_API=1 )
++ endif()
++
++ if ( USE_SYSTEM_TZ_DB AND NOT WIN32 AND NOT MANUAL_TZ_DB )
++ target_compile_definitions( date-tz PRIVATE INSTALL=. PUBLIC USE_OS_TZDB=1 )
++ else()
++ target_compile_definitions( date-tz PUBLIC USE_OS_TZDB=0 )
++ endif()
++
++ if ( WIN32 AND BUILD_SHARED_LIBS )
++ target_compile_definitions( date-tz PUBLIC DATE_BUILD_DLL=1 )
++ endif()
++
+ set(TZ_HEADERS include/date/tz.h)
++
+ if( IOS )
+ list(APPEND TZ_HEADERS include/date/ios.h)
+ endif( )
+--
diff --git a/dev-libs/date/files/date-3.0.0-version.patch b/dev-libs/date/files/date-3.0.0-version.patch
new file mode 100644
index 000000000000..398b2107059c
--- /dev/null
+++ b/dev-libs/date/files/date-3.0.0-version.patch
@@ -0,0 +1,15 @@
+Fixes an oversight in the build-system versioning.
+
+Upstream-Bug: https://github.com/HowardHinnant/date/issues/583
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -17,7 +17,7 @@
+
+ cmake_minimum_required( VERSION 3.7 )
+
+-project( date VERSION 2.4.1 )
++project( date VERSION 3.0.0 )
+
+ include( GNUInstallDirs )
+
diff --git a/dev-libs/date/metadata.xml b/dev-libs/date/metadata.xml
new file mode 100644
index 000000000000..aaa7e8ae6e5d
--- /dev/null
+++ b/dev-libs/date/metadata.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM 'http://www.gentoo.org/dtd/metadata.dtd'>
+<pkgmetadata>
+ <maintainer type="person">
+ <email>gentoo@jonas-toth.eu</email>
+ <name>Jonas Toth</name>
+ </maintainer>
+ <maintainer type="project">
+ <email>proxy-maint@gentoo.org</email>
+ <name>Proxy Maintainers</name>
+ </maintainer>
+ <use>
+ <flag name="only-c-locale">Build only the C locale</flag>
+ </use>
+ <upstream>
+ <remote-id type="github">HowardHinnant/date</remote-id>
+ <bugs-to>https://github.com/HowardHinnant/date/issues</bugs-to>
+ <changelog>https://github.com/HowardHinnant/date/releases</changelog>
+ </upstream>
+</pkgmetadata>