template.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. pkgname = "libgcc-chimera"
  2. pkgver = "15.0.7"
  3. pkgrel = 0
  4. build_style = "cmake"
  5. configure_args = [
  6. "-DCMAKE_BUILD_TYPE=Release", "-Wno-dev",
  7. # prevent a bunch of checks
  8. "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY",
  9. # we want to link it into libgcc_s
  10. "-DCOMPILER_RT_BUILTINS_HIDE_SYMBOLS=OFF",
  11. # only build that target
  12. "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON",
  13. # we are only building builtins
  14. "-DCOMPILER_RT_BUILD_BUILTINS=ON",
  15. # disable everything else
  16. "-DCOMPILER_RT_BUILD_CRT=OFF",
  17. "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF",
  18. "-DCOMPILER_RT_BUILD_MEMPROF=OFF",
  19. "-DCOMPILER_RT_BUILD_PROFILE=OFF",
  20. "-DCOMPILER_RT_BUILD_SANITIZERS=OFF",
  21. "-DCOMPILER_RT_BUILD_XRAY=OFF",
  22. "-DCOMPILER_RT_BUILD_ORC=OFF",
  23. # simplifies lookup
  24. "-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON",
  25. ]
  26. hostmakedepends = ["cmake", "ninja", "python", "perl", "clang-tools-extra"]
  27. makedepends = [
  28. "llvm-devel", "zlib-devel", "libffi-devel", "ncurses-devel",
  29. "libunwind-devel", "linux-headers"
  30. ]
  31. pkgdesc = "Chimera shim for libgcc runtime compatibility"
  32. maintainer = "q66 <q66@chimera-linux.org>"
  33. license = "Apache-2.0"
  34. url = "https://llvm.org"
  35. source = f"https://github.com/llvm/llvm-project/releases/download/llvmorg-{pkgver}/llvm-project-{pkgver}.src.tar.xz"
  36. sha256 = "8b5fcb24b4128cf04df1b0b9410ce8b1a729cb3c544e6da885d234280dedeac6"
  37. # shim
  38. options = ["!check", "!lto"]
  39. cmake_dir = "compiler-rt"
  40. _trip = self.profile().triplet
  41. _soname = "libgcc_s.so.1"
  42. configure_args += [
  43. f"-DCMAKE_ASM_COMPILER_TARGET={_trip}",
  44. f"-DCMAKE_C_COMPILER_TARGET={_trip}",
  45. f"-DCMAKE_CXX_COMPILER_TARGET={_trip}",
  46. ]
  47. tool_flags = {
  48. "CFLAGS": ["-fPIC"],
  49. "CXXFLAGS": ["-fPIC"],
  50. }
  51. def post_build(self):
  52. from cbuild.util import compiler
  53. # make a libgcc_s.so.1 from the builtins
  54. cc = compiler.C(self)
  55. cc.invoke([], f"build/{_soname}", ldflags = [
  56. "-nostdlib", "-shared", f"-Wl,-soname,{_soname}",
  57. "-Wl,--whole-archive", f"build/lib/{_trip}/libclang_rt.builtins.a",
  58. "-Wl,--no-as-needed", "-lunwind"
  59. ])
  60. def do_install(self):
  61. self.install_lib(f"build/{_soname}")