Salome HOME
Add config files and some code update for compilation of SALOME-7.8.0
[tools/sat.git] / data / compil_scripts / Python.sh
1 #!/bin/bash
2
3 echo "##########################################################################"
4 echo "Python" $VERSION
5 echo "##########################################################################"
6
7 rm -Rf $PRODUCT_INSTALL
8
9 # WARNING $PYTHOSTARTUP can be problematic -> unset.
10 # If an error occurs during make install then the environement is "messy"
11
12 # check for readline library
13 # if NO_CHECK_READLINE is not set and readline is not found the script will exit
14 if [[ "x$NO_CHECK_READLINE" == "x" ]]
15 then
16     echo
17     echo "*** check for readline library"
18     python -c "import readline" &> /dev/null
19     if [ $? -ne 0 ]
20     then
21         echo "ERROR readline library is not installed"
22         echo "set environement variable NO_CHECK_READLINE to skip checking for readline library"
23         exit 5
24     else
25         echo "readline library found"
26     fi
27 fi
28
29 echo
30 echo "*** configure"
31 if [[ $DIST_NAME == "UB" ]]
32 then
33     export LDFLAGS="-L/usr/lib/x86_64-linux-gnu/"
34     echo "set LDFLAGS=$LDFLAGS"
35 fi
36
37 ################################## Hack the bug with <Lib64> on OpenSuse 
38 if [[ $DIST_NAME == "OS" ]]
39 then
40     echo
41     echo "*** fix bug OpenSuse"
42         VAR_PWD=`pwd`
43         mkdir -p ${PRODUCT_INSTALL}
44         echo
45         echo "*** create missing link ${PRODUCT_INSTALL}/lib ${PRODUCT_INSTALL}/lib64"
46         cd ${PRODUCT_INSTALL}
47         mkdir lib
48         ln -s lib lib64
49         cd $VAR_PWD
50 fi
51
52 $SOURCE_DIR/configure --prefix=$PRODUCT_INSTALL --enable-shared --with-threads --without-pymalloc --enable-unicode=ucs4
53 if [ $? -ne 0 ]
54 then
55     echo "ERROR on configure"
56     exit 1
57 fi
58
59 echo
60 echo "*** make" $MAKE_OPTIONS
61 make $MAKE_OPTIONS
62 if [ $? -ne 0 ]
63 then
64     echo "ERROR on make"
65     exit 2
66 fi
67
68 echo
69 echo "*** make install"
70 make install
71 if [ $? -ne 0 ]
72 then
73     echo "ERROR on make install"
74     exit 3
75 fi
76
77 ######### link for salome
78
79 PYTHON_VERSION=`${PRODUCT_INSTALL}/bin/python -c "import sys; print sys.version[:3]"`
80 if [ $? -ne 0 ]
81 then
82     PYTHON_VERSION="${VERSION:0:3}"
83 fi
84
85 cd ${PRODUCT_INSTALL}/lib/python${PYTHON_VERSION}/config
86
87 if [ ! -e libpython${PYTHON_VERSION}.so ]
88 then
89     echo
90     echo "*** create missing link"
91     ln -sf ../../libpython${PYTHON_VERSION}.so .
92     if [ $? -ne 0 ]
93     then
94         echo "ERROR when creating missing link"
95         # no error here
96     fi
97 fi
98
99 # changement des ent�tes
100 #cd $PRODUCT_INSTALL/bin
101 #for sc in idle pydoc smtpd.py ; do
102 #    if [ -e $sc ] ; then
103 #   sed -e "s%#\!.*python%#\!/usr/bin/env python%" "$sc" > _"$sc"
104 #   mv -f _"$sc" "$sc"
105 #   chmod a+x "$sc"
106 #    fi
107 #done
108
109 echo
110 echo "########## END"
111