__init__.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import os
  2. from devtools.yamaker.project import NixProject
  3. def post_install(self):
  4. with self.yamakes["static"] as libaio:
  5. # Drop sources providing libaio==0.1 ABI compatibility,
  6. # as we build everything from the sources.
  7. os.remove(f"{self.dstdir}/src/compat-0_1.c")
  8. libaio.SRCS.remove("compat-0_1.c")
  9. self.make_dll_dispatcher(
  10. switch_flag="USE_AIO",
  11. switch_as_enum=True,
  12. handle_local=True,
  13. default_local_flags={
  14. "CFLAGS": ("USE_LOCAL_AIO_CFLAGS",),
  15. "LDFLAGS": ("USE_LOCAL_AIO_LDFLAGS", "-laio"),
  16. },
  17. # It is hard to maintain both static and dynamic linkage against versioned symbols.
  18. # We will create library with every symbol visible to the linker.
  19. exports_script=None,
  20. before_switch="""
  21. IF(EXPORT_CMAKE)
  22. OPENSOURCE_EXPORT_REPLACEMENT(
  23. CMAKE AIO
  24. CMAKE_TARGET AIO::aio
  25. )
  26. ENDIF()
  27. """,
  28. or_local_condition="EXPORT_CMAKE",
  29. )
  30. libaio = NixProject(
  31. arcdir="contrib/libs/libaio",
  32. nixattr="libaio",
  33. put={
  34. "aio": "static",
  35. },
  36. inclink={
  37. "include": ["src/libaio.h"],
  38. },
  39. addincl_global={
  40. "static": ["../include"],
  41. },
  42. copy_sources=[
  43. "src/syscall-generic.h",
  44. ],
  45. disable_includes=[
  46. "syscall-alpha.h",
  47. "syscall-arm.h",
  48. "syscall-i386.h",
  49. "syscall-ia64.h",
  50. "syscall-ppc.h",
  51. "syscall-s390.h",
  52. "syscall-sparc.h",
  53. ],
  54. post_install=post_install,
  55. )