Accepting request 234826 from home:jengelh:branches:systemsmanagement

- Replace verbose cmake script (remove CMakeLists.txt).
- Instead, use a simpler automake patch (add automake.diff).

OBS-URL: https://build.opensuse.org/request/show/234826
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement/lmdb?expand=0&rev=6
This commit is contained in:
Klaus Kämpf 2014-05-21 07:39:07 +00:00 committed by Git OBS Bridge
parent 509216eece
commit 4dbd3fba8d
5 changed files with 133 additions and 401 deletions

View File

@ -1,289 +0,0 @@
#
# 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 )

View File

@ -1,51 +0,0 @@
## ==================================================
# 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")

68
automake.diff Normal file
View File

@ -0,0 +1,68 @@
From: Jan Engelhardt <jengelh@inai.de>
Date: 2014-05-16 21:40:05.570658956 +0200
Upstream: Submitted and rejected
build: use automake for building
The upstream Makefile suffers from some shortcomings, such as:
- Provides no way to set bindir, libdir, docdir/mandir.
- Fails to mkdir the DESTDIR tree on make install.
- Uses the wrong shared library extension on MinGW/Cygwin.
- No way of turning off static library generation at build time.
- There is no shared library versioning of any kind, which does not line up
with the guidelines for openSUSE and other distributions.
Upstream believes it will never change anything in an incompatible way.
While I, the patch author, concur with that expectation, it does not solve
the issue with compatible changes (such as adding functions), for which
symbol version maps would come into play. As I do not want to also maintain
a symvers patch, I will apply the naming guidelines of section
http://en.opensuse.org/openSUSE:Shared_library_packaging_policy#When_there_is_no_versioning
meaning the use of -release ${PACKAGE_VERSION}.
LMDB is a very simple project without many source files or compile-time flag
combinations; working with the original Makefile does not need all that many
hoops. But it is a tie IMO, and so, the casting vote shall be the AM route.
---
Makefile.am | 16 ++++++++++++++++
configure.ac | 13 +++++++++++++
2 files changed, 29 insertions(+)
Index: liblmdb/Makefile.am
===================================================================
--- /dev/null
+++ liblmdb/Makefile.am
@@ -0,0 +1,16 @@
+# -*- Makefile -*-
+
+ACLOCAL_AMFLAGS = -I m4
+AM_CFLAGS = -W -Wall -Wno-unused-parameter -Wbad-function-cast -pthread
+LDADD = liblmdb.la
+
+bin_PROGRAMS = mdb_copy mdb_stat
+check_PROGRAMS = mtest mtest2 mtest3 mtest4 mtest5
+man_MANS = mdb_copy.1 mdb_stat.1
+include_HEADERS = lmdb.h
+lib_LTLIBRARIES = liblmdb.la
+liblmdb_la_SOURCES = mdb.c midl.c
+liblmdb_la_LDFLAGS = -release ${PACKAGE_VERSION}
+
+clean-local:
+ rm -Rf testdb
Index: liblmdb/configure.ac
===================================================================
--- /dev/null
+++ liblmdb/configure.ac
@@ -0,0 +1,13 @@
+AC_INIT([liblmdb], [0.9.11], [http://symas.com/mdb/])
+AC_CONFIG_AUX_DIR([build-aux])
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE([-Wall foreign subdir-objects tar-pax])
+AC_PROG_CC
+AM_PROG_CC_C_O
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
+LT_INIT
+AC_CHECK_HEADERS([sys/file.h])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Fri May 16 20:00:29 UTC 2014 - jengelh@inai.de
- Replace verbose cmake script (remove CMakeLists.txt).
- Instead, use a simpler automake patch (add automake.diff).
- There is a change in shared library versioning scheme to line up
with our packaging guidelines. This is embodied within
automake.diff.
- Shorten the description by 2/3, focus on the important points.
- Do not unnecessarily pull in a C++ compiler for the build.
- Invoke ldconfig directly as %post rather than sh+ldconfig.
-------------------------------------------------------------------
Wed Feb 12 13:53:21 UTC 2014 - kkaempf@suse.com

114
lmdb.spec
View File

@ -1,7 +1,7 @@
#
# spec file for package lmdb
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -17,87 +17,79 @@
Name: lmdb
%define libname liblmdb
%define libsoname %{libname}0
Summary: Lightning Memory-Mapped Database Manager
License: OLDAP-2.8
Group: Productivity/Databases/Tools
Summary: LMDB is a tiny database with some great capabilities
%define lname liblmdb-0_9_11
Version: 0.9.11
Release: 0
Url: http://symas.com/mdb
Source: %{name}-%{version}.tar.bz2
Source1: VERSION.cmake
Source2: CMakeLists.txt
Url: http://symas.com/mdb/
#Git-Clone: git://git.openldap.org/openldap mdb.master
Source: %{name}-%{version}.tar.bz2
Patch1: automake.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: autoconf
BuildRequires: automake >= 1.10
BuildRequires: libtool >= 2
%description
LMDB is a tiny database with some great capabilities:
LMDB is a Btree-based database management library with an API similar
to BerkeleyDB. The library is thread-aware and supports concurrent
read/write access from multiple processes and threads. The DB
structure is multi-versioned, and data pages use a copy-on-write
strategy, which also provides resistance to corruption and eliminates
the need for any recovery procedures. The database is exposed in a
memory map, requiring no page cache layer of its own.
Ordered-map interface (keys are always sorted, supports range lookups)
Fully transactional, full ACID semantics with MVCC.
Reader/writer transactions: readers don't block writers and writers
don't block readers. Writers are fully serialized, so writes are
always deadlock-free.
Read transactions are extremely cheap, and can be performed using no
mallocs or any other blocking calls.
Supports multi-thread and multi-process concurrency, environments may
be opened by multiple processes on the same host.
Multiple sub-databases may be created with transactions covering all
sub-databases.
Memory-mapped, allowing for zero-copy lookup and iteration.
Maintenance-free, no external process or background cleanup/compaction
required.
No application-level caching. LMDB fully exploits the operating
system's buffer cache.
32KB of object code and 6KLOC of C.
Licensed under the OpenLDAP Public License
It is a read-optimized design and performs reads several times faster
than other DB engines, several orders of magnitude faster in many
cases. It is not a write-optimized design; for heavy random write
workloads other DB designs may be more suitable.
%package -n %{libsoname}
Summary: Shared library of Lightning MDB (LMDB)
%package -n %lname
Summary: Shared library for Lightning Memory-Mapped Database (LMDB)
Group: System/Libraries
%if 0%{?suse_version} == 1010
Requires: glibc
%endif
%description -n %{libsoname}
This package contains the shared lightning memory data base (lmdb)
%description -n %lname
LMDB is a Btree-based database management library with an API similar
to BerkeleyDB. The library is thread-aware and supports concurrent
read/write access from multiple processes and threads. The DB
structure is multi-versioned, and data pages use a copy-on-write
strategy, which also provides resistance to corruption and eliminates
the need for any recovery procedures. The database is exposed in a
memory map, requiring no page cache layer of its own.
This package contains the shared library.
%package devel
Summary: Development package for lmdb
Group: Development/Libraries/C and C++
Requires: %{libsoname} = %{version}
Requires: %lname = %version
%description devel
A high-speed in-memory database.
LMDB is a Btree-based database management library with an API similar
to BerkeleyDB. The library is thread-aware and supports concurrent
read/write access from multiple processes and threads. The DB
structure is multi-versioned, and data pages use a copy-on-write
strategy, which also provides resistance to corruption and eliminates
the need for any recovery procedures. The database is exposed in a
memory map, requiring no page cache layer of its own.
This package contains the files needed to compile programs that use the
liblmdb library.
This package contains the files needed to compile programs that use
the liblmdb library.
%prep
%setup -q -n %{libname}
%setup -qn liblmdb
%patch -P 1 -p1
%build
cp %{S:1} .
cp %{S:2} .
%{cmake}
mkdir -p m4
autoreconf -fi
%configure --disable-static
make %{?_smp_mflags}
%install
(cd build; %{__make} install DESTDIR=%{buildroot})
make install DESTDIR="%buildroot"
rm -f "%buildroot/%_libdir"/*.la
%post -n %{libsoname}
/sbin/ldconfig
%postun -n %{libsoname}
/sbin/ldconfig
%post -n %lname -p /sbin/ldconfig
%postun -n %lname -p /sbin/ldconfig
%files
%defattr(-,root,root)
@ -107,13 +99,13 @@ cp %{S:2} .
%{_bindir}/*
%doc %{_mandir}/man1/*
%files -n %{libsoname}
%files -n %lname
%defattr(-,root,root)
%{_libdir}/*.so.*
%_libdir/liblmdb-%version.so
%files devel
%defattr(-,root,root)
%{_prefix}/include/*
%{_libdir}/*.so
%_includedir/*
%_libdir/liblmdb.so
%changelog