#note: DISTRO_BINARY_COMPAT and DISTRO_FILE_PREFIX are visible here, exported in 2createpackages.
#140117 xARCHDIR, ARCHDIR and DISTRO_ARCHDIR_SYMLINKS exported in 2createpackages. 
#140117 note, 2createpackages may move /lib, /usr/lib, /usr/bin in template to ARCHDIR subdir.

#to support apps compiled for older x264...
if [ "$xARCHDIR" ];then #140117
 FNDLIB="`find usr/lib/${ARCHDIR} -maxdepth 1 -type f -name 'libx264.so.*' | tail -n 1`"
 if [ "$FNDLIB" ];then
  BASELIB="`basename $FNDLIB`"
  BASENUM="`echo -n "$BASELIB" | rev | cut -f 1 -d '.' | rev`" #ex: libx264.so.115 becomes 115
  if vercmp ${BASENUM} gt 116;then
   ln -s $BASELIB usr/lib/${ARCHDIR}/libx264.so.116
  fi
  if vercmp ${BASENUM} gt 105;then
   ln -s $BASELIB usr/lib/${ARCHDIR}/libx264.so.105
  fi
  if vercmp ${BASENUM} gt 94;then
   ln -s $BASELIB usr/lib/${ARCHDIR}/libx264.so.94
  fi
  if vercmp ${BASENUM} gt 98;then
   ln -s $BASELIB usr/lib/${ARCHDIR}/libx264.so.98
  fi
 fi
fi
FNDLIB="`find usr/lib -maxdepth 1 -type f -name 'libx264.so.*' | tail -n 1`"
if [ "$FNDLIB" ];then
 BASELIB="`basename $FNDLIB`"
 BASENUM="`echo -n "$BASELIB" | rev | cut -f 1 -d '.' | rev`" #ex: libx264.so.115 becomes 115
 if vercmp ${BASENUM} gt 116;then
  ln -s $BASELIB usr/lib/libx264.so.116
 fi
 if vercmp ${BASENUM} gt 105;then
  ln -s $BASELIB usr/lib/libx264.so.105
 fi
 if vercmp ${BASENUM} gt 94;then
  ln -s $BASELIB usr/lib/libx264.so.94
 fi
 if vercmp ${BASENUM} gt 98;then
  ln -s $BASELIB usr/lib/libx264.so.98
 fi
fi
