diff options
author | Mathias Preiner <mathias.preiner@gmail.com> | 2018-10-19 14:45:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-19 14:45:42 -0700 |
commit | ce8c429281fd1f7e4ac4d2b7133152c1d370df0c (patch) | |
tree | 407400e728621cc9a5262e7112a93bd6acd0835a /contrib | |
parent | 7de0540252b62080ee9f98617f5718cb1ae08579 (diff) |
Remove autotools build system. (#2639)
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/Makefile.am | 36 | ||||
-rwxr-xr-x | contrib/addsourcedir | 94 | ||||
-rwxr-xr-x | contrib/code-checker | 96 | ||||
-rwxr-xr-x | contrib/configure-in-place | 30 | ||||
-rw-r--r-- | contrib/editing-with-emacs | 18 | ||||
-rwxr-xr-x | contrib/extract-strings-and-comments | 52 | ||||
-rwxr-xr-x | contrib/get-abc | 2 | ||||
-rwxr-xr-x | contrib/get-antlr-3.4 | 25 | ||||
-rwxr-xr-x | contrib/get-cadical | 2 | ||||
-rwxr-xr-x | contrib/get-cryptominisat | 2 | ||||
-rwxr-xr-x | contrib/get-glpk-cut-log | 2 | ||||
-rwxr-xr-x | contrib/get-lfsc-checker | 2 | ||||
-rwxr-xr-x | contrib/get-symfpu | 2 | ||||
-rw-r--r-- | contrib/indent-settings | 1 | ||||
-rwxr-xr-x | contrib/mac-build | 56 | ||||
-rwxr-xr-x | contrib/make_devel_video.sh | 10 | ||||
-rwxr-xr-x | contrib/my-configure | 12 | ||||
-rwxr-xr-x | contrib/switch-config | 96 |
18 files changed, 20 insertions, 518 deletions
diff --git a/contrib/Makefile.am b/contrib/Makefile.am deleted file mode 100644 index 4d61e88f4..000000000 --- a/contrib/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -EXTRA_DIST = \ - README \ - cvc-devel.el \ - dimacs_to_smt.pl \ - switch-config \ - cvc-mode.el \ - editing-with-emacs \ - luby.c \ - addsourcedir \ - new-theory \ - configure-in-place \ - depgraph \ - get-abc \ - get-antlr-3.4 \ - get-cadical \ - get-cryptominisat \ - get-glpk-cut-log \ - get-lfsc-checker \ - get-script-header.sh \ - get-symfpu \ - get-win-dependencies \ - mac-build \ - run-script-smtcomp2014 \ - run-script-cascj7-fnt \ - run-script-cascj7-fof \ - run-script-cascj7-tff \ - theoryskel/kinds \ - theoryskel/README.WHATS-NEXT \ - theoryskel/theory_DIR.cpp \ - theoryskel/theory_DIR.h \ - theoryskel/theory_DIR_rewriter.h \ - theoryskel/theory_DIR_type_rules.h - alttheoryskel/kinds \ - alttheoryskel/README.WHATS-NEXT \ - alttheoryskel/theory_DIR.cpp \ - alttheoryskel/theory_DIR.h diff --git a/contrib/addsourcedir b/contrib/addsourcedir deleted file mode 100755 index 431ec1d90..000000000 --- a/contrib/addsourcedir +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/sh -# -# addsourcedir -# Morgan Deters <mdeters@cs.nyu.edu> for the CVC4 project -# Copyright (c) 2010, 2011 The CVC4 Project -# -# usage: addsourcedir paths... -# - -progname=`basename "$0"` -cd `dirname "$0"`/.. - -if [ $# -lt 1 ]; then - echo >&2 - echo "usage: $progname paths..." >&2 - echo >&2 - echo "Each path should be relative to the top-level source directory, e.g.:" >&2 - echo >&2 - echo " $progname src/expr" >&2 - echo >&2 - exit 1 -fi - -while [ $# -gt 0 ]; do - srcdir="$1"; shift - - # remove trailing slashes, if any - srcdir=`expr "$srcdir" : '\(.*[^/]\)/*$'` - # remove redundant slashes, if any - srcdir=`echo "$srcdir" | sed 's,//*,/,g'` - - if expr "$srcdir" : src/ >/dev/null; then :; else - echo "$progname: error: Directories must be under src/" >&2 - echo "$progname: error: and \`$srcdir' isn't!" >&2 - echo "$progname: error: Make sure you provide source paths" >&2 - echo "$progname: error: relative to the top level, e.g. \`src/expr'." >&2 - exit 1 - fi - - if [ -d "$srcdir" ]; then :; else - echo "creating directory \`$srcdir'..." - mkdir -p "$srcdir" - fi - - # enough dotdots to get us back to the top-level directory - # (e.g. "src/foo" yields "../.." here), used for $(topdir) in Makefile - topdir=`echo "$srcdir" | sed 's,[^/][^/]*,..,g'` - # one less, used for the include path in Makefile.am - topsrcdir=`echo "$topdir" | sed 's,\.\./,,'` - - if [ -e "$srcdir/Makefile" ]; then - echo "$progname: warning: not replacing extant \`$srcdir/Makefile'." >&2 - else - echo "generating \`$srcdir/Makefile'..." - cat >"$srcdir/Makefile" <<EOF -topdir = $topdir -srcdir = $srcdir - -include \$(topdir)/Makefile.subdir -EOF - fi - - if [ -e "$srcdir/Makefile.am" ]; then - echo "$progname: warning: not replacing extant \`$srcdir/Makefile.am'." >&2 - else - echo "generating \`$srcdir/Makefile.am'..." - clibbase=`expr "$srcdir" : '.*/\([^/][^/]*\)$'` - if expr "$srcdir" : src/parser >/dev/null; then - definitions=" -D__BUILDING_CVC4PARSERLIB \\ -" - visibility=' $(FLAG_VISIBILITY_HIDDEN)' - elif expr "$srcdir" : src/main >/dev/null; then - definitions= - visibility= - else - definitions=" -D__BUILDING_CVC4LIB \\ -" - visibility=' $(FLAG_VISIBILITY_HIDDEN)' - fi - clibname="lib${clibbase}.la" - clibtarget="lib${clibbase}_la" - cat >"$srcdir/Makefile.am" <<EOF -AM_CPPFLAGS = \\ -$definitions -I@srcdir@/$topsrcdir/include -I@srcdir@/$topsrcdir -I@builddir@/$topsrcdir -AM_CXXFLAGS = -Wall$visibility - -noinst_LTLIBRARIES = $clibname - -${clibtarget}_SOURCES = \\ - SOURCEFILE.cpp -EOF - fi -done - diff --git a/contrib/code-checker b/contrib/code-checker deleted file mode 100755 index a40dc61af..000000000 --- a/contrib/code-checker +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -while($#ARGV >= 0) { - my %FP; - my $file = shift @ARGV; - - local $/ = undef; - - open(FP, $file) || die "can't read $file"; - print "checking $file...\n"; - binmode FP; - my $buf = <FP>; - close FP; - - print "file named incorrectly; use *.h: $file\n" if $file =~ /\.(hpp|H|hh)$/; - print "file named incorrectly; use *.cpp: $file\n" if $file =~ /\.(C|cc)$/; - if($file =~ /\.(h|hpp|H)$/) { - check_as_header($buf); - } elsif($file =~ /\.(h|cpp|C)$/) { - check_as_source($buf); - } else { - die "$file not checked (unknown type of file)"; - } - open(FP, "cpp -nostdinc \"$file\" 2>/dev/null |") || die "can't cpp $file"; - binmode FP; - $buf = <FP>; - close FP; - - if($file =~ /\.(h|hpp|H)$/) { - check_as_header_cpp($buf); - } elsif($file =~ /\.(h|cpp|C)$/) { - check_as_source_cpp($buf); - } else { - die "$file not checked (unknown type of file)"; - } -} - -sub check_as_any { - my($buf) = @_; - - print "no file head comment\n" unless $buf =~ m,^/*\*\*\*,; -} - -sub check_as_header { - my($buf) = @_; - check_as_any($buf); -} - -sub check_as_source { - my($buf) = @_; - check_as_any($buf); -} - -sub check_as_any_cpp { - my($buf) = @_; - - print "need space between tokens ) and {\n" if $buf =~ /\)\{/; - print "need space between tokens 'const' and {\n" if $buf =~ /\bconst\{/; - print "need space between tokens ) and 'const'\n" if $buf =~ /\)const\b/; - print "need space between tokens 'template' and <\n" if $buf =~ /\btemplate</; - print "need space between tokens } and 'else'\n" if $buf =~ /\}else\b/; - print "need space between tokens 'else' and {\n" if $buf =~ /\belse\{/; - print "need space between tokens 'do' and {\n" if $buf =~ /\bdo\{/; - print "need space between tokens } and 'while'\n" if $buf =~ /\}while\b/; - - print "no space permitted before ;\n" if $buf =~ /\s+;/; - print "no space permitted between tokens 'if' and (\n" if $buf =~ /\bif\s\(/; - print "no space permitted between tokens 'while' and (\n" if $buf =~ /\bwhile\s\(/; - print "no space permitted between tokens 'for' and (\n" if $buf =~ /\bfor\s\(/; - - my $code = $buf; - $code =~ s,\\.,.,g; - $code =~ s,"[^"]*","",g; - - #print "'if' blocks must be braced, '{' should be last character on block opening line\n" if $code =~ /\bif\b.*[^{]\s*$/m; - #print "'while' blocks must be braced, '{' should be last character on block opening line\n" if $code =~ /\bwhile\b.*[^{]\s*$/m; - #print "'for' blocks must be braced, '{' should be last character on block opening line\n" if $code =~ /\bfor\b.*[^{]\s*$/m; - print "'else' cannot start a line (should follow preceding '}')\n" if $code =~ /^\s+else\b/m; -} - -sub check_as_header_cpp { - my($buf) = @_; - check_as_any_cpp($buf); -} - -sub check_as_source_cpp { - my($buf) = @_; - check_as_any_cpp($buf); -} - -## Local Variables: -## perl-indent-level: 2 -## perl-brace-offset: 0 -## End: diff --git a/contrib/configure-in-place b/contrib/configure-in-place deleted file mode 100755 index cc0e9e387..000000000 --- a/contrib/configure-in-place +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -ex -# -# configure-in-place -# Morgan Deters <mdeters@cs.nyu.edu> for CVC4 -# Copyright (c) 2010-2014 The CVC4 Project -# -# usage: configure-in-place [ arguments... ] -# -# This script configures CVC4 in the source directory (from where it -# should be invoked). -# - -if [ -e .git ] && ! [ x"$1" = x-f ]; then - echo - echo "DO NOT USE THIS IN GIT WORKING DIRECTORIES!" - echo - echo "You might accidentally commit Makefiles in the source directories" - echo "improperly, since they exist in the source directory for" - echo "another purpose." - echo - exit 1 -fi - -if [ x"$1" = x-f ]; then - shift -fi - -./configure "$@" -CURRENT_BUILD="$(grep '^CURRENT_BUILD *= *' builds/current | awk 'BEGIN {FS=" *= *"} {print$2}')" -builds/$CURRENT_BUILD/config.status diff --git a/contrib/editing-with-emacs b/contrib/editing-with-emacs deleted file mode 100644 index 529e4fadc..000000000 --- a/contrib/editing-with-emacs +++ /dev/null @@ -1,18 +0,0 @@ -To match the CVC4 coding style, drop the following in your ~/.emacs, -replacing "/home/mdeters/cvc4.*" in the last line with a regexp -describing your usual cvc4 editing location(s): - - -; CVC4 mode -(defun cvc4-c++-editing-mode () - "C++ mode with adjusted defaults for use with editing CVC4 code." - (interactive) - (message "CVC4 variant of C++ mode activated.") - (c++-mode) - (setq c-basic-offset 2) - (c-set-offset 'innamespace 0) - (setq indent-tabs-mode nil)) -(setq auto-mode-alist (cons '("/home/mdeters/cvc4.*/.*\\.\\(cc\\|cpp\\|h\\|hh\\|hpp\\|y\\|yy\\|ypp\\|lex\\|l\\|ll\\|lpp\\)\\(\\.in\\)?$" . cvc4-c++-editing-mode) auto-mode-alist)) - - --- Morgan Deters <mdeters@cs.nyu.edu> Mon, 27 Sep 2010 17:35:38 -0400 diff --git a/contrib/extract-strings-and-comments b/contrib/extract-strings-and-comments deleted file mode 100755 index a6670c1e9..000000000 --- a/contrib/extract-strings-and-comments +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/perl -0777 - -my $debug = 0; - -$_ = <>; -my $comments = ""; -my $code = ""; - -# ignore strings and comments appearing in preprocessor directives -s/^#.*//mg; - -for(;;) { - s,^([^"/]+),,; - $code .= "$1\n"; - - if(m,^([^"]*)"",) { - s,^([^"]*)"",,s; - $code .= "$1\n"; - next; - } - if(m,^([^"]*)"([^"]*)",) { - s,^([^"]*)"(([^\\"]*?([^\\"]|(\\.)))+)",,s; - print STDERR "quote: $2\n" if $debug; - $code .= "$1\n"; - $comments .= "$2\n"; - next; - } - if(m,/\*.*?\*/,) { - s,/\*(.*?)\*/,,s; - print STDERR "c-style comment: $1\n" if $debug; - $comments .= "$1\n"; - print STDERR "REMAINDER:\n===========================\n$_\n=========================\n" if $debug; - next; - } - if(m,//,) { - s,//([^\n]*),,s; - print STDERR "c++-style comment: $1\n" if $debug; - $comments .= "$1\n"; - print STDERR "REMAINDER:\n===========================\n$_\n=========================\n" if $debug; - next; - } - last; -} - -$code .= "$_\n"; -$code =~ s,\W+,\n,g; -$code =~ s,^,@,gm; -print "$code\n"; - -$comments =~ s,^,^,gm; -print "$comments\n"; - diff --git a/contrib/get-abc b/contrib/get-abc index 217cbfdf8..fa90f240f 100755 --- a/contrib/get-abc +++ b/contrib/get-abc @@ -33,4 +33,4 @@ make -j$(nproc) libabc.a OPTFLAGS='-O -fPIC' ABC_USE_NO_READLINE=1 ABC_USE_NO_PT echo echo ===================== Now configure CVC4 with ===================== -echo ./configure --with-abc --with-abc-dir=`pwd` +echo ./configure.sh --abc diff --git a/contrib/get-antlr-3.4 b/contrib/get-antlr-3.4 index 16adf9108..b2b722ebb 100755 --- a/contrib/get-antlr-3.4 +++ b/contrib/get-antlr-3.4 @@ -1,18 +1,21 @@ #!/bin/bash # source "$(dirname "$0")/get-script-header.sh" +ANTLR_HOME_DIR=antlr-3.4 if [ -z "${BUILD_TYPE}" ]; then BUILD_TYPE="--disable-shared --enable-static" fi if [ -z "${MACHINE_TYPE}" ]; then - if ! [ -e config/config.guess ]; then + CONFIG_GUESS_SCRIPT=$ANTLR_HOME_DIR/config.guess + if ! [ -e ${CONFIG_GUESS_SCRIPT} ]; then + mkdir -p $ANTLR_HOME_DIR # Attempt to download once - webget 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' config/config.guess - if [ -e config/config.guess ]; then - chmod +x config/config.guess - else + webget 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' $CONFIG_GUESS_SCRIPT + if [ -e $CONFIG_GUESS_SCRIPT ]; then + chmod +x $CONFIG_GUESS_SCRIPT + else echo "$(basename $0): I need the file config/config.guess to tell MACHINE_TYPE" >&2 echo "Try running ./autogen.sh, or set the MACHINE_TYPE environment variable" >&2 echo "(e.g., \"export MACHINE_TYPE=x86_64\")." >&2 @@ -20,14 +23,14 @@ if [ -z "${MACHINE_TYPE}" ]; then fi fi # get first nibble from config.guess (x86_64, i686, ...) - MACHINE_TYPE=`config/config.guess | sed 's,-.*,,'` + MACHINE_TYPE=$(${CONFIG_GUESS_SCRIPT} | sed 's,-.*,,') fi set -x -mkdir -p antlr-3.4/share/java -mkdir -p antlr-3.4/bin -mkdir -p antlr-3.4/src -cd antlr-3.4 +mkdir -p $ANTLR_HOME_DIR/share/java +mkdir -p $ANTLR_HOME_DIR/bin +mkdir -p $ANTLR_HOME_DIR/src +cd $ANTLR_HOME_DIR || exit 1 webget http://www.antlr3.org/download/antlr-3.4-complete.jar share/java/antlr-3.4-complete.jar webget http://www.antlr3.org/download/C/libantlr3c-3.4.tar.gz src/libantlr3c-3.4.tar.gz tee bin/antlr3 <<EOF @@ -111,4 +114,4 @@ fi echo echo ===================== Now configure CVC4 with ===================== -echo ./configure +echo ./configure.sh diff --git a/contrib/get-cadical b/contrib/get-cadical index a4be17d51..359afaaa7 100755 --- a/contrib/get-cadical +++ b/contrib/get-cadical @@ -19,4 +19,4 @@ echo echo "Using CaDiCaL commit $commit" echo echo ===================== Now configure CVC4 with ===================== -echo ./configure --with-cadical +echo ./configure.sh --cadical diff --git a/contrib/get-cryptominisat b/contrib/get-cryptominisat index ff4bff81c..39fc22044 100755 --- a/contrib/get-cryptominisat +++ b/contrib/get-cryptominisat @@ -33,4 +33,4 @@ cd ../ echo echo ===================== Now configure CVC4 with ===================== -echo ./configure --with-cryptominisat +echo ./configure.sh --cryptominisat diff --git a/contrib/get-glpk-cut-log b/contrib/get-glpk-cut-log index 419fdba90..dcd5aac00 100755 --- a/contrib/get-glpk-cut-log +++ b/contrib/get-glpk-cut-log @@ -31,4 +31,4 @@ cd .. echo echo ===================== Now configure CVC4 with ===================== -echo ./configure --enable-gpl --with-glpk --with-glpk-dir=`pwd` +echo ./configure.sh --gpl --glpk diff --git a/contrib/get-lfsc-checker b/contrib/get-lfsc-checker index f4c79de2a..2fc191707 100755 --- a/contrib/get-lfsc-checker +++ b/contrib/get-lfsc-checker @@ -35,4 +35,4 @@ cd .. echo echo ===================== Now configure CVC4 with ===================== -echo ./configure --with-lfsc +echo ./configure.sh --lfsc diff --git a/contrib/get-symfpu b/contrib/get-symfpu index ed49e3638..705e9d873 100755 --- a/contrib/get-symfpu +++ b/contrib/get-symfpu @@ -21,4 +21,4 @@ echo echo "Using symfpu commit $commit" echo echo ===================== Now configure CVC4 with ===================== -echo ./configure --with-symfpu +echo ./configure.sh --symfpu diff --git a/contrib/indent-settings b/contrib/indent-settings deleted file mode 100644 index 41637fd42..000000000 --- a/contrib/indent-settings +++ /dev/null @@ -1 +0,0 @@ -indent -l 80 -lc 80 -lps -bli 2 -bbo -nbbb -bap -bad -br -brf -brs -cbi 1 -ce -cdw -cli 0 -hnl -i 2 -il 0 -lp -ci 0 -nut -ss -npro -npcs -nprs -npsl -nsaf -nsai -nsaw -sc -cd0 -dj0 diff --git a/contrib/mac-build b/contrib/mac-build deleted file mode 100755 index e45cd0fad..000000000 --- a/contrib/mac-build +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -# -# mac-build script -# Morgan Deters <mdeters@cs.nyu.edu> -# Tue, 25 Sep 2012 15:44:27 -0400 -# - -macports_prereq="autoconf automake boost gmp gtime libtool readline" - -export PATH="/opt/local/bin:$PATH" - -if [ $# -ne 0 ]; then - echo "usage: `basename $0`" >&2 - echo >&2 - echo "This script attempts to set up the build requirements for CVC4 for Mac OS X." >&2 - echo "MacPorts must be installed (but this script installs prerequisite port" >&2 - echo "packages for CVC4). If this script is successful, it prints a configure" >&2 - echo "line that you can use to configure CVC4." >&2 - exit 1 -fi - -function reporterror { - echo - echo ============================================================================= - echo - echo "There was an error setting up the prerequisites. Look above for details." - echo - exit 1 -} - -echo ============================================================================= -echo -echo "running: sudo port install $macports_prereq" -if which port &>/dev/null; then - echo "You may be asked for your password to install these packages." - echo - sudo port install $macports_prereq || reporterror -else - echo - echo "ERROR: You must have MacPorts installed for Mac builds of CVC4." - echo "ERROR: See http://www.macports.org/" - reporterror -fi -echo -echo ============================================================================= -echo -contrib/get-antlr-3.4 | grep -v 'Now configure CVC4 with' | grep -v '\./configure --with-antlr-dir=' -[ ${PIPESTATUS[0]} -eq 0 ] || reporterror -echo -echo ============================================================================= -echo -echo 'Now just run:' -echo ' ./configure LDFLAGS=-L/opt/local/lib CPPFLAGS=-I/opt/local/include --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3' -echo ' make' -echo -echo ============================================================================= diff --git a/contrib/make_devel_video.sh b/contrib/make_devel_video.sh deleted file mode 100755 index 00eb9094c..000000000 --- a/contrib/make_devel_video.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# get the svn log -svn log -r 1:HEAD --xml --verbose --quiet > cvc4-log.xml - -# run gource into ffmeg (first pass) -gource --key --max-file-lag -1 -i 0 --max-files 0 --hide progress -1280x720 --user-scale 1.5 --camera-mode track --title "cvc4 trunk" -s 0.5 -r 25 --date-format "%B %d, %Y" cvc4-log.xml -o - | ffmpeg -y -r 25 -f image2pipe -vcodec ppm -i - -vcodec libx264 -vpre ultrafast_firstpass -crf 1 -threads 0 -bf 0 -s 640x360 cvc4-640x360.mp4 - -# run gource into ffmeg (second pass) -gource --key --max-file-lag -1 -i 0 --max-files 0 --hide progress -1280x720 --user-scale 1.5 --camera-mode track --title "cvc4 trunk" -s 0.5 -r 25 --date-format "%B %d, %Y" cvc4-log.xml -o - | ffmpeg -y -r 25 -f image2pipe -vcodec ppm -i - -vcodec libx264 -vpre ultrafast -crf 1 -threads 0 -bf 0 -s 640x360 cvc4-640x360.mp4 diff --git a/contrib/my-configure b/contrib/my-configure deleted file mode 100755 index 65a64895d..000000000 --- a/contrib/my-configure +++ /dev/null @@ -1,12 +0,0 @@ -# Includes the contents of the file .cvc4_config, if it exists, -# on the ./configure command line - -#! /bin/bash - -CONFIG_OPTIONS= - -if [ -e .cvc4_config ]; then - CONFIG_OPTIONS=`cat .cvc4_config` -fi - -./configure $CONFIG_OPTIONS $* diff --git a/contrib/switch-config b/contrib/switch-config deleted file mode 100755 index 98ed10329..000000000 --- a/contrib/switch-config +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash -# -# usage: switch-config [configuration] -# switch-config -l -# -# Script to switch the "current" configuration of the CVC4 builds directory -# to another one. Without an argument, it switches to the next alphabetically. -# With an argument, it switches to that configuration. With -l, it lists the -# available configurations. -# -# Only configurations in the "current" architecture (that for which the build directory is currently -# configured) are considered. -# -# This script is useful because it's faster that re-configuring. -# -# Script assumes it lives under contrib/ in the root of the CVC4 source -# tree. - -function usage { - echo "usage: `basename \"$0\"` [configuration]" - echo " `basename \"$0\"` -l" -} - -if [ $# -gt 1 ]; then - usage - exit 1 -fi - -cd `dirname "$0"`/.. - -if ! [ -d builds ]; then - echo "No configurations are available (no builds/ directory)." - exit -fi - -if ! [ -e builds/current ]; then - echo "Cannot get current configuration." - exit 1 -fi - -current=(`grep '^CURRENT_BUILD' builds/current | sed 's,^CURRENT_BUILD *= *\([^/]*\)/\(.*\),\1 \2,'`) -arch=${current[0]} -build=${current[1]} - -builds=(`ls "builds/$arch/"`) - -if ! [ -d "builds/$arch" ] || ! [ -d "builds/$arch/$build" ] || [ ${#builds[@]} -eq 0 ]; then - echo "builds/ directory in malformed state." - echo "You might want to blow it away and start from scratch." - exit 1 -fi - -function switchto { - config/mkbuilddir "$arch" "$1" >/dev/null - #perl -pi -e 's,^CURRENT_BUILD *= *.*,CURRENT_BUILD = '$arch/$1',' builds/current - echo "Current build switched to \`$1'." -} - -if [ $# -eq 0 ]; then - first= - last= - setbuild= - for d in `ls "builds/$arch/"`; do - if [ -z "$first" ]; then first=$d; fi - if [ "$last" = "$build" ]; then setbuild=$d; break; fi - last=$d - done - if [ -z "$setbuild" ]; then setbuild=$first; fi - if [ "$setbuild" = "$build" ]; then - echo "There is only one build profile (\`$build'), and it is current." - else - switchto "$setbuild" - fi -else - case $1 in - -l) for config in `ls -1 "builds/$arch/"`; do - if [ "$config" = "$build" ]; then - echo "$config" '*' - else - echo "$config" - fi - done ;; - -*) usage; exit 1 ;; - *) if ! [ -d "builds/$arch/$1" ]; then - echo "Build \`$1' does not exist." - exit 1 - else - if [ "$1" = "$build" ]; then - echo "Build \`$1' is already the current build profile." - else - switchto "$1" - fi - fi ;; - esac -fi - |