1 #!/usr/bin/env sh 2 3 exit_with_usage () 4 { 5 echo "Usage: $0 [ignored.py] --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir" 6 exit 1 7 } 8 9 case "$1" in 10 *.py) 11 shift 12 ;; 13 esac 14 15 if [ "$1" = "" ] ; then 16 exit_with_usage 17 fi 18 19 # Returns the actual prefix where this script was installed to. 20 installed_prefix () 21 { 22 local RESULT=$(dirname $(cd $(dirname "$1") && pwd -P)) 23 local READLINK=readlink 24 if [ "$(uname -s)" = "Darwin" ] ; then 25 # readlink in darwin can't handle -f. Use greadlink from MacPorts instead. 26 READLINK=greadlink 27 fi 28 if [ $(which $READLINK) ] ; then 29 RESULT=$($READLINK -f "$RESULT") 30 fi 31 echo $RESULT 32 } 33 34 prefix_build="/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64" 35 prefix_real=$(installed_prefix "$0") 36 37 # Use sed to fix paths from their built to locations to their installed to locations. 38 prefix=$(echo "$prefix_build" | sed "s#$prefix_build#$prefix_real#") 39 exec_prefix_build="${prefix}" 40 exec_prefix=$(echo "$exec_prefix_build" | sed "s#$exec_prefix_build#$prefix_real#") 41 includedir=$(echo "${prefix}/include" | sed "s#$prefix_build#$prefix_real#") 42 libdir=$(echo "${exec_prefix}/lib" | sed "s#$prefix_build#$prefix_real#") 43 CFLAGS=$(echo "-O2 -Os -fomit-frame-pointer -s" | sed "s#$prefix_build#$prefix_real#") 44 VERSION="2.7" 45 LIBM="" 46 LIBC="" 47 SYSLIBS="$LIBM $LIBC" 48 ABIFLAGS="@ABIFLAGS@" 49 # Protect against lack of substitution. 50 if [ "$ABIFLAGS" = "@ABIFLAGS@" ] ; then 51 ABIFLAGS= 52 fi 53 LIBS="-ldl -framework CoreFoundation $SYSLIBS -lpython${VERSION}${ABIFLAGS}" 54 BASECFLAGS=" -fno-strict-aliasing" 55 LDLIBRARY="libpython${VERSION}.a" 56 LINKFORSHARED="-u _PyMac_Error" 57 OPT="-DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes" 58 PY_ENABLE_SHARED="0" 59 DLLLIBRARY="" 60 LIBDEST=${prefix}/lib/python${VERSION} 61 LIBPL=${LIBDEST}/config 62 SO=".so" 63 PYTHONFRAMEWORK="" 64 INCDIR="-I$includedir/python${VERSION}${ABIFLAGS}" 65 PLATINCDIR="-I$includedir/python${VERSION}${ABIFLAGS}" 66 67 # Scan for --help or unknown argument. 68 for ARG in $* 69 do 70 case $ARG in 71 --help) 72 exit_with_usage 73 ;; 74 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags) 75 ;; 76 *) 77 exit_with_usage 78 ;; 79 esac 80 done 81 82 for ARG in $* 83 do 84 case $ARG in 85 --prefix) 86 echo "$prefix" 87 ;; 88 --exec-prefix) 89 echo "$exec_prefix" 90 ;; 91 --includes) 92 echo "$INCDIR" 93 ;; 94 --cflags) 95 echo "$INCDIR $BASECFLAGS $CFLAGS $OPT" 96 ;; 97 --libs) 98 echo "$LIBS" 99 ;; 100 --ldflags) 101 LINKFORSHAREDUSED= 102 if [ -z "$PYTHONFRAMEWORK" ] ; then 103 LINKFORSHAREDUSED=$LINKFORSHARED 104 fi 105 LIBPLUSED= 106 if [ "$PY_ENABLE_SHARED" = "0" -o -n "${DLLLIBRARY}" ] ; then 107 LIBPLUSED="-L$LIBPL" 108 fi 109 echo "$LIBPLUSED -L$libdir $LIBS $LINKFORSHAREDUSED" 110 ;; 111 esac 112 done 113