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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 14:01:29 2024 UTC