gitstatus-1.5.5-r1.ebuild 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. # Copyright 2021-2024 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. inherit cmake flag-o-matic toolchain-funcs
  5. LIBGIT_TAG=tag-2ecf33948a4df9ef45a66c68b8ef24a5e60eaac6
  6. LIBGIT_P="libgit2-romkatv-${LIBGIT_TAG}"
  7. LIBGIT_DIR="${LIBGIT_P/-romkatv/}"
  8. CMAKE_USE_DIR="${WORKDIR}/${LIBGIT_DIR}"
  9. BUILD_DIR="${CMAKE_USE_DIR}_build"
  10. DESCRIPTION="Git status for Bash and Zsh prompt"
  11. HOMEPAGE="
  12. https://github.com/romkatv/gitstatus
  13. https://github.com/romkatv/libgit2
  14. "
  15. SRC_URI="
  16. https://github.com/romkatv/${PN}/archive/v${PV}.tar.gz
  17. -> ${P}.tar.gz
  18. https://github.com/romkatv/libgit2/archive/${LIBGIT_TAG}.tar.gz
  19. -> ${LIBGIT_P}.tar.gz
  20. "
  21. LICENSE="GPL-3"
  22. SLOT="0"
  23. KEYWORDS="amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86"
  24. pkg_pretend() {
  25. tc-is-clang || return 0
  26. ewarn 'if you are using sys-libs/libcxx to compile this,'
  27. ewarn 'please make sure to compile sys-libs/libcxx with static-libs'
  28. ewarn 'echo "sys-libs/libcxx static-libs" >> /etc/portage/package.use/libcxx'
  29. }
  30. src_prepare() {
  31. # there are few vulnerabilities from libgit2 that is present in romkatv fork,
  32. # but it looks like vulnerable parts of code not used by gitstatus
  33. #
  34. # https://github.com/libgit2/libgit2/security
  35. # https://github.com/romkatv/libgit2/issues/5
  36. (
  37. cd "${CMAKE_USE_DIR}"
  38. # this patch replaces vulnerable parts with `assert(false)`
  39. eapply "${FILESDIR}/${P}-abort-on-vulnerable-libgit2-funcions.patch"
  40. )
  41. cmake_src_prepare
  42. }
  43. src_configure() {
  44. mycmakeargs=(
  45. -DUSE_SSH=OFF
  46. -DZERO_NSEC=ON
  47. -DTHREADSAFE=ON
  48. -DUSE_HTTPS=OFF
  49. -DBUILD_CLAR=OFF
  50. -DUSE_GSSAPI=OFF
  51. -DUSE_NTLMCLIENT=OFF
  52. -DUSE_BUNDLED_ZLIB=ON
  53. -DBUILD_SHARED_LIBS=OFF
  54. -DREGEX_BACKEND=builtin
  55. -DUSE_HTTP_PARSER=builtin
  56. -DENABLE_REPRODUCIBLE_BUILDS=ON
  57. )
  58. cmake_src_configure
  59. }
  60. src_compile() {
  61. append-cflags $(test-flags-CC -fno-plt)
  62. cmake_src_compile
  63. local cxxflags=(
  64. "-I${CMAKE_USE_DIR}/include"
  65. -DGITSTATUS_ZERO_NSEC
  66. -D_GNU_SOURCE
  67. )
  68. local ldflags=(
  69. "-L${BUILD_DIR}"
  70. -static
  71. )
  72. append-cxxflags "${cxxflags[@]}"
  73. append-ldflags "${ldflags[@]}"
  74. emake all pkg
  75. }
  76. src_install() {
  77. local DOCS=( {README,docs/listdir}.md )
  78. insinto "/usr/share/${PN}"
  79. exeinto "${_}"
  80. doins gitstatus.*.{sh,zsh{,.zwc}} *.info
  81. doexe install
  82. exeinto "/usr/libexec/${PN}"
  83. doexe usrbin/gitstatusd
  84. dosym "../../../libexec/${PN}/gitstatusd" \
  85. "/usr/share/${PN}/usrbin/gitstatusd"
  86. einstalldocs
  87. }