2019-04-05 20:16:33 +00:00
|
|
|
# Building Doodle
|
|
|
|
|
2019-06-26 01:58:48 +00:00
|
|
|
## Fonts
|
|
|
|
|
|
|
|
The `fonts/` folder is git-ignored. The app currently uses font files here
|
|
|
|
named:
|
|
|
|
|
|
|
|
* `DejaVuSans.ttf` for sans-serif font.
|
|
|
|
* `DejaVuSans-Bold.ttf` for bold sans-serif font.
|
|
|
|
* `DejaVuSansMono.ttf` for monospace font.
|
|
|
|
|
|
|
|
These are the open source **DejaVu Sans [Mono]** fonts, so copy them in from
|
|
|
|
your `/usr/share/fonts/dejavu` folder or provide alternative fonts.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
mkdir fonts
|
|
|
|
cp /usr/share/fonts/dejavu/{DejaVuSans.ttf,DejaVuSans-Bold.ttf,DejaVuSansMono.ttf} fonts/
|
|
|
|
```
|
|
|
|
|
|
|
|
## Makefile
|
|
|
|
|
2019-04-05 20:16:33 +00:00
|
|
|
Makefile commands for Linux:
|
|
|
|
|
|
|
|
* `make setup`: install Go dependencies and set up the build environment
|
|
|
|
* `make build`: build the Doodle and Doodad binaries to the `bin/` folder.
|
2019-05-05 21:03:20 +00:00
|
|
|
* `make build-free`: build the shareware binaries to the `bin/` folder. See
|
|
|
|
Build Tags below.
|
|
|
|
* `make build-debug`: build a debug binary (not release-mode) to the `bin/`
|
|
|
|
folder. See Build Tags below.
|
2019-06-27 01:36:54 +00:00
|
|
|
* `make wasm`: build the WebAssembly output
|
|
|
|
* `make wasm-serve`: build the WASM output and then run the server.
|
2019-04-05 20:16:33 +00:00
|
|
|
* `make run`: run a local dev build of Doodle in debug mode
|
|
|
|
* `make guitest`: run a local dev build in the GUITest scene
|
|
|
|
* `make test`: run the test suite
|
|
|
|
* `make dist`: produce a zipped release tarball and zip file for your current
|
|
|
|
environment and output into the `dist/` folder.
|
|
|
|
* `make docker`: run all the Dockerfiles from the `docker/` folder to produce
|
|
|
|
dist builds for Debian, Fedora and Ubuntu. You may also run these builds
|
|
|
|
individually:
|
|
|
|
* `make docker.ubuntu`
|
|
|
|
* `make docker.debian`
|
|
|
|
* `make docker.fedora`
|
|
|
|
* `make clean`: clean all build artifacts
|
|
|
|
|
2019-05-05 21:03:20 +00:00
|
|
|
## Build Tags
|
|
|
|
|
|
|
|
### shareware
|
|
|
|
|
|
|
|
> Files ending with `_free.go` are for the shareware release as opposed to
|
|
|
|
> `_paid.go` for the full version.
|
|
|
|
|
|
|
|
Builds the game in the free shareware release mode.
|
|
|
|
|
|
|
|
Run `make build-free` to build the shareware binary.
|
|
|
|
|
|
|
|
Shareware releases of the game have the following changes compared to the default
|
|
|
|
(release) mode:
|
|
|
|
|
|
|
|
* No access to the Doodad Editor scene in-game (soft toggle)
|
|
|
|
|
|
|
|
### developer
|
|
|
|
|
|
|
|
> Files ending with `_developer.go` are for the developer build as opposed to
|
|
|
|
> `_release.go` for the public version.
|
|
|
|
|
|
|
|
Developer builds support extra features over the standard release version:
|
|
|
|
|
|
|
|
* Ability to write the JSON file format for Levels and Doodads.
|
|
|
|
|
|
|
|
Run `make build-debug` to build a developer version of the program.
|
|
|
|
|
2019-04-05 20:16:33 +00:00
|
|
|
## Linux
|
|
|
|
|
|
|
|
Dependencies are Go, SDL2 and SDL2_ttf:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# Fedora
|
|
|
|
sudo dnf -y install golang SDL2-devel SDL2_ttf-devel
|
|
|
|
|
|
|
|
# Ubuntu and Debian
|
|
|
|
sudo apt -y install golang libsdl2-dev libsdl2-ttf-dev
|
|
|
|
```
|
|
|
|
|
2019-04-07 02:30:25 +00:00
|
|
|
## Windows Cross-Compile from Linux
|
2019-04-05 20:16:33 +00:00
|
|
|
|
2019-04-07 02:30:25 +00:00
|
|
|
Install the Mingw C compiler:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# Fedora
|
|
|
|
sudo dnf -y install mingw64-gcc # for 64-bit
|
|
|
|
sudo dnf -y install mingw32-gcc # for 32-bit
|
|
|
|
|
|
|
|
# Arch Linux
|
|
|
|
pacman -S mingw-w64
|
|
|
|
```
|
|
|
|
|
|
|
|
Download the SDL2 Mingw development libraries [here](https://libsdl.org/download-2.0.php)
|
|
|
|
and SDL2_TTF from [here](https://www.libsdl.org/projects/).
|
|
|
|
|
|
|
|
Extract each and copy their library folder into the mingw path.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# e.g. /usr/x86_64-w64-mingw32 is usually the correct path, verify on e.g.
|
|
|
|
# Fedora with `rpm -ql mingw64-filesystem`
|
|
|
|
tar -xzvf SDL2_ttf-devel-2.0.15-mingw.tar.gz
|
|
|
|
cd SDL_ttf-2.0.15
|
|
|
|
sudo cp -r x86_64-w64-mingw32 /usr
|
|
|
|
```
|
|
|
|
|
|
|
|
Make and set permissions for Go to download the standard library for Windows:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
mkdir /usr/lib/golang/pkg/windows_amd64
|
|
|
|
chown your_username /usr/lib/golang/pkg/windows_amd64
|
|
|
|
```
|
|
|
|
|
|
|
|
And run `make mingw` to build the Windows binary.
|
|
|
|
|
|
|
|
### Windows DLLs
|
|
|
|
|
|
|
|
For the .exe to run it will need SDL2.dll and such.
|
|
|
|
|
|
|
|
```
|
|
|
|
# SDL2.dll and SDL2_ttf.dll
|
|
|
|
cp /usr/x86_64-w64-mingw32/bin/SDL*.dll bin/
|
|
|
|
```
|
|
|
|
|
|
|
|
SDL2_ttf requires libfreetype, you can get its DLL here:
|
|
|
|
https://github.com/ubawurinna/freetype-windows-binaries
|