Author: dmacvicar Date: Fri Oct 26 15:57:08 2007 New Revision: 7649 URL: http://svn.opensuse.org/viewcvs/zypp?rev=7649&view=rev Log: - add cmake support - add ruby bindings Added: trunk/sat-solver/CMakeLists.txt trunk/sat-solver/VERSION.cmake trunk/sat-solver/bindings/ trunk/sat-solver/bindings/CMakeLists.txt trunk/sat-solver/bindings/Makefile.am trunk/sat-solver/bindings/ruby/ trunk/sat-solver/bindings/ruby/CMakeLists.txt trunk/sat-solver/bindings/ruby/ruby.i trunk/sat-solver/bindings/ruby/satsolver.rb trunk/sat-solver/bindings/satsolver.i trunk/sat-solver/cmake/ trunk/sat-solver/cmake/modules/ trunk/sat-solver/cmake/modules/FindDb43.cmake trunk/sat-solver/libsatsolver.spec.in - copied, changed from r7645, trunk/sat-solver/libsatsolver.spec trunk/sat-solver/src/CMakeLists.txt trunk/sat-solver/testsuite/CMakeLists.txt trunk/sat-solver/tools/CMakeLists.txt Removed: trunk/sat-solver/libsatsolver.spec Modified: trunk/sat-solver/configure.in trunk/sat-solver/src/pool.h Added: trunk/sat-solver/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/CMakeLists.txt?rev=7649&view=auto ============================================================================== --- trunk/sat-solver/CMakeLists.txt (added) +++ trunk/sat-solver/CMakeLists.txt Fri Oct 26 15:57:08 2007 @@ -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} +) Added: trunk/sat-solver/VERSION.cmake URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/VERSION.cmake?rev=7649&view=auto ============================================================================== --- trunk/sat-solver/VERSION.cmake (added) +++ trunk/sat-solver/VERSION.cmake Fri Oct 26 15:57:08 2007 @@ -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 Added: trunk/sat-solver/bindings/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/CMakeLists.txt?rev=7649&view=auto ============================================================================== --- trunk/sat-solver/bindings/CMakeLists.txt (added) +++ trunk/sat-solver/bindings/CMakeLists.txt Fri Oct 26 15:57:08 2007 @@ -0,0 +1 @@ +ADD_SUBDIRECTORY(ruby) \ No newline at end of file Added: trunk/sat-solver/bindings/Makefile.am URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/Makefile.am?rev=7649&view=auto ============================================================================== (empty) Added: trunk/sat-solver/bindings/ruby/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/ruby/CMakeLists.txt?rev=7649&view=auto ============================================================================== --- trunk/sat-solver/bindings/ruby/CMakeLists.txt (added) +++ trunk/sat-solver/bindings/ruby/CMakeLists.txt Fri Oct 26 15:57:08 2007 @@ -0,0 +1,37 @@ +#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing") +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + +FIND_PACKAGE(Ruby REQUIRED) + +EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['vendorarchdir']" OUTPUT_VARIABLE RUBY_VENDOR_ARCH_DIR) + +MESSAGE(STATUS "Ruby executable: ${RUBY_EXECUTABLE}") +MESSAGE(STATUS "Ruby vendor arch dir: ${RUBY_VENDOR_ARCH_DIR}") +MESSAGE(STATUS "Ruby include path: ${RUBY_INCLUDE_PATH}") + +SET( SWIG_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libsatsolver_wrap.c" ) +SET( SWIG_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/satsolver.i" ) + +ADD_CUSTOM_COMMAND ( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libsatsolver_wrap.c + COMMAND ${CMAKE_COMMAND} -E echo_append "Creating wrapper code for ruby..." + COMMAND ${SWIG_EXECUTABLE} -ruby -autorename -xmlout ${CMAKE_CURRENT_BINARY_DIR}/parse.xml -o ${CMAKE_CURRENT_BINARY_DIR}/libsatsolver_wrap.c -I${CMAKE_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/../satsolver.i + COMMAND ${CMAKE_COMMAND} -E echo "Done." + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i ${CMAKE_CURRENT_SOURCE_DIR}/*.i +) + +ADD_CUSTOM_TARGET( glue + DEPENDS ${SWIG_OUTPUT} +) + +ADD_LIBRARY( satsolverx SHARED "${CMAKE_CURRENT_BINARY_DIR}/libsatsolver_wrap.c" ) +SET_TARGET_PROPERTIES( satsolverx PROPERTIES PREFIX "" ) +ADD_DEPENDENCIES( satsolverx glue ) + +INCLUDE_DIRECTORIES( ${RUBY_INCLUDE_PATH} ) +TARGET_LINK_LIBRARIES( satsolverx satsolver ) +TARGET_LINK_LIBRARIES( satsolverx ${RUBY_LIBRARY} ) + +INSTALL(TARGETS satsolverx LIBRARY DESTINATION ${RUBY_VENDOR_ARCH_DIR}) + Added: trunk/sat-solver/bindings/ruby/ruby.i URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/ruby/ruby.i?rev=7649&view=auto ============================================================================== (empty) Added: trunk/sat-solver/bindings/ruby/satsolver.rb URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/ruby/satsolver.rb?rev=7649&view=auto ============================================================================== --- trunk/sat-solver/bindings/ruby/satsolver.rb (added) +++ trunk/sat-solver/bindings/ruby/satsolver.rb Fri Oct 26 15:57:08 2007 @@ -0,0 +1,7 @@ +require 'satsolverx' + +module Satsolver + + + +end \ No newline at end of file Added: trunk/sat-solver/bindings/satsolver.i URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/satsolver.i?rev=7649&view=auto ============================================================================== --- trunk/sat-solver/bindings/satsolver.i (added) +++ trunk/sat-solver/bindings/satsolver.i Fri Oct 26 15:57:08 2007 @@ -0,0 +1,38 @@ +%module satsolver + +%{ + +#include "ruby.h" +#include "bitmap.h" +#include "evr.h" +#include "hash.h" +#include "poolarch.h" +#include "pool.h" +#include "poolid.h" +#include "poolid_private.h" +#include "pooltypes.h" +#include "queue.h" +#include "solvable.h" +#include "solver.h" +#include "source.h" +#include "source_solv.h" + +#define true (1==1) +#define false !true + +%} + +%include "bitmap.h" +%include "evr.h" +%include "hash.h" +%include "poolarch.h" +%include "pool.h" +%include "poolid.h" +%include "poolid_private.h" +%include "pooltypes.h" +%include "queue.h" +%include "solvable.h" +%include "solver.h" +%include "source.h" +%include "source_solv.h" + Added: trunk/sat-solver/cmake/modules/FindDb43.cmake URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/cmake/modules/FindDb43.cmake?rev=7649&view=auto ============================================================================== --- trunk/sat-solver/cmake/modules/FindDb43.cmake (added) +++ trunk/sat-solver/cmake/modules/FindDb43.cmake Fri Oct 26 15:57:08 2007 @@ -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 Modified: trunk/sat-solver/configure.in URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/configure.in?rev=7649&r1=7648&r2=7649&view=diff ============================================================================== --- trunk/sat-solver/configure.in (original) +++ trunk/sat-solver/configure.in Fri Oct 26 15:57:08 2007 @@ -51,6 +51,11 @@ # 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 *********************** Copied: trunk/sat-solver/libsatsolver.spec.in (from r7645, trunk/sat-solver/libsatsolver.spec) URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/libsatsolver.spec.in?p2=trunk/sat-solver/libsatsolver.spec.in&p1=trunk/sat-solver/libsatsolver.spec&r1=7645&r2=7649&rev=7649&view=diff ============================================================================== --- trunk/sat-solver/libsatsolver.spec (original) +++ trunk/sat-solver/libsatsolver.spec.in Fri Oct 26 15:57:08 2007 @@ -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 Added: trunk/sat-solver/src/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/CMakeLists.txt?rev=7649&view=auto ============================================================================== --- trunk/sat-solver/src/CMakeLists.txt (added) +++ trunk/sat-solver/src/CMakeLists.txt Fri Oct 26 15:57:08 2007 @@ -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 Modified: trunk/sat-solver/src/pool.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/pool.h?rev=7649&r1=7648&r2=7649&view=diff ============================================================================== --- trunk/sat-solver/src/pool.h (original) +++ trunk/sat-solver/src/pool.h Fri Oct 26 15:57:08 2007 @@ -17,10 +17,11 @@ #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 @@ 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 */ Added: trunk/sat-solver/testsuite/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/testsuite/CMakeLists.txt?rev=7649&view=auto ============================================================================== --- trunk/sat-solver/testsuite/CMakeLists.txt (added) +++ trunk/sat-solver/testsuite/CMakeLists.txt Fri Oct 26 15:57:08 2007 @@ -0,0 +1,14 @@ + +SET(yps_SOURCES yps.c) +ADD_EXECUTABLE(yps ${yps_SOURCES}) +TARGET_LINK_LIBRARIES(yps satsolver) + +SET(gimmick_SOURCES gimmick.c) +ADD_EXECUTABLE(gimmick ${gimmick_SOURCES}) +TARGET_LINK_LIBRARIES(gimmick satsolver) + + +SET(deptestomatic_SOURCES deptestomatic.c) +ADD_EXECUTABLE(deptestomatic ${deptestomatic_SOURCES}) +TARGET_LINK_LIBRARIES(deptestomatic satsolver ${EXPAT_LIBRARY}) + Added: trunk/sat-solver/tools/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/tools/CMakeLists.txt?rev=7649&view=auto ============================================================================== --- trunk/sat-solver/tools/CMakeLists.txt (added) +++ trunk/sat-solver/tools/CMakeLists.txt Fri Oct 26 15:57:08 2007 @@ -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 -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org