Skip to content

Commit

Permalink
fix: tweaked Makefile for it to work on BSD systems
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
iWas-Coder committed Apr 10, 2024
1 parent a86f78a commit f48cd01
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
10 changes: 6 additions & 4 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -118,7 +119,7 @@ define RAYLIB_CFLAGS
$(RELEASE_OPTS)
endef
define CFLAGS
-std=c17 \
-std=c11 \
-Wall \
-Wextra \
-pedantic \
Expand All @@ -134,6 +135,7 @@ define LDFLAGS
-L $(LAUNCHER_BUILD_DIR) \
-lraylib \
-lsk_launcher \
-lpthread \
-lm \
-static-libgcc
endef
Expand Down
29 changes: 22 additions & 7 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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~
Expand All @@ -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

0 comments on commit f48cd01

Please sign in to comment.