From 0fc4a618702131ef71640d5f16f69bfd9a456861 Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 7 Feb 2022 21:07:40 +0000 Subject: [PATCH] Build and documentation tweaks Signed-off-by: falkTX --- Makefile | 12 ++++++++++++ deps/Makefile | 17 +++++++++++++++-- doc/BUILDING.md | 28 ++++++++++++++-------------- plugins/Makefile | 18 +++++++++++------- src/Makefile | 16 +++++++++------- src/Makefile.cardinal.mk | 19 ++++++++++++------- 6 files changed, 73 insertions(+), 37 deletions(-) diff --git a/Makefile b/Makefile index 790e889..6c6b2d4 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,15 @@ # Created by falkTX # +# -------------------------------------------------------------- +# Import base definitions + +USE_NANOVG_FBO = true include dpf/Makefile.base.mk +# -------------------------------------------------------------- +# Build targets + all: cardinal carla deps dgl plugins gen resources # -------------------------------------------------------------- @@ -13,7 +20,12 @@ all: cardinal carla deps dgl plugins gen resources PREFIX ?= /usr/local DESTDIR ?= + +ifeq ($(BSD),true) +SYSDEPS ?= true +else SYSDEPS ?= false +endif # -------------------------------------------------------------- # Carla config diff --git a/deps/Makefile b/deps/Makefile index 179717e..d2997f5 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -9,12 +9,21 @@ DEP_PATH = $(abspath ../src/Rack/dep) # -------------------------------------------------------------- # Import base definitions +USE_NANOVG_FBO = true include ../dpf/Makefile.base.mk +# -------------------------------------------------------------- +# Build config + +ifeq ($(BSD),true) +SYSDEPS ?= true +else +SYSDEPS ?= false +endif + # -------------------------------------------------------------- # custom build flags -BASE_FLAGS += -DZSTDLIB_VISIBILITY= BASE_FLAGS += -I../include BASE_FLAGS += -I../include/neon-compat @@ -24,6 +33,10 @@ BASE_FLAGS += -ffat-lto-objects endif endif +ifneq ($(SYSDEPS),true) +BASE_FLAGS += -DZSTDLIB_VISIBILITY= +endif + ifeq ($(WASM),true) BASE_FLAGS += -msse -msse2 -msse3 -msimd128 else @@ -191,7 +204,7 @@ QUICKJS_MAKE_FLAGS += PROGS=libquickjs.a ifeq ($(WITH_LTO),true) QUICKJS_MAKE_FLAGS += CONFIG_LTO=y else -QUICKJS_MAKE_FLAGS += CONFIG_LTO=n +QUICKJS_MAKE_FLAGS += CONFIG_LTO= endif ifeq ($(WINDOWS),true) diff --git a/doc/BUILDING.md b/doc/BUILDING.md index 0be87db..a969e10 100644 --- a/doc/BUILDING.md +++ b/doc/BUILDING.md @@ -13,9 +13,10 @@ If you are building from a release tarball you do not need to care about git. ## Build options -Cardinal uses makefiles as build system. So you just got to run `make` within the Cardinal main directory. +Cardinal uses [GNU Make](https://www.gnu.org/software/make/) as build system. +So you just got to run `make` within the Cardinal main directory in order to build. -There are a few useful options you can pass as arguments when building. +There are a few useful options you can pass as arguments when building though. Use them as `make SOMEOPTION=SOMEVALUE` syntax. You can specify as many options as you want. Developer related options: @@ -27,6 +28,7 @@ Packaging related options: * `DESTDIR=/path` typical extra install target path (if you are used to packaging, this does what you expect) * `PREFIX=/usr` prefix used for installation (note that it **must** be set during build time as well) +* `NOOPT=true` do not automatically set well-known optimization flags * `SKIP_STRIPPING=true` do not automatically strip the binaries * `SYSDEPS=true` use jansson, libarchive, samplerate and speexdsp system libraries, instead of vendored * `WITH_LTO=true` enable Link-Time-Optimization, which has performance benefits but significantly increases the build time @@ -36,24 +38,22 @@ Advanced options: * `HEADLESS=true` build headless version (without gui), useful for embed systems * `STATIC_BUILD=true` skip building Cardinal core plugins that use local resources (e.g. audio file and plugin host) +The commonly used build environment flags such as `CC`, `CXX`, `CFLAGS`, etc are respected and used. + ## FreeBSD -Dependencies for using system libraries, that is, with `SYSDEPS=true`: +The use of vendored libraries doesn't work on FreeBSD, as such the `SYSDEPS=true` build option is automatically set. +This means some dependencies that are optional in other systems are required under FreeBSD. -``` -# common -sudo pkg install -A dbus libglvnd liblo libsndfile libX11 libXcursor libXext libXrandr -# system libraries -sudo pkg install -A libarchive libsamplerate jansson speexdsp -``` +The use of `gmake` instead of `make` is also required. -Dependencies for vendored libraries: +Dependencies for using system libraries: ``` # common sudo pkg install -A dbus libglvnd liblo libsndfile libX11 libXcursor libXext libXrandr -# nedeed by vendored libraries -sudo pkg install -A cmake +# system libraries +sudo pkg install -A libarchive libsamplerate jansson speexdsp ``` ## Linux @@ -78,7 +78,7 @@ Dependencies for vendored libraries: # common sudo pacman -S dbus libgl liblo libsndfile libx11 libxcursor libxext libxrandr # nedeed by vendored libraries -sudo pacman -S cmake +sudo pacman -S cmake wget ``` ### Debian @@ -98,7 +98,7 @@ Dependencies for vendored libraries: # common sudo apt install libdbus-1-dev libgl1-mesa-dev liblo-dev libsndfile1-dev libx11-dev libxcursor-dev libxext-dev libxrandr-dev # nedeed by vendored libraries -sudo apt install cmake +sudo apt install cmake wget ``` ## macOS diff --git a/plugins/Makefile b/plugins/Makefile index a66077b..17c44ca 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -5,16 +5,19 @@ # # -------------------------------------------------------------- -# Build config +# Import base definitions -PREFIX ?= /usr/local -DESTDIR ?= -SYSDEPS ?= false +USE_NANOVG_FBO = true +include ../dpf/Makefile.base.mk # -------------------------------------------------------------- -# Import base definitions +# Build config -include ../dpf/Makefile.base.mk +ifeq ($(BSD),true) +SYSDEPS ?= true +else +SYSDEPS ?= false +endif # -------------------------------------------------------------- # List of drwav functions, used in several modules @@ -734,14 +737,15 @@ endif ifeq ($(SYSDEPS),true) BASE_FLAGS += -DCARDINAL_SYSDEPS +BASE_FLAGS += $(shell pkg-config --cflags jansson libarchive samplerate speexdsp) else BASE_FLAGS += -DZSTDLIB_VISIBILITY= +BASE_FLAGS += -I../src/Rack/dep/include endif BASE_FLAGS += -I../src BASE_FLAGS += -I../src/Rack/include BASE_FLAGS += -I../src/Rack/include/dsp -BASE_FLAGS += -I../src/Rack/dep/include BASE_FLAGS += -I../src/Rack/dep/filesystem/include # # BASE_FLAGS += -I../src/Rack/dep/fuzzysearchdatabase/src BASE_FLAGS += -I../src/Rack/dep/glfw/include diff --git a/src/Makefile b/src/Makefile index bc56652..cfadcb5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,19 +4,21 @@ # Created by falkTX # -# -------------------------------------------------------------- -# Build config - -PREFIX ?= /usr/local -DESTDIR ?= -SYSDEPS ?= false - # -------------------------------------------------------------- # Import base definitions USE_NANOVG_FBO = true include ../dpf/Makefile.base.mk +# -------------------------------------------------------------- +# Build config + +ifeq ($(BSD),true) +SYSDEPS ?= true +else +SYSDEPS ?= false +endif + # -------------------------------------------------------------- # Build setup diff --git a/src/Makefile.cardinal.mk b/src/Makefile.cardinal.mk index cc8b018..da08142 100644 --- a/src/Makefile.cardinal.mk +++ b/src/Makefile.cardinal.mk @@ -6,13 +6,6 @@ # Must have NAME defined -# -------------------------------------------------------------- -# Build config - -PREFIX ?= /usr/local -DESTDIR ?= -SYSDEPS ?= false - # -------------------------------------------------------------- # Carla stuff @@ -49,8 +42,20 @@ endif # STATIC_BUILD # -------------------------------------------------------------- # Import base definitions +USE_NANOVG_FBO = true include ../../dpf/Makefile.base.mk +# -------------------------------------------------------------- +# Build config + +PREFIX ?= /usr/local + +ifeq ($(BSD),true) +SYSDEPS ?= true +else +SYSDEPS ?= false +endif + # -------------------------------------------------------------- # Files to build (DPF stuff)