[PC-BSD Commits] r3290 - in pbibuild: pbi-source/PBCsource pbibuilder/pbicreator/PBIfiles

svn at pcbsd.org svn at pcbsd.org
Mon Jan 19 13:31:25 PST 2009


Author: kris
Date: 2009-01-19 13:31:24 -0800 (Mon, 19 Jan 2009)
New Revision: 3290

Modified:
   pbibuild/pbi-source/PBCsource/createpbi.sh
   pbibuild/pbibuilder/pbicreator/PBIfiles/copylibs.sh
Log:

Updated our PBI builder support scripts, now we should be grabbing and copying all relevant libs properly from binaries, and from other libraries which require additional libraries. This should prevent errors like with firefox3, missing some library files



Modified: pbibuild/pbi-source/PBCsource/createpbi.sh
===================================================================
--- pbibuild/pbi-source/PBCsource/createpbi.sh	2009-01-19 21:28:14 UTC (rev 3289)
+++ pbibuild/pbi-source/PBCsource/createpbi.sh	2009-01-19 21:31:24 UTC (rev 3290)
@@ -115,9 +115,10 @@
 then
   echo -e "Populating libraries...\t\c"
   
-  # Make shure the autolibs directory is made in the PBI folder 
+  # Make sure the autolibs directory is made in the PBI folder 
   mkdir "${PBILOC}/autolibs" >/dev/null 2>/dev/null
 
+  echo "Checking for libs in the ExePath: Variables"
   # Now loop through the ExePath variables and grab the libs for each
   while read line
   do
@@ -126,19 +127,40 @@
     if [ "$?" = "0" ]
     then
        BINARY="`echo $line | grep '^ExePath:' | cut -d ' ' -f 2-5`"
-       ${PROGDIR}/PBIfiles/copylibs.sh ${BINARY} ${PBILOC}/autolibs/
+       ${PROGDIR}/PBIfiles/copylibs.sh ${PBILOC}/${BINARY} ${PBILOC}/autolibs/ ${PROGDIR}
     fi
   done < ${PBCFILE}
 
+  echo "Checking for libs for all bin/ entries"
   # Check if we have a "bin" directory and run LDD on those files
   if [ -d "${PBILOC}/bin" ]
   then
      for i in `ls ${PBILOC}/bin/`
      do
-       ${PROGDIR}/PBIfiles/copylibs.sh ${PBILOC}/bin/${i} ${PBILOC}/autolibs/
+       ${PROGDIR}/PBIfiles/copylibs.sh ${PBILOC}/bin/${i} ${PBILOC}/autolibs/ ${PROGDIR}
      done
   fi
 
+  # Save our current LD_LIBRARY_PATH variable
+  LD_LIBRARY_OLD="${LD_LIBRARY_PATH}"
+
+  # Make sure we parse the autolibs dir, to find any libs our libs require
+  for i in `ls ${PBILOC}/autolibs`
+  do
+     file ${PBILOC}/autolibs/${i} | grep "dynamically linked" >/dev/null 2>/dev/null
+     if [ "$?" = "0" ]
+     then
+       echo "Checking libraries required for ${i}"
+       LD_LIBRARY_PATH="${PBILOC}/autolibs" ; export LD_LIBRARY_PATH
+
+       # Copy over the libs for this file now
+       ${PROGDIR}/PBIfiles/copylibs.sh ${PBILOC}/autolibs/${i} ${PBILOC}/autolibs/ ${PROGDIR}
+     fi
+  done
+
+  # Reset our LD_LIBRARY_PATH back to the orignal
+  LD_LIBRARY_PATH="${LD_LIBRARY_OLD}" ; export LD_LIBRARY_PATH
+
   # Now copy all the files from /lib into the autolibs directory since this
   # improves compat across FBSD versions
 

Modified: pbibuild/pbibuilder/pbicreator/PBIfiles/copylibs.sh
===================================================================
--- pbibuild/pbibuilder/pbicreator/PBIfiles/copylibs.sh	2009-01-19 21:28:14 UTC (rev 3289)
+++ pbibuild/pbibuilder/pbicreator/PBIfiles/copylibs.sh	2009-01-19 21:31:24 UTC (rev 3290)
@@ -7,23 +7,45 @@
 # Copyright 2005 PC-BSD Software
 ###################################################################
 
+LDDFILE="${1}"
+COPYDIR="${2}"
+PROGDIR="${3}"
+
+if [ -z "${LDDFILE}" -o -z "${COPYDIR}" -o -z "${PROGDIR}" ]
+then
+   echo "ERROR: Missing some flags for copylibs.sh"
+   exit 2
+fi
+
 found="0"
 
-mkdir -p ${2} 
+mkdir -p ${2} >/dev/null 2>/dev/null
 
-for i in `ldd ${1} | grep -v "${1}" | grep -v 'not found'`
+rm /tmp/.pbilddlist >/dev/null 2>/dev/null 
+ldd ${LDDFILE} 2>/dev/null | grep -v 'not found' >/tmp/.pbilddlist 
+if [ "$?" != "0" ]
+then
+   exit
+fi
+
+while read line
 do
 
-if [ "${found}" = "1" ]
+echo $line | grep '=>' >/dev/null 2>/dev/null
+if [ "${?}" = "0" ]
 then
-  echo "Copy Lib: ${i}" >&2
-  cp ${i} ${2} 
-  found="0"
-fi
+  FILE="`echo $line | cut -d '>' -f 2 | cut -d ' ' -f 2`"
+  if [ ! -e "${COPYDIR}/`basename ${FILE}`" ]
+  then
+    echo "Copy Lib ${FILE} -> ${COPYDIR}"
+    cp ${FILE} ${COPYDIR}/
 
-if [ "${i}" = "=>" ]
-then
-  found="1"
+    # If we have found a new library, do a recursive call on copylibs, to ensure its depends are copied also
+    ${PROGDIR}/PBIfiles/copylibs.sh ${FILE} ${COPYDIR} ${PROGDIR} 
+  fi
 fi
 
-done
+done </tmp/.pbilddlist
+
+# Remove our tmp file
+rm /tmp/.pbilddlist >/dev/null 2>/dev/null



More information about the Commits mailing list