Message ID | 1578079434-15500-1-git-send-email-pjtexier@koncepto.io |
---|---|
State | Changes Requested |
Headers | show |
Series | [libubootenv] libubootenv: add pkg-config support | expand |
On 03/01/20 20:23, 'Pierre-Jean Texier' via swupdate wrote: > Create a libubootenv.pc file for pkg-config. Allows to use > PKG_CHECK_MODULE in autoconf-based projects or : > > ubootenv_dep = dependency('libubootenv', version : '>= 0.2') > > for meson build system. > > Fixes: > > $: meson build > The Meson build system > Cross C compiler: arm-poky-linux-gnueabi-gcc ... > [...] > Cross dependency libubootenv found: NO (tried pkgconfig) > > With this commit: > > $: meson builld > The Meson build system > Cross C compiler: arm-poky-linux-gnueabi-gcc ... > [...] > Cross dependency libubootenv found: YES 0.2 > Build targets in project: 1 > > Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io> > --- > src/CMakeLists.txt | 12 ++++++++++++ > src/libubootenv.pc.in | 10 ++++++++++ > 2 files changed, 22 insertions(+) > create mode 100644 src/libubootenv.pc.in > > diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt > index 051732b..e3f28ed 100644 > --- a/src/CMakeLists.txt > +++ b/src/CMakeLists.txt > @@ -23,3 +23,15 @@ install (TARGETS ubootenv DESTINATION lib) > install (FILES libuboot.h DESTINATION include) > install (TARGETS fw_printenv DESTINATION bin) > install (TARGETS fw_setenv DESTINATION bin) > + > +# Handle pkg-config files > +set(prefix ${CMAKE_INSTALL_PREFIX}) > +set(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin) > +set(includedir ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME}) This does not seem correct. libubootenv.h is installed in ${PREFIX}/include, but the include directory in .pc is set to include/libubootenv, that means include/libubootenv/libubootenv.h Best regards, Stefano Babic > +set(libdir ${CMAKE_INSTALL_PREFIX}/lib) > + > +configure_file(${CMAKE_SOURCE_DIR}/src/libubootenv.pc.in ${CMAKE_BINARY_DIR}/libubootenv.pc @ONLY) > +set(LIBUBOOTENV_PKG_CONFIG_FILES ${CMAKE_BINARY_DIR}/libubootenv.pc) > +message(STATUS "Generate ${LIBUBOOTENV_PKG_CONFIG_FILES}") > +# Install pkg-config files > +install(FILES ${LIBUBOOTENV_PKG_CONFIG_FILES} DESTINATION lib/pkgconfig) > diff --git a/src/libubootenv.pc.in b/src/libubootenv.pc.in > new file mode 100644 > index 0000000..31806a9 > --- /dev/null > +++ b/src/libubootenv.pc.in > @@ -0,0 +1,10 @@ > +prefix=@prefix@ > +exec_prefix=@exec_prefix@ > +libdir=@libdir@ > +includedir=@includedir@ > + > +Name: libubootenv > +Description: Library to access U-Boot environment > +Version: @VERSION@ > +Libs: -L${libdir} -lubootenv -lz > +Cflags: -I${includedir} >
Hello Stefano, Le 07/01/2020 à 17:12, Stefano Babic a écrit : > This does not seem correct. libubootenv.h is installed in > ${PREFIX}/include, but the include directory in .pc is set to > include/libubootenv, that means include/libubootenv/libubootenv.h Argf, you're indeed right. I will send a v2 to remove the PROJECT_NAME variable. Thanks ! BR Pierre-Jean > > Best regards, > Stefano Babic
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 051732b..e3f28ed 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -23,3 +23,15 @@ install (TARGETS ubootenv DESTINATION lib) install (FILES libuboot.h DESTINATION include) install (TARGETS fw_printenv DESTINATION bin) install (TARGETS fw_setenv DESTINATION bin) + +# Handle pkg-config files +set(prefix ${CMAKE_INSTALL_PREFIX}) +set(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin) +set(includedir ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME}) +set(libdir ${CMAKE_INSTALL_PREFIX}/lib) + +configure_file(${CMAKE_SOURCE_DIR}/src/libubootenv.pc.in ${CMAKE_BINARY_DIR}/libubootenv.pc @ONLY) +set(LIBUBOOTENV_PKG_CONFIG_FILES ${CMAKE_BINARY_DIR}/libubootenv.pc) +message(STATUS "Generate ${LIBUBOOTENV_PKG_CONFIG_FILES}") +# Install pkg-config files +install(FILES ${LIBUBOOTENV_PKG_CONFIG_FILES} DESTINATION lib/pkgconfig) diff --git a/src/libubootenv.pc.in b/src/libubootenv.pc.in new file mode 100644 index 0000000..31806a9 --- /dev/null +++ b/src/libubootenv.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libubootenv +Description: Library to access U-Boot environment +Version: @VERSION@ +Libs: -L${libdir} -lubootenv -lz +Cflags: -I${includedir}
Create a libubootenv.pc file for pkg-config. Allows to use PKG_CHECK_MODULE in autoconf-based projects or : ubootenv_dep = dependency('libubootenv', version : '>= 0.2') for meson build system. Fixes: $: meson build The Meson build system Cross C compiler: arm-poky-linux-gnueabi-gcc ... [...] Cross dependency libubootenv found: NO (tried pkgconfig) With this commit: $: meson builld The Meson build system Cross C compiler: arm-poky-linux-gnueabi-gcc ... [...] Cross dependency libubootenv found: YES 0.2 Build targets in project: 1 Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io> --- src/CMakeLists.txt | 12 ++++++++++++ src/libubootenv.pc.in | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/libubootenv.pc.in