Artifact [a7650ac17b]

Login

Artifact a7650ac17bdbdc9f3c9f52507bfd2031352dc1cdcc796176db096a84175abc6f:


# TIP 483: Improved TIP #59 implementation for Tk
	Author:         Stuart Cassoff <[email protected]>
	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]](205.md), the TIP #59 [[59]](59.md) 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:

<pre>
    #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
</pre>

# 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:
* Changes made based on recommendations in <http://code.activestate.com/lists/tcl-core/19816/>
* Tk checkin: <https://core.tcl-lang.org/tk/info/d65d0705151eb38b>
* Tcl checkin: <https://core.tcl-lang.org/tcl/info/14bb7ec850ddaf66>

# 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]](482.md): Record Tk demo directory information.

# Copyright

This document has been placed in the public domain.