Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .dev/docker/make_tests.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ RUN cd /app/cbflib && \
RUN cd /app/cbflib && \
source /usr/share/miniconda/etc/profile.d/conda.sh && \
conda activate test && \
make tests
make tests 2>&1 | tee test.out

RUN ! grep -a ignored /app/cbflib/test.out
57 changes: 20 additions & 37 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,10 @@ if(HAVE_FGETLN)
add_compile_definitions("HAVE_FGETLN")
endif()

check_symbol_exists(regcomp "regex.h" HAVE_REGCOMP)
check_symbol_exists(regcomp "regex.h" HAVE_REGEX)
if(HAVE_REGEX)
add_compile_definitions("HAVE_REGEX")
endif()


#
Expand Down Expand Up @@ -457,9 +460,9 @@ fetchcontent_declare(hdf5
URL "https://github.com/HDFGroup/hdf5/releases/download/hdf5_1.14.6/hdf5-1.14.6.tar.gz"
URL_HASH MD5=63426c8e24086634eaf9179a8c5fe9e5)

fetchcontent_declare(pcreposix
URL "http://downloads.sf.net/cbflib/pcre-8.38.tar.gz"
URL_HASH MD5=8a353fe1450216b6655dfcf3561716d9)
fetchcontent_declare(pcre2
URL "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.45/pcre2-10.45.tar.gz"
URL_HASH MD5=88fe01e3f2ec144912ebecf7ef5cd595)

fetchcontent_declare(tiff
URL "http://downloads.sf.net/cbflib/tiff-4.0.6_rev_3Nov16.tar.gz"
Expand Down Expand Up @@ -595,45 +598,25 @@ endif()


#
# PCRE
#
# Linking against an external PCRE1 library (no longer maintained)
# with a libc that has the regex functions will define regcomp(3),
# regerror(3), regexec(3), and regfree(3) twice: do not set
# CBF_WITH_PCRE if libc has the regexec functions. PCRE2 does it
# differently: it defines the regex functions prefixed with pcre2_ and
# maps them onto the unprefixed names with preprocessor directives.
set(CBF_WITH_PCRE OFF CACHE BOOL
# PCRE2
set(CBF_WITH_PCRE2 ON CACHE BOOL
"Link against internally built Perl-compatible regular expressions library")
mark_as_advanced(CBF_WITH_PCRE)

if(CBF_WITH_PCRE)
# Do not try to link pcretest against readline, because the PCRE
# build system does not catch the libtinfo dependency (for tputs and
# friends). Note that PCRE-8.38 is not using GNUInstallDirs; later
# versions may.
#
# PCRE 8.38 reads the DEBUG_LOCATION property of the pcregrep and
# pcretest targets--disable both targets.
set(PCRE_BUILD_PCREGREP OFF CACHE INTERNAL "Bulid pcregrep")
set(PCRE_BUILD_TESTS OFF CACHE INTERNAL "Build the tests")
fetchcontent_makeavailable(pcreposix)

mark_as_advanced(CBF_WITH_PCRE2)

# Always use pcreposix.h from ${pcreposix_SOURCE_DIR} rather than a
# system-supplied header.
target_include_directories(pcreposix PUBLIC
"$<BUILD_INTERFACE:${pcreposix_SOURCE_DIR}>")
if(CBF_WITH_PCRE2)
set(PCRE2_BUILD_PCRE2GREP OFF CACHE INTERNAL "Build pcre2grep")
set(PCRE2_BUILD_TESTS OFF CACHE INTERNAL "Build the tests")
fetchcontent_makeavailable(pcre2)

elseif(HAVE_REGCOMP)
add_library(pcreposix INTERFACE IMPORTED)
target_compile_definitions(pcreposix
elseif(HAVE_REGEX)
add_library(pcre2-posix INTERFACE IMPORTED)
target_compile_definitions(pcre2-posix
INTERFACE CBF_REGEXLIB_REGEX)

else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(pcreposix REQUIRED IMPORTED_TARGET libpcreposix)
add_library(pcreposix ALIAS PkgConfig::pcreposix)
pkg_check_modules(pcre2-posix REQUIRED IMPORTED_TARGET libpcre2-posix)
add_library(pcre2-posix ALIAS PkgConfig::pcre2-posix)
endif()


Expand Down Expand Up @@ -846,7 +829,7 @@ set_target_properties(cbf PROPERTIES LINKER_LANGUAGE C)
set_target_properties(cbf PROPERTIES SOVERSION "${SOVERSION}")
target_link_libraries(cbf
PUBLIC hdf5
PRIVATE pcreposix
PRIVATE pcre2-posix
PRIVATE ${libm})


Expand Down
32 changes: 15 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -516,16 +516,15 @@ endif

REGEX_LIBDIR ?= $(REGEX_PREFIX)/lib
ifneq ($(CBFLIB_DONT_USE_LOCAL_REGEX),yes)
REGEX ?= pcre-8.38
REGEX ?= pcre2-10.45
REGEXDEP = $(REGEX)
REGEX_INSTALL = $(REGEX)_INSTALL
REGEX_LIB ?= pcreposix
REGEX_LIB2 ?= pcre
REGEX_LIB ?= pcre2-posix
ifneq ($(MSYS2),yes)
REGEX_LIBS ?= -L $(REGEX_LIBDIR) -l$(REGEX_LIB) -l$(REGEX_LIB2)
REGEX_LIBS_STATIC = $(LIB)/libpcreposix.a $(LIB)/libpcre.a
REGEX_LIBS ?= -L $(REGEX_LIBDIR) -l$(REGEX_LIB)
REGEX_LIBS_STATIC = $(LIB)/libpcre2-posix.a $(LIB)/libpcre2-8.a
else
REGEX_LIBS ?= -L $(REGEX_LIBDIR) -l$(REGEX_LIB) -l$(REGEX_LIB).dll -l$(REGEX_LIB2) -l$(REGEX_LIB2).dll
REGEX_LIBS ?= -L $(REGEX_LIBDIR) -l$(REGEX_LIB) -l$(REGEX_LIB).dll
REGEX_LIBS_STATIC = $(REGEX_LIBS)
endif
REGEX_INCLUDES ?= -I $(REGEX_PREFIX)
Expand All @@ -534,7 +533,6 @@ REGEX =
REGEXDEP =
REGEX_INSTALL =
REGEX_LIB ?=
REGEX_LIB2 ?=
REGEX_LIBS ?=
REGEX_INCLUDES ?=
endif
Expand Down Expand Up @@ -572,7 +570,7 @@ RANLIB = /usr/bin/ranlib
#
#SIGNATURE ?= /usr/bin/openssl dgst -md5
#SIGNATURE ?= (/usr/bin/openssl dgst -md5 | sed "s/^.*= //")
SIGNATURE ?= ( cat > md5tmp; cmake -E md5sum md5tmp| sed "s/ .*//")
SIGNATURE ?= ( cat > md5tmp; md5sum md5tmp| sed "s/ .*//")

#
# Pipe command to extract all but the first line of a text file
Expand Down Expand Up @@ -667,7 +665,7 @@ endif
ifneq ($(CBF_NO_REGEX),)
CBF_REGEXFLAG = -DCBF_NO_REGEX
else
CBF_REGEXFLAG = -DCBF_REGEXLIB_REGEX
CBF_REGEXFLAG = -DHAVE_REGEX
endif

ifneq ($(CBF_USE_ULP),)
Expand Down Expand Up @@ -783,7 +781,7 @@ ifneq ($(CBFLIB_DONT_USE_PY3CIFRW),yes)
PY3CIFRWURL = http://downloads.sf.net/cbflib/$(PY3CIFRW).tar.gz
PY3PLYURL = http://downloads.sf.net/cbflib/$(PY3PLY).tar.gz
endif
REGEX_URL ?= http://downloads.sf.net/cbflib/$(REGEX).tar.gz
REGEX_URL ?= https://github.com/PCRE2Project/pcre2/releases/download/$(REGEX)/$(REGEX).tar.gz
TIFF_URL ?= http://downloads.sf.net/cbflib/$(TIFF).tar.gz
HDF5_URL ?= https://github.com/HDFGroup/hdf5/releases/download/hdf5_1.14.6/$(HDF5).tar.gz
ifneq ($(CBFLIB_DONT_USE_LOCAL_NUWEB),yes)
Expand Down Expand Up @@ -1609,13 +1607,13 @@ $(REGEX): build_regex
(cd $(REGEX); \
prefix=$(REGEX_PREFIX); export prefix; \
./configure --prefix=$(REGEX_PREFIX); make install)
@-cp $(REGEX_PREFIX)/include/pcreposix.h $(REGEX_PREFIX)/include/regex.h
@-cp $(REGEX_PREFIX)/include/pcre2posix.h $(REGEX_PREFIX)/include/regex.h
$(REGEX)_INSTALL: $(REGEX)
-rm -rf $(REGEX)_install
rsync -avz $(REGEX)/ $(REGEX)_install
(cd $(REGEX)_install; prefix=$(CBF_PREFIX); export prefix; \
make distclean; ./configure --prefix=$(CBF_PREFIX); make install )
@-cp $(CBF_PREFIX)/include/pcreposix.h $(CBF_PREFIX)/include/regex.h
@-cp $(CBF_PREFIX)/include/pcre2posix.h $(CBF_PREFIX)/include/regex.h

#
# TIFF
Expand Down Expand Up @@ -1973,12 +1971,12 @@ $(PY2CBF)/py2cbfuserinstall: $(PY2CBF)/pycbf.py
(cd $(PY2CBF); $(PYTHON2) $(PY2INSTALLSETUP_PY) install $(PY2CBFIOPT) --user)

$(PY2CBF)/py2setup.py: $(PY2CBF)/py2setup_py.m4
(m4 -P -Dregexlib=$(REGEX_LIB) -Dregexlib2=$(REGEX_LIB2) \
(m4 -P -Dregexlib=$(REGEX_LIB) \
-Dregexlibdir=$(REGEX_LIBDIR) -Dhdf5_prefix=$(HDF5_PREFIX) \
$(PY2CBF)/py2setup_py.m4 > $@)

$(PY2CBF)/py2setup_MINGW.py: $(PY2CBF)/setup_py.m4
(m4 -P -Dregexlib=$(REGEX_LIB) -Dregexlib2=$(REGEX_LIB2) \
(m4 -P -Dregexlib=$(REGEX_LIB) \
-Dregexlibdir=$(REGEX_LIBDIR) -Dhdf5_prefix=$(HDF5_PREFIX) \
$(PY2CBF)/py2setup_py.m4 > $@)

Expand Down Expand Up @@ -2046,12 +2044,12 @@ $(PY3CBF)/py3cbfuserinstall: $(PY3CBF)/pycbf.py
(cd $(PY3CBF); $(PYTHON3) $(PY3INSTALLSETUP_PY) install $(PY3CBFIOPT) --user)

$(PY3CBF)/py3setup.py: $(PY3CBF)/py3setup_py.m4
(m4 -P -Dregexlib=$(REGEX_LIB) -Dregexlib2=$(REGEX_LIB2) \
(m4 -P -Dregexlib=$(REGEX_LIB) \
-Dregexlibdir=$(REGEX_LIBDIR) -Dhdf5_prefix=$(HDF5_PREFIX) \
$(PY3CBF)/py3setup_py.m4 > $@)

$(PY3CBF)/py3setup_MINGW.py: $(PY3CBF)/py3setup_py.m4
(m4 -P -Dregexlib=$(REGEX_LIB) -Dregexlib2=$(REGEX_LIB2) \
(m4 -P -Dregexlib=$(REGEX_LIB) \
-Dregexlibdir=$(REGEX_LIBDIR) -Dhdf5_prefix=$(HDF5_PREFIX) \
$(PY3CBF)/py3setup_py.m4 > $@)

Expand Down Expand Up @@ -3138,7 +3136,7 @@ endif
@-rm -f include/pcre_stringpiece.h
@-rm -f include/pcrecpp.h
@-rm -f include/pcrecpparg.h
@-rm -f include/pcreposix.h
@-rm -f include/pcre2posix.h
@-rm -f include/regex.h
@-rm -f minicbf_test/X4_lots_M1S4_1_0001.cbf
@-rm -f minicbf_test/X4_lots_M1S4_1_0002.cbf
Expand Down
32 changes: 15 additions & 17 deletions Makefile_LINUX
Original file line number Diff line number Diff line change
Expand Up @@ -516,16 +516,15 @@ endif

REGEX_LIBDIR ?= $(REGEX_PREFIX)/lib
ifneq ($(CBFLIB_DONT_USE_LOCAL_REGEX),yes)
REGEX ?= pcre-8.38
REGEX ?= pcre2-10.45
REGEXDEP = $(REGEX)
REGEX_INSTALL = $(REGEX)_INSTALL
REGEX_LIB ?= pcreposix
REGEX_LIB2 ?= pcre
REGEX_LIB ?= pcre2-posix
ifneq ($(MSYS2),yes)
REGEX_LIBS ?= -L $(REGEX_LIBDIR) -l$(REGEX_LIB) -l$(REGEX_LIB2)
REGEX_LIBS_STATIC = $(LIB)/libpcreposix.a $(LIB)/libpcre.a
REGEX_LIBS ?= -L $(REGEX_LIBDIR) -l$(REGEX_LIB)
REGEX_LIBS_STATIC = $(LIB)/libpcre2-posix.a $(LIB)/libpcre2-8.a
else
REGEX_LIBS ?= -L $(REGEX_LIBDIR) -l$(REGEX_LIB) -l$(REGEX_LIB).dll -l$(REGEX_LIB2) -l$(REGEX_LIB2).dll
REGEX_LIBS ?= -L $(REGEX_LIBDIR) -l$(REGEX_LIB) -l$(REGEX_LIB).dll
REGEX_LIBS_STATIC = $(REGEX_LIBS)
endif
REGEX_INCLUDES ?= -I $(REGEX_PREFIX)
Expand All @@ -534,7 +533,6 @@ REGEX =
REGEXDEP =
REGEX_INSTALL =
REGEX_LIB ?=
REGEX_LIB2 ?=
REGEX_LIBS ?=
REGEX_INCLUDES ?=
endif
Expand Down Expand Up @@ -572,7 +570,7 @@ RANLIB = /usr/bin/ranlib
#
#SIGNATURE ?= /usr/bin/openssl dgst -md5
#SIGNATURE ?= (/usr/bin/openssl dgst -md5 | sed "s/^.*= //")
SIGNATURE ?= ( cat > md5tmp; cmake -E md5sum md5tmp| sed "s/ .*//")
SIGNATURE ?= ( cat > md5tmp; md5sum md5tmp| sed "s/ .*//")

#
# Pipe command to extract all but the first line of a text file
Expand Down Expand Up @@ -667,7 +665,7 @@ endif
ifneq ($(CBF_NO_REGEX),)
CBF_REGEXFLAG = -DCBF_NO_REGEX
else
CBF_REGEXFLAG = -DCBF_REGEXLIB_REGEX
CBF_REGEXFLAG = -DHAVE_REGEX
endif

ifneq ($(CBF_USE_ULP),)
Expand Down Expand Up @@ -779,7 +777,7 @@ ifneq ($(CBFLIB_DONT_USE_PY3CIFRW),yes)
PY3CIFRWURL = http://downloads.sf.net/cbflib/$(PY3CIFRW).tar.gz
PY3PLYURL = http://downloads.sf.net/cbflib/$(PY3PLY).tar.gz
endif
REGEX_URL ?= http://downloads.sf.net/cbflib/$(REGEX).tar.gz
REGEX_URL ?= https://github.com/PCRE2Project/pcre2/releases/download/$(REGEX)/$(REGEX).tar.gz
TIFF_URL ?= http://downloads.sf.net/cbflib/$(TIFF).tar.gz
HDF5_URL ?= https://github.com/HDFGroup/hdf5/releases/download/hdf5_1.14.6/$(HDF5).tar.gz
ifneq ($(CBFLIB_DONT_USE_LOCAL_NUWEB),yes)
Expand Down Expand Up @@ -1605,13 +1603,13 @@ $(REGEX): build_regex
(cd $(REGEX); \
prefix=$(REGEX_PREFIX); export prefix; \
./configure --prefix=$(REGEX_PREFIX); make install)
@-cp $(REGEX_PREFIX)/include/pcreposix.h $(REGEX_PREFIX)/include/regex.h
@-cp $(REGEX_PREFIX)/include/pcre2posix.h $(REGEX_PREFIX)/include/regex.h
$(REGEX)_INSTALL: $(REGEX)
-rm -rf $(REGEX)_install
rsync -avz $(REGEX)/ $(REGEX)_install
(cd $(REGEX)_install; prefix=$(CBF_PREFIX); export prefix; \
make distclean; ./configure --prefix=$(CBF_PREFIX); make install )
@-cp $(CBF_PREFIX)/include/pcreposix.h $(CBF_PREFIX)/include/regex.h
@-cp $(CBF_PREFIX)/include/pcre2posix.h $(CBF_PREFIX)/include/regex.h

#
# TIFF
Expand Down Expand Up @@ -1969,12 +1967,12 @@ $(PY2CBF)/py2cbfuserinstall: $(PY2CBF)/pycbf.py
(cd $(PY2CBF); $(PYTHON2) $(PY2INSTALLSETUP_PY) install $(PY2CBFIOPT) --user)

$(PY2CBF)/py2setup.py: $(PY2CBF)/py2setup_py.m4
(m4 -P -Dregexlib=$(REGEX_LIB) -Dregexlib2=$(REGEX_LIB2) \
(m4 -P -Dregexlib=$(REGEX_LIB) \
-Dregexlibdir=$(REGEX_LIBDIR) -Dhdf5_prefix=$(HDF5_PREFIX) \
$(PY2CBF)/py2setup_py.m4 > $@)

$(PY2CBF)/py2setup_MINGW.py: $(PY2CBF)/setup_py.m4
(m4 -P -Dregexlib=$(REGEX_LIB) -Dregexlib2=$(REGEX_LIB2) \
(m4 -P -Dregexlib=$(REGEX_LIB) \
-Dregexlibdir=$(REGEX_LIBDIR) -Dhdf5_prefix=$(HDF5_PREFIX) \
$(PY2CBF)/py2setup_py.m4 > $@)

Expand Down Expand Up @@ -2042,12 +2040,12 @@ $(PY3CBF)/py3cbfuserinstall: $(PY3CBF)/pycbf.py
(cd $(PY3CBF); $(PYTHON3) $(PY3INSTALLSETUP_PY) install $(PY3CBFIOPT) --user)

$(PY3CBF)/py3setup.py: $(PY3CBF)/py3setup_py.m4
(m4 -P -Dregexlib=$(REGEX_LIB) -Dregexlib2=$(REGEX_LIB2) \
(m4 -P -Dregexlib=$(REGEX_LIB) \
-Dregexlibdir=$(REGEX_LIBDIR) -Dhdf5_prefix=$(HDF5_PREFIX) \
$(PY3CBF)/py3setup_py.m4 > $@)

$(PY3CBF)/py3setup_MINGW.py: $(PY3CBF)/py3setup_py.m4
(m4 -P -Dregexlib=$(REGEX_LIB) -Dregexlib2=$(REGEX_LIB2) \
(m4 -P -Dregexlib=$(REGEX_LIB) \
-Dregexlibdir=$(REGEX_LIBDIR) -Dhdf5_prefix=$(HDF5_PREFIX) \
$(PY3CBF)/py3setup_py.m4 > $@)

Expand Down Expand Up @@ -3134,7 +3132,7 @@ endif
@-rm -f include/pcre_stringpiece.h
@-rm -f include/pcrecpp.h
@-rm -f include/pcrecpparg.h
@-rm -f include/pcreposix.h
@-rm -f include/pcre2posix.h
@-rm -f include/regex.h
@-rm -f minicbf_test/X4_lots_M1S4_1_0001.cbf
@-rm -f minicbf_test/X4_lots_M1S4_1_0002.cbf
Expand Down
Loading