Home Wiki > openSUSE:Packaging Go
Sign up | Login

openSUSE:Packaging Go

tagline: From openSUSE

The Packaging Go is a step by step introduction on how to build Go software packages for openSUSE and others using the openSUSE Build Service.

Contents

About Go

Go is an expressive, concurrent, garbage collected systems programming language that is type safe and memory safe. It has pointers but no pointer arithmetic. Go has fast builds, clean syntax, garbage collection, methods for any type, and run-time reflection. It feels like a dynamic language but has the speed and safety of a static language.

Recipe

You can use the following spec file template. Make sure to replace $VARIABLES with appropriate values. Please note that Go packages follow a strict naming convention, i.e. 'go-$EXACT_UPSTREAM_NAME'. Furthermore, most Go software currently doesn't follow a strict version scheme. You should use the date when you retrieved the upstream software (e.g. via git/mercurial/etc. checkout) plus the VCS used, like 0.0.0+git20110521. If the upstream maintainers decide to start using a version scheme, this ensures easy package upgrades in the future.

#
# Copyright (c) 2011, $YOUR_NAME <$YOUR_MAIL>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
 
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# 
 
 
Name:           go-$EXACT_UPSTREAM_NAME
Version:        0.0.0+git20110521
Release:        0
License:        $LICENSE
Summary:        $SUMMARY
Url:            $HOMEPAGE
Group:          Development/Languages/Other
Source0:        $EXACT_UPSTREAM_NAME-%{version}.tar.bz2
BuildRequires:  go-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
# The following line is only needed for (static) libraries:
%if 0%{?suse_version} >= 1100
Recommends:     %{name}-doc
%endif
%{go_requires}
%{go_provides}
 
%description
$DESCRIPTION

%package doc
Summary:        API documentation
Group:          Documentation/Other
Requires:       %{name} = %{version}

%description doc
API, examples and documentation. 

%prep
%setup -q -n $EXACT_UPSTREAM_NAME

%build
%goprep $IMPORTPATH_NAMESPACE
%gobuild $IMPORTPATH_MODIFIER

%install
%{go_disable_brp_strip_static_archive}

%goinstall
%godoc

%check
%gotest $IMPORTPATH_NAMESPACE

%files
%defattr(-,root,root,-)
%doc README LICENSE
%{go_contribdir}/*

%files doc
%defattr(-,root,root,-)
%{go_contribdir}/*

%changelog

Provided macros

You can look up the provided macros in the file /etc/rpm/macros.go (when the Go base package is installed). This file also gives a description of how to use the $IMPORTPATH_MODIFIER arguments for the %gobuild macro.

Communication

Team members

External links