TipsAndTricks/Packaging Prebuilt Libraries: Difference between revisions
From Yocto Project
Jump to navigationJump to search
Henry Bruce (talk | contribs) No edit summary |
Henry Bruce (talk | contribs) No edit summary |
||
Line 2: | Line 2: | ||
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 | 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. | * 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. | * 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 appropriately. | * We installing, use the MACHINE override to set source directory 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 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 | * 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> | <pre> | ||
SUMMARY = "FTDI FT4222 Library" | SUMMARY = "FTDI FT4222 Library" | ||
SECTION = "libs" | SECTION = "libs" | ||
LICENSE_FLAGS = "ftdi" | LICENSE_FLAGS = "ftdi" | ||
Line 33: | Line 32: | ||
MACHINE_DIR_edison = "build-i386" | MACHINE_DIR_edison = "build-i386" | ||
MACHINE_DIR_qemux86 = "build-i386" | MACHINE_DIR_qemux86 = "build-i386" | ||
INSANE_SKIP_${PN} = "ldflags" | |||
INHIBIT_PACKAGE_STRIP = "1" | |||
INHIBIT_SYSROOT_STRIP = "1" | |||
do_install () { | do_install () { |
Revision as of 00:06, 10 September 2016
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 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
- The vendor will have licence so add a licence flag
- 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.
- We installing, use the MACHINE override to set source directory appropriately.
- As vendor provides versioned libraries, we can use so_oeinstall to install shared library and creates symbolic links. If vendor does not do this, consult the Packaging Nonversioned Library article
- As the vendor likely used the different LDFLAGS from your Yocto build, disable checking by adding ldflags to INSANE_SKIP
- Vendor typically ship release builds with debug symbols so disable stripping to prevent packaging errors by setting INHIBIT_PACKAGE_STRIP and INHIBIT_SYSROOT_STRIP.
Complete recipe would look like this.
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 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" 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} }