#!/usr/bin/perl -CDS

#
# Font log generator for Tsukurimashou
# Copyright (C) 2011, 2012, 2013, 2014, 2015, 2017  Matthew Skala
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# As a special exception, if you create a document which uses this font, and
# embed this font or unaltered portions of this font into the document, this
# font does not by itself cause the resulting document to be covered by the
# GNU General Public License. This exception does not however invalidate any
# other reasons why the document might be covered by the GNU General Public
# License. If you modify this font, you may extend this exception to your
# version of the font, but you are not obligated to do so. If you do not
# wish to do so, delete this exception statement from your version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Matthew Skala
# http://ansuz.sooke.bc.ca/
# mskala@ansuz.sooke.bc.ca
#

use utf8;

$prefix=$0;
$prefix=~s!/tools/make-flog$!!;

if (-r "$prefix/makefile-maint.inc") {
  $svnversion=`cd $prefix; svnversion`;
  chomp $svnversion;
} else {
  $svnversion='3rd-party';
}

$tsuversion='UNKNOWN';
open(MAKEFILE,'Makefile');
while (<MAKEFILE>) {
  $tsuversion=$1 if /^VERSION\s*=\s*(\S+)/;
}
close(MAKEFILE);

print <<EOF;
TSUKURIMASHOU PARAMETRIC FONT FAMILY
Version $tsuversion ($svnversion)
Copyright © 2011, 2012, 2013, 2014, 2015, 2017  Matthew Skala

English-language home page: http://tsukurimashou.osdn.jp/index.html.en
日本語のページが http://tsukurimashou.osdn.jp/index.html.ja

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3.

As a special exception, if you create a document which uses this font, and
embed this font or unaltered portions of this font into the document, this
font does not by itself cause the resulting document to be covered by the
GNU General Public License. This exception does not however invalidate any
other reasons why the document might be covered by the GNU General Public
License. If you modify this font, you may extend this exception to your
version of the font, but you are not obligated to do so. If you do not
wish to do so, delete this exception statement from your version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see http://www.gnu.org/licenses/ .

---------------------------------------------------------------------------

This "font log" records information about the circumstances under which the
enclosing font file was built.  It may be of use for debugging.

EOF

($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$dir,$shell,$expire)=
  getpwuid($<);

print "General information:\n\n";
print "$name\n$comment $gcos\n$dir $shell\n";
print `pwd`;
print `date`;
print `hostname`;
print `hostname --fqdn 2> /dev/null`;
print `uname -a`;
print `grep ' \$ ' config.log | head -1`;

print "\nSelected Makefile variables:\n\n";
open(MAKEFILE,'Makefile');
while (<MAKEFILE>) {
  $echoing=1 if /^ACLOCAL = /;
  $echoing=0 if /nasty hack/;
  print if $echoing;
}
close(MAKEFILE);
