Bug #76044 [Opn->Csd]: 'date: illegal option -- -' in ./configure on FreeBSD
| From: | ab@php.net | Date: | Mon, 05 Mar 2018 21:39:37 +0000 |
| Subject: | Bug #76044 [Opn->Csd]: 'date: illegal option -- -' in ./configure on FreeBSD | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-214214@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76044&edit=1
ID: 76044
Updated by: ab@php.net
Reported by: mgorny at gentoo dot org
Summary: 'date: illegal option -- -' in ./configure on
FreeBSD
-Status: Open
+Status: Closed
Type: Bug
Package: *Compile Issues
Operating System: Gentoo/FreeBSD 11.1
PHP Version: master-Git-2018-03-02 (Git)
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=60ac2558974bf63a5f07664a53e1502835a24998
Log: Fixed bug #76044 'date: illegal option -- -' in ./configure on FreeBSD
Previous Comments:
------------------------------------------------------------------------
[2018-03-02 14:40:47] mgorny at gentoo dot org
Description:
------------
When running the configure script, I see the following error message from underlying tools:
Configuring TSRM
checking for stdarg.h... (cached) yes
checking for sigprocmask... (cached) yes
checking how many arguments gethostbyname_r() takes... (cached) six
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]
Apparently, the following code uses GNU-specific 'date' tool syntax that does not work on
*BSD (FWICS, it also won't work on MacOS X):
PHP_BUILD_DATE=
date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}"
+%Y-%m-%d
The *BSD version of 'date' does not support long options at all. The following would work
for the current date:
PHP_BUILD_DATE=date -u +%Y-%m-%d
However, I don't know of any portable replacement for --date. FWICS, the *BSD version has
'-r' option that takes UNIX epoch timestamp but the GNU version uses '-r' for
something else.
One possible option would be to replace SOURCE_DATE_EPOCH with verbatim Y-m-d date, and use e.g.:
PHP_BUILD_DATE=${SOURCE_DATE:-$(date -u +%Y-%m-%d)}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76044&edit=1