Ghee, While runtime detection is a step forward, I wouldn't reverse the packaging changes. With the printing backends in separate packages, SUNWgtk2 need not depend on _both_ cups and papi.
Laca On Mon, 2009-10-12 at 16:34 +0100, Ghee Teo wrote: > Bug: http://defect.opensolaris.org/bz/show_bug.cgi?id=11830 > > This is now a new fix which does not include the create of the new packages. > Essentially, a run-time check is made when the backend modules (cups/papi) are > loaded. If the supporting print system is found then create the print backend > so that the applications can use. However, it is not then don't create the > print backend module. > > The check for papi is to check for /usr/lib/libpapi.so > and for cups is /usr/lib/libcups.so > > The patch is attached include a reverting the changes made to SUNWgtk2.spec. > So we would not be generating SUNWgtk2-print-[cups|papi] anymore. > > -Ghee > > plain text document attachment (print-system-libs-check.diff) > --- SUNWgtk2.spec 2009-10-12 16:04:25.887908177 +0100 > +++ SUNWgtk2.spec.reverted 2009-10-12 15:31:54.263184834 +0100 > @@ -63,7 +63,9 @@ > SUNW_BaseDir: %{_basedir} > %include default-depend.inc > Requires: SUNWgtk2 > +Requires: SUNWcupsu > Requires: SUNWlibmsr > +Requires: SUNWpapi > Requires: SUNWpng-devel > Requires: SUNWglib2-devel > Requires: SUNWcairo-devel > @@ -71,37 +73,6 @@ > Requires: SUNWlibatk-devel > Requires: SUNWxwinc > > -%package print-cups > -Summary: %{summary} - CUPS Print Backend > -SUNW_BaseDir: %{_basedir} > -%include default-depend.inc > -Requires: SUNWglib2 > -Requires: SUNWgtk2 > -Requires: SUNWcairo > -Requires: SUNWcupsu > -Requires: SUNWpango > -Requires: SUNWxwplt > -Requires: SUNWxwrtl > -Requires: SUNWxorg-clientlibs > -BuildRequires: SUNWglib2-devel > -BuildRequires: SUNWcairo-devel > - > -%package print-papi > -Summary: %{summary} - PAPI (LP) Print Backend > -SUNW_BaseDir: %{_basedir} > -%include default-depend.inc > -Requires: SUNWglib2 > -Requires: SUNWgtk2 > -Requires: SUNWcairo > -Requires: SUNWpango > -Requires: SUNWpapi > -Requires: SUNWxwplt > -Requires: SUNWxwrtl > -Requires: SUNWxorg-clientlibs > -BuildRequires: SUNWglib2-devel > -BuildRequires: SUNWgtk2-devel > -BuildRequires: SUNWcairo-devel > - > %if %build_l10n > %package l10n > Summary: %{summary} - l10n content > @@ -243,8 +214,7 @@ > %{_libdir}/gtk*/*/loaders/*.so > %{_libdir}/gtk*/*/immodules/im-xim.so > %{_libdir}/gtk-2.0/modules/*.so > -%{_libdir}/gtk*/*/printbackends/libprintbackend-file.so > -%{_libdir}/gtk*/*/printbackends/libprintbackend-lpr.so > +%{_libdir}/gtk*/*/printbackends > %ifarch amd64 sparcv9 > %dir %attr (0755, root, bin) %{_bindir}/%{_arch64} > %{_bindir}/%{_arch64}/gtk-builder-convert > @@ -256,8 +226,7 @@ > %{_libdir}/%{_arch64}/gtk*/*/engines/*.so > %{_libdir}/%{_arch64}/gtk*/*/immodules/im-xim.so > %{_libdir}/%{_arch64}/gtk*/modules/*.so > -%{_libdir}/%{_arch64}/gtk*/*/printbackends/libprintbackend-file.so > -%{_libdir}/%{_arch64}/gtk*/*/printbackends/libprintbackend-lpr.so > +%{_libdir}/%{_arch64}/gtk*/*/printbackends > %endif > %dir %attr (0755, root, sys) %{_datadir} > %{_datadir}/themes > @@ -312,20 +281,6 @@ > %{_sysconfdir}/%{_arch64}/gtk-2.0/im-multipress.conf > %endif > > -%files print-cups > -%defattr (-, root, bin) > -%dir %attr (0755, root, bin) %{_libdir} > -%{_libdir}/gtk*/*/printbackends/libprintbackend-cups.so > -%ifarch amd64 sparcv9 > -%dir %attr (0755, root, bin) %{_libdir}/%{_arch64} > -%{_libdir}/%{_arch64}/gtk*/*/printbackends/libprintbackend-cups.so > -%endif > - > -%files print-papi > -%defattr (-, root, bin) > -%dir %attr (0755, root, bin) %{_libdir} > -%{_libdir}/gtk*/*/printbackends/libprintbackend-papi.so > - > %if %build_l10n > %files l10n > %defattr (-, root, bin) > @@ -334,12 +289,6 @@ > %endif > > %changelog > -* Sun Oct 11 2009 - ghee.teo at sun.com > -- rename backend print modules to SUNWgtk2-print-cups and SUNWgtk2-print-papi > -* Sat Oct 10 2009 - dave.lin at sun.com > -- Fixed directory attribute issue for SUNWgtk2-cups/papi-be. > -* Fri Oct 09 2009 - ghee.teo at sun.com > -- split out CUPS and PAPI print backends into SUNWgtk2-cups-be, > SUNWgtk2-papi-be > * Thu Sep 10 2009 - jedy.wang at sun.com > - Remove SUNWmlib dependency. It's optinal now. > * Tue Jun 30 2009 - dave.lin at sun.com > diff -urN gtk+-2.18.0/modules/printbackends/cups/gtkprintbackendcups.c > ../../SUNWgtk2-2.18.0.hacked/i386/gtk+-2.18.0/modules/printbackends/cups/gtkprintbackendcups.c > --- gtk+-2.18.0/modules/printbackends/cups/gtkprintbackendcups.c > 2009-09-12 03:58:39.000000000 +0100 > +++ > ../../SUNWgtk2-2.18.0.hacked/i386/gtk+-2.18.0/modules/printbackends/cups/gtkprintbackendcups.c > 2009-10-12 15:16:34.544907874 +0100 > @@ -228,6 +228,23 @@ > G_MODULE_EXPORT GtkPrintBackend * > pb_module_create (void) > { > + static gboolean loaded = FALSE; > + > + if (!loaded) > + { > + GModule *cups; > + GModuleFlags flags; > + > + flags = G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL; > + > + cups = g_module_open ("libcups.so", flags); > + loaded = TRUE; > + if (!cups) > + return NULL; > + else > + g_module_close (cups); > + } > + > return gtk_print_backend_cups_new (); > } > > diff -urN gtk+-2.18.0/modules/printbackends/papi/gtkprintbackendpapi.c > ../../SUNWgtk2-2.18.0.hacked/i386/gtk+-2.18.0/modules/printbackends/papi/gtkprintbackendpapi.c > --- gtk+-2.18.0/modules/printbackends/papi/gtkprintbackendpapi.c > 2009-09-12 03:58:39.000000000 +0100 > +++ > ../../SUNWgtk2-2.18.0.hacked/i386/gtk+-2.18.0/modules/printbackends/papi/gtkprintbackendpapi.c > 2009-10-12 15:16:10.112638436 +0100 > @@ -140,6 +140,23 @@ > G_MODULE_EXPORT GtkPrintBackend * > pb_module_create (void) > { > + static gboolean loaded = FALSE; > + > + if (!loaded) > + { > + GModule *papi; > + GModuleFlags flags; > + > + flags = G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL; > + > + papi = g_module_open ("libpapi.so", flags); > + loaded = TRUE; > + if (!papi) > + return NULL; > + else > + g_module_close (papi); > + } > + > return gtk_print_backend_papi_new (); > } >
