TipsAndTricks/Packaging Prebuilt Libraries: Difference between revisions

From Yocto Project
Jump to navigationJump to search
(Created page with "Some library vendors do not release source code for their software but do release pre-built binaries. This articel shows how to deal with such libraries. In the example below...")
 
(Keeping only link to official docs)
 
(24 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Some library vendors do not release source code for their software but do release pre-built binaries. This articel shows how to deal with such libraries.
See https://docs.yoctoproject.org/dev-manual/common-tasks.html#working-with-pre-built-libraries
 
In the example below we work with libraries for the FT4222 USB I/O chip. Libraries are built for x86 32 and 64bit architectures and packaged in zip file. The key steps are as follows
* Vendor provides a tarball containing libraries so set SRC_URI appropriately. 
* Set COMPATIBLE_MACHINE so that recipe cannot be be used with an unsupported architectures. In this example we support Minnowboard Max (32 and 64bit), Intel Edison and qemux86.
* Use the MACHINE override to set source directory for each machine.
* As vendor provides versioned libraries, we can use <tt>so_oeinstall</tt> to install shared library and creates symbolic links. If vendor does not do this, consult the [[TipsAndTricks/PackagingNonversionedLibrary | Packaging Nonversioned Library article]]
* This vendor does not strip debug symbols. If they did, recipe must disable stripping in packaging task as follows
INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_SYSROOT_STRIP = "1"
 
<pre>
SUMMARY = "FTDI FT4222 Library"
AUTHOR = "Henry Bruce"
SECTION = "libs"
LICENSE_FLAGS = "ftdi"
LICENSE = "CLOSED"
 
COMPATIBLE_MACHINE = "intel-corei7-64|intel-core2-32|edison|qemux86"
 
# BUILD_NUMBER is set to build number of libft4222 release tarball
# Set subdir variable so that files are unpacked unto ${S}
BUILD_NUMBER = "35"
PR = "r${BUILD_NUMBER}"
SRC_URI = "http://www.ftdichip.com/Support/SoftwareExamples/${PN}-${PV}.${BUILD_NUMBER}.tgz;subdir=${PN}-${PV}"
SRC_URI[md5sum] = "c5bc189fb5b167daf662ff81c66cde55"
SRC_URI[sha256sum] = "df03e50f4a205474eaacadcdb59dc602237e95d48008ede8fc2d1f2493e54845"
 
MACHINE_DIR_intel-corei7-64 = "build-x86_64"
MACHINE_DIR_intel-core2-32 = "build-i386"
MACHINE_DIR_edison = "build-i386"
MACHINE_DIR_qemux86 = "build-i386"
 
do_install () {
install -m 0755 -d ${D}${libdir}
oe_soinstall ${S}/${MACHINE_DIR}/libft4222.so.${PV}.${BUILD_NUMBER} ${D}${libdir}
 
install -m 0755 -d ${D}${includedir}
install -m 0755 ${S}/*.h ${D}${includedir}
}
</pre>

Latest revision as of 07:17, 4 February 2022