userland: Fix install prefix and generate pkgconfigs

several userspace libraries like libepoxy poke for pkgconfigs ( .pc )
files to detect egl support, and comes out to fail in configure stage,
one of the patches now adds support to generate .pc files for some known
cases. it could be further extended if needed for other libraries too

Secondly, the default CMAKE_INSTALL_PREFIX is /opt/vc but in OE we use
proper /usr so lets make this change as well, it simplifies do_install()

.so are not versioned so we need to grapple with OE's defaults of
expecting versioned .so files.

Adjust packages for -dev package such that it can automatically package
pkgconfig files and inherit pkgconfig because in cmake code we are not
looking for pkgconfig so we need the dependency also put in place for
consistent builds

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj 2015-10-03 16:37:34 +00:00 committed by Andrei Gherzan
parent 7cff0a0a9e
commit dba20cbb0a
3 changed files with 152 additions and 12 deletions

View File

@ -0,0 +1,29 @@
From 05554d8486050546efc3c0605015786c8b267d19 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 9 Aug 2015 23:58:17 -0700
Subject: [PATCH 1/2] set VMCS_INSTALL_PREFIX to /usr
in OE we dont use /opt/vc but standard prefix
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Submitted
makefiles/cmake/vmcs.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/makefiles/cmake/vmcs.cmake b/makefiles/cmake/vmcs.cmake
index 0f8641b..e9d576d 100644
--- a/makefiles/cmake/vmcs.cmake
+++ b/makefiles/cmake/vmcs.cmake
@@ -10,7 +10,7 @@ INCLUDE(CPack)
if (ANDROID)
SET(VMCS_INSTALL_PREFIX "/vendor/brcm/islands" CACHE PATH "Prefix prepended to install directories" FORCE)
else()
- SET(VMCS_INSTALL_PREFIX "/opt/vc" CACHE PATH "Prefix prepended to install directories" FORCE)
+ SET(VMCS_INSTALL_PREFIX "/usr" CACHE PATH "Prefix prepended to install directories" FORCE)
endif()
SET(CMAKE_INSTALL_PREFIX "${VMCS_INSTALL_PREFIX}" CACHE INTERNAL "Prefix
--
2.1.4

View File

@ -0,0 +1,114 @@
From ef43e09c2d13b88c2e92cffc94b68003afcb1f13 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 9 Aug 2015 23:59:32 -0700
Subject: [PATCH 2/2] cmake: generate and install pkgconfig files
many packages expect packageconfig support especially for detecting EGL
libraries. This patch helps in compiling those packages on RPi
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Submitted
CMakeLists.txt | 10 +++++++++-
pkgconfig/bcm_host.pc.in | 10 ++++++++++
pkgconfig/egl.pc.in | 12 ++++++++++++
pkgconfig/glesv2.pc.in | 12 ++++++++++++
pkgconfig/vg.pc.in | 11 +++++++++++
5 files changed, 54 insertions(+), 1 deletion(-)
create mode 100644 pkgconfig/bcm_host.pc.in
create mode 100644 pkgconfig/egl.pc.in
create mode 100644 pkgconfig/glesv2.pc.in
create mode 100644 pkgconfig/vg.pc.in
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d8f776c..f15dc2b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -105,6 +105,14 @@ set(vmcs_host_apps_VERSION_MAJOR 1)
set(vmcs_host_apps_VERSION_MINOR 0)
include_directories("${PROJECT_BINARY_DIR}")
-
+include(FindPkgConfig QUIET)
+if(PKG_CONFIG_FOUND)
+ # Produce a pkg-config file
+ foreach(PCFILE bcm_host.pc egl.pc glesv2.pc vg.pc)
+ configure_file("pkgconfig/${PCFILE}.in" "${PCFILE}" @ONLY)
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PCFILE}"
+ DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
+ endforeach()
+endif()
# Remove cache entry, if one added by command line
unset(KHRONOS_EGL_PLATFORM CACHE)
diff --git a/pkgconfig/bcm_host.pc.in b/pkgconfig/bcm_host.pc.in
new file mode 100644
index 0000000..c7237c5
--- /dev/null
+++ b/pkgconfig/bcm_host.pc.in
@@ -0,0 +1,10 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: bcm_host
+Description: Broadcom VideoCore host API library
+Version: 1
+Libs: -L${libdir} -lbcm_host -lvcos -lvchiq_arm -pthread
+Cflags: -I${includedir} -I${includedir}/interface/vmcs_host/linux -I${includedir}/interface/vcos/pthreads -DUSE_VCHIQ_ARM
diff --git a/pkgconfig/egl.pc.in b/pkgconfig/egl.pc.in
new file mode 100644
index 0000000..4e3d6ac
--- /dev/null
+++ b/pkgconfig/egl.pc.in
@@ -0,0 +1,12 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: EGL
+Description: Fake EGL package for RPi
+Version: 10
+Requires: bcm_host
+Libs: -L${libdir} -lEGL
+Cflags: -I${includedir}
+
diff --git a/pkgconfig/glesv2.pc.in b/pkgconfig/glesv2.pc.in
new file mode 100644
index 0000000..5900225
--- /dev/null
+++ b/pkgconfig/glesv2.pc.in
@@ -0,0 +1,12 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: GLESv2
+Description: Fake GL ES 2 package for RPi
+Version: 10
+Requires: bcm_host
+Libs: -L${libdir} -lGLESv2
+Cflags: -I${includedir}
+
diff --git a/pkgconfig/vg.pc.in b/pkgconfig/vg.pc.in
new file mode 100644
index 0000000..8c39c98
--- /dev/null
+++ b/pkgconfig/vg.pc.in
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: OpenVG
+Description: Fake OpenVG package for RPi
+Version: 10
+Requires: bcm_host
+Libs: -L${libdir} -lOpenVG
+Cflags: -I${includedir}
--
2.1.4

View File

@ -21,31 +21,28 @@ SRC_URI = "\
file://0001-fix-gcc-5.x-inlines.patch \ file://0001-fix-gcc-5.x-inlines.patch \
file://0002-fix-musl-build.patch \ file://0002-fix-musl-build.patch \
file://0003-fix-alloc-size-uninitialized.patch \ file://0003-fix-alloc-size-uninitialized.patch \
file://0002-set-VMCS_INSTALL_PREFIX-to-usr.patch \
file://0003-cmake-generate-and-install-pkgconfig-files.patch \
" "
S = "${WORKDIR}/git" S = "${WORKDIR}/git"
inherit cmake inherit cmake pkgconfig
EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DCMAKE_EXE_LINKER_FLAGS='-Wl,--no-as-needed'" EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DCMAKE_EXE_LINKER_FLAGS='-Wl,--no-as-needed'"
CFLAGS_append = " -fPIC" CFLAGS_append = " -fPIC"
# The compiled binaries don't provide sonames. # Shared libs from userland package build aren't versioned, so we need
SOLIBS = "${SOLIBSDEV}" # to force the .so files into the runtime package (and keep them
# out of -dev package).
do_install_append() { FILES_SOLIBSDEV = ""
mkdir -p ${D}/${prefix}
mv ${D}/opt/vc/* ${D}/${prefix}
rm -rf ${D}/opt
}
FILES_${PN} += " \ FILES_${PN} += " \
${libdir}/*${SOLIBS} \ ${libdir}/*.so \
${libdir}/plugins" ${libdir}/plugins"
FILES_${PN}-dev = "${includedir} \ FILES_${PN}-dev += "${includedir} \
${prefix}/src" ${prefix}/src"
FILES_${PN}-doc += "${datadir}/install" FILES_${PN}-doc += "${datadir}/install"
FILES_${PN}-dbg += "${libdir}/plugins/.debug" FILES_${PN}-dbg += "${libdir}/plugins/.debug"
PACKAGE_ARCH = "${MACHINE_ARCH}" PACKAGE_ARCH = "${MACHINE_ARCH}"