__init__.py 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. import os.path as P
  2. from devtools.yamaker.fileutil import subcopy
  3. from devtools.yamaker.modules import Linkable, Switch
  4. from devtools.yamaker.project import NixProject
  5. def post_install(self):
  6. def d(s):
  7. return self.dstdir + "/" + s
  8. # Move asm sources to asm/linux.
  9. subcopy(self.dstdir, d("asm/linux"), ["**/*.s"], move=True)
  10. with self.yamakes["crypto"] as m:
  11. asm = {s for s in m.SRCS if s.endswith(".s")}
  12. m.SRCS -= asm
  13. m.after(
  14. "SRCS",
  15. Switch(
  16. dict(
  17. {
  18. "OS_LINUX AND ARCH_X86_64": Linkable(
  19. SRCS={"../asm/linux/" + s for s in asm},
  20. )
  21. }
  22. )
  23. ),
  24. )
  25. # Shorten paths.
  26. m.SRCDIR = []
  27. m.SRCS = {P.relpath(s, "crypto") for s in m.SRCS}
  28. m.SRCS -= {"dso/dso_dlfcn.c", "rand/rand_vms.c"}
  29. # Add suppression for ubsan, see also https://github.com/openssl/openssl/issues/22896
  30. with self.yamakes["crypto"] as m:
  31. m.after("NO_RUNTIME", "SUPPRESSIONS(ubsan.supp)")
  32. self.yamakes["crypto"].PEERDIR.add("library/cpp/sanitizer/include")
  33. self.yamakes["apps"].PEERDIR.add("library/cpp/sanitizer/include")
  34. with self.yamakes["."] as m:
  35. m.after(
  36. "ORIGINAL_SOURCE",
  37. """IF (OPENSOURCE_REPLACE_OPENSSL AND EXPORT_CMAKE)
  38. OPENSOURCE_EXPORT_REPLACEMENT(
  39. CMAKE OpenSSL
  40. CMAKE_TARGET OpenSSL::OpenSSL
  41. CONAN openssl/${OPENSOURCE_REPLACE_OPENSSL}
  42. )
  43. ELSE()
  44. ADDINCL(
  45. GLOBAL contrib/libs/openssl/include
  46. )
  47. ENDIF()
  48. """,
  49. )
  50. m.ADDINCL = []
  51. with self.yamakes["crypto"] as m:
  52. m.after(
  53. "LICENSE_TEXTS",
  54. """IF (OPENSOURCE_REPLACE_OPENSSL)
  55. OPENSOURCE_EXPORT_REPLACEMENT(
  56. CMAKE OpenSSL
  57. CMAKE_PACKAGE_COMPONENT Crypto
  58. CMAKE_TARGET OpenSSL::Crypto
  59. CONAN openssl/${OPENSOURCE_REPLACE_OPENSSL}
  60. )
  61. ENDIF() # IF (OPENSOURCE_REPLACE_OPENSSL)
  62. """,
  63. )
  64. m.ADDINCL = []
  65. openssl = NixProject(
  66. license="OpenSSL AND SSLeay",
  67. owners=["g:cpp-contrib"],
  68. arcdir="contrib/libs/openssl",
  69. nixattr="openssl",
  70. ignore_commands=["bash", "perl"],
  71. put_with={"openssl": ["apps"]},
  72. install_targets=["crypto", "openssl", "ssl"],
  73. put={"ssl": "."},
  74. disable_includes=[
  75. "efndef.h",
  76. "iosbdef.h",
  77. "rmidef.h",
  78. "sys/ldr.h",
  79. # if defined(OPENSSL_SYS_VXWORKS)
  80. "ioLib.h",
  81. "sockLib.h",
  82. "sysLib.h",
  83. "taskLib.h",
  84. "tickLib.h",
  85. "vxWorks.h",
  86. # if defined(OPENSSL_SYS_VMS)
  87. "descrip.h",
  88. "dvidef.h",
  89. "gen64def.h",
  90. "iledef.h",
  91. "iodef.h",
  92. "jpidef.h",
  93. "lib$routines.h",
  94. "libfildef.h",
  95. "libfisdef.h",
  96. "rms.h",
  97. "rmsdef.h",
  98. "times.h",
  99. "ssdef.h",
  100. "starlet.h",
  101. "str$routines.h",
  102. "stsdef.h",
  103. "syidef.h",
  104. "unixio.h",
  105. ],
  106. copy_sources=[
  107. "apps/**/*.c",
  108. "apps/**/*.h",
  109. "crypto/**/*.asm",
  110. "crypto/**/*.c",
  111. "crypto/**/*.h",
  112. "engines/**/*.c",
  113. "engines/**/*.h",
  114. "include/**/*.h",
  115. ],
  116. platform_dispatchers=[
  117. "apps/progs.h",
  118. "crypto/buildinf.h",
  119. "include/crypto/bn_conf.h",
  120. "include/crypto/dso_conf.h",
  121. "include/openssl/opensslconf.h",
  122. ],
  123. keep_paths=[
  124. "asm/aarch64/",
  125. "asm/android/",
  126. "asm/darwin/",
  127. "asm/darwin-arm64/",
  128. "asm/ios/",
  129. "asm/ppc64le/",
  130. "asm/windows/",
  131. "openssl.package.json",
  132. "sanitizers.h",
  133. "crypto/ubsan.supp",
  134. ],
  135. post_install=post_install,
  136. )