php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76044 'date: illegal option -- -' in ./configure on FreeBSD
Submitted: 2018-03-02 14:40 UTC Modified: -
From: mgorny at gentoo dot org Assigned:
Status: Closed Package: *Compile Issues
PHP Version: master-Git-2018-03-02 (Git) OS: Gentoo/FreeBSD 11.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mgorny at gentoo dot org
New email:
PHP Version: OS:

 

 [2018-03-02 14:40 UTC] 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)}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-05 21:39 UTC] ab@php.net
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
 [2018-03-05 21:39 UTC] ab@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Tue Dec 18 12:01:27 2018 UTC