Re: build dependencies



In message <Pine.LNX.3.96.981209125354.25401A-100000@atrus.jesus.cam.ac.uk>, Mi
chael Hudson writes:
 ] On Wed, 9 Dec 1998, Jonathan Sergent wrote:
 ] > As we attempt to hash out this humongo ASCII art dependency tree, it 
 ] > occurs to me that it might be easier if we put build-time dependencies 
 ] > at the module level in some form that a build script or Makefile could 
 ] > process.
 ] > 
 ] > Something like a file in each module called .build-deps with
 ] > module-name: other-module other-module other-module
 ] > 
 ] > Just build ordering dependencies, not run-time dependencies, else you
 ] > end up running in circles.
 ] > 
 ] > Thoughts?  If something like this gets into CVS, I will update the top 
 ] > level makefile mess I posted the other day to grok it.
 ] 
 ] This is a very good idea! Might as well call it build-deps, though - you'd
 ] probably want to see it.

Whichever.  Here is a script that can process a file in this format
(it's written for having them all in one file, but that is easy to
change of course).  Just a start of something to play with.  There's
a really dumb (more like a test case) dependency tree in this shar
file too.

tsort does the dirty work of making the fully ordered list from
the partial orderings in the deps file.

When I get a bit more time I will try to look through the makefiles
and configure scripts to find out what the actual build dependencies
are and make a new file.

#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 1998-12-11 01:12 PST by <sergent@kgb.etla.net>.
# Source directory was `/kgb/b/sergent'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#   1166 -rwxr-xr-x resolve-deps
#    835 -rw------- dumb-deps
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
  if test "$gettext_dir" = FAILED && test -f $dir/gettext \
     && ($dir/gettext --version >/dev/null 2>&1)
  then
    set `$dir/gettext --version 2>&1`
    if test "$3" = GNU
    then
      gettext_dir=$dir
    fi
  fi
  if test "$locale_dir" = FAILED && test -f $dir/shar \
     && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
  then
    locale_dir=`$dir/shar --print-text-domain-dir`
  fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
  echo=echo
else
  TEXTDOMAINDIR=$locale_dir
  export TEXTDOMAINDIR
  TEXTDOMAIN=sharutils
  export TEXTDOMAIN
  echo="$gettext_dir/gettext -s"
fi
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
  shar_touch=touch
else
  shar_touch=:
  echo
  $echo 'WARNING: not restoring timestamps.  Consider getting and'
  $echo "installing GNU \`touch', distributed in GNU File Utilities..."
  echo
fi
rm -f 1231235999 $$.touch
#
if mkdir _sh20117; then
  $echo 'x -' 'creating lock directory'
else
  $echo 'failed to create lock directory'
  exit 1
fi
# ============= resolve-deps ==============
if test -f 'resolve-deps' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'resolve-deps' '(file already exists)'
else
shar: Saving resolve-deps (text)
  $echo 'x -' extracting 'resolve-deps' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'resolve-deps' &&
#! /bin/ksh
X
ProcessLines() {
X	while read line; do
X		set -- $line
X
X		if [[ $# = 0 ]]; then
X			continue
X		fi
X
X		typeset tag="$1"
X		tag="${tag%:}"
X
X		if [[ "$1" = "$tag" ]]; then
X			print -u2 "Error: invalid syntax: '$line'"
X			exit 1
X		fi
X
X		shift
X
X		for dep; do
X			print $dep $tag
X		done
X	done
X
X	for module; do
X		print $module $module
X	done
}
X
MakeRegex() {
X	print -n "^("
X
X	[[ -n "$1" ]] && print -n "$1" | sed 's/\+/\\\+/'
X
X	if [[ "$#" -gt 1 ]]; then 
X		shift
X		for x; do print -n "|$x" | sed 's/\+/\\\+/'; done
X	fi
X
X	print -n "):"
}
X
DoRun() {
X	egrep "$(MakeRegex $@)" "$Input" |
X		ProcessLines $@ |
X		tsort
}
X
Straighten() {
X	echo $(echo $* | xargs -n 1 echo | sort | uniq)
}
X
# [[ -n "$DEBUG" ]] && 
# 	set -x && 
# 	typeset -ft ProcessLines MakeRegex DoRun Straighten
X
if [[ $# -lt 2 ]]; then
X	print -u2 "Usage: resolve-deps file module [module ...]"
X	exit 2
fi
X
Input=$1
shift
X
# Start off with direct dependencies of specified modules.
X
Old=""
New=""
Out="$(DoRun "$@")"
New="$(Straighten "$Out")"
X
# Loop until we stop finding more modules.
X
while [[ "$Old" != "$New" ]]; do
X	Old="$New"
X	Out="$(DoRun "$New")"
X	New="$(Straighten "$Out")"
done
X
DoRun "$New"
SHAR_EOF
  $shar_touch -am 1211010898 'resolve-deps' &&
  chmod 0755 'resolve-deps' ||
  $echo 'restore of' 'resolve-deps' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'resolve-deps:' 'MD5 check failed'
7dc70098eef62aed413e186c8a3a3754  resolve-deps
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'resolve-deps'`"
    test 1166 -eq "$shar_count" ||
    $echo 'resolve-deps:' 'original size' '1166,' 'current size' "$shar_count!"
  fi
fi
# ============= dumb-deps ==============
if test -f 'dumb-deps' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'dumb-deps' '(file already exists)'
else
shar: Saving dumb-deps (text)
  $echo 'x -' extracting 'dumb-deps' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'dumb-deps' &&
gtk+: glib
imlib: gtk+
libgtop: glib
gnome-dom: gnome-xml
gnome-xml: gnome-http
gnome-http: glib
ORBit: glib
gtk-engines: gtk+ glib
esound: audiofile
gnome-libs: imlib glib libgtop gnome-http gnome-dom ORBit esound
gnome-objc: gnome-libs
gnome-guile: gnome-libs
gnome-core: gnome-libs gnome-guile gnome-objc
balsa: libPropList gnome-libs ORBit esound
dia: gnome-libs
ee: gnome-libs
gdm: gnome-libs
gedit: gnome-libs
genius: gnome-libs
ggv: gnome-libs
gnome-admin: gnome-libs
gnome-chess: gnome-libs
gnome-games: gnome-libs
gnome-media: gnome-libs
gnome-network: gnome-libs
gnome-pilot: gnome-libs
gnome-print: gnome-libs
gnome-python: gnome-libs
gnome-utils: gnome-libs
gnumeric: gnome-libs
go: gnome-libs
grpm: gnome-libs
gtkicq: gnome-libs
gtop: gnome-libs libgtop 
gwp: gnome-libs
mc: gnome-libs
sane: gnome-libs
yagirc: gnome-libs
SHAR_EOF
  $shar_touch -am 1211010098 'dumb-deps' &&
  chmod 0600 'dumb-deps' ||
  $echo 'restore of' 'dumb-deps' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'dumb-deps:' 'MD5 check failed'
91851bbe257d9b8dc1a0b2d941405598  dumb-deps
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'dumb-deps'`"
    test 835 -eq "$shar_count" ||
    $echo 'dumb-deps:' 'original size' '835,' 'current size' "$shar_count!"
  fi
fi
rm -fr _sh20117
exit 0



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]