2

I have been able to successfully compile Tcl/Tk Frameworks on macOS (following instructions here). I use these Frameworks inside an .app for distributions. I would like to customize my Frameworks adding extra extensions, for example Drag&Drop TkDND (by the way, I really think this basic GUI feature should be integral part of Tk...).

Instructions here seem to refer to adding the extension to a normal installation, not a Framework. I haven't found any explicit instructions. Sorry if the question is naive, but I am very unexperienced of Tcl/Tk. PS: my .app accesses Tk through Perl. I would very much appreciate any help/instructions/link.

Kelly o'Brian
  • 415
  • 3
  • 12

2 Answers2

0

I don't use tkdnd, so I do not have a answer specific to that installation.

Adding to my script I have blocks in my build script such as this one which builds the 'tdom' extension.

cd $SRCDIR
cd tdom*
if [[ $? -eq 0 ]]; then
  make distclean
  ./configure \
      --exec-prefix=$INSTLOC \
      --prefix=$INSTLOC \
      --with-tcl=$INSTLOC/Library/Frameworks/Tcl.framework/tclConfig.sh
  make CFLAGS="-O2 -mmacosx-version-min=${macosxminver}"
  make install
fi

However, linking to the Tk libraries may complicate things. And every package is different and uses different variables. So I will need to download tkdnd and build it and see if there are any issues, so expect an upcoming edit to this answer.

(Edit: I fixed the script in the original question, so the following paragraph no longer applies) My changes to the init.tcl script are not quite perfect, as you can see, the wrong package is loaded when I run via 'wish' (wish is in a different location than tclsh, which causes some issues). I should have the local installation's path located earlier in the auto_path. If you are using my script, you need to be aware of this.

bll-mac:$ ../darwin/64/tcl/bin/tclsh
% package require tdom
0.9.1

bll-mac$ ../darwin/64/tcl/bin/wish
% package require tdom
0.8.3
% package require tdom 0.9.1
0.9.1

There really isn't any difference between a framework (and b) and a normal installation, the framework just provides a structure for resource location.

Edit:

It appears that the following works to compile and install the tkdnd package. The redefinition of PKG_CFLAGS is necessary because the tkdnd makefile has an argument defined that is not supported by the compiler (on Mojave). So PKG_CFLAGS is a copy of what's in the makefile without -fobjc-gc.

I only tried doing a package require tkdnd. I don't know how to use the package, so I did not try anything else.

cd $SRCDIR
cd tkdnd*
if [[ $? -eq 0 ]]; then
  make distclean
  ./configure \
      --prefix=$INSTLOC \
      --exec-prefix=$INSTLOC \
      --with-tcl=$INSTLOC/Library/Frameworks/Tcl.framework \
      --with-tk=$INSTLOC/Library/Frameworks/Tk.framework
  make CLAGS_OPTIMIZE="-O2 -mmacosx-version-min=${macosxminver}" \
       PKG_CFLAGS="-DMAC_TK_COCOA -std=gnu99 -x objective-c"
  make install
fi
Brad Lanam
  • 5,192
  • 2
  • 19
  • 29
0

This seems to install the extension in the standard path (/usr/local/lib) but not in the Tk.framework. Probably the "make instal" should require some extra values.

Mike
  • 1