- Switch to cmake build
Drop liblmdb.patch Add VERSION.cmake and CMakeLists.txt OBS-URL: https://build.opensuse.org/package/show/systemsmanagement/lmdb?expand=0&rev=4
This commit is contained in:
parent
cf384bfc96
commit
74b6ba02dd
289
CMakeLists.txt
Normal file
289
CMakeLists.txt
Normal file
@ -0,0 +1,289 @@
|
||||
#
|
||||
# CMakeLists.txt for lmdb
|
||||
#
|
||||
|
||||
PROJECT(lmdb)
|
||||
|
||||
cmake_minimum_required(VERSION 2.4)
|
||||
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
#
|
||||
# cmake2.6: backward compatibility to cmake 2.4
|
||||
#
|
||||
if(COMMAND cmake_policy)
|
||||
cmake_policy(SET CMP0003 OLD)
|
||||
endif(COMMAND cmake_policy)
|
||||
|
||||
if(COMMAND cmake_policy)
|
||||
cmake_policy(SET CMP0005 OLD)
|
||||
endif(COMMAND cmake_policy)
|
||||
|
||||
INCLUDE (CheckIncludeFiles)
|
||||
INCLUDE (CheckFunctionExists)
|
||||
|
||||
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
|
||||
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
|
||||
|
||||
INCLUDE( ${CMAKE_SOURCE_DIR}/VERSION.cmake )
|
||||
SET(VERSION "${LMDB_MAJOR}.${LMDB_MINOR}.${LMDB_PATCH}")
|
||||
MESSAGE(STATUS "Version ${VERSION}")
|
||||
SET(PACKAGE_VERSION \"${LMDB_MAJOR}.${LMDB_MINOR}\")
|
||||
MESSAGE(STATUS "Package Version ${PACKAGE_VERSION}")
|
||||
# build timestamp
|
||||
EXECUTE_PROCESS(COMMAND "/bin/date" "+%Y%m%d%H%M" OUTPUT_VARIABLE BUILD_DATE)
|
||||
STRING(REPLACE "\n" "" PACKAGE_BUILDTS "${BUILD_DATE}")
|
||||
MESSAGE(STATUS "Package build timestamp ${PACKAGE_BUILDTS}")
|
||||
|
||||
# Package architecture
|
||||
IF ( NOT DEFINED PACKAGE_ARCHITECTURE )
|
||||
EXECUTE_PROCESS(COMMAND "/bin/uname" "-m" OUTPUT_VARIABLE UNAME_M)
|
||||
# strip trailing newline
|
||||
STRING(REPLACE "\n" "" PACKAGE_ARCHITECTURE ${UNAME_M})
|
||||
ENDIF ( NOT DEFINED PACKAGE_ARCHITECTURE )
|
||||
MESSAGE(STATUS "Building for ${PACKAGE_ARCHITECTURE}" )
|
||||
|
||||
|
||||
# Library path (lib / lib64 )
|
||||
|
||||
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}" )
|
||||
SET( BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin" )
|
||||
SET( INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include" )
|
||||
IF( "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
|
||||
SET( SYSCONFDIR "/etc" )
|
||||
ELSE( "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
|
||||
SET( SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc" )
|
||||
ENDIF( "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
|
||||
|
||||
|
||||
#/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
CHECK_INCLUDE_FILES( "sys/time.h" TIME_WITH_SYS_TIME )
|
||||
IF(NOT TIME_WITH_SYS_TIME)
|
||||
SET(TIME_WITH_SYS_TIME 0)
|
||||
ENDIF(NOT TIME_WITH_SYS_TIME)
|
||||
|
||||
#/* Define ssize_t to int' if <sys/types.h> does not define. */
|
||||
SET(SSIZE_T_MISSING 0)
|
||||
|
||||
CHECK_FUNCTION_EXISTS( "alloca" HAVE_ALLOCA )
|
||||
IF (NOT HAVE_ALLOCA)
|
||||
SET(HAVE_ALLOCA 0)
|
||||
SET(C_ALLOCA 0)
|
||||
CHECK_INCLUDE_FILES( "alloca.h" HAVE_ALLOCA_H )
|
||||
ENDIF (NOT HAVE_ALLOCA)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
|
||||
SET (FUNCS_TO_TEST "bcopy" "crypt" "daemon" "fnmatch" "getaddrinfo" "getnameinfo" "getpid" "gettimeofday" "gmtime_r" "inet_aton" "inet_ntop" "inet_pton" "sleep" "srandom" "strsep" "strtok_r" "syslog" "timegm" "memmove" "unlink" "va_copy" )
|
||||
FOREACH( FUNC ${FUNCS_TO_TEST})
|
||||
STRING(TOUPPER ${FUNC} UPNAME)
|
||||
SET(HAVENAME "HAVE_${UPNAME}")
|
||||
CHECK_FUNCTION_EXISTS( "${FUNC}" HAVE_FUNC )
|
||||
IF(HAVE_FUNC)
|
||||
SET(${HAVENAME} 1)
|
||||
ELSE(HAVE_FUNC)
|
||||
SET(${HAVENAME} 0)
|
||||
ENDIF(HAVE_FUNC)
|
||||
ENDFOREACH( FUNC ${FUNCS_TO_TEST})
|
||||
|
||||
|
||||
# types
|
||||
|
||||
INCLUDE(CheckTypeSize)
|
||||
|
||||
#
|
||||
#/* Define to 1 if you have the ANSI C header files. */
|
||||
# STDC_HEADERS
|
||||
SET(STDC_HEADERS 1)
|
||||
|
||||
####################################################################
|
||||
# CONFIGURATION #
|
||||
####################################################################
|
||||
|
||||
ADD_DEFINITIONS( -DHAVE_CONFIG_H )
|
||||
|
||||
SET(PACKAGE "lmdb")
|
||||
SET(PACKAGE_BUGREPORT "\"http://symas.com/mdb\"")
|
||||
SET(PACKAGE_NAME "\"${PACKAGE}\"")
|
||||
SET(PACKAGE_STRING "\"LMDB is a tiny database with some great capabilities\"")
|
||||
SET(PACKAGE_TARNAME "\"${PACKAGE}-${VERSION}.tar.bz2\"")
|
||||
|
||||
SET("prefix" ${CMAKE_INSTALL_PREFIX})
|
||||
SET("includedir" ${CMAKE_INSTALL_PREFIX}/include)
|
||||
SET("libdir" ${LIB_INSTALL_DIR})
|
||||
|
||||
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wunused -Werror" )
|
||||
SET( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3" )
|
||||
|
||||
####################################################################
|
||||
# PACKAGING #
|
||||
####################################################################
|
||||
SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 1)
|
||||
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LMDB is a tiny database with some great capabilities")
|
||||
SET(CPACK_PACKAGE_VENDOR "http://symas.com")
|
||||
SET(CPACK_PACKAGE_VERSION_MAJOR ${LMDB_MAJOR})
|
||||
SET(CPACK_PACKAGE_VERSION_MINOR ${LMDB_MINOR})
|
||||
SET(CPACK_PACKAGE_VERSION_PATCH ${LMDB_PATCH})
|
||||
SET(CPACK_GENERATOR "TBZ2")
|
||||
SET(CPACK_SOURCE_GENERATOR "TBZ2")
|
||||
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${PACKAGE}-${VERSION}" )
|
||||
MESSAGE(STATUS "Package file ${CPACK_SOURCE_PACKAGE_FILE_NAME}")
|
||||
|
||||
# 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
|
||||
#git files
|
||||
"/.git"
|
||||
"\\\\.gitignore$"
|
||||
#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$"
|
||||
"Makefile$"
|
||||
# autotool
|
||||
"/m4/"
|
||||
"autom4te.cache"
|
||||
"config.log"
|
||||
"config.h$"
|
||||
"configure$"
|
||||
"config.status"
|
||||
"depcomp"
|
||||
"config.guess"
|
||||
"install.sh"
|
||||
"libtool"
|
||||
# generated
|
||||
"\\\\.bz2$"
|
||||
"\\\\.class$"
|
||||
"/bindings/ruby/rdoc/"
|
||||
)
|
||||
|
||||
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
|
||||
)
|
||||
|
||||
IF(HAVE_WARNINGS)
|
||||
MESSAGE(STATUS " ************ NOTE: ************")
|
||||
MESSAGE(STATUS " Warnings occurred during cmake configuration... Please see output")
|
||||
MESSAGE(STATUS " *******************************")
|
||||
ENDIF(HAVE_WARNINGS)
|
||||
|
||||
####################################################################
|
||||
# RPM SPEC #
|
||||
####################################################################
|
||||
|
||||
SET( AUTOBUILD_COMMAND
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/package/*.tar.bz2
|
||||
COMMAND mkdir -p _CPack_Packages/${CPACK_TOPLEVEL_TAG}
|
||||
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/package
|
||||
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
|
||||
)
|
||||
|
||||
ADD_CUSTOM_TARGET( srcpackage_local
|
||||
${AUTOBUILD_COMMAND}
|
||||
)
|
||||
|
||||
ADD_CUSTOM_TARGET( srcpackage
|
||||
${AUTOBUILD_COMMAND}
|
||||
)
|
||||
|
||||
####################################################################
|
||||
# Library build #
|
||||
####################################################################
|
||||
|
||||
SET( LMDB_HEADERS lmdb.h )
|
||||
INSTALL(FILES ${LMDB_HEADERS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include")
|
||||
|
||||
SET( LMDB_SOURCES mdb.c midl.c )
|
||||
ADD_LIBRARY( lmdb SHARED ${LMDB_SOURCES} )
|
||||
TARGET_LINK_LIBRARIES( lmdb ${CMAKE_THREAD_LIBS_INIT} )
|
||||
|
||||
SET_TARGET_PROPERTIES(lmdb PROPERTIES VERSION 0.0.0 SOVERSION ${LMDB_MAJOR})
|
||||
INSTALL(TARGETS lmdb DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
####################################################################
|
||||
# Executables build #
|
||||
####################################################################
|
||||
|
||||
ADD_EXECUTABLE(mdb_stat mdb_stat.c)
|
||||
TARGET_LINK_LIBRARIES(mdb_stat lmdb)
|
||||
|
||||
ADD_EXECUTABLE(mdb_copy mdb_copy.c)
|
||||
TARGET_LINK_LIBRARIES(mdb_copy lmdb)
|
||||
|
||||
install(TARGETS
|
||||
mdb_stat
|
||||
mdb_copy
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
|
||||
####################################################################
|
||||
# Man pages #
|
||||
####################################################################
|
||||
|
||||
SET( LMDB_MAN mdb_stat.1 mdb_copy.1 )
|
||||
INSTALL(FILES ${LMDB_MAN} DESTINATION "${CMAKE_INSTALL_PREFIX}/share/man/man1")
|
||||
|
||||
####################################################################
|
||||
# Tests build #
|
||||
# leave out mtest6, only compiles with DEBUG enabled lib #
|
||||
####################################################################
|
||||
|
||||
SET( mtest_SOURCES mtest.c )
|
||||
SET( mtest2_SOURCES mtest2.c )
|
||||
SET( mtest3_SOURCES mtest3.c )
|
||||
SET( mtest4_SOURCES mtest4.c )
|
||||
SET( mtest5_SOURCES mtest5.c )
|
||||
ADD_EXECUTABLE( mtest ${mtest_SOURCES} )
|
||||
ADD_EXECUTABLE( mtest2 ${mtest2_SOURCES} )
|
||||
ADD_EXECUTABLE( mtest3 ${mtest3_SOURCES} )
|
||||
ADD_EXECUTABLE( mtest4 ${mtest4_SOURCES} )
|
||||
ADD_EXECUTABLE( mtest5 ${mtest5_SOURCES} )
|
||||
TARGET_LINK_LIBRARIES( mtest lmdb )
|
||||
TARGET_LINK_LIBRARIES( mtest2 lmdb )
|
||||
TARGET_LINK_LIBRARIES( mtest3 lmdb )
|
||||
TARGET_LINK_LIBRARIES( mtest4 lmdb )
|
||||
TARGET_LINK_LIBRARIES( mtest5 lmdb )
|
||||
ADD_TEST( test_mtest mtest )
|
||||
ADD_TEST( test_mtest2 mtest2 )
|
||||
ADD_TEST( test_mtest3 mtest3 )
|
||||
ADD_TEST( test_mtest4 mtest4 )
|
||||
ADD_TEST( test_mtest5 mtest5 )
|
51
VERSION.cmake
Normal file
51
VERSION.cmake
Normal file
@ -0,0 +1,51 @@
|
||||
## ==================================================
|
||||
# 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)
|
||||
#
|
||||
|
||||
# Package version 0.9.11
|
||||
SET(LMDB_MAJOR "0")
|
||||
SET(LMDB_MINOR "9")
|
||||
SET(LMDB_PATCH "11")
|
||||
|
@ -1,46 +0,0 @@
|
||||
--- liblmdb/Makefile
|
||||
+++ liblmdb/Makefile
|
||||
@@ -23,12 +23,12 @@
|
||||
CFLAGS = $(THREADS) $(OPT) $(W) $(XCFLAGS)
|
||||
LDLIBS =
|
||||
SOLIBS =
|
||||
-prefix = /usr/local
|
||||
+prefix = /usr
|
||||
|
||||
########################################################################
|
||||
|
||||
IHDRS = lmdb.h
|
||||
-ILIBS = liblmdb.a liblmdb.so
|
||||
+ILIBS = liblmdb.a liblmdb.so liblmdb.so.0
|
||||
IPROGS = mdb_stat mdb_copy
|
||||
IDOCS = mdb_stat.1 mdb_copy.1
|
||||
PROGS = $(IPROGS) mtest mtest2 mtest3 mtest4 mtest5
|
||||
@@ -36,9 +36,11 @@
|
||||
|
||||
install: $(ILIBS) $(IPROGS) $(IHDRS)
|
||||
for f in $(IPROGS); do cp $$f $(DESTDIR)$(prefix)/bin; done
|
||||
- for f in $(ILIBS); do cp $$f $(DESTDIR)$(prefix)/lib; done
|
||||
+ for f in $(ILIBS); do cp $$f $(DESTDIR)$(prefix)/$(LIB); done
|
||||
for f in $(IHDRS); do cp $$f $(DESTDIR)$(prefix)/include; done
|
||||
- for f in $(IDOCS); do cp $$f $(DESTDIR)$(prefix)/man/man1; done
|
||||
+ for f in $(IDOCS); do cp $$f $(DESTDIR)/$(MANDIR)/man1; done
|
||||
+ rm $(DESTDIR)$(prefix)/$(LIB)/liblmdb.so
|
||||
+ ln -sf liblmdb.so.0 $(DESTDIR)$(prefix)/$(LIB)/liblmdb.so
|
||||
|
||||
clean:
|
||||
rm -rf $(PROGS) *.[ao] *.so *~ testdb
|
||||
@@ -50,9 +52,12 @@
|
||||
liblmdb.a: mdb.o midl.o
|
||||
ar rs $@ mdb.o midl.o
|
||||
|
||||
-liblmdb.so: mdb.o midl.o
|
||||
+liblmdb.so.0: mdb.o midl.o
|
||||
# $(CC) $(LDFLAGS) -pthread -shared -Wl,-Bsymbolic -o $@ mdb.o midl.o $(SOLIBS)
|
||||
- $(CC) $(LDFLAGS) -pthread -shared -o $@ mdb.o midl.o $(SOLIBS)
|
||||
+ $(CC) $(LDFLAGS) -pthread -shared -Wl,-soname,liblmdb.so.0 -o $@ mdb.o midl.o $(SOLIBS)
|
||||
+
|
||||
+liblmdb.so: liblmdb.so.0
|
||||
+ ln -sf liblmdb.so.0 $@
|
||||
|
||||
mdb_stat: mdb_stat.o liblmdb.a
|
||||
mdb_copy: mdb_copy.o liblmdb.a
|
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Feb 12 13:53:21 UTC 2014 - kkaempf@suse.com
|
||||
|
||||
- Switch to cmake build
|
||||
Drop liblmdb.patch
|
||||
Add VERSION.cmake and CMakeLists.txt
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Feb 6 15:27:13 CET 2014 - ro@suse.de
|
||||
|
||||
|
20
lmdb.spec
20
lmdb.spec
@ -27,9 +27,12 @@ Version: 0.9.11
|
||||
Release: 0
|
||||
Url: http://symas.com/mdb
|
||||
Source: %{name}-%{version}.tar.bz2
|
||||
# fix prefix and libdir
|
||||
Patch: liblmdb.patch
|
||||
Source1: VERSION.cmake
|
||||
Source2: CMakeLists.txt
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildRequires: cmake
|
||||
BuildRequires: gcc-c++
|
||||
|
||||
%description
|
||||
LMDB is a tiny database with some great capabilities:
|
||||
@ -81,19 +84,14 @@ liblmdb library.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{libname}
|
||||
%patch -p1
|
||||
|
||||
%build
|
||||
MANDIR=%{_mandir} LIB=%{_lib} %{__make}
|
||||
cp %{S:1} .
|
||||
cp %{S:2} .
|
||||
%{cmake}
|
||||
|
||||
%install
|
||||
install -d %{buildroot}%{_bindir}
|
||||
install -d %{buildroot}%{_libdir}
|
||||
install -d %{buildroot}%{_mandir}/man1
|
||||
install -d %{buildroot}%{_prefix}/include
|
||||
MANDIR=%{_mandir} LIB=%{_lib} %{__make} install DESTDIR=%{buildroot}
|
||||
install -m 644 lmdb.h %{buildroot}%{_prefix}/include
|
||||
rm -f %{buildroot}%{_libdir}/*.a
|
||||
(cd build; %{__make} install DESTDIR=%{buildroot})
|
||||
|
||||
%post -n %{libsoname}
|
||||
/sbin/ldconfig
|
||||
|
Loading…
Reference in New Issue
Block a user