# -*- sh -*-
#
# bob script to build the xtruss tarball.

module xtruss

set Version $(!builddate).$(vcsid)

# use perl to avoid inconsistent behaviour of echo '\v'
in xtruss do perl -e 'print "\n\\versionid xtruss version $$ARGV[0]\n"' $(Version) >> xtruss.but

in xtruss do sed '/AC_INIT/s/6.66/$(Version)/' configure.ac > tmp.ac
in xtruss do mv tmp.ac configure.ac
in xtruss do ./autogen.sh

# Build the man page. This also tests the automake setup to ensure
# configure actually works; but we use a self-delegation (i.e. do all
# of this in a throwaway copy of the build directory) to avoid
# accidentally shipping any outputs of configure. Instead we return
# only the actual man page from the delegation environment.
delegate -
  in xtruss do ./configure
  in xtruss do make doc
  return xtruss/*.1
enddelegate

in . do cp -R xtruss xtruss-$(Version)
in . do tar chzvf xtruss-$(Version).tar.gz xtruss-$(Version)

in xtruss do halibut --html=manpage.html xtruss.but

deliver xtruss-$(Version).tar.gz $@
deliver xtruss/manpage.html $@
