Files
go-rpm-macros/macros.buildsystem.golang
2026-01-04 10:56:57 +08:00

20 lines
640 B
Plaintext

# Example buildsystem for go
%buildsystem_golang_conf() %nil
%buildsystem_golang_prep() %{expand:\\\
%autosetup -C -p1 %* ; \\\
%{go_prep}
}
%buildsystem_golang_build() %{expand:\\\
%{go_common} \\\
export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw" ; \\\
%__go build %{shrink:%{go_build_flags_default} %*} -o %{_name} . \\\
}
%buildsystem_golang_install() %{expand:\\\
%__install -D -m 0755 %{_name} %{buildroot}%{_bindir}/%{_name} \\\
}
%buildsystem_golang_check() %{expand:\\\
%{go_common} \\\
cd %{_builddir}/go/src/%{go_import_path} ; \\\
%__go test %{shrink:%{go_test_flags_default} %*} ./... \\\
}