diff options
author | Michael Raskin <7c6f434c@mail.ru> | 2014-11-15 15:18:35 +0300 |
---|---|---|
committer | Michael Raskin <7c6f434c@mail.ru> | 2014-11-15 15:18:35 +0300 |
commit | a7c8d00b2742c8594796a7c3f2c2316db38da1fa (patch) | |
tree | 03149ae096368573873e7fba329d054a9ba36f92 /pkgs/misc | |
parent | 48867b98aabf7fd1490516f00f0b5c6781c5c121 (diff) | |
parent | a75d294516d6b09036657d0788e3f8aebe4c8ffa (diff) | |
download | nixlib-a7c8d00b2742c8594796a7c3f2c2316db38da1fa.tar nixlib-a7c8d00b2742c8594796a7c3f2c2316db38da1fa.tar.gz nixlib-a7c8d00b2742c8594796a7c3f2c2316db38da1fa.tar.bz2 nixlib-a7c8d00b2742c8594796a7c3f2c2316db38da1fa.tar.lz nixlib-a7c8d00b2742c8594796a7c3f2c2316db38da1fa.tar.xz nixlib-a7c8d00b2742c8594796a7c3f2c2316db38da1fa.tar.zst nixlib-a7c8d00b2742c8594796a7c3f2c2316db38da1fa.zip |
Merge pull request #4857 from abbradar/cups2
[WIP] Improve printing experience and update related packages
Diffstat (limited to 'pkgs/misc')
-rw-r--r-- | pkgs/misc/cups/default.nix | 21 | ||||
-rw-r--r-- | pkgs/misc/cups/drivers/cups-filters/default.nix | 35 | ||||
-rw-r--r-- | pkgs/misc/cups/drivers/cups-filters/fix-cups-path.patch | 26 | ||||
-rw-r--r-- | pkgs/misc/cups/pdf-filter.nix | 39 | ||||
-rw-r--r-- | pkgs/misc/cups/use-initgroups.patch | 80 | ||||
-rw-r--r-- | pkgs/misc/drivers/foomatic-filters/default.nix | 4 | ||||
-rw-r--r-- | pkgs/misc/ghostscript/default.nix | 113 | ||||
-rw-r--r-- | pkgs/misc/ghostscript/purity.patch | 26 |
8 files changed, 197 insertions, 147 deletions
diff --git a/pkgs/misc/cups/default.nix b/pkgs/misc/cups/default.nix index c332dc021546..56ccf7bd04ac 100644 --- a/pkgs/misc/cups/default.nix +++ b/pkgs/misc/cups/default.nix @@ -1,24 +1,27 @@ -{ stdenv, fetchurl, pkgconfig, zlib, libjpeg, libpng, libtiff, pam, openssl +{ stdenv, fetchurl, pkgconfig, zlib, pam, openssl , dbus, libusb, acl }: -let version = "1.5.4"; in +let version = "2.0.0"; in -stdenv.mkDerivation { +stdenv.mkDerivation rec { name = "cups-${version}"; - passthru = { inherit version; }; - src = fetchurl { - url = "https://www.cups.org/software/${version}/cups-${version}-source.tar.bz2"; - sha256 = "1rfhlv9b37120d6shngvyrcp99vh4a3lwdkrfanv3sjqid7068w0"; + url = "https://www.cups.org/software/${version}/${name}-source.tar.bz2"; + sha256 = "1qjv1w8m3f9lbrnd9wx8gman4sjbgb75svfypd4jkn649b5vpzc3"; }; - buildInputs = [ pkgconfig zlib libjpeg libpng libtiff libusb ] + buildInputs = [ pkgconfig zlib libusb ] ++ stdenv.lib.optionals stdenv.isLinux [ pam dbus.libs acl ] ; propagatedBuildInputs = [ openssl ]; - configureFlags = "--localstatedir=/var --enable-dbus"; # --with-dbusdir + patches = [ ./use-initgroups.patch ]; + + configureFlags = [ "--localstatedir=/var" "--enable-dbus" + # Workaround for installing systemd path + "--with-systemd=$out/lib/systemd/system" + ]; installFlags = [ # Don't try to write in /var at build time. diff --git a/pkgs/misc/cups/drivers/cups-filters/default.nix b/pkgs/misc/cups/drivers/cups-filters/default.nix new file mode 100644 index 000000000000..0357b875dc71 --- /dev/null +++ b/pkgs/misc/cups/drivers/cups-filters/default.nix @@ -0,0 +1,35 @@ +{ stdenv, fetchurl, autoreconfHook, pkgconfig, cups, libjpeg, ghostscript +, dejavu_fonts, libpng, libtiff, glib, lcms, freetype, fontconfig, ijs, poppler +, zlib, qpdf, dbus }: + +stdenv.mkDerivation rec { + name = "cups-filters-1.0.61"; + + src = fetchurl { + url = "https://www.openprinting.org/download/cups-filters/${name}.tar.gz"; + sha256 = "0mri36qih4vniycbga8aczmdf0qkiwyyi5hv8x9mg2f6a9wj8ch9"; + }; + + configureFlags = [ "--with-test-font-path=${dejavu_fonts}/share/fonts/truetype/DejaVuSans.ttf" + "--with-cups-domainsocket=/var/run/cups/cups.sock" + "--with-rcdir=no" + ]; + + buildInputs = [ ghostscript cups libjpeg libpng libtiff glib lcms freetype fontconfig + poppler zlib ijs qpdf dbus + ]; + + patches = [ ./fix-cups-path.patch ]; + + nativeBuildInputs = [ pkgconfig autoreconfHook ]; + + doCheck = true; + + meta = with stdenv.lib; { + homepage = http://www.linuxfoundation.org/collaborate/workgroups/openprinting/cups-filters; + description = "Backends, filters, and other software that was once part of the core CUPS distribution"; + license = "cups-filters"; + maintainers = maintainers.abbradar; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/misc/cups/drivers/cups-filters/fix-cups-path.patch b/pkgs/misc/cups/drivers/cups-filters/fix-cups-path.patch new file mode 100644 index 000000000000..6e6683220611 --- /dev/null +++ b/pkgs/misc/cups/drivers/cups-filters/fix-cups-path.patch @@ -0,0 +1,26 @@ +diff -ru3 cups-filters-1.0.61-old/configure.ac cups-filters-1.0.61/configure.ac +--- cups-filters-1.0.61-old/configure.ac 2014-11-04 23:48:35.185515564 +0300 ++++ cups-filters-1.0.61/configure.ac 2014-11-05 00:01:57.132038500 +0300 +@@ -92,11 +92,11 @@ + AC_SUBST(CUPS_CFLAGS) + AC_SUBST(CUPS_LIBS) + +-CUPS_DATADIR="`$CUPSCONFIG --datadir`" ++CUPS_DATADIR="$out/share/cups" + AC_DEFINE_UNQUOTED(CUPS_DATADIR, "$CUPS_DATADIR", [CUPS datadir]) + AC_SUBST(CUPS_DATADIR) + +-CUPS_SERVERROOT="`$CUPSCONFIG --serverroot`" ++CUPS_SERVERROOT="$out/etc/cups" + AC_DEFINE_UNQUOTED(CUPS_SERVERROOT, "$CUPS_SERVERROOT", [CUPS serverroot]) + AC_SUBST(CUPS_SERVERROOT) + +@@ -104,7 +104,7 @@ + AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$CUPS_FONTPATH", [Path to CUPS fonts dir]) + AC_SUBST(CUPS_FONTPATH) + +-CUPS_SERVERBIN="`$CUPSCONFIG --serverbin`" ++CUPS_SERVERBIN="$out/lib/cups" + AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$CUPS_SERVERBIN", [Path to CUPS binaries dir]) + AC_SUBST(CUPS_SERVERBIN) + diff --git a/pkgs/misc/cups/pdf-filter.nix b/pkgs/misc/cups/pdf-filter.nix deleted file mode 100644 index e99ad03212c2..000000000000 --- a/pkgs/misc/cups/pdf-filter.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ stdenv, fetchurl, pkgconfig, cups, poppler }: - -stdenv.mkDerivation { - name = "cups-pdf-filter-${cups.version}"; - - inherit (cups) src; - - buildInputs = [ pkgconfig cups poppler ]; - - preConfigure = '' - sed -e 's@\.\./cups/$(LIBCUPS)@@' -e 's@$(LIBCUPSIMAGE)@@' -i filter/Makefile - ''; - - NIX_LDFLAGS="-L${cups}/lib"; - - configureFlags = '' - --localstatedir=/var --enable-dbus - --enable-image --with-pdftops=pdftops''; - - buildPhase = '' - cd filter - make pdftops - ''; - - installPhase = '' - mkdir -pv $out/lib/cups/filter $out/share/cups/mime - cp -v pdftops $out/lib/cups/filter - echo >$out/share/cups/mime/pdftops.convs 'application/pdf application/vnd.cups-postscript 66 pdftops' - ''; - - - meta = { - homepage = http://www.cups.org/; - description = "Image and pdf filters for CUPS"; - license = stdenv.lib.licenses.gpl2; - maintainers = [ stdenv.lib.maintainers.urkud ]; - platforms = stdenv.lib.platforms.linux; - }; -} diff --git a/pkgs/misc/cups/use-initgroups.patch b/pkgs/misc/cups/use-initgroups.patch new file mode 100644 index 000000000000..3976ce74a8a4 --- /dev/null +++ b/pkgs/misc/cups/use-initgroups.patch @@ -0,0 +1,80 @@ +diff -ru3 cups-2.0.0-old/scheduler/cups-exec.c cups-2.0.0/scheduler/cups-exec.c +--- cups-2.0.0-old/scheduler/cups-exec.c 2014-11-04 19:55:05.734768315 +0300 ++++ cups-2.0.0/scheduler/cups-exec.c 2014-11-04 20:24:15.936670878 +0300 +@@ -25,6 +25,7 @@ + #include <unistd.h> + #include <fcntl.h> + #include <grp.h> ++#include <pwd.h> + #include <sys/stat.h> + #ifdef HAVE_SANDBOX_H + # include <sandbox.h> +@@ -55,6 +56,7 @@ + uid_t uid = getuid(); /* UID */ + gid_t gid = getgid(); /* GID */ + int niceval = 0; /* Nice value */ ++ struct passwd *pwd; /* User passwd entry */ + #ifdef HAVE_SANDBOX_H + char *sandbox_error = NULL; /* Sandbox error, if any */ + #endif /* HAVE_SANDBOX_H */ +@@ -135,7 +137,15 @@ + if (setgid(gid)) + exit(errno + 100); + +- if (setgroups(1, &gid)) ++ if (uid) ++ { ++ if ((pwd = getpwuid(uid)) == NULL) ++ exit(errno + 100); ++ ++ if (initgroups(pwd->pw_name, gid)) ++ exit(errno + 100); ++ } ++ else if (setgroups(1, &gid)) + exit(errno + 100); + + if (uid && setuid(uid)) +diff -ru3 cups-2.0.0-old/scheduler/process.c cups-2.0.0/scheduler/process.c +--- cups-2.0.0-old/scheduler/process.c 2014-11-04 19:55:05.736768298 +0300 ++++ cups-2.0.0/scheduler/process.c 2014-11-04 20:23:55.001850057 +0300 +@@ -19,6 +19,7 @@ + + #include "cupsd.h" + #include <grp.h> ++#include <pwd.h> + #ifdef __APPLE__ + # include <libgen.h> + #endif /* __APPLE__ */ +@@ -462,6 +463,7 @@ + cups_exec[1024]; /* Path to "cups-exec" program */ + uid_t user; /* Command UID */ + cupsd_proc_t *proc; /* New process record */ ++ struct passwd *pwd; /* User passwd entry */ + #ifdef HAVE_POSIX_SPAWN + posix_spawn_file_actions_t actions; /* Spawn file actions */ + posix_spawnattr_t attrs; /* Spawn attributes */ +@@ -716,13 +718,22 @@ + nice(FilterNice); + + /* +- * Reset group membership to just the main one we belong to. ++ * Reset group membership to the main one we belong to with its ++ * supplementary groups. + */ + + if (!RunUser && setgid(Group)) + exit(errno + 100); + +- if (!RunUser && setgroups(1, &Group)) ++ if (!RunUser && user) ++ { ++ if ((pwd = getpwuid(user)) == NULL) ++ exit(errno + 100); ++ ++ if (initgroups(pwd->pw_name, Group)) ++ exit(errno + 100); ++ } ++ else if (!RunUser && setgroups(1, &Group)) + exit(errno + 100); + + /* diff --git a/pkgs/misc/drivers/foomatic-filters/default.nix b/pkgs/misc/drivers/foomatic-filters/default.nix index ffc5e093c218..bdba1eb7b817 100644 --- a/pkgs/misc/drivers/foomatic-filters/default.nix +++ b/pkgs/misc/drivers/foomatic-filters/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, pkgconfig, perl, cups, dbus }: +{ stdenv, fetchurl, pkgconfig, perl, cups, dbus, enscript }: stdenv.mkDerivation rec { name = "foomatic-filters-4.0.17"; @@ -8,7 +8,7 @@ stdenv.mkDerivation rec { sha256 = "1qrkgbm5jay2r7sh9qbyf0aiyrsl1mdc844hxf7fhw95a0zfbqm2"; }; - buildInputs = [ pkgconfig perl cups dbus ]; + buildInputs = [ pkgconfig perl cups dbus enscript ]; preConfigure = '' diff --git a/pkgs/misc/ghostscript/default.nix b/pkgs/misc/ghostscript/default.nix index b8c879d598ba..9e753d8f8302 100644 --- a/pkgs/misc/ghostscript/default.nix +++ b/pkgs/misc/ghostscript/default.nix @@ -3,70 +3,19 @@ , libiconvOrEmpty , x11Support ? false, x11 ? null , cupsSupport ? false, cups ? null -, gnuFork ? true }: assert x11Support -> x11 != null; assert cupsSupport -> cups != null; -let - meta_common = { - homepage = "http://www.gnu.org/software/ghostscript/"; - description = "PostScript interpreter (GNU version)"; - - longDescription = '' - Ghostscript is the name of a set of tools that provides (i) an - interpreter for the PostScript language and the PDF file format, - (ii) a set of C procedures (the Ghostscript library) that - implement the graphics capabilities that appear as primitive - operations in the PostScript language, and (iii) a wide variety - of output drivers for various file formats and printers. - ''; - - license = stdenv.lib.licenses.gpl3Plus; - - platforms = stdenv.lib.platforms.all; - maintainers = [ stdenv.lib.maintainers.viric ]; - }; - - gnuForkSrc = rec { - name = "ghostscript-9.04.1"; - src = fetchurl { - url = "mirror://gnu/ghostscript/gnu-${name}.tar.bz2"; - sha256 = "0zqa6ggbkdqiszsywgrra4ij0sddlmrfa50bx2mh568qid4ga0a2"; - }; - - meta = meta_common; - patches = [ ./purity.patch ]; - }; +stdenv.mkDerivation rec { + name = "ghostscript-9.15"; - mainlineSrc = rec { - name = "ghostscript-9.06"; - src = fetchurl { - url = "http://downloads.ghostscript.com/public/${name}.tar.bz2"; - sha256 = "014f10rxn4ihvcr1frby4szd1jvkrwvmdhnbivpp55c9fssx3b05"; - }; - meta = meta_common // { - homepage = "http://www.ghostscript.com/"; - description = "PostScript interpreter (mainline version)"; - }; - - preConfigure = '' - rm -R libpng jpeg lcms{,2} tiff freetype jbig2dec expat openjpeg - - substituteInPlace base/unix-aux.mak --replace "INCLUDE=/usr/include" "INCLUDE=/no-such-path" - sed "s@if ( test -f \$(INCLUDE)[^ ]* )@if ( true )@" -i base/unix-aux.mak - ''; - patches = []; + src = fetchurl { + url = "http://downloads.ghostscript.com/public/${name}.tar.bz2"; + sha256 = "0p1isp6ssfay141klirn7n9s8b546vcz6paksfmksbwy0ljsypg6"; }; - variant = if gnuFork then gnuForkSrc else mainlineSrc; - -in - -stdenv.mkDerivation rec { - inherit (variant) name src meta; - fonts = [ (fetchurl { url = "mirror://sourceforge/gs-fonts/ghostscript-fonts-std-8.11.tar.gz"; @@ -91,34 +40,56 @@ stdenv.mkDerivation rec { # [] # maybe sometimes jpeg2000 support ; - CFLAGS = "-fPIC"; - NIX_LDFLAGS = - "-lz -rpath${ if stdenv.isDarwin then " " else "="}${freetype}/lib"; + patches = [ ./urw-font-files.patch ]; - patches = variant.patches ++ [ ./urw-font-files.patch ]; - - preConfigure = '' - # "ijs" is impure: it contains symlinks to /usr/share/automake etc.! - rm -rf ijs/ltmain.sh - - # Don't install stuff in the Cups store path. - makeFlagsArray=(CUPSSERVERBIN=$out/lib/cups CUPSSERVERROOT=$out/etc/cups CUPSDATA=$out/share/cups) - '' + stdenv.lib.optionalString (variant ? preConfigure) variant.preConfigure; + makeFlags = [ "cups_serverroot=$(out)" "cups_serverbin=$(out)/lib/cups" ]; configureFlags = - [ "--with-system-libtiff" + [ "--with-system-libtiff" "--disable-sse2" + "--enable-dynamic" (if x11Support then "--with-x" else "--without-x") - (if cupsSupport then "--enable-cups --with-install-cups" else "--disable-cups") + (if cupsSupport then "--enable-cups" else "--disable-cups") ]; doCheck = true; installTargets="install soinstall"; - # ToDo: web says the fonts should be already included + #CFLAGS = "-fPIC"; + #NIX_LDFLAGS = + # "-lz -rpath${ if stdenv.isDarwin then " " else "="}${freetype}/lib"; + + preConfigure = '' + rm -rf jpeg libpng zlib jasper expat tiff lcms{,2} jbig2dec openjpeg freetype cups/libs + + sed "s@if ( test -f \$(INCLUDE)[^ ]* )@if ( true )@; s@INCLUDE=/usr/include@INCLUDE=/no-such-path@" -i base/unix-aux.mak + ''; + postInstall = '' + # ToDo: web says the fonts should be already included for i in $fonts; do (cd $out/share/ghostscript && tar xvfz $i) done + + rm -rf $out/lib/cups/filter/{gstopxl,gstoraster} ''; + + meta = { + homepage = "http://www.ghostscript.com/"; + description = "PostScript interpreter (mainline version)"; + + longDescription = '' + Ghostscript is the name of a set of tools that provides (i) an + interpreter for the PostScript language and the PDF file format, + (ii) a set of C procedures (the Ghostscript library) that + implement the graphics capabilities that appear as primitive + operations in the PostScript language, and (iii) a wide variety + of output drivers for various file formats and printers. + ''; + + license = stdenv.lib.licenses.gpl3Plus; + + platforms = stdenv.lib.platforms.all; + maintainers = [ stdenv.lib.maintainers.viric ]; + }; } diff --git a/pkgs/misc/ghostscript/purity.patch b/pkgs/misc/ghostscript/purity.patch deleted file mode 100644 index 1c92ecf593a7..000000000000 --- a/pkgs/misc/ghostscript/purity.patch +++ /dev/null @@ -1,26 +0,0 @@ -Don't look for files under `/usr/include' since we don't have that directory -under NixOS. - ---- gnu-ghostscript-8.64.0/base/unix-aux.mak 2009-04-19 19:00:20.000000000 +0200 -+++ gnu-ghostscript-8.64.0/base/unix-aux.mak 2009-04-27 11:58:31.000000000 +0200 -@@ -103,13 +103,13 @@ $(MKROMFS_XE): $(GLSRC)mkromfs.c $(MKROM - # The "else true;" is required because Ultrix's implementation of sh -e - # terminates execution of a command if any error occurs, even if the command - # traps the error with ||. --INCLUDE=/usr/include -+INCLUDE=/no-such-path - $(gconfig__h): $(UNIX_AUX_MAK) $(ECHOGS_XE) - $(ECHOGS_XE) -w $(gconfig__h) -x 2f2a -s This file was generated automatically by unix-aux.mak. -s -x 2a2f -- if ( test -f $(INCLUDE)/dirent.h ); then $(ECHOGS_XE) -a $(gconfig__h) -x 23 define HAVE_DIRENT_H; else true; fi -- if ( test -f $(INCLUDE)/ndir.h ); then $(ECHOGS_XE) -a $(gconfig__h) -x 23 define HAVE_NDIR_H; else true; fi -- if ( test -f $(INCLUDE)/sys/dir.h ); then $(ECHOGS_XE) -a $(gconfig__h) -x 23 define HAVE_SYS_DIR_H; else true; fi -- if ( test -f $(INCLUDE)/sys/ndir.h ); then $(ECHOGS_XE) -a $(gconfig__h) -x 23 define HAVE_SYS_NDIR_H; else true; fi -- if ( test -f $(INCLUDE)/sys/time.h ); then $(ECHOGS_XE) -a $(gconfig__h) -x 23 define HAVE_SYS_TIME_H; else true; fi -- if ( test -f $(INCLUDE)/sys/times.h ); then $(ECHOGS_XE) -a $(gconfig__h) -x 23 define HAVE_SYS_TIMES_H; else true; fi -+ if ( true ); then $(ECHOGS_XE) -a $(gconfig__h) -x 23 define HAVE_DIRENT_H; else true; fi -+ if ( true ); then $(ECHOGS_XE) -a $(gconfig__h) -x 23 define HAVE_NDIR_H; else true; fi -+ if ( true ); then $(ECHOGS_XE) -a $(gconfig__h) -x 23 define HAVE_SYS_DIR_H; else true; fi -+ if ( true ); then $(ECHOGS_XE) -a $(gconfig__h) -x 23 define HAVE_SYS_NDIR_H; else true; fi -+ if ( true ); then $(ECHOGS_XE) -a $(gconfig__h) -x 23 define HAVE_SYS_TIME_H; else true; fi -+ if ( true ); then $(ECHOGS_XE) -a $(gconfig__h) -x 23 define HAVE_SYS_TIMES_H; else true; fi - if ( test -f $(JSRCDIR)/jmemsys.h); then true; else $(ECHOGS_XE) -a $(gconfig__h) -x 23 define DONT_HAVE_JMEMSYS_H; fi |