Commit da94d65c by Maarten L. Hekkelman

prepare for 1.0.0 release

parent d5134000
...@@ -41,13 +41,10 @@ datarootdir = @datarootdir@ ...@@ -41,13 +41,10 @@ datarootdir = @datarootdir@
datadir = @datadir@ datadir = @datadir@
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
LIB_NAME = @PACKAGE_NAME@
LIB_TARGET = $(LIB_NAME).la
CCP4DIR = @CCP4@ CCP4DIR = @CCP4@
CLIBD ?= $(CCP4DIR)/lib/data CLIBD = $(CCP4DIR:%=%/lib/data)
DATADIR = $(datadir)/libcifpp CACHE_DIR = /var/cache/libcifpp
GNUmakefile: config.status GNUmakefile.in GNUmakefile: config.status GNUmakefile.in
$(SHELL) ./config.status $(SHELL) ./config.status
...@@ -62,19 +59,25 @@ configure: configure.ac ...@@ -62,19 +59,25 @@ configure: configure.ac
endif endif
LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIB_NAME = @PACKAGE_NAME@
libtool: $(LIBTOOL_DEPS) LIB_VERSION = @LIBCIF_LT_VERSION@
$(SHELL) ./config.status --recheck LIB_CURRENT = @LIBCIF_LT_CURRENT@
LIB_TARGET = $(LIB_NAME).la
VERSION = @PACKAGE_VERSION@
DIST_NAME = @PACKAGE_NAME@-$(subst :,.,$(LIB_VERSION))
# libtool stuff # libtool stuff
LIBTOOL = $(SHELL) ./libtool LIBTOOL_DEPS = @LIBTOOL_DEPS@
libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status libtool
LIBTOOL = $(SHELL) @abs_top_builddir@/libtool
CXXCOMPILE = $(LIBTOOL) --silent --tag=CXX --mode=compile $(CXX) $(CXXFLAGS) CXXCOMPILE = $(LIBTOOL) --silent --tag=CXX --mode=compile $(CXX) $(CXXFLAGS)
CXXLINK = $(LIBTOOL) --silent --tag=CXX --mode=link $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ CXXLINK = $(LIBTOOL) --silent --tag=CXX --mode=link $(CXX) $(CXXFLAGS) $(LDFLAGS) -version-info $(LIB_VERSION) -o $@
# main build variables # main build variables
CXXFLAGS += -I. -pthread -I include/ CXXFLAGS += -Wall -Wno-multichar -I include
CXXFLAGS += -Wall -Wno-multichar
# Use the DEBUG flag to build debug versions of the code # Use the DEBUG flag to build debug versions of the code
DEBUG = @DEBUG@ DEBUG = @DEBUG@
...@@ -102,23 +105,20 @@ endif ...@@ -102,23 +105,20 @@ endif
$(OBJDIR): $(OBJDIR):
mkdir -p $(OBJDIR) mkdir -p $(OBJDIR)
LIBCIF_SRC = AtomType.cpp \ OBJECTS = $(OBJDIR)/AtomType.lo \
Cif2PDB.cpp \ $(OBJDIR)/Cif2PDB.lo \
Cif++.cpp \ $(OBJDIR)/Cif++.lo \
CifParser.cpp \ $(OBJDIR)/CifParser.lo \
CifUtils.cpp \ $(OBJDIR)/CifUtils.lo \
CifValidator.cpp \ $(OBJDIR)/CifValidator.lo \
Compound.cpp \ $(OBJDIR)/Compound.lo \
PDB2Cif.cpp \ $(OBJDIR)/PDB2Cif.lo \
PDB2CifRemark3.cpp \ $(OBJDIR)/PDB2CifRemark3.lo \
Point.cpp \ $(OBJDIR)/Point.lo \
Secondary.cpp \ $(OBJDIR)/Secondary.lo \
Structure.cpp \ $(OBJDIR)/Structure.lo \
Symmetry.cpp \ $(OBJDIR)/Symmetry.lo \
TlsParser.cpp $(OBJDIR)/TlsParser.lo
SOURCES = $(addprefix src/,$(LIBCIF_SRC))
OBJECTS = $(addprefix $(OBJDIR)/, $(notdir $(SOURCES:%.cpp=%.lo)))
ifneq "$(CCP4DIR)" "" ifneq "$(CCP4DIR)" ""
...@@ -132,37 +132,14 @@ $(OBJDIR)/Symmetry.lo: src/SymOpTable_data.cpp ...@@ -132,37 +132,14 @@ $(OBJDIR)/Symmetry.lo: src/SymOpTable_data.cpp
endif endif
REVISION = $(shell git log --pretty=format:%h --max-count=1)
REVISION_FILE = version-info-$(REVISION).txt
# Unfortunately, travis-ci checks out only with --depth=50, missing the required tag
ifeq "$(NO_REVISION)" ""
$(REVISION_FILE):
rm -f version-info-*.txt
git describe --match=build --dirty > $@
@ git log --pretty=medium --date=iso8601 -1 >> $@
else
$(REVISION_FILE):
touch $@
endif
src/revision.hpp: $(REVISION_FILE)
@ echo 'const char kRevision[] = R"(' > $@
@ cat $? >> $@
@ echo ')";' >> $@
$(OBJDIR)/CifUtils.o: src/revision.hpp
$(OBJDIR)/CifUtils.lo: src/revision.hpp
$(LIB_TARGET): $(OBJECTS) $(LIB_TARGET): $(OBJECTS)
$(CXXLINK) -rpath $(libdir) $(OBJECTS) $(LIBS) $(CXXLINK) -rpath $(libdir) $(OBJECTS) $(LIBS)
.PHONY: lib
lib: $(LIB_TARGET) lib: $(LIB_TARGET)
.PHONY: libs
all: lib
.PHONY: all .PHONY: all
all: $(LIB_TARGET)
-include $(OBJECTS:%.lo=%.d) -include $(OBJECTS:%.lo=%.d)
...@@ -232,13 +209,20 @@ HEADERS = \ ...@@ -232,13 +209,20 @@ HEADERS = \
install-lib: lib install-lib: lib
install -d $(libdir) install -d $(libdir)
$(LIBTOOL) --mode=install install $(LIB_TARGET) $(libdir) $(LIBTOOL) --mode=install install $(LIB_TARGET) $(libdir)
install -d $(DATADIR)/dictionaries rm -f $(libdir)/$(LIB_NAME).so $(libdir)/$(LIB_NAME).a $(libdir)/$(LIB_NAME).la
install -d $(CACHE_DIR)/dictionaries
for d in mmcif_ddl.dic mmcif_pdbx.dic; do \ for d in mmcif_ddl.dic mmcif_pdbx.dic; do \
install -m644 rsrc/dictionaries/$$d $(DATADIR)/dictionaries/$$d; \ install -m644 rsrc/dictionaries/$$d $(CACHE_DIR)/dictionaries/$$d; \
done done
if [ -d /etc/cron.weekly ]; then \
install -m755 tools/update-dictionaries-script /etc/cron.weekly/libcifpp; \
fi
.PHONY: install-dev .PHONY: install-dev
install-dev: install-dev:
install -d $(libdir)
$(LIBTOOL) --mode=install install $(LIB_TARGET) $(libdir)
rm -f $(libdir)/$(LIB_NAME).so.$(subst :,.,$(LIB_VERSION)) $(libdir)/$(LIB_NAME).so.$(LIB_CURRENT)
install -d $(includedir)/cif++ install -d $(includedir)/cif++
for f in $(HEADERS); do install include/cif++/$$f $(includedir)/cif++/$$f; done for f in $(HEADERS); do install include/cif++/$$f $(includedir)/cif++/$$f; done
install -d $(pkgconfigdir) install -d $(pkgconfigdir)
...@@ -249,4 +233,12 @@ install: install-lib install-dev ...@@ -249,4 +233,12 @@ install: install-lib install-dev
dist-clean: clean dist-clean: clean
.PHONY: dist
dist:
rm -rf $(DIST_NAME)
mkdir $(DIST_NAME)
git archive trunk | tar -x -C $(DIST_NAME)
tar czf $(DIST_NAME).tgz $(DIST_NAME)
rm -rf $(DIST_NAME)
FORCE: FORCE:
...@@ -646,6 +646,8 @@ SET_MAKE ...@@ -646,6 +646,8 @@ SET_MAKE
PKG_CONFIG PKG_CONFIG
CCP4 CCP4
DEBUG DEBUG
LIBCIF_LT_VERSION
LIBCIF_LT_CURRENT
LIBTOOL_DEPS LIBTOOL_DEPS
LT_SYS_LIBRARY_PATH LT_SYS_LIBRARY_PATH
OTOOL64 OTOOL64
...@@ -736,8 +738,8 @@ SHELL' ...@@ -736,8 +738,8 @@ SHELL'
ac_subst_files='' ac_subst_files=''
ac_user_opts=' ac_user_opts='
enable_option_checking enable_option_checking
enable_static
enable_shared enable_shared
enable_static
with_pic with_pic
enable_fast_install enable_fast_install
with_aix_soname with_aix_soname
...@@ -1391,8 +1393,8 @@ Optional Features: ...@@ -1391,8 +1393,8 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options --disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-shared[=PKGS] build shared libraries [default=yes]
--enable-static[=PKGS] build static libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes]
--enable-shared[=PKGS] build shared libraries [default=no]
--enable-fast-install[=PKGS] --enable-fast-install[=PKGS]
optimize for fast installation [default=yes] optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds) --disable-libtool-lock avoid locking (might break parallel builds)
...@@ -4458,67 +4460,6 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' ...@@ -4458,67 +4460,6 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
# Check whether --enable-static was given.
if test "${enable_static+set}" = set; then :
enableval=$enable_static; p=${PACKAGE-default}
case $enableval in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS=$lt_save_ifs
;;
esac
else
enable_static=yes
fi
# Check whether --enable-shared was given.
if test "${enable_shared+set}" = set; then :
enableval=$enable_shared; p=${PACKAGE-default}
case $enableval in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS=$lt_save_ifs
;;
esac
else
enable_shared=no
fi
case `pwd` in case `pwd` in
*\ * | *\ *) *\ * | *\ *)
...@@ -8494,6 +8435,66 @@ func_stripname_cnf () ...@@ -8494,6 +8435,66 @@ func_stripname_cnf ()
enable_win32_dll=no enable_win32_dll=no
# Check whether --enable-shared was given.
if test "${enable_shared+set}" = set; then :
enableval=$enable_shared; p=${PACKAGE-default}
case $enableval in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS=$lt_save_ifs
;;
esac
else
enable_shared=yes
fi
# Check whether --enable-static was given.
if test "${enable_static+set}" = set; then :
enableval=$enable_static; p=${PACKAGE-default}
case $enableval in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS=$lt_save_ifs
;;
esac
else
enable_static=yes
fi
...@@ -16063,6 +16064,16 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ...@@ -16063,6 +16064,16 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
LIBCIF_CURRENT=1
LIBCIF_REVISION=0
LIBCIF_AGE=0
LIBCIF_LT_CURRENT="${LIBCIF_CURRENT}"
LIBCIF_LT_VERSION="${LIBCIF_CURRENT}:${LIBCIF_REVISION}:${LIBCIF_AGE}"
...@@ -17704,10 +17715,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ...@@ -17704,10 +17715,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
sed_quote_subst='$sed_quote_subst' sed_quote_subst='$sed_quote_subst'
double_quote_subst='$double_quote_subst' double_quote_subst='$double_quote_subst'
delay_variable_subst='$delay_variable_subst' delay_variable_subst='$delay_variable_subst'
enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`'
...@@ -18695,15 +18706,15 @@ available_tags='CXX ' ...@@ -18695,15 +18706,15 @@ available_tags='CXX '
# ### BEGIN LIBTOOL CONFIG # ### BEGIN LIBTOOL CONFIG
# Whether or not to build static libraries. # Which release of libtool.m4 was used?
build_old_libs=$enable_static macro_version=$macro_version
macro_revision=$macro_revision
# Whether or not to build shared libraries. # Whether or not to build shared libraries.
build_libtool_libs=$enable_shared build_libtool_libs=$enable_shared
# Which release of libtool.m4 was used? # Whether or not to build static libraries.
macro_version=$macro_version build_old_libs=$enable_static
macro_revision=$macro_revision
# What type of objects to build. # What type of objects to build.
pic_mode=$pic_mode pic_mode=$pic_mode
......
...@@ -51,11 +51,23 @@ dnl [AC_MSG_ERROR([Your c++ compiler is not capable of compiling libcifpp, plea ...@@ -51,11 +51,23 @@ dnl [AC_MSG_ERROR([Your c++ compiler is not capable of compiling libcifpp, plea
dnl AC_MSG_RESULT(ok) dnl AC_MSG_RESULT(ok)
AC_PROG_INSTALL AC_PROG_INSTALL
AC_ENABLE_STATIC
AC_DISABLE_SHARED dnl Shared libraries are not convenient
AC_PROG_LIBTOOL dnl LT_INIT([disable-shared])
LT_INIT
AC_SUBST(LIBTOOL_DEPS) AC_SUBST(LIBTOOL_DEPS)
dnl versioning
LIBCIF_CURRENT=1
LIBCIF_REVISION=0
LIBCIF_AGE=0
LIBCIF_LT_CURRENT="${LIBCIF_CURRENT}"
LIBCIF_LT_VERSION="${LIBCIF_CURRENT}:${LIBCIF_REVISION}:${LIBCIF_AGE}"
AC_SUBST(LIBCIF_LT_CURRENT)
AC_SUBST(LIBCIF_LT_VERSION)
AC_ARG_VAR([DEBUG], [Build a debug version of the library]) AC_ARG_VAR([DEBUG], [Build a debug version of the library])
AC_ARG_VAR([CCP4], [The location where CCP4 is installed]) AC_ARG_VAR([CCP4], [The location where CCP4 is installed])
......
libcifpp (0.1.0-1) unstable; urgency=medium
* Initial release. (Closes: #XXXXXX)
-- Maarten L. Hekkelman <maarten@hekkelman.com> Mon, 28 Sep 2020 08:34:16 +0200
Source: libcifpp
Maintainer: Debian Med Packaging Team <debian-med-packaging@lists.alioth.debian.org>
Uploaders: Maarten L. Hekkelman <maarten@hekkelman.com>,
Andreas Tille <tille@debian.org>
Section: libs
Priority: optional
Build-Depends: debhelper-compat (= 12),
autoconf-archive,
libboost-dev,
libboost-iostreams-dev,
libboost-system-dev,
zlib1g-dev,
libbz2-dev
Standards-Version: 4.5.0
Vcs-Browser: https://salsa.debian.org/med-team/libcifpp
Vcs-Git: https://salsa.debian.org/med-team/libcifpp.git
Homepage: https://github.com/PDB-REDO/libcifpp
Rules-Requires-Root: no
Package: libcifpp-dev
Architecture: any
Section: libdevel
Depends: ${misc:Depends},
libcifpp0.1 (= ${binary:Version}),
libboost-dev,
libboost-iostreams-dev,
pkg-config
Suggests: libcifpp-doc
Description: Development files for libcifpp
Libcifpp is a C++ library used to create and manipulate
mmCIF and PDB files containing macro molecular structure information.
.
This specific package contains all files needed to develop new
software using libcifpp.
Package: libcifpp0.1
Architecture: any
Depends: ${misc:Depends},
${shlibs:Depends}
Description: Library files for libcifpp
Libcifpp is a C++ library used to create and manipulate
mmCIF and PDB files containing macro molecular structure information.
.
This package contains the library file only.
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: libcifpp
Upstream-Contact: Maarten L. Hekkelman <maarten@hekkelman.com>
Source: http://github.com/PDB-REDO/libcifpp
Files: *
Copyright: © 2020 NKI/AVL, Netherlands Cancer Institute
License: BSD-2-Clause
Files: debian/*
Copyright: © 2020 NKI/AVL, Netherlands Cancer Institute
License: BSD-2-Clause
License: BSD-2-Clause
Copyright (c) 2020 NKI/AVL, Netherlands Cancer Institute
.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
.
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
README.md
\ No newline at end of file
README.md
\ No newline at end of file
Description: Fix makefiles to install at the correct location
Author: Maarten L. Hekkelman <maarten@hekkelman.com>
Last-Update: Mon, 28 Sep 2020 09:18:14 +0200
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -33,12 +33,12 @@
LIBS = @LIBS@ \
@BOOST_IOSTREAMS_LIB@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-libdir = @libdir@
-includedir = @includedir@
-datarootdir = @datarootdir@
-datadir = @datadir@
+prefix = $(DESTDIR)@prefix@
+exec_prefix = $(DESTDIR)@exec_prefix@
+libdir = $(DESTDIR)@libdir@
+includedir = $(DESTDIR)@includedir@
+datarootdir = $(DESTDIR)@datarootdir@
+datadir = $(DESTDIR)@datadir@
pkgconfigdir = $(libdir)/pkgconfig
LIB_NAME = @PACKAGE_NAME@
#!/usr/bin/make -f
DH_VERBOSE := 1
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
# Fixing reproducible builds
LC_ALL := C.UTF-8
export LC_ALL
export LIBRARY_VERSION=0.1
%:
dh $@
override_dh_auto_configure:
dh_auto_configure -- --enable-documentation
override_dh_auto_install:
$(MAKE) DESTDIR=$(CURDIR)/debian/libcifpp0.1 install-lib
$(MAKE) DESTDIR=$(CURDIR)/debian/libcifpp-dev install-dev
override_dh_auto_configure-arch:
dh_auto_configure -- --enable-shared
override_dh_auto_configure-indep:
dh_auto_configure -- --enable-shared
override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
$(MAKE) test
endif
override_dh_install:
## cleaning up dependency_libs filed in *.la files
sed -i "/dependency_libs/ s/'.*'/''/" `find . -name '*.la'`
dh_install
override_dh_makeshlibs:
dh_makeshlibs -- -v$(LIBRARY_VERSION)
extend-diff-ignore = "(^|/)(\.gitignore|\.travis\.yml)$"
---
Bug-Database: https://github.com/PDB-REDO/libcifpp/issues
Bug-Submit: https://github.com/PDB-REDO/libcifpp/issues/new
Repository: https://github.com/PDB-REDO/libcifpp.git
Repository-Browse: https://github.com/PDB-REDO/libcifpp
version=4
opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/libcifpp-$1\.tar\.gz/ \
https://github.com/PDB-REDO/libcifpp/tags .*/v?(\d\S+)\.tar\.gz
...@@ -1302,6 +1302,18 @@ class iterator_impl ...@@ -1302,6 +1302,18 @@ class iterator_impl
bool operator==(const iterator_impl& rhs) const { return mCurrent == rhs.mCurrent; } bool operator==(const iterator_impl& rhs) const { return mCurrent == rhs.mCurrent; }
bool operator!=(const iterator_impl& rhs) const { return mCurrent != rhs.mCurrent; } bool operator!=(const iterator_impl& rhs) const { return mCurrent != rhs.mCurrent; }
template<typename IRowType, typename... ITs>
bool operator==(const iterator_impl<IRowType, ITs...>& rhs) const
{
return mCurrent == rhs.mCurrent;
}
template<typename IRowType, typename... ITs>
bool operator!=(const iterator_impl<IRowType, ITs...>& rhs) const
{
return mCurrent != rhs.mCurrent;
}
private: private:
template<std::size_t... Is> template<std::size_t... Is>
...@@ -1426,7 +1438,13 @@ class conditional_iterator_proxy ...@@ -1426,7 +1438,13 @@ class conditional_iterator_proxy
} }
bool operator==(const conditional_iterator_impl& rhs) const { return mBegin == rhs.mBegin; } bool operator==(const conditional_iterator_impl& rhs) const { return mBegin == rhs.mBegin; }
bool operator!=(const conditional_iterator_impl& rhs) const { return mBegin != rhs.mBegin; } bool operator!=(const conditional_iterator_impl& rhs) const { return mBegin != rhs.mBegin; }
template<typename IRowType, typename... ITs>
bool operator==(const iterator_impl<IRowType, ITs...>& rhs) const { return mBegin == rhs; }
template<typename IRowType, typename... ITs>
bool operator!=(const iterator_impl<IRowType, ITs...>& rhs) const { return mBegin != rhs; }
private: private:
...@@ -1682,7 +1700,7 @@ class Category ...@@ -1682,7 +1700,7 @@ class Category
conditional_iterator_proxy<Row, Ts...> find(Condition&& cond, char const* const (&columns)[N]) conditional_iterator_proxy<Row, Ts...> find(Condition&& cond, char const* const (&columns)[N])
{ {
static_assert(sizeof...(Ts) == N, "The number of column titles should be equal to the number of types to return"); static_assert(sizeof...(Ts) == N, "The number of column titles should be equal to the number of types to return");
return { *this, begin(), std::forward<Condition>(cond), columns }; return find<Ts...>(cbegin(), std::forward<Condition>(cond), std::forward<char const* const[N]>(columns));
} }
template<typename... Ts, size_t N> template<typename... Ts, size_t N>
...@@ -1692,6 +1710,39 @@ class Category ...@@ -1692,6 +1710,39 @@ class Category
return { *this, pos, std::forward<Condition>(cond), columns }; return { *this, pos, std::forward<Condition>(cond), columns };
} }
// --------------------------------------------------------------------
// if you only expect a single row
Row find1(Condition&& cond)
{
return find1(cbegin(), std::forward<Condition>(cond));
}
Row find1(const_iterator pos, Condition&& cond);
template<typename... Ts, size_t N>
std::tuple<Ts...> find1(Condition&& cond, char const* const (&columns)[N])
{
static_assert(sizeof...(Ts) == N, "The number of column titles should be equal to the number of types to return");
return find1<Ts...>(cbegin(), std::forward<Condition>(cond), std::forward<char const* const[N]>(columns));
}
template<typename... Ts, size_t N>
std::tuple<Ts...> find1(const_iterator pos, Condition&& cond, char const* const (&columns)[N])
{
static_assert(sizeof...(Ts) == N, "The number of column titles should be equal to the number of types to return");
auto h = find<Ts...>(pos, std::forward<Condition>(cond), std::forward<char const* const[N]>(columns));
if (h.empty())
throw std::runtime_error("No hits found");
if (h.size() != 1)
throw std::runtime_error("Hit not unique");
return *h.begin();
}
bool exists(Condition&& cond) const; bool exists(Condition&& cond) const;
RowSet orderBy(const std::string& Item) RowSet orderBy(const std::string& Item)
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
/* define if the Boost library is available */ /* define if the Boost library is available */
#undef HAVE_BOOST #undef HAVE_BOOST
/* define if the Boost::Regex library is available */ /* define if the Boost::IOStreams library is available */
#undef HAVE_BOOST_REGEX #undef HAVE_BOOST_IOSTREAMS
/* define if the compiler supports basic C++17 syntax */ /* define if the compiler supports basic C++17 syntax */
#undef HAVE_CXX17 #undef HAVE_CXX17
...@@ -78,5 +78,23 @@ ...@@ -78,5 +78,23 @@
/* Define to the sub-directory where libtool stores uninstalled libraries. */ /* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR #undef LT_OBJDIR
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */ /* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS #undef STDC_HEADERS
...@@ -1202,4 +1202,9 @@ _test.name ...@@ -1202,4 +1202,9 @@ _test.name
BOOST_CHECK(false); BOOST_CHECK(false);
} }
} }
const auto& [id, name] = db["test"].find1<int, std::string>(cif::Key("id") == 1, { "id", "name" });
BOOST_CHECK(id == 1);
BOOST_CHECK(name == "aap");
} }
#!/bin/sh
set -e
# create cache directory if it doesn't exist
if ! [ -d /var/cache/libcifpp ]; then
install -d -m755 /var/cache/libcifpp
fi
# fetch the dictionary
dict=/var/cache/libcifpp/mmcif_pdbx_v50.cif
source=http://mmcif.wwpdb.org/dictionaries/ascii/mmcif_pdbx_v50.dic.gz
wget -O${dict}.gz ${source}
# be careful not to nuke an existing dictionary file
# extract to a temporary file first
gunzip -c ${dict}.gz > ${dict}-tmp
# then move the extracted file to the final location
mv ${dict}-tmp ${dict}
# and clean up afterwards
rm ${dict}.gz
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment