summaryrefslogtreecommitdiffstats
path: root/INSTALL.adoc
blob: 9fe95d064bf9b6b66a521c51990554530a195de8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
Installation instructions
=========================
:docext: adoc

Download a tarball from https://github.com/jonas/tig/releases[] or clone the Tig
repository https://github.com/jonas/tig[https://github.com/jonas/tig.git].

The latest version is:
https://github.com/jonas/tig/releases/download/tig-2.5.9/tig-2.5.9.tar.gz[tig-2.5.9]
https://github.com/jonas/tig/releases/download/tig-2.5.9/tig-2.5.9.tar.gz.sha256[(sha256)]

*Note:* Do not use the tar.gz file for version 2.0 because it will fail
to compile due to issue https://github.com/jonas/tig/pull/283[#283] and
https://github.com/jonas/tig/issues/337[#337]

The quick and simple way to install Tig is:

	$ make
	$ make install

By default, `tig` is installed in `$HOME/bin`. To install `tig` elsewhere set
`prefix` to the desired path:

	$ make prefix=/usr/local
	$ sudo make install prefix=/usr/local

Additional build options can be defined in the `config.make` file, which is
loaded automatically when running `make` if it exists. By default,
`contrib/config.make-$kernel_name` is loaded if it exists (currently
available for Linux, macOS [`Darwin`] and Cygwin but Linux users should
prefer the `configure` script). See `contrib/config.make` for example build
options.

Documentation files, such as manpages, are distributed in the release tarballs,
and can be installed using:

	$ make install-doc

When installing directly from the Tig repository, `make install-doc` will assume
that the documentation tool chain is available and build the documentation
locally. In case you do not wish to install the required tools, documentation
can be installed from the 'release' branch using:

	$ make install-release-doc

Before upgrading, you are advised to read link:NEWS.{docext}[the release notes].

Installation using `configure`
------------------------------

If you prefer an autotools-based installation process, you can use the
`configure` script to detect dependencies and enable features. If you downloaded
the Tig sources from https://github.com/jonas/tig/releases/[a release tarball]
there's already a `configure` script. However, if you are building from the Tig
repository, you need to ensure that `autoconf` is installed on your system and
generate the `configure` script yourself.

To install using `configure`, run the following commands:

	$ make configure # Only run if you are building from the Git repository
	$ ./configure
	$ make
	$ make install

If your `iconv` library is not in the default library and include path, you need
to pass the `--with-libiconv` option to `configure` to tell it where to look.

If you have installed ncurses with brew, run configure with the following
flags to have it properly detected (note this done out of the box if you
build without `configure`):

        $ ./configure LDFLAGS=-L/usr/local/opt/ncurses/lib CPPFLAGS=-I/usr/local/opt/ncurses/include

Installation using Homebrew
---------------------------

You can use link:https://brew.sh[Homebrew] to install Tig on macOS and Linux:

        $ brew install tig

Note, for older installations of Tig, Homebrew does not automatically
update the system-wide `tigrc` file when upgrading Tig and the
link:https://github.com/Homebrew/homebrew-core/commit/5600463d68620d68c9745acc490af7f8a16a75cb[behavior]
was changed in 2015 to install the system-wide `tigrc` in the
`/usr/local/share/tig/examples` directory so Tig always uses the
defaults compiled into the binary.

If you see warnings when starting Tig after upgrading, e.g.:

	tig warning: Errors while loading /usr/local/etc/tigrc

It means you either need to manually update `/usr/local/etc/tigrc` with
changes from `/usr/local/share/tig/examples` rename the file if you
never made any changes to it.

	$ mv /usr/local/etc/tigrc{,.old}


Installation using Nix
----------------------

You can use link:https://nixos.org/nix/[Nix] to install Tig on NixOS, or any Linux/macOS distribution with Nix installed:

        $ nix-env -i tig
	
Installation on Linux
---------------------

Depending on your distribution, you may be able to use one of the following commands to install Tig on Linux:

        $ apt-get install tig (Debian, Ubuntu)
        $ dnf install tig (Fedora)
        $ pacman -S tig (Arch Linux)
        $ apk add tig (Alpine)

Installation on FreeBSD
-----------------------

You can use link:https://man.freebsd.org/pkg/8[pkg] to install Tig on FreeBSD:

        $ pkg install tig

Installation on Windows
-----------------------

Easiest way is to install link:https://gitforwindows.org/[Git-for-Windows]. As 
of version `2.14.2`, it comes bundled with `tig`.

Alternatively, you can also use it by installing link:https://www.cygwin.com/[cygwin].
You must then install the packages `git`, `gcc-core`, `make`, `libiconv-devel`
and `libncurses-devel`. Extract the tarball and install by using `configure`
as explained above.

If you want to install from the sources, then you will also need the `automake`
package (which will also install `autoconf`). Then run `make configure` and install
by using `configure` as explained above.

Build configuration
-------------------

Build settings are read from the file `config.make` and for certain systems also
from `contrib/config.make-$kernel`. An example of the latter is macOS, where
`contrib/config.make-Darwin` provides out-of-the-box configuration for using the
system ncurses library and linking with the iconv library. This makes it easy to
configure the build without having to use the `configure` script. As a side
note, `configure` itself generates a `config.make` file.

Apart from the different standard `make` build variables (`CC`, `CFLAGS`, etc.)
and standard `configure` variables (`prefix`, `bindir`, etc.), build settings
can be one of the following flags:

 - `NO_SETENV`: Define this variable to enable work-around for missing
   `setenv()`.
 - `NO_MKSTEMPS`: Define this variable to enable work-around for missing
   `mkstemps()`.
 - `NO_WORDEXP`: Define this variable to enable work-around for missing
   `wordexp()`.
 - `NO_BUILTIN_TIGRC`: Reduce the size of the binary by not including a
   built-in tigrc. The built-in tigrc is used as a fallback when no
   `tigrc` is found in the system configuration directory (e.g. `/etc`).
 - `TIG_USER_CONFIG`: Allow to customize the `tigrc` path (default `~/.tigrc`).

The following example `config.make` manually configures Tig to use the ncurses
library with wide character support and include the proper ncurses header file
(see tig.h for more information):

	LDLIBS = -lncursesw
	CPPFLAGS = -DHAVE_NCURSESW_CURSES_H

For more examples of build settings, see `contrib/config.make` and
`config.make.in`.

Tools and packages
------------------

The following tools and packages are needed:

[cols="2<,8<",options="header"]
|=============================================================================
|Tool				|Description
|git-core			|Tig is just a frontend for Git.
|ncurses or ncursesw		|Be sure to have the development files
				 installed. Usually they are available in a
				 separate package ending with `-dev`.

				 Ncurses with wide character support (ncursesw)
				 is required to properly handle UTF-8 encoded
				 strings.

				 Note for packagers: For Tig's `configure`
				 script to work as expected you should avoid
				 configuring and building ncurses using
				 `--with-shared`.
|iconv				|If iconv is not provided by the c library
				 you need to change the Makefile to link it
				 into the binary.
|=============================================================================

The following tools and packages are optional and mainly needed for creating the
configure script and building documentation:

[cols="2<,8<",options="header"]
|=============================================================================
|Tool				|Description
|readline			|Adds support for completion and history in
				 search and command prompts.
|PCRE				|Adds support for Perl Compatible Regular
				 Expressions in searches.
|autoconf			|Contains autoreconf for generating configure
				 from configure.ac.
|asciidoc (>= 8.4)		|Generates HTML and (DocBook) XML from text.
|xmlto				|Generates manpages and chunked HTML from XML.
|DocBook XSL (>= 1.72.0)	|Used by xmlto for building manpages.
|DocBook (DSSL/Jade) tools	|Generates PDF from XML.
				 Also known as docbook-utils.
|=============================================================================