__init__.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. from devtools.yamaker.fileutil import files
  2. from devtools.yamaker.modules import Linkable, Switch
  3. from devtools.yamaker.project import CMakeNinjaNixProject
  4. def post_install(self):
  5. with self.yamakes["."] as m:
  6. # (Not adding source/darwin because it conflicts with s2n and openssl.)
  7. linux_srcs = []
  8. darwin_srcs = files(self.srcdir + "/source/bsd/", rel=self.srcdir)
  9. for src in sorted(m.SRCS):
  10. if "source/linux/" in src:
  11. m.SRCS.remove(src)
  12. linux_srcs.append(src)
  13. elif "source/s2n/" in src or "source/posix/" in src:
  14. m.SRCS.remove(src)
  15. linux_srcs.append(src)
  16. darwin_srcs.append(src)
  17. m.after(
  18. "SRCS",
  19. Switch(OS_LINUX=Linkable(SRCS=linux_srcs), OS_DARWIN=Linkable(SRCS=darwin_srcs)),
  20. )
  21. m.CFLAGS.remove("-DUSE_S2N")
  22. m.PEERDIR.remove("contrib/restricted/aws/s2n")
  23. m.after(
  24. "CFLAGS",
  25. Switch(
  26. CLANG_CL=Linkable(
  27. CFLAGS=["-DAWS_IO_EXPORTS", "-DAWS_USE_IO_COMPLETION_PORTS", "-std=c99"],
  28. ),
  29. OS_WINDOWS=Linkable(
  30. CFLAGS=["-DAWS_IO_EXPORTS", "-DAWS_USE_IO_COMPLETION_PORTS"],
  31. ),
  32. default=Linkable(
  33. CFLAGS=["-DUSE_S2N"],
  34. PEERDIR=["contrib/restricted/aws/s2n"],
  35. ),
  36. ),
  37. )
  38. aws_c_io = CMakeNinjaNixProject(
  39. arcdir="contrib/restricted/aws/aws-c-io",
  40. nixattr="aws-c-io",
  41. copy_sources=["source/bsd/", "include/aws/io/*.h"],
  42. post_install=post_install,
  43. )