[python3-cairo] add the spec and patch files

John Palmieri (J5) johnp at fedoraproject.org
Tue Sep 28 13:08:45 UTC 2010


commit 604f1ae902cfd26800709dc325596bc91c86fde4
Author: John (J5) Palmieri <johnp at redhat.com>
Date:   Mon Sep 27 23:37:39 2010 -0400

    add the spec and patch files

 0001-Add-support-for-libdir.patch |   87 ++++++++++++++++++++++++++++++++
 python3-cairo.spec                |   99 +++++++++++++++++++++++++++++++++++++
 2 files changed, 186 insertions(+), 0 deletions(-)
---
diff --git a/0001-Add-support-for-libdir.patch b/0001-Add-support-for-libdir.patch
new file mode 100644
index 0000000..cfd54d6
--- /dev/null
+++ b/0001-Add-support-for-libdir.patch
@@ -0,0 +1,87 @@
+From 2fbc506f34ea0844b9cda366a8031dd022efcc09 Mon Sep 17 00:00:00 2001
+From: Steve Chaplin <>
+Date: Sat, 18 Sep 2010 04:29:45 +0800
+Subject: [PATCH 1/4] Add support for
+   ./waf configure --libdir=XXX
+ Fixes #30230.
+
+---
+
+diff --git a/src/wscript b/src/wscript
+index 7fdeffc..ca51a88 100644
+--- a/src/wscript
++++ b/src/wscript
+@@ -7,12 +7,15 @@ d = 'src'
+ 
+ def build(ctx):
+   print('  %s/build()' %d)
++  pycairoLibDir = os.path.join(ctx.env['LIBDIR'],
++                               'python'+ctx.env['PYTHON_VERSION'],
++                               'site-packages', 'cairo')
+ 
+   # .py files
+   ctx.new_task_gen(
+     features     = 'py',
+     source       = '__init__.py',
+-    install_path = '${PYTHONDIR}/cairo',
++    install_path = pycairoLibDir,
+     )
+ 
+   # C extension module
+@@ -22,7 +25,7 @@ def build(ctx):
+     target = '_cairo',
+     includes = '.',
+     uselib = 'CAIRO',
+-    install_path = '${PYTHONDIR}/cairo',
++    install_path = pycairoLibDir,
+     )
+ 
+   # C API
+diff --git a/wscript b/wscript
+index 91ebe93..a55ae55 100644
+--- a/wscript
++++ b/wscript
+@@ -13,6 +13,7 @@ cairo_version_required = '1.8.10'
+ 
+ def set_options(ctx):
+   print('  %s/set_options()' %d)
++  ctx.tool_options('gnu_dirs')
+   ctx.tool_options('compiler_cc')
+   ctx.tool_options('python') # options for disabling pyc or pyo compilation
+ 
+@@ -28,6 +29,7 @@ def configure(ctx):
+   print('  %s/configure()' %d)
+ 
+   env = ctx.env
++  ctx.check_tool('gnu_dirs')
+   ctx.check_tool('misc')
+   ctx.check_tool('compiler_cc')
+   ctx.check_tool('python')
+@@ -48,8 +50,8 @@ def configure(ctx):
+ 
+   ctx.write_config_header('src/config.h')
+ 
+-  import Options
+-  print("%-40s : %s" % ('Prefix', Options.options.prefix))
++  print("%-40s : %s" % ('PREFIX', env['PREFIX']))
++  print("%-40s : %s" % ('LIBDIR', env['LIBDIR']))
+ 
+ 
+ def build(ctx):
+@@ -65,12 +67,7 @@ def build(ctx):
+     'prefix'    : ctx.env['PREFIX'],
+     'includedir': os.path.join(ctx.env['PREFIX'], 'include'),
+     }
+-  obj.install_path = os.path.join(ctx.env['PREFIX'], 'lib', 'pkgconfig')
+-
+-
+-#def dist():  # create archives of project
+-#  print('  %s/dist()' %d)
+-# dist is predefined
++  obj.install_path = os.path.join(ctx.env['LIBDIR'], 'pkgconfig')
+ 
+ 
+ def dist_hook():
+-- 
+1.7.2.3
+
diff --git a/python3-cairo.spec b/python3-cairo.spec
new file mode 100644
index 0000000..3ed8dc6
--- /dev/null
+++ b/python3-cairo.spec
@@ -0,0 +1,99 @@
+%define cairo_version 1.8.10
+
+### Abstract ###
+
+Name: python3-cairo
+Version: 1.8.10
+Release: 5%{?dist}
+License: MPLv1.1 or LGPLv2
+Group: Development/Languages
+Summary: Python 3 bindings for the cairo library
+URL: http://cairographics.org/pycairo
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+Source: http://cairographics.org/releases/pycairo-%{version}.tar.bz2
+
+Patch0: 0001-Add-support-for-libdir.patch
+### Build Dependencies ###
+
+BuildRequires: cairo-devel >= %{cairo_version}
+BuildRequires: pkgconfig
+BuildRequires: python3-devel
+
+%description
+Python 3 bindings for the cairo library.
+
+%package devel
+Summary: Libraries and headers for python3-cairo
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: cairo-devel
+Requires: pkgconfig
+Requires: python3-devel
+
+%description devel
+This package contains files required to build wrappers for cairo add-on
+libraries so that they interoperate with python3-cairo.
+
+%prep
+%setup -q -n pycairo-%{version}
+%patch0 -p1 -b .add_libdir
+
+%build
+# FIXME: we should be using the system version of waf (e.g. %{_bindir}/waf)
+#        however it is not yet python 3 compatible but should be when 1.6.0
+#        is released - https://bugzilla.redhat.com/show_bug.cgi?id=637935 
+CFLAGS="$RPM_BUILD_OPS" \
+python3 ./waf --prefix=%{_usr} \
+              --libdir=%{_libdir} \
+              configure
+
+python3 ./waf build -v
+
+# remove executable bits from examples
+find ./examples/ -type f -print0 | xargs -0 chmod -x
+
+# add executable bit to the _cairo.so library so we strip the debug info
+
+%install
+rm -rf $RPM_BUILD_ROOT
+DESTDIR=$RPM_BUILD_ROOT python3 ./waf install
+# add executable bit to the .so libraries so we strip the debug info
+find $RPM_BUILD_ROOT -name '*.so' | xargs chmod +x
+
+find $RPM_BUILD_ROOT -name '*.la' | xargs rm -f
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root,-)
+%doc AUTHORS COPYING* INSTALL NEWS README
+%doc examples doc/faq.rst doc/overview.rst doc/README 
+%{python3_sitearch}/cairo/
+
+%files devel
+%doc COPYING*
+%defattr(-,root,root,-)
+%{_includedir}/pycairo/py3cairo.h
+%{_libdir}/pkgconfig/py3cairo.pc
+
+%changelog
+* Mon Sep 27 2010 John (J5) Palmieri <johnp at redhat.com> - 1.8.10-5
+- revert back to using the provided waf script until 
+  https://bugzilla.redhat.com/show_bug.cgi?id=637935
+  is fixed
+
+* Mon Sep 27 2010 John (J5) Palmieri <johnp at redhat.com> - 1.8.10-4
+- add buildreq for waf
+
+* Wed Sep 22 2010 John (J5) Palmieri <johnp at redhat.com> - 1.8.10-3
+- Use system waf instead of bundled version (this does not work
+  on F13 since the system waf contains syntax which has changed
+  in python3)
+
+* Wed Sep 22 2010 John (J5) Palmieri <johnp at redhat.com> - 1.8.10-2
+- Fixed up for package review
+
+* Thu Sep 16 2010 John (J5) Palmieri <johnp at redhat.com> - 1.8.10-1
+- Initial build.
+


More information about the scm-commits mailing list