void-packages/srcpkgs/teeworlds/patches/zlib-cross.patch
Đoàn Trần Công Danh 4f75cf25fd srcpkgs/t*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.-][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.-][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

32 lines
1.5 KiB
Diff

Bam doesn't respect cflags when searching for libs/includes like this, so
just assume we have zlib for the target (which we do) and link it. Other
libs use pkg-config, so there is no problem for those.
--- a/bam.lua
+++ b/bam.lua
@@ -10,7 +10,6 @@ config:Add(OptCCompiler("compiler"))
config:Add(OptTestCompileC("stackprotector", "int main(){return 0;}", "-fstack-protector -fstack-protector-all"))
config:Add(OptTestCompileC("minmacosxsdk", "int main(){return 0;}", "-mmacosx-version-min=10.7 -isysroot /Developer/SDKs/MacOSX10.7.sdk"))
config:Add(OptTestCompileC("buildwithoutsseflag", "#include <immintrin.h>\nint main(){_mm_pause();return 0;}", ""))
-config:Add(OptLibrary("zlib", "zlib.h", false))
config:Add(SDL.OptFind("sdl", true))
config:Add(FreeType.OptFind("freetype", true))
config:Finalize("config.lua")
@@ -82,17 +81,8 @@ function GenerateCommonSettings(settings, conf, arch, compiler)
settings.cc.flags:Add("-Wall", "-fno-exceptions")
end
- -- Compile zlib if needed
local zlib = nil
- if config.zlib.value == 1 then
- settings.link.libs:Add("z")
- if config.zlib.include_path then
- settings.cc.includes:Add(config.zlib.include_path)
- end
- else
- settings.cc.includes:Add("src/engine/external/zlib")
- zlib = Compile(settings, Collect("src/engine/external/zlib/*.c"))
- end
+ settings.link.libs:Add("z")
local md5 = Compile(settings, Collect("src/engine/external/md5/*.c"))
local wavpack = Compile(settings, Collect("src/engine/external/wavpack/*.c"))