Blob Blame History Raw
%global debug_package   %{nil}
%global pkgname         googlecode-net
%global import_path     code.google.com/p/go.net
%global goroot          %(go env GOROOT)
%global pkgarch         %(go env GOOS)_%(go env GOARCH)
%global rev             84a4013f96e01fdd14b65d260a78b543e3702ee1
%global shortrev        %(r=%{rev}; echo ${r:0:12})

Name:           golang-%{pkgname}
Version:        0
Release:        0.5.hg%{shortrev}%{?dist}
Summary:        Supplementary Go networking libraries
License:        BSD
URL:            http://%{import_path}
Source0:        https://net.go.googlecode.com/archive/%{rev}.zip

%description
%{summary}

%package devel
BuildRequires:  golang
Requires:       golang
Summary:        Supplementary Go networking libraries
Provides:       golang("%{import_path}") = %{version}-%{release}

%description devel
%{summary}

%prep
%setup -c
mkdir -p src/%{import_path}
cp -R net.go-%{shortrev}/* src/%{import_path}
cd src/%{import_path}/html/testdata/webkit
mv README README-webkit

%build
unset GOROOT GOPATH GOOS GOARCH
if [ ! -d %{goroot}/src/pkg/%{import_path} ] ; then
# Do this if pkg isn't installed
    mkdir -p pkg/%{pkgarch}/%{import_path}
    pushd src/
    for dir in $(find %{import_path} -type d -print) ; do
        [[ "$dir" == "%{import_path}" \
        || "$dir" == "%{import_path}/html/testdata" \
        || "$dir" == "%{import_path}/html/testdata/webkit" \
        || "$dir" == "%{import_path}/html/testdata/webkit/scripted" \
        || "$dir" == "%{import_path}/ipv6" ]] \
        && continue
        GOPATH=$(readlink -f ..) go install $dir
   done
   popd
else
# Do this if pkg (or its previous version) already installed
    GOPATH=$(readlink -f .)
    pushd $GOPATH/src
    for dir in $(find %{import_path} -type d) ; do
        [[ "$dir" == "%{import_path}" \
        || "$dir" == "%{import_path}/html/testdata" \
        || "$dir" == "%{import_path}/html/testdata/webkit" \
        || "$dir" == "%{import_path}/html/testdata/webkit/scripted" \
        || "$dir" == "%{import_path}/ipv6" ]] \
        && continue
        mkdir -p $GOPATH/pkg/%{pkgarch}/$dir
        go build -o $GOPATH/pkg/%{pkgarch}/$dir.a $dir
    done
    popd
fi

%install
mkdir -p %{buildroot}/%{goroot}/src/pkg/%{import_path}
cp -a src/%{import_path}/* %{buildroot}/%{goroot}/src/pkg/%{import_path}
rm %{buildroot}/%{goroot}/src/pkg/%{import_path}/{AUTHORS,CONTRIBUTORS,LICENSE,PATENTS,README}
rm %{buildroot}/%{goroot}/src/pkg/%{import_path}/html/testdata/webkit/README-webkit
rm %{buildroot}/%{goroot}/src/pkg/%{import_path}/codereview.cfg
mkdir -p %{buildroot}/%{goroot}/pkg/%{pkgarch}/%{import_path}
cp -a pkg/* %{buildroot}/%{goroot}/pkg/

%files devel
%defattr(-,root,root,-)
%doc src/%{import_path}/AUTHORS src/%{import_path}/CONTRIBUTORS
%doc src/%{import_path}/LICENSE src/%{import_path}/PATENTS
%doc src/%{import_path}/README
%doc src/%{import_path}/html/testdata/webkit/README-webkit
%dir %attr(755,root,root) %{goroot}/src/pkg/code.google.com/
%dir %attr(755,root,root) %{goroot}/src/pkg/code.google.com/p/
%dir %attr(755,root,root) %{goroot}/src/pkg/%{import_path}
%dir %attr(755,root,root) %{goroot}/src/pkg/%{import_path}/dict
%dir %attr(755,root,root) %{goroot}/src/pkg/%{import_path}/html
%dir %attr(755,root,root) %{goroot}/src/pkg/%{import_path}/html/atom
%dir %attr(755,root,root) %{goroot}/src/pkg/%{import_path}/html/testdata
%dir %attr(755,root,root) %{goroot}/src/pkg/%{import_path}/html/testdata/webkit
%dir %attr(755,root,root) %{goroot}/src/pkg/%{import_path}/html/testdata/webkit/scripted
%dir %attr(755,root,root) %{goroot}/src/pkg/%{import_path}/idna
%dir %attr(755,root,root) %{goroot}/src/pkg/%{import_path}/ipv4
%dir %attr(755,root,root) %{goroot}/src/pkg/%{import_path}/ipv6
%dir %attr(755,root,root) %{goroot}/src/pkg/%{import_path}/proxy
%dir %attr(755,root,root) %{goroot}/src/pkg/%{import_path}/publicsuffix
%dir %attr(755,root,root) %{goroot}/src/pkg/%{import_path}/spdy
%dir %attr(755,root,root) %{goroot}/src/pkg/%{import_path}/websocket
%{goroot}/src/pkg/%{import_path}/dict/*.go
%{goroot}/src/pkg/%{import_path}/html/*.go
%{goroot}/src/pkg/%{import_path}/html/atom/*.go
%{goroot}/src/pkg/%{import_path}/html/testdata/*.html
%{goroot}/src/pkg/%{import_path}/html/testdata/webkit/*.dat
%{goroot}/src/pkg/%{import_path}/html/testdata/webkit/scripted/*.dat
%{goroot}/src/pkg/%{import_path}/idna/*.go
%{goroot}/src/pkg/%{import_path}/ipv4/*.go
%{goroot}/src/pkg/%{import_path}/ipv6/*.go
%{goroot}/src/pkg/%{import_path}/proxy/*.go
%{goroot}/src/pkg/%{import_path}/publicsuffix/*.go
%{goroot}/src/pkg/%{import_path}/spdy/*.go
%{goroot}/src/pkg/%{import_path}/websocket/*.go
%dir %attr(755,root,root) %{goroot}/pkg/%{pkgarch}/code.google.com/
%dir %attr(755,root,root) %{goroot}/pkg/%{pkgarch}/code.google.com/p/
%dir %attr(755,root,root) %{goroot}/pkg/%{pkgarch}/%{import_path}
%dir %attr(755,root,root) %{goroot}/pkg/%{pkgarch}/%{import_path}/html
%{goroot}/pkg/%{pkgarch}/%{import_path}/*.a
%{goroot}/pkg/%{pkgarch}/%{import_path}/html/atom.a

%changelog
* Fri Sep 20 2013 Lokesh Mandvekar <lsm5@redhat.com> 0-0.5.hg
- Provides corrected

* Fri Sep 20 2013 Lokesh Mandvekar <lsm5@redhat.com> 0-0.4.hg
- comment cleanup
- build explanation

* Fri Sep 20 2013 Lokesh Mandvekar <lsm5@redhat.com> 0-0.3.hg
- html/webkit/scripted ownership set
- codereview.cfg not packaged

* Fri Sep 20 2013 Lokesh Mandvekar <lsm5@redhat.com> 0-0.2.hg
- IPv6 doesn't build
- Typo correction
- directory ownership taken care of

* Thu Sep 19 2013 Lokesh Mandvekar <lsm5@redhat.com> 0-0.1.hg
- Initial fedora package