Try this:
do_install() {
install -d ${D}${libdir}
# Install all libraries into the image folder
for file in ${WORKDIR}/location/lib*; do
install -m 0644 $file ${D}${libdir}
# Change directory to the image folder
cd ${D}${libdir}
for libfile in lib*; do
# Strip the version
stripped_libversion=$(echo $libfile | sed 's/\.so.*/.so/')
ln -sf $libfile $stripped_libversion