view sources/native-builds/bootstrap-skeleton/files/build-one-package.sh @ 1269:7a60afa1846c

More tweaks to bootstrap-skeleton, implement the first half of lfs-bootstrap for Linux From Scratch 6.7 against the new infrastructure, and tweak gentoo build to stay current with bootstrap-skeleton changes. (Now more common infrastructure, and requires package-list file.)
author Rob Landley <rob@landley.net>
date Sun, 24 Oct 2010 04:17:15 -0500
parents c264495fbf21
children
line wrap: on
line source

#!/bin/sh

source /mnt/functions.sh || exit 1

# build $1 using manifest file $2

# Is it already installed?

if [ ! -z "$2" ] && [ -z "$FORCE" ] && grep -q "$1" "$2"
then
  echo "$1 already installed"
  exit 0
fi

set_titlebar "$1"

if [ -d "/mnt/packages/$1" ]
then

  # Snapshot source

  cd /home &&
  rm -rf "/home/$1" &&
  cp -sfR "/mnt/packages/$1" "$1" &&
  cd "$1" || exit 1

  # Lobotomize config.guess so it won't complain about unknown target types.
  # 99% of packages do not care, but autoconf throws a temper tantrum if
  # the version of autoconf that created this back when the package shipped
  # didn't know what a microblaze or hexagon was.  Repeat after me:
  #   "Autoconf is useless"

  for guess in $(find . -name config.guess)
  do
    rm "$guess" &&
    echo -e "#!/bin/sh\ngcc -dumpmachine" > "$guess" || exit 1
  done
  EXT=sh
else
  EXT=nosrc
fi

# Call package build script

if ! time "/mnt/build/${1}.$EXT"
then
  echo "$1" died >&2
  exit 1
fi

# Add file to manifest, removing previous version (if any).

if [ ! -z "$2" ]
then
  sed -i -e "/$1/d" "$2" &&
  echo "$1" >> "$2" || exit 1
fi

if [ -d "/mnt/packages/$1" ]
then

  # Delete copy of source if build succeeded

  cd /home &&
  rm -rf "$1" &&
  sync || exit 1
fi