- Move C extension so that "require %gemname" works correctly
This commit is contained in:
parent
fbf8d74793
commit
2d04ec00c3
@ -14,7 +14,7 @@
|
|||||||
Summary: Ruby bindings for cairo
|
Summary: Ruby bindings for cairo
|
||||||
Name: rubygem-%{gemname}
|
Name: rubygem-%{gemname}
|
||||||
Version: 1.10.0
|
Version: 1.10.0
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
Group: Development/Languages
|
Group: Development/Languages
|
||||||
License: GPLv2 or Ruby
|
License: GPLv2 or Ruby
|
||||||
URL: http://cairographics.org/rcairo/
|
URL: http://cairographics.org/rcairo/
|
||||||
@ -97,36 +97,52 @@ sed -i -e '/pkg-config/s|project\.extra_deps|project.extra_dev_deps|' \
|
|||||||
sed -i -e '/pkg-config/s|add_runtime_dependency|add_development_dependency|' \
|
sed -i -e '/pkg-config/s|add_runtime_dependency|add_development_dependency|' \
|
||||||
.%{gemdir}/specifications/%{gemname}-%{version}.gemspec
|
.%{gemdir}/specifications/%{gemname}-%{version}.gemspec
|
||||||
|
|
||||||
pushd .%{geminstdir}
|
# Once install to TMPINSTDIR for %%check
|
||||||
# only create Makefile
|
rm -rf ./TMPINSTDIR
|
||||||
export CFLAGS="%{optflags}"
|
mkdir -p ./TMPINSTDIR/%{gemdir}
|
||||||
ruby ./extconf.rb
|
cp -a ./%{gemdir}/* ./TMPINSTDIR/%{gemdir}
|
||||||
popd
|
|
||||||
|
|
||||||
%install
|
TOPDIR=$(pwd)
|
||||||
rm -rf %{buildroot}
|
## Install C extensions, header files
|
||||||
mkdir -p %{buildroot}%{gemdir}
|
|
||||||
cp -a ./%{gemdir}/* %{buildroot}%{gemdir}
|
|
||||||
|
|
||||||
# Install C extensions, header files
|
|
||||||
pushd .%{geminstdir}
|
pushd .%{geminstdir}
|
||||||
|
# Once create Makefile, then:
|
||||||
|
ruby extconf.rb
|
||||||
|
|
||||||
make -C ext/cairo \
|
make -C ext/cairo \
|
||||||
install \
|
install \
|
||||||
INSTALL="install -p" \
|
INSTALL="install -p" \
|
||||||
DESTDIR=%{buildroot}/
|
DESTDIR=$TOPDIR/TMPINSTDIR/
|
||||||
|
popd
|
||||||
|
|
||||||
# remove all shebang, set permission to 0644
|
## remove all shebang, set permission to 0644
|
||||||
for f in $(find %{buildroot}%{geminstdir} -name \*.rb)
|
for f in $(find ./TMPINSTDIR/%{geminstdir} -name \*.rb)
|
||||||
do
|
do
|
||||||
sed -i -e '/^#!/d' $f
|
sed -i -e '/^#!/d' $f
|
||||||
chmod 0644 $f
|
chmod 0644 $f
|
||||||
done
|
done
|
||||||
|
|
||||||
# cleanups
|
# Move C extension library to some private directory
|
||||||
rm -rf %{buildroot}%{geminstdir}/ext/
|
pushd ./TMPINSTDIR/%{geminstdir}
|
||||||
rm -f %{buildroot}%{geminstdir}/lib/*.so
|
grep -rl '%{gemname}.so' . | \
|
||||||
|
xargs sed -i \
|
||||||
|
-e "\@require@s|'%{gemname}.so'|'%{gemname}/%{gemname}.so'|" \
|
||||||
|
-e '\@require@s|"%{gemname}.so"|"%{gemname}/%{gemname}.so"|'
|
||||||
|
popd
|
||||||
|
pushd ./TMPINSTDIR/%{ruby_sitearch}
|
||||||
|
mkdir %{gemname}
|
||||||
|
mv %{gemname}.so %{gemname}/
|
||||||
|
popd
|
||||||
|
|
||||||
|
# cleanups
|
||||||
|
rm -rf ./TMPINSTDIR/%{geminstdir}/ext/
|
||||||
|
rm -f ./TMPINSTDIR/%{geminstdir}/lib/*.so
|
||||||
|
rm -f ./TMPINSTDIR/%{geminstdir}/{Makefile*,extconf.rb}
|
||||||
|
|
||||||
|
%install
|
||||||
|
rm -rf %{buildroot}
|
||||||
|
mkdir -p %{buildroot}
|
||||||
|
cp -a ./TMPINSTDIR/* %{buildroot}/
|
||||||
|
|
||||||
rm -f %{buildroot}%{geminstdir}/{Makefile*,extconf.rb}
|
|
||||||
|
|
||||||
# The following method is completely copied from rubygem-gettext
|
# The following method is completely copied from rubygem-gettext
|
||||||
# spec file
|
# spec file
|
||||||
@ -193,13 +209,24 @@ create_symlink_rec %{geminstdir}/lib %{ruby_sitelib}
|
|||||||
rm -rf %{buildroot}
|
rm -rf %{buildroot}
|
||||||
|
|
||||||
%check
|
%check
|
||||||
pushd ./%{geminstdir}
|
export RUBYLIB=$(pwd)/TMPINSTDIR/%{ruby_sitearch}
|
||||||
|
|
||||||
|
pushd ./TMPINSTDIR/%{geminstdir}
|
||||||
|
# kill unneeded make process
|
||||||
|
rm -rf ./TMPBINDIR
|
||||||
|
mkdir ./TMPBINDIR
|
||||||
|
pushd ./TMPBINDIR
|
||||||
|
ln -sf /bin/true make
|
||||||
|
export PATH=$(pwd):$PATH
|
||||||
|
popd
|
||||||
|
|
||||||
ruby ./test/run-test.rb --verbose
|
ruby ./test/run-test.rb --verbose
|
||||||
popd
|
popd
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root, root,-)
|
%defattr(-,root, root,-)
|
||||||
%{ruby_sitearch}/%{gemname}.so
|
%dir %{ruby_sitearch}/%{gemname}/
|
||||||
|
%{ruby_sitearch}/%{gemname}/%{gemname}.so
|
||||||
%dir %{geminstdir}/
|
%dir %{geminstdir}/
|
||||||
%doc %{geminstdir}/[A-Z]*
|
%doc %{geminstdir}/[A-Z]*
|
||||||
%exclude %{geminstdir}/Rakefile
|
%exclude %{geminstdir}/Rakefile
|
||||||
@ -225,6 +252,9 @@ popd
|
|||||||
%{ruby_sitearch}/rb_cairo.h
|
%{ruby_sitearch}/rb_cairo.h
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sun Oct 31 2010 Mamoru Taska <mtasaka@ioa.s.u-tokyo.ac.jp> 1.10.0-3
|
||||||
|
- Move C extension so that "require %%gemname" works correctly
|
||||||
|
|
||||||
* Tue Oct 5 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 1.10.0-2
|
* Tue Oct 5 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 1.10.0-2
|
||||||
- Install one font at BuildRequires for test
|
- Install one font at BuildRequires for test
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user