summaryrefslogtreecommitdiff
path: root/Makefile
AgeCommit message (Collapse)Author
2007-05-09git-gui: Define a simple class/method systemShawn O. Pearce
As most of the git-gui interface is based upon "meta-widgets" that need to carry around a good deal of state (e.g. console windows, browser windows, blame viewer) we have a good deal of messy code that tries to store this meta-widget state in global arrays, where keys into the array are formed from a union of a unique "object instance id" and the field name. This is a simple class system for Tcl that allows us to hide much of that mess by making Tcl do what it does best; process strings to manipulate its own code during startup. Each object instance is placed into its own namespace. The namespace is created when the object instance is created and the namespace is destroyed when the object instance is removed from the system. Within that namespace we place variables for each field within the class; these variables can themselves be scalar values or full-blown Tcl arrays. A simple class might be defined as: class map { field data field size 0 constructor {} { return $this } method set {name value} { set data($name) $value incr size } method size {} { return $size } ifdeleted { return 0 } } All fields must be declared before any constructors or methods. This allows our class to generate a list of the fields so it can properly alter the definition of the constructor and method bodies prior to passing them off to Tcl for definition with proc. A field may optionally be given a default/initial value. This can only be done for non-array type fields. Constructors are given full access to all fields of the class, so they can initialize the data values. The default values of fields (if any) are set before the constructor runs, and the implicit local variable $this is initialized to the instance identifier. Methods are given access to fields they actually use in their body. Every method has an implicit "this" argument inserted as its first parameter; callers of methods must be sure they supply this value. Some basic optimization tricks are performed (but not much). We try to only upvar (locally bind) fields that are accessed within a method, but we err on the side of caution and may upvar more than we need to. If a variable is accessed only once within a method and that access is by $foo (read) we avoid the upvar and instead use [set foo] to obtain the value. This is slightly faster as Tcl does not need to lookup the variable twice. We also offer some small syntatic sugar for interacting with Tk and the fileevent callback system in Tcl. If a field (say "foo") is used as "@foo" we insert instead the true global variable name of that variable into the body of the constructor or method. This allows easy binding to Tk textvariable options, e.g.: label $w.title -textvariable @title Proper namespace callbacks can also be setup with the special cb proc that is defined in each namespace. [cb _foo a] will invoke the method _foo in the current namespace, passing it $this as the first (implied) parameter and a as the second parameter. This makes it very simple to connect an object instance to a -command option for a Tk widget or to a fileevent readable or writable for a file channel. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-08git-gui: Refactor into multiple files to save my sanityShawn O. Pearce
I'm finding it difficult to work with a 6,000+ line Tcl script and not go insane while looking for a particular block of code. Since most of the program is organized into different units of functionality and not all users will need all units immediately on startup we can improve things by splitting procs out into multiple files and let auto_load handle things for us. This should help not only to better organize the source, but it may also improve startup times for some users as the Tcl parser does not need to read as much script before it can show the UI. In many cases the user can avoid reading at least half of git-gui now. Unfortunately we now need a library directory in our runtime location. This is currently assumed to be $(sharedir)/git-gui/lib and its expected that the Makefile invoker will setup some sort of reasonable sharedir value for us, or let us assume its going to be $(gitexecdir)/../share. We now also require a tclsh (in TCL_PATH) to just run the Makefile, as we use tclsh to generate the tclIndex for our lib directory. I'm hoping this is not an unncessary burden on end-users who are building from source. I haven't really made any functionality changes here, this is just a huge migration of code from one file to many smaller files. All of the new changes are to setup the library path and install the library files. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-02git-gui: Track our own embedded values and rebuild when they changeShawn O. Pearce
Like core-Git we now track the values that we embed into our shell script wrapper, and we "recompile" that wrapper if they are changed. This concept was lifted from git.git's Makefile, where a similar thing was done by Eygene Ryabinkin. Too bad it wasn't just done here in git-gui from the beginning, as the git.git Makefile support for GIT-GUI-VARS was really just because git-gui doesn't do it on its own. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-04-17git-gui: Honor TCLTK_PATH if suppliedJunio C Hamano
Mimick what we do for gitk. Since you do have a source file, git-gui.sh, which is separate from the target, it should be much easier in git-gui's Makefile. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-04-17Revert "Allow wish interpreter to be defined with TCLTK_PATH"Shawn O. Pearce
This reverts commit e2a1bc67d321a0c03737179f331c39a52e7049d7. Junio rightly pointed out this patch doesn't handle the `make install` target very well: Junio C Hamano <junkio@cox.net> writes: > You should never generate new files in the source tree from > 'install' target. Otherwise, the usual pattern of "make" as > yourself and then "make install" as root would not work from a > "root-to-nobody-squashing" NFS mounted source tree to local > filesystem. You should know better than accepting such a patch.
2007-04-04Allow wish interpreter to be defined with TCLTK_PATHEygene Ryabinkin
Makefile got one external option: - TCLTK_PATH: the path to the Tcl/Tk interpreter. Users (or build wrappers) may set this variable to the location of the wish executable. Signed-off-by: Eygene Ryabinkin <rea-git@codelabs.ru> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-03-12Merge branch 'maint'gitgui-0.6.5Shawn O. Pearce
* maint: git-gui: Allow 'git gui version' outside of a repository git-gui: Revert "git-gui: Display all authors of git-gui." git-gui: Revert "Don't modify CREDITS-FILE if it hasn't changed." git-gui: Allow committing empty merges
2007-03-12git-gui: Revert "git-gui: Display all authors of git-gui."Shawn O. Pearce
This reverts commit 871f4c97ad7e021d1a0a98c80c5da77fcf70e4af. Too many users have complained about the credits generator in git-gui, so I'm backing the entire thing out. This revert will finish that series. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-03-07git-gui: Support of "make -s" in: do not output anything of the build itselfAlex Riesen
Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-03-06git-gui: Make 'make' quieter by defaultgitgui-0.6.3Shawn O. Pearce
To fit nicely into the output of the git.git project's own quieter Makefile, we want to make the git-gui Makefile nice and quiet too. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-21git-gui: Display all authors of git-gui.Shawn O. Pearce
Now that git-gui has been released to the public as part of Git 1.5.0 I am starting to see some work from other people beyond myself and Paul. Consequently the copyright for git-gui is not strictly the two of us anymore, and these others deserve to have some credit given to them. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-12git-gui: Generate a version file on demand.Shawn O. Pearce
Because git-gui is being shipped as a subproject of the main Git project and will often have a different lifecycle than the main Git project, we should ship our own version number in the release tarball rather than relying on the main Git version file. Git's master Makefile will invoke our own with the target dist-version, asking us to save off our GITGUI_VERSION value into our own version file, so that our GIT-VERSION-GEN script can recover it at build time. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-12git-gui: Rename GIT_VERSION to GITGUI_VERSION.Shawn O. Pearce
Now that the decision has been made to treat git-gui as a subproject, rather than merging it directly into git, we should use a different substitution for our version value to avoid any possible confusion. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-12git-gui: Allow gitexecdir, INSTALL to be set by the caller.Shawn O. Pearce
When used as a subproject within git.git our Makefile must honor the gitexecdir which git.git's Makefile is passing down to us, ensuring that we install our executables into the libexec chosen by the end-user or packager. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-01-21git-gui: Ensure version number is always current.Shawn O. Pearce
I'm stealing the exact logic used by core Git within its own Makefile to setup the version number within scripts and executables. This way we can be sure that the version number is always updated after a commit, and that the version number also reflects when it is coming from a dirty working directory (and is thus pretty worthless). I've cleaned up some of the version display code in the about dialog too. There were simply too many blank lines in the bottom section where we showed the version data. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-01-21git-gui: Modified makefile to embed version into git-gui script.Shawn O. Pearce
We want to embed the version of git-gui directly into the script file, so that we can display it properly in the about dialog. Consequently I've refactored the Makefile process to act like the one in core git.git with regards to shell scripts, allowing git-gui to be constructed by a sed replacement performed on git-gui.sh. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2006-11-18git-gui: Created makefile to install the program.Shawn O. Pearce
Since we want to be installed in gitexecdir so that "git gui" works we can guess where that directory is by asking the git wrapper executable and locating ourselves at the same location using the same install rules as core git. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>