From 2ece2d3e1a0f0b3164f5149e8204bf80cadb3d5d Mon Sep 17 00:00:00 2001 From: Tomas Mlcoch Date: Mon, 7 Apr 2014 13:42:10 +0200 Subject: [PATCH] CMake: Support for build with custom RPM version (CMake now supports RPM_PATH) --- CMakeLists.txt | 36 ++++++++++++++++++++++-------------- README.md | 14 ++++++++++++++ 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a6bb141..e2f1162 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,25 +41,33 @@ include_directories(${GLIB2_INCLUDE_DIRS}) include_directories(${LIBXML2_INCLUDE_DIR}) -# rpm: - -FIND_LIBRARY (RPMDB_LIBRARY NAMES rpmdb) -IF (NOT RPMDB_LIBRARY) - FIND_LIBRARY (RPMDB_LIBRARY NAMES rpm) +IF (RPM_PATH) + SET (RPM_PATH "/home/tmlcoch/git/rpm") + include_directories("${RPM_PATH}/include/") + SET(RPMDB_LIBRARY "${RPM_PATH}/rpmio/.libs/librpmio.so" + "${RPM_PATH}/lib/.libs/librpm.so") + message("Using custom RPM: ${RPMDB_LIBRARY}") +ELSE (RPM_PATH) + # rpm: + FIND_LIBRARY (RPMDB_LIBRARY NAMES rpmdb) IF (NOT RPMDB_LIBRARY) - MESSAGE(FATAL_ERROR "No Rpm library installed") + FIND_LIBRARY (RPMDB_LIBRARY NAMES rpm) + IF (NOT RPMDB_LIBRARY) + MESSAGE(FATAL_ERROR "No Rpm library installed") + ENDIF (NOT RPMDB_LIBRARY) ENDIF (NOT RPMDB_LIBRARY) -ENDIF (NOT RPMDB_LIBRARY) -# rpmio: + # rpmio: + FIND_LIBRARY (RPMIO_LIBRARY NAMES rpmio) + IF (RPMIO_LIBRARY) + SET(RPMDB_LIBRARY ${RPMIO_LIBRARY} ${RPMDB_LIBRARY}) + ELSE (RPMIO_LIBRARY) + MESSAGE(FATAL_ERROR "No Rpmio library installed") + ENDIF (RPMIO_LIBRARY) -FIND_LIBRARY (RPMIO_LIBRARY NAMES rpmio) -IF (RPMIO_LIBRARY) - SET(RPMDB_LIBRARY ${RPMIO_LIBRARY} ${RPMDB_LIBRARY}) -ELSE (RPMIO_LIBRARY) - MESSAGE(FATAL_ERROR "No Rpmio library installed") -ENDIF (RPMIO_LIBRARY) + message("Using system RPM: ${RPMDB_LIBRARY}") +ENDIF (RPM_PATH) # Get package version diff --git a/README.md b/README.md index 58e23a5..0a018a9 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,20 @@ To build the documentation, from the build/ directory: cmake -DCMAKE_BUILD_TYPE:STRING=DEBUG .. && make +## Building from an rpm checkout + +E.g. when you want to try weak and rich dependencies. + + cmake -D RPM_PATH="/home/tmlcoch/git/rpm" .. && make + +**Note:** The RPM must be buit in that directory + +Commands I am using for building of RPM: + + cd /home/tmlcoch/git/rpm + CPPFLAGS='-I/usr/include/nss3/ -I/usr/include/nspr4/' ./autogen.sh --rpmconfigure --with-vendor=redhat --with-external-db --with-lua --with-selinux --with-cap --with-acl --enable-python + make clean && make + ## Build tarball utils/make_tarball.sh [git revision] -- 2.7.4