2009-01-20 04:10:53 +00:00
|
|
|
%define ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")
|
|
|
|
%define ruby_sitearch %(ruby -rrbconfig -e "puts Config::CONFIG['sitearchdir']")
|
|
|
|
%define rubyabi 1.8
|
|
|
|
|
|
|
|
%define gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
|
|
|
|
%define gemname nokogiri
|
|
|
|
%define geminstdir %{gemdir}/gems/%{gemname}-%{version}
|
|
|
|
|
|
|
|
Summary: An HTML, XML, SAX, and Reader parser
|
|
|
|
Name: rubygem-%{gemname}
|
2009-06-24 18:22:46 +00:00
|
|
|
Version: 1.3.2
|
2009-03-11 15:35:33 +00:00
|
|
|
Release: 1%{?dist}
|
2009-01-20 04:10:53 +00:00
|
|
|
Group: Development/Languages
|
|
|
|
License: MIT
|
|
|
|
URL: http://nokogiri.rubyforge.org/nokogiri/
|
|
|
|
Source0: http://gems.rubyforge.org/gems/%{gemname}-%{version}.gem
|
|
|
|
|
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
|
|
|
BuildRequires: ruby(abi) = %{rubyabi}
|
|
|
|
BuildRequires: ruby(rubygems)
|
2009-03-18 15:53:47 +00:00
|
|
|
BuildRequires: rubygem(hoe)
|
2009-01-20 04:10:53 +00:00
|
|
|
BuildRequires: rubygem(rake)
|
2009-06-10 19:53:39 +00:00
|
|
|
# Not available yet
|
|
|
|
# BuildRequires(check): rubygem(rake-compiler)
|
2009-01-20 04:10:53 +00:00
|
|
|
BuildRequires: libxml2-devel
|
|
|
|
BuildRequires: libxslt-devel
|
|
|
|
BuildRequires: ruby-devel
|
|
|
|
Requires: ruby(abi) = %{rubyabi}
|
|
|
|
Requires: ruby(rubygems)
|
|
|
|
Provides: rubygem(%{gemname}) = %{version}-%{release}
|
|
|
|
|
|
|
|
%description
|
|
|
|
Nokogiri parses and searches XML/HTML very quickly, and also has
|
|
|
|
correctly implemented CSS3 selector support as well as XPath support.
|
|
|
|
|
|
|
|
Nokogiri also features an Hpricot compatibility layer to help ease the change
|
|
|
|
to using correct CSS and XPath.
|
|
|
|
|
|
|
|
%package doc
|
|
|
|
Summary: Documentation for %{name}
|
|
|
|
Group: Documentation
|
|
|
|
# Directory ownership issue
|
|
|
|
Requires: %{name} = %{version}-%{release}
|
|
|
|
Requires: ruby(rubygems)
|
|
|
|
|
|
|
|
%description doc
|
|
|
|
This package contains documentation for %{name}.
|
|
|
|
|
|
|
|
%package -n ruby-%{gemname}
|
|
|
|
Summary: Non-Gem support package for %{gemname}
|
|
|
|
Group: Development/Languages
|
|
|
|
Requires: %{name} = %{version}-%{release}
|
|
|
|
Provides: ruby(%{gemname}) = %{version}-%{release}
|
|
|
|
|
|
|
|
%description -n ruby-%{gemname}
|
|
|
|
This package provides non-Gem support for %{gemname}.
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -q -T -c
|
|
|
|
|
|
|
|
%build
|
|
|
|
mkdir -p ./%{gemdir}
|
|
|
|
export CONFIGURE_ARGS="--with-cflags='%{optflags}'"
|
|
|
|
gem install \
|
|
|
|
--local \
|
|
|
|
--install-dir ./%{gemdir} \
|
|
|
|
-V --force \
|
|
|
|
%{SOURCE0}
|
|
|
|
|
|
|
|
# cflags wrong (-O3 passed), recompiling
|
2009-06-10 19:53:39 +00:00
|
|
|
# Skip until rubygem(rake-compiler) is available
|
|
|
|
%if 0
|
2009-01-20 04:10:53 +00:00
|
|
|
pushd ./%{geminstdir}
|
|
|
|
sed -i.flags -e 's|-O3||' ext/nokogiri/extconf.rb
|
|
|
|
find . -name \*.so -or -name \*.o -exec rm -f {} \;
|
2009-03-18 17:04:08 +00:00
|
|
|
rake -v ext/nokogiri/native.so --trace
|
2009-06-10 19:53:39 +00:00
|
|
|
%endif
|
2009-01-20 04:10:53 +00:00
|
|
|
|
|
|
|
%install
|
|
|
|
rm -rf %{buildroot}
|
|
|
|
mkdir -p %{buildroot}%{gemdir}
|
|
|
|
cp -a ./%{gemdir}/* %{buildroot}%{gemdir}
|
|
|
|
|
|
|
|
# move arch dependent files to %%ruby_sitearch
|
|
|
|
mkdir -p %{buildroot}%{ruby_sitearch}/%{gemname}
|
|
|
|
mv %{buildroot}%{geminstdir}/lib/%{gemname}/*.so \
|
|
|
|
%{buildroot}%{ruby_sitearch}/%{gemname}/
|
|
|
|
|
2009-06-10 19:53:39 +00:00
|
|
|
# move bin/ files
|
|
|
|
mkdir -p %{buildroot}%{_prefix}
|
|
|
|
mv -f %{buildroot}%{gemdir}/bin %{buildroot}%{_prefix}
|
|
|
|
|
2009-01-20 04:10:53 +00:00
|
|
|
# remove all shebang
|
|
|
|
for f in $(find %{buildroot}%{geminstdir} -name \*.rb)
|
|
|
|
do
|
|
|
|
sed -i -e '/^#!/d' $f
|
|
|
|
chmod 0644 $f
|
|
|
|
done
|
|
|
|
|
|
|
|
# cleanups
|
|
|
|
rm -rf %{buildroot}%{geminstdir}/ext
|
2009-06-10 19:53:39 +00:00
|
|
|
rm -f %{buildroot}%{geminstdir}/{.autotest,.require_paths}
|
2009-01-20 04:10:53 +00:00
|
|
|
|
|
|
|
# The following method is completely copied from rubygem-gettext
|
|
|
|
# spec file
|
|
|
|
#
|
|
|
|
# Create symlinks
|
|
|
|
##
|
|
|
|
## Note that before switching to gem %%{ruby_sitelib}/%%{gemname}
|
|
|
|
## already existed as a directory, so this cannot be replaced
|
|
|
|
## by symlink (cpio fails)
|
|
|
|
## Similarly, all directories under %%{ruby_sitelib} cannot be
|
|
|
|
## replaced by symlink
|
|
|
|
#
|
|
|
|
|
|
|
|
create_symlink_rec(){
|
|
|
|
|
|
|
|
ORIGBASEDIR=$1
|
|
|
|
TARGETBASEDIR=$2
|
|
|
|
|
|
|
|
## First calculate relative path of ORIGBASEDIR
|
|
|
|
## from TARGETBASEDIR
|
|
|
|
TMPDIR=$TARGETBASEDIR
|
|
|
|
BACKDIR=
|
|
|
|
DOWNDIR=
|
|
|
|
num=0
|
|
|
|
nnum=0
|
|
|
|
while true
|
|
|
|
do
|
|
|
|
num=$((num+1))
|
|
|
|
TMPDIR=$(echo $TMPDIR | sed -e 's|/[^/][^/]*$||')
|
|
|
|
DOWNDIR=$(echo $ORIGBASEDIR | sed -e "s|^$TMPDIR||")
|
|
|
|
if [ x$DOWNDIR != x$ORIGBASEDIR ]
|
|
|
|
then
|
|
|
|
nnum=0
|
|
|
|
while [ $nnum -lt $num ]
|
|
|
|
do
|
|
|
|
BACKDIR="../$BACKDIR"
|
|
|
|
nnum=$((nnum+1))
|
|
|
|
done
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
RELBASEDIR=$( echo $BACKDIR/$DOWNDIR | sed -e 's|//*|/|g' )
|
|
|
|
|
|
|
|
## Next actually create symlink
|
|
|
|
pushd %{buildroot}/$ORIGBASEDIR
|
|
|
|
find . -type f | while read f
|
|
|
|
do
|
|
|
|
DIRNAME=$(dirname $f)
|
|
|
|
BACK2DIR=$(echo $DIRNAME | sed -e 's|/[^/][^/]*|/..|g')
|
|
|
|
mkdir -p %{buildroot}${TARGETBASEDIR}/$DIRNAME
|
|
|
|
LNNAME=$(echo $BACK2DIR/$RELBASEDIR/$f | \
|
|
|
|
sed -e 's|^\./||' | sed -e 's|//|/|g' | \
|
|
|
|
sed -e 's|/\./|/|' )
|
|
|
|
ln -s -f $LNNAME %{buildroot}${TARGETBASEDIR}/$f
|
|
|
|
done
|
|
|
|
popd
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
create_symlink_rec %{geminstdir}/lib %{ruby_sitelib}
|
|
|
|
|
|
|
|
|
|
|
|
%clean
|
|
|
|
rm -rf %{buildroot}
|
|
|
|
|
2009-03-11 15:35:33 +00:00
|
|
|
%check
|
2009-06-10 19:53:39 +00:00
|
|
|
# Skip until rubygem(rake-compiler) is available
|
|
|
|
exit 0
|
|
|
|
|
2009-03-11 15:35:33 +00:00
|
|
|
pushd ./%{geminstdir}
|
2009-06-10 19:53:39 +00:00
|
|
|
rake test
|
2009-03-11 15:35:33 +00:00
|
|
|
popd
|
|
|
|
|
2009-01-20 04:10:53 +00:00
|
|
|
%files
|
|
|
|
%defattr(-,root, root,-)
|
2009-06-10 19:53:39 +00:00
|
|
|
%{_bindir}/%{gemname}
|
2009-01-20 04:10:53 +00:00
|
|
|
%{ruby_sitearch}/%{gemname}/
|
|
|
|
%dir %{geminstdir}/
|
|
|
|
%doc %{geminstdir}/[A-Z]*
|
2009-06-10 19:53:39 +00:00
|
|
|
%exclude %{geminstdir}/Rakefile
|
2009-01-20 04:10:53 +00:00
|
|
|
%{geminstdir}/[a-l]*/
|
|
|
|
%{gemdir}/cache/%{gemname}-%{version}.gem
|
|
|
|
%{gemdir}/specifications/%{gemname}-%{version}.gemspec
|
|
|
|
|
|
|
|
%files doc
|
|
|
|
%defattr(-,root,root,-)
|
2009-06-10 19:53:39 +00:00
|
|
|
%{geminstdir}/Rakefile
|
2009-03-11 15:35:33 +00:00
|
|
|
%{geminstdir}/tasks/
|
2009-01-20 04:10:53 +00:00
|
|
|
%{geminstdir}/test/
|
|
|
|
%{gemdir}/doc/%{gemname}-%{version}/
|
|
|
|
|
|
|
|
%files -n ruby-%{gemname}
|
|
|
|
%defattr(-,root,root,-)
|
|
|
|
%{ruby_sitelib}/*%{gemname}.rb
|
|
|
|
%{ruby_sitelib}/%{gemname}/
|
2009-03-18 15:53:47 +00:00
|
|
|
%{ruby_sitelib}/xsd/
|
2009-01-20 04:10:53 +00:00
|
|
|
|
|
|
|
%changelog
|
2009-06-24 18:22:46 +00:00
|
|
|
* Thu Jun 25 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.3.2-1
|
|
|
|
- 1.3.2
|
|
|
|
|
2009-06-10 19:53:39 +00:00
|
|
|
* Thu Jun 11 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.3.1-1
|
|
|
|
- 1.3.1
|
|
|
|
|
2009-03-25 19:45:03 +00:00
|
|
|
* Thu Mar 26 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.2.3-1
|
|
|
|
- 1.2.3
|
|
|
|
|
2009-03-18 15:53:47 +00:00
|
|
|
* Thu Mar 19 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.2.2-1
|
|
|
|
- 1.2.2
|
|
|
|
|
2009-03-11 15:35:33 +00:00
|
|
|
* Thu Mar 12 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.2.1-1
|
|
|
|
- 1.2.1
|
|
|
|
|
2009-02-24 14:52:03 +00:00
|
|
|
* Tue Feb 24 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.1.1-2
|
|
|
|
- F-11: Mass rebuild
|
|
|
|
|
2009-01-20 04:10:53 +00:00
|
|
|
* Thu Jan 15 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.1.1-1
|
|
|
|
- 1.1.1
|
|
|
|
|
|
|
|
* Thu Dec 25 2008 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.1.0-1
|
|
|
|
- Initial packaging
|
|
|
|
|