From: Mark Wooding Date: Sun, 30 Mar 2025 02:39:15 +0000 (+0100) Subject: Replace build system with Autotools, and Debianize. X-Git-Tag: 0.99.0^0 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/xyla/commitdiff_plain/3c4cffd5c601d49db68857bf1d6488ae03c2fe5e Replace build system with Autotools, and Debianize. --- diff --git a/.gitignore b/.gitignore index f6848b7..4c72fd0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,27 @@ -*.o -*.d -*.a -*.out -/soak.ckpt -/avltest -/rbtest +## Pervasive build machinery. +Makefile.in + +## Top-level generated files. +/aclocal.m4 +/autom4te.cache/ +/configure + +## GNU build system machinery installed by `autoreconf'. +/config/compile +/config/config.guess +/config/config.sub +/config/depcomp +/config/install-sh +/config/ltmain.sh +/config/missing +/config/test-driver +/m4/libtool.m4 +/m4/ltoptions.m4 +/m4/ltsugar.m4 +/m4/ltversion.m4 +/m4/lt~obsolete.m4 + +## Test machinery. +/t/package.m4 +/t/testsuite +/t/tests.m4 diff --git a/COPYING.LIB b/COPYING.LIB new file mode 120000 index 0000000..610fc52 --- /dev/null +++ b/COPYING.LIB @@ -0,0 +1 @@ +.ext/cfd/licence/LGPL-3 \ No newline at end of file diff --git a/INSTALL b/INSTALL new file mode 120000 index 0000000..1483568 --- /dev/null +++ b/INSTALL @@ -0,0 +1 @@ +.ext/cfd/doc/INSTALL \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index a3369b3..0000000 --- a/Makefile +++ /dev/null @@ -1,196 +0,0 @@ -### -*-makefile-*- -### -### Build script -### -### (c) 2024 Straylight/Edgeware -### - -###----- Licensing notice --------------------------------------------------- -### -### This file is part of Xyla, a library of binary trees. -### -### Xyla is free software: you can redistribute it and/or modify it under -### the terms of the GNU Lesser General Public License as published by the -### Free Software Foundation; either version 3 of the License, or (at your -### option) any later version. -### -### Xyla is distributed in the hope that it will be useful, but WITHOUT -### ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -### FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -### License for more details. -### -### You should have received a copy of the GNU Lesser General Public -### License along with Xyla. If not, see . - -###-------------------------------------------------------------------------- -### Preliminaries. - -all: -check: -clean:: -soak: -.PHONY: all check clean soak - -.SECONDEXPANSION: - -###-------------------------------------------------------------------------- -### Configuration tweaks. - -CC = gcc -OPTIMIZE = -Og -g3 -WARNINGS = -pedantic -Wall -CFLAGS = $(OPTIMIZE) $(WARNINGS) $(CFLAGS.t) - -AR = ar - -VERBOSE = nil -FREESTANDING = nil -SOAKSTEPS = 1000000 - -###-------------------------------------------------------------------------- -### Machinery. - -CFLAGS.t = -CFLAGS.nil = - -CFLAGS.$(VERBOSE) += -DXYLA_VERBOSE -CFLAGS.$(FREESTANDING) += -DXYLA_FREESTANDING - -not = $(not.$1) -not.t = nil -not.nil = t - -TARGETS = -CLEAN = - -V = 0 -V_AT = $(V_AT.$V) -V_AT.0 = @ -v-tag = $(call v-tag.$V,$1,$2) -v-tag.0 = @printf " %-8s %s\n" $1 $(or $2,$@); - -SRCEXT = -objify = $(addsuffix .o, \ - $(basename \ - $(filter $(addprefix %, $(SRCEXT)), \ - $1))) -CLEAN += *.o - -compile = $(call v-tag,$1)$(CC) -c $(CFLAGS) $4 \ - -MD -MF $(2:.o=.d) -o$2 $3 -DEPOBJS = -CLEAN += *.d - -SRCEXT += .c -%.o: %.c - $(call compile,CC,$@,$<) - -all.t all.nil: -all: all.t -.PHONY: all.t all.nil - -###-------------------------------------------------------------------------- -### Building the library. - -all: libxyla.a -CLEAN += libxyla.a -LIBSRCS = $(LIBSRCS.t) -LIBSRCS.t = -LIBOBJS = $(call objify, $(LIBSRCS)) -DEPOBJS += $(LIBOBJS) - -LIBSRCS += base.c -LIBSRCS += diag.c - -LIBSRCS.$(call not,$(FREESTANDING)) += bt-check.c -LIBSRCS += bt-rm.c -LIBSRCS += bt-set.c -LIBSRCS += bt-sever.c - -TREES = -LIBSRCS += $(foreach t,$(TREES), \ - $($t_LIBSRCS) $($t_LIBSRCS.t)) - -COMMON_TESTS = commontest - -TREES += avl -avl_LIBSRCS = -avl_LIBSRCS.t = -avl_LIBSRCS.nil = -avl_LIBSRCS += avl-addrm.c -avl_LIBSRCS.$(call not,$(FREESTANDING)) += avl-check.c -avl_LIBSRCS += avl-iter.c -avl_LIBSRCS += avl-misc.c -avl_LIBSRCS += avl-path.c -avl_LIBSRCS += avl-search.c -avl_LIBSRCS += avl-set.c -avl_LIBSRCS += avl-splitjoin.c -avl_DEFINES = -DTREE=AVL -avl_TESTS = avltest avlregress - -TREES += rb -rb_LIBSRCS = -rb_LIBSRCS.t = -rb_LIBSRCS.nil = -rb_LIBSRCS += rb-addrm.c -rb_LIBSRCS.$(call not,$(FREESTANDING)) += rb-check.c -rb_LIBSRCS += rb-iter.c -rb_LIBSRCS += rb-misc.c -rb_LIBSRCS += rb-path.c -rb_LIBSRCS += rb-search.c -rb_LIBSRCS += rb-set.c -rb_LIBSRCS += rb-splitjoin.c -rb_DEFINES = -DTREE=RB -rb_TESTS = rbtest rbregress - -libxyla.a: $(LIBOBJS) - $(call v-tag,AR)$(AR) crs $@ $+ - -###-------------------------------------------------------------------------- -### Testing. - -TREE_TESTS = $(foreach t,$(TREES), $ttest) -all.$(call not,$(FREESTANDING)): $(TREE_TESTS) -CLEAN += $(TREE_TESTS) -$(TREE_TESTS): %test: treetest.%.o libxyla.a - $(call v-tag,LD)$(CC) -o$@ $+ - -$(foreach t,$(TREES), treetest.$t.o): treetest.%.o: treetest.c - $(call compile,CC,$@,$<, $($*_DEFINES)) -DEPOBJS += $(foreach t,$(TREES), treetest.$t.o) - -TESTS = $(foreach t,$(TREES), check-$t) -check: $(TESTS) - -define tree-tests -$1_ALLTESTS = $$(foreach t,$$(COMMON_TESTS) $$($1_TESTS), $1-$$t) -$1_CHECK = $$(foreach t,$$($1_ALLTESTS), check-$$t) -check-$1: $$($1_CHECK) -$$($1_CHECK): check-$1-%: $1test %.in | $1-%.ref - $$(call v-tag,TEST)./$1test -o$1-$$*.out $$*.in && diff -u $1-$$*.out $1-$$*.ref -$$(foreach t,$$($1_ALLTESTS), $$t.ref): $1-%.ref: | %.in $1test - $$(call v-tag,GEN)./$1test -o$$@.new $$*.in && mv $$@.new $$@ -.PHONY: check-$1 $$($1_CHECK) -endef -$(foreach t,$(TREES), $(eval $(call tree-tests,$t))) -CLEAN += *.out - -ref: $(foreach t,$(TREES), $(foreach i,$($t_ALLTESTS), $i.ref)) -.PHONY: ref - -ALL_SOAKS = $(foreach t,$(TREES), soak-$t) -soak: $(ALL_SOAKS) -$(ALL_SOAKS): soak-%: %test - $(call v-tag,SOAK)./soak -fsoak-$*.ckpt -n$(SOAKSTEPS) ./$*test -CLEAN += soak-*.ckpt -.PHONY: $(ALL_SOAKS) - -###-------------------------------------------------------------------------- -### Finishing touches. - -clean::; rm -f $(CLEAN) --include $(DEPOBJS:.o=.d) - -p:; : $p - -###----- That's all, folks -------------------------------------------------- diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..7d4e620 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,114 @@ +### -*-makefile-*- +### +### Build script for Xyla +### +### (c) 2024 Straylight/Edgeware +### + +###----- Licensing notice --------------------------------------------------- +### +### This file is part of Xyla, a library of binary trees. +### +### Xyla is free software: you can redistribute it and/or modify it under +### the terms of the GNU Lesser General Public License as published by the +### Free Software Foundation; either version 3 of the License, or (at your +### option) any later version. +### +### Xyla is distributed in the hope that it will be useful, but WITHOUT +### ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +### FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +### License for more details. +### +### You should have received a copy of the GNU Lesser General Public +### License along with Xyla. If not, see . + +include vars.am + +ACLOCAL_AMFLAGS = -Im4 + +SUBDIRS = + +lib_LTLIBRARIES = +pkginclude_HEADERS = + +SUBDIRS += . + +###-------------------------------------------------------------------------- +### Library. + +## The library itself. +lib_LTLIBRARIES += libxyla.la +libxyla_la_LDFLAGS = -version-info $(LIBTOOL_VERSION_INFO) +libxyla_la_SOURCES = +LDADD += libxyla.la + +libxyla_la_SOURCES += lib.h +libxyla_la_SOURCES += base.c +libxyla_la_SOURCES += diag.c + +pkginclude_HEADERS += bt.h +libxyla_la_SOURCES += bt-check.c +libxyla_la_SOURCES += bt-rm.c +libxyla_la_SOURCES += bt-sever.c +libxyla_la_SOURCES += bt-set.c + +pkginclude_HEADERS += avl.h +libxyla_la_SOURCES += avl-addrm.c +libxyla_la_SOURCES += avl-check.c +libxyla_la_SOURCES += avl-iter.c +libxyla_la_SOURCES += avl-misc.c +libxyla_la_SOURCES += avl-path.c +libxyla_la_SOURCES += avl-search.c +libxyla_la_SOURCES += avl-set.c +libxyla_la_SOURCES += avl-splitjoin.c + +pkginclude_HEADERS += rb.h +libxyla_la_SOURCES += rb-addrm.c +libxyla_la_SOURCES += rb-check.c +libxyla_la_SOURCES += rb-iter.c +libxyla_la_SOURCES += rb-misc.c +libxyla_la_SOURCES += rb-path.c +libxyla_la_SOURCES += rb-search.c +libxyla_la_SOURCES += rb-set.c +libxyla_la_SOURCES += rb-splitjoin.c + +## Package description. +pkgconf_DATA += xyla.pc +CLEANFILES += xyla.pc +EXTRA_DIST += xyla.pc.in + +xyla.pc: xyla.pc.in Makefile + $(SUBST) $(srcdir)/xyla.pc.in >$@.new $(SUBSTITUTIONS) \ + && mv $@.new $@ + +###-------------------------------------------------------------------------- +### Other subdirectories. + +## Testing. +SUBDIRS += t + +###-------------------------------------------------------------------------- +### Other finishing touches. + +## Version stamp. +dist-hook:: + echo $(VERSION) >$(distdir)/RELEASE + +## Build tools. +EXTRA_DIST += config/auto-version +EXTRA_DIST += config/confsubst + +###-------------------------------------------------------------------------- +### Debian. + +## Main stuff. +EXTRA_DIST += debian/changelog debian/compat debian/control +EXTRA_DIST += debian/copyright debian/rules debian/source/format + +## Library. +EXTRA_DIST += debian/libxyla0.install +EXTRA_DIST += debian/libxyla0.shlibs +EXTRA_DIST += debian/libxyla0.symbols +EXTRA_DIST += debian/libxyla-dev.install + +###----- That's all, folks -------------------------------------------------- diff --git a/config/auto-version b/config/auto-version new file mode 120000 index 0000000..652e105 --- /dev/null +++ b/config/auto-version @@ -0,0 +1 @@ +../.ext/cfd/build/auto-version \ No newline at end of file diff --git a/config/autotest.am b/config/autotest.am new file mode 120000 index 0000000..2309b1e --- /dev/null +++ b/config/autotest.am @@ -0,0 +1 @@ +../.ext/cfd/build/autotest.am \ No newline at end of file diff --git a/config/confsubst b/config/confsubst new file mode 120000 index 0000000..8e7de22 --- /dev/null +++ b/config/confsubst @@ -0,0 +1 @@ +../.ext/cfd/build/confsubst \ No newline at end of file diff --git a/config/testsuite.at b/config/testsuite.at new file mode 120000 index 0000000..78fa5b5 --- /dev/null +++ b/config/testsuite.at @@ -0,0 +1 @@ +../.ext/cfd/build/testsuite.at \ No newline at end of file diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..955b0b2 --- /dev/null +++ b/configure.ac @@ -0,0 +1,54 @@ +dnl -*-autoconf-*- +dnl +dnl Configuration script for Xyla +dnl +dnl (c) 2024 Straylight/Edgeware +dnl + +dnl----- Licensing notice --------------------------------------------------- +dnl +dnl This file is part of Xyla, a library of binary trees. +dnl +dnl Xyla is free software: you can redistribute it and/or modify it under +dnl the terms of the GNU Lesser General Public License as published by the +dnl Free Software Foundation; either version 3 of the License, or (at your +dnl option) any later version. +dnl +dnl Xyla is distributed in the hope that it will be useful, but WITHOUT +dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +dnl License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with Xyla. If not, see . + +mdw_AUTO_VERSION +AC_INIT([xyla], AUTO_VERSION, [mdw@distorted.org.uk]) +AC_CONFIG_SRCDIR([bt.h]) +AC_CONFIG_AUX_DIR([config]) +AC_CONFIG_MACRO_DIRS([m4]) +AM_INIT_AUTOMAKE([foreign]) +mdw_SILENT_RULES + +AC_CHECK_PROGS([AUTOM4TE], [autom4te]) +AM_PATH_PYTHON([2.7],, [:]) + +dnl-------------------------------------------------------------------------- +dnl C language environment. + +dnl Compiler and tools. +AC_PROG_CC +AX_CFLAGS_WARN_ALL +AM_PROG_LIBTOOL +mdw_LIBTOOL_VERSION_INFO +AC_SUBST([AM_CFLAGS]) + +dnl-------------------------------------------------------------------------- +dnl Output. + +AC_CONFIG_TESTDIR([t]) +AC_CONFIG_FILES([Makefile t/Makefile t/atlocal]) + +AC_OUTPUT + +dnl----- That's all, folks -------------------------------------------------- diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..f4c9f3c --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +libxyla (0.99.0~) unstable; urgency=medium + + * Initial version. + + -- Mark Wooding Mon, 09 Sep 2024 11:04:05 +0100 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +10 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..a86e212 --- /dev/null +++ b/debian/control @@ -0,0 +1,39 @@ +Source: libxyla +Section: libs +Priority: optional +Maintainer: Mark Wooding +Build-Depends: + debhelper (>= 10), + autoconf, automake, libtool, autoconf-archive, + python3 | python +Standards-Version: 4.3.0 + +Package: libxyla0 +Architecture: any +Multi-Arch: same +Depends: ${shlibs:Depends}, ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} +Description: Library of fast, hard-mode binary tree implementations (run-time) + The Xyla library implements AVL trees, red-black trees, splay trees, and + treaps. It provides search, iteration, insertion, deletion, splitting and + joining, and set operations. It supports search, update, and retrieval of + user-defined annotations. Except for the invariant-checking functionality, + the library allocates no memory of its own. The algorithm implementations + are nonrecursive. + . + This package provides the run-time library. + +Package: libxyla-dev +Architecture: any +Depends: libxyla0 (= ${binary:Version}), libc6-dev, ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} +Description: Library of fast, hard-mode binary tree implementations (development) + The Xyla library implements AVL trees, red-black trees, splay trees, and + treaps. It provides search, iteration, insertion, deletion, splitting and + joining, and set operations. It supports search, update, and retrieval of + user-defined annotations. Except for the invariant-checking functionality, + the library allocates no memory of its own. The algorithm implementations + are nonrecursive. + . + This package contains the header files and static libraries needed to + compile programs which use Xyla. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..70fda68 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,108 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Copyright: + 1999, 2002--2006, 2008, 2010, 2013, 2017, 2019, 2020, 2024 + Mark Wooding + 1996, 1997, 1999, 2000, 2003, 2004, 2008--2010, 2013, 2016, 2019, + 2020 Straylight/Edgeware + 1989, 1991, 1994--1996 1999--2002, 2004--2012 Free Software + Foundation +Upstream-Name: libxyla +Upstream-Contact: Mark Wooding +Source: https://ftp.distorted.org.uk/pub/mdw/ +License: LGPL-3.0+ + +Files: * +Copyright: 2024 Straylight/Edgeware +LIcense: LGPL-3.0+ + +Files: .ext/cfd/build/* +Copyright: 2003, 2008--2010, 2013, 2016, 2019, 2020 Straylight/Edgeware +License: GPL-2.0+ + +Files: ext/cfd/src/* +Copyright: 1996, 1997, 1999, 2000, 2004, 2008 Straylight/Edgeware +License: LGPL-2.0+ + +Files: ext/cfd/build/auto-version ext/cfd/build/confsubst + ext/cfd/doc/texinice.tex ext/cfd/m4/*.m4 +Copyright: 1999, 2002--2006, 2008, 2010, 2013, 2017, 2019, 2020, 2024 + Mark Wooding +License: GPL-2.0+ + +Files: ext/cfd/doc/INSTALL +Copyright: 1994--1996, 1999--2002, 2004--2012 Free Software Foundation +License: FSFAP + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. This file is offered as-is, + without warranty of any kind. + +Files: ext/cfd/licence/* +Copyright: 1989, 1991, 1999, 2007 Free Software Foundation +License: FSF-meta-licence + Everyone is permitted to copy and distribute verbatim copies of this + license document, but changing it is not allowed. + +Files: ext/cfd/src/getdate.* +Copyright: + (unknown dates) Steven M. Bellovin + (unknown dates) `a couple of people on Usenet' + 1994 Rich Salz + 1994 Jim Berets + 1999 Mark Wooding +License: public-domain + This code is in the public domain and has no copyright. + +License: GPL-2.0+ + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this package; if not, see . +Comment: + On Debian systems, the full text of the GNU General Public License + version 2 can be found in the file '/usr/share/common-licenses/GPL-2'. + +License: LGPL-2.0+ + This library is free software; you can redistribute it and/or modify + modify it under the terms of the GNU Library General Public License + as published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + . + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + . + You should have received a copy of the GNU Library General Public + License along with this package; if not, see + . +Comment: + On Debian systems, the full text of the GNU Library General Public + License version 2 can be found in the file + '/usr/share/common-licenses/LGPL-2'. + +License: LGPL-3.0+ + Xyla is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. + . + Xyla is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + . + You should have received a copy of the GNU Lesser General Public + License along with Xyla. If not, see . +Comment: + On Debian systems, the full text of the GNU Lesser General Public + License version 3 can be found in the file + '/usr/share/common-licenses/LGPL-3'. diff --git a/debian/libxyla-dev.install b/debian/libxyla-dev.install new file mode 100644 index 0000000..3a9bb3c --- /dev/null +++ b/debian/libxyla-dev.install @@ -0,0 +1,5 @@ +debian/tmp/usr/include +debian/tmp/usr/lib/*/libxyla.a +debian/tmp/usr/lib/*/libxyla.la +debian/tmp/usr/lib/*/libxyla.so +debian/tmp/usr/lib/*/pkgconfig diff --git a/debian/libxyla0.install b/debian/libxyla0.install new file mode 100644 index 0000000..ee59b44 --- /dev/null +++ b/debian/libxyla0.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/*/libxyla.so.* diff --git a/debian/libxyla0.shlibs b/debian/libxyla0.shlibs new file mode 100644 index 0000000..086dea5 --- /dev/null +++ b/debian/libxyla0.shlibs @@ -0,0 +1,2 @@ +### -*-conf-*- +libxyla 0 libxyla0 (>= 0.99.0~) diff --git a/debian/libxyla0.symbols b/debian/libxyla0.symbols new file mode 100644 index 0000000..c294047 --- /dev/null +++ b/debian/libxyla0.symbols @@ -0,0 +1,81 @@ +### -*-conf-*- + +libxyla.so.0 libxyla0 #MINVER# +* Build-Depends-Package: libxyla-dev + +## Binary tree basics. + xyla_strerror@Base 0.99.0~ + xyla_bt_check@Base 0.99.0~ + xyla_bt_bughdr@Base 0.99.0~ + xyla_bt_printnode@Base 0.99.0~ + xyla_bt_chkorder@Base 0.99.0~ + xyla_bt_severfirst@Base 0.99.0~ + xyla_bt_remove@Base 0.99.0~ + xyla_bt_unisect@Base 0.99.0~ + xyla_bt_diffsect@Base 0.99.0~ + +## AVL trees. + xyla_avl_height@Base 0.99.0~ + xyla_avl_inititer@Base 0.99.0~ + xyla_avl_next@Base 0.99.0~ + xyla_avl_initriter@Base 0.99.0~ + xyla_avl_prev@Base 0.99.0~ + xyla_avl_current@Base 0.99.0~ + xyla_avl_copypath@Base 0.99.0~ + xyla_avl_firstpath@Base 0.99.0~ + xyla_avl_lastpath@Base 0.99.0~ + xyla_avl_nextpath@Base 0.99.0~ + xyla_avl_prevpath@Base 0.99.0~ + xyla_avl_beforepath@Base 0.99.0~ + xyla_avl_afterpath@Base 0.99.0~ + xyla_avl_rootpath@Base 0.99.0~ + xyla_avl_uppath@Base 0.99.0~ + xyla_avl_leftpath@Base 0.99.0~ + xyla_avl_rightpath@Base 0.99.0~ + xyla_avl_replace@Base 0.99.0~ + xyla_avl_ripple@Base 0.99.0~ + xyla_avl_ascend@Base 0.99.0~ + xyla_avl_lookup@Base 0.99.0~ + xyla_avl_probe@Base 0.99.0~ + xyla_avl_insert@Base 0.99.0~ + xyla_avl_remove@Base 0.99.0~ + xyla_avl_join@Base 0.99.0~ + xyla_avl_split@Base 0.99.0~ + xyla_avl_splitat@Base 0.99.0~ + xyla_avl_splitroot@Base 0.99.0~ + xyla_avl_unisect@Base 0.99.0~ + xyla_avl_diffsect@Base 0.99.0~ + xyla_avl_check@Base 0.99.0~ + +## Red-black trees. + xyla_rb_height@Base 0.99.0~ + xyla_rb_inititer@Base 0.99.0~ + xyla_rb_next@Base 0.99.0~ + xyla_rb_initriter@Base 0.99.0~ + xyla_rb_prev@Base 0.99.0~ + xyla_rb_current@Base 0.99.0~ + xyla_rb_copypath@Base 0.99.0~ + xyla_rb_firstpath@Base 0.99.0~ + xyla_rb_lastpath@Base 0.99.0~ + xyla_rb_nextpath@Base 0.99.0~ + xyla_rb_prevpath@Base 0.99.0~ + xyla_rb_beforepath@Base 0.99.0~ + xyla_rb_afterpath@Base 0.99.0~ + xyla_rb_rootpath@Base 0.99.0~ + xyla_rb_uppath@Base 0.99.0~ + xyla_rb_leftpath@Base 0.99.0~ + xyla_rb_rightpath@Base 0.99.0~ + xyla_rb_replace@Base 0.99.0~ + xyla_rb_ripple@Base 0.99.0~ + xyla_rb_ascend@Base 0.99.0~ + xyla_rb_lookup@Base 0.99.0~ + xyla_rb_probe@Base 0.99.0~ + xyla_rb_insert@Base 0.99.0~ + xyla_rb_remove@Base 0.99.0~ + xyla_rb_join@Base 0.99.0~ + xyla_rb_split@Base 0.99.0~ + xyla_rb_splitat@Base 0.99.0~ + xyla_rb_splitroot@Base 0.99.0~ + xyla_rb_unisect@Base 0.99.0~ + xyla_rb_diffsect@Base 0.99.0~ + xyla_rb_check@Base 0.99.0~ diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..a0a9604 --- /dev/null +++ b/debian/rules @@ -0,0 +1,7 @@ +#! /usr/bin/make -f + +DH_OPTIONS = --parallel -Bdebian/build +%:; dh $@ $(DH_OPTIONS) + +override_dh_makeshlibs: + dh_makeshlibs -- -c4 diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..d3827e7 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +1.0 diff --git a/m4/mdw-auto-version.m4 b/m4/mdw-auto-version.m4 new file mode 120000 index 0000000..db358e4 --- /dev/null +++ b/m4/mdw-auto-version.m4 @@ -0,0 +1 @@ +../.ext/cfd/m4/mdw-auto-version.m4 \ No newline at end of file diff --git a/m4/mdw-libtool-version-info.m4 b/m4/mdw-libtool-version-info.m4 new file mode 120000 index 0000000..3298202 --- /dev/null +++ b/m4/mdw-libtool-version-info.m4 @@ -0,0 +1 @@ +../.ext/cfd/m4/mdw-libtool-version-info.m4 \ No newline at end of file diff --git a/m4/mdw-silent-rules.m4 b/m4/mdw-silent-rules.m4 new file mode 120000 index 0000000..52d11e3 --- /dev/null +++ b/m4/mdw-silent-rules.m4 @@ -0,0 +1 @@ +../.ext/cfd/m4/mdw-silent-rules.m4 \ No newline at end of file diff --git a/t/Makefile.am b/t/Makefile.am new file mode 100644 index 0000000..264c030 --- /dev/null +++ b/t/Makefile.am @@ -0,0 +1,55 @@ +### -*-makefile-*- +### +### Build script for testing +### +### (c) 2024 Straylight/Edgeware +### + +###----- Licensing notice --------------------------------------------------- +### +### This file is part of Xyla, a library of binary trees. +### +### Xyla is free software: you can redistribute it and/or modify it under +### the terms of the GNU Lesser General Public License as published by the +### Free Software Foundation; either version 3 of the License, or (at your +### option) any later version. +### +### Xyla is distributed in the hope that it will be useful, but WITHOUT +### ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +### FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +### License for more details. +### +### You should have received a copy of the GNU Lesser General Public +### License along with Xyla. If not, see . + +check_PROGRAMS = + +include autotest.am +autotest_TESTS = +TEST_ARGS = -j8 + +autotest_TESTS += ./tests.at + +AM_CPPFLAGS = -I$(top_srcdir) +LDADD = ../libxyla.la + +## Common tests. +EXTRA_DIST += commontest.in + +## AVL trees. +check_PROGRAMS += avltest +avltest_SOURCES = treetest.c +avltest_CFLAGS = $(AM_CFLAGS) -DTREE=AVL +EXTRA_DIST += avl-commontest.ref +EXTRA_DIST += avltest.in avl-avltest.ref +EXTRA_DIST += avlregress.in avl-avlregress.ref + +## Red-black trees. +check_PROGRAMS += rbtest +rbtest_SOURCES = treetest.c +rbtest_CFLAGS = $(AM_CFLAGS) -DTREE=RB +EXTRA_DIST += rb-commontest.ref +EXTRA_DIST += rbtest.in rb-rbtest.ref +EXTRA_DIST += rbregress.in rb-rbregress.ref + +###----- That's all, folks -------------------------------------------------- diff --git a/t/atlocal.in b/t/atlocal.in new file mode 100644 index 0000000..2996e4d --- /dev/null +++ b/t/atlocal.in @@ -0,0 +1,27 @@ +### -*-sh-*- +### +### Configuration variables interesting to the test suite +### +### (c) 2024 Straylight/Edgeware +### + +###----- Licensing notice --------------------------------------------------- +### +### This file is part of Xyla, a library of binary trees. +### +### Xyla is free software: you can redistribute it and/or modify it under +### the terms of the GNU Lesser General Public License as published by the +### Free Software Foundation; either version 3 of the License, or (at your +### option) any later version. +### +### Xyla is distributed in the hope that it will be useful, but WITHOUT +### ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +### FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +### License for more details. +### +### You should have received a copy of the GNU Lesser General Public +### License along with Xyla. If not, see . + +PYTHON=@PYTHON@ + +###----- That's all, folks -------------------------------------------------- diff --git a/t/autotest.am b/t/autotest.am new file mode 120000 index 0000000..2309b1e --- /dev/null +++ b/t/autotest.am @@ -0,0 +1 @@ +../.ext/cfd/build/autotest.am \ No newline at end of file diff --git a/avl-avlregress.ref b/t/avl-avlregress.ref similarity index 100% rename from avl-avlregress.ref rename to t/avl-avlregress.ref diff --git a/avl-avltest.ref b/t/avl-avltest.ref similarity index 100% rename from avl-avltest.ref rename to t/avl-avltest.ref diff --git a/avl-commontest.ref b/t/avl-commontest.ref similarity index 100% rename from avl-commontest.ref rename to t/avl-commontest.ref diff --git a/avlregress.in b/t/avlregress.in similarity index 100% rename from avlregress.in rename to t/avlregress.in diff --git a/avltest.in b/t/avltest.in similarity index 100% rename from avltest.in rename to t/avltest.in diff --git a/commontest.in b/t/commontest.in similarity index 100% rename from commontest.in rename to t/commontest.in diff --git a/dump-to-assgn b/t/dump-to-assgn similarity index 100% rename from dump-to-assgn rename to t/dump-to-assgn diff --git a/rb-commontest.ref b/t/rb-commontest.ref similarity index 100% rename from rb-commontest.ref rename to t/rb-commontest.ref diff --git a/rb-rbregress.ref b/t/rb-rbregress.ref similarity index 100% rename from rb-rbregress.ref rename to t/rb-rbregress.ref diff --git a/rb-rbtest.ref b/t/rb-rbtest.ref similarity index 100% rename from rb-rbtest.ref rename to t/rb-rbtest.ref diff --git a/rbregress.in b/t/rbregress.in similarity index 100% rename from rbregress.in rename to t/rbregress.in diff --git a/rbtest.in b/t/rbtest.in similarity index 100% rename from rbtest.in rename to t/rbtest.in diff --git a/soak b/t/soak similarity index 100% rename from soak rename to t/soak diff --git a/t/tests.at b/t/tests.at new file mode 100644 index 0000000..5025f21 --- /dev/null +++ b/t/tests.at @@ -0,0 +1,179 @@ +### -*-autotest-*- +### +### Test script +### +### (c) 2024 Straylight/Edgeware +### + +###----- Licensing notice --------------------------------------------------- +### +### This file is part of Xyla, a library of binary trees. +### +### Xyla is free software: you can redistribute it and/or modify it under +### the terms of the GNU Lesser General Public License as published by the +### Free Software Foundation; either version 3 of the License, or (at your +### option) any later version. +### +### Xyla is distributed in the hope that it will be useful, but WITHOUT +### ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +### FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +### License for more details. +### +### You should have received a copy of the GNU Lesser General Public +### License along with Xyla. If not, see . + +m4_define([TESTINPUT_PATH], [$abs_top_srcdir/t]) +m4_define([TESTPROG_PATH], [$abs_top_builddir/t]) +m4_define([LTRUN], [$abs_top_builddir/libtool --mode=execute]) + +m4_define([_FOREACH], [dnl +m4_if([$#], [1], [_foreach_func($1)], + [_foreach_func($1)[]_FOREACH(m4_shift($@))])]) +m4_define([FOREACH], [dnl +m4_pushdef([_foreach_func], [$2])dnl +_FOREACH($1)[]dnl +m4_popdef([_foreach_func])]) + +m4_define([DOL], [$]) + +m4_define([VALGRIND_DEFAULTS], +[--leak-check=full --show-leak-kinds=all dnl +--errors-for-leak-kinds=all --track-origins=yes --error-exitcode=3]) +m4_define([DIRECT_NSTEPS], [1000000]) +m4_define([VALGRIND_NSTEPS], [100000]) + +m4_define([TREES], [avl, rb]) +m4_define([COMMON_TESTS], [commontest]) +m4_define([avl_TESTS], [avltest, avlregress]) +m4_define([rb_TESTS], [rbtest, rbregress]) + +###-------------------------------------------------------------------------- +### Option parsing. + +AT_ARG_OPTION_ARG([xyla-launder], + [AS_HELP_STRING([--xyla-launder=FILTER], + [apply FILTER for test output])], + [AS_CASE([$at_optarg], + [nil], + [filter=cat], + [ignseq], + [filter="sed 's/@%:@0x@<:@0-9a-f@:>@*/@%:@0x......../g'"], + [AS_ECHO([unknown launder]) >&2; AS_EXIT([2])])], + [filter=cat]) + +AT_ARG_OPTION_ARG([xyla-runner], + [AS_HELP_STRING([--xyla-runner=WRAPPER], + [apply WRAPPER around test programs])], + [AS_CASE([$at_optarg], + [direct], + [adverb= dflt_steps=DIRECT_NSTEPS], + [valgrind], + [adverb="valgrind ${VALGRIND_OPTS-VALGRIND_DEFAULTS} \ + --log-file=valgrind.out" + dflt_steps=VALGRIND_NSTEPS], + [vgdb], + [adverb="valgrind ${VALGRIND_OPTS-VALGRIND_DEFAULTS} \ + --vgdb=full --vgdb-error=1 --vgdb-shadow-registers=yes" + dflt_steps=VALGRIND_NSTEPS], + [AS_ECHO([unknown runner]) >&2; AS_EXIT([2])])], + [adverb= dflt_steps=DIRECT_NSTEPS]) + +AT_ARG_OPTION([xyla-setref], + [AS_HELP_STRING([--xyla-setref], + [set reference file from test output])]) + +AT_ARG_OPTION([xyla-soak], + [AS_HELP_STRING([--xyla-soak], [run soak tests])]) + +AT_ARG_OPTION_ARG([xyla-soak-seed], + [AS_HELP_STRING([--xyla-soak-seed=SEED], + [force soak-test seed])], + [soak_seed=$at_optarg], + [soak_seed=nil]) + +AT_ARG_OPTION_ARG([xyla-soak-steps], + [AS_HELP_STRING([--xyla-soak-steps=NSTEPS], + [run NSTEPS soak steps])], + [soak_steps=$at_optarg], + [soak_steps=nil]) + +###-------------------------------------------------------------------------- +m4_define([DEF_KAT1], [AT_SETUP([$1-$2]) + +AT_KEYWORDS([$1 $2 kat $1-$2]) + +cp TESTINPUT_PATH/$2.in in +AT_CHECK([LTRUN $adverb TESTPROG_PATH/$1test -oout in], [0], [], []) +if test -r TESTINPUT_PATH/$1-$2.ref; then + eval $filter out.filtered + eval $filter ref.filtered + AT_CHECK([diff -u out.filtered ref.filtered], [0], [], []) +else + AS_CASE([$at_arg_xyla_setref], + [:], [cp out TESTINPUT_PATH/$1-$2.ref], + [AT_CHECK([echo missing ref file TESTINPUT_PATH/$1-$2.ref; AS_EXIT([99])])]) +fi + +AT_CLEANUP]) + +FOREACH([TREES], + [FOREACH([COMMON_TESTS, $1_TESTS], + [DEF_KAT1([$1], ]DOL()1[)])]) + +###-------------------------------------------------------------------------- +### Verify checking is working properly. + +AT_SETUP([avl-check]) +AT_KEYWORDS([avl avl-check]) +AT_DATA([in], [= (_ -4 (_ =3 _)) ! +]) +XYLA_REDACT_ADDRESSES=t; export XYLA_REDACT_ADDRESSES +AT_CHECK([LTRUN TESTPROG_PATH/avltest in], [2], +[offending tree... + @%:@0x00000001 (n = 2) (-) 4 + @%:@0x00000000 (n = 1) (=) 3 +], +[XYLA-BT @%:@@> BUG: @%:@ key not above lower bound +XYLA-AVL @%:@@> BUG: @%:@ incorrect balance annotation `-' /= left 0 - 1 right +BUG: check failed: tree structure invalid (input pos = 19) +]) +AT_CLEANUP + +AT_SETUP([rb-check]) +AT_KEYWORDS([rb rb-check]) +AT_DATA([in], [= ((_ 2 _) 4 (_ *3 _)) ! +]) +XYLA_REDACT_ADDRESSES=t; export XYLA_REDACT_ADDRESSES +AT_CHECK([LTRUN TESTPROG_PATH/rbtest in], [2], +[offending tree... + @%:@0x00000000 (n = 1) ( ) 2 + @%:@0x00000002 (n = 3) ( ) 4 + @%:@0x00000001 (n = 1) (*) 3 +], +[XYLA-RB @%:@@> BUG: root @%:@ is red +XYLA-RB @%:@@> BUG: red @%:@ has red parent @%:@ +XYLA-BT @%:@@> BUG: @%:@ key not above lower bound +XYLA-RB @%:@@> BUG: @%:@ left black-height 0 /= 1 right black-height +BUG: check failed: tree structure invalid (input pos = 24) +]) +AT_CLEANUP + +###-------------------------------------------------------------------------- +m4_define([DEF_SOAK], [AT_SETUP([$1-soak]) + +AT_KEYWORDS([soak $1 $1-soak]) +AT_SKIP_IF([test $at_arg_xyla_soak != :]) +AT_SKIP_IF([test $PYTHON = :]) + +args= +AS_CASE([$soak_steps], [nil], [soak_steps=$dflt_steps]) +args=${args+$args }-n$soak_steps +AS_CASE([$soak_seed], [nil], [], [args="${args+$args }-s '$soak_seed'"]) +AT_CHECK([$PYTHON TESTINPUT_PATH/soak $args dnl + LTRUN $adverb TESTPROG_PATH/$1test], [0], [], []) + +AT_CLEANUP]) + +FOREACH([TREES], [DEF_SOAK([$1])]) + +###----- That's all, folks -------------------------------------------------- diff --git a/t/testsuite.at b/t/testsuite.at new file mode 120000 index 0000000..78fa5b5 --- /dev/null +++ b/t/testsuite.at @@ -0,0 +1 @@ +../.ext/cfd/build/testsuite.at \ No newline at end of file diff --git a/treetest.c b/t/treetest.c similarity index 100% rename from treetest.c rename to t/treetest.c diff --git a/vars.am b/vars.am new file mode 100644 index 0000000..e6dcb23 --- /dev/null +++ b/vars.am @@ -0,0 +1,52 @@ +### -*-makefile-*- +### +### Common build-system definitions +### +### (c) 2024 Straylight/Edgeware +### + +###----- Licensing notice --------------------------------------------------- +### +### This file is part of Xyla, a library of binary trees. +### +### Xyla is free software: you can redistribute it and/or modify it under +### the terms of the GNU Lesser General Public License as published by the +### Free Software Foundation; either version 3 of the License, or (at your +### option) any later version. +### +### Xyla is distributed in the hope that it will be useful, but WITHOUT +### ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +### FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +### License for more details. +### +### You should have received a copy of the GNU Lesser General Public +### License along with Xyla. If not, see . + +###-------------------------------------------------------------------------- +### Initial values for common variables. + +CLEANFILES = +EXTRA_DIST = + +LDADD = + +pkgconfdir = $(libdir)/pkgconfig +pkgconf_DATA = + +###-------------------------------------------------------------------------- +### Standard configuration substitutions. + +## Substitute tags in files. +confsubst = $(top_srcdir)/config/confsubst + +SUBSTITUTIONS = \ + prefix=$(prefix) exec_prefix=$(exec_prefix) \ + libdir=$(libdir) includedir=$(includedir) \ + PACKAGE=$(PACKAGE) VERSION=$(VERSION) + +v_subst = $(v_subst_@AM_V@) +v_subst_ = $(v_subst_@AM_DEFAULT_V@) +v_subst_0 = @echo " SUBST $@"; +SUBST = $(v_subst)$(confsubst) + +###----- That's all, folks -------------------------------------------------- diff --git a/xyla.pc.in b/xyla.pc.in new file mode 100644 index 0000000..049faf1 --- /dev/null +++ b/xyla.pc.in @@ -0,0 +1,8 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libxyla +Description: Library of binary trees +Version: @VERSION@