File: system-libs.patch

package info (click to toggle)
teeworlds 0.7.5-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,068 kB
  • sloc: cpp: 58,010; ansic: 14,468; python: 3,763; asm: 946; objc: 107; makefile: 36; xml: 21; sh: 7
file content (196 lines) | stat: -rw-r--r-- 6,968 bytes parent folder | download | duplicates (3)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
From: Markus Koschany <apo@debian.org>
Date: Sun, 30 Aug 2020 15:59:13 +0200
Subject: system-libs

Use system libraries.
---
 bam.lua                                       | 48 ++++++++++++++++++++++++---
 src/engine/client/serverbrowser.cpp           |  2 +-
 src/engine/client/sound.cpp                   |  2 +-
 src/game/client/components/countryflags.cpp   |  2 +-
 src/game/client/components/menus_browser.cpp  |  2 +-
 src/game/client/components/menus_settings.cpp |  2 +-
 src/game/client/components/skins.cpp          |  2 +-
 src/game/client/localization.cpp              |  2 +-
 src/game/editor/auto_map.h                    |  2 +-
 9 files changed, 51 insertions(+), 13 deletions(-)

diff --git a/bam.lua b/bam.lua
index 4d89ef9..c74c80a 100644
--- a/bam.lua
+++ b/bam.lua
@@ -13,6 +13,9 @@ config:Add(OptTestCompileC("buildwithoutsseflag", "#include <immintrin.h>\nint m
 config:Add(OptLibrary("zlib", "zlib.h", false))
 config:Add(SDL.OptFind("sdl", true))
 config:Add(FreeType.OptFind("freetype", true))
+config:Add(OptLibrary("pnglite", "pnglite.h", false))
+config:Add(OptLibrary("wavpack", "wavpack/wavpack.h", false))
+config:Add(OptLibrary("jsonparser", "json-parser/json.h", false))
 config:Finalize("config.lua")
 
 generated_src_dir = "build/src"
@@ -86,10 +89,15 @@ function GenerateCommonSettings(settings, conf, arch, compiler)
 	if compiler == "gcc" or compiler == "clang" then
 		settings.cc.flags:Add("-Wall", "-fno-exceptions")
 	end
-
+	local debian_cflags = os.getenv("CFLAGS")
+	local debian_cppflags = os.getenv("CPPFLAGS")
+	local debian_ldflags = os.getenv("LDFLAGS")
+	settings.cc.flags:Add(debian_cflags)
+	settings.cc.flags:Add(debian_cppflags)
+	settings.link.flags:Add(debian_ldflags)
 	-- Compile zlib if needed
 	local zlib = nil
-	if config.zlib.value == 1 then
+	if config.zlib.value then
 		settings.link.libs:Add("z")
 		if config.zlib.include_path then
 			settings.cc.includes:Add(config.zlib.include_path)
@@ -100,9 +108,39 @@ function GenerateCommonSettings(settings, conf, arch, compiler)
 	end
 
 	local md5 = Compile(settings, Collect("src/engine/external/md5/*.c"))
-	local wavpack = Compile(settings, Collect("src/engine/external/wavpack/*.c"))
-	local png = Compile(settings, Collect("src/engine/external/pnglite/*.c"))
-	local json = Compile(settings, Collect("src/engine/external/json-parser/*.c"))
+	-- compile wavpack if needed
+	if config.wavpack.value then
+		settings.link.libs:Add("wavpack")
+		if config.wavpack.include_path then
+			settings.cc.includes:Add(config.wavpack.include_path)
+		end
+		wavpack = {}
+	else
+		wavpack = Compile(settings, Collect("src/engine/external/wavpack/*.c"))
+		settings.cc.includes:Add("src/engine/external")
+	end
+	-- compile pnglite if needed
+	if config.pnglite.value then
+		settings.link.libs:Add("pnglite")
+		if config.pnglite.include_path then
+			settings.cc.includes:Add(config.pnglite.include_path)
+		end
+		pnglite = {}
+	else
+		pnglite = Compile(settings, Collect("src/engine/external/pnglite/*.c"))
+		settings.cc.includes:Add("src/engine/external/pnglite")
+	end
+-- compile jsonparser if needed
+	if config.jsonparser.value then
+		settings.link.libs:Add("jsonparser")
+		if config.jsonparser.include_path then
+			settings.cc.includes:Add(config.jsonparser.include_path)
+		end
+		jsonparser = {}
+	else
+		jsonparser = Compile(settings, Collect("src/engine/external/json-parser/*.c"))
+		settings.cc.includes:Add("src/engine/external/json-parser")
+	end
 
 	-- globally available libs
 	libs = {zlib=zlib, wavpack=wavpack, png=png, md5=md5, json=json}
diff --git a/src/engine/client/serverbrowser.cpp b/src/engine/client/serverbrowser.cpp
index 767045c..69e7879 100644
--- a/src/engine/client/serverbrowser.cpp
+++ b/src/engine/client/serverbrowser.cpp
@@ -3,7 +3,7 @@
 #include <base/math.h>
 #include <base/system.h>
 
-#include <engine/external/json-parser/json.h>
+#include <json-parser/json.h>
 
 #include <engine/shared/config.h>
 #include <engine/shared/memheap.h>
diff --git a/src/engine/client/sound.cpp b/src/engine/client/sound.cpp
index f5c126c..190763f 100644
--- a/src/engine/client/sound.cpp
+++ b/src/engine/client/sound.cpp
@@ -14,7 +14,7 @@
 
 extern "C"
 {
-	#include <wavpack.h>
+	#include <wavpack/wavpack.h>
 }
 #include <math.h>
 
diff --git a/src/game/client/components/countryflags.cpp b/src/game/client/components/countryflags.cpp
index bf6a240..54a74d1 100644
--- a/src/game/client/components/countryflags.cpp
+++ b/src/game/client/components/countryflags.cpp
@@ -7,7 +7,7 @@
 #include <engine/graphics.h>
 #include <engine/storage.h>
 #include <engine/textrender.h>
-#include <engine/external/json-parser/json.h>
+#include <json-parser/json.h>
 #include <engine/shared/config.h>
 
 #include "menus.h"
diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp
index 851465e..9e76f25 100644
--- a/src/game/client/components/menus_browser.cpp
+++ b/src/game/client/components/menus_browser.cpp
@@ -2,7 +2,7 @@
 /* If you are missing that file, acquire a complete release at teeworlds.com.                */
 #include <algorithm> // sort  TODO: remove this
 
-#include <engine/external/json-parser/json.h>
+#include <json-parser/json.h>
 
 #include <engine/config.h>
 #include <engine/graphics.h>
diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp
index c4f5919..d389686 100644
--- a/src/game/client/components/menus_settings.cpp
+++ b/src/game/client/components/menus_settings.cpp
@@ -9,7 +9,7 @@
 #include <engine/serverbrowser.h>
 #include <engine/storage.h>
 #include <engine/textrender.h>
-#include <engine/external/json-parser/json.h>
+#include <json-parser/json.h>
 #include <engine/shared/config.h>
 
 #include <generated/protocol.h>
diff --git a/src/game/client/components/skins.cpp b/src/game/client/components/skins.cpp
index 1086606..2bfd382 100644
--- a/src/game/client/components/skins.cpp
+++ b/src/game/client/components/skins.cpp
@@ -8,7 +8,7 @@
 
 #include <engine/graphics.h>
 #include <engine/storage.h>
-#include <engine/external/json-parser/json.h>
+#include <json-parser/json.h>
 #include <engine/shared/config.h>
 #include <engine/shared/jsonwriter.h>
 
diff --git a/src/game/client/localization.cpp b/src/game/client/localization.cpp
index 84d4ff8..924241d 100644
--- a/src/game/client/localization.cpp
+++ b/src/game/client/localization.cpp
@@ -4,7 +4,7 @@
 #include "localization.h"
 #include <base/tl/algorithm.h>
 
-#include <engine/external/json-parser/json.h>
+#include <json-parser/json.h>
 #include <engine/console.h>
 #include <engine/storage.h>
 
diff --git a/src/game/editor/auto_map.h b/src/game/editor/auto_map.h
index 2e567f1..499a8e9 100644
--- a/src/game/editor/auto_map.h
+++ b/src/game/editor/auto_map.h
@@ -4,7 +4,7 @@
 #include <base/tl/array.h>
 #include <base/vmath.h>
 
-#include <engine/external/json-parser/json.h>
+#include <json-parser/json.h>
 
 typedef struct
 {