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

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

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

revision 1190 by schoenebeck, Wed May 16 20:38:55 2007 UTC revision 1640 by nagata, Sun Jan 13 16:23:50 2008 UTC
# Line 43  Line 43 
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  #  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.  #               relative to $BUILD_BASE_DIR/$BUILD_STYLE/local. Eg. bin/some_executable, lib/some_library.a.
46    #  UB_ARCHS: The target architectures for the "UB" build style. If not specified, "ppc i386" is assumed.
47    #  UB_ONEPASS: When non-empty, building "UB" is done with the compiler flag like "-arch i386 -arch ppc".
48    #       Otherwise, binaries for each architecture are separately built and combined later by lipo.
49  #  #
50  #  The variables marked with (*) are automatically set by Xcode.  #  The variables marked with (*) are automatically set by Xcode.
51    
52  BASE_DIR=$PWD  BASE_DIR=$PWD
53  BASE_NAME=`basename $PWD`  BASE_NAME=`basename $PWD`
54    UB_ARCHS=${UB_ARCHS:-"ppc i386"}
55    
56  function rel2abs () {  function rel2abs () {
57          (cd "$1"; pwd)          (cd "$1"; pwd)
# Line 90  if test "x$ACTION" = "x"; then Line 94  if test "x$ACTION" = "x"; then
94          ACTION="build"          ACTION="build"
95  fi  fi
96  if test "x$BUILD_BASE_DIR" = "x"; then  if test "x$BUILD_BASE_DIR" = "x"; then
97          BUILD_BASE_DIR=$PWD/build          BUILD_BASE_DIR=$PWD/../temp_build
98  fi  fi
99  mkdir -p "$BUILD_BASE_DIR" || exit $?  mkdir -p "$BUILD_BASE_DIR" || exit $?
100  BUILD_BASE_DIR=`rel2abs "$BUILD_BASE_DIR"`  export BUILD_BASE_DIR=`rel2abs "$BUILD_BASE_DIR"`
101    
102  if test -e "$SDKROOT"; then  if test -e "$SDKROOT"; then
103          SYSROOT_CFLAGS="-isysroot $SDKROOT"          SYSROOT_CFLAGS="-isysroot $SDKROOT"
104  else  else
105          SYSROOT_CFLAGS=          SYSROOT_CFLAGS=
106  fi  fi
107  PATH="/usr/local/bin:$PATH"  if ! expr "$arg" : ".*/usr/local/bin.*" >/dev/null; then
108            PATH=${PATH/\/usr\/bin/\/usr\/local\/bin:\/usr\/bin}
109    fi
110  ARCH_CFLAGS=""  ARCH_CFLAGS=""
111  ARCH_CONFIG_OPTIONS=""  ARCH_CONFIG_OPTIONS=""
112  case "$BUILD_STYLE" in  case "$BUILD_STYLE" in
# Line 110  case "$BUILD_STYLE" in Line 114  case "$BUILD_STYLE" in
114          ARCH="ppc"          ARCH="ppc"
115          ARCH_CFLAGS="-arch ppc"          ARCH_CFLAGS="-arch ppc"
116          ;;          ;;
117            *ppc64)
118            ARCH="ppc64"
119            ARCH_CFLAGS="-arch ppc64"
120            ARCH_CONFIG_OPTIONS="--host=ppc64-apple-darwin8"
121            if expr "$BASE_NAME" : "libsndfile" >/dev/null; then
122                    #  For shortcut endianness detection in libsndfile 1.0.17
123                    export ac_cv_c_byte_order=big
124            fi
125            ;;
126      *i386)      *i386)
127          ARCH="i386"          ARCH="i386"
128          ARCH_CFLAGS="-arch i386 -msse -msse2"          ARCH_CFLAGS="-arch i386 -msse -msse2"
129          ARCH_CONFIG_OPTIONS="--host=i386-apple-darwin8"          ARCH_CONFIG_OPTIONS="--host=i386-apple-darwin8"
130          ;;          ;;
131            *x86_64)
132            ARCH="x86_64"
133            ARCH_CFLAGS="-arch x86_64 -m64"
134            ARCH_CONFIG_OPTIONS="--host=x86_64-apple-darwin8"
135            ;;
136          *UB)          *UB)
137          ARCH="UB"          ARCH="UB"
138          BUILD_STYLE_BASE=${BUILD_STYLE/UB/}          BUILD_STYLE_BASE=${BUILD_STYLE/UB/}
# Line 138  case "$BUILD_STYLE" in Line 156  case "$BUILD_STYLE" in
156          ;;          ;;
157  esac  esac
158    
159  export CFLAGS="$SYSROOT_CFLAGS $ARCH_CFLAGS $OPT_CFLAGS $CFLAGS"  if test "x$ARCH" = "xUB"; then
160  export CXXFLAGS="$SYSROOT_CFLAGS $ARCH_CFLAGS $OPT_CFLAGS $CXXFLAGS"          for arch in $UB_ARCHS; do
161                    case $arch in
162  if test "x$ARCH" = "xUB" -a "x$ACTION" != "xclean"; then                          ppc)
163                            ARCH_CFLAGS="$ARCH_CFLAGS -arch ppc"
164                            ;;
165                            *ppc64)
166                            ARCH_CFLAGS="$ARCH_CFLAGS -arch ppc64"
167                            ;;
168                            *i386)
169                            ARCH_CFLAGS="$ARCH_CFLAGS -arch i386 -msse -msse2"
170                            ;;
171                            *x86_64)
172                            ARCH_CFLAGS="$ARCH_CFLAGS -arch x86_64 -m64"
173                            ;;
174                    esac
175            done
176    fi
177                    
178    if test "x$ARCH" = "xUB" -a "x$ACTION" != "xclean" -a "x$UB_ONEPASS" = "x"; then
179          #  Test the existence of the products          #  Test the existence of the products
180          BUILD_STYLE_PPC=${BUILD_STYLE_BASE}ppc          for arch in $UB_ARCHS; do
181          BUILD_STYLE_386=${BUILD_STYLE_BASE}i386                  style=${BUILD_STYLE_BASE}${arch}
182          for style in $BUILD_STYLE_PPC $BUILD_STYLE_386; do  #       BUILD_STYLE_PPC=${BUILD_STYLE_BASE}ppc
183    #       BUILD_STYLE_386=${BUILD_STYLE_BASE}i386
184    #       for style in $BUILD_STYLE_PPC $BUILD_STYLE_386; do
185                  missing=no                  missing=no
186                  for i in $UB_PRODUCTS; do                  for i in $UB_PRODUCTS; do
187                          if ! test -e "$BUILD_BASE_DIR/$style/local/$i"; then                          if ! test -e "$BUILD_BASE_DIR/$style/local/$i"; then
# Line 163  if test "x$ARCH" = "xUB" -a "x$ACTION" ! Line 199  if test "x$ARCH" = "xUB" -a "x$ACTION" !
199          mkdir -p "$BUILD_BASE_DIR/$BUILD_STYLE/local" || exit $?          mkdir -p "$BUILD_BASE_DIR/$BUILD_STYLE/local" || exit $?
200          cd "$BUILD_BASE_DIR"          cd "$BUILD_BASE_DIR"
201          for i in $UB_PRODUCTS; do          for i in $UB_PRODUCTS; do
202                    archbins=""
203                    for arch in $UB_ARCHS; do
204                            archbins="$archbins $BUILD_BASE_DIR/${BUILD_STYLE_BASE}${arch}/local/$i"
205                    done
206                  mkdir -p "$BUILD_STYLE/local/"`dirname $i` || exit $?                  mkdir -p "$BUILD_STYLE/local/"`dirname $i` || exit $?
207                  echo "Creating universal binary $BUILD_STYLE/local/$i"                  echo "Creating universal binary $BUILD_STYLE/local/$i"
208                  lipo -create "$BUILD_STYLE_PPC/local/$i" "$BUILD_STYLE_386/local/$i" -output "$BUILD_STYLE/local/$i" || exit $?                  lipo -create $archbins -output "$BUILD_STYLE/local/$i" || exit $?
209          done          done
210          exit $?          exit $?
211  fi  fi
212    
213    export CFLAGS="$SYSROOT_CFLAGS $ARCH_CFLAGS $OPT_CFLAGS $CFLAGS"
214    export CXXFLAGS="$SYSROOT_CFLAGS $ARCH_CFLAGS $OPT_CFLAGS $CXXFLAGS"
215    
216  #  Move to the working directory  #  Move to the working directory
217  BUILD_DIR="$BUILD_BASE_DIR/$BUILD_STYLE/$BASE_NAME.build"  BUILD_DIR="$BUILD_BASE_DIR/$BUILD_STYLE/$BASE_NAME.build"
218  mkdir -p "$BUILD_DIR"  mkdir -p "$BUILD_DIR"
# Line 190  if test "x$ACTION" = "xclean"; then Line 233  if test "x$ACTION" = "xclean"; then
233      echo "Removing files in $BUILD_DIR"      echo "Removing files in $BUILD_DIR"
234          cd $BASE_DIR          cd $BASE_DIR
235      rm -rf "$BUILD_DIR"      rm -rf "$BUILD_DIR"
236            echo "Removing product files in $BUILD_BASE_DIR/$BUILD_STYLE/local"
237            (cd "$BUILD_BASE_DIR/$BUILD_STYLE/local"; rm -rf $UB_PRODUCTS)
238      exit $?      exit $?
239  fi  fi
240    

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

  ViewVC Help
Powered by ViewVC