__init__.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import os
  2. import os.path as P
  3. from devtools.yamaker.fileutil import re_sub_dir
  4. from devtools.yamaker.modules import Linkable, Switch
  5. from devtools.yamaker.project import GNUMakeNixProject
  6. def libwebp_post_install(self):
  7. # Update includes to supported stripped src.
  8. re_sub_dir(self.dstdir, '#include "src/', '#include "../')
  9. # Match current style of relative includes.
  10. for d in os.listdir(self.dstdir):
  11. absd = P.join(self.dstdir, d)
  12. if P.isdir(absd):
  13. re_sub_dir(absd, '#include "../' + d + "/", '#include "./')
  14. # Deduplicate SRCS.
  15. for s in "dsp/webpdsp", "utils/webputils":
  16. with self.yamakes[s] as m:
  17. m.PEERDIR.add(self.arcdir + "/" + s + "decode")
  18. m.SRCS -= self.yamakes[s + "decode"].SRCS
  19. # Support NEON on 32-bit Androids.
  20. self.yamakes["dsp/webpdspdecode"].after(
  21. "PEERDIR",
  22. Switch(
  23. OS_ANDROID=Linkable(
  24. PEERDIR=["contrib/libs/android_cpufeatures"],
  25. ADDINCL=["contrib/libs/android_cpufeatures"],
  26. )
  27. ),
  28. )
  29. libwebp = GNUMakeNixProject(
  30. arcdir="contrib/libs/libwebp",
  31. nixattr="libwebp",
  32. license="BSD-3-Clause",
  33. makeflags=["-C", "src"],
  34. install_subdir="src",
  35. copy_sources=["dsp/mips_macro.h", "dsp/msa_macro.h", "dsp/neon.h"],
  36. platform_dispatchers=["webp/config.h"],
  37. put={"webp": "."},
  38. post_install=libwebp_post_install,
  39. )