Skip to content

Drop the need for exporting TCLLIBPATH, use system path [v2]#4140

Open
NTULINUX wants to merge 1 commit into
LinuxCNC:masterfrom
NTULINUX:system-tclpath
Open

Drop the need for exporting TCLLIBPATH, use system path [v2]#4140
NTULINUX wants to merge 1 commit into
LinuxCNC:masterfrom
NTULINUX:system-tclpath

Conversation

@NTULINUX

@NTULINUX NTULINUX commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

I don't know how to restore my last PR properly with the fixed tree so making a new one.

This avoids hard-coding LinuxCNC to use a path outside of the system's default Tcl search path, making it no longer required to specify TCLLIBPATH on Gentoo and Fedora. Logging in and out in order to update the environmental variables so the icons/menu entries work is also no longer needed.

@NTULINUX NTULINUX marked this pull request as draft June 8, 2026 12:10
@NTULINUX

NTULINUX commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

So I have a lot of the work for this done but I'm stuck battling the CI/CD.

@BsAtHome @grandixximo any ideas? I'm pausing here because I'm worried about an influx of spam. Minus the CI/CD stuff, this should be ready to go.

@NTULINUX NTULINUX marked this pull request as ready for review June 8, 2026 14:03
@NTULINUX NTULINUX force-pushed the system-tclpath branch 2 times, most recently from dedba2a to b7475fa Compare June 8, 2026 14:13
@NTULINUX NTULINUX marked this pull request as draft June 8, 2026 14:19
@NTULINUX NTULINUX force-pushed the system-tclpath branch 3 times, most recently from 709f3cc to da75753 Compare June 8, 2026 22:01
@grandixximo

Copy link
Copy Markdown
Contributor

move apt-get --yes install tcl to BEFORE debian/configure in indep script, and add the same line before debian/configure in arch script.

@NTULINUX NTULINUX force-pushed the system-tclpath branch 2 times, most recently from d5f9811 to 2112d51 Compare June 9, 2026 02:14
@NTULINUX

NTULINUX commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Thank you, that got me a lot further, working on the last little bit now!

Signed-off-by: Alec Ari <neotheuser@ymail.com>
@NTULINUX

NTULINUX commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

OK, I fixed the linuxcnc.install.in file but now dpkg is being stupid. Any ideas on how to fix that?

edit: I think sid just broke up from upstream.

@NTULINUX NTULINUX marked this pull request as ready for review June 9, 2026 23:43
@NTULINUX NTULINUX changed the title [WIP] Drop the need for exporting TCLLIBPATH, use system path [v2] Drop the need for exporting TCLLIBPATH, use system path [v2] Jun 9, 2026
@grandixximo

Copy link
Copy Markdown
Contributor

Yeah, just need rerun once sid is stable

Comment thread src/configure.ac
EMC2_TCL_DIR=${prefix}/lib/tcltk/linuxcnc
EMC2_TCL_LIB_DIR=${prefix}/lib/tcltk/linuxcnc
EMC2_LANG_DIR=${prefix}/lib/tcltk/linuxcnc/msgs
TCL_GET_DIR=$(echo 'puts [[tcl::pkgconfig get scriptdir,runtime]]' | tclsh)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be changed with a better multidistro approach

AC_ARG_WITH([tcl-dir],
    [AS_HELP_STRING([--with-tcl-dir=DIR],
        [directory for LinuxCNC Tcl scripts (default: auto-detected from tcl_pkgPath)])],
    [EMC2_TCL_DIR="$withval"],
    [TCL_GET_DIR=$(echo ['set d [lindex [lsearch -all -inline -glob $tcl_pkgPath /usr/share/*] 0]; if {$d eq ""} {set d [lindex [lsearch -all -inline -glob $tcl_pkgPath /usr/lib*] 0]}; puts $d'] | tclsh 2>/dev/null)
     AS_IF([test -z "$TCL_GET_DIR"],
           [AC_MSG_ERROR([could not determine Tcl package dir from tcl_pkgPath])])
     EMC2_TCL_DIR="$TCL_GET_DIR/linuxcnc"])

this returns

Debian => /usr/share/tcltk
Fedora => /usr/share/tcl9.0
Gentoo => /usr/lib64

And guards failure, and --with-tcl-dir configure override knob

Comment thread debian/configure
KERNEL_HEADERS=
KERNEL_VERSION=uspace
MODUTILS_DEPENDS=
TCL_GET_DIR=$(echo 'puts [tcl::pkgconfig get scriptdir,runtime]' | tclsh)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hardcode the literal /usr/share/tcltk/linuxcnc. It's Debian's stable unversioned package dir, doesn't change across 8.6 to 9, and a Debian package only ever builds on Debian anyway. Once you do this you can remove the apt-get install tcl band-aid

@NTULINUX NTULINUX Jun 13, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean /usr/lib/tcltk? /usr/lib/tcltk/linuxcnc was the path before. Just want to clarify.

set -eu #Needed so CI fails when anything is wrong
set -x

apt-get --yes install tcl

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can get rid of these, see below

usr/lib/linuxcnc
usr/lib/python3
usr/lib/tcltk
@EMC2_TCL_DIR@

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you confirm a real .deb build actually ships linuxcnc.tcl (and the msgs/) at the new path here, and that lintian stays clean? @EMC2_TCL_DIR@ expands to an absolute /usr/share/..., so dh_install ends up globbing debian/tmp//usr/share/.... It should collapse fine, but since this is the riskiest untested part of the change it's worth a verified install before merge.

@grandixximo

grandixximo commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

for rs274/options.py‎ rename isn't needed, expose EMC2_TCL_DIR via the already-generated nf.py and we could keep options.py static, just read it:

rip = os.path.join(nf.PREFIX, 'tcl', 'linuxcnc.tcl')
LINUXCNC_TCL = rip if os.path.exists(rip) else os.path.join(nf.EMC2_TCL_DIR, 'linuxcnc.tcl')

then can cleanup

  • the new AC_CONFIG_FILES(../lib/python/rs274/options.py) line
  • the .gitignore entry.

It works either way, but it might be easier to keep track of things for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants