Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ settings.toml
.secrets.toml
/rhc*.tar.*
/vendor/
*.mo
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
.ONESHELL:
.SHELLFLAGS := -e -c

VERSION := $(shell rpmspec rhc.spec --query --queryformat '%{version}')
VERSION := $(shell rpmspec rhc.spec --query --queryformat '%{version}\n' | head -n 1)

# The 'build' target is not used during packaging; it is present for upstream development purposes.
.PHONY: build
build:
go build -ldflags "-X main.Version=$(VERSION)" -o rhc ./cmd/rhc

# Compile translation files (.po -> .mo)
.PHONY: i18n
i18n:
@for file in po/*/LC_MESSAGES/*.po; do \
msgfmt --check -o $${file%.po}.mo $$file; \
done

.PHONY: archive
archive:
git archive --prefix rhc-$(VERSION)/ --format tar.gz HEAD > rhc-$(VERSION).tar.gz
Expand All @@ -22,3 +29,4 @@ srpm: archive
clean:
rm -f rhc
rm -f rhc-*.tar*
find po -name "*.mo" -type f -delete
14 changes: 14 additions & 0 deletions rhc.spec
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Source2: go-vendor-tools.toml

BuildRequires: go-vendor-tools
BuildRequires: systemd-rpm-macros
BuildRequires: gettext
%if 0%{?with_check}
BuildRequires: /usr/bin/dbus-launch
%endif
Expand Down Expand Up @@ -49,6 +50,9 @@ export GO_LDFLAGS="-X main.Version=%{version} -X main.ServiceName=yggdrasil"
# Generate man page
%{gobuilddir}/bin/rhc --generate-man-page > rhc.1

# Compile translation files (.po -> .mo)ç
make i18n

%install
# Licenses
%go_vendor_license_install -c %{S:2}
Expand All @@ -73,6 +77,14 @@ install -m 0755 -vd %{buildroot}%{_sysconfdir}/%{name}/
install -m 0755 -vd %{buildroot}%{_unitdir}/yggdrasil.service.d/
install -m 0644 -vp %{buildroot}%{_unitdir}/yggdrasil.service.d/rhcd.conf %{buildroot}%{_unitdir}/yggdrasil.service.d/
%endif
# Localization files
for mo_file in po/*/LC_MESSAGES/*.mo; do
if [ -f "$mo_file" ]; then
lang=$(echo $mo_file | sed 's|po/\(.*\)/LC_MESSAGES/.*|\1|')
install -m 0755 -vd %{buildroot}%{_prefix}/local/share/locale/$lang/LC_MESSAGES
install -m 0644 -vp $mo_file %{buildroot}%{_prefix}/local/share/locale/$lang/LC_MESSAGES/rhc.mo
fi
done

%check
%go_vendor_license_check -c %{S:2}
Expand Down Expand Up @@ -113,6 +125,8 @@ fi
%if 0%{?with_rhcd_compat}
%{_unitdir}/yggdrasil.service.d/rhcd.conf
%endif
# Localization
%{_prefix}/local/share/locale/*/LC_MESSAGES/rhc.mo

%changelog
%autochangelog
Loading