Search code examples
linuxyocto

Creating simlink from yocto recipe


I'm downloading libs from repository as name.so.version

SRC_URI_x86-64 = "fetch location"

do_install() {
    install -d ${D}${libdir}

    
    for file in ${WORKDIR}/location/lib*;do
        install -m 0644 $file ${D}${libdir}
    done
}

how can I in addition to coping the original files generate symbolic link filename.so to each of the files?

Thanks.


Solution

  • 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}
        done
    
        # 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
        done
    
        # Go back to working directory ${S} or ${WORKDIR}
        cd ${S}
    }