]> SALOME platform Git repositories - tools/install.git/commitdiff
Salome HOME
PAL14048: modify *.la files for libGL.so
authorvsr <vsr@opencascade.com>
Tue, 19 Dec 2006 08:42:40 +0000 (08:42 +0000)
committervsr <vsr@opencascade.com>
Tue, 19 Dec 2006 08:42:40 +0000 (08:42 +0000)
config_files/CAS-6.1.2a2.sh
config_files/common.sh
config_files/qt-3.3.3.sh
config_files/qt-3.3.4.sh

index 22cf11397c842aa97832060bcfdd00c1a1c7baa1..745ce15316a27e3b7022f43971e2921b2219e93c 100755 (executable)
@@ -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
 }
 
index 509b8dab3b497a375482f377d58c97ca2b558fcb..e4c88fbd2fbe5088879c48137e88062327587f62 100755 (executable)
@@ -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
index e1061a879c6dcbe80e40072541f01dd57aca77b1..9fb1c9195284bdc561ce1bab848d80d3ac3fddce 100755 (executable)
@@ -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
index 222c67e12f7695bb4833d963c5c79cb5cc70f6e8..c4c5aa747940e999114f81f459ed6704aa0c99be 100755 (executable)
@@ -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