|
|
(18 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. When shared libraries are built, they should be versioned ([http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html see this article for some background]), but sometimes this is not done. This article shows how to deal with both versioned and unversioned libraries.
| | See https://docs.yoctoproject.org/dev-manual/common-tasks.html#working-with-pre-built-libraries |
| | |
| == Versioned Libraries ==
| |
| In this example 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 as follows.
| |
| <pre>
| |
| ├── build-i386
| |
| │ └── libft4222.so.1.2.1.35
| |
| ├── build-x86_64
| |
| │ └── libft4222.so.1.2.1.35
| |
| ├── ftd2xx.h
| |
| ├── libft4222.h
| |
| └── WinTypes.h
| |
| </pre>
| |
| The key steps are as follows
| |
| * The vendor will have licence so add a licence flag
| |
| * Vendor provides a tarball containing libraries so set <tt>SRC_URI</tt> 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.
| |
| * We installing, use the MACHINE override to set source directory within tarball appropriately.
| |
| * 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]]
| |
| * As the vendor likely used the different LDFLAGS from your Yocto build, disable checking by adding <tt>ldflags</tt> to <tt>INSANE_SKIP</tt>
| |
| * Vendor typically ship release builds with debug symbols so disable stripping to prevent packaging errors by setting <tt>INHIBIT_PACKAGE_STRIP</tt> and <tt>INHIBIT_SYSROOT_STRIP</tt>.
| |
| | |
| Complete recipe would look like this.
| |
| | |
| <pre>
| |
| SUMMARY = "FTDI FT4222 Library"
| |
| 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 to ${P} so that files are unpacked into ${S}
| |
| SRC_URI = "http://www.ftdichip.com/Support/SoftwareExamples/${PN}-${PV}.${BUILD_NUMBER}.tgz;subdir=${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"
| |
| | |
| INSANE_SKIP_${PN} = "ldflags"
| |
| INHIBIT_PACKAGE_STRIP = "1"
| |
| INHIBIT_SYSROOT_STRIP = "1"
| |
| | |
| 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>
| |