- Move C extension so that "require %gemname" works correctly
This commit is contained in:
parent
0d543b4dd4
commit
0734c70f29
@ -14,7 +14,7 @@
|
||||
Summary: Ruby bindings for cairo
|
||||
Name: rubygem-%{gemname}
|
||||
Version: 1.10.0
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Group: Development/Languages
|
||||
License: GPLv2 or Ruby
|
||||
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|' \
|
||||
.%{gemdir}/specifications/%{gemname}-%{version}.gemspec
|
||||
|
||||
pushd .%{geminstdir}
|
||||
# only create Makefile
|
||||
export CFLAGS="%{optflags}"
|
||||
ruby ./extconf.rb
|
||||
popd
|
||||
# Once install to TMPINSTDIR for %%check
|
||||
rm -rf ./TMPINSTDIR
|
||||
mkdir -p ./TMPINSTDIR/%{gemdir}
|
||||
cp -a ./%{gemdir}/* ./TMPINSTDIR/%{gemdir}
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
mkdir -p %{buildroot}%{gemdir}
|
||||
cp -a ./%{gemdir}/* %{buildroot}%{gemdir}
|
||||
|
||||
# Install C extensions, header files
|
||||
TOPDIR=$(pwd)
|
||||
## Install C extensions, header files
|
||||
pushd .%{geminstdir}
|
||||
# Once create Makefile, then:
|
||||
ruby extconf.rb
|
||||
|
||||
make -C ext/cairo \
|
||||
install \
|
||||
INSTALL="install -p" \
|
||||
DESTDIR=%{buildroot}/
|
||||
DESTDIR=$TOPDIR/TMPINSTDIR/
|
||||
popd
|
||||
|
||||
# remove all shebang, set permission to 0644
|
||||
for f in $(find %{buildroot}%{geminstdir} -name \*.rb)
|
||||
## remove all shebang, set permission to 0644
|
||||
for f in $(find ./TMPINSTDIR/%{geminstdir} -name \*.rb)
|
||||
do
|
||||
sed -i -e '/^#!/d' $f
|
||||
chmod 0644 $f
|
||||
done
|
||||
|
||||
# cleanups
|
||||
rm -rf %{buildroot}%{geminstdir}/ext/
|
||||
rm -f %{buildroot}%{geminstdir}/lib/*.so
|
||||
# Move C extension library to some private directory
|
||||
pushd ./TMPINSTDIR/%{geminstdir}
|
||||
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
|
||||
# spec file
|
||||
@ -193,13 +209,24 @@ create_symlink_rec %{geminstdir}/lib %{ruby_sitelib}
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%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
|
||||
popd
|
||||
|
||||
%files
|
||||
%defattr(-,root, root,-)
|
||||
%{ruby_sitearch}/%{gemname}.so
|
||||
%dir %{ruby_sitearch}/%{gemname}/
|
||||
%{ruby_sitearch}/%{gemname}/%{gemname}.so
|
||||
%dir %{geminstdir}/
|
||||
%doc %{geminstdir}/[A-Z]*
|
||||
%exclude %{geminstdir}/Rakefile
|
||||
@ -225,6 +252,9 @@ popd
|
||||
%{ruby_sitearch}/rb_cairo.h
|
||||
|
||||
%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
|
||||
- Install one font at BuildRequires for test
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user