Ticket #69782: lscc.sh

File lscc.sh, 1.0 KB (added by fhgwright (Fred Wright), 5 months ago)

Wrapper script for building legacy-support

Line 
1#! /bin/bash
2
3PREFIX="/opt/local"
4
5if [ "$ARCH" == "" ]; then
6  ARCH="$(grep '^build_arch' $PREFIX/etc/macports/macports.conf \
7         | awk '{print $2}')"
8fi
9
10if [ "$OSVER" == "" ]; then
11  OSFULLVER="$(sw_vers -productVersion)"
12  if echo $OSFULLVER | egrep -q '[0-9]+[.][0-9]+[.][0-9]+'; then 
13    OSVER="$(echo $OSFULLVER | sed -E 's/[.][0-9]+$//')"
14  else
15    OSVER="$OSFULLVER"
16  fi
17fi
18
19if [ "$CC" == "" ]; then
20  case $OSVER in
21
22    10.4 )
23      export CC="$PREFIX/bin/gcc-apple-4.2"
24      export TIGER="-Itiger_only/include"
25      ;;
26
27    10.5 )
28      export CC="/Developer/usr/bin/gcc-4.2"
29      ;;
30  esac
31fi
32
33if echo $CC | grep -q "/clang" ; then
34  export CXX="$(echo $CC | sed 's|/clang|/clang++|')"
35fi
36if echo $CC | grep -q "/gcc" ; then
37  export CXX="$(echo $CC | sed 's|/gcc|/g++|')"
38fi
39if echo $CC | grep -q "/cc" ; then
40  export CXX="$(echo $CC | sed 's|/cc|/c++|')"
41fi
42
43export CFLAGS="-arch $ARCH $CFLAGS $TIGER"
44export CXXFLAGS="-arch $ARCH $CXXFLAGS $TIGER"
45export LDFLAGS="-arch $ARCH $LDFLAGS"
46
47exec "$@"