sys-apps/isd: new package
[gentoo-zh.git] / app-shells / gitstatus / gitstatus-1.5.5.ebuild
blob1abf491a4070cf7a0a7108a5c8c37be7ff089b4b
1 # Copyright 2023 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
6 inherit cmake flag-o-matic
8 DESCRIPTION="Git status for Bash and Zsh prompt"
9 HOMEPAGE="https://github.com/romkatv/gitstatus"
10 SRC_URI="https://github.com/romkatv/gitstatus/archive/v${PV}.tar.gz -> ${P}.tar.gz"
12 # LIBGIT2_TAG depends on pkgver. They must be updated together. See libgit2_version in:
13 # https://raw.githubusercontent.com/romkatv/gitstatus/v${pkgver}/build.info
14 LIBGIT2_TAG="tag-5860a42d19bcd226cb6eff2dcbfcbf155d570c73"
15 SRC_URI+=" https://github.com/romkatv/libgit2/archive/refs/tags/${LIBGIT2_TAG}.tar.gz -> libgit2-${LIBGIT2_TAG}.tar.gz"
16 CMAKE_USE_DIR="${S}/deps/libgit2"
17 BUILD_DIR="${CMAKE_USE_DIR}_BUILD"
19 IUSE="zsh-completion"
21 LICENSE="GPL-3"
22 SLOT="0"
23 KEYWORDS="~amd64 ~x86"
25 DEPEND="zsh-completion? ( app-shells/zsh )"
26 RDEPEND="${DEPEND}"
28 src_unpack() {
29         default
30         mv -v "${WORKDIR}/libgit2-${LIBGIT2_TAG}" "${S}/deps/libgit2" || die
33 src_configure() {
34         mycmakeargs=(
35                 -DCMAKE_BUILD_TYPE=Release
36                 -DZERO_NSEC=ON
37                 -DTHREADSAFE=ON
38                 -DUSE_BUNDLED_ZLIB=ON
39                 -DREGEX_BACKEND=builtin
40                 -DUSE_HTTP_PARSER=builtin
41                 -DUSE_SSH=OFF
42                 -DUSE_HTTPS=OFF
43                 -DBUILD_CLAR=OFF
44                 -DUSE_GSSAPI=OFF
45                 -DUSE_NTLMCLIENT=OFF
46                 -DBUILD_SHARED_LIBS=OFF
47         )
48         cmake_src_configure
51 src_compile() {
52         append-cflags $(test-flags-CC -fno-plt)
54         cmake_src_compile
56         local cxxflags=(
57                 "-I${CMAKE_USE_DIR}/include"
58                 -DGITSTATUS_ZERO_NSEC
59                 -D_GNU_SOURCE
60         )
61         local ldflags=(
62                 "-L${BUILD_DIR}"
63                 -static
64         )
66         append-cxxflags "${cxxflags[@]}"
67         append-ldflags "${ldflags[@]}"
68         emake all
69         GITSTATUS_DAEMON= GITSTATUS_CACHE_DIR=${S}/usrbin ./install
70         if use zsh-completion; then
71                 for file in *.zsh install; do
72                         zsh -fc "emulate zsh -o no_aliases && zcompile -R -- $file.zwc $file" || die "Couldn't zcompile"
73                 done
74         fi
77 src_install() {
78         insinto "/usr/share/${PN}"
79         exeinto "${_}"
81         doins gitstatus.*.sh *.info
83         if use zsh-completion; then
84                 doins gitstatus.*.zsh{,.zwc}
85         fi
87         doexe install
89         exeinto "/usr/libexec/${PN}"
90         doexe usrbin/gitstatusd
92         dosym "../../../libexec/${PN}/gitstatusd" \
93                 "/usr/share/${PN}/usrbin/gitstatusd"
95         dodoc {README,docs/listdir}.md
98 pkg_postinst() {
99         elog "The easiest way to take advantage of gitstatus from Zsh is to use a theme"
100         elog "that's already integrated with it. For example: app-shells/zsh-theme-powerlevel10k"
101         elog "The easiest way to take advantage of gitstatus from Bash is via gitstatus.prompt.sh."
102         elog "Follow this guide: https://github.com/romkatv/gitstatus#using-from-bash"