# obscene macro junk %global ghowner Ouest-France %global owner %{ghowner} %global githost github.com %global proj ldap %global module terraform-provider-%{proj} %global archive v%{version}.tar.gz %global dir %{module}-%{version} %global namespace %{githost}/%{owner}/%{module} %global v13base %{_datadir}/terraform/plugins/%{regsite}/%{regorg}/%{proj}/%{version}/%{regos}_%{regarch} %global regsite registry.terraform.io %global regorg hashicorp %global regarch amd64 %global regos %{_target_os} Name: golang-github-%{module} Version: 0.5.0 Release: 1%{!?dis:%{?dist}} Summary: Terraform %{plugin} provider Group: Applications/System License: MPL-2.0 License URL: https://registry.terraform.io/providers/%{ghowner}/%{plugin}/latest Source0: https://%{namespace}/archive/v%{version}.tar.gz BuildRequires: golang make git Requires: terraform %description A Terraform plugin for managing an LDAP server. %prep %setup -q -n %{module}-%{version} %build %define debug_package %{nil} export GOPATH=$PWD export GOOS=%{_target_os} export GOARCH=%{regarch} export GOFLAGS=-modcacherw mkdir -p src/%{namespace}/ shopt -s extglob dotglob mv !(src) src/%{namespace}/ shopt -u extglob dotglob pushd src/%{namespace}/ go build -o bin/%{module} popd %install [ "%{buildroot}" = "/" ] || [ ! -d %{buildroot} ] || rm -rf %{buildroot} install -d -m 755 %{buildroot}%{_bindir} install -m 0755 \ src/%{namespace}/bin/%{module} \ %{buildroot}%{_bindir} %clean find %{buildroot} -exec chmod 777 \{\} \; # modcacherw is imperfect still rm -rf %{buildroot} %files #license src/%{namespace}/LICENSE %doc src/%{namespace}/README.md %{_bindir}/%{module} %changelog