Svenska
=======



Installera
----------
1.	`make`
	-	`CC`
	-	`CFLAGS`
2.	`make install`
	-	`DESTDIR`
	-	`PREFIX`
	-	`BINDIR`
	-	`DATADIR`
	-	`MANDIR`

`make` kan vara GNU Make (`gmake`) eller BSD Make (`pmake`).

Som förval byggs programmet med statisk länkning, med en datorspelare
och ett X-gränssnitt. Man kan dock bygga det med dynamisk länkning och
utan datorspelaren eller X-gränssnittet. Läs `README`-filerna i `core`,
`aim` och `uicx` (i `src/`) för anvisningar om specialinställningar.

### `CFLAGS` ###
Bland `CFLAGS` bör man ha följande, om kompilatorn stöder det:

*	`-DNDEBUG` (inga `assert`-satser)
*	`-std=c99` (`restrict`-pekare)
*	`-O3`

Endast `-DNDEBUG` är förvalt eftersom man inte kan förutsätta att alla
har GCC.

### Dynamisk länkning ###
För att installera det dynamiskt länkade programmet kör man (i stället
för ovanstående kommandon):

1.	`make dynamic`
	-	`CC`
	-	`CFLAGS`
	-	`LDFLAGS`
2.	`make install-dynamic`
	-	`DESTDIR`
	-	`PREFIX`
	-	`BINDIR`
	-	`DATADIR`
	-	`INCDIR`
	-	`LIBDIR`
	-	`MANDIR`

Observera att Gleipnir alltid länkas statiskt i `core` och `uicx`, även
om allt annat länkas dynamiskt.

### Efter installation ###
Installationen kopierar bara över filerna till de angivna katalogerna.
Man måste själv göra följande:

*	Köra `strip` på den binära körbara filen
*	Komprimera manualerna (vanligtvis med `gzip -9`)
*	Sätta ägare av alla filer till `root:root`
*	Sätta rätt tillstånd för alla filer
	-	755 för körbara filer och kataloger
	-	644 för filer som inte är körbara
*	Kopiera dokumentation (`CHANGES`, `CONTRIBUTING`, `INSTALL`,
	`LICENSE` och `README`) till `/usr/local/doc/hnefatafl/` (eller
	var man nu vill ha den)
*	Hnefatafl är på svenska som förval. För att ändra det måste man
	ändra `l swe` i `hnefataflrc` till `l eng`.



Operativsystem
--------------

### Debian 7 ###
Följande paket behövs för att kompilera programmet med X-gränssnittet:

*	`libx11-dev` (`X11/Xlib.h, X11/Xutil.h`)
*	`libxpm-dev` (`X11/xpm.h`)

### FreeBSD 10.0 ###
Följande ports behövs för att kompilera och använda programmet med
X-gränssnittet:

*	`xorg-minimal` (`X11/Xlib.h, X11/Xutil.h, X11/xpm.h`) eller
	motsvarande

Stöd för UTF-8 i FreeBSD 10.0 lämnar en del att önska. Det fungerar i
X-gränssnittet, men jag har inte lyckats få det att fungera i konsolen
eller i manualerna.

### Slackware 14.1 ###
För att få UTF-8-manualer kan det vara nödvändigt att ställa in
(exempelvis i `~/.profile`):

*	`GROFF_ENCODING=utf8`
*	`LESSCHARSET=utf-8`



Avinstallera
------------
1.	`make uninstall`

Observera att man måste använda samma `DESTDIR`, `PREFIX`, `BINDIR`
o.s.v. som när man installerade.

`make uninstall-dynamic` tar bort filer som installerades med
`make install-dynamic`.



Uppgradera
----------
1.	Avinstallera den gamla versionen.
2.	Installera den nya versionen.



English
=======



Install
-------
1.	`make`
	-	`CC`
	-	`CFLAGS`
2.	`make install`
	-	`DESTDIR`
	-	`PREFIX`
	-	`BINDIR`
	-	`DATADIR`
	-	`MANDIR`

`make` can be GNU Make (`gmake`) or BSD Make (`pmake`).

The program is statically linked by default, with a computer player and
an X interface. However you can build it with dynamic linking and
without the computer player or X interface. Read the `README` files in
`core`, `aim` and `uicx` for customization instructions.

### `CFLAGS` ###
It is recommended to have the following `CFLAGS` if the compiler
supports it:

*	`-DNDEBUG` (no `assert`s)
*	`-std=c99` (`restrict` pointers)
*	`-O3`

The default options only contain `-DNDEBUG` since it is unreasonable to
assume that everyone has GCC.

### Dynamic linking ###
To install the dynamically linked program, run (instead of the commands
described above):

1.	`make dynamic`
	-	`CC`
	-	`CFLAGS`
	-	`LDFLAGS`
2.	`make install-dynamic`
	-	`DESTDIR`
	-	`PREFIX`
	-	`BINDIR`
	-	`DATADIR`
	-	`INCDIR`
	-	`LIBDIR`
	-	`MANDIR`

Note that Gleipnir is always statically linked in `core` and `uicx`,
even if everything else is linked dynamically.

### Post-install ###
The installation only copies the files to the specified directories. You
have to do the following things yourself:

*	Strip the binary executable
*	Compress the manuals (usually with `gzip -9`)
*	Set the owner of all files to `root:root`
*	Set the right permissions for all files
	-	755 for executables and directories
	-	644 for files that are not executable
*	Copy documentation (`CHANGES`, `CONTRIBUTING`, `INSTALL`,
	`LICENSE` and `README`) to `/usr/local/doc/hnefatafl/` (or
	wherever you want it)
*	Hnefatafl is in Swedish by default. To change this, change
	`l swe` in `hnefataflrc` to `l eng`.



Operating systems
-----------------

### Debian 7 ###
The following packages are required to compile the program with the X
interface:

*	`libx11-dev` (`X11/Xlib.h, X11/Xutil.h`)
*	`libxpm-dev` (`X11/xpm.h`)

### FreeBSD 10.0 ###
The following ports are required to compile and use the program with the
X interface:

*	`xorg-minimal` (`X11/Xlib.h, X11/Xutil.h, X11/xpm.h`) or
	equivalent

UTF-8 support is poor in FreeBSD 10.0. It works in the X interface, but
I have not gotten it to work in the console or with the manuals.

### Slackware 14.1 ###
In order to get UTF-8 manuals, you may have to set (for example in
`~/.profile`):

*	`GROFF_ENCODING=utf8`
*	`LESSCHARSET=utf-8`



Uninstall
---------
1.	`make uninstall`

Note that you must use the same `DESTDIR`, `PREFIX`, `BINDIR` et c. as
you used when you installed.

`make uninstall-dynamic` uninstalls files that were installed with
`make install-dynamic`.



Upgrade
-------
1.	Uninstall the old version.
2.	Install the new version.

