From: Stuart Cassoff Subject: math/graphviz: Fix for Tcl To: Edd Barrett Cc: OpenBSD Ports Date: Fri, 28 Nov 2025 11:03:01 -0500 This gets the Tcl bits working and fwiw the demos as well. The demos aren't perfect but still pretty good for 30 year-old software! I chose to not install demos that need a /proc filesystem. Maybe it's still good to have them as examples? Almost completely unimportant. I can go either way. MODTCL_VERSION=8.6 SEPARATE_BUILD=Yes Stubs-enabled Tcl extensions don't link directly to libtcl; use BUILD/RUN_DEPENDS not LIB_DEPENDS. One issue remains: $ make port-lib-depends-check graphviz-14.0.2(math/graphviz,-main): Missing: croco-0.6.4 from libcroco-0.6.13p4 (/usr/local/lib/graphviz/libgvplugin_rsvg.so.8.0) Extra: dav1d.3 WANTLIB-main += croco-0.6 How to handle? Add some ".if" or wait until resolved according to www/libcroco/Makefile? Libtool: The problem is that libtool, when given -ltclstub86, first searches for libtclstub86.so.* then libtclstub86_pic.a, which doesn't exist. There are "_pic" libs installed for Tcl/Tk 8.5 but these are just symlinks to the real .a libs - a hack that shouldn't be continued. To satisfy libtool, the port creates a dir in the build dir, then symlinks the stub lib there as the "_pic" lib. This is done in post-configure, which I'm not 100% sure is the right place. Btw, the libtool shenanigans happen in sub resolve_library in /usr/libdata/perl5/LT/Library.pm. This patch (which is probably a bad idea) will search for the non-"_pic" lib as well. --- /usr/libdata/perl5/LT/Library.pm Thu Nov 27 13:56:15 2025 +++ Library.pm Sat Nov 22 10:43:37 2025 @@ -110,6 +110,12 @@ sub resolve_library($self, $dirs, $shared, $staticflag $libfile = $spath; last; } + my $spath = "$sd/lib$libtofind.a"; + if (-f $spath) { + tsay {"found static $libtofind in $sd"}; + $libfile = $spath; + last; + } } } else { # look for a static library Stu (Of course, the *real* solution is to abandon libtool/automake or move to a universe where they don't exist :) diff -Nurp /usr/ports/math/graphviz/Makefile ./Makefile --- /usr/ports/math/graphviz/Makefile Wed Nov 5 05:48:29 2025 +++ ./Makefile Fri Nov 28 10:08:11 2025 @@ -48,14 +48,15 @@ WANTLIB-main += gmp guile-2.2 lcms2 openjp2 perl poppl WANTLIB-main += rsvg-2 unistring wayland-client wayland-cursor wayland-egl WANTLIB-main += xkbcommon xml2 -# "extra" libtclXX: tcldot is built against Tcl headers -WANTLIB-tcl += ${WANTLIB} ${MODTCL_WANTLIB} +WANTLIB-tcl += ${WANTLIB} WANTLIB-tcl += cdt cgraph gvc pathplan xdot COMPILER= base-clang ports-gcc MODULES= lang/tcl \ perl +MODTCL_VERSION= 8.6 + LIB_DEPENDS= graphics/jpeg \ graphics/png \ devel/libtool,-ltdl \ @@ -66,12 +67,16 @@ LIB_DEPENDS= graphics/jpeg \ devel/harfbuzz \ print/poppler \ lang/guile2 -LIB_DEPENDS-tcl=math/graphviz,-main \ - ${MODTCL_LIB_DEPENDS} -BUILD_DEPENDS= devel/swig + +BUILD_DEPENDS= devel/swig \ + ${MODTCL_BUILD_DEPENDS} + TEST_DEPENDS= ${FULLPKGNAME}:math/graphviz -MODTCL_VERSION= 8.6 +LIB_DEPENDS-tcl=math/graphviz,-main +RUN_DEPENDS-tcl=${MODTCL_RUN_DEPENDS} + +SEPARATE_BUILD= Yes USE_GMAKE= Yes USE_GROFF= Yes CONFIGURE_STYLE= autoreconf @@ -127,8 +132,8 @@ CONFIGURE_ENV= CPPFLAGS="-I${X11BASE}/include -I${LOCA DOCBASE= ${PREFIX}/share/doc/graphviz EXBASE= ${PREFIX}/share/examples/graphviz -MAKE_FLAGS= TCL_STUB_LIB_SPEC='-L${LOCALBASE}/lib \ - -ltclstub${MODTCL_VERSION:S/.//}_pic' +MAKE_FLAGS= TCL_STUB_LIB_SPEC='-L${WRKBUILD}/libtclstub \ + -ltclstub${MODTCL_VERSION:S/.//}' # needs "criterion" to actually do anything TEST_DEPENDS= ${FULLPKGNAME}:${FULLPKGPATH} @@ -145,9 +150,23 @@ FAKE_FLAGS= htmldir="${DOCBASE}/html" \ # Ensure plugin version check works. SUBST_VARS += GVPLUGIN_VERSION + pre-configure: - ${SUBST_CMD} ${WRKSRC}/lib/gvc/gvconfig.c + @${MODTCL_TCLSH_ADJ} \ + ${WRKSRC}/tclpkg/gdtclft/demo/entities.tcl \ + ${WRKSRC}/tclpkg/tcldot/demo/gcat.tcl + @${MODTCL_WISH_ADJ} \ + ${WRKSRC}/tclpkg/tcldot/demo/doted.tcl \ + ${WRKSRC}/tclpkg/tclpathplan/demo/pathplan.tcl + @${SUBST_CMD} \ + ${WRKSRC}/tclpkg/tcldot/demo/doted.tcl \ + ${WRKSRC}/lib/gvc/gvconfig.c +post-configure: + @mkdir -p ${WRKBUILD}/libtclstub \ + && ln -sf ${LOCALBASE}/lib/libtclstub86.a \ + ${WRKBUILD}/libtclstub/libtclstub86_pic.a + post-install: # generate config6 from fake-install directory, so we don't need # @exec or a pregenerated file @@ -160,5 +179,8 @@ post-install: # Second copy of tcl extensions isn't needed rm -R ${PREFIX}/lib/tcl${MODTCL_VERSION} + +# Needs a /proc filesystem + rm ${PREFIX}/share/examples/graphviz/demo/modgraph.* .include diff -Nurp /usr/ports/math/graphviz/patches/patch-tclpkg_gdtclft_demo_entities_tcl ./patches/patch-tclpkg_gdtclft_demo_entities_tcl --- /usr/ports/math/graphviz/patches/patch-tclpkg_gdtclft_demo_entities_tcl Wed Dec 31 19:00:00 1969 +++ ./patches/patch-tclpkg_gdtclft_demo_entities_tcl Mon Nov 24 16:44:03 2025 @@ -0,0 +1,15 @@ +Load data from the example dir. + + +Index: tclpkg/gdtclft/demo/entities.tcl +--- tclpkg/gdtclft/demo/entities.tcl.orig ++++ tclpkg/gdtclft/demo/entities.tcl +@@ -44,7 +44,7 @@ for {set val 32} {$val < 127} {incr val} { + + # get other names for html-4.0 characters from: + # http://www.w3.org/TR/REC-html40/sgml/entities.html +-set f [open entities.html r] ++set f [open [file join [file dirname [info script]] entities.html]] + while {! [eof $f]} { + set rec [gets $f] + if {[scan $rec {<!ENTITY %s CDATA "&#%d;" --} name val] == 2} { diff -Nurp /usr/ports/math/graphviz/patches/patch-tclpkg_tcldot_demo_doted_tcl ./patches/patch-tclpkg_tcldot_demo_doted_tcl --- /usr/ports/math/graphviz/patches/patch-tclpkg_tcldot_demo_doted_tcl Wed Dec 31 19:00:00 1969 +++ ./patches/patch-tclpkg_tcldot_demo_doted_tcl Tue Nov 25 11:31:47 2025 @@ -0,0 +1,24 @@ +Tk example images aren't in Tk's default example install dir. + + +Index: tclpkg/tcldot/demo/doted.tcl +--- tclpkg/tcldot/demo/doted.tcl.orig ++++ tclpkg/tcldot/demo/doted.tcl +@@ -20,7 +20,7 @@ proc mouse_anyenter {c} { + set item [string range [lindex [$c gettags current] 0] 1 end] + set saveFill [list $item [lindex [$c itemconfigure 1$item -fill] 4]] + $c itemconfigure 1$item -fill black \ +- -stipple @$tk_library/demos/images/gray25.xbm ++ -stipple @${LOCALBASE}/share/examples/tk${MODTCL_VERSION}/images/gray25.xbm + } + + # as the mouse moves out of an object restore its shading +@@ -613,7 +613,7 @@ button .b.layout \ + -height [.b.h cget -width] \ + -foreground green \ + -activeforeground green\ +- -bitmap @$tk_library/demos/images/gray25.xbm \ ++ -bitmap @${LOCALBASE}/share/examples/tk${MODTCL_VERSION}/images/gray25.xbm \ + -command "layout $c" + + # initialize zoom state diff -Nurp /usr/ports/math/graphviz/patches/patch-tclpkg_tclpathplan_demo_pathplan_tcl ./patches/patch-tclpkg_tclpathplan_demo_pathplan_tcl --- /usr/ports/math/graphviz/patches/patch-tclpkg_tclpathplan_demo_pathplan_tcl Wed Dec 31 19:00:00 1969 +++ ./patches/patch-tclpkg_tclpathplan_demo_pathplan_tcl Thu Nov 27 11:07:19 2025 @@ -0,0 +1,56 @@ +Tkspline isn't necessary for this demo. +Load data from the example dir. + + +Index: tclpkg/tclpathplan/demo/pathplan.tcl +--- tclpkg/tclpathplan/demo/pathplan.tcl.orig ++++ tclpkg/tclpathplan/demo/pathplan.tcl +@@ -2,7 +2,6 @@ + # next line is a comment in tcl \ + exec wish "$0" ${1+"$@"} + +-package require Tkspline + package require Tclpathplan + + ######################################################################## +@@ -190,11 +189,11 @@ proc nextpoint {vc c wx wy} { + $c coords $id $path + $c itemconfigure $id -fill orange + set id [$c create line $x $y $x $y \ +- -smooth spline -fill orange -state disabled] ++ -smooth raw -fill orange -state disabled] + } + } { + set id [$c create line $gx $gy $gx $gy \ +- -smooth spline -fill orange -state disabled] ++ -smooth raw -fill orange -state disabled] + } + } + delete { +@@ -365,7 +364,7 @@ proc loadpaths {vc c file} { + puts $path + } { + $c create line $path \ +- -smooth spline -fill #ff00c0 -state disabled ++ -smooth raw -fill #ff00c0 -state disabled + } + } + close $f +@@ -429,7 +428,7 @@ proc nextfile {} { + + set vc [vgpane] + set mode draw +-set filename "pathplan.tcl.data/unknown.dat" ++set filename [file join [file dirname [info script]] pathplan_data unknown.dat] + frame .fl + set a [frame .fl.a] + set b [frame .fl.b] +@@ -560,7 +559,7 @@ bind .fr.coordinates { + puts $coords + } { + $c create line $coords \ +- -smooth spline -fill orange -state disabled ++ -smooth raw -fill orange -state disabled + } + } + } diff -Nurp /usr/ports/math/graphviz/pkg/PLIST-main ./pkg/PLIST-main --- /usr/ports/math/graphviz/pkg/PLIST-main Wed Nov 5 05:48:29 2025 +++ ./pkg/PLIST-main Tue Nov 25 00:56:52 2025 @@ -192,8 +192,6 @@ share/examples/graphviz/demo/entities.tcl share/examples/graphviz/demo/entities.tcl.README share/examples/graphviz/demo/gcat.tcl share/examples/graphviz/demo/gcat.tcl.README -share/examples/graphviz/demo/modgraph.pl -share/examples/graphviz/demo/modgraph.tcl share/examples/graphviz/demo/pathplan.tcl share/examples/graphviz/demo/pathplan.tcl.README share/examples/graphviz/demo/pathplan_data/