Files
buildroot/package/prboom/prboom.mk
Thomas Perale 2eb72e7666 package/prboom: fix build w/ gcc-15
This patch force the usage of `-std=gnu18` for GCC15 toolchains to fix
the following issues:

- The boolean issue with C23

```
In file included from ../../src/i_sound.h:38,
                 from i_sound.c:58:
../../src/doomtype.h:48:15: error: cannot use keyword ‘false’ as enumeration constant
   48 | typedef enum {false, true} boolean;
      |               ^~~~~
../../src/doomtype.h:48:15: note: ‘false’ is a keyword with ‘-std=c23’ onwards
```

- The usage of `usleep` & `struct timezone` require usage of GNU
  extensions.

```
i_system.c:58:3: error: implicit declaration of function ‘usleep’; did you mean ‘sleep’? [-Wimplicit-function-declaration]
   58 |   usleep(usecs);
      |   ^~~~~~
      |   sleep
i_system.c: In function ‘I_GetTime_RealTime’:
i_system.c:78:19: error: storage size of ‘tz’ isn’t known
   78 |   struct timezone tz;
      |                   ^~
i_system.c: In function ‘I_GetRandomTimeSeed’:
i_system.c:105:19: error: storage size of ‘tz’ isn’t known
  105 |   struct timezone tz;
      |                   ^~
```

Signed-off-by: Thomas Perale <thomas.perale@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2025-08-16 22:49:13 +02:00

62 lines
1.8 KiB
Makefile

################################################################################
#
# prboom
#
################################################################################
PRBOOM_VERSION = 2.5.0
PRBOOM_SITE = http://downloads.sourceforge.net/project/prboom/prboom%20stable/$(PRBOOM_VERSION)
PRBOOM_CONF_ENV = ac_cv_type_gid_t=yes ac_cv_type_uid_t=yes
PRBOOM_DEPENDENCIES = sdl sdl_net sdl_mixer
PRBOOM_LICENSE = GPL-2.0+
PRBOOM_LICENSE_FILES = COPYING
PRBOOM_AUTORECONF = YES
PRBOOM_CFLAGS = $(TARGET_CFLAGS)
ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_85180),y)
PRBOOM_CFLAGS += -O0
endif
ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_15),y)
PRBOOM_CFLAGS += -std=gnu18
endif
PRBOOM_CONF_ENV += CFLAGS="$(PRBOOM_CFLAGS)"
ifeq ($(BR2_PACKAGE_LIBPNG),y)
PRBOOM_DEPENDENCIES += libpng
endif
ifeq ($(BR2_STATIC_LIBS),y)
# SDL_mixer uses symbols from SDL, but ends up after it on the link
# cmdline. Fix it by forcing the SDL libs at the very end
PRBOOM_CONF_ENV += LIBS="`$(STAGING_DIR)/usr/bin/sdl-config --static-libs`"
endif
PRBOOM_CONF_OPTS = \
--oldincludedir=$(STAGING_DIR)/usr/include \
--with-sdl-prefix=$(STAGING_DIR)/usr \
--with-sdl-exec-prefix=$(STAGING_DIR)/usr \
--disable-cpu-opt \
--disable-sdltest \
--disable-gl
# endianness detection isn't used when cross compiling
define PRBOOM_BIG_ENDIAN_FIXUP
$(SED) 's,.*#.*undef WORDS_BIGENDIAN.*,#define WORDS_BIGENDIAN 1,g' \
$(PRBOOM_DIR)/config.h
endef
ifeq ($(BR2_ENDIAN),"BIG")
PRBOOM_POST_CONFIGURE_HOOKS += PRBOOM_BIG_ENDIAN_FIXUP
endif
define PRBOOM_INSTALL_TARGET_CMDS
$(INSTALL) -D $(@D)/src/prboom $(TARGET_DIR)/usr/games/prboom
$(INSTALL) -D $(@D)/src/prboom-game-server $(TARGET_DIR)/usr/games/prboom-game-server
$(INSTALL) -D $(@D)/data/prboom.wad $(TARGET_DIR)/usr/share/games/doom/prboom.wad
endef
$(eval $(autotools-package))