From e57042e8a93e4f3d65cc91633f5af0daedf69a2a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Sat, 15 Oct 2016 15:36:18 +0200
Subject: [PATCH] png: Try to fix neon issue on iphone armv7

---
 drivers/png/SCsub | 46 ++++++++++++++++++++++++----------------------
 1 file changed, 24 insertions(+), 22 deletions(-)

diff --git a/drivers/png/SCsub b/drivers/png/SCsub
index d1dab15ed4a..1e3f54a9ca4 100644
--- a/drivers/png/SCsub
+++ b/drivers/png/SCsub
@@ -6,22 +6,26 @@ env_png = env.Clone()
 if (env["libpng"] == "builtin"):
 	thirdparty_dir = "#thirdparty/libpng/"
 	thirdparty_sources = [
-		thirdparty_dir + "png.c",
-		thirdparty_dir + "pngerror.c",
-		thirdparty_dir + "pngget.c",
-		thirdparty_dir + "pngmem.c",
-		thirdparty_dir + "pngpread.c",
-		thirdparty_dir + "pngread.c",
-		thirdparty_dir + "pngrio.c",
-		thirdparty_dir + "pngrtran.c",
-		thirdparty_dir + "pngrutil.c",
-		thirdparty_dir + "pngset.c",
-		thirdparty_dir + "pngtrans.c",
-		thirdparty_dir + "pngwio.c",
-		thirdparty_dir + "pngwrite.c",
-		thirdparty_dir + "pngwtran.c",
-		thirdparty_dir + "pngwutil.c",
+		"png.c",
+		"pngerror.c",
+		"pngget.c",
+		"pngmem.c",
+		"pngpread.c",
+		"pngread.c",
+		"pngrio.c",
+		"pngrtran.c",
+		"pngrutil.c",
+		"pngset.c",
+		"pngtrans.c",
+		"pngwio.c",
+		"pngwrite.c",
+		"pngwtran.c",
+		"pngwutil.c",
 	]
+	thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+	env_png.add_source_files(env.drivers_sources, thirdparty_sources)
+	env_png.Append(CPPPATH = [thirdparty_dir])
 
 	# Currently .ASM filter_neon.S does not compile on NT.
 	import os
@@ -30,16 +34,14 @@ if (env["libpng"] == "builtin"):
 		env_neon = env_png.Clone();
 		if "S_compiler" in env:
 			env_neon['CC'] = env['S_compiler']
-		#env_neon.Append(CPPFLAGS = ["-DPNG_ARM_NEON"])
-		thirdparty_sources.append(env_neon.Object(thirdparty_dir + "/arm/arm_init.c"))
-		thirdparty_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon.S"))
+		neon_sources = []
+		neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/arm_init.c"))
+		neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon_intrinsics.c"))
+		neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon.S"))
+		env.drivers_sources += neon_sources
 	else:
 		env_png.Append(CPPFLAGS = ["-DPNG_ARM_NEON_OPT=0"])
 
-	#env_png.add_source_files(env.drivers_sources, thirdparty_sources)
-	env.drivers_sources += thirdparty_sources # Concatenation necessary for neon objects it seems?
-	env_png.Append(CPPPATH = [thirdparty_dir])
-
 # Godot source files
 env_png.add_source_files(env.drivers_sources, "*.cpp")