From: Duncan Mac-Vicar P Date: Fri, 26 Oct 2007 13:57:08 +0000 (+0000) Subject: - add cmake support X-Git-Tag: BASE-SuSE-Code-12_1-Branch~308^2~889 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=b420bdb292fad020232509b0db80c154bdd0b03e;p=thirdparty%2Flibsolv.git - add cmake support - add ruby bindings --- diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..7e9beead --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,142 @@ +PROJECT(satsolver) + +# 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}" ) + +#################################################################### +# CONFIGURATION # +#################################################################### + +# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked +SET( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ) + +FIND_PACKAGE(Db43 REQUIRED) +FIND_PACKAGE(EXPAT REQUIRED) + +SET( PACKAGE "satsolver" ) +SET( VERSION "${LIBZYPP_MAJOR}.${LIBZYPP_MINOR}.${LIBZYPP_PATCH}" ) + +SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O3 -Wall" ) +ADD_DEFINITIONS( -D_FILE_OFFSET_BITS=64 ) +ADD_DEFINITIONS( -DVERSION=\\\"${VERSION}\\\" ) + +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "mls solver") +SET(CPACK_PACKAGE_VENDOR "Novell Inc.") +SET(CPACK_PACKAGE_VERSION_MAJOR ${LIBZYPP_MAJOR}) +SET(CPACK_PACKAGE_VERSION_MINOR ${LIBZYPP_MINOR}) +SET(CPACK_PACKAGE_VERSION_PATCH ${LIBZYPP_PATCH}) +SET( CPACK_GENERATOR "TBZ2") +SET( CPACK_SOURCE_GENERATOR "TBZ2") +SET( CPACK_SOURCE_PACKAGE_FILE_NAME "${PACKAGE}-${VERSION}" ) + +# The following components are regex's to match anywhere (unless anchored) +# in absolute path + filename to find files or directories to be excluded +# from source tarball. +SET (CPACK_SOURCE_IGNORE_FILES +#svn files +"\\\\.svn/" +"\\\\.cvsignore$" +# temporary files +"\\\\.swp$" +# backup files +"~$" +# eclipse files +"\\\\.cdtproject$" +"\\\\.cproject$" +"\\\\.project$" +"\\\\.settings/" +# others +"\\\\.#" +"/#" +"/build/" +"/_build/" +"/\\\\.git/" +# used before +"/CVS/" +"/\\\\.libs/" +"/\\\\.deps/" +"\\\\.o$" +"\\\\.lo$" +"\\\\.la$" +"Makefile\\\\.in$" +) + +INCLUDE(CPack) + +#################################################################### + +SET( DOC_INSTALL_DIR + "${CMAKE_INSTALL_PREFIX}/share/doc/packages/${PACKAGE}" + CACHE PATH "The install dir for documentation (default prefix/share/doc/packages/${PACKAGE})" + FORCE +) + +#################################################################### +# INCLUDES # +#################################################################### + +#SET (CMAKE_INCLUDE_DIRECTORIES_BEFORE ON) +INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR} SYSTEM ) + +#################################################################### + +MESSAGE(STATUS "Looking modules in ${CMAKE_MODULE_PATH}") +FIND_PROGRAM(SWIG_EXECUTABLE + NAMES swig-1.3 swig + PATHS ${SWIG_DIR} ${SWIG_DIR}/.. ${SWIG_DIR}/../../bin /usr/bin /usr/local/bin ${CMAKE_INSTALL_PREFIX}/bin +) + +ADD_SUBDIRECTORY(src) +ADD_SUBDIRECTORY(tools) +ADD_SUBDIRECTORY(testsuite) + +IF ( NOT SWIG_EXECUTABLE ) + MESSAGE( FATAL "SWIG not found." ) +ELSE ( NOT SWIG_EXECUTABLE ) + MESSAGE( STATUS "SWIG found at ${SWIG_EXECUTABLE}" ) + ADD_SUBDIRECTORY(bindings) +ENDIF ( NOT SWIG_EXECUTABLE ) + +MESSAGE(STATUS "version: ${VERSION}") + +#################################################################### +# RPM SPEC # +#################################################################### + +MACRO(SPECFILE) + MESSAGE(STATUS "Writing spec file...") + CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/libsatsolver.spec.in ${CMAKE_BINARY_DIR}/package/libsatsolver.spec.in @ONLY) + #MESSAGE(STATUS "I hate you rpm-lint...!!!") + #CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/package/libsatsolver-rpmlint.cmake ${CMAKE_BINARY_DIR}/package/libsatsolver-rpmlintrc @ONLY) +ENDMACRO(SPECFILE) + +SPECFILE() + +ADD_CUSTOM_TARGET( svncheck + COMMAND cd $(CMAKE_SOURCE_DIR) && ! LC_ALL=C svn status --show-updates --quiet | grep -v '^Status against revision' +) + +SET( AUTOBUILD_COMMAND + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/package/*.tar.bz2 + COMMAND ${CMAKE_MAKE_PROGRAM} package_source + COMMAND ${CMAKE_COMMAND} -E copy ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.bz2 ${CMAKE_BINARY_DIR}/package + COMMAND ${CMAKE_COMMAND} -E remove ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.bz2 + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/package/${PACKAGE}.changes" "${CMAKE_BINARY_DIR}/package/${PACKAGE}.changes" +) + +ADD_CUSTOM_TARGET( srcpackage_local + ${AUTOBUILD_COMMAND} +) + +ADD_CUSTOM_TARGET( srcpackage + COMMAND ${CMAKE_MAKE_PROGRAM} svncheck + ${AUTOBUILD_COMMAND} +) diff --git a/VERSION.cmake b/VERSION.cmake new file mode 100644 index 00000000..afd872aa --- /dev/null +++ b/VERSION.cmake @@ -0,0 +1,49 @@ +# ================================================== +# Versioning +# ========== +# +# MAJOR Major number for this branch. +# +# MINOR The most recent interface number this +# library implements. +# +# COMPATMINOR The latest binary compatible minor number +# this library implements. +# +# PATCH The implementation number of the current interface. +# +# +# - The package VERSION will be MAJOR.MINOR.PATCH. +# +# - Libtool's -version-info will be derived from MAJOR, MINOR, PATCH +# and COMPATMINOR (see configure.ac). +# +# - Changing MAJOR always breaks binary compatibility. +# +# - Changing MINOR doesn't break binary compatibility by default. +# Only if COMPATMINOR is changed as well. +# +# +# 1) After branching from TRUNK increment TRUNKs MAJOR and +# start with version `MAJOR.0.0' and also set COMPATMINOR to 0. +# +# 2) Update the version information only immediately before a public release +# of your software. More frequent updates are unnecessary, and only guarantee +# that the current interface number gets larger faster. +# +# 3) If the library source code has changed at all since the last update, +# then increment PATCH. +# +# 4) If any interfaces have been added, removed, or changed since the last +# update, increment MINOR, and set PATCH to 0. +# +# 5) If any interfaces have been added since the last public release, then +# leave COMPATMINOR unchanged. (binary compatible change) +# +# 6) If any interfaces have been removed since the last public release, then +# set COMPATMINOR to MINOR. (binary incompatible change) +# + +SET(LIBSATSOLVER_MAJOR "0") +SET(LIBSATSOLVER_MINOR "0") +SET(LIBSATSOLVER_PATCH "1") \ No newline at end of file diff --git a/cmake/modules/FindDb43.cmake b/cmake/modules/FindDb43.cmake new file mode 100644 index 00000000..cc8d6138 --- /dev/null +++ b/cmake/modules/FindDb43.cmake @@ -0,0 +1,28 @@ + +if(DB43_INCLUDE_DIR AND DB43_LIBRARY) + # Already in cache, be silent + set(DB43_FIND_QUIETLY TRUE) +endif(DB43_INCLUDE_DIR AND DB43_LIBRARY) + +set(DB43_LIBRARY) +set(DB43_INCLUDE_DIR) + +FIND_PATH(DB43_INCLUDE_DIR db43/db.h + /usr/include + /usr/local/include +) + +FIND_LIBRARY(DB43_LIBRARY NAMES db-4.3 + PATHS + /usr/lib + /usr/local/lib +) + +if(DB43_INCLUDE_DIR AND DB43_LIBRARY) + MESSAGE( STATUS "db-4.3 found: includes in ${DB43_INCLUDE_DIR}, library in ${DB43_LIBRARY}") + set(DB43_FOUND TRUE) +else(DB43_INCLUDE_DIR AND DB43_LIBRARY) + MESSAGE( STATUS "db-4.3 not found") +endif(DB43_INCLUDE_DIR AND DB43_LIBRARY) + +MARK_AS_ADVANCED(DB43_INCLUDE_DIR DB43_LIBRARY) \ No newline at end of file diff --git a/configure.in b/configure.in index 87a8a95e..c185222c 100644 --- a/configure.in +++ b/configure.in @@ -51,6 +51,11 @@ AM_PROG_LIBTOOL # This isn't a program, but it doesn't fit anywhere else... AC_FUNC_ALLOCA +dnl *********************** +dnl *** swig *** +dnl *********************** + +AC_PROG_SWIG(1.3.0) dnl *********************** diff --git a/libsatsolver.spec b/libsatsolver.spec.in similarity index 97% rename from libsatsolver.spec rename to libsatsolver.spec.in index 02ff9ec9..38ee5a38 100644 --- a/libsatsolver.spec +++ b/libsatsolver.spec.in @@ -1,5 +1,5 @@ Name: libsatsolver -Version: 0.0.1 +Version: @VERSION@ Release: 1 License: BSD Url: http://svn.opensuse.org/svn/zypp/trunk/sat-solver diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000..10e542bc --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,5 @@ + +SET(libsatsolver_SRCS bitmap.c poolarch.c poolid.c solver.c source_solv.c +evr.c pool.c queue.c source.c util.c) + +ADD_LIBRARY(satsolver STATIC ${libsatsolver_SRCS}) \ No newline at end of file diff --git a/src/pool.h b/src/pool.h index 1a5ec5dd..e48e5b05 100644 --- a/src/pool.h +++ b/src/pool.h @@ -17,10 +17,11 @@ extern "C" { #include "queue.h" // bool +#ifndef SWIG #ifndef __cplusplus -typedef _Bool bool; + typedef _Bool bool; +#endif #endif - // see initpool_data[] in pool.c /* well known ids */ @@ -75,8 +76,11 @@ struct _Pool { Solvable *solvables; int nsolvables; +#ifdef SWIG + _Bool promoteepoch; +#else bool promoteepoch; - +#endif Id *id2arch; /* map arch ids to scores */ Id lastarch; /* last valid entry in id2arch */ diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 00000000..389c09f3 --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,44 @@ + +SET(rpmdb2solv_SOURCES + rpmdb2solv.c + source_rpmdb.h + source_rpmdb.c + source_write.c +) + +ADD_EXECUTABLE( rpmdb2solv ${rpmdb2solv_SOURCES} ) +TARGET_LINK_LIBRARIES( rpmdb2solv satsolver ${DB43_LIBRARY}) + +SET(rpmmd2solv_SOURCES rpmmd2solv.c source_rpmmd.h source_rpmmd.c source_write.c ) +ADD_EXECUTABLE( rpmmd2solv ${rpmmd2solv_SOURCES} ) +TARGET_LINK_LIBRARIES( rpmmd2solv satsolver ${EXPAT_LIBRARY}) + +SET(helix2solv_SOURCES helix2solv.c source_helix.h source_helix.c source_write.c ) +ADD_EXECUTABLE( helix2solv ${helix2solv_SOURCES} ) +TARGET_LINK_LIBRARIES( helix2solv satsolver ${EXPAT_LIBRARY}) + +SET(susetags2solv_SOURCES susetags2solv.c source_susetags.h source_susetags.c source_write.c) +ADD_EXECUTABLE( susetags2solv ${susetags2solv_SOURCES} ) +TARGET_LINK_LIBRARIES( susetags2solv satsolver) + +SET(patchxml2solv_SOURCES patchxml2solv.c source_patchxml.h source_patchxml.c source_write.c) +ADD_EXECUTABLE( patchxml2solv ${patchxml2solv_SOURCES} ) +TARGET_LINK_LIBRARIES( patchxml2solv satsolver ${EXPAT_LIBRARY}) + + +SET(content2solv_SOURCES + content2solv.c + source_content.h + source_content.c + source_write.c) +ADD_EXECUTABLE( content2solv ${content2solv_SOURCES} ) +TARGET_LINK_LIBRARIES( content2solv satsolver) + + +SET(dumpsolv_SOURCES dumpsolv.c) +ADD_EXECUTABLE( dumpsolv ${dumpsolv_SOURCES} ) +TARGET_LINK_LIBRARIES( dumpsolv satsolver) + +SET(mergesolv_SOURCES mergesolv.c source_write.c) +ADD_EXECUTABLE( mergesolv ${mergesolv_SOURCES} ) +TARGET_LINK_LIBRARIES( mergesolv satsolver) \ No newline at end of file