From f48cd01103b35e42d296a140994ed0334197e7ae Mon Sep 17 00:00:00 2001 From: iWas-Coder Date: Wed, 10 Apr 2024 02:29:48 +0200 Subject: [PATCH] fix: tweaked Makefile for it to work on BSD systems - On both FreeBSD and OpenBSD it's needed to explicitly link with `pthread` (dynamic). On GNU/Linux does not affect this change. - On OpenBSD the X11 headers are located in `/usr/X11R6/include`, instead of in `/usr/include` as the rest of OSes, so the flag for the preprocessor to find headers there has been added. On the rest of the systems does not affect this change. --- GNUmakefile | 10 ++++++---- README.org | 29 ++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index c69517b..072089a 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -99,9 +99,10 @@ else STRIP_OPTS = -s endif define RAYLIB_CPPFLAGS - $(DISABLE_ASSERTS_OPTS) \ - -D PLATFORM_DESKTOP \ - -isystem $(RAYLIB_SRC_DIR) \ + $(DISABLE_ASSERTS_OPTS) \ + -D PLATFORM_DESKTOP \ + -isystem /usr/X11R6/$(HDR_DIR) \ + -isystem $(RAYLIB_SRC_DIR) \ -isystem $(RAYLIB_SRC_DIR)/external/glfw/$(HDR_DIR) endef define CPPFLAGS @@ -118,7 +119,7 @@ define RAYLIB_CFLAGS $(RELEASE_OPTS) endef define CFLAGS - -std=c17 \ + -std=c11 \ -Wall \ -Wextra \ -pedantic \ @@ -134,6 +135,7 @@ define LDFLAGS -L $(LAUNCHER_BUILD_DIR) \ -lraylib \ -lsk_launcher \ + -lpthread \ -lm \ -static-libgcc endef diff --git a/README.org b/README.org index 61ed1ea..39c3451 100644 --- a/README.org +++ b/README.org @@ -108,6 +108,8 @@ You should have received a copy of the GNU General Public License along with Spa - [[#fedora][Fedora]] - [[#arch][Arch]] - [[#gentoo][Gentoo]] + - [[#freebsd][FreeBSD]] + - [[#openbsd][OpenBSD]] * Project's Roadmap @@ -152,10 +154,10 @@ git clone --recurse-submodules https://github.com/iWas-Coder/sparky These are the packages needed to be able to build /Sparky/ from source, they are divided by distribution/package manager. Also, a command for each one is added to make the installation of these development dependencies as easy and straightforward as possible. -- ~gcc~ -- ~rustc~ -- ~cargo~ - ~make~ +- ~gcc~ +- ~rust~ +- ~jq~ - ~libX11~ - ~libXcursor~ - ~libXrandr~ @@ -165,23 +167,36 @@ These are the packages needed to be able to build /Sparky/ from source, they are *** Debian/Ubuntu #+begin_src sh -sudo apt install -y gcc rustc cargo make libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev +sudo apt install -y make gcc rustc jq libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev #+end_src *** Fedora #+begin_src sh -sudo dnf install -y gcc rust cargo make libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel libXi-devel +sudo dnf install -y make gcc cargo jq libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel libXi-devel #+end_src *** Arch #+begin_src sh -sudo pacman -S gcc rust make libx11 libxcursor libxrandr libxinerama libxi +sudo pacman -S make gcc rust jq libx11 libxcursor libxrandr libxinerama libxi #+end_src *** Gentoo #+begin_src sh -sudo emerge -va gcc rust-bin make libX11 libXcursor libXrandr libXinerama libXi +sudo emerge -va make gcc rust-bin jq libX11 libXcursor libXrandr libXinerama libXi +#+end_src + +*** FreeBSD + +#+begin_src sh +sudo pkg install gmake gcc rust jq libX11 libXcursor libXrandr libXinerama libXi +#+end_src + +*** OpenBSD + +#+begin_src sh +sudo pkg_add gmake gcc rust jq +sudo ln -s /usr/local/bin/x86_64-unknown-openbsd*-gcc-* /usr/local/bin/gcc #+end_src