- enhance CUPS support:

* correct PATH for foomatic db files (asked by ian@)
 * make it possible to restart the server from kcontrol (using pgreg
 instead of /proc - from FreeBSD)
 * fix WANTLIB
This changes make it possible to use kcontrol to easily
add/change/configure your printers when using CUPS.

- while here, don't try to strip the kdelibtool script
This commit is contained in:
ajacoutot 2007-10-06 12:47:20 +00:00
parent b032baf6b5
commit 63bd3b32a3
3 changed files with 110 additions and 7 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.83 2007/09/15 20:04:21 merdely Exp $
# $OpenBSD: Makefile,v 1.84 2007/10/06 12:47:20 ajacoutot Exp $
COMMENT-main= K Desktop Environment, libraries
COMMENT-cups= K Desktop Environment, cups support
@ -8,8 +8,8 @@ DISTNAME= kdelibs-${VERSION}
MASTER_SITES0= ftp://ftp.kde.org/pub/kde/security_patches/
#PATCHFILES= post-3.4.3-kdelibs-kjs.diff:0
PKGNAME-main= ${DISTNAME}p0
PKGNAME-cups= kdecups-${VERSION}
PKGNAME-main= ${DISTNAME}p1
PKGNAME-cups= kdecups-${VERSION}p0
MODKDE_VERSION= 3.5.7
SHARED_LIBS += DCOP 7.0 # .6.0
SHARED_LIBS += kdefx 7.0 # .6.0
@ -62,7 +62,7 @@ CONFIGURE_ARGS+= --enable-cups
LIB_DEPENDS= art_lgpl_2::graphics/libart \
idn::devel/libidn \
fam::sysutils/fam
WANTLIB= intl iconv util jpeg m X11 ICE Xrender c SM pthread \
WANTLIB= iconv util jpeg m X11 ICE Xrender c SM pthread \
stdc++ Xext z png rpcsvc Xau Xdmcp
LIB_DEPENDS-main=${LIB_DEPENDS} \
@ -75,7 +75,7 @@ LIB_DEPENDS-main=${LIB_DEPENDS} \
Half,Iex,Imath,IlmImf::graphics/openexr \
aspell::textproc/aspell/core
WANTLIB-main= ${WANTLIB} \
WANTLIB-main= ${WANTLIB} intl \
audiofile esd glib-2.0 \
gmodule-2.0 gthread-2.0 mad ogg \
ossaudio vorbisenc vorbis vorbisfile \
@ -97,13 +97,17 @@ SAMPLECONFDIR=${TRUEPREFIX}/share/apps/kde-conf-sample
EXTRA_CONFIG=xdg/menus/applications.menu
FAKE_FLAGS=DESTDIR=${WRKINST} sysconfdir=${SAMPLECONFDIR}
post-extract:
cp ${FILESDIR}/krb5-config ${WRKDIR}/bin
chmod a+x ${WRKDIR}/bin/krb5-config
pre-configure:
@perl -pi -e 's,!!LOCALBASE!!,${LOCALBASE},g' \
${WRKSRC}/kdeprint/cups/kmcupsmanager.cpp
post-install:
${INSTALL_PROGRAM} ${WRKBUILD}/libtool ${PREFIX}/bin/kdelibtool
${INSTALL_SCRIPT} ${WRKBUILD}/libtool ${PREFIX}/bin/kdelibtool
.include <bsd.port.mk>
MODGNU_AUTOCONF_FILES+= dcop/dcop-path.h.in

View File

@ -0,0 +1,65 @@
$OpenBSD: patch-kdeprint_cups_cupsdconf2_cupsddialog_cpp,v 1.1 2007/10/06 12:47:20 ajacoutot Exp $
--- kdeprint/cups/cupsdconf2/cupsddialog.cpp.orig Mon Oct 10 17:06:30 2005
+++ kdeprint/cups/cupsdconf2/cupsddialog.cpp Sat Oct 6 14:48:54 2007
@@ -44,6 +44,7 @@
#include <kio/passdlg.h>
#include <kguiitem.h>
#include <kprocess.h>
+#include <qprocess.h>
#include <signal.h>
#include <cups/cups.h>
@@ -69,24 +70,37 @@ extern "C"
int getServerPid()
{
- QDir dir("/proc",QString::null,QDir::Name,QDir::Dirs);
- for (uint i=0;i<dir.count();i++)
- {
- if (dir[i] == "." || dir[i] == ".." || dir[i] == "self") continue;
- QFile f("/proc/" + dir[i] + "/cmdline");
- if (f.exists() && f.open(IO_ReadOnly))
+ #if defined(__OpenBSD__)
+ QProcess *proc = new QProcess();
+ proc->addArgument("pgrep");
+ proc->addArgument("cupsd");
+ proc->start();
+ while (proc->isRunning()); //Wait for process to exit
+ QString pidString = proc->readLineStdout();
+ bool ok;
+ int pid = pidString.toInt(&ok);
+ if (ok) return pid;
+ return (-1);
+ #else
+ QDir dir("/proc",QString::null,QDir::Name,QDir::Dirs);
+ for (uint i=0;i<dir.count();i++)
{
- QTextStream t(&f);
- QString line;
- t >> line;
- f.close();
- if (line.right(5) == "cupsd" ||
- line.right(6).left(5) == "cupsd") // second condition for 2.4.x kernels
- // which add a null byte at the end
- return dir[i].toInt();
+ if (dir[i] == "." || dir[i] == ".." || dir[i] == "self") continue;
+ QFile f("/proc/" + dir[i] + "/cmdline");
+ if (f.exists() && f.open(IO_ReadOnly))
+ {
+ QTextStream t(&f);
+ QString line;
+ t >> line;
+ f.close();
+ if (line.right(5) == "cupsd" ||
+ line.right(6).left(5) == "cupsd") // second condition for 2.4.x kernels
+ // which add a null byte at the end
+ return dir[i].toInt();
+ }
}
- }
- return (-1);
+ return (-1);
+ #endif
}
const char* getPassword(const char*)

View File

@ -0,0 +1,34 @@
$OpenBSD: patch-kdeprint_cups_kmcupsmanager_cpp,v 1.1 2007/10/06 12:47:20 ajacoutot Exp $
--- kdeprint/cups/kmcupsmanager.cpp.orig Sat Oct 6 09:19:06 2007
+++ kdeprint/cups/kmcupsmanager.cpp Sat Oct 6 09:23:44 2007
@@ -102,10 +102,10 @@ QString KMCupsManager::driverDirectory()
{
QString d = cupsInstallDir();
if (d.isEmpty())
- d = "/usr";
+ d = "!!LOCALBASE!!";
d.append("/share/cups/model");
// raw foomatic support
- d.append(":/usr/share/foomatic/db/source");
+ d.append(":!!LOCALBASE!!/share/foomatic/db/source");
return d;
}
@@ -576,7 +576,7 @@ DrMain* KMCupsManager::loadMaticDriver(const QString&
{
QStringList comps = QStringList::split('/', drname, false);
QString tmpFile = locateLocal("tmp", "foomatic_" + kapp->randomString(8));
- QString PATH = getenv("PATH") + QString::fromLatin1(":/usr/sbin:/usr/local/sbin:/opt/sbin:/opt/local/sbin");
+ QString PATH = getenv("PATH") + QString::fromLatin1(":!!LOCALBASE!!/bin:/usr/sbin:/usr/local/sbin:/opt/sbin:/opt/local/sbin");
QString exe = KStandardDirs::findExe("foomatic-datafile", PATH);
if (exe.isEmpty())
{
@@ -867,7 +867,7 @@ void KMCupsManager::exportDriver()
{
QString path = cupsInstallDir();
if (path.isEmpty())
- path = "/usr/share/cups";
+ path = "!!LOCALBASE!!/share/cups";
else
path += "/share/cups";
CupsAddSmb::exportDest(m_currentprinter->printerName(), path);