#!/bin/sh
# build-info -- Generate header file containing build details
# $Id: build-info,v 1.5 2000/11/16 21:58:27 jsh Exp $

version="$1"
sawfishdir="$2"
lispdir="$3"
sawfishexecdir="$4"
localedir="$5"

[ -n "$HOSTNAME" ] \
    || HOSTNAME=`hostname` \
    || HOSTNAME=unknown

[ -n "$LOCALDOMAIN" ] \
    || LOCALDOMAIN=`dnsdomainname` \
    || LOCALDOMAIN=`domainname` \
    || LOCALDOMAIN=unknown

sys_name="$HOSTNAME.$LOCALDOMAIN"
user_name="$LOGNAME"

build_date="`date +'%a %b %e %Y'`"
build_time="`date +'%T %Z'`"

cat >src/build.h <<EOF
/* build.h -- Definitions relating to the current build
   Automatically generated by build-info; DO NOT EDIT! */

#ifndef BUILD_H
#define BUILD_H

#define SAWFISH_VERSION "$version"
#define SAWFISH_DIR "$sawfishdir"
#define SAWFISH_LISPDIR "$lispdir"
#define SAWFISH_EXECDIR "$sawfishexecdir"
#define SAWFISH_LOCALEDIR "$localedir"

#define BUILD_HOST "$sys_name"
#define BUILD_USER "$user_name"

#define BUILD_DATE "$build_date"
#define BUILD_TIME "$build_time"

#endif /* BUILD_H */
EOF
