Blob Blame History Raw
Name:      openlayers
Version:   2.12
Release:   5%{?dist}
Summary:   A JavaScript library for displaying map data in web browsers
Group:     Applications/Publishing
License:   BSD
URL:       http://www.openlayers.org/
# Source is modified as it bundles jsmin which license is unacceptable in Fedora:
#   $ wget http://openlayers.org/download/OpenLayers-%{version}.tar.gz
#   $ tar xzvf OpenLayers-%{version}.tar.gz
#   $ cd OpenLayers-%{version}
#   $ rm tools/jsmin.{c,py}
#   $ tar czvf OpenLayers-%{version}-mod.tar.gz OpenLayers-%{version}
Source0:   OpenLayers-%{version}-mod.tar.gz
Source1:   openlayers.conf
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: python
Requires:  httpd


%package doc
Summary:   API documentation for %{name}
Group:     Documentation
Requires:  %{name} = %{version}-%{release}


%description
OpenLayers is a pure JavaScript library for displaying map data in most
modern web browsers, with no server-side dependencies. OpenLayers implements
a JavaScript API for building rich web-based geographic applications,
similar to the Google Maps and MSN Virtual Earth APIs, with one important
difference -- OpenLayers is Free Software, developed for and by the Open
Source software community.

Furthermore, OpenLayers implements industry-standard methods for geographic
data access, such as the OpenGIS Consortium's Web Mapping Service (WMS) and
Web Feature Service (WFS) protocols. Under the hood, OpenLayers is written
in object-oriented JavaScript, using components from Prototype.js and the
Rico library. The OpenLayers code base already has hundreds of unit tests,
via the Test.AnotherWay framework.

%description doc
Reference API documentation for the OpenLayers JavaScript library.


%prep
%setup -q -n OpenLayers-%{version}

# I've created a pull request on github to get the following
# changes upstream: https://github.com/openlayers/openlayers/pull/616
set +x
for f in `find . -type f` ; do
   if file $f | grep -q ISO-8859 ; then
      set -x
      iconv -f ISO-8859-1 -t UTF-8 $f > ${f}.tmp && \
         mv -f ${f}.tmp $f
      set +x
   fi
   if file $f | grep -q CRLF ; then
      set -x
      sed -i -e 's|\r||g' $f
      set +x
   fi
done
set -x

# fix spurious perms
find . -type f -name *.png -exec chmod -x '{}' \;
find . -type f -name *.html -exec chmod -x '{}' \;
chmod -x tools/exampleparser.py
chmod -x examples/proxy.cgi

# fix shebang
find . -type f -exec sed -i -e 's/\#\!\/usr\/bin\/env python/\#\!\/usr\/bin\/python/' '{}' +

# remove the minimize tool so that it is not used until upstream bug is fixed:
#    http://trac.openlayers.org/ticket/2275
rm tools/minimize.py


%build
pushd build
./build.py
popd


%install
rm -rf %{buildroot}
install -d %{buildroot}%{_datadir}/%{name}/www
cp -rp theme %{buildroot}%{_datadir}/%{name}/www/
cp -rp img %{buildroot}%{_datadir}/%{name}/www/
install -p -m 644 build/OpenLayers.js %{buildroot}%{_datadir}/%{name}/www/

cp -rp art %{buildroot}%{_datadir}/%{name}/
cp -rp build %{buildroot}%{_datadir}/%{name}/
cp -rp lib %{buildroot}%{_datadir}/%{name}/
cp -rp tests %{buildroot}%{_datadir}/%{name}/

# install tools
install -d %{buildroot}%{_datadir}/%{name}/tools/
install -p tools/BeautifulSoup.py %{buildroot}%{_datadir}/%{name}/tools/
install -p tools/mergejs.py %{buildroot}%{_datadir}/%{name}/tools/
# don't install the minimize tool as it was removed in prep
#install -p tools/minimize.py %{buildroot}%{_datadir}/%{name}/tools/
install -p tools/shrinksafe.py %{buildroot}%{_datadir}/%{name}/tools/
install -p tools/toposort.py %{buildroot}%{_datadir}/%{name}/tools/
# fix one python header
sed -i -e '1i\#\!\/usr\/bin\/python' %{buildroot}%{_datadir}/%{name}/tools/BeautifulSoup.py
# minimize tool was removed in prep
#sed -i -e '1i\#\!\/usr\/bin\/python' %{buildroot}%{_datadir}/%{name}/tools/minimize.py
sed -i -e '1i\#\!\/usr\/bin\/python' %{buildroot}%{_datadir}/%{name}/tools/toposort.py

# fix generation of OpenLayer.js
sed -i -e 's|OpenLayers.js|..\/www\/OpenLayers.js|' \
    %{buildroot}%{_datadir}/%{name}/build/build.py
sed -i -e 's|OpenLayers.js|..\/www\/OpenLayers.js|' \
    %{buildroot}%{_datadir}/%{name}/build/buildUncompressed.py

# install config files
install -d %{buildroot}%{_sysconfdir}/%{name}
mv %{buildroot}%{_datadir}/%{name}/build/*.cfg %{buildroot}%{_sysconfdir}/%{name}
pushd %{buildroot}%{_datadir}/%{name}/build/
 for file in {full,library,lite}; do
   ln -s ../../../../%{_sysconfdir}/%{name}/$file.cfg $file.cfg
 done
popd

# install httpd config alias
install -D -p %{SOURCE1} %{buildroot}%{_sysconfdir}/httpd/conf.d/%{name}.conf

# fix two more annoying mods
chmod -x %{buildroot}%{_datadir}/%{name}/lib/OpenLayers/Strategy.js
chmod -x %{buildroot}%{_datadir}/%{name}/lib/OpenLayers/Protocol.js


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root)
%doc readme.md 
%doc tools/README.txt build/license.txt tools/exampleparser.py
%dir %{_sysconfdir}/%{name}
%attr(644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/*.cfg
%attr(644,root,root) %config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf
%dir %{_datadir}/%{name}
%exclude %{_datadir}/%{name}/tools/*.py?
%exclude %{_datadir}/%{name}/build/*.txt
%exclude %{_datadir}/%{name}/build/*.py?
%exclude %{_datadir}/%{name}/build/OpenLayers.js
%{_datadir}/%{name}/*

%files doc
%defattr(-,root,root)
%doc examples doc


%changelog
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.12-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.12-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.12-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Mon Jan  7 2013 Remi Collet <rcollet@redhat.com> - 2.12-2
- fix configuration file for httpd 2.4, #871443

* Sun Aug 05 2012 Sven Lankes <sven@lank.es> - 2.12-1
- update to latest upstream release

* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.11-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Sun Jan 22 2012 Sven Lankes <sven@lank.es> - 2.11-1
- update to latest upstream release

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.9.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.9.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Wed Aug 11 2010 David Malcolm <dmalcolm@redhat.com> - 2.9.1-3
- recompiling .py files against Python 2.7 (rhbz#623341)

* Wed Aug 11 2010 Sven Lankes <sven@lank.es> - 2.9.1-2
- Rebuild for python 2.7

* Mon Jun 07 2010 Balint Cristian <cristian.balint@gmail.com> - 2.9.1-1
- new release.

* Sat Sep 19 2009 Mathieu Bridon <bochecha@fedoraproject.org> - 2.8-5
- Don't use the minimize tool as it produces an incorrect JS file

* Sun Sep 13 2009 Mathieu Bridon <bochecha@fedoraproject.org> - 2.8-4
- Make a -doc subpackage for the API documentation which makes the main package 75% smaller

* Sun Sep 13 2009 Mathieu Bridon <bochecha@fedoraproject.org> - 2.8-3
- Removed the bundled jsmin tool which license is unacptable in Fedora
- This makes it a noarch package

* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Sun Jun 28 2009 Mathieu Bridon <bochecha@fedoraproject.org> - 2.8-1
- New upstream version: 2.8
- see http://trac.openlayers.org/wiki/Release/2.8/Notes

* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.7-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Mon Oct 20 2008 Balint Cristian <rezso@rdsor.ro> - 2.7-2
- fix invalid shebags

* Wed Oct 08 2008 Balint Cristian <rezso@rdsor.ro> - 2.7-1
- new upstream

* Mon Aug 25 2008 Balint Cristian <rezso@rdsor.ro> - 2.6-1
- initial import