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 1: | Line 1: | ||
Some library vendors do not release source code for their software but do release pre-built binaries. This | 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. | ||
In | == 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 | * The vendor will have licence so add a licence flag | ||
* Vendor provides a tarball containing libraries so set <tt>SRC_URI</tt> appropriately. | * Vendor provides a tarball containing libraries so set <tt>SRC_URI</tt> appropriately. | ||
Line 21: | Line 32: | ||
# BUILD_NUMBER is set to build number of libft4222 release tarball | # BUILD_NUMBER is set to build number of libft4222 release tarball | ||
# Set subdir variable so that files are unpacked into ${S} | # 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 = "http://www.ftdichip.com/Support/SoftwareExamples/${PN}-${PV}.${BUILD_NUMBER}.tgz;subdir= | |||
SRC_URI[md5sum] = "c5bc189fb5b167daf662ff81c66cde55" | SRC_URI[md5sum] = "c5bc189fb5b167daf662ff81c66cde55" | ||
SRC_URI[sha256sum] = "df03e50f4a205474eaacadcdb59dc602237e95d48008ede8fc2d1f2493e54845" | SRC_URI[sha256sum] = "df03e50f4a205474eaacadcdb59dc602237e95d48008ede8fc2d1f2493e54845" |
Revision as of 21:54, 20 September 2016
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 (see this article for some background), but sometimes this is not done. This article shows how to deal with both versioned and unversioned 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.
├── build-i386 │ └── libft4222.so.1.2.1.35 ├── build-x86_64 │ └── libft4222.so.1.2.1.35 ├── ftd2xx.h ├── libft4222.h └── WinTypes.h
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 within tarball 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 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} }