Bug 218030 - [New port] devel/hhdate: A date and time library based on the C++11 (and beyond) <chrono> header
Summary: [New port] devel/hhdate: A date and time library based on the C++11 (and beyo...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Michael Gmelin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-23 09:20 UTC by Andreas Sommer
Modified: 2017-03-27 22:38 UTC (History)
1 user (show)

See Also:


Attachments
Port skeleton (3.85 KB, text/plain)
2017-03-23 09:20 UTC, Andreas Sommer
no flags Details
Poudriere log (with TEST option) (15.29 KB, text/plain)
2017-03-23 09:21 UTC, Andreas Sommer
no flags Details
Poudriere log (without TEST option, just installs one header) (7.43 KB, text/plain)
2017-03-23 09:21 UTC, Andreas Sommer
no flags Details
Port skeleton with review fixes (4.19 KB, text/plain)
2017-03-27 20:47 UTC, Andreas Sommer
no flags Details
Poudriere log (with TEST option) (15.43 KB, text/plain)
2017-03-27 20:47 UTC, Andreas Sommer
no flags Details
Port skeleton (3.78 KB, text/plain)
2017-03-27 22:19 UTC, Andreas Sommer
no flags Details
Poudriere log (with TEST option) (10.94 KB, text/plain)
2017-03-27 22:20 UTC, Andreas Sommer
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Sommer 2017-03-23 09:20:41 UTC
Created attachment 181087 [details]
Port skeleton
Comment 1 Andreas Sommer 2017-03-23 09:21:05 UTC
Created attachment 181088 [details]
Poudriere log (with TEST option)
Comment 2 Andreas Sommer 2017-03-23 09:21:35 UTC
Created attachment 181089 [details]
Poudriere log (without TEST option, just installs one header)
Comment 3 Michael Gmelin freebsd_committer freebsd_triage 2017-03-23 11:11:15 UTC
Why do you use PORTREVISION=35?
Comment 4 Michael Gmelin freebsd_committer freebsd_triage 2017-03-23 11:15:31 UTC
Also: As the library says C++11, are you sure that

TEST_USES=		compiler:c++14-lang
TEST_BUILD_DEPENDS=	${LOCALBASE}/bin/clang39:devel/llvm39

are required? (maybe c++11-lang would do?). You might also want to explore USE_CXXSTD in this case (not sure if it's required or not).

In case this doesn't work with C++11, I would change the port description (even if it's different from upstream in this case) to reflect that.
Comment 5 Andreas Sommer 2017-03-23 11:16:12 UTC
(In reply to Michael Gmelin from comment #3)
Quoting my Makefile:

> # New versions aren't released often, so using the number of commits since
> # last release as PORTREVISION (see `git describe --tags ${GH_TAGNAME}`).
> # 35 = commit a little after 2.1.0 to have LICENSE file and fixed unit tests.
> PORTREVISION=		35
> GH_TAGNAME=		3ab6510cab764c1a20926b1e8442af4c9e8a16b2

so the 35 comes from `git describe --tags 3ab6510cab764c1a20926b1e8442af4c9e8a16b2` == 2.1.0-35-g3ab6510

I thought that's a reasonable way of versioning this port for a library which doesn't usually receive minor version releases. That might change in the future, but currently the FreeBSD port would be the first OS package ever made for the library, so releases are probably just not important yet as people just pull the latest header file from GitHub.
Comment 6 Andreas Sommer 2017-03-23 11:22:57 UTC
(In reply to Michael Gmelin from comment #4)
The library works fine for both C++11/C++14 but the tests seem only maintained for C++14. Since the tests don't build for C++11, I simply didn't make the effort at the current time to fix that. The upstream maintainer already fixed some problems that came up during the port build (TEST=on), and I think making it build with C++11 could be done when the maintainer or I have more time available.

Since the library states that it works for both standards, I added these tests to actually confirm that statement:
> @echo "C++14 compiler (chosen: ${CXX}) should compile minimal example"
> ${CXX} -std=c++14 -stdlib=libc++ ${CXXFLAGS} ${FILESDIR}/test-minimal.cpp \
>         -I${STAGEDIR}${PREFIX}/include -o ${WRKDIR}/test-minimal && \
>         ${WRKDIR}/test-minimal >/dev/null
> 
> @echo "System compiler in C++11 mode should compile minimal example"
> clang++ -std=c++11 -stdlib=libc++ ${FILESDIR}/test-minimal.cpp \
>         -I${STAGEDIR}${PREFIX}/include -o ${WRKDIR}/test-minimal && \
>         ${WRKDIR}/test-minimal >/dev/null

Regarding USE_CXXSTD: we're juggling two different language standards in the Makefile, so I'd rather have it explicitly defined everywhere (everywhere = "do-test" target). What do you think?
Comment 7 Michael Gmelin freebsd_committer freebsd_triage 2017-03-23 11:33:14 UTC
(In reply to Andreas Sommer from comment #5)

Portrevisions are not for versioning upstream but for marking progress in a port. Thus, a new port never has one set and every change which isn't coming from upstream will increase that counter.

So what I would suggest is:

 - You remove portrevision
 - You remove the github commit in the Makefile, so it
   actually checks out version 2.1.0 from upstream
 - You add the diff between upstream and 2.1.0 as a patch
   in files

That way it's very clear what's going on in the port. Once upstream tags a new version, you can get rid of the patch.

Regadring USE_CXXSTD: This is supposed to modify CXXFLAGS for you to select the correct standard. I don't like the explicit use of "clang++" in the Makefile. Maybe it would make more sense to put create Makefile.in in files and install that in post-extract into the ports workdir. Then your test target in the Makefile would get super trivial.
Comment 8 Michael Gmelin freebsd_committer freebsd_triage 2017-03-23 11:50:37 UTC
(In reply to Michael Gmelin from comment #7)

Alternatively you could keep the commit in the Makefile and change the library version to 2.1.0.35 and still remove PORTREVISION from Makefile.

See also
https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/makefile-naming.html
https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/makefile-distfiles.html#makefile-distversion
Comment 9 Andreas Sommer 2017-03-27 20:47:28 UTC
Created attachment 181243 [details]
Port skeleton with review fixes

Outsourced a Makefile.in and changed versioning scheme
Comment 10 Andreas Sommer 2017-03-27 20:47:53 UTC
Created attachment 181244 [details]
Poudriere log (with TEST option)
Comment 11 Michael Gmelin freebsd_committer freebsd_triage 2017-03-27 21:26:22 UTC
(In reply to Andreas Sommer from comment #9)

> TEST_USES=		compiler:c++14-lang
> TEST_BUILD_DEPENDS=	${LOCALBASE}/bin/clang39:devel/llvm39

Looking at these two lines, the second one seems not necessary, the ports framework should pick a sufficient compiler for you (that way you won't have tp update this line when a new version of clang and/or gcc becomes available).
Comment 12 Andreas Sommer 2017-03-27 22:19:48 UTC
Created attachment 181247 [details]
Port skeleton

Removing unit tests for now, as discussed. Too many unclarified questions about tests that don't build with C++14 ready compilers (llvm36/llvm37) or are marked C++14 only while they should also build fine for C++11 (static_assert issues?!).

Left over is a check whether a minimal example builds fine with a c++11-lib compiler.
Comment 13 Andreas Sommer 2017-03-27 22:20:11 UTC
Created attachment 181248 [details]
Poudriere log (with TEST option)
Comment 14 Michael Gmelin freebsd_committer freebsd_triage 2017-03-27 22:31:14 UTC
For some reason there is a "configure" directory in your shar archive, I'll remove that, test and commit.

Thanks for adapting the skeleton multiple times.
Comment 15 commit-hook freebsd_committer freebsd_triage 2017-03-27 22:36:17 UTC
A commit references this bug:

Author: grembo
Date: Mon Mar 27 22:35:21 UTC 2017
New revision: 437089
URL: https://svnweb.freebsd.org/changeset/ports/437089

Log:
  Add hhdate 2.1.0.35, date and time library based on the C++11 (and
  beyond) <chrono> header.

  PR:		218030
  Submitted by:	Andreas Sommer <andreas.sommer87@googlemail.com>

Changes:
  head/devel/Makefile
  head/devel/hhdate/
  head/devel/hhdate/Makefile
  head/devel/hhdate/distinfo
  head/devel/hhdate/files/
  head/devel/hhdate/files/Makefile.in
  head/devel/hhdate/files/test-minimal.cpp
  head/devel/hhdate/pkg-descr