This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: building the _tkinter.a or _tkinter.dll for cygwin


>>>>> "Dennis" == Dennis Wilson <lincwils@teleport.com> writes:

    Dennis> Thanks to advice from this mailing list, I was able to get python to
    Dennis> compile. Once again thanks.


    Dennis> The next lack of knowledge I am exhibiting is that I can't get the
    Dennis> _tkinter.c to compile and link.

    Dennis> What I have found so far is that there is a python script called
    Dennis> setup.py that is run. It tries to detect where

Below is the relevant portion of my version of setup.py:


Note that I moved the cygwin tcl/tk stuff from usr/include, usr/lib out of the way
and compiled the X11 variant of tcl/tk. I have the relevant header and libs now under
/usr/local/...

I also compiled

o BLT2.4u - http://www.scriptics.com/ftp/blt/

and have that under /usr/local tree.

I can only say that with this setup python compiles OOTB and also the 
_tkinter module. It even works fine. I checked with the supplied demos.


--------------------- cut here --------------


    def detect_tkinter(self, inc_dirs, lib_dirs):
        # The _tkinter module.
        #
        # The command for _tkinter is long and site specific.  Please
        # uncomment and/or edit those parts as indicated.  If you don't have a
        # specific extension (e.g. Tix or BLT), leave the corresponding line
        # commented out.  (Leave the trailing backslashes in!  If you
        # experience strange errors, you may want to join all uncommented
        # lines and remove the backslashes -- the backslash interpretation is
        # done by the shell's "read" command and it may not be implemented on
        # every system.

        # Assume we haven't found any of the libraries or include files
        tcllib = tklib = tcl_includes = tk_includes = None
        for version in ['8.0']:
             tklib = self.compiler.find_library_file(lib_dirs,
                                                     'tk' + version )
             tcllib = self.compiler.find_library_file(lib_dirs,
                                                      'tcl' + version )
             if tklib and tcllib:
                # Exit the loop when we've found the Tcl/Tk libraries
                break

        # Now check for the header files
        if tklib and tcllib:
            # Cygwin
            cygwin_tcl_include = ( '/usr/include/tcl' + version )
            cygwin_tk_include = ( '/usr/include/tk'  + version )
            # Check for the include files on Debian, where
            # they're put in /usr/include/{tcl,tk}X.Y
            debian_tcl_include = ( '/usr/include/tcl' + version )
            debian_tk_include =  ( '/usr/include/tk'  + version )
            tcl_includes = find_file('tcl.h',inc_dirs,
                                     [cygwin_tcl_include]
                                     )
            tk_includes = find_file('tk.h',inc_dirs,
                                     [cygwin_tk_include]
                                     )

        if (tcllib is None or tklib is None and
            tcl_includes is None or tk_includes is None):
            # Something's missing, so give up
            return

        # OK... everything seems to be present for Tcl/Tk.

        include_dirs = [] ; libs = [] ; defs = [] ; added_lib_dirs = []
        for dir in tcl_includes + tk_includes:
            if dir not in include_dirs:
                include_dirs.append(dir)

        # Check for various platform-specific directories
        platform = self.get_platform()
        if platform == 'sunos5':
            include_dirs.append('/usr/openwin/include')
            added_lib_dirs.append('/usr/openwin/lib')
        elif os.path.exists('/usr/X11R6/include'):
            include_dirs.append('/usr/X11R6/include')
            added_lib_dirs.append('/usr/X11R6/lib')
        elif os.path.exists('/usr/X11R5/include'):
            include_dirs.append('/usr/X11R5/include')
            added_lib_dirs.append('/usr/X11R5/lib')
        else:
            include_dirs.append('/usr/local/include/tcl8.0')
            include_dirs.append('/usr/local/include/tk8.0')
            # Assume default location for X11
            include_dirs.append('/usr/X11/include')
            added_lib_dirs.append('/usr/X11/lib')

        # Check for Tix extension
        if self.compiler.find_library_file(lib_dirs + added_lib_dirs, 'tix4.1.8.0'):
            defs.append( ('WITH_TIX', 1) )
            libs.append('tix4.1.8.0')

        # Check for BLT extension
        if self.compiler.find_library_file(lib_dirs + added_lib_dirs, 'BLT24'):
            defs.append( ('WITH_BLT', 1) )
            libs.append('BLT24')
            libs.append('jpeg')

        # Add the Tcl/Tk libraries
        libs.append('tk'+version)
        libs.append('tcl'+version)


--------------------- cut here --------------

Ciao
  Volker


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]