TIP 483: Improved TIP #59 implementation for Tk

Login
Bounty program for improvements to Tcl and certain Tcl packages.
Author:         Stuart Cassoff <stwo@users.sourceforge.net>
State:          Final
Type:           Project
Vote:           Done
Created:        03-Nov-2017
Post-History:   
Keywords:       Tk, configuration
Tcl-Version:    8.7
Tk-Branch:      tk-stu-pkg

Abstract

Initially implemented in TIP #205 [205], the TIP #59 [59] implementation for Tk is incomplete.

This TIP proposes a more complete TIP #59 implementation for Tk.

Rationale

There is currently only one key (fontsystem) provided by ::tk::pkgconfig, which will contain the value xft only if xft was enabled at configure-time, requiring a [catch]-wrapping of any [::tk::pkgconfig get fontsystem] calls.

Proposal

  • Add to ::tk::pkgconfig a group of keys/values analogous to those provided by Tcl.

  • Make the fontsystem key ever-present and use the following to determine its value:

    #if defined(_WIN32) || defined(__CYGWIN__)
    #  define CFG_FONTSYSTEM	"gdi"
    #elif defined(MAC_OSX_TK)
    #  define CFG_FONTSYSTEM	"xft"
    #elif defined(HAVE_XFT)
    #  define CFG_FONTSYSTEM	"xft"
    #else
    #  define CFG_FONTSYSTEM	"x11"
    #endif

Tk Configuration Specification

Keys to be provided by ::tk::pkgconfig, their types and a description of their use.

Types: B = Boolean flag, S = String.

Examples of the files expected to be found in the configured directories in parenthesis.

Name Type Description
64bit B Set to true if Tk was compiled in 64bit mode
debug B Set to true if Tk was compiled to contain debugging information
mem_debug B Set to true if Tk has memory debugging compiled into it
optimized B Set to true if Tk was compiled with compiler optimizations
profiled B Set to true if Tk was compiled to contain profiling statements
threaded B Set to true if Tk was compiled as thread-enabled
fontsystem S Name of fontsystem being used by Tk
bindir,install S Directory where binary files are configured to be installed (wish)
demodir,install S Directory where demonstration files are configured to be installed (.tcl, .xbm)
docdir,install S Directory where documentation files are configured to be installed (.man, .html)
includedir,install S Directory where include files are configured to be installed (.h)
libdir,install S Directory where library files are configured to be installed (.so, .a)
scriptdir,install S Directory where script files are configured to be installed (tk.tcl)
bindir,runtime S Directory where binary files should be found at runtime (wish)
demodir,runtime S Directory where demonstration files should be found at runtime (.tcl, .xbm)
docdir,runtime S Directory where documentation files should be found at runtime (.man, .html)
includedir,runtime S Directory where include files should be found at runtime (.h)
libdir,runtime S Directory where library files should be found at runtime (.so, .a)
scriptdir,runtime S Directory where script files should be found at runtime (tk.tcl)

Platform Considerations

  • Unix, MacOSX
    • This TIP works as described.
  • Windows
    • This TIP works as described however saved configuration information about directories is generally less useful on Windows because Tk is almost never installed into the same directories that are recorded in the pre-built files.

Current Uncertainties as of 2017/11/22:

  • Are the choices ok for fontsystem?
  • Is it necessary to always provide the fontsystem key? Not all Tcl platforms provide all the same tcl::pkgconfig keys. Should Tcl's example be followed?
  • The new test file for Tk is named pkgconfig.test while Tcl's is named config.test. The new name more accurately describes the tests but maybe it's better to go along with Tcl?
  • Only tested on Unix.

Status 2018/07/04:

Reference Implementation

The reference implementation is available in the tk-stu-pkg branch. https://core.tcl-lang.org/tk/timeline?r=tk-stu-pkg

The code is licensed under the same license as Tk.

See Also

TIP #482 [482]: Record Tk demo directory information.

Copyright

This document has been placed in the public domain.

History