Trouble with TEST_USES and TEST_BUILD_DEPENDS/TEST_DEPENDS
Andreas Sommer
andreas.sommer87 at googlemail.com
Thu Mar 16 22:43:39 UTC 2017
Hi list,
I'm currently trying to add https://github.com/HowardHinnant/date as devel/hhdate and having quite some trouble getting the tests to work while having a semantically correct port Makefile.
Quoting my Makefile here (should be reproducible with the attached full diff). I'd be grateful if someone could share insights about the 2 issues marked with XXX - and potentially general advice about structure and content.
> # Created by: Andreas Sommer <andreas.sommer87 at googlemail.com>
> # $FreeBSD$
>
> PORTNAME= hhdate
> PORTVERSION= 2.1.0
> # Choose commit a little after 2.1.0 to have LICENSE file and fixed unit tests
> GH_TAGNAME= d110f07f596d86e63daa2db41f1d52c05f4a179c
> CATEGORIES= devel
>
> MAINTAINER= andreas.sommer87 at googlemail.com
> COMMENT= A date and time library based on the C++11 (and beyond) <chrono> header
>
> LICENSE= MIT
> LICENSE_FILE= ${WRKSRC}/LICENSE.txt
>
> USE_GITHUB= yes
> GH_ACCOUNT= HowardHinnant
> GH_PROJECT= date
>
> NO_BUILD= yes
> NO_ARCH= yes
>
> PLIST_FILES= include/hhdate/date.h
>
> do-install:
> @${MKDIR} ${STAGEDIR}${PREFIX}/include/hhdate
> ${INSTALL_DATA} ${WRKSRC}/date.h ${STAGEDIR}${PREFIX}/include/hhdate/
>
> # TODO add timezone support when interest grows
> OPTIONS_DEFINE= TEST
> TEST_DESC= Build with tests
> # XXX should be TEST_USES, but then compiler.mk doesn't even seem to be called i.e. CXX and other variables not overwritten
> USES= compiler:c++14-lang
> TEST_TEST_TARGET= do-test
> # XXX doesn't work with TEST_BUILD_DEPENDS (clang++39 not found) or TEST_DEPENDS (see error below) - why?
> # ===> Testing for hhdate-2.1.0
> # ===> hhdate-2.1.0 depends on file: /usr/local/bin/clang39 - not found
> # ===> Installing existing package /packages/All/llvm39-3.9.1_2.txz
> # [porttesting-devel] Installing llvm39-3.9.1_2...
> # [porttesting-devel] `-- Installing libxml2-2.9.4...
> # [porttesting-devel] `-- Extracting libxml2-2.9.4: .......... done
> # [porttesting-devel] Extracting llvm39-3.9.1_2: .......... done
> # ===> hhdate-2.1.0 depends on file: /usr/local/bin/clang39 - found
> # ===> Returning to build of hhdate-2.1.0
> # ===> dp_STRICT_DEPENDS set - Not installing missing dependencies.
> # This means a dependency is wrong since it was not satisfied in the TEST_DEPENDS phase.
> # List of not found patterns: /usr/local/bin/clang39 [note: I added this debug line, probably worth a PR to ports tree?!]
> # BUILD_DEPENDS works but is of course not really correct.
> BUILD_DEPENDS+= ${LOCALBASE}/bin/clang39:devel/llvm39
>
> do-test:
> # As developer, I tried printf debugging in a Makefile to see which .mk's are "called" :P
> @echo ANDIDEBUG=${ANDIDEBUG}
> @echo C++14 compiler 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
>
> @echo "Run unit tests with modern compiler (not maintained for older ones)"
> @cd ${WRKSRC}/test && ${SETENV} CXX="${LOCALBASE}/bin/clang++39" \
> CXXFLAGS="${CXXFLAGS}" CXX_LANG=c++14 ./testit
>
> .include <bsd.port.mk>
Thanks,
Andreas
-------------- next part --------------
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..ce81cd3
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,67 @@
+# Created by: Andreas Sommer <andreas.sommer87 at googlemail.com>
+# $FreeBSD$
+
+PORTNAME= hhdate
+PORTVERSION= 2.1.0
+# Choose commit a little after 2.1.0 to have LICENSE file and fixed unit tests
+GH_TAGNAME= d110f07f596d86e63daa2db41f1d52c05f4a179c
+CATEGORIES= devel
+
+MAINTAINER= andreas.sommer87 at googlemail.com
+COMMENT= A date and time library based on the C++11 (and beyond) <chrono> header
+
+LICENSE= MIT
+LICENSE_FILE= ${WRKSRC}/LICENSE.txt
+
+USE_GITHUB= yes
+GH_ACCOUNT= HowardHinnant
+GH_PROJECT= date
+
+NO_BUILD= yes
+NO_ARCH= yes
+
+PLIST_FILES= include/hhdate/date.h
+
+do-install:
+ @${MKDIR} ${STAGEDIR}${PREFIX}/include/hhdate
+ ${INSTALL_DATA} ${WRKSRC}/date.h ${STAGEDIR}${PREFIX}/include/hhdate/
+
+# TODO add timezone support when interest grows
+OPTIONS_DEFINE= TEST
+TEST_DESC= Build with tests
+# XXX should be TEST_USES, but then compiler.mk doesn't even seem to be called?!
+USES= compiler:c++14-lang
+TEST_TEST_TARGET= do-test
+# XXX doesn't work with TEST_BUILD_DEPENDS (clang++39 not found) or TEST_DEPENDS (see error below) - why?
+# ===> Testing for hhdate-2.1.0
+# ===> hhdate-2.1.0 depends on file: /usr/local/bin/clang39 - not found
+# ===> Installing existing package /packages/All/llvm39-3.9.1_2.txz
+# [porttesting-devel] Installing llvm39-3.9.1_2...
+# [porttesting-devel] `-- Installing libxml2-2.9.4...
+# [porttesting-devel] `-- Extracting libxml2-2.9.4: .......... done
+# [porttesting-devel] Extracting llvm39-3.9.1_2: .......... done
+# ===> hhdate-2.1.0 depends on file: /usr/local/bin/clang39 - found
+# ===> Returning to build of hhdate-2.1.0
+# ===> dp_STRICT_DEPENDS set - Not installing missing dependencies.
+# This means a dependency is wrong since it was not satisfied in the TEST_DEPENDS phase.
+# List of not found patterns: /usr/local/bin/clang39 [note: I added this debug line, probably worth a PR to ports tree?!]
+# BUILD_DEPENDS works but is of course not really correct.
+BUILD_DEPENDS+= ${LOCALBASE}/bin/clang39:devel/llvm39
+
+do-test:
+ @echo ANDIDEBUG=${ANDIDEBUG}
+ @echo C++14 compiler 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
+
+ @echo "Run unit tests with modern compiler (not maintained for older ones)"
+ @cd ${WRKSRC}/test && ${SETENV} CXX="${LOCALBASE}/bin/clang++39" \
+ CXXFLAGS="${CXXFLAGS}" CXX_LANG=c++14 ./testit
+
+.include <bsd.port.mk>
diff --git a/distinfo b/distinfo
new file mode 100644
index 0000000..49fd06f
--- /dev/null
+++ b/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1489697375
+SHA256 (HowardHinnant-date-2.1.0-d110f07f596d86e63daa2db41f1d52c05f4a179c_GH0.tar.gz) = 18bbc78573942f783d9f8bdd3dae86376335e704e784f4119979bed0e03c4495
+SIZE (HowardHinnant-date-2.1.0-d110f07f596d86e63daa2db41f1d52c05f4a179c_GH0.tar.gz) = 776082
diff --git a/files/test-minimal.cpp b/files/test-minimal.cpp
new file mode 100644
index 0000000..3328743
--- /dev/null
+++ b/files/test-minimal.cpp
@@ -0,0 +1,20 @@
+// Small example taken from https://howardhinnant.github.io/date/date.html.
+// Only for testing installed header shortly.
+#include <iostream>
+#include <hhdate/date.h>
+
+int main()
+{
+ using namespace std;
+ using namespace date;
+ for (auto m = 1; m <= 12; ++m)
+ {
+ auto meet = year_month_day{m/fri[1]/2015};
+ cout << meet << '\n';
+ meet = meet.year()/meet.month()/(meet.day()+weeks{2});
+ cout << meet << '\n';
+ meet = meet.year()/meet.month()/(meet.day()+weeks{2});
+ if (meet.ok())
+ cout << meet << '\n';
+ }
+}
diff --git a/pkg-descr b/pkg-descr
new file mode 100644
index 0000000..1143610
--- /dev/null
+++ b/pkg-descr
@@ -0,0 +1,3 @@
+A date and time library based on the C++11 (and beyond) <chrono> header
+
+WWW: https://github.com/HowardHinnant/date
More information about the freebsd-ports
mailing list