libsolv: use GNUInstallDirs

Message ID 20190401112221.29128-1-ross.burton@intel.com
State Accepted
Commit 7c7d8ce6fe54e239374a6a04c007b4aa0712ba33
Headers show
Series
  • libsolv: use GNUInstallDirs
Related show

Commit Message

Ross Burton April 1, 2019, 11:22 a.m.
Backport a patch from upstream to use GNUInstallDirs instead of hand-coded path
logic, so we have proper control over where files end up.

Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 .../libsolv/0001-build-use-GNUInstallDirs.patch    | 188 +++++++++++++++++++++
 meta/recipes-extended/libsolv/libsolv_0.7.3.bb     |   3 +-
 2 files changed, 190 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/libsolv/libsolv/0001-build-use-GNUInstallDirs.patch

-- 
2.11.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/recipes-extended/libsolv/libsolv/0001-build-use-GNUInstallDirs.patch b/meta/recipes-extended/libsolv/libsolv/0001-build-use-GNUInstallDirs.patch
new file mode 100644
index 00000000000..75ef1500524
--- /dev/null
+++ b/meta/recipes-extended/libsolv/libsolv/0001-build-use-GNUInstallDirs.patch
@@ -0,0 +1,188 @@ 
+Backport a patch from upstream to use GNUInstallDirs instead of
+hand-coded path logic, so we have proper control over where files end up.
+
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+From b6c9df4c686975ce5009d09dac706a4e83f02a31 Mon Sep 17 00:00:00 2001
+From: Igor Gnatenko <i.gnatenko.brain@gmail.com>
+Date: Mon, 2 Jul 2018 12:56:41 +0100
+Subject: [PATCH] build: use GNUInstallDirs
+
+Fixes: #128
+Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
+---
+ CMakeLists.txt               | 34 +++++++---------------------------
+ README                       |  2 +-
+ doc/CMakeLists.txt           |  4 ++--
+ examples/solv/CMakeLists.txt |  2 +-
+ ext/CMakeLists.txt           |  8 ++++----
+ libsolv.pc.in                |  4 ++--
+ libsolvext.pc.in             |  4 ++--
+ src/CMakeLists.txt           |  8 ++++----
+ tools/CMakeLists.txt         |  3 +--
+ 9 files changed, 24 insertions(+), 45 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1deef57d..7e9ffa9b 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,6 +1,6 @@
+ PROJECT (libsolv)
+ 
+-CMAKE_MINIMUM_REQUIRED (VERSION 2.4)
++CMAKE_MINIMUM_REQUIRED (VERSION 2.8.5)
+ 
+ OPTION (ENABLE_STATIC "Build a static version of the libraries?" OFF)
+ OPTION (DISABLE_SHARED "Do not build a shared version of the libraries?" OFF)
+@@ -38,34 +38,14 @@ OPTION (ENABLE_ZCHUNK_COMPRESSION "Build with zchunk compression support?" OFF)
+ OPTION (WITH_SYSTEM_ZCHUNK "Use system zchunk library?" OFF)
+ OPTION (WITH_LIBXML2  "Build with libxml2 instead of libexpat?" OFF)
+ 
+-# Library
+-IF (DEFINED LIB)
+-  SET (LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIB}")
+-ELSE (DEFINED  LIB)
+-  IF (CMAKE_SIZEOF_VOID_P MATCHES "8")
+-    SET (LIB_SUFFIX "64")
+-  ENDIF (CMAKE_SIZEOF_VOID_P MATCHES "8")
+-  SET (LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
+-ENDIF (DEFINED  LIB)
+-MESSAGE (STATUS "Libraries will be installed in ${LIB_INSTALL_DIR}")
+-# Library
+-IF (DEFINED INCLUDE)
+-  SET (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${INCLUDE}")
+-else (DEFINED INCLUDE)
+-  SET (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include")
+-ENDIF (DEFINED  INCLUDE)
+-MESSAGE (STATUS "Header files will be installed in ${INCLUDE_INSTALL_DIR}")
+-SET (BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
+-IF (NOT MAN_INSTALL_DIR)
+-SET (MAN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/man")
+-IF (IS_DIRECTORY "${CMAKE_INSTALL_PREFIX}/man"  AND NOT IS_DIRECTORY "${CMAKE_INSTALL_PREFIX}/share/man")
+-  SET (MAN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/man")
+-ENDIF (IS_DIRECTORY "${CMAKE_INSTALL_PREFIX}/man"  AND NOT IS_DIRECTORY "${CMAKE_INSTALL_PREFIX}/share/man")
+-ENDIF (NOT MAN_INSTALL_DIR)
+-MESSAGE(STATUS "Man pages will be installed in ${MAN_INSTALL_DIR}")
++include (GNUInstallDirs)
++message (STATUS "Libraries will be installed in ${CMAKE_INSTALL_FULL_LIBDIR}")
++message (STATUS "Header files will be installed in ${CMAKE_INSTALL_FULL_INCLUDEDIR}")
++message (STATUS "Binaries will be installed in ${CMAKE_INSTALL_FULL_BINDIR}")
++message (STATUS "Man pages will be installed in ${CMAKE_INSTALL_FULL_MANDIR}")
+ 
+ IF (NOT PKGCONFIG_INSTALL_DIR)
+-  SET (PKGCONFIG_INSTALL_DIR ${LIB_INSTALL_DIR}/pkgconfig)
++  SET (PKGCONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+ ENDIF (NOT PKGCONFIG_INSTALL_DIR)
+ ####################################################################
+ # CONFIGURATION                                                    #
+diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
+index 66011b48..ed38274e 100644
+--- a/doc/CMakeLists.txt
++++ b/doc/CMakeLists.txt
+@@ -48,8 +48,8 @@ STRING(REGEX REPLACE "([^;]+)" "gen/\\1" libsolv_MANPAGES3 "${libsolv_MANPAGES3}
+ 
+ INSTALL(FILES
+     ${libsolv_MANPAGES3}
+-    DESTINATION "${MAN_INSTALL_DIR}/man3")
++    DESTINATION "${CMAKE_INSTALL_MANDIR}/man3")
+ 
+ INSTALL(FILES
+     ${libsolv_MANPAGES1}
+-    DESTINATION "${MAN_INSTALL_DIR}/man1")
++    DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
+diff --git a/examples/solv/CMakeLists.txt b/examples/solv/CMakeLists.txt
+index 41f45f74..0f3bd477 100644
+--- a/examples/solv/CMakeLists.txt
++++ b/examples/solv/CMakeLists.txt
+@@ -25,5 +25,5 @@ TARGET_LINK_LIBRARIES (solv libsolvext libsolv ${SYSTEM_LIBRARIES})
+ 
+ INSTALL(TARGETS
+     solv
+-    DESTINATION ${BIN_INSTALL_DIR})
++    DESTINATION ${CMAKE_INSTALL_BINDIR})
+ 
+diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt
+index edc2b9f9..6dd28b1a 100644
+--- a/ext/CMakeLists.txt
++++ b/ext/CMakeLists.txt
+@@ -145,14 +145,14 @@ ENDIF (DISABLE_SHARED)
+ 
+ SET_TARGET_PROPERTIES(libsolvext PROPERTIES OUTPUT_NAME "solvext")
+ SET_TARGET_PROPERTIES(libsolvext PROPERTIES SOVERSION ${LIBSOLVEXT_SOVERSION})
+-SET_TARGET_PROPERTIES(libsolvext PROPERTIES INSTALL_NAME_DIR ${LIB_INSTALL_DIR})
++SET_TARGET_PROPERTIES(libsolvext PROPERTIES INSTALL_NAME_DIR ${CMAKE_INSTALL_LIBDIR})
+ 
+-INSTALL (FILES ${libsolvext_HEADERS} DESTINATION "${INCLUDE_INSTALL_DIR}/solv")
+-INSTALL (TARGETS libsolvext LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} RUNTIME DESTINATION bin)
++INSTALL (FILES ${libsolvext_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/solv")
++INSTALL (TARGETS libsolvext LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+ 
+ IF (ENABLE_STATIC AND NOT DISABLE_SHARED)
+ ADD_LIBRARY (libsolvext_static STATIC ${libsolvext_SRCS})
+ SET_TARGET_PROPERTIES(libsolvext_static PROPERTIES OUTPUT_NAME "solvext")
+ SET_TARGET_PROPERTIES(libsolvext_static PROPERTIES SOVERSION ${LIBSOLVEXT_SOVERSION})
+-INSTALL (TARGETS libsolvext_static LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
++INSTALL (TARGETS libsolvext_static LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ ENDIF (ENABLE_STATIC AND NOT DISABLE_SHARED)
+diff --git a/libsolv.pc.in b/libsolv.pc.in
+index 40a86230..766146c5 100644
+--- a/libsolv.pc.in
++++ b/libsolv.pc.in
+@@ -1,5 +1,5 @@
+-libdir=@LIB_INSTALL_DIR@
+-includedir=@INCLUDE_INSTALL_DIR@
++libdir=@CMAKE_INSTALL_FULL_LIBDIR@
++includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
+ 
+ Name: libsolv
+ Description: Library for solving packages
+diff --git a/libsolvext.pc.in b/libsolvext.pc.in
+index d48b6fab..d0078461 100644
+--- a/libsolvext.pc.in
++++ b/libsolvext.pc.in
+@@ -1,5 +1,5 @@
+-libdir=@LIB_INSTALL_DIR@
+-includedir=@INCLUDE_INSTALL_DIR@
++libdir=@CMAKE_INSTALL_FULL_LIBDIR@
++includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
+ 
+ Name: libsolvext
+ Description: Library for reading repositories
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 2e32968e..03ea9119 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -42,14 +42,14 @@ ENDIF (DISABLE_SHARED)
+ 
+ SET_TARGET_PROPERTIES(libsolv PROPERTIES OUTPUT_NAME "solv")
+ SET_TARGET_PROPERTIES(libsolv PROPERTIES SOVERSION ${LIBSOLV_SOVERSION})
+-SET_TARGET_PROPERTIES(libsolv PROPERTIES INSTALL_NAME_DIR ${LIB_INSTALL_DIR})
++SET_TARGET_PROPERTIES(libsolv PROPERTIES INSTALL_NAME_DIR ${CMAKE_INSTALL_LIBDIR})
+ 
+-INSTALL (FILES ${libsolv_HEADERS} DESTINATION "${INCLUDE_INSTALL_DIR}/solv")
+-INSTALL (TARGETS libsolv LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} RUNTIME DESTINATION bin)
++INSTALL (FILES ${libsolv_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/solv")
++INSTALL (TARGETS libsolv LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+ 
+ IF (ENABLE_STATIC AND NOT DISABLE_SHARED)
+ ADD_LIBRARY (libsolv_static STATIC ${libsolv_SRCS})
+ SET_TARGET_PROPERTIES(libsolv_static PROPERTIES OUTPUT_NAME "solv")
+ SET_TARGET_PROPERTIES(libsolv_static PROPERTIES SOVERSION ${LIBSOLV_SOVERSION})
+-INSTALL (TARGETS libsolv_static LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
++INSTALL (TARGETS libsolv_static LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ ENDIF (ENABLE_STATIC AND NOT DISABLE_SHARED)
+diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
+index 802dc500..0d677f69 100644
+--- a/tools/CMakeLists.txt
++++ b/tools/CMakeLists.txt
+@@ -110,5 +110,4 @@ TARGET_LINK_LIBRARIES (testsolv libsolvext libsolv ${SYSTEM_LIBRARIES})
+ ADD_EXECUTABLE (repo2solv repo2solv.c )
+ TARGET_LINK_LIBRARIES (repo2solv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES})
+ 
+-INSTALL (TARGETS ${tools_list} DESTINATION ${BIN_INSTALL_DIR})
+-
++INSTALL (TARGETS ${tools_list} DESTINATION ${CMAKE_INSTALL_BINDIR})
+-- 
+2.11.0
+
diff --git a/meta/recipes-extended/libsolv/libsolv_0.7.3.bb b/meta/recipes-extended/libsolv/libsolv_0.7.3.bb
index 3fe6f2c20ae..70c8dbc2e3b 100644
--- a/meta/recipes-extended/libsolv/libsolv_0.7.3.bb
+++ b/meta/recipes-extended/libsolv/libsolv_0.7.3.bb
@@ -9,6 +9,7 @@  DEPENDS = "expat zlib"
 
 SRC_URI = "git://github.com/openSUSE/libsolv.git \
            file://0001-solver_solve-only-disfavor-recommends-if-there-are-a.patch \
+           file://0001-build-use-GNUInstallDirs.patch \
 "
 
 SRCREV = "dc7d0f1c3113f2c8217563166906bef3eb5d1ee1"
@@ -21,7 +22,7 @@  inherit cmake
 PACKAGECONFIG ??= "rpm"
 PACKAGECONFIG[rpm] = "-DENABLE_RPMMD=ON -DENABLE_RPMDB=ON,,rpm"
 
-EXTRA_OECMAKE = "-DLIB=${baselib} -DMULTI_SEMANTICS=ON -DENABLE_COMPLEX_DEPS=ON"
+EXTRA_OECMAKE = "-DMULTI_SEMANTICS=ON -DENABLE_COMPLEX_DEPS=ON"
 
 PACKAGES =+ "${PN}-tools ${PN}ext"