app-admin/awscli: Bump to 1.37.9
[gentoo/gentoo.git] / www-apps / hugo / hugo-0.129.0.ebuild
blobe9550f242204f99539260dd1217df7fd79847e4f
1 # Copyright 2018-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
6 inherit check-reqs go-module shell-completion
8 DESCRIPTION="Fast static HTML and CSS website generator"
9 HOMEPAGE="https://gohugo.io https://github.com/gohugoio/hugo"
10 SRC_URI="
11         https://github.com/gohugoio/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
12         https://tastytea.de/files/gentoo/${P}-vendor.tar.xz
15 # NOTE: To create the vendor tarball, run:
16 # `go mod vendor && cd .. && tar -caf ${P}-vendor.tar.xz ${P}/vendor`
18 LICENSE="Apache-2.0 BSD BSD-2 MIT MPL-2.0 Unlicense"
19 SLOT="0"
20 KEYWORDS="~amd64 ~arm64 ~loong ~riscv ~x86"
21 IUSE="doc +extended test"
23 BDEPEND="
24         >=dev-lang/go-1.22.2
25         test? (
26                 dev-python/docutils
27                 dev-ruby/asciidoctor
28         )
30 RDEPEND="
31         extended? (
32                 dev-libs/libsass:=
33                 >=media-libs/libwebp-1.3.2:=
34         )
36 DEPEND="${RDEPEND}"
38 RESTRICT="!test? ( test )"
40 PATCHES=(
41         "${FILESDIR}"/${PN}-0.121.0-unbundle-libwebp-and-libsass.patch
42         "${FILESDIR}"/${PN}-0.128.0-skip-some-tests.patch
45 _check_reqs() {
46         if [[ ${MERGE_TYPE} == binary ]] ; then
47                 return 0
48         fi
50         if has test ${FEATURES}; then
51                 CHECKREQS_DISK_BUILD="4G"
52         else
53                 CHECKREQS_DISK_BUILD="1500M"
54         fi
55         check-reqs_${EBUILD_PHASE_FUNC}
58 pkg_pretend() {
59         _check_reqs
62 pkg_setup() {
63         _check_reqs
66 src_configure() {
67         export CGO_ENABLED=1
68         export CGO_CFLAGS="${CFLAGS}"
69         export CGO_CPPFLAGS="${CPPFLAGS}"
70         export CGO_CXXFLAGS="${CXXFLAGS}"
71         export CGO_LDFLAGS="${LDFLAGS}"
72         export MY_BUILD_FLAGS="$(usev extended "-tags extended")"
74         default
77 src_prepare() {
78         # wants to run command that require network access
79         rm testscripts/commands/mod{,_vendor,__disable,_get,_get_u,_npm{,_withexisting}}.txt || die
81         default
84 src_compile() {
85         mkdir -pv bin || die
86         ego build -ldflags "-X github.com/gohugoio/hugo/common/hugo.vendorInfo=gentoo:${PVR}" \
87                 ${MY_BUILD_FLAGS} -o "${S}/bin/hugo"
89         bin/hugo gen man --dir man || die
91         mkdir -pv completions || die
92         bin/hugo completion bash > completions/hugo || die
93         bin/hugo completion fish > completions/hugo.fish || die
94         bin/hugo completion zsh > completions/_hugo || die
96         if use doc ; then
97                 bin/hugo gen doc --dir doc || die
98         fi
101 src_test() {
102         if ! has_version -b virtual/pandoc ; then
103                 elog "You're missing virtual/pandoc - some tests will be skipped."
104         fi
106         ego test "./..." ${MY_BUILD_FLAGS}
109 src_install() {
110         dobin bin/*
111         doman man/*
113         dobashcomp completions/${PN}
114         dofishcomp completions/${PN}.fish
115         dozshcomp completions/_${PN}
117         if use doc ; then
118                 dodoc -r doc/*
119         fi
122 pkg_postinst() {
123         elog "the sass USE-flag was renamed to extended. the functionality is the" \
124                 "same, except it also toggles the dependency on libwebp (for encoding)"