Instantly share code, notes, and snippets.

What would you like to do?
golang specfile for CentOS 5.x and RHEL5
# Specfile for go used @ bitly for CentOS 5.*, RHEL5
%define name go-devel
%define path /usr/local
%define version go1.0.2
%define release 13
%define group Development/Languages
%define __os_install_post %{nil}
Name: %{name}
Version: %{version}
Release: %{release}
Summary: The Go programming language
Group: Development/Languages
License: BSD
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
AutoReqProv: no
The Go programming language is an open source project to make programmers
more productive. Go is expressive, concise, clean, and efficient. Its
concurrency mechanisms make it easy to write programs that get the most
out of multi-core and networked machines, while its novel type system
enables flexible and modular program construction. Go compiles quickly
to machine code yet has the convenience of garbage collection and the
power of run-time reflection. It's a fast, statically typed, compiled
language that feels like a dynamically typed, interpreted language.
%setup -D -b1
rm -rf $RPM_BUILD_DIR/%{name}-%{version}-%{release}
mkdir -p $RPM_BUILD_DIR/%{name}-%{version}-%{release}
tar -xvzf %{SOURCE0} -C $RPM_BUILD_DIR/%{name}-%{version}-%{release}
export GOPATH=
export GOROOT=
export GOARCH=
export GOOS=
cd $RPM_BUILD_DIR/%{name}-%{version}-%{release}
cd go/src
export DONT_STRIP=1
cd $RPM_BUILD_DIR/%{name}-%{version}-%{release}
mkdir -p $RPM_BUILD_ROOT/%{path}
cp -R go $RPM_BUILD_ROOT/%{path}
mkdir -p $RPM_BUILD_ROOT/etc/profile.d
export PACKAGE_DIR=$(echo %{version} | awk -F. '{print $1"."$2}')
mkdir -p $RPM_BUILD_ROOT/%{path}/go/site-packages/$PACKAGE_DIR/src
mkdir -p $RPM_BUILD_ROOT/%{path}/go/site-packages/$PACKAGE_DIR/pkg/linux_amd64
echo "
export GOROOT=/%{path}/go
export GOPATH=/%{path}/go/site-packages/$PACKAGE_DIR
export GOARCH=amd64
export GOOS=linux
export PATH=\$PATH:/%{path}/go/bin
" > $RPM_BUILD_ROOT/etc/profile.d/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment