mirror of
https://github.com/terrapkg/packages.git
synced 2026-05-31 17:11:56 +00:00
117 lines
3.9 KiB
RPMSpec
117 lines
3.9 KiB
RPMSpec
# Generated by go2rpm 1.15.0
|
|
%bcond check 0
|
|
%bcond bootstrap 0
|
|
|
|
%if %{with bootstrap}
|
|
%global debug_package %{nil}
|
|
%endif
|
|
|
|
%if %{with bootstrap}
|
|
%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^golang\\(.*\\)$
|
|
%endif
|
|
|
|
# Naming variable as something other than "commit" is necessary
|
|
# to stop %%gometa from putting commit hash in release
|
|
%global commit_hash c93747926d2e5ead9adf0039f6bf34f48ba3263d
|
|
%global commit_date 20250225
|
|
%global shortcommit %{sub %{commit_hash} 1 7}
|
|
%global ver v2.0.14
|
|
|
|
# https://github.com/zyedidia/micro
|
|
%global goipath github.com/zyedidia/micro
|
|
Version: %{ver}^%{commit_date}git.%{shortcommit}
|
|
|
|
%gometa -f
|
|
|
|
%global common_description %{expand:
|
|
micro is a terminal-based text editor that aims to be easy to use and intuitive, while also taking advantage of the capabilities of modern terminals. It strives to be enjoyable as a full-time editor for people who prefer to work in a terminal, or those who regularly edit files over SSH.}
|
|
|
|
%global golicenses LICENSE LICENSE-THIRD-PARTY
|
|
%global godocs README.md runtime/help/colors.md runtime/help/commands.md\\\
|
|
runtime/help/copypaste.md runtime/help/defaultkeys.md\\\
|
|
runtime/help/help.md runtime/help/keybindings.md\\\
|
|
runtime/help/options.md runtime/help/plugins.md\\\
|
|
runtime/help/tutorial.md
|
|
|
|
Name: micro.nightly
|
|
Release: 1%{?dist}
|
|
Summary: A modern and intuitive terminal-based text editor
|
|
|
|
License: MIT
|
|
URL: %{gourl}
|
|
Packager: sadlerm <lerm@chromebooks.lol>
|
|
|
|
BuildRequires: anda-srpm-macros
|
|
|
|
Provides: micro-nightly = %{version}-%{release}
|
|
Provides: micro
|
|
Conflicts: micro
|
|
|
|
%description %{common_description}
|
|
|
|
%gopkg
|
|
|
|
%prep
|
|
git clone --recurse-submodules -q -j$(nproc) %{gourl} -b master && cd micro
|
|
if ! [ %{shortcommit} = $(git rev-parse --short=7 HEAD) ]; then
|
|
printf "Commit mismatch, exiting..." >&2
|
|
exit 1
|
|
fi
|
|
|
|
%go_prep_online
|
|
|
|
%build
|
|
cd micro
|
|
%if %{without bootstrap}
|
|
go generate ./runtime
|
|
|
|
MICRO_VERSION=$(go run ./tools/build-version.go)
|
|
MICRO_DATE=$(date --date=%{commit_date} +"%%B %%d, %%Y")
|
|
|
|
go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${GO_BUILDTAGS-${BUILDTAGS-}}" -a -x \
|
|
-ldflags "-X internal/util.version=${MICRO_VERSION} \
|
|
-X internal/util.hash=%{shortcommit} \
|
|
-X 'internal/util.date=${MICRO_DATE}' \
|
|
-B 0x$(echo "%{name}-%{version}-%{release}-${SOURCE_DATE_EPOCH:-}" | sha1sum | cut -d ' ' -f1) \
|
|
-compressdwarf=false -linkmode=external \
|
|
-extldflags '-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now \
|
|
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 \
|
|
-Wl,--build-id=sha1'" \
|
|
-o ./micro ./cmd/micro/
|
|
%endif
|
|
|
|
%install
|
|
%if %{without bootstrap}
|
|
install -m 0755 -vd %{buildroot}%{_bindir} \
|
|
%{buildroot}%{_mandir}/man1 \
|
|
%{buildroot}%{_datadir}/applications
|
|
|
|
install -m 0755 -vp ./micro/micro %{buildroot}%{_bindir}/
|
|
install -m 0644 -vp ./micro/assets/packaging/micro.1 %{buildroot}%{_mandir}/man1/
|
|
install -m 0644 -vp ./micro/assets/packaging/micro.desktop %{buildroot}%{_datadir}/applications/
|
|
|
|
# for %%doc packaging
|
|
mkdir -v ./micro/help
|
|
mv -v ./micro/runtime/help/* ./micro/help/
|
|
%endif
|
|
|
|
%if %{without bootstrap}
|
|
%if %{with check}
|
|
%check
|
|
cd micro
|
|
%gotest ./internal/... ./cmd/micro/...
|
|
%endif
|
|
%endif
|
|
|
|
%if %{without bootstrap}
|
|
%files
|
|
%license micro/LICENSE micro/LICENSE-THIRD-PARTY
|
|
%doc micro/README.md micro/help
|
|
%{_bindir}/micro
|
|
%{_mandir}/man1/micro.1.gz
|
|
%{_datadir}/applications/micro.desktop
|
|
%endif
|
|
|
|
%changelog
|
|
%autochangelog
|