1 # Copyright 2018-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
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"
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"
20 KEYWORDS="~amd64 ~arm64 ~loong ~riscv ~x86"
21 IUSE="doc +extended test"
33 >=media-libs/libwebp-1.3.2:=
38 RESTRICT="!test? ( test )"
41 "${FILESDIR}"/${PN}-0.121.0-unbundle-libwebp-and-libsass.patch
42 "${FILESDIR}"/${PN}-0.128.0-skip-some-tests.patch
46 if [[ ${MERGE_TYPE} == binary ]] ; then
50 if has test ${FEATURES}; then
51 CHECKREQS_DISK_BUILD="4G"
53 CHECKREQS_DISK_BUILD="1500M"
55 check-reqs_${EBUILD_PHASE_FUNC}
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")"
78 # wants to run command that require network access
79 rm testscripts/commands/mod{,_vendor,__disable,_get,_get_u,_npm{,_withexisting}}.txt || 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
97 bin/hugo gen doc --dir doc || die
102 if ! has_version -b virtual/pandoc ; then
103 elog "You're missing virtual/pandoc - some tests will be skipped."
106 ego test "./..." ${MY_BUILD_FLAGS}
113 dobashcomp completions/${PN}
114 dofishcomp completions/${PN}.fish
115 dozshcomp completions/_${PN}
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)"