From: vsr Date: Tue, 19 Dec 2006 08:42:40 +0000 (+0000) Subject: PAL14048: modify *.la files for libGL.so X-Git-Tag: V_3_2_4~21 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cd829a66ad0072e55ee2b9ce47d7ba6266eaefb9;p=tools%2Finstall.git PAL14048: modify *.la files for libGL.so --- diff --git a/config_files/CAS-6.1.2a2.sh b/config_files/CAS-6.1.2a2.sh index 22cf113..745ce15 100755 --- a/config_files/CAS-6.1.2a2.sh +++ b/config_files/CAS-6.1.2a2.sh @@ -98,16 +98,18 @@ check_jb tar xfz ${SOURCE_DIR}/CAS-6.1.2a2.tar.gz -C ${INSTALL_WORK} cd ${PRODUCT_WORK} # configure - if test `uname -m` = "x86_64" ; then -flags="CFLAGS=-m64 CXXFLAGS=-m64" -flags="$flags --with-gl-include=/usr/include --with-gl-library=/usr/X11R6/lib64" -flags="$flags --with-xmu-include=/usr/X11R6/include/X11" -flags="$flags --with-xmu-library=/usr/X11R6/lib64" +if test `uname -m` = "x86_64" ; then + flags="CFLAGS=-m64 CXXFLAGS=-m64" + flags="$flags --with-xmu-include=/usr/X11R6/include/X11" + flags="$flags --with-xmu-library=/usr/X11R6/lib64" else -flags="--with-gl-include=/usr/include --with-gl-library=/usr/lib" -flags="$flags --with-xmu-include=/usr/X11R6/include/X11" -flags="$flags --with-xmu-library=/usr/X11R6/lib" - fi + flags="$flags --with-xmu-include=/usr/X11R6/include/X11" + flags="$flags --with-xmu-library=/usr/X11R6/lib" +fi +glincdir="`where_gl_includes`" +if [ $? -eq 0 ] ; then flags="$flags --with-gl-include=$glincdir"; fi +gllibdir="`where_gl_libs`" +if [ $? -eq 0 ] ; then flags="$flags --with-gl-library=$gllibdir"; fi tcldir="`where_tcl`" if [ $? -eq 0 ] ; then flags="$flags --with-tcl=$tcldir"; fi tkdir="`where_tk`" @@ -132,15 +134,32 @@ cp -f config.h ${PRODUCT_DIR} (cd ${PRODUCT_DIR}/inc; ln -fs ../config.h config.h) # copy resources makedir ${PRODUCT_DIR}/src -cp -rp src/UnitsAPI ${PRODUCT_DIR}/src -cp -rp src/SHMessage ${PRODUCT_DIR}/src -cp -rp src/FontMFT ${PRODUCT_DIR}/src -cp -rp src/Textures ${PRODUCT_DIR}/src -cp -rp src/XSMessage ${PRODUCT_DIR}/src -cp -rp src/DrawResources ${PRODUCT_DIR}/src +for d in UnitsAPI SHMessage FontMFT Textures XSMessage DrawResources ; do + cp -rp src/${d} ${PRODUCT_DIR}/src +done (cd ${PRODUCT_DIR}; mkdir -p Linux; cd Linux; ln -fs ../lib lib; ln -fs ../bin bin) (cd ${PRODUCT_DIR}; mkdir -p lin; cd lin; ln -fs ../lib lib; ln -fs ../bin bin) +# fix libGL dependencies +cd ${PRODUCT_DIR}/lib +gllibdir="`where_gl_libs`" +if [ "$gllibdir" != "" ] ; then + if [ -f ${gllibdir}/libGL.la ] ; then + libdir=`grep "libdir=" ${gllibdir}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%"` + if [ "`ls $libdir/libGL.so* 2>/dev/null`" ] ; then + str_to_replace="${gllibdir}/libGL.la" + fi + fi + if [ "$str_to_replace" == "" ] ; then + str_to_replace="-L${gllibdir} -lGL" + fi + sed -e "s%-lGL%%g" \ + -e "s%[^[:space:]]*libGL.la[[:space:]]%%g" \ + -e "s%^dependency_libs='\(.*\)%dependency_libs='${str_to_replace} \1%" \ + libTKOpenGl.la > libTKOpenGl.la.new + mv -f libTKOpenGl.la.new libTKOpenGl.la +fi + #du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK} print_env @@ -152,10 +171,13 @@ make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE} source ${INSTALL_WORK}/$SHRC check_jb tar xfz ${SOURCE_DIR}/CAS-6.1.2a2.tar.gz -C ${INSTALL_ROOT} + +# modify *.la files ldir=${PRODUCT_DIR}/lib if [ ! -d $ldir ]; then ldir=${PRODUCT_DIR}/Linux/lib; fi if [ ! -d $ldir ]; then ldir=${PRODUCT_DIR}/lin/lib; fi cd $ldir +# 1. set libdir correctly, correct dependencies, set tcldir correctly tcldir=`printenv TCLHOME` for l in X `find . -name "*.la"`; do if [ "$l" != "X" ] ; then @@ -171,6 +193,26 @@ for l in X `find . -name "*.la"`; do fi done +# 2. fix libGL dependencies +cd $ldir +gllibdir="`where_gl_libs`" +if [ "$gllibdir" != "" ] ; then + if [ -f ${gllibdir}/libGL.la ] ; then + libdir=`grep "libdir=" ${gllibdir}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%"` + if [ "`ls $libdir/libGL.so* 2>/dev/null`" ] ; then + str_to_replace="${gllibdir}/libGL.la" + fi + fi + if [ "$str_to_replace" == "" ] ; then + str_to_replace="-L${gllibdir} -lGL" + fi + sed -e "s%-lGL%%g" \ + -e "s%[^[:space:]]*libGL.la[[:space:]]%%g" \ + -e "s%^dependency_libs='\(.*\)%dependency_libs='${str_to_replace} \1%" \ + libTKOpenGl.la > libTKOpenGl.la.new + mv -f libTKOpenGl.la.new libTKOpenGl.la +fi + print_env } diff --git a/config_files/common.sh b/config_files/common.sh index 509b8da..e4c88fb 100755 --- a/config_files/common.sh +++ b/config_files/common.sh @@ -533,6 +533,39 @@ echo "" return 1 } +where_gl_includes(){ +for d in /usr/X11R6/include /usr/include ; do + if [ -d ${d}/GL ] && [ -f ${d}/GL/gl.h ] ; then + echo "$d" + return 0 + fi +done +echo "" +return 1 +} + +where_gl_libs(){ +# first search libGL.la file and check if this file is correct +for d in /usr/X11R6/lib64 /usr/lib64 /usr/X11R6/lib /usr/lib ; do + if [ -f ${d}/libGL.la ] ; then + libdir=`grep "libdir=" ${d}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%"` + if [ "`ls $libdir/libGL.so* 2>/dev/null`" ] ; then + echo "$d" + return 0 + fi + fi +done +# then search libGL.so* file +for d in /usr/X11R6/lib64 /usr/lib64 /usr/X11R6/lib /usr/lib ; do + if [ "`ls ${d}/libGL.so* 2>/dev/null`" ] ; then + echo "$d" + return 0 + fi +done +echo "" +return 1 +} + modif_la_files(){ ldir=$1 if [ -z "$ldir" ] || [ ! -d "$ldir" ]; then return 1; fi diff --git a/config_files/qt-3.3.3.sh b/config_files/qt-3.3.3.sh index e1061a8..9fb1c91 100755 --- a/config_files/qt-3.3.3.sh +++ b/config_files/qt-3.3.3.sh @@ -143,6 +143,17 @@ for b in `find bin -mindepth 1 -maxdepth 1 -name "*"`; do cp -f ${PRODUCT_WORK}/bin/$b ${PRODUCT_DIR}/bin/$b fi done + +# modify libGL.so flags +has_gl_dep=`grep -E "^dependency_libs=.*-lGL.*" ${PRODUCT_DIR}/lib/libqt-mt.la` +gllibdir="`where_gl_libs`" +if [ "$has_gl_dep" != "" ] && [ "$gllibdir" != "" ] ; then + sed -e "s%-lGL%%g" \ + -e "s%^dependency_libs='\(.*\)%dependency_libs='-L$gllibdir -lGL \1%g" \ + ${PRODUCT_DIR}/lib/libqt-mt.la > ${PRODUCT_DIR}/lib/libqt-mt.la.new + mv -f ${PRODUCT_DIR}/lib/libqt-mt.la.new ${PRODUCT_DIR}/lib/libqt-mt.la +fi + #rm -rf ${PRODUCT_DIR}/doc #du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log @@ -158,8 +169,22 @@ source ${INSTALL_WORK}/$SHRC check_jb tar xfz ${SOURCE_DIR}/qt-3.3.3.tar.gz -C ${INSTALL_ROOT} cd ${PRODUCT_DIR}/lib + +# modify libdir sed -e "s%^libdir='\(.*\)'%libdir='${PRODUCT_DIR}/lib'%g" libqt-mt.la > libqt-mt.la.new mv -f libqt-mt.la.new libqt-mt.la + +# modify libGL.so flags +has_gl_dep=`grep -E "^dependency_libs=.*-lGL.*" libqt-mt.la` +gllibdir="`where_gl_libs`" +if [ "$has_gl_dep" != "" ] && [ "$gllibdir" != "" ] ; then + sed -e "s%-lGL%%g" \ + -e "s%^dependency_libs='\(.*\)%dependency_libs='-L$gllibdir -lGL \1%g" \ + libqt-mt.la > libqt-mt.la.new + mv -f libqt-mt.la.new libqt-mt.la +fi + +# modify qt package config cd ${PRODUCT_DIR}/lib/pkgconfig sed -e "s%^prefix=\(.*\)%prefix=${PRODUCT_DIR}%g" qt-mt.pc > qt-mt.pc.new mv -f qt-mt.pc.new qt-mt.pc diff --git a/config_files/qt-3.3.4.sh b/config_files/qt-3.3.4.sh index 222c67e..c4c5aa7 100755 --- a/config_files/qt-3.3.4.sh +++ b/config_files/qt-3.3.4.sh @@ -173,6 +173,17 @@ for b in `find bin -mindepth 1 -maxdepth 1 -name "*"`; do cp -f ${PRODUCT_WORK}/bin/$b ${PRODUCT_DIR}/bin/$b fi done + +# modify libGL.so flags +has_gl_dep=`grep -E "^dependency_libs=.*-lGL.*" ${PRODUCT_DIR}/lib/libqt-mt.la` +gllibdir="`where_gl_libs`" +if [ "$has_gl_dep" != "" ] && [ "$gllibdir" != "" ] ; then + sed -e "s%-lGL%%g" \ + -e "s%^dependency_libs='\(.*\)%dependency_libs='-L$gllibdir -lGL \1%g" \ + ${PRODUCT_DIR}/lib/libqt-mt.la > ${PRODUCT_DIR}/lib/libqt-mt.la.new + mv -f ${PRODUCT_DIR}/lib/libqt-mt.la.new ${PRODUCT_DIR}/lib/libqt-mt.la +fi + #rm -rf ${PRODUCT_DIR}/doc #du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log @@ -187,9 +198,22 @@ source ${INSTALL_WORK}/$SHRC check_jb tar xfz ${SOURCE_DIR}/qt-3.3.4.tar.gz -C ${INSTALL_ROOT} +# modify libdir cd ${PRODUCT_DIR}/lib sed -e "s%^libdir='\(.*\)'%libdir='${PRODUCT_DIR}/lib'%g" libqt-mt.la > libqt-mt.la.new mv -f libqt-mt.la.new libqt-mt.la + +# modify libGL.so flags +has_gl_dep=`grep -E "^dependency_libs=.*-lGL.*" libqt-mt.la` +gllibdir="`where_gl_libs`" +if [ "$has_gl_dep" != "" ] && [ "$gllibdir" != "" ] ; then + sed -e "s%-lGL%%g" \ + -e "s%^dependency_libs='\(.*\)%dependency_libs='-L$gllibdir -lGL \1%g" \ + libqt-mt.la > libqt-mt.la.new + mv -f libqt-mt.la.new libqt-mt.la +fi + +# modify qt package config cd ${PRODUCT_DIR}/lib/pkgconfig sed -e "s%^prefix=\(.*\)%prefix=${PRODUCT_DIR}%g" qt-mt.pc > qt-mt.pc.new mv -f qt-mt.pc.new qt-mt.pc