#!/bin/sh # # Copyright (C) 1993, Digital Equipment Corporation # All rights reserved. # See the file COPYRIGHT for a full description. # # Last modified on Mon Nov 1 10:51:59 PST 1993 by kalsow # quake="/ex32/usr/local/bin/quake" template_dir="/ex32/usr/local/lib/m3/pkg/m3build/templates" template="LINUX" build_dir="LINUX" start_dir="." quake_args="" src_ok="0" ship_partial="0" verbose="n" # # parse the command line # while case "$1" in "") break;; -b) shift ; build_dir="$1" ; template="$1" ;; -T) shift ; template_dir="$1" ;; -F) shift ; quake_args="$quake_args $1" ;; -S) src_ok="1" ;; -k) ship_partial="1" ;; -d) shift ; start_dir="$1" ;; -v) verbose="y" ;; -*) quake_args="$quake_args $1" ;; *) echo "m3ship: unrecognized option: " $1 ; exit 1 ;; esac do shift done # # get to the initial directory # cd "$start_dir" start_dir=`pwd` base=`basename "$start_dir"` parent=`cd .. ; pwd` # # move to the directory with derived objects # if [ $src_ok = "0" ] then if [ $base = "src" ] then echo "m3ship: use -S to ship from the 'src' directory" exit 1 elif [ $base = $build_dir ] then package_dir=$parent elif [ -d "$build_dir" ] then package_dir="$start_dir" echo "--- shipping from $build_dir ---" cd "$build_dir" else echo "m3ship: no build directory $build_dir" exit 1 fi else # assume that we're in an immediate subdirectory of the package package_dir="$parent" build_dir="$base" fi package=`basename "$package_dir"` # # check for an overrides file # if [ -r .M3OVERRIDES ] then if [ "$ship_partial" = "0" ] then echo "m3ship: package built with overrides - not shipping" exit 1 fi exit 0 fi # # check for a .M3SHIP file # if [ -r .M3SHIP ] then shipfile="$package_dir/$build_dir/.M3SHIP" else echo "m3ship: cannot locate a .M3SHIP file, run m3build first" exit 1 fi # # prepare for the worst... # # trap 'exit 1' 1 2 3 15 # # finally, evaulate the ship file # if [ x"$verbose" = xy ] then echo "$quake -D_ship -DPACKAGE_DIR=$package_dir -DPACKAGE=$package -DBUILD_DIR=$build_dir $template_dir/$template $quake_args $shipfile" fi if $quake -D_ship -DPACKAGE_DIR=$package_dir -DPACKAGE=$package -DBUILD_DIR=$build_dir $template_dir/$template $quake_args $shipfile then exit 0 else exit 1 fi