rubygem-cairo/rubygem-cairo.spec

369 lines
9.6 KiB
RPMSpec

%if 0%{?fedora} <= 16
%global ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")
%global ruby_sitearch %(ruby -rrbconfig -e "puts Config::CONFIG['sitearchdir']")
%endif
%if %{?fedora:0%{fedora} >= 17}%{?rhel:0%{rhel} >= 7}
%global rubyabi 1.9.1
%global header_dir %{ruby_vendorarchdir}
%global ruby19 1
%else
%global rubyabi 1.8
%global header_dir %{ruby_sitearch}
%global ruby19 0
%endif
%global gem_name cairo
%global gemver 1.12.2
%global gem_githash af3e3fc059
# Upstream GIT http://github.com/rcairo/
Summary: Ruby bindings for cairo
Name: rubygem-%{gem_name}
Version: %{gemver}
Release: 1.git%{gem_githash}%{?dist}
Group: Development/Languages
License: GPLv2 or Ruby
URL: http://cairographics.org/rcairo/
%if 0
Source0: http://rubygems.org/downloads/%{gem_name}-%{version}.gem
%else
Source0: %{gem_name}-%{gemver}-%{gem_githash}.gem
%endif
# Git based gem is created by below
Source1: create-cairo-gem.sh
BuildRequires: ruby(abi) = %{rubyabi}
BuildRequires: rubygems-devel
BuildRequires: cairo-devel
BuildRequires: ruby-devel
# For %%check
BuildRequires: rubygem(test-unit)
BuildRequires: rubygem(pkg-config)
# Make sure at least one font is available for test/test_context.rb:57
# `initialize': out of memory (NoMemoryError)
BuildRequires: dejavu-serif-fonts
Requires: ruby(abi) = %{rubyabi}
Requires: rubygems
Provides: rubygem(%{gem_name}) = %{version}-%{release}
%if %{ruby19}
Obsoletes: ruby-%{gem_name} = %{version}-%{release}
Provides: ruby-%{gem_name} = %{version}-%{release}
%endif
%description
Ruby bindings for cairo. Cairo is a 2D graphics library with support for
multiple output devices. Currently supported output targets include the
X Window System, win32, and image buffers.
%package doc
Summary: Documentation for %{name}
Group: Documentation
Requires: %{name} = %{version}-%{release}
%description doc
This package contains documentation for %{name}.
%package -n ruby-%{gem_name}
# TODO: remove ruby-%%{gem_name} compat package for F-17
# TODO: needs dependency check
Summary: Non-Gem support package for %{gem_name}
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Provides: ruby(%{gem_name}) = %{version}-%{release}
%description -n ruby-%{gem_name}
This package provides non-Gem support for %{gem_name}.
%package devel
Summary: Ruby-cairo development environment
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Requires: cairo-devel
Requires: ruby-devel
# Obsoletes / Provides
# ruby(cairo-devel) Provides is for compatibility
#
# Actually ruby(cairo-dock) provides should not exist -
# Remove on F-17 and above
Obsoletes: ruby-cairo-devel < 1.9
Provides: ruby-cairo-devel = %{version}-%{release}
%if %{ruby19} < 1
Provides: ruby(cairo-devel) = %{version}-%{release}
%endif
%description devel
Header files and libraries for building a extension library for the
ruby-cairo
%prep
%setup -q -T -c
mkdir -p ./%{gem_dir}
export CONFIGURE_ARGS="--with-cflags='%{optflags}'"
gem install \
--local \
--install-dir ./%{gem_dir} \
-V --force \
%{SOURCE0}
find . -name \*.gem | xargs chmod 0644
%build
# pkg-config dependency should be for deelopment
find . -name \*.gemspec | \
xargs sed -i -e '\@pkg-config@s|runtime_dependency|development_dependency|'
# Once install to TMPINSTDIR for %%check
rm -rf ./TMPINSTDIR
mkdir -p ./TMPINSTDIR/%{gem_dir}
cp -a ./%{gem_dir}/* ./TMPINSTDIR/%{gem_dir}
TOPDIR=$(pwd)
## remove all shebang, set permission to 0644
for f in $(find ./TMPINSTDIR/%{gem_instdir} -name \*.rb)
do
sed -i -e '/^#!/d' $f
chmod 0644 $f
done
# Move C extension library to some private directory
pushd ./TMPINSTDIR/%{gem_instdir}
%if %{ruby19} < 1
grep -rl '%{gem_name}.so' . | \
xargs sed -i \
-e "\@require@s|'%{gem_name}.so'|'%{gem_name}/%{gem_name}.so'|" \
-e '\@require@s|"%{gem_name}.so"|"%{gem_name}/%{gem_name}.so"|'
popd
mkdir -p ./TMPINSTDIR/%{ruby_sitearch}/%{gem_name}
pushd ./TMPINSTDIR
mv .%{gem_instdir}/lib/%{gem_name}.so \
./%{ruby_sitearch}/%{gem_name}/
%else
popd
pushd ./TMPINSTDIR
mkdir -p .%{gem_extdir}/lib
mv .%{gem_instdir}/lib/%{gem_name}.so \
./%{gem_extdir}/lib
%endif
# Move header
mkdir -p ./%{header_dir}
mv ./%{gem_instdir}/lib/*.h \
./%{header_dir}/
popd
# cleanups
rm -rf ./TMPINSTDIR/%{gem_instdir}/ext/
rm -f ./TMPINSTDIR/%{gem_instdir}/{Makefile*,extconf.rb}
%install
cp -a ./TMPINSTDIR/* %{buildroot}/
# The following method is completely copied from rubygem-gettext
# spec file
#
# Create symlinks
##
## Note that before switching to gem %%{ruby_sitelib}/%%{gem_name}
## 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
}
%if %{ruby19} < 1
create_symlink_rec %{gem_instdir}/lib %{ruby_sitelib}
%endif
%check
%if %{ruby19}
export RUBYLIB=$(pwd)/TMPINSTDIR/%{gem_instdir}:$(pwd)/TMPINSTDIR/%{gem_extdir}/lib
%else
export RUBYLIB=$(pwd)/TMPINSTDIR/%{ruby_sitearch}
%endif
pushd ./TMPINSTDIR/%{gem_instdir}
# kill unneeded make process
rm -rf ./TMPBINDIR
mkdir ./TMPBINDIR
pushd ./TMPBINDIR
ln -sf /bin/true make
export PATH=$(pwd):$PATH
popd
# Fix up test/run-test.rb
sed -i -e '\@require .rubygems@a\\ngem "test-unit"\n' test/run-test.rb
sed -i -e "\@require 'bundler/setup'@d" test/run-test.rb
sed -i -e "\@require@s|test-unit|test/unit|" test/run-test.rb
ruby ./test/run-test.rb
popd
%files
%if %{ruby19} < 1
%dir %{ruby_sitearch}/%{gem_name}/
%{ruby_sitearch}/%{gem_name}/%{gem_name}.so
%else
%dir %{gem_extdir}
%dir %{gem_extdir}/lib
%{gem_extdir}/lib/%{gem_name}.so
%endif
%dir %{gem_instdir}/
%doc %{gem_instdir}/[A-Z]*
%exclude %{gem_instdir}/Gemfile
%exclude %{gem_instdir}/Rakefile
%{gem_instdir}/lib/
%{gem_cache}
%{gem_spec}
%files doc
%{gem_instdir}/Gemfile
%{gem_instdir}/Rakefile
%{gem_instdir}/samples/
%{gem_instdir}/test/
%{gem_docdir}/
%if %{ruby19} < 1
%files -n ruby-%{gem_name}
%{ruby_sitelib}/%{gem_name}.rb
%{ruby_sitelib}/%{gem_name}/
%endif
%files devel
%{header_dir}/rb_cairo.h
%changelog
* Wed Apr 18 2012 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.12.2-1.gitaf3e3fc059
- Update to 1.12.2
- And use git based gem for now to avoid test failure
* Tue Apr 03 2012 Vít Ondruch <vondruch@redhat.com> - 1.10.2-4
- Fix conditionals for F17 to work for RHEL 7 as well.
* Sun Jan 29 2012 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.10.2-3
- F-17: rebuild against ruby 1.9
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.10.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Wed Nov 30 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.10.2-1
- 1.10.2
- Make dependency for pkg-config be development only again
- Change the license tag to "GPLv2 or Ruby"
- Remove defattr
* Sun Oct 16 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.10.1-1
- 1.10.1
* Mon Feb 14 2011 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 1.10.0-4
- F-15 mass rebuild
- Ignore test failure for now
* Sun Oct 31 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 1.10.0-3
- Move C extension so that "require %%gem_name" 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
* Sun Sep 19 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 1.10.0-1
- Update to 1.10.0
* Fri Sep 3 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 1.8.5-2
- Switch to gem
- Fix license tag
* Thu Sep 2 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 1.8.5-1
- Update to 1.8.5
* Wed Dec 16 2009 Allisson Azevedo <allisson@gmail.com> 1.8.1-1
- Update to 1.8.1
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Fri Jan 23 2009 Allisson Azevedo <allisson@gmail.com> 1.8.0-2
- Rebuild
* Sun Oct 5 2008 Allisson Azevedo <allisson@gmail.com> 1.8.0-1
- Update to 1.8.0
* Tue Sep 9 2008 Allisson Azevedo <allisson@gmail.com> 1.7.0-1
- Update to 1.7.0
* Sun May 18 2008 Allisson Azevedo <allisson@gmail.com> 1.6.1-1
- Update to 1.6.1
* Mon Feb 25 2008 Allisson Azevedo <allisson@gmail.com> 1.5.1-1
- Update to 1.5.1
- Update License for GPLv2+
* Mon Feb 18 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.5.0-2
- Autorebuild for GCC 4.3
* Mon Jun 11 2007 Allisson Azevedo <allisson@gmail.com> 1.5.0-1
- Update to 1.5.0
* Sun Mar 28 2007 Allisson Azevedo <allisson@gmail.com> 1.4.1-2
- Changed license for Ruby License/GPL
- Add ruby-devel for devel requires
- Changed main group for System Environment/Libraries
- Changed install for keep timestamps
* Sun Mar 26 2007 Allisson Azevedo <allisson@gmail.com> 1.4.1-1
- Initial RPM release