From 5562fc0a9086afdf5a9112f4f87ecefe898dd8e7 Mon Sep 17 00:00:00 2001 From: Jan Chaloupka Date: Sep 09 2015 13:47:25 +0000 Subject: Initial commit - resolves: #1258182 --- diff --git a/go-compilers.spec b/go-compilers.spec new file mode 100644 index 0000000..16b7cc6 --- /dev/null +++ b/go-compilers.spec @@ -0,0 +1,75 @@ +Name: go-compilers +Version: 1 +Release: 1%{?dist} +Summary: Go language compilers for various architectures +Group: Development/Tools +License: GPLv3+ +Source0: macros.golang-compiler +Source1: macros.gcc-go-compiler + +ExclusiveArch: %{go_arches} + +# for install, cut and rm commands +BuildRequires: coreutils +# for go specific macros +BuildRequires: go-srpm-macros + +%description +The package provides correct golang language compiler +base on an architectures. + +%ifarch %{golang_arches} +%package golang-compiler +Summary: compiler for golang + +Requires: golang + +Provides: compiler(go-compiler) +Provides: compiler(golang) + +%description golang-compiler +Compiler for golang. +%endif + +%ifarch %{gccgo_arches} +%package gcc-go-compiler +Summary: compiler for gcc-go + +Requires: gcc-go >= %{gccgo_min_vers} + +Provides: compiler(go-compiler) +Provides: compiler(gcc-go) + +%description gcc-go-compiler +Compiler for gcc-go. +%endif + +%prep +# nothing to prep, just for hooks + +%build +# nothing to build, just for hooks + +%install +%ifarch %{golang_arches} +install -m 644 -D %{SOURCE0} %{buildroot}%{_rpmconfigdir}/macros.d/macros.golang-compiler +%endif + +%ifarch %{gccgo_arches} +install -m 644 -D %{SOURCE1} %{buildroot}%{_rpmconfigdir}/macros.d/macros.gcc-go-compiler +%endif + +%ifarch %{golang_arches} +%files golang-compiler +%{_rpmconfigdir}/macros.d/macros.golang-compiler +%endif + +%ifarch %{gccgo_arches} +%files gcc-go-compiler +%{_rpmconfigdir}/macros.d/macros.gcc-go-compiler +%endif + +%changelog +* Tue Jul 07 2015 Jan Chaloupka - 1-1 +- Initial commit + resolves: #1258182 diff --git a/macros.gcc-go-compiler b/macros.gcc-go-compiler new file mode 100644 index 0000000..b2ae622 --- /dev/null +++ b/macros.gcc-go-compiler @@ -0,0 +1,19 @@ +# Copyright (c) 2015 Jakub Cajka , Jan Chaloupka +# This file is distributed under the terms of GNU GPL license version 3, or +# any later version. + +# This file contains macros for building projects in golang for packages +# with golang compiler or gcc-go compiler based on an architecture. + +# Minimal version of gcc providing gcc-go +%gccgo_min_vers 5.0.0 + +# Define commands for building +%gobuild(o:) go build -compiler gccgo -gccgoflags "$RPM_OPT_FLAGS ${LDFLAGS:-}" -a -v -x %{?**}; + +# Define commands for testing +%gotest() go test -compiler gccgo -gccgoflags "$RPM_OPT_FLAGS ${LDFLAGS:-}" + %{?**}; + +# Enable use of compiler(...) virtual provide +%go_compiler 1 diff --git a/macros.golang-compiler b/macros.golang-compiler new file mode 100644 index 0000000..47c3de8 --- /dev/null +++ b/macros.golang-compiler @@ -0,0 +1,16 @@ +# Copyright (c) 2015 Jakub Cajka , Jan Chaloupka +# This file is distributed under the terms of GNU GPL license version 3, or +# any later version. + +# This file contains macros for building projects in golang for packages +# with golang compiler or gcc-go compiler based on an architecture. + +# Define commands for building +# BUILD_ID can be generated for golang build no matter of debuginfo +%gobuild(o:) go build -compiler gc -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**}; + +# Define commands for testing +%gotest() go test -compiler gc -ldflags "${LDFLAGS:-}" %{?**}; + +# Enable use of compiler(...) virtual provide +%go_compiler 1