Rename to golang

This commit is contained in:
Denis Silakov 2015-06-25 12:11:00 +03:00
parent d2c6eda290
commit 2f2b3f774d
10 changed files with 167 additions and 569 deletions

View file

@ -1,13 +0,0 @@
diff --git a/src/cmd/go/pkg.go b/src/cmd/go/pkg.go
index 30bbfad..54d65f9 100644
--- a/src/cmd/go/pkg.go
+++ b/src/cmd/go/pkg.go
@@ -220,7 +220,7 @@ func loadImport(path string, srcDir string, stk *importStack, importPos []token.
//
// TODO: After Go 1, decide when to pass build.AllowBinary here.
// See issue 3268 for mistakes to avoid.
- bp, err := buildContext.Import(path, srcDir, build.ImportComment)
+ bp, err := buildContext.Import(path, srcDir, build.ImportComment | build.AllowBinary)
bp.ImportPath = importPath
if gobin != "" {
bp.BinDir = gobin

View file

@ -1,4 +0,0 @@
addFilter("binaryinfo-readelf-failed") # go binaries are suposedly ELF-compliant
addFilter("statically-linked-binary") # go doesn't yet support dynamic linking
addFilter("unstripped-binary-or-object") # doesnt like stripping
addFilter("devel-file-in-non-devel-package")

17
go.sh
View file

@ -1,17 +0,0 @@
# go toolchain env paths
gopath=lib
arch=386
if [ -x /usr/lib64/go ] ; then
gopath=lib64
arch=amd64
fi
export GOOS="linux"
export GOARCH=$arch
export GOROOT=/usr/$gopath/go
export GOBIN=/usr/bin
if [ `id -u` != 0 ]; then
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
fi

342
go.spec
View file

@ -1,342 +0,0 @@
%define debug_package %{nil}
%define __debug_install_post echo
%define goversion go1.4
Summary: A compiled, garbage-collected, concurrent programming language
Name: go
Version: 1.4
Release: 1
License: BSD-3-Clause
Group: Development/Other
Url: http://golang.org
Source0: https://storage.googleapis.com/golang/%{name}%{version}.src.tar.gz
Source1: %{name}.rpmlintrc
Source2: go.sh
Source3: macros.go
# This file is otherwise generated at build-time from the .hg directory, which was
# stripped from the tarball to save space. TODO: Update contents after version update!
Source4: VERSION
Source5: godoc.service
# PATCH-FIX-OPENSUSE re-enable build binary only packages (we are binary distro)
# see http://code.google.com/p/go/issues/detail?id=2775 & also issue 3268
Patch4: allow-binary-only-packages.patch
BuildRequires: bison
BuildRequires: ed
BuildRequires: systemd
# We need to manually specify the release version string here. All code compiled
# with this package will have the release string specified by the VERSION file
# in this source tarball baked into it, libs compiled with a different version
# cannot be linked anyway so all library packages will depend on this version string.
# the version string is pulled into the %godepends macro using the "go version" command.
Provides: go-devel = %{goversion}
Provides: go-devel-static = %{goversion}
Provides: golang = %{version}-%{release}
Obsoletes: go-devel < %{goversion}
Obsoletes: %{name}-kate < 1.2.1
%description
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.
%files
%doc AUTHORS CONTRIBUTORS LICENSE PATENTS README
%ifarch %{ix86}
%{_libdir}/go/pkg/tool/linux_%{go_arch}/8*
%endif
%ifarch x86_64
%{_libdir}/go/pkg/tool/linux_%{go_arch}/6*
%endif
%ifarch %{armx}
%{_libdir}/go/pkg/tool/linux_%{go_arch}/5*
%endif
%{_libdir}/go/src/cmd
%{_libdir}/go/src/pkg
%{_libdir}/go/pkg/linux_%{go_arch}/archive/tar.a
%{_libdir}/go/pkg/linux_%{go_arch}/archive/zip.a
%{_libdir}/go/pkg/linux_%{go_arch}/bufio.a
%{_libdir}/go/pkg/linux_%{go_arch}/bytes.a
%{_libdir}/go/pkg/linux_%{go_arch}/cgocall.h
%{_libdir}/go/pkg/linux_%{go_arch}/cmd/internal/goobj.a
%{_libdir}/go/pkg/linux_%{go_arch}/cmd/internal/objfile.a
%{_libdir}/go/pkg/linux_%{go_arch}/cmd/internal/rsc.io/arm/armasm.a
%{_libdir}/go/pkg/linux_%{go_arch}/cmd/internal/rsc.io/x86/x86asm.a
%{_libdir}/go/pkg/linux_%{go_arch}/cmd/pprof/internal/commands.a
%{_libdir}/go/pkg/linux_%{go_arch}/cmd/pprof/internal/driver.a
%{_libdir}/go/pkg/linux_%{go_arch}/cmd/pprof/internal/fetch.a
%{_libdir}/go/pkg/linux_%{go_arch}/cmd/pprof/internal/plugin.a
%{_libdir}/go/pkg/linux_%{go_arch}/cmd/pprof/internal/profile.a
%{_libdir}/go/pkg/linux_%{go_arch}/cmd/pprof/internal/report.a
%{_libdir}/go/pkg/linux_%{go_arch}/cmd/pprof/internal/svg.a
%{_libdir}/go/pkg/linux_%{go_arch}/cmd/pprof/internal/symbolizer.a
%{_libdir}/go/pkg/linux_%{go_arch}/cmd/pprof/internal/symbolz.a
%{_libdir}/go/pkg/linux_%{go_arch}/cmd/pprof/internal/tempfile.a
%{_libdir}/go/pkg/linux_%{go_arch}/compress/bzip2.a
%{_libdir}/go/pkg/linux_%{go_arch}/compress/flate.a
%{_libdir}/go/pkg/linux_%{go_arch}/compress/gzip.a
%{_libdir}/go/pkg/linux_%{go_arch}/compress/lzw.a
%{_libdir}/go/pkg/linux_%{go_arch}/compress/zlib.a
%{_libdir}/go/pkg/linux_%{go_arch}/container/heap.a
%{_libdir}/go/pkg/linux_%{go_arch}/container/list.a
%{_libdir}/go/pkg/linux_%{go_arch}/container/ring.a
%{_libdir}/go/pkg/linux_%{go_arch}/crypto.a
%{_libdir}/go/pkg/linux_%{go_arch}/crypto/aes.a
%{_libdir}/go/pkg/linux_%{go_arch}/crypto/cipher.a
%{_libdir}/go/pkg/linux_%{go_arch}/crypto/des.a
%{_libdir}/go/pkg/linux_%{go_arch}/crypto/dsa.a
%{_libdir}/go/pkg/linux_%{go_arch}/crypto/ecdsa.a
%{_libdir}/go/pkg/linux_%{go_arch}/crypto/elliptic.a
%{_libdir}/go/pkg/linux_%{go_arch}/crypto/hmac.a
%{_libdir}/go/pkg/linux_%{go_arch}/crypto/md5.a
%{_libdir}/go/pkg/linux_%{go_arch}/crypto/rand.a
%{_libdir}/go/pkg/linux_%{go_arch}/crypto/rc4.a
%{_libdir}/go/pkg/linux_%{go_arch}/crypto/rsa.a
%{_libdir}/go/pkg/linux_%{go_arch}/crypto/sha1.a
%{_libdir}/go/pkg/linux_%{go_arch}/crypto/sha256.a
%{_libdir}/go/pkg/linux_%{go_arch}/crypto/sha512.a
%{_libdir}/go/pkg/linux_%{go_arch}/crypto/subtle.a
%{_libdir}/go/pkg/linux_%{go_arch}/crypto/tls.a
%{_libdir}/go/pkg/linux_%{go_arch}/crypto/x509.a
%{_libdir}/go/pkg/linux_%{go_arch}/crypto/x509/pkix.a
%{_libdir}/go/pkg/linux_%{go_arch}/database/sql.a
%{_libdir}/go/pkg/linux_%{go_arch}/database/sql/driver.a
%{_libdir}/go/pkg/linux_%{go_arch}/debug/dwarf.a
%{_libdir}/go/pkg/linux_%{go_arch}/debug/elf.a
%{_libdir}/go/pkg/linux_%{go_arch}/debug/gosym.a
%{_libdir}/go/pkg/linux_%{go_arch}/debug/macho.a
%{_libdir}/go/pkg/linux_%{go_arch}/debug/plan9obj.a
%{_libdir}/go/pkg/linux_%{go_arch}/debug/pe.a
%{_libdir}/go/pkg/linux_%{go_arch}/encoding.a
%{_libdir}/go/pkg/linux_%{go_arch}/encoding/ascii85.a
%{_libdir}/go/pkg/linux_%{go_arch}/encoding/asn1.a
%{_libdir}/go/pkg/linux_%{go_arch}/encoding/base32.a
%{_libdir}/go/pkg/linux_%{go_arch}/encoding/base64.a
%{_libdir}/go/pkg/linux_%{go_arch}/encoding/binary.a
%{_libdir}/go/pkg/linux_%{go_arch}/encoding/csv.a
%{_libdir}/go/pkg/linux_%{go_arch}/encoding/gob.a
%{_libdir}/go/pkg/linux_%{go_arch}/encoding/hex.a
%{_libdir}/go/pkg/linux_%{go_arch}/encoding/json.a
%{_libdir}/go/pkg/linux_%{go_arch}/encoding/pem.a
%{_libdir}/go/pkg/linux_%{go_arch}/encoding/xml.a
%{_libdir}/go/pkg/linux_%{go_arch}/errors.a
%{_libdir}/go/pkg/linux_%{go_arch}/expvar.a
%{_libdir}/go/pkg/linux_%{go_arch}/flag.a
%{_libdir}/go/pkg/linux_%{go_arch}/fmt.a
%{_libdir}/go/pkg/linux_%{go_arch}/funcdata.h
%{_libdir}/go/pkg/linux_%{go_arch}/go/ast.a
%{_libdir}/go/pkg/linux_%{go_arch}/go/build.a
%{_libdir}/go/pkg/linux_%{go_arch}/go/doc.a
%{_libdir}/go/pkg/linux_%{go_arch}/go/format.a
%{_libdir}/go/pkg/linux_%{go_arch}/go/parser.a
%{_libdir}/go/pkg/linux_%{go_arch}/go/printer.a
%{_libdir}/go/pkg/linux_%{go_arch}/go/scanner.a
%{_libdir}/go/pkg/linux_%{go_arch}/go/token.a
%{_libdir}/go/pkg/linux_%{go_arch}/hash.a
%{_libdir}/go/pkg/linux_%{go_arch}/hash/adler32.a
%{_libdir}/go/pkg/linux_%{go_arch}/hash/crc32.a
%{_libdir}/go/pkg/linux_%{go_arch}/hash/crc64.a
%{_libdir}/go/pkg/linux_%{go_arch}/hash/fnv.a
%{_libdir}/go/pkg/linux_%{go_arch}/html.a
%{_libdir}/go/pkg/linux_%{go_arch}/html/template.a
%{_libdir}/go/pkg/linux_%{go_arch}/image.a
%{_libdir}/go/pkg/linux_%{go_arch}/image/color.a
%{_libdir}/go/pkg/linux_%{go_arch}/image/color/palette.a
%{_libdir}/go/pkg/linux_%{go_arch}/image/draw.a
%{_libdir}/go/pkg/linux_%{go_arch}/image/gif.a
%{_libdir}/go/pkg/linux_%{go_arch}/image/jpeg.a
%{_libdir}/go/pkg/linux_%{go_arch}/image/png.a
%{_libdir}/go/pkg/linux_%{go_arch}/index/suffixarray.a
%{_libdir}/go/pkg/linux_%{go_arch}/internal/syscall.a
%{_libdir}/go/pkg/linux_%{go_arch}/io.a
%{_libdir}/go/pkg/linux_%{go_arch}/io/ioutil.a
%{_libdir}/go/pkg/linux_%{go_arch}/log.a
%{_libdir}/go/pkg/linux_%{go_arch}/log/syslog.a
%{_libdir}/go/pkg/linux_%{go_arch}/math.a
%{_libdir}/go/pkg/linux_%{go_arch}/math/big.a
%{_libdir}/go/pkg/linux_%{go_arch}/math/cmplx.a
%{_libdir}/go/pkg/linux_%{go_arch}/math/rand.a
%{_libdir}/go/pkg/linux_%{go_arch}/mime.a
%{_libdir}/go/pkg/linux_%{go_arch}/mime/multipart.a
%{_libdir}/go/pkg/linux_%{go_arch}/net.a
%{_libdir}/go/pkg/linux_%{go_arch}/net/http.a
%{_libdir}/go/pkg/linux_%{go_arch}/net/http/cgi.a
%{_libdir}/go/pkg/linux_%{go_arch}/net/http/cookiejar.a
%{_libdir}/go/pkg/linux_%{go_arch}/net/http/fcgi.a
%{_libdir}/go/pkg/linux_%{go_arch}/net/http/httptest.a
%{_libdir}/go/pkg/linux_%{go_arch}/net/http/httputil.a
%{_libdir}/go/pkg/linux_%{go_arch}/net/http/internal.a
%{_libdir}/go/pkg/linux_%{go_arch}/net/http/pprof.a
%{_libdir}/go/pkg/linux_%{go_arch}/net/mail.a
%{_libdir}/go/pkg/linux_%{go_arch}/net/rpc.a
%{_libdir}/go/pkg/linux_%{go_arch}/net/rpc/jsonrpc.a
%{_libdir}/go/pkg/linux_%{go_arch}/net/smtp.a
%{_libdir}/go/pkg/linux_%{go_arch}/net/textproto.a
%{_libdir}/go/pkg/linux_%{go_arch}/net/url.a
%{_libdir}/go/pkg/linux_%{go_arch}/os.a
%{_libdir}/go/pkg/linux_%{go_arch}/os/exec.a
%{_libdir}/go/pkg/linux_%{go_arch}/os/signal.a
%{_libdir}/go/pkg/linux_%{go_arch}/os/user.a
%{_libdir}/go/pkg/linux_%{go_arch}/path.a
%{_libdir}/go/pkg/linux_%{go_arch}/path/filepath.a
%{_libdir}/go/pkg/linux_%{go_arch}/reflect.a
%{_libdir}/go/pkg/linux_%{go_arch}/regexp.a
%{_libdir}/go/pkg/linux_%{go_arch}/regexp/syntax.a
%{_libdir}/go/pkg/linux_%{go_arch}/runtime.a
%{_libdir}/go/pkg/linux_%{go_arch}/runtime.h
%{_libdir}/go/pkg/linux_%{go_arch}/runtime/cgo.a
%{_libdir}/go/pkg/linux_%{go_arch}/runtime/debug.a
%{_libdir}/go/pkg/linux_%{go_arch}/runtime/pprof.a
%{_libdir}/go/pkg/linux_%{go_arch}/runtime/race.a
%{_libdir}/go/pkg/linux_%{go_arch}/sort.a
%{_libdir}/go/pkg/linux_%{go_arch}/strconv.a
%{_libdir}/go/pkg/linux_%{go_arch}/strings.a
%{_libdir}/go/pkg/linux_%{go_arch}/sync.a
%{_libdir}/go/pkg/linux_%{go_arch}/sync/atomic.a
%{_libdir}/go/pkg/linux_%{go_arch}/syscall.a
%{_libdir}/go/pkg/linux_%{go_arch}/testing.a
%{_libdir}/go/pkg/linux_%{go_arch}/testing/iotest.a
%{_libdir}/go/pkg/linux_%{go_arch}/testing/quick.a
%{_libdir}/go/pkg/linux_%{go_arch}/text/scanner.a
%{_libdir}/go/pkg/linux_%{go_arch}/text/tabwriter.a
%{_libdir}/go/pkg/linux_%{go_arch}/text/template.a
%{_libdir}/go/pkg/linux_%{go_arch}/text/template/parse.a
%{_libdir}/go/pkg/linux_%{go_arch}/textflag.h
%{_libdir}/go/pkg/linux_%{go_arch}/time.a
%{_libdir}/go/pkg/linux_%{go_arch}/unicode.a
%{_libdir}/go/pkg/linux_%{go_arch}/unicode/utf16.a
%{_libdir}/go/pkg/linux_%{go_arch}/unicode/utf8.a
%{_libdir}/go/pkg/obj/linux_%{go_arch}/lib9.a
%{_libdir}/go/pkg/obj/linux_%{go_arch}/libbio.a
%{_libdir}/go/pkg/obj/linux_%{go_arch}/libcc.a
%{_libdir}/go/pkg/obj/linux_%{go_arch}/libgc.a
%{_libdir}/go/pkg/obj/linux_%{go_arch}/liblink.a
%{_libdir}/go/pkg/tool/linux_%{go_arch}/addr2line
%{_libdir}/go/pkg/tool/linux_%{go_arch}/cgo
%{_libdir}/go/pkg/tool/linux_%{go_arch}/dist
%{_libdir}/go/pkg/tool/linux_%{go_arch}/fix
%{_libdir}/go/pkg/tool/linux_%{go_arch}/nm
%{_libdir}/go/pkg/tool/linux_%{go_arch}/objdump
%{_libdir}/go/pkg/tool/linux_%{go_arch}/pack
%{_libdir}/go/pkg/tool/linux_%{go_arch}/pprof
%{_libdir}/go/pkg/tool/linux_%{go_arch}/yacc
%{_bindir}/go*
%{_datadir}/go
%config %{_sysconfdir}/rpm/macros.go
%config %{_sysconfdir}/profile.d/go.sh
%{_unitdir}/godoc.service
%post
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
%preun
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
%postun
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
#----------------------------------------------------------------------------
%package doc
Summary: Go documentation
Requires: %{name} = %{EVRD}
%description doc
Go examples and documentation.
%files doc
%doc doc misc
%prep
%setup -q -n %{name}
%apply_patches
cp %{SOURCE4} .
cp %{SOURCE5} .
# setup go_arch (BSD-like scheme)
%ifarch %{ix86}
%define go_arch 386
%endif
%ifarch x86_64
%define go_arch amd64
%endif
%ifarch %{armx}
%define go_arch arm
%endif
%build
mkdir -p bfd
ln -s %{_bindir}/ld.bfd bfd/ld
export PATH=$PWD/bfd:$PATH
export GOROOT="`pwd`"
export GOROOT_FINAL=%{_libdir}/go
export GOBIN="$GOROOT/bin"
mkdir -p "$GOBIN"
cd src
export GDB_PRINTER="%{gdb_printer}"
HOST_EXTRA_CFLAGS="%{optflags} -Wno-error" ./make.bash
# CC_FOR_TARGET="%{__cc}" CC="%{__cc} %{optflags} %{ldflags}" ./make.bash
%check
export GOROOT=$(pwd -P)
export PATH="$PATH":"$GOROOT"/bin
chmod +x doc/progs/run
chmod +x doc/articles/wiki/test.bash
chmod +x doc/codewalk/run
cd src
# For now test 3729,5603 doesn't pass so skiping it
perl -pi -e 's/!windows/!windows,!linux/' ../misc/cgo/test/issue3729.go
perl -pi -e 's/func Test3729/\/\/func Test3729/' ../misc/cgo/test/cgo_test.go
perl -pi -e 's/^package/\/\/ +build !linux^Mpackage/' ../misc/cgo/test/issue5603.go
perl -pi -e 's/func Test5603/\/\/func Test5603/' ../misc/cgo/test/cgo_test.go
#./run.bash --no-rebuild --banner
CGO_ENABLED=0 ./run.bash --no-rebuild
cd ..
%install
export GOROOT="%{buildroot}%{_libdir}/%{name}"
install -Dm644 %{SOURCE2} %{buildroot}%{_sysconfdir}/profile.d/go.sh
# godoc service
mkdir -p %{buildroot}%{_unitdir}
install -Dm644 godoc.service %{buildroot}%{_unitdir}/godoc.service
# copy document templates, packages, obj libs and command utilities
mkdir -p %{buildroot}%{_bindir}
mkdir -p $GOROOT/lib
cp -r pkg $GOROOT
cp bin/* %{buildroot}%{_bindir}
rm -f %{buildroot}%{_bindir}/{hgpatch,quietgcc}
# source files for go install, godoc, etc
install -d %{buildroot}%{_datadir}/go
for ext in *.{go,c,h,s,S,py}; do
find src -name ${ext} -exec install -Dm644 \{\} %{buildroot}%{_datadir}/go/\{\} \;
done
mkdir -p $GOROOT/src
ln -s /usr/share/go/src/pkg $GOROOT/src/pkg
ln -s /usr/share/go/src/cmd $GOROOT/src/cmd
# documentation and examples
# fix documetation permissions (rpmlint warning)
find doc/ misc/ -type f -exec chmod 0644 '{}' \;
# remove unwanted arch-dependant binaries (rpmlint warning)
rm -rf misc/cgo/test/{_*,*.o,*.out,*.6,*.8}
rm -f misc/dashboard/builder/{gobuilder,*6,*.8}
rm -f misc/goplay/{goplay,*.6,*.8}
rm -rf misc/windows
rm -rf misc/cgo/test/{_*,*.o,*.out,*.6,*.8}
# install RPM macros
install -Dm644 %{SOURCE3} %{buildroot}%{_sysconfdir}/rpm/macros.go
sed -i s/GOARCH/%{go_arch}/ %{buildroot}%{_sysconfdir}/rpm/macros.go
# break hard links
rm %{buildroot}%{_libdir}/go/pkg/linux_%{go_arch}/{cgocall,runtime}.h
ln -s %{_datadir}/go/src/pkg/runtime/{cgocall,runtime}.h %{buildroot}%{_libdir}/go/pkg/linux_%{go_arch}/
strip %{buildroot}%{_bindir}/%{name}

View file

@ -1,21 +0,0 @@
diff --git a/src/cmd/godoc/godoc.go b/src/cmd/godoc/godoc.go
index f6dc678..3579dc7 100644
--- a/src/cmd/godoc/godoc.go
+++ b/src/cmd/godoc/godoc.go
@@ -81,8 +81,16 @@ var (
cmdHandler docServer
pkgHandler docServer
)
+const (
+ SUSE_DOC_DIR = "/usr/share/doc/packages/go-doc/"
+ SUSE_SRC_DIR = "/usr/share/go/"
+)
func initHandlers() {
+ // OPENSUSE: Bind godoc & source location
+ fs.Bind("/doc", OS(SUSE_DOC_DIR), "/doc", bindReplace)
+ fs.Bind("/src", OS(SUSE_SRC_DIR), "/src", bindBefore)
+
// Add named directories in -path argument as
// subdirectories of src/pkg.
for _, p := range filepath.SplitList(*pkgPath) {

View file

@ -1,21 +0,0 @@
# systemd service file for Go language API & documentation server
# this file is part of the Go programming language package
[Unit]
Description=godoc - Go API and documentation server
After=syslog.target network.target
[Service]
User=nobody
PIDFile=/var/run/godoc.pid
ExecStart=/usr/bin/godoc -http=:6060 -index=true
ExecStop=/bin/kill -TERM $MAINPID
ExecStop=/bin/kill -QUIT $MAINPID
KillMode=process
KillSignal=SIGKILL
SendSIGKILL=yes
RestartSec=30
Restart=always
[Install]
WantedBy=multi-user.target

2
golang-gdbinit Normal file
View file

@ -0,0 +1,2 @@
add-auto-load-safe-path /usr/lib/golang/src/pkg/runtime/runtime-gdb.py
add-auto-load-safe-path /usr/lib64/golang/src/pkg/runtime/runtime-gdb.py

3
golang-prelink.conf Normal file
View file

@ -0,0 +1,3 @@
# there are ELF files in src which are testdata and shouldn't be modified
-b /usr/lib/golang/src
-b /usr/lib64/golang/src

162
golang.spec Normal file
View file

@ -0,0 +1,162 @@
# build ids are not currently generated:
# https://code.google.com/p/go/issues/detail?id=5238
#
# also, debuginfo extraction currently fails with
# "Failed to write file: invalid section alignment"
%global debug_package %{nil}
# we are shipping the full contents of src in the data subpackage, which
# contains binary-like things (ELF data for tests, etc)
%global _binaries_in_noarch_packages_terminate_build 0
# Don't alter timestamps of especially the .a files (or else go will rebuild later)
# Actually, don't strip at all since we are not even building debug packages and this corrupts the dwarf testdata
%global __strip /bin/true
# rpmbuild magic to keep from having meta dependency on libc.so.6
# % define _use_internal_dependency_generator 0
# % define __find_requires %{nil}
%global debug_package %{nil}
%global __spec_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot \
/usr/lib/rpm/brp-compress
# %define _emacs_sitelispdir %{_datadir}/emacs/site-lisp
# %define _xemacs_sitelispdir %{_datadir}/xemacs/site-lisp
# %define _emacs_sitestartdir %{_datadir}/emacs/site-lisp
# %define _xemacs_sitestartdir %{_datadir}/xemacs/site-lisp
%define __noautoreq '/bin/rc|/usr/bin/awk'
Name: golang
Version: 1.4
Release: 2
Summary: The Go Programming Language
Group: Development/Other
License: BSD
URL: http://golang.org/
Source0: https://storage.googleapis.com/golang/go%{version}.src.tar.gz
# for hostname
BuildRequires: net-tools
%rename go
# We strip the meta dependency, but go does require glibc.
# This is an odd issue, still looking for a better fix.
Requires: glibc
# Having godoc and the documentation separate was broken
Obsoletes: %{name}-godoc < 1.1-4
Obsoletes: %{name}-docs < 1.1-4
# RPM can't handle symlink -> dir with subpackages, so merge back
Obsoletes: %{name}-data < 1.1.1-4
ExclusiveArch: %{ix86} x86_64 %{arm}
Source100: golang-gdbinit
Source101: golang-prelink.conf
%description
%{summary}.
# Workaround old RPM bug of symlink-replaced-with-dir failure
%pretrans -p <lua>
for _,d in pairs({"api", "doc", "include", "lib", "src"}) do
path = "%{_libdir}/%{name}/" .. d
if posix.stat(path, "type") == "link" then
os.remove(path)
posix.mkdir(path)
end
end
%prep
%setup -q -n go
%build
export CFLAGS="${RPM_OPT_FLAGS/-Wstrict-aliasing=2/} -Wno-error"
export LDFLAGS="$RPM_LD_FLAGS"
# set up final install location
export GOROOT_FINAL=%{_libdir}/%{name}
export GOROOT=$(pwd -P)
export GOBIN="$GOROOT"/bin
# TODO use the system linker to get the system link flags and build-id
# when https://code.google.com/p/go/issues/detail?id=5221 is solved
#export GO_LDFLAGS="-linkmode external -extldflags $RPM_LD_FLAGS"
# build
cd src
./make.bash
cd ..
# build static version of documentation
export PATH="$PATH":"$GOROOT"/bin
#cd doc
#make
#cd ..
%check
export GOROOT=$(pwd -P)
export PATH="$PATH":"$GOROOT"/bin
cd src
# For now test 3729,5603 doesn't pass so skiping it
perl -pi -e 's/!windows/!windows,!linux/' ../misc/cgo/test/issue3729.go
perl -pi -e 's/func Test3729/\/\/func Test3729/' ../misc/cgo/test/cgo_test.go
perl -pi -e 's/^package/\/\/ +build !linux package/' ../misc/cgo/test/issue5603.go
perl -pi -e 's/func Test5603/\/\/func Test5603/' ../misc/cgo/test/cgo_test.go
#./run.bash --no-rebuild
cd ..
%install
# create the top level directories
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_libdir}/%{name}
# install everything into libdir (until symlink problems are fixed)
# https://code.google.com/p/go/issues/detail?id=5830
cp -av api bin doc favicon.ico include lib pkg robots.txt src \
%{buildroot}%{_libdir}/%{name}
# remove the unnecessary zoneinfo file (Go will always use the system one first)
rm -rfv %{buildroot}%{_libdir}/%{name}/lib/time
# remove the doc Makefile
rm -rfv %{buildroot}%{_libdir}/%{name}/doc/Makefile
# add symlinks for binaries
pushd %{buildroot}%{_bindir}
for z in %{buildroot}%{_libdir}/%{name}/bin/*
do ln -s %{_libdir}/%{name}/bin/$(basename $z)
done
popd
# gdbinit
mkdir -p %{buildroot}%{_sysconfdir}/gdbinit.d
cp -av %{SOURCE100} %{buildroot}%{_sysconfdir}/gdbinit.d/golang
# prelink blacklist
mkdir -p %{buildroot}%{_sysconfdir}/prelink.conf.d
cp -av %{SOURCE101} %{buildroot}%{_sysconfdir}/prelink.conf.d/golang.conf
%files
%doc AUTHORS CONTRIBUTORS LICENSE PATENTS VERSION
# go files
%{_libdir}/%{name}
# bin symlinks
%{_bindir}/go
#%{_bindir}/godoc
%{_bindir}/gofmt
# gdbinit (for gdb debugging)
%{_sysconfdir}/gdbinit.d
# prelink blacklist
%{_sysconfdir}/prelink.conf.d

151
macros.go
View file

@ -1,151 +0,0 @@
# Macros for Go module building.
#
# Copyrigh: (c) 2011 Sascha Peilicke <saschpe@gmx.de>
#
%go_ver %(LC_ALL=C rpm -q --qf '%%{epoch}:%%{version}\\n' go | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")
%go_arch GOARCH
%go_build_ver %(go version | sed 's/^go version //' | tr -d ' ')
%go_dir %{_libdir}/go
%go_sitedir %{_libdir}/go/pkg
%go_sitearch %{_libdir}/go/pkg/linux_%{go_arch}
%go_requires Requires: go-devel = %go_build_ver
%go_provides \
Provides: %{name}-devel = %{version} \
Provides: %{name}-devel-static = %{version}
%go_disable_brp_strip_static_archive \
%define __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib/rpm/[^/]*/?brp-strip-static-archive %{__strip}!!g')
# Prepare the expected Go package build environement.
# We need a $GOPATH: go help gopath
# We need a valid importpath: go help packages
%goprep() \
export GOPATH=%{_builddir}/go \
if [ %# -eq 0 ]; then \
echo "goprep: please specify a valid importpath, see: go help packages" \
exit 1 \
else \
export IMPORTPATH=%1 \
fi \
# create the importpath and move the package there \
mkdir -p $GOPATH/src/$IMPORTPATH && mv ./* $GOPATH/src/$IMPORTPATH \
# now link the old location to the new (for compatibility) \
cd %{_builddir} && rmdir %{_builddir}/%(basename %1) \
ln -s $GOPATH/src/$IMPORTPATH %{_builddir}/%(basename %1) \
# we'll be installing packages/binaries, make the targ dirs \
install -d %{buildroot}%{go_sitearch} \
install -d %{buildroot}%{_bindir} \
%{nil}
# %%gobuild macro actually performs the command "go install", but the go
# toolchain will install to the $GOPATH which allows us then customise the final
# install for the distro default locations.
#
# gobuild accepts zero or more arguments. Each argument corresponds to
# a modifier of the importpath. If no arguments are passed, this is equivalent
# to the following go install statement:
#
# go install [importpath]
#
# Only the first or last arguement may be ONLY the wildcard argument "..."
# if the wildcard argument is passed then the importpath expands to all packages
# and binaries underneath it. If the argument contains only the wildcard no further
# arguments are considered.
#
# If no wildcard argument is passed, go install will be invoked on each $arg
# subdirectory under the importpath.
#
# Valid importpath modifier examples:
#
# example: %gobuild ...
# command: go install importpath...
#
# example: %gobuild /...
# command: go install importpath/... (All subdirs NOT including importpath)
#
# example: %gobuild foo...
# command: go install importpath/foo... (All subdirs INCLUDING foo)
#
# example: %gobuild foo ... (same as foo...)
# command: go install importpath/foo... (All subdirs INCLUDING foo)
#
# example: %gobuild foo/...
# commands: go install importpath/foo/... (All subdirs NOT including foo)
#
# example: %gobuild foo bar
# commands: go install importpath/foo
# go install importpath/bar
#
# example: %gobuild foo ... bar
# commands: go install importpath/foo... (bar is ignored)
#
# example: %gobuild foo bar... baz
# commands: go install importpath/foo
# go install importpath/bar...
# go install importpath/baz
#
# See: go help install, go help packages
%gobuild() \
export BUILDFLAGS="-s -v -p 4" \
export GOBIN=%{_builddir}/go/bin \
MOD="" \
if [ %# -gt 0 ]; then \
for mod in %*; do \
if [ $mod == "..." ]; then \
MOD=$MOD... \
go install $BUILDFLAGS $IMPORTPATH$MOD \
break \
else \
MOD=/$mod \
go install $BUILDFLAGS $IMPORTPATH$MOD \
fi \
done \
else \
go install $BUILDFLAGS $IMPORTPATH \
fi \
%{nil}
# Install all compiled packages and binaries to the buildroot
%goinstall() \
export GOPATH=%{_builddir}/go \
TMPPKG=%{_builddir}/go/pkg \
if [ "$(ls -A $TMPPKG)" ]; then \
cp -ar %{_builddir}/go/pkg/linux_%{go_arch}/* %{buildroot}%{go_sitearch} \
fi \
TMPBIN=%{_builddir}/go/bin \
if [ "$(ls -A $TMPBIN)" ]; then \
install -m755 $TMPBIN/* %{buildroot}%{_bindir} \
fi \
%{nil}
%gofix() \
export GOPATH=%{_builddir}/go \
if [ %# -eq 0 ]; then \
echo "gofix: please specify a valid importpath, see: go help fix" \
exit 1 \
else \
go fix %1... \
fi \
%{nil}
%gotest() \
export GOPATH=%{_builddir}/go \
if [ %# -eq 0 ]; then \
echo "gotest: please specify a valid importpath, see: go help test" \
exit 1 \
else \
go test %1... \
fi \
%{nil}
%godoc() \
install -d %{buildroot}%{_datadir}/go/src/pkg \
cd %{_builddir}/go/src \
find . -name *.go -exec install -Dm644 \{\} %{buildroot}%{_datadir}/go/src/pkg/\{\} \\; \
%{nil}