changeset 417:7ac4b10eedbe

misc: update INSTALL
author David Demelier <markand@malikania.fr>
date Sun, 09 Oct 2022 17:52:55 +0200
parents 2862526f1fc9
children ed61fef6e47b
files .hgignore GNUmakefile INSTALL.md
diffstat 3 files changed, 65 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Sun Oct 09 13:58:05 2022 +0200
+++ b/.hgignore	Sun Oct 09 17:52:55 2022 +0200
@@ -68,8 +68,8 @@
 
 # Tools.
 ^src/tools/bcc/mlk-bcc$
-^src/tools/bcc/mlk-map$
-^src/tools/bcc/mlk-tileset$
+^src/tools/map/mlk-map$
+^src/tools/tileset/mlk-tileset$
 
 # Documentation.
 ^doc/site
--- a/GNUmakefile	Sun Oct 09 13:58:05 2022 +0200
+++ b/GNUmakefile	Sun Oct 09 17:52:55 2022 +0200
@@ -3,14 +3,16 @@
 # Toolchain options.
 CC ?=                   clang
 CFLAGS ?=               -g -O0
-BCC ?=                  src/tools/bcc/mlk-bcc
-BCC_OPTS ?=             -cs
-MD ?=                   -MD
+
+# Installation directory.
+PREFIX ?=               /usr/local
+LIBDIR ?=               $(PREFIX)/lib
+INCDIR ?=               $(PREFIX)/include
 
 # User options.
-WITH_ZIP :=             yes
-WITH_ZSTD :=            yes
-WITH_DEBUG :=           no
+WITH_ZIP ?=             yes
+WITH_ZSTD ?=            yes
+WITH_DEBUG ?=           no
 
 OS :=                   $(shell uname -s)
 
@@ -82,6 +84,9 @@
 OPTS +=                 -DNDEBUG -O3
 endif
 
+BCC_OPTS :=             -cs
+MD ?=                   -MD
+
 # Meta variable that contains all libraries, used for executables and tests.
 LIBMLK =                $(LIBMLK_RPG) \
                         $(LIBMLK_UI) \
@@ -115,7 +120,7 @@
 	$(CC) $(OPTS) $(INCS) $(DEFS) $(CFLAGS) $< -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
 
 .ogg.h .png.h .ttf.h .sql.h .wav.h:
-	$(BCC) $(BCC_OPTS) $< assets_$(basename $(<F)) > $@
+	$(MLK_BCC) $(BCC_OPTS) $< assets_$(basename $(<F)) > $@
 
 %.a:
 	$(AR) -rc $@ $(OBJS)
@@ -457,6 +462,16 @@
 doc-serve:
 	cd doc && mkdocs serve
 
+install:
+	mkdir -p $(DESTDIR)$(LIBDIR)
+	mkdir -p $(DESTDIR)$(INCDIR)/mlk/core
+	mkdir -p $(DESTDIR)$(INCDIR)/mlk/ui
+	mkdir -p $(DESTDIR)$(INCDIR)/mlk/rpg
+	cp $(LIBMLK_SQLITE) $(LIBMLK_CORE) $(LIBMLK_UI) $(LIBMLK_RPG) $(DESTDIR)$(LIBDIR)
+	cp -R src/libmlk-core/core/*.h $(DESTDIR)$(INCDIR)/mlk/core
+	cp -R src/libmlk-ui/ui/*.h $(DESTDIR)$(INCDIR)/mlk/ui
+	cp -R src/libmlk-rpg/rpg/*.h $(DESTDIR)$(INCDIR)/mlk/rpg
+
 clean:
 	rm -f config.h
 	rm -f $(MLK_BCC) $(MLK_MAP) $(MLK_TILESET)
@@ -468,4 +483,4 @@
 	rm -f $(LIBMLK_EXAMPLE) $(LIBMLK_EXAMPLE_DEPS) $(LIBMLK_EXAMPLE_OBJS) $(LIBMLK_EXAMPLE_DATA_OBJS)
 	rm -f $(TESTS_EXE) $(EXAMPLES_EXE)
 
-.PHONY: all clean doc dov-serve examples tests
+.PHONY: all clean doc doc-serve examples install tests
--- a/INSTALL.md	Sun Oct 09 13:58:05 2022 +0200
+++ b/INSTALL.md	Sun Oct 09 17:52:55 2022 +0200
@@ -4,24 +4,24 @@
 Installation instructions.
 
 Requirements
-------------
+============
 
-- C99 compliant compiler.
-- [CMake][], CMake build system.
+- C11 compliant compiler.
+- [GNU Make][], Make build system.
 - [Jansson][], JSON parsing library.
 - [SDL2][], Multimedia library.
 - [SDL2_image][], Image loading addon for SDL2.
 - [SDL2_mixer][], Audio addon for SDL2.
-- [SDL2_ttf][], Fonts addon for SDL2,
-- [gettext][], For translations (optional).
+- [SDL2_ttf][], Fonts addon for SDL2.
 - [zstd][], For compression (optional).
+- [libzip][], For ZIP vfs support (optional).
 
 Molko's Engine is mostly written in pure C99 with a very limited POSIX
 extensions (including `stat`, `strlcpy`, `fmemopen`) but where support is
 missing fallback implementations are provided.
 
 Supported platforms
--------------------
+===================
 
 The project was successfully tested on the following platforms and their
 architectures.
@@ -29,35 +29,36 @@
 - Windows (MinGW-w64, VS2019).
 - Linux (musl/amd64, musl/aarch64, glibc/amd64).
 - FreeBSD (amd64).
-- macOS Big Sur.
+- OpenBSD (amd64).
+- macOS
 
 Basic installation
-------------------
+==================
 
 Quick install.
 
-	$ tar xvzf molko-x.y.z-tar.xz
+	$ bsdtar -xvf molko-x.y.z-tar.xz
 	$ cd molko-x.y.z
-	$ cmake -S. -Bbuild
-	$ cmake --build build --target all
-	# cmake --build build --target install
+	$ make
+	# sudo make install
 
 Available options
------------------
+=================
 
-The following options are available:
+The following make variables as available:
 
-- `MLK_WITH_NLS`: Enable Native Language Support
-- `MLK_WITH_ZSTD`: Enable map and tileset compression through [zstd][] (default:
-  on).
-- `MLK_WITH_TESTS`: Enable unit tests (default: off).
-- `MLK_WITH_EXAMPLES`: Enable sample programs.
+- `WITH_ZSTD`: Enable map and tileset compression through [zstd][] (default:
+  yes).
+- `WITH_ZIP`: Enable ZIP file support through VFS API (default: yes).
+- `WITH_DEBUG`: Disable optimizations and turn on debug symbols (default: no).
 
-Platform: Linux and BSD
------------------------
+The following make variables changes installation directories:
 
-Install dependencies using the package manager provided and use CMake to
-generate Makefiles.
+- `PREFIX`: Root install path (default: /usr/local).
+- `LIBDIR`: Libraries directory (default: $PREFIX/lib).
+- `INCDIR`: C header directory (default: $PREFIX/include).
+
+Booleans options can be set to `yes` or `no` (case sensitive).
 
 Platform: macOS
 ---------------
@@ -67,13 +68,13 @@
 
 You will need the following packages:
 
-- gettext (only if `MLK_WITH_NLS` is set)
-- jansson (only for mlk-map/mlk-tileset tools)
+- jansson
 - sdl2
 - sdl2_image
 - sdl2_mixer
 - sdl2_ttf
-- zstd (only if `MLK_WITH_ZSTD` is set)
+- zstd (only if `WITH_ZSTD` is enabled)
+- libzip (only if `WITH_ZIP` is enabled)
 
 Platform: Windows
 -----------------
@@ -86,18 +87,21 @@
 appropriate MinGW shell prior to the chapter above.
 
 - *make*
-- *mingw-w64-x86_64-gcc*
-- *mingw-w64-x86_64-SDL2*
-- *mingw-w64-x86_64-SDL2_image*
-- *mingw-w64-x86_64-SDL2_mixer*
-- *mingw-w64-x86_64-SDL2_ttf*
-- *mingw-w64-x86_64-jansson* (only for mlk-map/mlk-tileset tools)
-- *mingw-w64-x86_64-zstd* (only if `MLK_WITH_ZSTD` is set)
+- *mingw-w64-clang-x86_64-gcc*
+- *mingw-w64-clang-x86_64-SDL2*
+- *mingw-w64-clang-x86_64-SDL2_image*
+- *mingw-w64-clang-x86_64-SDL2_mixer*
+- *mingw-w64-clang-x86_64-SDL2_ttf*
+- *mingw-w64-clang-x86_64-jansson*
+- *mingw-w64-clang-x86_64-zstd* (only if `WITH_ZSTD` is enabled)
+- *mingw-w64-clang-x86_64-zip* (only if `WITH_ZSTD` is enabled)
 
 Note: replace `x86_64` with `i686` if you have a deprecated system or if you
       have issues while debugging (MinGW-w64 and/or gdb have known issues in
       this area).
 
+Remove `clang-` prefix if you need to use gcc for some reasons.
+
 ### Visual Studio
 
 On Visual Studio you will need to download or build libraries yourself. It is
@@ -108,8 +112,9 @@
 - <dir>/lib
 - <dir>/include
 
-Then adding `<dir>/bin` to *PATH* and `<dir>` to *CMAKE_PREFIX_PATH* will allow
-CMake to find libraries.
+Building with Visual Studio is only supported through `clang-cl` which should be
+installed as individual component from the Visual Studio installer. You also
+need a POSIX compliant toolset such as [MSYS2][] and add it to your path.
 
 [brew][]: http://brew.sh
 [CMake][]: http://cmake.org