[llvm-commits] [llvm-top] r40086 - in /llvm-top/trunk: build clean get install library.sh
Reid Spencer
rspencer at reidspencer.com
Fri Jul 20 01:25:28 PDT 2007
Author: reid
Date: Fri Jul 20 03:25:28 2007
New Revision: 40086
URL: http://llvm.org/viewvc/llvm-project?rev=40086&view=rev
Log:
Simplification changes:
1. All scripts use process_arguments to process arguments
2. Don't try to differentiate build modifiers (pass them down, valid or not)
3. Support passing VERBOSE down.
4. Support a DESTDIR variable.
5. Default installation place is now $LLVM_TOP/installed.
6. Add two scripts: clean and install, with the obvious actions.
7. Put build_a_module in the library so it can be used by "install"
Added:
llvm-top/trunk/install (with props)
Modified:
llvm-top/trunk/build
llvm-top/trunk/clean
llvm-top/trunk/get
llvm-top/trunk/library.sh
Modified: llvm-top/trunk/build
URL: http://llvm.org/viewvc/llvm-project/llvm-top/trunk/build?rev=40086&r1=40085&r2=40086&view=diff
==============================================================================
--- llvm-top/trunk/build (original)
+++ llvm-top/trunk/build Fri Jul 20 03:25:28 2007
@@ -28,49 +28,23 @@
# Process the arguments so that anything starting with - is passed down to the
# configure scripts while anything else is a module name. Collect the arguments
# in appropriate variables for later use.
-for arg in "$@" ; do
- case "$arg" in
- VERBOSE=*)
- VERBOSE=`echo "$VERBOSE" | sed -e 's/VERBOSE=//'`
- ;;
- -*)
- BUILD_OPTS="$BUILD_ARGS $arg"
- ;;
- *=*)
- BUILD_PARAMS="$BUILD_PARAMS $arg"
- ;;
- *)
- MODULE_NAMES="$MODULE_NAMES $arg"
- esac
-done
+msg 2 "Checking out dependencies"
+process_arguments "$@"
# Get (and possibly check out) the set of modules and their dependencies. This
# sets the MODULE_DEPENDENCIES variable to the set of module names that should
# be configured, in the correct order (least dependent first, no duplicates).
msg 1 "Checking out dependencies"
-MODULE_DEPENDENCIES=""
-get_module_dependencies $MODULE_NAMES
+get_module_dependencies $MODULES
+
+# Build a list of the static build options we'll pass to the modules
+build_args="LLVM_TOP=$LLVM_TOP PREFIX=$PREFIX DESTDIR=$DESTDIR VERBOSE=$VERBOSE"
+build_args="$build_args $OPTIONS_DASH $OPTIONS_DASH_DASH $OPTIONS_ASSIGN"
-build_a_module() {
- module="$1"
- get_module_info $module BuildCmd
- if test -z "$MODULE_INFO_VALUE" ; then
- msg 0 "Module $module has no BuildCmd entry so it will not be built."
- return 0
- fi
- build_command="$MODULE_INFO_VALUE"
- build_command="$build_command $BUILD_OPTS"
- build_command="$build_command MODULE="$module" LLVM_TOP=$LLVM_TOP "
- build_command="$build_command PREFIX=$INSTALL_PREFIX $BUILD_PARAMS"
- msg 1 "Building Module $module with this command:"
- msg 1 " $build_command"
- cd $module
- $build_command || die $? "Can't build $module"
- cd $LLVM_TOP
-}
# Now that we have a list of dependent modules, we must configure each of them
# according to the specifications of the module.
for mod in $MODULE_DEPENDENCIES ; do
+ msg 1 "Building module $mod"
build_a_module "$mod"
done
Modified: llvm-top/trunk/clean
URL: http://llvm.org/viewvc/llvm-project/llvm-top/trunk/clean?rev=40086&r1=40085&r2=40086&view=diff
==============================================================================
--- llvm-top/trunk/clean (original)
+++ llvm-top/trunk/clean Fri Jul 20 03:25:28 2007
@@ -12,18 +12,10 @@
. ./library.sh
-# Get the list of modules. Either everything checked out or the list passed in.
-if test -z "$*" ; then
- MODULES=""
- for modinfo in */ModuleInfo.txt ; do
- mod=`dirname $modinfo`
- mod=`basename $modinfo`
- MODULES="$mod $MODULES"
- done
-else
- MODULES="$*"
-fi
+# Get the list of modules.
+process_arguments "$@"
+# Get the
get_module_dependencies $MODULES
for mod in $MODULE_DEPENDENCIES ; do
@@ -31,9 +23,8 @@
if test ! -z "$MODULE_INFO_VALUE" ; then
msg 0 Cleaning module $mod
cd $mod
- $MODULE_INFO_VALUE
- cd ..
+ $MODULE_INFO_VALUE || die $? "Clean of module $mod failed."
else
- msg 0 Module $mod has no CleanCmd
+ msg 0 Module $mod has no CleanCmd in the ModuleInfo.txt
fi
done
Modified: llvm-top/trunk/get
URL: http://llvm.org/viewvc/llvm-project/llvm-top/trunk/get?rev=40086&r1=40085&r2=40086&view=diff
==============================================================================
--- llvm-top/trunk/get (original)
+++ llvm-top/trunk/get Fri Jul 20 03:25:28 2007
@@ -10,9 +10,11 @@
# of the modules on the command line.
. ./library.sh
+# Get the list of modules
+process_arguments "$@"
+
# Getting the module dependencies also causes them to be checked out.
-MODULE_DEPENDENCIES=""
-get_module_dependencies "$@"
+get_module_dependencies $MODULES
# Report what happened.
-msg 0 Modules checked out:"$MODULE_DEPENDENCIES".
+msg 0 Got: "$MODULE_DEPENDENCIES".
Added: llvm-top/trunk/install
URL: http://llvm.org/viewvc/llvm-project/llvm-top/trunk/install?rev=40086&view=auto
==============================================================================
--- llvm-top/trunk/install (added)
+++ llvm-top/trunk/install Fri Jul 20 03:25:28 2007
@@ -0,0 +1,33 @@
+#!/bin/sh
+# install script
+#
+# This file was developed by Reid Spencer and is distributed under the
+# University of Illinois Open Source License. See LICENSE.TXT for details.
+#
+#===------------------------------------------------------------------------===#
+
+# This script allows easier installing of LLVM modules. Just specify the names
+# of the modules on the command line and they and their dependencies will be
+# checked out, built and installed. Use INSTALL_PREFIX= to process
+
+. ./library.sh
+
+# Get the list of modules to install.
+process_arguments "$@"
+
+# Now find out what those modules depend on
+get_module_dependencies $MODULES
+
+# Now go run the install command for each of those modules, which are nicely
+# sorted in dependence order by get_module_dependencies
+for mod in $MODULE_DEPENDENCIES ; do
+ get_module_info $mod InstallCmd
+ if test ! -z "$MODULE_INFO_VALUE" ; then
+ msg 0 Installing module $mod
+ cd $mod
+ $MODULE_INFO_VALUE || die $? "Install of module $mod failed."
+ cd $LLVM_TOP
+ else
+ msg 0 Module $mod has no InstallCmd in the ModuleInfo.txt
+ fi
+done
Propchange: llvm-top/trunk/install
------------------------------------------------------------------------------
svn:executable = *
Modified: llvm-top/trunk/library.sh
URL: http://llvm.org/viewvc/llvm-project/llvm-top/trunk/library.sh?rev=40086&r1=40085&r2=40086&view=diff
==============================================================================
--- llvm-top/trunk/library.sh (original)
+++ llvm-top/trunk/library.sh Fri Jul 20 03:25:28 2007
@@ -15,14 +15,15 @@
# Get the llvm-top directory before anyone has a chance to cd out of it
LLVM_TOP=`pwd`
-INSTALL_PREFIX="$LLVM_TOP/install"
+PREFIX="$LLVM_TOP/installed"
+DESTDIR=
# A command to figure out the root of the SVN repository by asking for it from
# the 'svn info' command. To use, execute it in a script with something like
-SVNROOT=`$SVN info . | grep 'pository Root:' | sed -e 's/^Repository Root: //'`
+SVNROOT=`$SVN info . | grep 'Repository Root:' |sed -e 's/^Repository Root: //'`
-# Set this to true (after sourcing this library) if you want verbose
-# output from the library
+# Set this to non-zero (after sourcing this library) if you want verbose
+# output from the library. The higher the value, the more output you get
VERBOSE=0
# Generate an informative message to the user based on the verbosity level
@@ -30,7 +31,7 @@
level=$1
shift
if test "$level" -le "$VERBOSE" ; then
- echo "INFO-$level: $*"
+ echo "TOP-$level: $*"
fi
}
@@ -38,10 +39,37 @@
die() {
EXIT_CODE=$1
shift
- echo "ERROR-$EXIT_CODE: $*"
+ echo "TOP-$EXIT_CODE: Error: $*"
exit $EXIT_CODE
}
+process_arguments() {
+ for arg in "$@" ; do
+ case "$arg" in
+ LLVM_TOP=*) LLVM_TOP=`echo "$arg" | sed -e 's/LLVM_TOP=//'` ;;
+ PREFIX=*) PREFIX=`echo "$arg" | sed -e 's/PREFIX=//'` ;;
+ DESTDIR=*) DESTDIR=`echo "$arg" | sed -e 's/DESTDIR=//'` ;;
+ MODULE=*) MODULE=`echo "$arg" | sed -e 's/MODULE=//'` ;;
+ VERBOSE=*) VERBOSE=`echo "$arg" | sed -e 's/VERBOSE=//'` ;;
+ --*) OPTIONS_DASH_DASH="$OPTIONS_DASH_DASH $arg" ;;
+ -*) OPTIONS_DASH="$OPTIONS_DASH $arg" ;;
+ *=*) OPTIONS_ASSIGN="$OPTIONS_ASSIGN $arg" ;;
+ [a-zA-Z]*) MODULES="$MODULES $arg" ;;
+ *) die 1 "Unrecognized option: $arg" ;;
+ esac
+ done
+
+ # An empty modules list means "the checked out modules" so gather that list
+ # now if we didn't get any modules on the command line.
+ if test -z "$MODULES" ; then
+ MODULES=""
+ for modinfo in */ModuleInfo.txt ; do
+ mod=`dirname $modinfo`
+ mod=`basename $modinfo`
+ MODULES="$mod $MODULES"
+ done
+ fi
+}
# Check out a single module.
checkout_a_module() {
@@ -55,7 +83,7 @@
return 0
fi
msg 1 "Checking out module $module"
- if test "$module" == "llvm-gcc-4.0" ; then
+ if test "$module" = "llvm-gcc-4.0" ; then
$SVN checkout svn://anonsvn.opensource.apple.com/svn/llvm/trunk $module ||
die $? "Checkout of module $module failed."
else
@@ -99,7 +127,7 @@
if test ! -z "$MODULE_INFO_VALUE" ; then
msg 1 "Module '$module' depends on $MODULE_INFO_VALUE"
deps=`get_module_dependencies $MODULE_INFO_VALUE` || \
- die $? "get_dependencies failed"
+ die $? "get_module_dependencies failed"
for dep in $MODULE_INFO_VALUE ; do
matching=`echo "$MODULE_DEPENDENCIES" | grep "$dep"`
if test -z "$matching" ; then
@@ -115,32 +143,19 @@
return 0
}
-process_builder_args() {
- for arg in "$@" ; do
- case "$arg" in
- LLVM_TOP=*) LLVM_TOP=`echo "$arg" | sed -e 's/LLVM_TOP=//'` ;;
- PREFIX=*) PREFIX=`echo "$arg" | sed -e 's/PREFIX=//'` ;;
- MODULE=*) MODULE=`echo "$arg" | sed -e 's/MODULE=//'` ;;
- ENABLE_PIC=*)
- ENABLE_PIC=`echo "$arg" | sed -e 's/ENABLE_PIC=//'`
- OPTIONS_ASSIGN="$OPTIONS_ASSIGN $arg"
- ;;
- ENABLE_OPTIMIZED=*)
- ENABLE_OPTIMIZED=`echo "$arg" | sed -e 's/ENABLE_OPTIMIZED=//'`
- OPTIONS_ASSIGN="$OPTIONS_ASSIGN $arg"
- ;;
- ENABLE_PROFILING=*)
- ENABLE_PROFILING=`echo "$arg" | sed -e 's/ENABLE_PROFILING=//'`
- OPTIONS_ASSIGN="$OPTIONS_ASSIGN $arg"
- ;;
- ENABLE_EXPENSIVE_CHECKS=*)
- ENABLE_EXPENSIVE_CHECKS=`echo "$arg" | sed -e 's/ENABLE_EXPENSIVE_CHECKS=//'`
- OPTIONS_ASSIGN="$OPTIONS_ASSIGN $arg"
- ;;
- --*) OPTIONS_DASH_DASH="$OPTIONS_DASH_DASH $arg" ;;
- -*) OPTIONS_DASH="$OPTIONS_DASH $arg" ;;
- *=*) OPTIONS_ASSIGN="$OPTIONS_ASSIGN $arg" ;;
- *) die 1 "Unrecognized option: $arg" ;;
- esac
- done
+build_a_module() {
+ module="$1"
+ msg 2 "Getting module info for $module"
+ get_module_info $module BuildCmd
+ if test -z "$MODULE_INFO_VALUE" ; then
+ msg 0 "Module $module has no BuildCmd entry so it will not be built."
+ return 0
+ fi
+ build_cmd="$MODULE_INFO_VALUE MODULE=$module $build_args"
+ msg 1 "Building Module $module with this command:"
+ msg 1 " $build_cmd"
+ cd $module
+ $build_cmd || die $? "Build of $module failed."
+ cd $LLVM_TOP
}
+
More information about the llvm-commits
mailing list