/[svn]/linuxsampler/trunk/osx/autoconf_builder.sh
ViewVC logotype

Diff of /linuxsampler/trunk/osx/autoconf_builder.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1190 by schoenebeck, Sun May 6 16:38:35 2007 UTC revision 1191 by schoenebeck, Wed May 16 20:44:53 2007 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/sh
2  # autoconf_builder.sh  # autoconf_builder.sh
 # LinuxSampler  
 #  
3  # Created by Toshi Nagata on 07/04/18.  # Created by Toshi Nagata on 07/04/18.
4  # Copyright 2007 __MyCompanyName__. All rights reserved.  #
5    # Copyright 2007 Toshi Nagata.
6    #
7    # Redistribution and use in source and binary forms, with or without modification, are permitted
8    # provided that the following conditions are met:
9    #
10    #   1. Redistributions of source code must retain the above copyright notice, this list of
11    # conditions and the following disclaimer.
12    #   2. Redistributions in binary form must reproduce the above copyright notice, this list of
13    # conditions and the following disclaimer in the documentation and/or other materials provided
14    # with the distribution.
15    #
16    # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
17    # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
18    # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
19    # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
20    # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21    # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22    # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23    # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  #  #
25  #  Influential environmental variables:  #  Influential environmental variables:
26  #  ACTION(*): autoconf - run "make -f Makefile.cvs"; configure - run "configure";  #  ACTION(*): autoconf - run "make -f Makefile.cvs"; configure - run "configure";
27  #          make - run "make"; install - run "make install";  #               make - run "make"; install - run "make install";
28  #          build (or empty string) - autoconf && configure && make (&& install)  #               build (or empty string) - autoconf && configure && make (&& install)
29  #            "install" step is only done if WITH_INSTALL is non-empty  #               "install" step is only done if WITH_INSTALL is non-empty
30  #  BUILD_STYLE(*): The build style. If it ends with "ppc" or "i386", it also specifies the architecture.  #  BUILD_STYLE(*): The build style. If it ends with "ppc" or "i386", it also specifies the architecture.
31    #               If it ends with "UB" or "Universal", it creates the Universal Binaries for the products
32    #               specified by $UB_PRODUCTS (see below).
33    #               If any of the products are missing, then this script is recursively called for
34    #               $BUILD_STYLE's that have "ppc" and "i386" in place of "UB" or "Universal".
35  #  WITH_INSTALL: When non-empty, "install" action is automatically done in "build" action.  #  WITH_INSTALL: When non-empty, "install" action is automatically done in "build" action.
36  #  CFLAGS, CXXFLAGS: Compiler flags  #  CFLAGS, CXXFLAGS: Compiler flags
37  #  CONFIG_OPTIONS: Options for "configure"  #  CONFIG_OPTIONS: Options for "configure"
38  #  BUILD_BASE_DIR: Temporary building and install directory. By default "$PWD/build".  #  BUILD_BASE_DIR: Temporary building and install directory. By default "$PWD/build". The source
39    #               tree is duplicated (by use of symbolic links) in $BUILD_BASE_DIR/$BUILD_STYLE/<basename>.build,
40    #               where <basename> is the basename of the toplevel directory of the source tree (which also
41    #               should be the current directory when this script is invoked). The product is "installed"
42    #               into $BUILD_BASE_DIR/$BUILD_STYLE/local.
43  #  SDKROOT: The root directory for SDK  #  SDKROOT: The root directory for SDK
44    #  UB_PRODUCTS: The products for which Universal Binaries are to be created. The paths should be
45    #               relative to $BUILD_BASE_DIR/$BUILD_STYLE/local. Eg. bin/some_executable, lib/some_library.a.
46  #  #
47  #  The variables marked with (*) are automatically set by Xcode.  #  The variables marked with (*) are automatically set by Xcode.
48    
# Line 24  BASE_NAME=`basename $PWD` Line 51  BASE_NAME=`basename $PWD`
51    
52  function rel2abs () {  function rel2abs () {
53          (cd "$1"; pwd)          (cd "$1"; pwd)
 #       pushd "$1" >/dev/null  
 #       pwd  
 #       popd >/dev/null  
54  }  }
55    
56  function abs2rel () {  function abs2rel () {
# Line 68  fi Line 92  fi
92  if test "x$BUILD_BASE_DIR" = "x"; then  if test "x$BUILD_BASE_DIR" = "x"; then
93          BUILD_BASE_DIR=$PWD/build          BUILD_BASE_DIR=$PWD/build
94  fi  fi
95  BUILD_DIR="$BUILD_BASE_DIR/$BUILD_STYLE/$BASE_NAME.build"  mkdir -p "$BUILD_BASE_DIR" || exit $?
 mkdir -p "$BUILD_DIR" || exit $?  
96  BUILD_BASE_DIR=`rel2abs "$BUILD_BASE_DIR"`  BUILD_BASE_DIR=`rel2abs "$BUILD_BASE_DIR"`
 BUILD_DIR=`rel2abs "$BUILD_DIR"`  
 CONFIG_OPTIONS="--prefix=$BUILD_BASE_DIR/$BUILD_STYLE/local $CONFIG_OPTIONS"  
97    
98  if test -e "$SDKROOT"; then  if test -e "$SDKROOT"; then
99          SYSROOT_CFLAGS="-isysroot $SDKROOT"          SYSROOT_CFLAGS="-isysroot $SDKROOT"
# Line 94  case "$BUILD_STYLE" in Line 115  case "$BUILD_STYLE" in
115          ARCH_CFLAGS="-arch i386 -msse -msse2"          ARCH_CFLAGS="-arch i386 -msse -msse2"
116          ARCH_CONFIG_OPTIONS="--host=i386-apple-darwin8"          ARCH_CONFIG_OPTIONS="--host=i386-apple-darwin8"
117          ;;          ;;
118      *UB|*Universal)          *UB)
119          ARCH="UB"          ARCH="UB"
120            BUILD_STYLE_BASE=${BUILD_STYLE/UB/}
121            ;;
122        *Universal)
123            ARCH="UB"      
124            BUILD_STYLE_BASE=${BUILD_STYLE/Universal/}
125          ;;          ;;
126      *)      *)
127          echo "Warning: architecture cannot be recognized from the build style"          echo "Warning: architecture cannot be recognized from the build style"
# Line 115  esac Line 141  esac
141  export CFLAGS="$SYSROOT_CFLAGS $ARCH_CFLAGS $OPT_CFLAGS $CFLAGS"  export CFLAGS="$SYSROOT_CFLAGS $ARCH_CFLAGS $OPT_CFLAGS $CFLAGS"
142  export CXXFLAGS="$SYSROOT_CFLAGS $ARCH_CFLAGS $OPT_CFLAGS $CXXFLAGS"  export CXXFLAGS="$SYSROOT_CFLAGS $ARCH_CFLAGS $OPT_CFLAGS $CXXFLAGS"
143    
144    if test "x$ARCH" = "xUB" -a "x$ACTION" != "xclean"; then
145            #  Test the existence of the products
146            BUILD_STYLE_PPC=${BUILD_STYLE_BASE}ppc
147            BUILD_STYLE_386=${BUILD_STYLE_BASE}i386
148            for style in $BUILD_STYLE_PPC $BUILD_STYLE_386; do
149                    missing=no
150                    for i in $UB_PRODUCTS; do
151                            if ! test -e "$BUILD_BASE_DIR/$style/local/$i"; then
152                                    missing=yes
153                            fi
154                    done
155                    if test "$missing" = "yes"; then
156                            BUILD_STYLE_SAVE=$BUILD_STYLE
157                            export BUILD_STYLE=$style
158                            echo "Building with BUILD_STYLE=$style"
159                            /bin/sh $0 || exit $?
160                            BUILD_STYLE=$BUILD_STYLE_SAVE
161                    fi
162            done
163            mkdir -p "$BUILD_BASE_DIR/$BUILD_STYLE/local" || exit $?
164            cd "$BUILD_BASE_DIR"
165            for i in $UB_PRODUCTS; do
166                    mkdir -p "$BUILD_STYLE/local/"`dirname $i` || exit $?
167                    echo "Creating universal binary $BUILD_STYLE/local/$i"
168                    lipo -create "$BUILD_STYLE_PPC/local/$i" "$BUILD_STYLE_386/local/$i" -output "$BUILD_STYLE/local/$i" || exit $?
169            done
170            exit $?
171    fi
172    
173    #  Move to the working directory
174    BUILD_DIR="$BUILD_BASE_DIR/$BUILD_STYLE/$BASE_NAME.build"
175    mkdir -p "$BUILD_DIR"
176    BUILD_DIR=`rel2abs "$BUILD_DIR"`
177    CONFIG_OPTIONS="--prefix=$BUILD_BASE_DIR/$BUILD_STYLE/local $CONFIG_OPTIONS"
178    
179  #  Display all environments  #  Display all environments
180  set  set
181    
 #  Move to the working directory  
182  cd $BUILD_DIR  cd $BUILD_DIR
183    
184  #  Clean if specified  #  Clean if specified
185  if test "x$ACTION" = "xclean"; then  if test "x$ACTION" = "xclean"; then
186          if test "x$WITH_INSTALL" != "x" -a -e "Makefile"; then          # if test "x$WITH_INSTALL" != "x" -a -e "Makefile"; then
187                  echo "Doing make uninstall"          #       echo "Doing make uninstall"
188                  make uninstall          #       make uninstall
189          fi          # fi
190      echo "Removing files in $BUILD_DIR"      echo "Removing files in $BUILD_DIR"
191          cd $BASE_DIR          cd $BASE_DIR
192      rm -rf "$BUILD_DIR"      rm -rf "$BUILD_DIR"

Legend:
Removed from v.1190  
changed lines
  Added in v.1191

  ViewVC Help
Powered by ViewVC