summaryrefslogtreecommitdiff
blob: ed30687e7b4c3eaf5e791deebe77ae57c42ef248 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
From bce27acd4063d43da601e0a7a85b35fab69cf4bd Mon Sep 17 00:00:00 2001
From: "Azamat H. Hackimov" <azamat.hackimov@gmail.com>
Date: Fri, 28 Apr 2023 16:30:40 +0300
Subject: [PATCH] Switch to external zlib minizip library

Bundled unzip.[ch] uses deprecated zlib macros and fails to compile.
Additionaly added pkg-config calls to use system libraries and includes.

https://github.com/xu4-engine/u4/pull/16
--- a/src/Makefile
+++ b/src/Makefile
@@ -8,11 +8,13 @@ UI ?= glv
 GPU ?= scale
 SOUND=faun
 
+PKG_CONFIG ?= pkg-config
+
 ifeq ($(UI), allegro)
 ifeq ($(SOUND),allegro)
-	UILIBS=-lallegro_acodec -lallegro_audio -lallegro
+	UILIBS=$(shell ${PKG_CONFIG} --libs allegro-5 allegro_acodec-5 allegro_audio-5)
 else
-	UILIBS=-lallegro
+	UILIBS=$(shell ${PKG_CONFIG} --libs allegro-5)
 endif
 endif
 
@@ -37,23 +39,25 @@ endif
 	UILIBS+=-lboron
 #endif
 
-CXXFLAGS=-Wall -I. -Isupport $(UIFLAGS) -DVERSION=\"$(VERSION)\"
+CXXFLAGS+=-Wall -I. -Isupport $(UIFLAGS) -DVERSION=\"$(VERSION)\"
 #CXXFLAGS+=-rdynamic -DHAVE_BACKTRACE=1 -DHAVE_VARIADIC_MACROS=1
 
 # Choose one of these for debug/release mode.
 #CXXFLAGS+=-g -DDEBUG
 CXXFLAGS+=-O3 -DNDEBUG
 
+CXXFLAGS+=$(shell ${PKG_CONFIG} --cflags minizip)
+
 ifeq ($(UI), glv)
 CXXFLAGS+=-Iglv/x11
 GLV_SRC=glv/x11/glv.c
-UILIBS+=-lXcursor -lX11
+UILIBS+=$(shell ${PKG_CONFIG} --libs xcursor x11)
 CFLAGS=$(CXXFLAGS) -DUSE_CURSORS
 else
 CFLAGS=$(CXXFLAGS)
 endif
 
-LIBS=$(UILIBS) -lGL -lpng -lz
+LIBS=$(UILIBS) $(shell ${PKG_CONFIG} --libs gl libpng minizip zlib)
 
 ifeq ($(STATIC_GCC_LIBS),true)
     LDFLAGS+=-L. -static-libgcc
--- a/src/Makefile.common
+++ b/src/Makefile.common
@@ -9,7 +9,6 @@ CSRCS=\
         support/notify.c \
         support/stringTable.c \
         support/txf_draw.c \
-        support/unzip.c \
         $(NULL)
 
 CXXSRCS=\
--- a/src/u4file.cpp
+++ b/src/u4file.cpp
@@ -6,9 +6,9 @@
 #include <cstring>
 #include <cstdlib>
 #include <map>
+#include <unzip.h>
 
 #include "u4file.h"
-#include "unzip.h"
 #include "debug.h"
 #include "xu4.h"
 
-- 
2.39.2