]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
- add cmake support
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 26 Oct 2007 13:57:08 +0000 (13:57 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 26 Oct 2007 13:57:08 +0000 (13:57 +0000)
- add ruby bindings

CMakeLists.txt [new file with mode: 0644]
VERSION.cmake [new file with mode: 0644]
cmake/modules/FindDb43.cmake [new file with mode: 0644]
configure.in
libsatsolver.spec.in [moved from libsatsolver.spec with 97% similarity]
src/CMakeLists.txt [new file with mode: 0644]
src/pool.h
tools/CMakeLists.txt [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7e9beea
--- /dev/null
@@ -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 (file)
index 0000000..afd872a
--- /dev/null
@@ -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 (file)
index 0000000..cc8d613
--- /dev/null
@@ -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
index 87a8a95e5fa2110167841dbee2c70b9aa7e0e73d..c185222c1a077605b92ec50ea1f38d48f50a2480 100644 (file)
@@ -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 ***********************
similarity index 97%
rename from libsatsolver.spec
rename to libsatsolver.spec.in
index 02ff9ec985567d0cf08c283d9c770035c64a599b..38ee5a38ddf032eb916bd55ee35c3bc08f034995 100644 (file)
@@ -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 (file)
index 0000000..10e542b
--- /dev/null
@@ -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
index 1a5ec5dd8371deae62cb20593ed3b98f58e834ff..e48e5b05dfdb141b807f02ef48f30a61ba79fc79 100644 (file)
@@ -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 (file)
index 0000000..389c09f
--- /dev/null
@@ -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