__init__.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import os
  2. from devtools.yamaker.modules import GLOBAL, Library
  3. from devtools.yamaker.project import GNUMakeNixProject
  4. def post_install(self):
  5. # remove unnecessary test and cleanup its sources
  6. test = self.yamakes.pop(".")
  7. for src in test.SRCS:
  8. os.remove(f"{self.dstdir}/{src}")
  9. # remove files from src/ subfolder (without recursion)
  10. for header in os.listdir(f"{self.dstdir}/src"):
  11. if os.path.isfile(f"{self.dstdir}/src/{header}"):
  12. os.remove(f"{self.dstdir}/src/{header}")
  13. # generate LIBRARY modules
  14. self.yamakes["."] = self.module(
  15. Library,
  16. ADDINCL=[GLOBAL(f"{self.arcdir}/src")],
  17. )
  18. # Though sparsehash is a header-only library.
  19. # yet we need to generate config.h during norman autoconf routine.
  20. # Hence we can not use NixSourceProject for it.
  21. sparsehash = GNUMakeNixProject(
  22. owners=["g:cpp-contrib"],
  23. arcdir="contrib/libs/sparsehash",
  24. nixattr="sparsehash",
  25. ignore_commands=[
  26. "bash",
  27. "gawk",
  28. ],
  29. # FIXME:
  30. # There is no need to install anything, yet yamaker does not handle,
  31. # but we need to bring in the config.h generated during build.
  32. #
  33. # This target will be removed during post_install().
  34. install_targets=["hashtable_test"],
  35. put={"hashtable_test": "."},
  36. copy_sources=[
  37. "src/sparsehash/**",
  38. ],
  39. post_install=post_install,
  40. )