From 1b52c51989d8407c9741f033e8a6dde96a376ba5 Mon Sep 17 00:00:00 2001 From: Luochenghuang Date: Fri, 29 May 2026 22:55:21 -0700 Subject: [PATCH] Treat ctlgeom-types.h and geom-ctl-io.c as checked-in, not BUILT_SOURCES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #74 (mesh geometry import) hand-extended utils/ctlgeom-types.h with C-only mesh internals (mesh_bvh_node, face_normals, bvh, is_closed, etc.) that don't have Scheme analogs in geom.scm, and committed the matching deep-copy code in utils/geom-ctl-io.c. But Makefile.am still classified both files as BUILT_SOURCES with regen rules that run when configure detects Guile. The regen rewrites both files from geom.scm, which knows nothing about the rich mesh fields — result: compilation fails with 'unknown type name mesh_bvh_node'. Travis didn't catch this because its Guile detection was already broken on modern distros; the new GitHub Actions CI installs guile-3.0-dev and trips it immediately. This commit formalizes PR #74's actual intent: both files are hand-maintained, not generated. Removes them from BUILT_SOURCES, deletes their regen rules, moves ctlgeom-types.h to include_HEADERS, adds both to EXTRA_DIST, drops them from clean-local. Trade-off: future additions to public scheme classes in geom.scm now need manual mirroring in ctlgeom-types.h and geom-ctl-io.c. Matches the de facto practice since PR #74. Verified locally: build clean, 'make check' passes with 0 failures in test-mesh (including test_cube_vs_block, test_cube_segments_vs_block, test_copy_destroy, and all closure-validation cases) and test-prism. --- utils/Makefile.am | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/utils/Makefile.am b/utils/Makefile.am index 5f523bc..ae909ed 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -5,12 +5,17 @@ SUBDIRS = . endif bin_SCRIPTS = gen-ctl-io -include_HEADERS = ctlgeom.h -nodist_include_HEADERS = ctlgeom-types.h +# ctlgeom-types.h and geom-ctl-io.c are checked in and hand-maintained — +# they carry C-only mesh internals (mesh_bvh_node, face_normals, the +# matching deep-copy code in mesh_copy/mesh_destroy, etc.) that don't +# have Scheme analogs in geom.scm. Treating them as regular sources +# (not BUILT_SOURCES) keeps Guile-detected builds from regenerating +# and clobbering those internals. See PR #74. +include_HEADERS = ctlgeom.h ctlgeom-types.h lib_LTLIBRARIES = libctlgeom.la noinst_PROGRAMS = geomtst -EXTRA_DIST = gen-ctl-io.in README geom.scm geom-ctl-io-defaults.c nlopt.c +EXTRA_DIST = gen-ctl-io.in README geom.scm geom-ctl-io-defaults.c nlopt.c ctlgeom-types.h geom-ctl-io.c libctlgeom_la_SOURCES = geom.c $(top_srcdir)/src/ctl-math.c $(top_srcdir)/src/integrator.c geom-ctl-io.c ctlgeom-types.h libctlgeom_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@ @@ -34,7 +39,7 @@ TESTS = test-prism test-mesh dist_man_MANS = gen-ctl-io.1 -BUILT_SOURCES = gen-ctl-io geom-ctl-io.c ctlgeom-types.h nlopt-constants.scm +BUILT_SOURCES = gen-ctl-io nlopt-constants.scm nlopt-constants.scm: echo "#include " > nlopt-constants.h @@ -50,18 +55,7 @@ ctl-io.c: geom.scm $(GEN_CTL_IO) ctl-io.h: geom.scm $(GEN_CTL_IO) $(GEN_CTL_IO) --c-only --header -o $@ $(srcdir)/geom.scm $(top_srcdir) -ctlgeom-types.h: ctl-io.h - sed 's,SCM,void*,;s,ctl\.h,ctl-math.h,' ctl-io.h > $@ - echo '#ifndef LIBCTL_MAJOR_VERSION' >> $@ - echo '# define LIBCTL_MAJOR_VERSION '$(LIBCTL_MAJOR_VERSION) >> $@ - echo '# define LIBCTL_MINOR_VERSION '$(LIBCTL_MINOR_VERSION) >> $@ - echo '# define LIBCTL_BUGFIX_VERSION '$(LIBCTL_BUGFIX_VERSION) >> $@ - echo '#endif' >> $@ - -geom-ctl-io.c: ctl-io.c - sed 's,ctl-io\.h,ctlgeom-types.h,;s,/.* Input variables .*/,@#include "geom-ctl-io-defaults.c"@#if 0@,;s,/.* Output variables .*/,#endif@,' ctl-io.c | tr '@' '\n' > $@ - endif clean-local: - rm -f ctl-io.[ch] nlopt-constants.scm ctlgeom-types.h geom-ctl-io.c + rm -f ctl-io.[ch] nlopt-constants.scm geom-ctl-io.c