c56eb06
# build ids are not currently generated:
c56eb06
# https://code.google.com/p/go/issues/detail?id=5238
c56eb06
#
c56eb06
# also, debuginfo extraction currently fails with
c56eb06
# "Failed to write file: invalid section alignment"
c56eb06
%global debug_package %{nil}
c56eb06
cc50719
# we are shipping the full contents of src in the data subpackage, which
cc50719
# contains binary-like things (ELF data for tests, etc)
cc50719
%global _binaries_in_noarch_packages_terminate_build 0
cc50719
cc50719
# Do not check any files in doc or src for requires
cc50719
%global __requires_exclude_from ^%{_datadir}/%{name}/(doc|src)/.*$
cc50719
c56eb06
Name:		golang
cc50719
Version:	1.1.1
7e281b5
Release:	2%{?dist}
c56eb06
Summary:	The Go Programming Language
c56eb06
c56eb06
License:	BSD
c56eb06
URL:		http://golang.org/
c56eb06
Source0:	https://go.googlecode.com/files/go%{version}.src.tar.gz
c56eb06
cc50719
BuildRequires:	/bin/hostname symlinks
c56eb06
BuildRequires:	emacs xemacs xemacs-packages-extra
c56eb06
c56eb06
Patch0:		golang-1.1-verbose-build.patch
c56eb06
cc50719
# Having godoc and the documentation separate was broken
cc50719
Obsoletes:	%{name}-godoc < 1.1-4
c56eb06
cc50719
# All the noarch stuff is in one package now
cc50719
Requires:	%{name}-data = %{version}-%{release}
c56eb06
cc50719
ExclusiveArch:	%{ix86} x86_64 %{arm}
c56eb06
cc50719
%description
c56eb06
%{summary}.
c56eb06
c56eb06
cc50719
%package data
cc50719
Summary: Required architecture-independent files for Go
cc50719
Requires:	%{name} = %{version}-%{release}
cc50719
BuildArch:	noarch
cc50719
Obsoletes:	%{name}-docs < 1.1-4
c56eb06
cc50719
%description data
c56eb06
%{summary}.
c56eb06
c56eb06
c56eb06
%package vim
c56eb06
Summary: Vim plugins for Go
c56eb06
Requires:    vim-filesystem
c56eb06
BuildArch:   noarch
c56eb06
c56eb06
%description vim
c56eb06
%{summary}.
c56eb06
c56eb06
c56eb06
%package -n emacs-%{name}
c56eb06
Summary: Emacs add-on package for Go
c56eb06
Requires:      emacs(bin) >= %{_emacs_version}
c56eb06
BuildArch:     noarch
c56eb06
c56eb06
%description -n emacs-%{name}
c56eb06
%{summary}.
c56eb06
c56eb06
c56eb06
%package -n xemacs-%{name}
c56eb06
Summary: XEmacs add-on package for Go
c56eb06
Requires:	xemacs(bin) >= %{_xemacs_version}
c56eb06
Requires:	xemacs-packages-extra
c56eb06
BuildArch:	noarch
c56eb06
c56eb06
%description -n xemacs-%{name}
c56eb06
%{summary}.
c56eb06
c56eb06
7e281b5
# Workaround old RPM bug of symlink-replaced-with-dir failure
7e281b5
%pretrans
7e281b5
if [ -h %{_libdir}/%{name}/src ]; then
7e281b5
   rm -v %{_libdir}/%{name}/src
7e281b5
   mkdir %{_libdir}/%{name}/src
7e281b5
fi
7e281b5
7e281b5
c56eb06
%prep
c56eb06
%setup -q -n go
c56eb06
c56eb06
# increase verbosity of build
c56eb06
%patch0 -p1
c56eb06
420db8c
# make a copy before building to let us avoid generated src files in docs
420db8c
pushd ..
420db8c
cp -av go go-nogenerated
420db8c
popd
420db8c
c56eb06
c56eb06
%build
c56eb06
# create a gcc wrapper to allow us to build with our own flags
c56eb06
mkdir zz
c56eb06
cd zz
c56eb06
echo -e "#!/bin/sh\n/usr/bin/gcc $RPM_OPT_FLAGS $RPM_LD_FLAGS \"\$@\"" > mygcc
c56eb06
chmod +x mygcc
c56eb06
export CC="$(pwd -P)/mygcc"
c56eb06
cd ..
c56eb06
c56eb06
# set up final install location
c56eb06
export GOROOT_FINAL=%{_libdir}/%{name}
c56eb06
c56eb06
# TODO use the system linker to get the system link flags and build-id
c56eb06
# when https://code.google.com/p/go/issues/detail?id=5221 is solved
c56eb06
#export GO_LDFLAGS="-linkmode external -extldflags $RPM_LD_FLAGS"
c56eb06
c56eb06
# build
c56eb06
cd src
c56eb06
./make.bash
c56eb06
cd ..
c56eb06
c56eb06
# build static version of documentation
c56eb06
export GOROOT=$(pwd -P)
c56eb06
export PATH="$PATH":"$GOROOT"/bin
c56eb06
cd doc
c56eb06
make
c56eb06
cd ..
c56eb06
c56eb06
# compile for emacs and xemacs
c56eb06
cd misc
c56eb06
mv emacs/go-mode-load.el emacs/%{name}-init.el
c56eb06
cp -av emacs xemacs
c56eb06
%{_emacs_bytecompile} emacs/go-mode.el
c56eb06
%{_xemacs_bytecompile} xemacs/go-mode.el
c56eb06
cd ..
c56eb06
c56eb06
c56eb06
%check
c56eb06
export GOROOT=$(pwd -P)
c56eb06
export PATH="$PATH":"$GOROOT"/bin
c56eb06
cd src
c56eb06
./run.bash --no-rebuild
c56eb06
cd ..
c56eb06
c56eb06
c56eb06
%install
c56eb06
rm -rf $RPM_BUILD_ROOT
c56eb06
c56eb06
# create the top level directories
c56eb06
mkdir -p $RPM_BUILD_ROOT%{_bindir}
c56eb06
mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{name}
c56eb06
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}
c56eb06
c56eb06
# install binaries and runtime files into libdir
c56eb06
cp -av bin pkg $RPM_BUILD_ROOT%{_libdir}/%{name}
c56eb06
c56eb06
# install sources and other data in datadir
c56eb06
cp -av api doc include lib favicon.ico robots.txt $RPM_BUILD_ROOT%{_datadir}/%{name}
c56eb06
c56eb06
# remove the unnecessary zoneinfo file (Go will always use the system one first)
c56eb06
rm -rfv $RPM_BUILD_ROOT%{_datadir}/%{name}/lib/time
c56eb06
c56eb06
# remove the doc Makefile
c56eb06
rm -rfv $RPM_BUILD_ROOT%{_datadir}/%{name}/doc/Makefile
c56eb06
cc50719
# install all non-generated sources
420db8c
pushd ../go-nogenerated
cc50719
cp -av src $RPM_BUILD_ROOT%{_datadir}/%{name}
420db8c
popd
c56eb06
cc50719
# make a symlink tree for src
cc50719
cp -asv $RPM_BUILD_ROOT%{_datadir}/%{name}/src $RPM_BUILD_ROOT%{_libdir}/%{name}
c56eb06
cc50719
# install arch-specific generated sources (don't clobber symlinks)
cc50719
cp -anv src $RPM_BUILD_ROOT%{_libdir}/%{name}
c56eb06
c56eb06
# add symlinks for things in datadir
cc50719
for z in api doc favicon.ico include lib robots.txt
cc50719
  do ln -s ../../share/%{name}/$z $RPM_BUILD_ROOT%{_libdir}/%{name}
c56eb06
done
c56eb06
c56eb06
# add symlinks for binaries
c56eb06
pushd $RPM_BUILD_ROOT%{_bindir}
c56eb06
for z in $RPM_BUILD_ROOT%{_libdir}/%{name}/bin/*
c56eb06
  do ln -s %{_libdir}/%{name}/bin/$(basename $z)
c56eb06
done
c56eb06
popd
c56eb06
c56eb06
# misc/bash
c56eb06
mkdir -p $RPM_BUILD_ROOT%{_datadir}/bash-completion/completions
c56eb06
cp -av misc/bash/go $RPM_BUILD_ROOT%{_datadir}/bash-completion/completions
c56eb06
for z in 8l 6l 5l 8g 6g 5g gofmt gccgo
c56eb06
  do ln -s go $RPM_BUILD_ROOT%{_datadir}/bash-completion/completions/$z
c56eb06
done
c56eb06
c56eb06
# misc/emacs
c56eb06
mkdir -p $RPM_BUILD_ROOT%{_emacs_sitelispdir}/%{name}
c56eb06
mkdir -p $RPM_BUILD_ROOT%{_emacs_sitestartdir}
c56eb06
cp -av misc/emacs/go-mode.* $RPM_BUILD_ROOT%{_emacs_sitelispdir}/%{name}
c56eb06
cp -av misc/emacs/%{name}-init.el $RPM_BUILD_ROOT%{_emacs_sitestartdir}
c56eb06
c56eb06
# misc/xemacs
c56eb06
mkdir -p $RPM_BUILD_ROOT%{_xemacs_sitelispdir}/%{name}
c56eb06
mkdir -p $RPM_BUILD_ROOT%{_xemacs_sitestartdir}
c56eb06
cp -av misc/xemacs/go-mode.* $RPM_BUILD_ROOT%{_xemacs_sitelispdir}/%{name}
c56eb06
cp -av misc/xemacs/%{name}-init.el $RPM_BUILD_ROOT%{_xemacs_sitestartdir}
c56eb06
c56eb06
# misc/vim
c56eb06
mkdir -p $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles
c56eb06
cp -av misc/vim/* $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles
c56eb06
rm $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles/readme.txt
c56eb06
c56eb06
# misc/zsh
c56eb06
mkdir -p $RPM_BUILD_ROOT%{_datadir}/zsh/site-functions
c56eb06
cp -av misc/zsh/go $RPM_BUILD_ROOT%{_datadir}/zsh/site-functions
c56eb06
7e281b5
# relativize the symlinks
cc50719
symlinks -c -s -r $RPM_BUILD_ROOT%{_libdir}
cc50719
7e281b5
# ensure all binaries have a later time than all sources (really fix #973842)
7e281b5
touch $RPM_BUILD_ROOT%{_libdir}/%{name}/bin/go
7e281b5
find $RPM_BUILD_ROOT%{_libdir}/%{name} -type f -print0 | xargs -0 touch -r $RPM_BUILD_ROOT%{_libdir}/%{name}/bin/go
7e281b5
c56eb06
c56eb06
%files
c56eb06
%doc AUTHORS CONTRIBUTORS LICENSE PATENTS VERSION
c56eb06
c56eb06
# binaries
c56eb06
%dir %{_libdir}/%{name}
c56eb06
%dir %{_libdir}/%{name}/bin
c56eb06
%{_libdir}/%{name}/bin/go
cc50719
%{_libdir}/%{name}/bin/godoc
c56eb06
%{_libdir}/%{name}/bin/gofmt
c56eb06
%{_libdir}/%{name}/pkg
c56eb06
%{_bindir}/go
cc50719
%{_bindir}/godoc
c56eb06
%{_bindir}/gofmt
c56eb06
cc50719
# symlinks (lib -> share)
cc50719
%{_libdir}/%{name}/api
c56eb06
%{_libdir}/%{name}/doc
c56eb06
%{_libdir}/%{name}/favicon.ico
cc50719
%{_libdir}/%{name}/include
c56eb06
%{_libdir}/%{name}/lib
c56eb06
%{_libdir}/%{name}/robots.txt
7e281b5
7e281b5
# src (directory of symlinks to datadir + arch-specific generated files)
cc50719
%{_libdir}/%{name}/src
c56eb06
c56eb06
cc50719
%files data
cc50719
%{_datadir}/bash-completion
cc50719
%{_datadir}/zsh
c56eb06
c56eb06
%dir %{_datadir}/%{name}
cc50719
%{_datadir}/%{name}/api
c56eb06
%{_datadir}/%{name}/doc
c56eb06
%{_datadir}/%{name}/favicon.ico
cc50719
%{_datadir}/%{name}/include
c56eb06
%{_datadir}/%{name}/lib
cc50719
%{_datadir}/%{name}/robots.txt
c56eb06
%{_datadir}/%{name}/src
c56eb06
c56eb06
c56eb06
%files vim
c56eb06
%doc AUTHORS CONTRIBUTORS LICENSE PATENTS
c56eb06
%{_datadir}/vim/vimfiles/*
c56eb06
c56eb06
c56eb06
%files -n emacs-%{name}
c56eb06
%doc AUTHORS CONTRIBUTORS LICENSE PATENTS
c56eb06
%{_emacs_sitelispdir}/%{name}
c56eb06
%{_emacs_sitestartdir}/*.el
c56eb06
c56eb06
c56eb06
%files -n xemacs-%{name}
c56eb06
%doc AUTHORS CONTRIBUTORS LICENSE PATENTS
c56eb06
%{_xemacs_sitelispdir}/%{name}
c56eb06
%{_xemacs_sitestartdir}/*.el
c56eb06
c56eb06
c56eb06
%changelog
7e281b5
* Mon Jun 17 2013 Adam Goode <adam@spicenitz.org> - 1.1.1-2
7e281b5
- Hopefully really fix #973842
7e281b5
- Fix update from pre-1.1.1 (#974840)
7e281b5
cc50719
* Thu Jun 13 2013 Adam Goode <adam@spicenitz.org> - 1.1.1-1
cc50719
- Update to 1.1.1
cc50719
- Fix basically useless package (#973842)
cc50719
45f1244
* Sat May 25 2013 Dan HorĂ¡k <dan[at]danny.cz> - 1.1-3
45f1244
- set ExclusiveArch
45f1244
420db8c
* Fri May 24 2013 Adam Goode <adam@spicenitz.org> - 1.1-2
420db8c
- Fix noarch package discrepancies
420db8c
c56eb06
* Fri May 24 2013 Adam Goode <adam@spicenitz.org> - 1.1-1
c56eb06
- Initial Fedora release.
c56eb06
- Update to 1.1
c56eb06
c56eb06
* Thu May  9 2013 Adam Goode <adam@spicenitz.org> - 1.1-0.3.rc3
c56eb06
- Update to rc3
c56eb06
c56eb06
* Thu Apr 11 2013 Adam Goode <adam@spicenitz.org> - 1.1-0.2.beta2
c56eb06
- Update to beta2
c56eb06
c56eb06
* Tue Apr  9 2013 Adam Goode <adam@spicenitz.org> - 1.1-0.1.beta1
c56eb06
- Initial packaging.