#! /bin/echo This_file_must_be_sourced,_not_executed # # ---------------------------------------------------------------------- # agen5/bootstrap.dir --- maintainer's bootstrap script # # Author: Bruce Korb # Time-stamp: "2012-04-14 09:39:36 bkorb" ## ## This file is part of AutoGen. ## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved ## ## AutoGen 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, either version 3 of the License, or ## (at your option) any later version. ## ## AutoGen 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 . # ---------------------------------------------------------------------- # # This script rebuilds sources not kept in the GIT repository. # These files are distributed, so it is not necessary to invoke # AutoGen before building AutoGen. # "make" will invoke this file with the name of the desired output # as an argument. We do this here rather than in the make file # because some of the rules are complex and we don't want to # deal with the dual update problem. readonly stamp_list=$(echo "stamp-opts${nl}stamp-proto" sed -n '/^make_[a-z_]*[(]/{;s/^make_/stamp-/;s/[()].*//;p;}' \ ${srcdir}/mk-stamps.sh) set_defaults() { builddir=$(pwd) srcdir=${srcdir:-$builddir} AGexe=$(command -v autogen) CLexe=$(command -v columns) GDexe=$(command -v getdefs) test -x "${AGexe}" -a -x "${GDexe}" -a -x "${CLexe}" || \ die "autogen is required" export builddir srcdir AGexe CLexe GDexe # Make sure we have a default for top build and source. # Some of the templates need this information. # local verdata=$(egrep '^AG_' ${top_srcdir}/VERSION | \ sed 's,^\(AG[^=]*\)\(.*\),\1\2 export \1,') eval "set -a;${verdata};set +a" # disable any $HOME defaults # HOME=/dev/null SHELL=${POSIX_SHELL-/bin/sh} ${VERBOSE:-false} && set -x || : # Ensure complete success or a noticable failure # set -e } assemble_Makefile() { { sed '/# *start-generated-text/q' ${srcdir}/Makefile.am echo echo list_stamps = '\' sflist='' for f in $stamp_list do sflist=${sflist}$f${nl} done printf %s "$sflist" | \ ${CLexe} --spread=1 -I4 --line=' \' echo "if AMDEP" for f in $stamp_list do echo "@am__include@ @am__quote@./\$(DEPDIR)/${f}.d@am__quote@" done echo endif fmt='\n%s:\n\t@target="$(AUTOGEN_%s_TList)" \\\n' fmt=${fmt}'\t$(MAKE_STAMP)\n' for f in $stamp_list do g=$(echo $f | sed 's/[^a-zA-Z0-9]/_/g') printf "$fmt" $f $g done printf '\n# end-generated-text\n# end of Makefile.am\n' } > Makefile.XX if cmp -s Makefile.XX Makefile.am then rm -f Makefile.XX else mv -f Makefile.XX Makefile.am fi } assemble_fmemopen() { fmemdir=~bkorb/tools/mine/lib/fmemopen test -f ${fmemdir}/fmemopen.c || return test -f agen5/fmemopen.c && rm -f agen5/fmemopen.c { echo '#if defined(ENABLE_FMEMOPEN)' echo '#include ' echo sed -n '/^typedef enum/,/_IOWR(/p' ${fmemdir}/libfmem.h sed -e '/^#if defined(HAVE_FOPENCOOKIE)/p' \ -e '/=--subblock/,/^#if defined(HAVE_FOPENCOOKIE)/d' \ -e "s% @file .*% @file $(realpath ${fmemdir}/fmemopen.c)%" \ ${fmemdir}/fmemopen.c echo '#endif /* ENABLE_FMEMOPEN */' } > fmemopen.c } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # M A I N # PS4='>bsag-${FUNCNAME}> ' set_defaults ${1+"$@"} DEPDIR= . ${srcdir}/mk-stamps.sh $stamp_list assemble_fmemopen assemble_Makefile # IF we symlinked in columns or getdefs, # THEN it is time to unlink them # test -z "$rmlist" || rm -f $rmlist # Local Variables: # mode:shell-script # sh-indentation:4 # sh-basic-offset:4 # indent-tabs-mode: nil # End: # end of agen5/bootstrap.dir