Merge pull request #32207 from peterhoeg/u/cups

cups: 2.2.2 -> 2.2.6
This commit is contained in:
Orivej Desh 2017-12-07 07:23:14 +00:00 committed by GitHub
commit d104321b38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 27 deletions

View File

@ -39,7 +39,7 @@ import ./make-test.nix ({pkgs, ... }: {
$client->waitForUnit("cups.service");
$client->sleep(10); # wait until cups is fully initialized
$client->succeed("lpstat -r") =~ /scheduler is running/ or die;
$client->succeed("lpstat -H") =~ "/var/run/cups/cups.sock" or die;
$client->succeed("lpstat -H") =~ "localhost:631" or die;
$client->succeed("curl --fail http://localhost:631/");
$client->succeed("curl --fail http://server:631/");
$server->fail("curl --fail --connect-timeout 2 http://client:631/");

View File

@ -1,5 +1,5 @@
{ stdenv, fetchurl, pkgconfig, zlib, libjpeg, libpng, libtiff, pam
, dbus, systemd, acl, gmp, darwin
{ stdenv, fetchurl, fetchpatch, pkgconfig, removeReferencesTo
, zlib, libjpeg, libpng, libtiff, pam, dbus, systemd, acl, gmp, darwin
, libusb ? null, gnutls ? null, avahi ? null, libpaper ? null
}:
@ -9,18 +9,26 @@
with stdenv.lib;
stdenv.mkDerivation rec {
name = "cups-${version}";
version = "2.2.2";
version = "2.2.6";
passthru = { inherit version; };
src = fetchurl {
url = "https://github.com/apple/cups/releases/download/v${version}/cups-${version}-source.tar.gz";
sha256 = "1xp4ji4rz3xffsz6w6nd60ajxvvihn02pkyp2l4smhqxbmyvp2gm";
sha256 = "16qn41b84xz6khrr2pa2wdwlqxr29rrrkjfi618gbgdkq9w5ff20";
};
outputs = [ "out" "lib" "dev" "man" ];
nativeBuildInputs = [ pkgconfig ];
patches = [
(fetchpatch {
url = "https://git.archlinux.org/svntogit/packages.git/plain/trunk/cups-systemd-socket.patch?h=packages/cups";
sha256 = "1ddgdlg9s0l2ph6l8lx1m1lx6k50gyxqi3qiwr44ppq1rxs80ny5";
})
];
nativeBuildInputs = [ pkgconfig removeReferencesTo ];
buildInputs = [ zlib libjpeg libpng libtiff libusb gnutls libpaper ]
++ optionals stdenv.isLinux [ avahi pam dbus systemd acl ]
++ optionals stdenv.isDarwin (with darwin; [
@ -30,16 +38,9 @@ stdenv.mkDerivation rec {
propagatedBuildInputs = [ gmp ];
configureFlags = [
# Put just lib/* and locale into $lib; this didn't work directly.
# lib/cups is moved back to $out in postInstall.
# Beware: some parts of cups probably don't fully respect these.
"--prefix=$(lib)"
"--datadir=$(out)/share"
"--localedir=$(lib)/share/locale"
"--localstatedir=/var"
"--sysconfdir=/etc"
"--with-systemd=\${out}/lib/systemd/system"
"--with-rundir=/run"
"--enable-raw-printing"
"--enable-threads"
] ++ optionals stdenv.isLinux [
@ -49,15 +50,24 @@ stdenv.mkDerivation rec {
++ optional (gnutls != null) "--enable-ssl"
++ optional (avahi != null) "--enable-avahi"
++ optional (libpaper != null) "--enable-libpaper"
++ optionals stdenv.isDarwin [
"--with-bundledir=$out"
"--disable-launchd"
];
++ optional stdenv.isDarwin "--disable-launchd";
# XXX: Hackery until https://github.com/NixOS/nixpkgs/issues/24693
preBuild = if stdenv.isDarwin then ''
export DYLD_FRAMEWORK_PATH=/System/Library/Frameworks
'' else null;
preConfigure = ''
configureFlagsArray+=(
# Put just lib/* and locale into $lib; this didn't work directly.
# lib/cups is moved back to $out in postInstall.
# Beware: some parts of cups probably don't fully respect these.
"--prefix=$lib"
"--datadir=$out/share"
"--localedir=$lib/share/locale"
"--with-systemd=$out/lib/systemd/system"
${optionalString stdenv.isDarwin ''
"--with-bundledir=$out"
''}
)
'';
installFlags =
[ # Don't try to write in /var at build time.
@ -80,21 +90,26 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
postInstall = ''
moveToOutput lib/cups "$out"
libexec=${if stdenv.isDarwin then "libexec/cups" else "lib/cups"}
moveToOutput $libexec "$out"
# $lib contains references to $out/share/cups.
# CUPS is working without them, so they are not vital.
find "$lib" -type f -exec grep -q "$out" {} \; \
-printf "removing references from %p\n" \
-exec remove-references-to -t "$out" {} +
# Delete obsolete stuff that conflicts with cups-filters.
rm -rf $out/share/cups/banners $out/share/cups/data/testprint
# Some outputs in cups-config were unexpanded and some even wrong.
moveToOutput bin/cups-config "$dev"
sed -e "/^cups_serverbin=/s|\$(lib)|$out|" \
-e "s|\$(out)|$out|" \
-e "s|\$(lib)|$lib|" \
sed -e "/^cups_serverbin=/s|$lib|$out|" \
-i "$dev/bin/cups-config"
# Rename systemd files provided by CUPS
for f in "$out"/lib/systemd/system/*; do
substituteInPlace "$f" \
--replace "$lib/$libexec" "$out/$libexec" \
--replace "org.cups.cupsd" "cups" \
--replace "org.cups." ""