File hugo.spec of Package hugo
#
# spec file for package hugo
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define go_version 1.24
Name: hugo
Version: 0.145.0
Release: 0
Summary: The worlds fastest framework for building websites
# FIXME: Select a correct license from https://github.com/openSUSE/spec-cleaner#spdx-licenses
License: Apache-2.0
Group: Productivity/Publishing/Other
URL: https://gohugo.io/
Source: %{name}-%{version}.tar.gz
Source1: vendor.tar.gz
Source2: hugo-compress-site
Source99: hugo-rpmlintrc
BuildRequires: gcc-c++
BuildRequires: golang(API) >= %{go_version}
BuildRequires: golang-packaging
BuildRequires: pkgconfig(libsass) >= 3.5
BuildRequires: pkgconfig(libwebp)
Recommends: %{name}-doc = %{version}
Recommends: go%{go_version}
# formatsupport:
# to support more formarts from docs/content/en/content-management/formats.md
Recommends: python3-docutils
Recommends: python3-Pygments
Recommends: pandoc
Recommends: asciidoc
Recommends: rubygem(%{rb_default_ruby_abi}:asciidoctor)
# /formatsupport
Recommends: hugo-compress-site
%description
Hugo is a static HTML and CSS website generator written in Go. It is optimized
for speed, ease of use, and configurability. Hugo takes a directory with
content and templates and renders them into a full HTML website.
Hugo relies on Markdown files with front matter for metadata, and you can run
Hugo from any directory. This works well for shared hosts and other systems
where you don’t have a privileged account.
Hugo renders a typical website of moderate size in a fraction of a second. A
good rule of thumb is that each piece of content renders in around 1
millisecond.
Hugo is designed to work well for any kind of website including blogs, tumbles,
and docs.
%package doc
Summary: Documentation and examples for Hugo
Group: Productivity/Publishing/Other
Requires: %{name} = %{version}
BuildArch: noarch
%description doc
Hugo is a static HTML and CSS website generator written in Go. It is optimized
for speed, ease of use, and configurability. Hugo takes a directory with
content and templates and renders them into a full HTML website.
Hugo relies on Markdown files with front matter for metadata, and you can run
Hugo from any directory. This works well for shared hosts and other systems
where you don’t have a privileged account.
Hugo renders a typical website of moderate size in a fraction of a second. A
good rule of thumb is that each piece of content renders in around 1
millisecond.
Hugo is designed to work well for any kind of website including blogs, tumbles,
and docs.
This package holds the examples and documentation files.
%package compress-site
Summary: A simple script for compressing files in your hugo site
Group: Productivity/Publishing/Other
Requires: brotli
Requires: ruby
Requires: gzip
License: AGPL-3.0-only
BuildArch: noarch
%description compress-site
A simple script for compressing files in your hugo site.
%package bash-completion
Summary: Bash Completion for %{name}
Group: System/Shells
Requires: bash-completion
Supplements: packageand(%{name}:bash)
BuildArch: noarch
%description bash-completion
The official bash completion script for %{name}, generated during the build
%prep
%autosetup -a 1
%build
# build tags explained:
# - extended: build hugo in extended mode
# - dev: make the go-libsass use the system library
CGO_ENABLED=1 \
go build \
-mod=vendor \
-tags="dev extended" \
-buildmode=pie \
-ldflags "-X github.com/gohugoio/hugo/common/hugo.vendorInfo=https://build.opensuse.org/package/show/%{_project}/%{name}"
./hugo version
find docs/ -name .gitignore -print -delete
find docs/ -type f -print0 | xargs -r0 chmod a-x
%install
install -D -m 0755 hugo %{buildroot}%{_bindir}/hugo
install -D -m 0755 %{SOURCE2} %{buildroot}%{_bindir}/hugo-compress-site
# Build the man pages.
%{buildroot}/%{_bindir}/%{name} gen man
# Install the man pages.
mkdir -p "%{buildroot}/%{_mandir}/man1"
install -D -m 0644 man/%{name}*.1 "%{buildroot}/%{_mandir}/man1"
# Build the bash autocomplete file
%{buildroot}/%{_bindir}/%{name} completion bash > %{name}-autocomplete.sh
# Install the bash autocomplete file
install -Dm 644 %{name}-autocomplete.sh %{buildroot}%{_datadir}/bash-completion/completions/%{name}
%files
%license LICENSE
%doc CONTRIBUTING.md README.md
%{_bindir}/hugo
%{_mandir}/man1/%{name}*.1.gz
%files doc
%doc docs/
%files compress-site
%{_bindir}/hugo-compress-site
%files bash-completion
%{_datadir}/bash-completion
%changelog