forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
games-fps/qudos: almost fix build w/ Clang 16
- Drop various seds, converting them into patches - Fix build with libpng 1.4.0 too - Fix build on modern glibc - Use pkg-config (and therefore fix build on LLD) This nearly got there wrt Clang 16, but then ended up hitting -Wincompatible-function-pointer-types with some USE flags and got fed up. Bug: https://bugs.gentoo.org/874486 Closes: https://bugs.gentoo.org/730806 Closes: https://bugs.gentoo.org/770904 Signed-off-by: Sam James <[email protected]>
- Loading branch information
1 parent
ee51625
commit 8a8f555
Showing
9 changed files
with
235 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
From c657cd54baee3bdfe7a92c9b91536bb5c3ddcdd8 Mon Sep 17 00:00:00 2001 | ||
From: Sam James <[email protected]> | ||
Date: Mon, 24 Oct 2022 17:50:17 +0100 | ||
Subject: [PATCH 2/5] Fix clash with libjpeg | ||
|
||
--- a/src/ref_gl/gl_image.c | ||
+++ b/src/ref_gl/gl_image.c | ||
@@ -912,7 +912,7 @@ jpg_skip_input_data(j_decompress_ptr cinfo, long num_bytes) | ||
} | ||
|
||
void | ||
-jpeg_mem_src(j_decompress_ptr cinfo, byte * mem, int len) | ||
+qudos_jpeg_mem_src(j_decompress_ptr cinfo, byte * mem, int len) | ||
{ | ||
cinfo->src = (struct jpeg_source_mgr *)(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(struct jpeg_source_mgr)); | ||
cinfo->src->init_source = jpg_null; | ||
@@ -956,7 +956,7 @@ LoadJPG(char *filename, byte ** pic, int *width, int *height) | ||
jpeg_create_decompress(&cinfo); | ||
|
||
/* Feed JPEG memory into the libJpeg Object */ | ||
- jpeg_mem_src(&cinfo, rawdata, rawsize); | ||
+ qudos_jpeg_mem_src(&cinfo, rawdata, rawsize); | ||
|
||
/* Process JPEG header */ | ||
jpeg_read_header(&cinfo, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- a/src/ref_gl/gl_local.h | ||
+++ b/src/ref_gl/gl_local.h | ||
@@ -29,6 +29,7 @@ | ||
#include <GL/glu.h> | ||
#include <GL/glext.h> | ||
|
||
+#include <zlib.h> /* Z_DEFAULT_COMPRESSION */ | ||
#include <png.h> | ||
#include <jpeglib.h> | ||
|
||
Subject: [PATCH] Fix build with libpng 1.4.0 | ||
|
||
From the 1.4.0 release notes: | ||
``` | ||
m. The function png_set_gray_1_2_4_to_8() was removed. It has been | ||
deprecated since libpng-1.0.18 and 1.2.9, when it was replaced with | ||
png_set_expand_gray_1_2_4_to_8() because the former function also | ||
expanded palette images. | ||
``` | ||
--- a/src/ref_gl/gl_image.c | ||
+++ b/src/ref_gl/gl_image.c | ||
@@ -1186,7 +1186,7 @@ LoadPNG(char *filename, byte ** pic, int *width, int *height) | ||
if (my_png->ColorType == PNG_COLOR_TYPE_PALETTE) | ||
png_set_palette_to_rgb(png); | ||
if (my_png->ColorType == PNG_COLOR_TYPE_GRAY && my_png->BitDepth < 8) | ||
- png_set_gray_1_2_4_to_8(png); | ||
+ png_set_expand_gray_1_2_4_to_8(png); | ||
|
||
/* Add alpha channel if present */ | ||
if (png_get_valid(png, pnginfo, PNG_INFO_tRNS)) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- a/src/mods/rogue/g_local.h | ||
+++ b/src/mods/rogue/g_local.h | ||
@@ -26,9 +26,6 @@ | ||
//================================================================== | ||
|
||
#ifndef _WIN32 | ||
-#ifdef __linux__ | ||
-#include <bits/nan.h> | ||
-#endif | ||
#define min(a,b) ((a) < (b) ? (a) : (b)) | ||
#define max(a,b) ((a) > (b) ? (a) : (b)) | ||
#ifdef __sun__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
From 76aef29111d0b8c5e5fffe80833d0c227cca1127 Mon Sep 17 00:00:00 2001 | ||
From: Sam James <[email protected]> | ||
Date: Mon, 24 Oct 2022 17:54:38 +0100 | ||
Subject: [PATCH 4/5] Respect CC | ||
|
||
--- a/Makefile | ||
+++ b/Makefile | ||
@@ -60,7 +60,6 @@ PREFIX?= $(LOCALBASE) | ||
DATADIR?= $(LOCALBASE)/share/quake2 | ||
LIBDIR?= $(LOCALBASE)/lib/QuDos | ||
|
||
-CC?= gcc | ||
TYPE?= release | ||
|
||
OGG_LDFLAGS= -lvorbisfile -lvorbis -logg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
From 1dc6681ee4eea2d1b6e7edd04cf84fd10c407d28 Mon Sep 17 00:00:00 2001 | ||
From: Sam James <[email protected]> | ||
Date: Mon, 24 Oct 2022 17:54:12 +0100 | ||
Subject: [PATCH 3/5] Respect libdir | ||
|
||
--- a/Makefile | ||
+++ b/Makefile | ||
@@ -55,7 +55,6 @@ WITH_XMMS?=YES # Enable XMMS support (thanks AprQ2). | ||
|
||
# General variables. | ||
LOCALBASE?= /usr/local | ||
-X11BASE?= /usr/X11R6 | ||
PREFIX?= $(LOCALBASE) | ||
|
||
DATADIR?= $(LOCALBASE)/share/quake2 | ||
@@ -98,34 +97,19 @@ GAME_NAME= game$(ARCH).$(SHLIB_EXT) | ||
endif | ||
|
||
# Compilation flags. | ||
-CFLAGS+= -I/usr/include -I$(LOCALBASE)/include -I$(X11BASE)/include \ | ||
+CFLAGS+= -I/usr/include -I$(LOCALBASE)/include \ | ||
-DGAME_NAME='"$(GAME_NAME)"' -DQUDOS_VERSION='"$(VERSION)"' | ||
|
||
WARNS= -Wshadow -Wpointer-arith -Wcast-align -Waggregate-return -Wstrict-prototypes -Wredundant-decls -Wnested-externs | ||
|
||
-ifeq ($(TYPE),debug) | ||
-CFLAGS+= -Wall -Werror -g -ggdb -DDEBUGGING # $(WARNS) | ||
-else | ||
- ifeq ($(TYPE),profile) | ||
-CFLAGS+= -pg | ||
- else | ||
-CFLAGS+= -O3 -ffast-math -funroll-loops -fomit-frame-pointer \ | ||
- -fexpensive-optimizations | ||
- ifeq ($(ARCH),i386) | ||
-CFLAGS+= -falign-loops=2 -falign-jumps=2 -falign-functions=2 \ | ||
- -fno-strict-aliasing | ||
- endif | ||
- endif | ||
-endif | ||
- | ||
# Linker flags. | ||
-LDFLAGS+= -L/usr/lib -L$(LOCALBASE)/lib -L$(X11BASE)/lib -lm | ||
+LDFLAGS+= -lm | ||
|
||
ifeq ($(OSTYPE),Linux) | ||
LDFLAGS+= -ldl | ||
endif | ||
|
||
-REF_LDFLAGS= -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lGLU -ljpeg -lpng | ||
+REF_LDFLAGS= -lX11 -lXext -lXxf86vm -lGLU -ljpeg -lpng | ||
|
||
ifeq ($(strip $(WITH_DGA_MOUSE)),YES) | ||
REF_LDFLAGS+= -lXxf86dga |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
From 372cfdd9c81043667451fc46bcb8daaa5a5e3620 Mon Sep 17 00:00:00 2001 | ||
From: Sam James <[email protected]> | ||
Date: Mon, 24 Oct 2022 17:56:14 +0100 | ||
Subject: [PATCH 5/5] Use pkg-config | ||
|
||
--- a/Makefile | ||
+++ b/Makefile | ||
@@ -64,9 +64,9 @@ TYPE?= release | ||
|
||
OGG_LDFLAGS= -lvorbisfile -lvorbis -logg | ||
|
||
-SDL_CONFIG?= sdl-config | ||
-SDL_CFLAGS= $(shell $(SDL_CONFIG) --cflags) | ||
-SDL_LDFLAGS= $(shell $(SDL_CONFIG) --libs) | ||
+PKG_CONFIG?= pkg-config | ||
+SDL_CFLAGS= $(shell ${PKG_CONFIG} --cflags sdl) | ||
+SDL_LDFLAGS= $(shell ${PKG_CONFIG} --libs sdl) | ||
|
||
ifeq ($(OSTYPE),Linux) | ||
ALSA_LDFLAGS= -lasound | ||
@@ -96,8 +95,7 @@ GAME_NAME= game$(ARCH).$(SHLIB_EXT) | ||
endif | ||
|
||
# Compilation flags. | ||
-CFLAGS+= -I/usr/include -I$(LOCALBASE)/include \ | ||
- -DGAME_NAME='"$(GAME_NAME)"' -DQUDOS_VERSION='"$(VERSION)"' | ||
+CFLAGS+= -DGAME_NAME='"$(GAME_NAME)"' -DQUDOS_VERSION='"$(VERSION)"' | ||
|
||
WARNS= -Wshadow -Wpointer-arith -Wcast-align -Waggregate-return -Wstrict-prototypes -Wredundant-decls -Wnested-externs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
From bdd75315feed9fbaaf9dcf87f9a7e5eb18ca0b8b Mon Sep 17 00:00:00 2001 | ||
From: Sam James <[email protected]> | ||
Date: Mon, 24 Oct 2022 17:50:02 +0100 | ||
Subject: [PATCH 1/5] Fix zlib build | ||
|
||
--- a/src/qcommon/unzip/ioapi.h | ||
+++ b/src/qcommon/unzip/ioapi.h | ||
@@ -1,3 +1,4 @@ | ||
+#define OF(x) x | ||
/* | ||
* ioapi.h -- IO base function header for compress/uncompress .zip files | ||
* using zlib + zip or unzip API |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters