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
|
import os
from devtools.yamaker.fileutil import files
from devtools.yamaker.modules import Switch, Linkable
from devtools.yamaker.project import GNUMakeNixProject
def post_install(self):
with self.yamakes["."] as libpng:
# libpng generates config.h but does not use any of its defines.
os.remove(f"{self.dstdir}/config.h")
libpng.CFLAGS.remove("-DHAVE_CONFIG_H")
# Support ARM.
arm_srcs = files(f"{self.dstdir}/arm", rel=self.dstdir)
self.yamakes["."].after(
"SRCS",
Switch(
{
"NOT MSVC": Switch(
{
"ARCH_AARCH64 OR ARCH_ARM": Linkable(SRCS=arm_srcs),
}
)
}
),
)
libpng.RECURSE.add("include")
libpng = GNUMakeNixProject(
owners=["g:cpp-contrib"],
arcdir="contrib/libs/libpng",
nixattr="libpng",
makeflags=["libpng16.la"],
copy_sources=[
"arm/*",
"pngprefix.h",
],
disable_includes=[
"config.h",
"PNG_MIPS_MSA_FILE",
"PNG_POWERPC_VSX_FILE",
"PNG_ARM_NEON_FILE",
],
# Original libpng layout provides unnecessary ADDINCL(include/libpng16)
keep_paths=["include/ya.make"],
ignore_commands=["gawk"],
inclink={"include": ["png.h", "pngconf.h", "pnglibconf.h"]},
post_install=post_install,
)
|