mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-26 22:52:34 +02:00
BSD refinements
Make it easier to compile flashrom under NetBSD and DragonFlyBSD: - Use /usr/pkg/ as prefix for includes and linking - Use pciutils as include path for the right(tm) libpci Also, fix date handling in getrevision.sh to work with the various formats for invoking 'date'. This also uses svn's info --xml output instead of the regular one. Corresponding to flashrom svn r1742. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Tested-by: Idwer Vollering <vidwer@gmail.com> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
This commit is contained in:
parent
4442b81fd8
commit
c65b8555d5
14
Makefile
14
Makefile
@ -98,6 +98,16 @@ CPPFLAGS += -I/usr/local/include
|
|||||||
LDFLAGS += -L/usr/local/lib
|
LDFLAGS += -L/usr/local/lib
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET_OS), NetBSD)
|
||||||
|
CPPFLAGS += -I/usr/pkg/include
|
||||||
|
LDFLAGS += -L/usr/pkg/lib
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET_OS), DragonFlyBSD)
|
||||||
|
CPPFLAGS += -I/usr/pkg/include
|
||||||
|
LDFLAGS += -L/usr/pkg/lib
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET_OS), DOS)
|
ifeq ($(TARGET_OS), DOS)
|
||||||
EXEC_SUFFIX := .exe
|
EXEC_SUFFIX := .exe
|
||||||
CPPFLAGS += -I$(DOSLIBS_BASE)/libgetopt
|
CPPFLAGS += -I$(DOSLIBS_BASE)/libgetopt
|
||||||
@ -743,7 +753,11 @@ endif
|
|||||||
define LIBPCI_TEST
|
define LIBPCI_TEST
|
||||||
/* Avoid a failing test due to libpci header symbol shadowing breakage */
|
/* Avoid a failing test due to libpci header symbol shadowing breakage */
|
||||||
#define index shadow_workaround_index
|
#define index shadow_workaround_index
|
||||||
|
#if !defined __NetBSD__ && !defined __DragonFly__
|
||||||
#include <pci/pci.h>
|
#include <pci/pci.h>
|
||||||
|
#else
|
||||||
|
#include <pciutils/pci.h>
|
||||||
|
#endif
|
||||||
struct pci_access *pacc;
|
struct pci_access *pacc;
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
6
README
6
README
@ -80,11 +80,9 @@ To compile on Solaris, use:
|
|||||||
|
|
||||||
gmake LDFLAGS="-L$pathtolibpci" CC="gcc -I$pathtopciheaders" CFLAGS=-O2
|
gmake LDFLAGS="-L$pathtolibpci" CC="gcc -I$pathtopciheaders" CFLAGS=-O2
|
||||||
|
|
||||||
To compile on NetBSD or DragonFly BSD, use:
|
To compile on NetBSD or DragonFly BSD (with pciutils, libftdi, libusb installed in /usr/pkg/), use:
|
||||||
|
|
||||||
ln -s /usr/pkg/include/pciutils pci
|
gmake
|
||||||
gmake CPPFLAGS="-I. -I/usr/pkg/include" \
|
|
||||||
LDFLAGS="-L/usr/pkg/lib -Wl,-rpath-link,/usr/pkg/lib"
|
|
||||||
|
|
||||||
To compile on OpenBSD, use:
|
To compile on OpenBSD, use:
|
||||||
|
|
||||||
|
@ -37,7 +37,13 @@
|
|||||||
* or as builtin.
|
* or as builtin.
|
||||||
*/
|
*/
|
||||||
#define index shadow_workaround_index
|
#define index shadow_workaround_index
|
||||||
|
|
||||||
|
#if !defined (__NetBSD__) && !defined (__DragonFly__)
|
||||||
#include <pci/pci.h>
|
#include <pci/pci.h>
|
||||||
|
#else
|
||||||
|
#include <pciutils/pci.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef index
|
#undef index
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -110,15 +110,33 @@ scm_url() {
|
|||||||
timestamp() {
|
timestamp() {
|
||||||
local t
|
local t
|
||||||
|
|
||||||
|
# date syntaxes are manifold:
|
||||||
|
# gnu date [-d input]... [+FORMAT]
|
||||||
|
# netbsd date [-ajnu] [-d date] [-r seconds] [+format] [[[[[[CC]yy]mm]dd]HH]MM[.SS]]
|
||||||
|
# freebsd date [-jnu] [-d dst] [-r seconds] [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format] [...]
|
||||||
|
# dragonflybsd date [-jnu] [-d dst] [-r seconds] [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format] [...]
|
||||||
|
# openbsd date [-aju] [-d dst] [-r seconds] [+format] [[[[[[cc]yy]mm]dd]HH]MM[.SS]] [...]
|
||||||
if svn_is_file_tracked "$2" ; then
|
if svn_is_file_tracked "$2" ; then
|
||||||
if svn_has_local_changes "$2"; then
|
if svn_has_local_changes "$2"; then
|
||||||
t=$(date -u "$1")
|
t=$(date -u "$1")
|
||||||
else
|
else
|
||||||
# No local changes, get date of the last log record.
|
# No local changes, get date of the last log record. Subversion provides that in
|
||||||
local last_commit_date="$(svn info "$2" | \
|
# ISO 8601 format when using the --xml switch. The sed call extracts that ignoring any
|
||||||
grep '^Last Changed Date:' | \
|
# fractional parts started by a comma or a dot.
|
||||||
awk '{print $4" "$5" "$6}')"
|
local last_commit_date="$(svn info --xml "$2"| \
|
||||||
t=$(date -d "${last_commit_date}" -u "$1")
|
sed -n -e 's/<date>\([^,\.]*\)\([\.,].*\)*Z<\/date>/\1Z/p')"
|
||||||
|
|
||||||
|
case $(uname) in
|
||||||
|
# Most BSD dates do not support parsing date values from user input with -d but all of
|
||||||
|
# them support parsing the syntax with [[[[[[cc]yy]mm]dd]HH]MM[.ss]]. We have to
|
||||||
|
# transform the ISO8601 date first though.
|
||||||
|
NetBSD|OpenBSD|DragonFly|FreeBSD)
|
||||||
|
last_commit_date="$(echo ${last_commit_date} | \
|
||||||
|
sed -n -e 's/\(....\)-\(..\)-\(..\)T\(..\):\(..\):\(..\)Z/\1\2\3\4\5\.\6/p')"
|
||||||
|
t=$(date -u -j "${last_commit_date}" "$1" 2>/dev/null);;
|
||||||
|
*)
|
||||||
|
t=$(date -u -d "${last_commit_date}" "$1" 2>/dev/null);;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
elif git_is_file_tracked "$2" ; then
|
elif git_is_file_tracked "$2" ; then
|
||||||
# are there local changes?
|
# are there local changes?
|
||||||
@ -126,12 +144,22 @@ timestamp() {
|
|||||||
t=$(date -u "${1}")
|
t=$(date -u "${1}")
|
||||||
else
|
else
|
||||||
# No local changes, get date of the last commit
|
# No local changes, get date of the last commit
|
||||||
t=$(date -d "$(git log --pretty=format:"%cD" -1 -- "$2")" -u "$1")
|
case $(uname) in
|
||||||
|
# Most BSD dates do not support parsing date values from user input with -d but all of
|
||||||
|
# them support parsing epoch seconds with -r. Thanks to git we can easily use that:
|
||||||
|
NetBSD|OpenBSD|DragonFly|FreeBSD)
|
||||||
|
t=$(date -u -r "$(git log --pretty=format:%ct -1 -- $2)" "$1" 2>/dev/null);;
|
||||||
|
*)
|
||||||
|
t=$(date -d "$(git log --pretty=format:%cD -1 -- $2)" -u "$1" 2>/dev/null);;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
t=$(date -u "$1")
|
t=$(date -u "$1")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$t" ]; then
|
||||||
|
echo "Warning: Could not determine timestamp." 2>/dev/null
|
||||||
|
fi
|
||||||
echo "${t}"
|
echo "${t}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user