Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(36508)

Delta Between Two Patch Sets: Misc/python-config.sh.in

Issue 16235: Add python-config.sh for use during cross compilation.
Left Patch Set: Created 7 years ago
Right Patch Set: Created 6 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Makefile.pre.in ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #!/bin/sh 1 #!/bin/sh
2 2
3 exit_with_usage () 3 exit_with_usage ()
4 { 4 {
5 echo "Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags| --help" 5 echo "Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags| --extension-suffix|--help|--abiflags|--configdir"
6 exit 1 6 exit $1
7 } 7 }
8 8
9 if [ "$1" = "" ] ; then 9 if [ "$1" = "" ] ; then
10 exit_with_usage 10 exit_with_usage 1
11 fi 11 fi
12 12
13 # Returns the actual prefix where this script was installed to. 13 # Returns the actual prefix where this script was installed to.
14 installed_prefix () 14 installed_prefix ()
15 { 15 {
16 local RESULT=$(dirname $(cd $(dirname "$1") && pwd -P)) 16 RESULT=$(dirname $(cd $(dirname "$1") && pwd -P))
17 if [ $(which readlink) ] ; then 17 if which readlink >/dev/null 2>&1 ; then
18 RESULT=$(readlink -f "$RESULT") 18 RESULT=$(readlink -f "$RESULT")
19 fi 19 fi
20 echo $RESULT 20 echo $RESULT
21 } 21 }
22 22
23 prefix_build="@prefix@" 23 prefix_build="@prefix@"
24 prefix_real=$(installed_prefix "$0") 24 prefix_real=$(installed_prefix "$0")
25 25
26 # Use sed to fix paths from their built to locations to their installed to locat ions. 26 # Use sed to fix paths from their built to locations to their installed to locat ions.
27 prefix=$(echo "$prefix_build" | sed "s#$prefix_build#$prefix_real#") 27 prefix=$(echo "$prefix_build" | sed "s#$prefix_build#$prefix_real#")
28 exec_prefix_build="@exec_prefix@" 28 exec_prefix_build="@exec_prefix@"
29 exec_prefix=$(echo "$exec_prefix_build" | sed "s#$exec_prefix_build#$prefix_real #") 29 exec_prefix=$(echo "$exec_prefix_build" | sed "s#$exec_prefix_build#$prefix_real #")
30 includedir=$(echo "@includedir@" | sed "s#$prefix_build#$prefix_real#") 30 includedir=$(echo "@includedir@" | sed "s#$prefix_build#$prefix_real#")
31 libdir=$(echo "@libdir@" | sed "s#$prefix_build#$prefix_real#") 31 libdir=$(echo "@libdir@" | sed "s#$prefix_build#$prefix_real#")
32 CFLAGS=$(echo "@CFLAGS@" | sed "s#$prefix_build#$prefix_real#") 32 CFLAGS=$(echo "@CFLAGS@" | sed "s#$prefix_build#$prefix_real#")
33 VERSION="@VERSION@" 33 VERSION="@VERSION@"
34 LIBM="@LIBM@" 34 LIBM="@LIBM@"
35 LIBC="@LIBC@" 35 LIBC="@LIBC@"
36 SYSLIBS="$LIBM $LIBC" 36 SYSLIBS="$LIBM $LIBC"
37 LIBS="@LIBS@ $SYSLIBS -lpython$VERSION"
38 ABIFLAGS="@ABIFLAGS@" 37 ABIFLAGS="@ABIFLAGS@"
38 LIBS="@LIBS@ $SYSLIBS -lpython${VERSION}${ABIFLAGS}"
39 BASECFLAGS="@BASECFLAGS@" 39 BASECFLAGS="@BASECFLAGS@"
40 LDLIBRARY="@LDLIBRARY@" 40 LDLIBRARY="@LDLIBRARY@"
41 LINKFORSHARED="@LINKFORSHARED@" 41 LINKFORSHARED="@LINKFORSHARED@"
42 OPT="@OPT@" 42 OPT="@OPT@"
43 PY_ENABLE_SHARED="@PY_ENABLE_SHARED@" 43 PY_ENABLE_SHARED="@PY_ENABLE_SHARED@"
44 LDVERSION="@LDVERSION@" 44 LDVERSION="@LDVERSION@"
45 LIBDEST=${prefix}/lib/python${VERSION} 45 LIBDEST=${prefix}/lib/python${VERSION}
46 LIBPL=${LIBDEST}/config-${LDVERSION} 46 LIBPL=$(echo "@LIBPL@" | sed "s#$prefix_build#$prefix_real#")
47 SO="@SO@"
48 PYTHONFRAMEWORK="@PYTHONFRAMEWORK@"
49 INCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"
50 PLATINCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"
47 51
52 # Scan for --help or unknown argument.
48 for ARG in $* 53 for ARG in $*
49 do 54 do
50 case $ARG in 55 case $ARG in
56 --help)
57 exit_with_usage 0
58 ;;
59 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension- suffix|--abiflags|--configdir)
60 ;;
61 *)
62 exit_with_usage 1
63 ;;
64 esac
65 done
66
67 for ARG in "$@"
68 do
69 case "$ARG" in
51 --prefix) 70 --prefix)
52 echo "$prefix" 71 echo "$prefix"
53 exit 0
54 ;; 72 ;;
55 --exec-prefix) 73 --exec-prefix)
56 echo "$exec_prefix" 74 echo "$exec_prefix"
57 exit 0
58 ;; 75 ;;
59 --includes) 76 --includes)
60 echo "-I$includedir/python$VERSION" 77 echo "$INCDIR $PLATINCDIR"
61 exit 0 78 ;;
79 --cflags)
80 echo "$INCDIR $PLATINCDIR $BASECFLAGS $CFLAGS $OPT"
62 ;; 81 ;;
63 --libs) 82 --libs)
64 echo "$LIBS" 83 echo "$LIBS"
65 exit 0
66 ;;
67 --cflags)
68 echo "-I$includedir/python$VERSION $BASECFLAGS $CFLAGS $OPT"
69 exit 0
70 ;; 84 ;;
71 --ldflags) 85 --ldflags)
86 LINKFORSHAREDUSED=
87 if [ -z "$PYTHONFRAMEWORK" ] ; then
88 LINKFORSHAREDUSED=$LINKFORSHARED
89 fi
90 LIBPLUSED=
72 if [ "$PY_ENABLE_SHARED" = "0" ] ; then 91 if [ "$PY_ENABLE_SHARED" = "0" ] ; then
73 echo "-L$LIBPL -L$libdir $LIBS $LINKFORSHARED" 92 LIBPLUSED="-L$LIBPL"
74 » else 93 fi
75 echo "-L$libdir $LIBS $LINKFORSHARED" 94 echo "$LIBPLUSED -L$libdir $LIBS $LINKFORSHAREDUSED"
76 » fi
77 ;; 95 ;;
78 --help) 96 --extension-suffix)
79 exit_with_usage 97 echo "$SO"
80 ;; 98 ;;
81 *) 99 --abiflags)
82 exit_with_usage 100 echo "$ABIFLAGS"
101 ;;
102 --configdir)
103 echo "$LIBPL"
83 ;; 104 ;;
84 esac 105 esac
85 done 106 done
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+