From: msweet Date: Fri, 21 Mar 2014 14:50:24 +0000 (+0000) Subject: Save work on generalizing startup of cupsd… X-Git-Tag: v2.2b1~707 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2b8078bd6129eb05e81a9bb07a2d7a295d5422e;p=thirdparty%2Fcups.git Save work on generalizing startup of cupsd… git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11716 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/Makedefs.in b/Makedefs.in index f55057ae67..5d261c39df 100644 --- a/Makedefs.in +++ b/Makedefs.in @@ -3,7 +3,7 @@ # # Common makefile definitions for CUPS. # -# Copyright 2007-2013 by Apple Inc. +# Copyright 2007-2014 by Apple Inc. # Copyright 1997-2007 by Easy Software Products, all rights reserved. # # These coded instructions, statements, and computer programs are the @@ -121,9 +121,9 @@ INSTALLXPC = @INSTALLXPC@ # ALL_CFLAGS = -I.. -D_CUPS_SOURCE $(CFLAGS) $(SSLFLAGS) \ - @LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS) + @LARGEFILE@ @PTHREAD_FLAGS@ $(ONDEMANDFLAGS) $(OPTIONS) ALL_CXXFLAGS = -I.. -D_CUPS_SOURCE $(CXXFLAGS) $(SSLFLAGS) \ - @LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS) + @LARGEFILE@ @PTHREAD_FLAGS@ $(ONDEMANDFLAGS) $(OPTIONS) ARCHFLAGS = @ARCHFLAGS@ ARFLAGS = @ARFLAGS@ BACKLIBS = @BACKLIBS@ @@ -140,13 +140,14 @@ DSOLIBS = @DSOLIBS@ $(COMMONLIBS) DNSSDLIBS = @DNSSDLIBS@ IPPFIND_BIN = @IPPFIND_BIN@ IPPFIND_MAN = @IPPFIND_MAN@ -LAUNCHDLIBS = @LAUNCHDLIBS@ LDFLAGS = -L../cgi-bin -L../cups -L../filter -L../ppdc \ -L../scheduler @LDARCHFLAGS@ \ @LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM) LINKCUPS = @LINKCUPS@ $(LIBGSSAPI) $(DNSSDLIBS) $(LIBZ) LINKCUPSIMAGE = @LINKCUPSIMAGE@ LIBS = $(LINKCUPS) $(COMMONLIBS) +ONDEMANDFLAGS = @ONDEMANDFLAGS@ +ONDEMANDLIBS = @ONDEMANDLIBS@ OPTIM = @OPTIM@ OPTIONS = PAMLIBS = @PAMLIBS@ @@ -200,8 +201,6 @@ DATADIR = $(BUILDROOT)@CUPS_DATADIR@ DOCDIR = $(BUILDROOT)@CUPS_DOCROOT@ ICONDIR = @ICONDIR@ INCLUDEDIR = $(BUILDROOT)$(includedir) -INITDIR = @INITDIR@ -INITDDIR = @INITDDIR@ LIBDIR = $(BUILDROOT)$(libdir) LOCALEDIR = $(BUILDROOT)@CUPS_LOCALEDIR@ LOGDIR = $(BUILDROOT)@CUPS_LOGDIR@ @@ -216,10 +215,7 @@ REQUESTS = $(BUILDROOT)@CUPS_REQUESTS@ SBINDIR = $(BUILDROOT)@sbindir@ SERVERBIN = $(BUILDROOT)@CUPS_SERVERBIN@ SERVERROOT = $(BUILDROOT)@CUPS_SERVERROOT@ -SMFMANIFESTDIR = @SMFMANIFESTDIR@ STATEDIR = $(BUILDROOT)@CUPS_STATEDIR@ -USBQUIRKS = @USBQUIRKS@ -XINETD = @XINETD@ MAN1EXT = @MAN1EXT@ MAN5EXT = @MAN5EXT@ @@ -230,8 +226,15 @@ MAN8DIR = @MAN8DIR@ PAMDIR = @PAMDIR@ PAMFILE = @PAMFILE@ -DEFAULT_LAUNCHD_CONF = @DEFAULT_LAUNCHD_CONF@ DBUSDIR = @DBUSDIR@ +INITDIR = @INITDIR@ +INITDDIR = @INITDDIR@ +LAUNCHD_DIR = @LAUNCHD_DIR@ +SMFMANIFESTDIR = @SMFMANIFESTDIR@ +SYSTEMD_DIR = @SYSTEMD_DIR@ +XINETD = @XINETD@ + +USBQUIRKS = @USBQUIRKS@ # diff --git a/config-scripts/cups-directories.m4 b/config-scripts/cups-directories.m4 index 41793a169d..f4227506fb 100644 --- a/config-scripts/cups-directories.m4 +++ b/config-scripts/cups-directories.m4 @@ -3,7 +3,7 @@ dnl "$Id$" dnl dnl Directory stuff for CUPS. dnl -dnl Copyright 2007-2013 by Apple Inc. +dnl Copyright 2007-2014 by Apple Inc. dnl Copyright 1997-2007 by Easy Software Products, all rights reserved. dnl dnl These coded instructions, statements, and computer programs are the @@ -139,9 +139,7 @@ if test x$rcdir = x; then case "$uname" in Darwin*) # Darwin and MacOS X... - if test -x /sbin/launchd; then - INITDDIR="/System/Library/LaunchDaemons" - else + if test ! -x /sbin/launchd; then INITDDIR="/System/Library/StartupItems/PrintingServices" fi ;; diff --git a/config-scripts/cups-ondemand.m4 b/config-scripts/cups-ondemand.m4 index 863a9a91ac..b1ea1a3ff8 100644 --- a/config-scripts/cups-ondemand.m4 +++ b/config-scripts/cups-ondemand.m4 @@ -1,7 +1,7 @@ dnl dnl "$Id$" dnl -dnl launchd stuff for CUPS. +dnl Launch-on-demand stuff for CUPS. dnl dnl Copyright 2007-2014 by Apple Inc. dnl Copyright 1997-2005 by Easy Software Products, all rights reserved. @@ -13,11 +13,15 @@ dnl which should have been included with this file. If this file is dnl file is missing or damaged, see the license at "http://www.cups.org/". dnl +ONDEMANDFLAGS="" +ONDEMANDLIBS="" +AC_SUBST(ONDEMANDFLAGS) +AC_SUBST(ONDEMANDLIBS) +dnl Launchd is used on OS X/Darwin... AC_ARG_ENABLE(launchd, [ --disable-launchd disable launchd support]) - -DEFAULT_LAUNCHD_CONF="" -LAUNCHDLIBS="" +LAUNCHD_DIR="" +AC_SUBST(LAUNCHD_DIR) if test x$enable_launchd != xno; then AC_CHECK_FUNC(launch_msg, AC_DEFINE(HAVE_LAUNCHD)) @@ -31,7 +35,7 @@ if test x$enable_launchd != xno; then case "$uname" in Darwin*) # Darwin, MacOS X - DEFAULT_LAUNCHD_CONF="/System/Library/LaunchDaemons/org.cups.cupsd.plist" + LAUNCHD_DIR="/System/Library/LaunchDaemons/org.cups.cupsd.plist" # liblaunch is already part of libSystem ;; *) @@ -40,8 +44,32 @@ if test x$enable_launchd != xno; then esac fi -AC_SUBST(DEFAULT_LAUNCHD_CONF) -AC_SUBST(LAUNCHDLIBS) +dnl Systemd is used on Linux... +AC_ARG_ENABLE(systemd, [ --disable-systemd disable systemd support]) +AC_ARG_WITH(systemd, [ --with-systemd set directory for systemd service files], + SYSTEMD_DIR="$withval", SYSTEMD_DIR="") +AC_SUBST(SYSTEMD_DIR) + +if test x$enable_systemd != xno; then + if test "x$PKGCONFIG" = x; then + if test x$enable_systemd = xyes; then + AC_MSG_ERROR(Need pkg-config to enable systemd support.) + fi + else + AC_MSG_CHECKING(for libsystemd-daemon) + if $PKGCONFIG --exists libsystemd-daemon; then + AC_MSG_RESULT(yes) + ONDEMANDFLAGS=`$PKGCONFIG --cflags libsystemd-daemon` + ONDEMANDLIBS=`$PKGCONFIG --libs libsystemd-daemon` + AC_DEFINE(HAVE_SYSTEMD) + if test "x$SYSTEMD_DIR" = x; then + SYSTEMD_DIR="`$PKGCONFIG --variable=systemdsystemunitdir systemd`" + fi + else + AC_MSG_RESULT(no) + fi + fi +fi dnl dnl End of "$Id$". diff --git a/configure.ac b/configure.ac index 66badb52f2..cf97de7ffd 100644 --- a/configure.ac +++ b/configure.ac @@ -85,6 +85,9 @@ AC_OUTPUT(Makedefs scheduler/cups.sh scheduler/cups.xml scheduler/org.cups.cups-lpd.plist + scheduler/org.cups.cupsd.path + scheduler/org.cups.cupsd.service + scheduler/org.cups.cupsd.socket templates/header.tmpl packaging/cups.list $LANGFILES) diff --git a/scheduler/Makefile b/scheduler/Makefile index 91ac7194e4..4d8393d63e 100644 --- a/scheduler/Makefile +++ b/scheduler/Makefile @@ -184,22 +184,29 @@ install-data: $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc0.d; \ $(LN) ../init.d/cups $(BUILDROOT)$(INITDIR)/rc0.d/K$(RCSTOP)cups; \ fi - if test "x$(INITDIR)" = x -a "x$(INITDDIR)" != x; then \ - $(INSTALL_DIR) $(BUILDROOT)$(INITDDIR); \ - if test "$(INITDDIR)" = "/System/Library/LaunchDaemons"; then \ - echo Installing LaunchDaemons configuration files...; \ - $(INSTALL_DATA) org.cups.cupsd.plist $(BUILDROOT)$(DEFAULT_LAUNCHD_CONF); \ - $(INSTALL_DATA) org.cups.cups-lpd.plist $(BUILDROOT)/System/Library/LaunchDaemons; \ - else \ - echo Installing RC script...; \ - $(INSTALL_SCRIPT) cups.sh $(BUILDROOT)$(INITDDIR)/cups; \ - fi \ + if test "x$(INITDDIR)" != x; then \ + echo Installing init script...; \ + $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDDIR); \ + $(INSTALL_SCRIPT) cups.sh $(BUILDROOT)$(INITDDIR); \ + fi + if test "x$(LAUNCHD_DIR)" != x; then \ + echo Installing launchd configuration files...; \ + $(INSTALL_DIR) $(BUILDROOT)$(LAUNCHD_DIR); \ + $(INSTALL_DATA) org.cups.cupsd.plist $(BUILDROOT)$(LAUNCHD_DIR); \ + $(INSTALL_DATA) org.cups.cups-lpd.plist $(BUILDROOT)$(LAUNCHD_DIR); \ fi if test "x$(SMFMANIFESTDIR)" != x; then \ echo Installing SMF manifest in $(SMFMANIFESTDIR)...;\ $(INSTALL_DIR) $(BUILDROOT)/$(SMFMANIFESTDIR); \ $(INSTALL_SCRIPT) cups.xml $(BUILDROOT)$(SMFMANIFESTDIR)/cups.xml; \ fi + if test "x$(SYSTEMD_DIR)" != x; then \ + echo Installing systemd configuration files...; \ + $(INSTALL_DIR) $(BUILDROOT)$(SYSTEMD_DIR); \ + $(INSTALL_DATA) org.cups.cupsd.path $(BUILDROOT)$(SYSTEMD_DIR); \ + $(INSTALL_DATA) org.cups.cupsd.service $(BUILDROOT)$(SYSTEMD_DIR); \ + $(INSTALL_DATA) org.cups.cupsd.socket $(BUILDROOT)$(SYSTEMD_DIR); \ + fi if test "x$(XINETD)" != x; then \ echo Installing xinetd configuration file for cups-lpd...; \ $(INSTALL_DIR) -m 755 $(BUILDROOT)$(XINETD); \ diff --git a/scheduler/org.cups.cupsd.path.in b/scheduler/org.cups.cupsd.path.in new file mode 100644 index 0000000000..1bccc6f9d0 --- /dev/null +++ b/scheduler/org.cups.cupsd.path.in @@ -0,0 +1,8 @@ +[Unit] +Description=CUPS Scheduler + +[Path] +PathExists=@CUPS_CACHEDIR@/org.cups.cupsd + +[Install] +WantedBy=multi-user.target diff --git a/scheduler/org.cups.cupsd.service.in b/scheduler/org.cups.cupsd.service.in new file mode 100644 index 0000000000..43900167be --- /dev/null +++ b/scheduler/org.cups.cupsd.service.in @@ -0,0 +1,10 @@ +[Unit] +Description=CUPS Scheduler + +[Service] +ExecStart=@sbindir@/cupsd -l +Type=simple + +[Install] +Also=org.cups.cupsd.socket org.cups.cupsd.path +WantedBy=printer.target diff --git a/scheduler/org.cups.cupsd.socket.in b/scheduler/org.cups.cupsd.socket.in new file mode 100644 index 0000000000..c705c3762e --- /dev/null +++ b/scheduler/org.cups.cupsd.socket.in @@ -0,0 +1,11 @@ +[Unit] +Description=CUPS Scheduler + +[Socket] +ListenStream=@CUPS_DEFAULT_DOMAINSOCKET@ +ListenStream=[::1]:631 +ListenStream=127.0.0.1:631 +BindIPv6Only=ipv6-only + +[Install] +WantedBy=sockets.target diff --git a/xcode/CUPS.xcodeproj/project.pbxproj b/xcode/CUPS.xcodeproj/project.pbxproj index 640eb913bf..7e099b4a8f 100644 --- a/xcode/CUPS.xcodeproj/project.pbxproj +++ b/xcode/CUPS.xcodeproj/project.pbxproj @@ -1400,6 +1400,14 @@ 72E65BD218DC7A9800097E89 /* raster-driver.shtml */ = {isa = PBXFileReference; lastKnownFileType = text.html.other; name = "raster-driver.shtml"; path = "../filter/raster-driver.shtml"; sourceTree = ""; }; 72E65BD318DC7A9800097E89 /* spec-ppd.header */ = {isa = PBXFileReference; lastKnownFileType = text; name = "spec-ppd.header"; path = "../filter/spec-ppd.header"; sourceTree = ""; }; 72E65BD418DC7A9800097E89 /* spec-ppd.shtml */ = {isa = PBXFileReference; lastKnownFileType = text.html.other; name = "spec-ppd.shtml"; path = "../filter/spec-ppd.shtml"; sourceTree = ""; }; + 72E65BD518DC818400097E89 /* org.cups.cups-lpd.plist.in */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = "org.cups.cups-lpd.plist.in"; path = "../scheduler/org.cups.cups-lpd.plist.in"; sourceTree = SOURCE_ROOT; }; + 72E65BD618DC818400097E89 /* org.cups.cupsd.path.in */ = {isa = PBXFileReference; lastKnownFileType = text; name = org.cups.cupsd.path.in; path = ../scheduler/org.cups.cupsd.path.in; sourceTree = SOURCE_ROOT; }; + 72E65BD718DC818400097E89 /* org.cups.cupsd.service.in */ = {isa = PBXFileReference; lastKnownFileType = text; name = org.cups.cupsd.service.in; path = ../scheduler/org.cups.cupsd.service.in; sourceTree = SOURCE_ROOT; }; + 72E65BD818DC818400097E89 /* org.cups.cupsd.socket.in */ = {isa = PBXFileReference; lastKnownFileType = text; name = org.cups.cupsd.socket.in; path = ../scheduler/org.cups.cupsd.socket.in; sourceTree = SOURCE_ROOT; }; + 72E65BD918DC850A00097E89 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = ../Makefile; sourceTree = ""; }; + 72E65BDA18DC852700097E89 /* api-mime.header */ = {isa = PBXFileReference; lastKnownFileType = text; name = "api-mime.header"; path = "../scheduler/api-mime.header"; sourceTree = SOURCE_ROOT; }; + 72E65BDB18DC852700097E89 /* api-mime.shtml */ = {isa = PBXFileReference; lastKnownFileType = text.html.other; name = "api-mime.shtml"; path = "../scheduler/api-mime.shtml"; sourceTree = SOURCE_ROOT; }; + 72E65BDC18DC852700097E89 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = ../scheduler/Makefile; sourceTree = SOURCE_ROOT; }; 72F75A521336F950004BB496 /* cupstestppd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = cupstestppd; sourceTree = BUILT_PRODUCTS_DIR; }; 72F75A5B1336F988004BB496 /* cupstestppd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cupstestppd.c; path = ../systemv/cupstestppd.c; sourceTree = ""; }; 72F75A611336F9A3004BB496 /* libcupsimage.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libcupsimage.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1935,8 +1943,13 @@ 72220F5D13330A5A00FCA411 /* cupsd */ = { isa = PBXGroup; children = ( + 72E65BDC18DC852700097E89 /* Makefile */, 7226369B18AE6D19004ED309 /* org.cups.cups-lpd.plist */, + 72E65BD518DC818400097E89 /* org.cups.cups-lpd.plist.in */, + 72E65BD618DC818400097E89 /* org.cups.cupsd.path.in */, 7226369C18AE6D19004ED309 /* org.cups.cupsd.plist */, + 72E65BD718DC818400097E89 /* org.cups.cupsd.service.in */, + 72E65BD818DC818400097E89 /* org.cups.cupsd.socket.in */, 72D53A3615B4929D003F877F /* colorman.c */, 72D53A3715B4929D003F877F /* colorman.h */, 72220F6913330B0C00FCA411 /* auth.c */, @@ -2085,6 +2098,7 @@ 72E65BA218DC796500097E89 /* Autoconf Files */ = { isa = PBXGroup; children = ( + 72E65BD918DC850A00097E89 /* Makefile */, 72E65BB718DC79CC00097E89 /* Makedefs.in */, 72E65BA318DC797E00097E89 /* configure.ac */, 7226369D18AE73BB004ED309 /* config.h.in */, @@ -2126,6 +2140,8 @@ 72E65BC218DC7A6B00097E89 /* api-filter.shtml */, 72E65BC318DC7A6B00097E89 /* api-httpipp.header */, 72E65BC418DC7A6B00097E89 /* api-httpipp.shtml */, + 72E65BDA18DC852700097E89 /* api-mime.header */, + 72E65BDB18DC852700097E89 /* api-mime.shtml */, 72E65BC518DC7A6B00097E89 /* api-overview.header */, 72E65BC618DC7A6B00097E89 /* api-overview.shtml */, 72E65BC718DC7A6B00097E89 /* api-ppd.header */,