summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2011-08-20 23:14:32 +0000
committerroot <root@rshg054.dnsready.net>2011-08-20 23:14:32 +0000
commit839141249778baa4dba0f0511c52b5eded3cd934 (patch)
tree6c3df2941048911b4126ea70a46816110bddf514
parentc6a4d3790fc33558d9af322dac15d2bd6d34ac0b (diff)
Sat Aug 20 23:14:32 UTC 2011
-rw-r--r--community-testing/speed-dreams/PKGBUILD55
-rw-r--r--community-testing/speed-dreams/speed-dreams.desktop9
-rw-r--r--community-testing/speed-dreams/speed-dreams.sh3
-rw-r--r--community/dwm/PKGBUILD6
-rw-r--r--community/dwm/dwm.install11
-rw-r--r--community/luxrays/PKGBUILD12
-rw-r--r--community/luxrender/PKGBUILD17
-rw-r--r--community/luxrender/luxrender.install10
-rw-r--r--community/sawfish/PKGBUILD12
-rw-r--r--community/systemd/0001-convert-int-to-boolean-for-dbus_bool_t.patch25
-rw-r--r--community/systemd/PKGBUILD15
-rw-r--r--community/unhide/PKGBUILD31
-rw-r--r--community/xalan-c/1.11.0_pre797991-parallel-build.patch62
-rw-r--r--community/xalan-c/PKGBUILD33
-rw-r--r--extra/kdepim/PKGBUILD9
-rw-r--r--extra/php-apc/PKGBUILD4
-rw-r--r--extra/php-suhosin/PKGBUILD4
-rw-r--r--extra/php/PKGBUILD47
-rw-r--r--extra/php/php-fpm.conf.in.patch12
-rw-r--r--extra/potrace/PKGBUILD16
-rw-r--r--extra/rrdtool/PKGBUILD11
-rw-r--r--extra/thunar/PKGBUILD16
-rw-r--r--extra/thunar/fix-gvfs.patch148
-rw-r--r--extra/xpdf/PKGBUILD106
-rw-r--r--extra/xpdf/char.patch12
-rw-r--r--extra/xpdf/desktop9
-rw-r--r--extra/xpdf/install11
-rw-r--r--testing/cups/PKGBUILD20
-rw-r--r--testing/cups/cups-avahi.patch2353
-rw-r--r--testing/cups/cups-no-gcrypt.patch33
-rw-r--r--testing/gpsd/PKGBUILD78
-rwxr-xr-xtesting/gpsd/gpsd43
-rw-r--r--testing/gpsd/gpsd.install16
-rw-r--r--testing/inetutils/PKGBUILD79
-rw-r--r--testing/inetutils/dnsdomainname3
-rw-r--r--testing/inetutils/domainname3
-rw-r--r--testing/inetutils/ftpd.conf4
-rw-r--r--testing/inetutils/ftpd.rc37
-rw-r--r--testing/inetutils/inetutils.install20
-rw-r--r--testing/inetutils/rexec.xinetd10
-rw-r--r--testing/inetutils/rlogin.xinetd10
-rw-r--r--testing/inetutils/rsh.xinetd10
-rw-r--r--testing/inetutils/talk.xinetd10
-rw-r--r--testing/inetutils/telnet.xinetd10
-rw-r--r--testing/lvm2/PKGBUILD8
-rw-r--r--testing/net-tools/PKGBUILD43
-rw-r--r--testing/net-tools/gcc340.patch46
-rw-r--r--testing/net-tools/net-tools-1.60-2.6-compilefix.patch23
-rw-r--r--testing/net-tools/net-tools-1.60-miiioctl.patch17
-rw-r--r--testing/net-tools/net-tools-1.60-nameif.patch58
-rw-r--r--testing/net-tools/net-tools-1.60-nameif_strncpy.patch13
-rw-r--r--testing/net-tools/net-tools.install12
-rw-r--r--testing/net-tools/net-tools.patch30
-rw-r--r--testing/perl/0001-Append-CFLAGS-and-LDFLAGS-to-their-Config.pm-counter.patch83
-rw-r--r--testing/perl/ChangeLog66
-rw-r--r--testing/perl/PKGBUILD109
-rw-r--r--testing/perl/fix-h2ph-and-tests.patch104
-rw-r--r--testing/perl/perl.install18
-rw-r--r--testing/perl/perlbin.csh15
-rwxr-xr-xtesting/perl/perlbin.sh18
-rw-r--r--testing/perl/provides.pl272
61 files changed, 4025 insertions, 355 deletions
diff --git a/community-testing/speed-dreams/PKGBUILD b/community-testing/speed-dreams/PKGBUILD
new file mode 100644
index 000000000..757a901fe
--- /dev/null
+++ b/community-testing/speed-dreams/PKGBUILD
@@ -0,0 +1,55 @@
+# $Id: PKGBUILD 54504 2011-08-19 10:27:23Z svenstaro $
+# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
+# Contributor: Adrián Chaves Fernández, aka Gallaecio <adriyetichaves@gmail.com>
+# Contributor: Shahar Weiss <sweiss4@gmx.net> (build() code from his TORCS' PKGBUILD)
+pkgname=speed-dreams
+pkgver=2.0.0a3
+_pkgver=2.0.0-a3-r3412
+pkgrel=1
+pkgdesc="A racing simulator with rich graphics and physics"
+arch=('i686' 'x86_64')
+url="http://speed-dreams.sourceforge.net/"
+license=('GPL2')
+depends=('sdl' 'freealut' 'freeglut' 'libpng' 'libxi' 'libxmu' 'libxrandr' 'plib>=1.8.3' 'libjpeg' 'zlib' 'enet' 'speed-dreams-data')
+makedepends=('cmake' 'p7zip')
+source=("http://downloads.sourceforge.net/sourceforge/${pkgname}/${pkgname}-${_pkgver}-src.tar.7z"
+ "${pkgname}.desktop")
+md5sums=('659837e8866c59c85279c31fcaba4144'
+ 'bd5c81bac696ec53628ba42684ef8369')
+
+build() {
+ 7z x ${pkgname}-${_pkgver}-src.tar.7z
+ tar xf ${pkgname}-${_pkgver}-src.tar
+
+ cd "${pkgname}-${_pkgver}-src"
+
+ cmake . \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DSD_BINDIR=/usr/bin \
+ -DSD_DATADIR=/usr/share/speed-dreams-2 \
+ -DSD_LIBDIR=/usr/lib/speed-dreams-2
+
+ make
+}
+
+package() {
+ cd "$srcdir/${pkgname}-${_pkgver}-src"
+
+ make DESTDIR="${pkgdir}/" install
+
+ rm -r "${pkgdir}/usr/share"
+
+ install -Dm644 "data/data/icons/icon.png" "${pkgdir}/usr/share/pixmaps/speed-dreams.png"
+ install -Dm644 "data/data/icons/icon.svg" "${pkgdir}/usr/share/pixmaps/speed-dreams.svg"
+ install -Dm644 "${srcdir}/${pkgname}.desktop" "${pkgdir}/usr/share/applications/speed-dreams.desktop"
+
+ mkdir -p "${pkgdir}/usr/share/doc/${pkgname}"
+ cp -r doc "${pkgdir}/usr/share/doc/${pkgname}/"
+
+ mkdir -p "${pkgdir}/usr/share/man/man6/${pkgname}"
+ rm doc/man/speed-dreams.es.6
+ cp doc/man/* "${pkgdir}/usr/share/man/man6/${pkgname}"
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/community-testing/speed-dreams/speed-dreams.desktop b/community-testing/speed-dreams/speed-dreams.desktop
new file mode 100644
index 000000000..8c86d85cc
--- /dev/null
+++ b/community-testing/speed-dreams/speed-dreams.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=Speed Dreams
+Comment=The Open Racing Car Simulator Fork
+Exec=speed-dreams
+Icon=speed-dreams.svg
+Terminal=false
+Type=Application
+Encoding=UTF-8
+Categories=Application;Game;
diff --git a/community-testing/speed-dreams/speed-dreams.sh b/community-testing/speed-dreams/speed-dreams.sh
new file mode 100644
index 000000000..fa6dde97a
--- /dev/null
+++ b/community-testing/speed-dreams/speed-dreams.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+cd /opt/speed-dreams/bin
+./speed-dreams
diff --git a/community/dwm/PKGBUILD b/community/dwm/PKGBUILD
index ba034ff76..0c5b1a448 100644
--- a/community/dwm/PKGBUILD
+++ b/community/dwm/PKGBUILD
@@ -1,11 +1,11 @@
-# $Id: PKGBUILD 51492 2011-07-10 19:48:13Z spupykin $
+# $Id: PKGBUILD 54496 2011-08-19 09:22:43Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Dag Odenhall <dag.odenhall@gmail.com>
# Contributor: Grigorios Bouzakis <grbzks@gmail.com>
pkgname=dwm
pkgver=5.9
-pkgrel=1
+pkgrel=2
pkgdesc="A dynamic window manager for X"
url="http://dwm.suckless.org"
arch=('i686' 'x86_64')
@@ -36,5 +36,5 @@ package() {
make PREFIX=/usr DESTDIR=$pkgdir install
install -m644 -D LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
install -m644 -D README $pkgdir/usr/share/doc/$pkgname/README
- install -m644 -D $srcdir/dwm.desktop $pkgdir//etc/X11/sessions/dwm.desktop
+ install -m644 -D $srcdir/dwm.desktop $pkgdir/usr/share/xsessions/dwm.desktop
}
diff --git a/community/dwm/dwm.install b/community/dwm/dwm.install
index 7415613df..44b50ed82 100644
--- a/community/dwm/dwm.install
+++ b/community/dwm/dwm.install
@@ -1,11 +1,4 @@
-pre_install() {
- echo "-- Edit config.h in PKGBUILD's directory (generally /var/abs/community/x11/dwm/)"
+post_install() {
+ echo "-- Edit config.h in dwm's PKGBUILD directory (generally /var/abs/community/dwm/)"
echo "-- and rebuild package if you want to change settings."
- /bin/true
-}
-
-pre_upgrade() {
- echo "-- Edit config.h in PKGBUILD's directory (generally /var/abs/community/x11/dwm/)"
- echo "-- and rebuild package if you want to change settings."
- /bin/true
}
diff --git a/community/luxrays/PKGBUILD b/community/luxrays/PKGBUILD
index 3c10f96ea..e90a96a3a 100644
--- a/community/luxrays/PKGBUILD
+++ b/community/luxrays/PKGBUILD
@@ -1,18 +1,18 @@
-# $Id: PKGBUILD 49421 2011-06-15 20:18:28Z ebelanger $
+# $Id: PKGBUILD 54517 2011-08-19 16:16:33Z stativ $
# Maintainer: Lukas Jirkovsky <l.jirkovsky@gmail.com>
pkgname=luxrays
pkgver=0.8
_pkgver=ed424ec77571
-pkgrel=2
+pkgrel=3
epoch=0
pkgdesc="Accelerate the ray intersection process by using GPUs"
arch=('i686' 'x86_64')
url="http://www.luxrender.net/"
license=('GPL')
-depends=('freeimage' 'freeglut' 'glew')
-makedepends=('cmake' 'boost')
+depends=('freeimage' 'freeglut' 'glew' 'libcl')
+makedepends=('cmake' 'boost' 'opencl-headers')
source=(https://bitbucket.org/luxrender/luxrays/get/$_pkgver.tar.bz2)
-md5sums=('15a10c7ff9d4047982b140efee792967')
+md5sums=('2ac9c588675c5971c57f473ef10ac67d')
build() {
cd "$srcdir/luxrender-$pkgname-$_pkgver"
@@ -20,7 +20,7 @@ build() {
export CXXFLAGS="$CXXFLAGS -lpthread"
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_SKIP_RPATH=ON \
- -DLUXRAYS_DISABLE_OPENCL=ON \
+ -DLUXRAYS_DISABLE_OPENCL=OFF \
.
make
}
diff --git a/community/luxrender/PKGBUILD b/community/luxrender/PKGBUILD
index e998a4d78..dd58e3676 100644
--- a/community/luxrender/PKGBUILD
+++ b/community/luxrender/PKGBUILD
@@ -1,4 +1,4 @@
-# $Id: PKGBUILD 52563 2011-07-26 05:00:59Z svenstaro $
+# $Id: PKGBUILD 54540 2011-08-19 22:35:41Z ebelanger $
# Maintainer: Lukas Jirkovsky <l.jirkovsky@gmail.com>
# Initial contributor: flixie <69one@gmx.net>
# Contributor: Imanol Celaya <ornitorrincos@archlinux-es.org>
@@ -6,17 +6,18 @@ pkgname=luxrender
pkgver=0.8
_pkgver=45d3e13eb94c
_luxblend=9cb3fcee0be8
-_blender=2.58
-pkgrel=7
+_blender=2.59
+pkgrel=8
pkgdesc="Rendering system for physically correct, unbiased image synthesis"
arch=('i686' 'x86_64')
url="http://www.luxrender.net/"
license=('GPL')
-depends=('boost-libs' 'freeimage' 'openexr')
+depends=('boost-libs' 'freeimage' 'openexr' 'libcl')
optdepends=('blender: Blender exporter' 'qt: Qt GUI')
-makedepends=('cmake' 'boost' 'qt' 'luxrays' 'python')
-source=(http://ftp.archlinux.org/other/community/luxrender/lux-"$pkgver".tar.bz2 \
- http://ftp.archlinux.org/other/community/luxrender/luxblend-"$pkgver".tar.bz2)
+makedepends=('cmake' 'boost' 'qt' 'luxrays' 'python' 'opencl-headers')
+install=luxrender.install
+source=(ftp://ftp.archlinux.org/other/community/luxrender/lux-"$pkgver".tar.bz2 \
+ ftp://ftp.archlinux.org/other/community/luxrender/luxblend-"$pkgver".tar.bz2)
md5sums=('0f2d856385db72131f51e44a7ee527fa'
'0c3c8d9efba76133f8c687b5dd2bca8a')
@@ -27,7 +28,7 @@ build() {
export CXXFLAGS="$CXXFLAGS -lpthread"
cmake -DCMAKE_INSTALL_PREFIX=/usr \
- -DLUXRAYS_DISABLE_OPENCL=ON \
+ -DLUXRAYS_DISABLE_OPENCL=OFF \
-DPYTHON_CUSTOM=ON \
-DPYTHON_LIBRARIES=/usr/lib/libpython3.2mu.so \
-DPYTHON_INCLUDE_PATH=/usr/include/python3.2mu/ \
diff --git a/community/luxrender/luxrender.install b/community/luxrender/luxrender.install
new file mode 100644
index 000000000..5be530d50
--- /dev/null
+++ b/community/luxrender/luxrender.install
@@ -0,0 +1,10 @@
+post_install() {
+ cat << EOF
+To enable OpenCL support you need to install one of the following packages:
+ * nvidia-utils for nVidia GPUs
+ * amdstram for AMD GPUs
+ * intel-opencl-sdk for Intel CPUs
+EOF
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/community/sawfish/PKGBUILD b/community/sawfish/PKGBUILD
index 5942f29e1..a170930fd 100644
--- a/community/sawfish/PKGBUILD
+++ b/community/sawfish/PKGBUILD
@@ -1,10 +1,10 @@
-# $Id: PKGBUILD 46419 2011-05-07 10:07:50Z shusmann $
+# $Id: PKGBUILD 54530 2011-08-19 20:28:11Z shusmann $
# Maintainer: stefan-husmann@t-online.de
# Contributor: Juergen Hoetzel <juergen@archlinux.org>
pkgname=sawfish
pkgver=1.8.1
-pkgrel=1
+pkgrel=2
pkgdesc="An extensible window manager using a Lisp-based scripting language"
arch=('i686' 'x86_64')
url="http://sawfish.wikia.com/wiki/Main_Page"
@@ -16,14 +16,14 @@ sha1sums=('f93549382a438c1e7044624403876b345edae4b6')
options=('!libtool')
build() {
cd "${srcdir}/${pkgname}-${pkgver}"
- ./configure --prefix=/usr --libexecdir=/usr/lib --without-pango
+ ./configure --prefix=/usr --libexecdir=/usr/lib
make
}
package() {
cd "${srcdir}/${pkgname}-${pkgver}"
make DESTDIR="${pkgdir}" install
-
- install -Dm644 sawfish-session.desktop \
- "${pkgdir}/etc/X11/sessions/${pkgname}.desktop"
+ rm -r $pkgdir/usr/share/gnome/wm-properties
+ rm -r $pkgdir/usr/share/kde4
+ rmdir $pkgdir/usr/share/gnome
}
diff --git a/community/systemd/0001-convert-int-to-boolean-for-dbus_bool_t.patch b/community/systemd/0001-convert-int-to-boolean-for-dbus_bool_t.patch
new file mode 100644
index 000000000..675bc0478
--- /dev/null
+++ b/community/systemd/0001-convert-int-to-boolean-for-dbus_bool_t.patch
@@ -0,0 +1,25 @@
+From e191553d1dc80cd6d65d05f0cb29f8967fab6983 Mon Sep 17 00:00:00 2001
+From: Kay Sievers <kay.sievers@vrfy.org>
+Date: Wed, 17 Aug 2011 19:38:07 +0200
+Subject: [PATCH] convert int to boolean for dbus_bool_t
+
+---
+ src/dbus-manager.c | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/dbus-manager.c b/src/dbus-manager.c
+index ae88895..cfc2afc 100644
+--- a/src/dbus-manager.c
++++ b/src/dbus-manager.c
+@@ -444,7 +444,7 @@ static DBusMessage *message_from_file_changes(
+ if (carries_install_info >= 0) {
+ dbus_bool_t b;
+
+- b = carries_install_info;
++ b = !!carries_install_info;
+ if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &b))
+ goto oom;
+ }
+--
+1.7.6
+
diff --git a/community/systemd/PKGBUILD b/community/systemd/PKGBUILD
index aafaf1b5f..9d6c1d110 100644
--- a/community/systemd/PKGBUILD
+++ b/community/systemd/PKGBUILD
@@ -1,9 +1,9 @@
-# $Id: PKGBUILD 53877 2011-08-09 02:05:40Z dreisner $
+# $Id: PKGBUILD 54516 2011-08-19 14:57:25Z dreisner $
# Maintainer: Dave Reisner <dreisner@archlinux.org>
pkgname=systemd
pkgver=33
-pkgrel=2
+pkgrel=3
pkgdesc="Session and Startup manager"
arch=('i686' 'x86_64')
url="http://www.freedesktop.org/wiki/Software/systemd"
@@ -19,7 +19,7 @@ optdepends=('cryptsetup: required for encrypted block devices'
'python2-cairo: systemd-analyze'
'systemd-arch-units: collection of native unit files for Arch daemon/init scripts')
groups=('systemd')
-options=('!libtool')
+options=('!libtool' '!strip')
backup=(etc/dbus-1/system.d/org.freedesktop.systemd1.conf
etc/dbus-1/system.d/org.freedesktop.hostname1.conf
etc/dbus-1/system.d/org.freedesktop.login1.conf
@@ -30,9 +30,11 @@ backup=(etc/dbus-1/system.d/org.freedesktop.systemd1.conf
etc/systemd/systemd-logind.conf)
install=systemd.install
source=("http://www.freedesktop.org/software/$pkgname/$pkgname-$pkgver.tar.bz2"
- "os-release")
+ "os-release"
+ 0001-convert-int-to-boolean-for-dbus_bool_t.patch)
md5sums=('361cad7c3debbdd81c211527509ba181'
- '752636def0db3c03f121f8b4f44a63cd')
+ '752636def0db3c03f121f8b4f44a63cd'
+ '299c03fa55628af7fdff5955ca4e48ea')
build() {
cd "$srcdir/$pkgname-$pkgver"
@@ -42,6 +44,9 @@ build() {
sed -i -e '/^Environ.*LANG/s/^/#/' \
-e '/^ExecStart/s/agetty/& -8/' units/getty@.service.m4
+ # fix ABRT on `systemctl enable <unit-with-Also>'
+ patch -Np1 < "$srcdir/0001-convert-int-to-boolean-for-dbus_bool_t.patch"
+
./configure --prefix=/usr \
--sysconfdir=/etc \
--libexecdir=/usr/lib \
diff --git a/community/unhide/PKGBUILD b/community/unhide/PKGBUILD
new file mode 100644
index 000000000..c825f5e48
--- /dev/null
+++ b/community/unhide/PKGBUILD
@@ -0,0 +1,31 @@
+# $Id: PKGBUILD 54495 2011-08-19 08:09:31Z lfleischer $
+# Maintainer: Lukas Fleischer <archlinux at cryptocrack dot de>
+
+pkgname=unhide
+pkgver=20110113
+pkgrel=2
+pkgdesc='A forensic tool to find processes hidden by rootkits, LKMs or by other techniques.'
+arch=('i686' 'x86_64')
+url='http://www.unhide-forensics.info/'
+license=('GPL3')
+source=("http://downloads.sourceforge.net/project/${pkgname}/${pkgname}-${pkgver}.tgz")
+md5sums=('0dff8ee5029615f1f81db96dcf6758f7')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ cc -Os -static unhide.c -o unhide-posix
+ cc -Os -static -pthread unhide-linux26.c -o unhide-linux26
+ cc -Os -static unhide-tcp.c -o unhide-tcp
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ install -Dm0755 unhide-posix "${pkgdir}/usr/sbin/unhide-posix"
+ install -Dm0755 unhide-linux26 "${pkgdir}/usr/sbin/unhide-linux26"
+ install -Dm0755 unhide-tcp "${pkgdir}/usr/sbin/unhide-tcp"
+ ln -fs ./unhide-linux26 "${pkgdir}/usr/sbin/unhide"
+ install -Dm0644 man/unhide.8 "${pkgdir}/usr/share/man/man8/unhide.8"
+}
+
diff --git a/community/xalan-c/1.11.0_pre797991-parallel-build.patch b/community/xalan-c/1.11.0_pre797991-parallel-build.patch
new file mode 100644
index 000000000..46d9659b0
--- /dev/null
+++ b/community/xalan-c/1.11.0_pre797991-parallel-build.patch
@@ -0,0 +1,62 @@
+diff -urN xml-xalan.orig//c/src/xalanc/Makefile.in xml-xalan/c/src/xalanc/Makefile.in
+--- xml-xalan.orig//c/src/xalanc/Makefile.in 2010-02-23 10:51:30.058353490 +0100
++++ xml-xalan/c/src/xalanc/Makefile.in 2010-02-23 10:52:53.251679288 +0100
+@@ -84,6 +84,10 @@
+ SAMPLES_DIR = ${XALANCROOT}/samples
+ TESTS_DIR = ${XALANCROOT}/Tests
+
++TESTXSLT_OBJS = ${XSL_OBJ_DIR}/process.o
++XALANEXE_OBJS = ${XSL_OBJ_DIR}/XalanExe.o
++TESTXPATH_OBJS = ${XSL_OBJ_DIR}/TestXPath.o ${XSL_OBJ_DIR}/NodeNameTreeWalker.o
++
+ ALL_VPATH_CPP = \
+ $(XALANDOM_DIR):$(PLATFORMSUPPORT_DIR):$(DOMSUPPORT_DIR):$(XMLSUPPORT_DIR): \
+ $(XPATH_DIR):$(XERCESPARSERLIAISON_DIR):$(DEPRECATED_XERCESPARSERLIAISON_DIR):$(XALANSOURCETREE_DIR):$(XPATHCAPI_DIR): \
+@@ -169,6 +173,9 @@
+
+ compile: $(ALL_OBJECTS)
+
++$(ALL_OBJECTS) $(TESTXSLT_OBJS) $(XALANEXE_OBJS) $(TESTXPATH_OBJS): locale
++locale: prepare
++
+ ifeq (${OS390BATCH},1)
+ XalanExe: lib "//'$(LOADSAMP)(${BATCH_XALAN_UTIL_NAME})'"
+
+@@ -188,28 +195,28 @@
+
+ else # Not OS390BATCH
+
+-XalanExe: lib $(XSL_BIN_DIR)/Xalan
++XalanExe: $(XSL_BIN_DIR)/Xalan
+
+-$(XSL_BIN_DIR)/Xalan: ${XSL_OBJ_DIR}/XalanExe.o
++$(XSL_BIN_DIR)/Xalan: lib ${XALANEXE_OBJS}
+ ${LINK} $(XSL_BUILD_OPTIONS) ${PLATFORM_LIB_LINK_OPTIONS} \
+- ${EXTRA_LINK_OPTIONS} $^ -o $@ $(OTHER_LINK_PARAMETERS) $(XALAN_LIB) $(ALLLIBS)
++ ${EXTRA_LINK_OPTIONS} ${XALANEXE_OBJS} -o $@ $(OTHER_LINK_PARAMETERS) $(XALAN_LIB) $(ALLLIBS)
+ ${XSL_OBJ_DIR}/XalanExe.o: $(XALANEXE_DIR)/XalanExe.cpp
+ $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $<
+ endif
+
+-testXSLT: lib $(XSL_BIN_DIR)/testXSLT
++testXSLT: $(XSL_BIN_DIR)/testXSLT
+
+-$(XSL_BIN_DIR)/testXSLT: ${XSL_OBJ_DIR}/process.o
++$(XSL_BIN_DIR)/testXSLT: lib ${TESTXSLT_OBJS}
+ ${LINK} $(XSL_BUILD_OPTIONS) ${PLATFORM_LIB_LINK_OPTIONS} \
+- ${EXTRA_LINK_OPTIONS} $^ -o $@ $(OTHER_LINK_PARAMETERS) $(XALAN_LIB) $(ALLLIBS)
++ ${EXTRA_LINK_OPTIONS} ${TESTXSLT_OBJS} -o $@ $(OTHER_LINK_PARAMETERS) $(XALAN_LIB) $(ALLLIBS)
+ ${XSL_OBJ_DIR}/process.o: $(TESTXSLT_DIR)/process.cpp
+ $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $<
+
+-testXPath: lib $(XSL_BIN_DIR)/testXPath
++testXPath: $(XSL_BIN_DIR)/testXPath
+
+-$(XSL_BIN_DIR)/testXPath: ${XSL_OBJ_DIR}/TestXPath.o ${XSL_OBJ_DIR}/NodeNameTreeWalker.o
++$(XSL_BIN_DIR)/testXPath: lib ${TESTXPATH_OBJS}
+ ${LINK} $(XSL_BUILD_OPTIONS) ${PLATFORM_LIB_LINK_OPTIONS} \
+- ${EXTRA_LINK_OPTIONS} $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) $(XALAN_LIB) $(ALLLIBS)
++ ${EXTRA_LINK_OPTIONS} $(CXXFLAGS) ${TESTXPATH_OBJS} -o $@ $(OTHER_LINK_PARAMETERS) $(XALAN_LIB) $(ALLLIBS)
+ ${XSL_OBJ_DIR}/%.o:$(TESTXPATH_DIR)/%.cpp
+ $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $<
+
diff --git a/community/xalan-c/PKGBUILD b/community/xalan-c/PKGBUILD
index 2de7fb30b..c73848fca 100644
--- a/community/xalan-c/PKGBUILD
+++ b/community/xalan-c/PKGBUILD
@@ -1,33 +1,38 @@
-# $Id: PKGBUILD 11866 2010-02-20 10:45:04Z dgriffiths $
+# $Id: PKGBUILD 54514 2011-08-19 14:55:46Z ibiru $
# Maintainer: Roman Kyrylych <Roman.Kyrylych@gmail.com>
# Contributor: William Rea <sillywilly@gmail.com>
pkgname=xalan-c
-pkgver=1.11_pre797991
-pkgrel=2
+pkgver=1.11_pre1153059
+pkgrel=1
pkgdesc="A XSLT processor for transforming XML documents"
arch=('i686' 'x86_64')
url="http://xml.apache.org/xalan-c"
license=('APACHE')
depends=('xerces-c')
-options=('!makeflags')
-#source=(http://www.axint.net/apache/xml/xalan-c/source/Xalan-C_1_10_0-src.tar.gz)
-source=(http://mirrors.kernel.org/gentoo/distfiles/Xalan-C_r797991-src.tar.gz
- 1.11.0_pre797991-as-needed.patch 1.11.0_pre797991-bugfixes.patch)
+source=(http://mirrors.kernel.org/gentoo/distfiles/Xalan-C_r1153059-src.tar.gz
+ 1.11.0_pre797991-as-needed.patch
+ 1.11.0_pre797991-bugfixes.patch
+ 1.11.0_pre797991-parallel-build.patch)
+md5sums=('98ea8584ccdbb9044757dda725f780bf'
+ '7040fb617e26fbdadc423948d3a23558'
+ 'fe7af1f3a9e02ad813481f0e1a84f16c'
+ '633b4ab702cb0ea0cf1010cadef7ac4c')
build() {
export XALANCROOT=${srcdir}/xml-xalan/c
- unset LDFLAGS
cd ${srcdir}/xml-xalan/c
- patch -Np2 -i ${srcdir}/1.11.0_pre797991-as-needed.patch || return 1
- patch -Np2 -i ${srcdir}/1.11.0_pre797991-bugfixes.patch || return 1
+ patch -Np2 -i ${srcdir}/1.11.0_pre797991-as-needed.patch
+ patch -Np2 -i ${srcdir}/1.11.0_pre797991-bugfixes.patch
+ patch -Np2 -i ${srcdir}/1.11.0_pre797991-parallel-build.patch
./runConfigure -p linux -c gcc -x g++ -P/usr
#./configure --prefix=/usr
- make || return 1
+ make
+}
+
+package() {
+ cd ${srcdir}/xml-xalan/c
make DESTDIR=${pkgdir} install
}
-md5sums=('cc54971e92f308bcc326f4bba542eeeb'
- '7040fb617e26fbdadc423948d3a23558'
- 'fe7af1f3a9e02ad813481f0e1a84f16c')
diff --git a/extra/kdepim/PKGBUILD b/extra/kdepim/PKGBUILD
index e485345f3..6b411a06d 100644
--- a/extra/kdepim/PKGBUILD
+++ b/extra/kdepim/PKGBUILD
@@ -1,4 +1,4 @@
-# $Id: PKGBUILD 132630 2011-07-25 00:15:32Z andrea $
+# $Id: PKGBUILD 135830 2011-08-19 07:32:11Z andrea $
# Maintainer: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Pierre Schmitz <pierre@archlinux.de>
@@ -21,7 +21,7 @@ pkgname=('kdepim-akonadiconsole'
'kdepim-libkdepim'
'kdepim-wizards')
pkgver=4.7.0
-pkgrel=1
+pkgrel=2
arch=('i686' 'x86_64')
url='http://pim.kde.org'
license=('GPL' 'LGPL' 'FDL')
@@ -145,7 +145,7 @@ package_kdepim-kmail() {
'kdepim-mimelib' 'kdepim-plugins')
optdepends=('cyrus-sasl-plugins: CRAM-MD5 authentication')
for i in kmail doc/kmail kmailcvt ksendemail libksieve mailcommon \
- nepomuk_email_feeder ontologies templateparser kontact/plugins/kmail; do
+ nepomuk_email_feeder ontologies kontact/plugins/kmail; do
cd "${srcdir}"/build/${i}
make DESTDIR="${pkgdir}" install
done
@@ -237,7 +237,8 @@ package_kdepim-libkdepim() {
for i in akonadi_next calendarsupport calendarviews incidenceeditor-ng \
kdgantt2 libkdepim libkdepimdbusinterfaces libkleo libkpgp \
messagecomposer messagecore messagelist messageviewer icons \
- strigi-analyzer plugins/messageviewer plugins/ktexteditor; do
+ strigi-analyzer templateparser plugins/messageviewer \
+ plugins/ktexteditor; do
cd "${srcdir}"/build/${i}
make DESTDIR="${pkgdir}" install
done
diff --git a/extra/php-apc/PKGBUILD b/extra/php-apc/PKGBUILD
index 06eb95726..019ef8e19 100644
--- a/extra/php-apc/PKGBUILD
+++ b/extra/php-apc/PKGBUILD
@@ -1,9 +1,9 @@
-# $Id: PKGBUILD 123989 2011-05-15 16:00:20Z pierre $
+# $Id: PKGBUILD 135862 2011-08-19 20:05:54Z pierre $
# Maintainer: Pierre Schmitz <pierre@archlinux.de>
pkgname=php-apc
pkgver=3.1.9
-pkgrel=1
+pkgrel=3
arch=('i686' 'x86_64')
pkgdesc='A free, open, and robust framework for caching and optimizing PHP intermediate code'
url='http://pecl.php.net/package/APC'
diff --git a/extra/php-suhosin/PKGBUILD b/extra/php-suhosin/PKGBUILD
index a3173beaa..94a5c9c25 100644
--- a/extra/php-suhosin/PKGBUILD
+++ b/extra/php-suhosin/PKGBUILD
@@ -1,9 +1,9 @@
-# $Id: PKGBUILD 86069 2010-07-25 11:35:16Z pierre $
+# $Id: PKGBUILD 135864 2011-08-19 20:05:56Z pierre $
# Maintainer: Pierre Schmitz <pierre@archlinux.de>
pkgname=php-suhosin
pkgver=0.9.32.1
-pkgrel=1
+pkgrel=3
arch=('i686' 'x86_64')
pkgdesc='An advanced protection system for PHP installations'
url='http://www.hardened-php.net/suhosin/'
diff --git a/extra/php/PKGBUILD b/extra/php/PKGBUILD
index 4e7f515cd..12e326423 100644
--- a/extra/php/PKGBUILD
+++ b/extra/php/PKGBUILD
@@ -1,4 +1,4 @@
-# $Id: PKGBUILD 127446 2011-06-15 08:33:01Z pierre $
+# $Id: PKGBUILD 135860 2011-08-19 20:05:50Z pierre $
# Maintainer: Pierre Schmitz <pierre@archlinux.de>
pkgbase=php
@@ -7,7 +7,6 @@ pkgname=('php'
'php-apache'
'php-fpm'
'php-embed'
- 'php-pear'
'php-curl'
'php-enchant'
'php-gd'
@@ -15,7 +14,7 @@ pkgname=('php'
'php-intl'
'php-ldap'
'php-mcrypt'
- 'php-mssql'
+ 'php-mssql'
'php-odbc'
'php-pgsql'
'php-pspell'
@@ -23,33 +22,29 @@ pkgname=('php'
'php-sqlite'
'php-tidy'
'php-xsl')
-pkgver=5.3.6
-pkgrel=5
+pkgver=5.3.7
_suhosinver=${pkgver}-0.9.10
+pkgrel=2
arch=('i686' 'x86_64')
license=('PHP')
url='http://www.php.net'
-makedepends=('apache' 'imap' 'postgresql-libs' 'mysql' 'libldap' 'postfix'
+makedepends=('apache' 'imap' 'postgresql-libs' 'libldap' 'postfix'
'sqlite3' 'unixodbc' 'net-snmp' 'libzip' 'enchant' 'file' 'freetds'
'libmcrypt' 'tidyhtml' 'aspell' 'libtool' 'libpng' 'libjpeg' 'icu'
'curl' 'libxslt' 'openssl' 'bzip2' 'db' 'gmp' 'freetype2')
source=("http://www.php.net/distributions/${pkgbase}-${pkgver}.tar.bz2"
- "suhosin-patch-${_suhosinver}.patch.gz"
+ "http://download.suhosin.org/suhosin-patch-${_suhosinver}.patch.gz"
'php.ini.patch' 'apache.conf' 'rc.d.php-fpm' 'php-fpm.conf.in.patch'
'logrotate.d.php-fpm')
-md5sums=('2286f5a82a6e8397955a0025c1c2ad98'
- 'fff1a38877142f3ae6036dbe5a85d0a6'
+md5sums=('2d47d003c96de4e88863ff38da61af33'
+ '08582e502fed8221c6577042ca45ddb8'
'39eaa70d276fc3d45d6bcf6cd5ae1106'
'dec2cbaad64e3abf4f0ec70e1de4e8e9'
'b01be5f816988fcee7e78225836e5e27'
- 'd50ff349da08110a7cc8c691ce2d0423'
+ '09005dabd90c48ddd392b3dbf05f8a82'
'07c4e412909ac65a44ec90e7a2c4bade')
build() {
- # ldap-sasl does not compile with --as-needed
- export LDFLAGS="${LDFLAGS//-Wl,--as-needed}"
- export LDFLAGS="${LDFLAGS//,--as-needed}"
-
phpconfig="--srcdir=../${pkgbase}-${pkgver} \
--prefix=/usr \
--sysconfdir=/etc/php \
@@ -196,17 +191,6 @@ build() {
--enable-embed=shared \
${phpextensions}
make
-
- # pear
- cp -a ${srcdir}/build-php ${srcdir}/build-pear
- cd ${srcdir}/build-pear
- ./configure ${phpconfig} \
- --disable-cgi \
- --with-readline \
- --enable-pcntl \
- --with-pear \
- ${phpextensions}
- make
}
# check() {
@@ -272,19 +256,6 @@ package_php-embed() {
install -D -m644 ${srcdir}/${pkgbase}-${pkgver}/sapi/embed/php_embed.h ${pkgdir}/usr/include/php/sapi/embed/php_embed.h
}
-package_php-pear() {
- pkgdesc='PHP Extension and Application Repository'
- depends=('php' 'bash')
- backup=('etc/php/pear.conf')
-
- cd ${srcdir}/build-pear
- make -j1 install-pear INSTALL_ROOT=${pkgdir}
- local i
- while read i; do
- [ ! -e "$i" ] || rm -rf "$i"
- done < <(find ${pkgdir} -name '.*')
-}
-
package_php-curl() {
depends=('php' 'curl')
pkgdesc='curl module for PHP'
diff --git a/extra/php/php-fpm.conf.in.patch b/extra/php/php-fpm.conf.in.patch
index 93c62430a..b4dd32f96 100644
--- a/extra/php/php-fpm.conf.in.patch
+++ b/extra/php/php-fpm.conf.in.patch
@@ -1,5 +1,5 @@
---- sapi/fpm/php-fpm.conf.in 2010-12-11 08:31:47.695294987 +0100
-+++ sapi/fpm/php-fpm.conf.in 2010-12-11 08:31:55.907812237 +0100
+--- sapi/fpm/php-fpm.conf.in 2011-07-04 23:22:56.000000000 +0200
++++ sapi/fpm/php-fpm.conf.in 2011-08-12 16:56:23.686606725 +0200
@@ -12,7 +12,7 @@
; Relative path can also be used. They will be prefixed by:
; - the global prefix if it's been set (-p arguement)
@@ -18,7 +18,7 @@
; Error log file
; Note: the default prefix is @EXPANDED_LOCALSTATEDIR@
-@@ -93,7 +93,8 @@
+@@ -102,7 +102,8 @@
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
@@ -28,7 +28,7 @@
; Set listen(2) backlog. A value of '-1' means unlimited.
; Default Value: 128 (-1 on FreeBSD and OpenBSD)
-@@ -112,9 +113,9 @@
+@@ -121,9 +122,9 @@
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0666
@@ -41,7 +41,7 @@
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
-@@ -154,23 +155,23 @@
+@@ -163,23 +164,23 @@
; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
@@ -69,7 +69,7 @@
; The URI to view the FPM status page. If this value is not set, no URI will be
; recognized as a status page. By default, the status page shows the following
-@@ -264,7 +265,7 @@
+@@ -333,7 +334,7 @@
; Chdir to this directory at the start.
; Note: relative path can be used.
; Default Value: current directory or / when chroot
diff --git a/extra/potrace/PKGBUILD b/extra/potrace/PKGBUILD
index 0debf3aa1..e628b9b0c 100644
--- a/extra/potrace/PKGBUILD
+++ b/extra/potrace/PKGBUILD
@@ -1,18 +1,18 @@
-# $Id: PKGBUILD 104345 2011-01-01 13:50:24Z bisson $
-# Maintainer: damir <damir@archlinux.org>
-# Contributor: Damir Perisa <damir.perisa@bluewin.ch>
+# $Id: PKGBUILD 135877 2011-08-20 01:28:52Z bisson $
+# Maintainer: Gaetan Bisson <bisson@archlinux.org>
+# Contributor: Damir Perisa <damir@archlinux.org>
pkgname=potrace
-pkgver=1.9
-pkgrel=2
-pkgdesc='Utility for tracing a bitmap. Input: PBM, PGM, PPM, or BMP. Output: EPS, PostScript, PDF, SVG, Xfig, Gimppath, or PGM.'
-arch=('i686' 'x86_64')
+pkgver=1.10
+pkgrel=1
+pkgdesc='Utility for tracing a bitmap (input: PBM,PGM,PPM,BMP; output: EPS,PS,PDF,SVG,DXF,PGM,Gimppath,XFig)'
url='http://potrace.sourceforge.net/'
+arch=('i686' 'x86_64')
license=('GPL')
depends=('zlib')
options=('!libtool')
source=("http://potrace.sourceforge.net/download/${pkgname}-${pkgver}.tar.gz")
-sha1sums=('c3ace609c24a0d5e03bbab5f22478c2af69cf1c4')
+sha1sums=('e6e8b64d85d30b4695d197a79187ac98c2b236f9')
build() {
cd "${srcdir}/${pkgname}-${pkgver}"
diff --git a/extra/rrdtool/PKGBUILD b/extra/rrdtool/PKGBUILD
index 2395df342..9e5a9dc9d 100644
--- a/extra/rrdtool/PKGBUILD
+++ b/extra/rrdtool/PKGBUILD
@@ -1,14 +1,14 @@
-# $Id: PKGBUILD 131818 2011-07-15 23:27:54Z dan $
+# $Id: PKGBUILD 135894 2011-08-20 03:53:06Z eric $
# Maintainer: Eric Bélanger <eric@archlinux.org>
pkgname=rrdtool
pkgver=1.4.5
-pkgrel=3
+pkgrel=4
pkgdesc="Data logging and graphing application"
arch=('i686' 'x86_64')
url="http://www.rrdtool.org"
license=('GPL' 'custom')
-depends=('libpng' 'libxml2' 'pango')
+depends=('libxml2' 'pango' 'ttf-dejavu')
makedepends=('intltool' 'ruby' 'python2' 'tcl' 'lua')
optdepends=('tcl: to use corresponding binding' \
'python2: to use corresponding binding' \
@@ -21,9 +21,8 @@ sha1sums=('56638e8aedd5d5522152e86746e382b75dc48c35')
build() {
cd "${srcdir}/${pkgname}-${pkgver}"
- sed -i 's|-lrrd|-lrrd -L/usr/lib/perl5/core_perl/CORE/ -lperl -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE |' \
- bindings/perl-shared/Makefile.PL
- ./configure --prefix=/usr --localstatedir=/var --disable-rpath \
+ sed -i 's|-lrrd|-lrrd -L/usr/lib/perl5/core_perl/CORE/ -lperl |' bindings/perl-shared/Makefile.PL
+ PYTHON=python2 ./configure --prefix=/usr --localstatedir=/var --disable-rpath \
--enable-perl --enable-perl-site-install --with-perl-options='INSTALLDIRS=vendor' \
--enable-ruby --enable-ruby-site-install --enable-python \
--enable-lua --enable-lua-site-install --enable-tcl --disable-libwrap
diff --git a/extra/thunar/PKGBUILD b/extra/thunar/PKGBUILD
index c273914b0..9c252849e 100644
--- a/extra/thunar/PKGBUILD
+++ b/extra/thunar/PKGBUILD
@@ -1,10 +1,10 @@
-# $Id: PKGBUILD 125778 2011-05-29 16:38:52Z andyrtr $
+# $Id: PKGBUILD 135871 2011-08-19 21:48:29Z eric $
# Maintainer: andyrtr <andyrtr funnychar archlinux.org>
# Contributor: Andrew Simmons <andrew.simmons@gmail.com>
pkgname=thunar
pkgver=1.2.2
-pkgrel=1
+pkgrel=2
pkgdesc="modern file manager for Xfce"
arch=('i686' 'x86_64')
license=('GPL2' 'LGPL2.1')
@@ -23,12 +23,12 @@ options=('!libtool')
install=${pkgname}.install
backup=('etc/polkit-1/localauthority/50-local.d/org.freedesktop.udisks.pkla')
source=(http://archive.xfce.org/src/xfce/${pkgname}/1.2/Thunar-${pkgver}.tar.bz2
- org.freedesktop.udisks.pkla)
-md5sums=('a86df0212db71e61f459bda6bc7b7fb6'
- 'a7ddb5eec02d9a8e91a2997862e73cd8')
+ org.freedesktop.udisks.pkla
+ fix-gvfs.patch)
build() {
cd ${srcdir}/Thunar-${pkgver}
+ patch -Np1 -i ../fix-gvfs.patch
./configure --prefix=/usr \
--sysconfdir=/etc \
--libexecdir=/usr/lib \
@@ -57,3 +57,9 @@ package() {
install -dm755 ${pkgdir}/etc/polkit-1/localauthority/50-local.d
install -m644 ${srcdir}/org.freedesktop.udisks.pkla ${pkgdir}/etc/polkit-1/localauthority/50-local.d/
}
+md5sums=('a86df0212db71e61f459bda6bc7b7fb6'
+ 'a7ddb5eec02d9a8e91a2997862e73cd8'
+ '376c81af1ce5cf8b872d62a878163091')
+md5sums=('a86df0212db71e61f459bda6bc7b7fb6'
+ 'a7ddb5eec02d9a8e91a2997862e73cd8'
+ '167c79462cddc5aaa1fcdc814041350b')
diff --git a/extra/thunar/fix-gvfs.patch b/extra/thunar/fix-gvfs.patch
new file mode 100644
index 000000000..71c7dbb57
--- /dev/null
+++ b/extra/thunar/fix-gvfs.patch
@@ -0,0 +1,148 @@
+--- a/thunar/thunar-shortcuts-model.c
++++ b/thunar/thunar-shortcuts-model.c
+@@ -1,25 +1,23 @@
+-/* vi:set et ai sw=2 sts=2 ts=2: */
++/* $Id$ */
+ /*-
+ * Copyright (c) 2005-2006 Benedikt Meurer <benny@xfce.org>
+- * Copyright (c) 2009-2011 Jannis Pohlmann <jannis@xfce.org>
++ * Copyright (c) 2009 Jannis Pohlmann <jannis@xfce.org>
+ *
+- * This program is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU General Public License as
+- * published by the Free Software Foundation; either version 2 of
+- * the License, or (at your option) any later version.
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License as published by the Free
++ * Software Foundation; either version 2 of the License, or (at your option)
++ * any later version.
+ *
+- * This program is distributed in the hope that it will be useful,
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- * GNU General Public License for more details.
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
+ *
+- * You should have received a copy of the GNU General Public
+- * License along with this program; if not, write to the Free
+- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+- * Boston, MA 02110-1301, USA.
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
++ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+-
+ #ifdef HAVE_CONFIG_H
+ #include <config.h>
+ #endif
+@@ -219,84 +217,6 @@ thunar_shortcuts_model_drag_source_init (GtkTreeDragSourceIface *iface)
+
+
+
+-static gboolean
+-thunar_shortcuts_model_add_network_idle (gpointer user_data)
+-{
+- ThunarShortcutsModel *model = THUNAR_SHORTCUTS_MODEL (user_data);
+- ThunarShortcut *shortcut = NULL;
+- GtkTreePath *path;
+- GtkTreeIter iter;
+- ThunarFile *file = NULL;
+- GVolume *volume = NULL;
+- gboolean have_iter = FALSE;
+- gboolean is_separator = FALSE;
+- gboolean position_found = FALSE;
+- GFile *location = NULL;
+-
+- /* append the network icon if browsing the network is supported */
+- if (thunar_g_vfs_is_uri_scheme_supported ("network"))
+- {
+- /* load the network root file */
+- location = g_file_new_for_uri ("network://");
+- file = thunar_file_get (location, NULL);
+- g_object_unref (location);
+-
+- /* create the shortcut */
+- shortcut = g_slice_new0 (ThunarShortcut);
+- shortcut->type = THUNAR_SHORTCUT_SYSTEM_DEFINED;
+- shortcut->file = file;
+-
+- /* iterate over all rows in the model in order to find the
+- * first one with a volume or a separator */
+- have_iter = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter);
+- while (have_iter && !position_found)
+- {
+- /* read volume and separator flag from the current row */
+- gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
+- THUNAR_SHORTCUTS_MODEL_COLUMN_VOLUME, &volume,
+- THUNAR_SHORTCUTS_MODEL_COLUMN_SEPARATOR, &is_separator,
+- -1);
+-
+- /* check if a volume row was found */
+- if (volume != NULL)
+- {
+- /* stop searching */
+- position_found = TRUE;
+-
+- /* release the volume */
+- g_object_unref (volume);
+- }
+- else if (is_separator)
+- {
+- /* stop searching */
+- position_found = TRUE;
+- }
+- else
+- {
+- /* advance to the next row */
+- have_iter = gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter);
+- }
+- }
+-
+- /* we always have a volume or separator row */
+- g_assert (position_found);
+-
+- /* get the path of the iter */
+- path = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter);
+-
+- /* append the shortcut to the list */
+- thunar_shortcuts_model_add_shortcut (model, shortcut, path);
+-
+- /* release the path */
+- gtk_tree_path_free (path);
+- }
+-
+- /* remove this idle handler */
+- return FALSE;
+-}
+-
+-
+-
+ static void
+ thunar_shortcuts_model_init (ThunarShortcutsModel *model)
+ {
+@@ -339,6 +259,10 @@ thunar_shortcuts_model_init (ThunarShortcutsModel *model)
+ /* append the root file system */
+ system_paths = g_list_append (system_paths, thunar_g_file_new_for_root ());
+
++ /* append the network icon if browsing the network is supported */
++ if (thunar_g_vfs_is_uri_scheme_supported ("network"))
++ system_paths = g_list_append (system_paths, g_file_new_for_uri ("network://"));
++
+ /* will be used to append the shortcuts to the list */
+ path = gtk_tree_path_new_from_indices (0, -1);
+
+@@ -416,9 +340,6 @@ thunar_shortcuts_model_init (ThunarShortcutsModel *model)
+ g_object_unref (bookmarks);
+ g_object_unref (home);
+ gtk_tree_path_free (path);
+-
+- /* add the network item (and other slow items) in an idle handler */
+- g_idle_add_full (G_PRIORITY_LOW, thunar_shortcuts_model_add_network_idle, model, NULL);
+ }
+
+
+
diff --git a/extra/xpdf/PKGBUILD b/extra/xpdf/PKGBUILD
index 3fda983cf..12e63382c 100644
--- a/extra/xpdf/PKGBUILD
+++ b/extra/xpdf/PKGBUILD
@@ -1,74 +1,66 @@
-# $Id: PKGBUILD 117882 2011-04-04 21:05:28Z bisson $
+# $Id: PKGBUILD 135889 2011-08-20 02:28:50Z bisson $
# Maintainer: Gaetan Bisson <bisson@archlinux.org>
# Contributor: tobias <tobias@archlinux.org>
# Contributor: Sarah Hay <sarahhay@mb.sympatico.ca>
pkgname=xpdf
-_srcver=3.02
-_patchlevel=pl6
-pkgver=${_srcver}_${_patchlevel}
+#pkgver=3.03_pl1
+pkgver=3.03
pkgrel=1
-pkgdesc="A viewer for Portable Document Format (PDF) files"
+pkgdesc='Viewer for Portable Document Format (PDF) files'
+url='http://www.foolabs.com/xpdf/'
+license=('GPL2')
arch=('i686' 'x86_64')
-license=('GPL')
-depends=('lesstif' 'gsfonts' 'libxt' 'desktop-file-utils')
-optdepends=('poppler: pdf tools that used to be included in xpdf')
+depends=('lesstif' 'gsfonts' 'libxt')
+optdepends=('poppler: tools that used to be included in xpdf'
+ 'desktop-file-utils: for desktop environments')
+# "ftp://ftp.foolabs.com/pub/${pkgname}/${pkgname}-${pkgver%_*}pl1.patch"
+source=("ftp://ftp.foolabs.com/pub/${pkgname}/${pkgname}-${pkgver%_*}.tar.gz"
+ 'char.patch'
+ 'desktop')
+sha1sums=('499423e8a795e0efd76ca798239eb4d0d52fe248'
+ '5c471944685a6b24a2b0c0e000562d1a3263aeeb'
+ '3b6fe01636253676ffa0efe1b237a75af4721f6d')
+
+install=install
backup=('etc/xpdfrc')
-url="http://www.foolabs.com/xpdf/"
-install=${pkgname}.install
-source=(ftp://ftp.foolabs.com/pub/${pkgname}/${pkgname}-${_srcver}.tar.gz
- ftp://ftp.foolabs.com/pub/${pkgname}/${pkgname}-${_srcver}pl1.patch
- ftp://ftp.foolabs.com/pub/${pkgname}/${pkgname}-${_srcver}pl2.patch
- ftp://ftp.foolabs.com/pub/${pkgname}/${pkgname}-${_srcver}pl3.patch
- ftp://ftp.foolabs.com/pub/${pkgname}/${pkgname}-${_srcver}pl4.patch
- ftp://ftp.foolabs.com/pub/${pkgname}/${pkgname}-${_srcver}pl5.patch
- xpdf-3.00-xfont.patch
- xpdf.desktop)
-md5sums=('599dc4cc65a07ee868cf92a667a913d2'
- '877118786dfe27d1b7aa5a6759cc6e45'
- '3a5cb165ae66781e0b21e6219ae06795'
- '581963ede0fb5715e1a69f01b5b8ce63'
- '70b752716798dd341a4bf890df5f6fdc'
- '504902ca5e9d66c67eed03636ec6b163'
- '6490de55687e0d2389212c1b5bbcf916'
- '93b9df5ebef3bc56133236ef3f176bb7')
build() {
- cd "${srcdir}/${pkgname}-${_srcver}"
+ cd "${srcdir}/${pkgname}-${pkgver%_*}"
+
+# patch -p1 -i "../${pkgname}-${_srcver}pl1.patch"
+ patch -p1 -i ../char.patch
+
+ sed -i 's:/usr/share/fonts/type1/gsfonts:/usr/share/fonts/Type1:' xpdf/GlobalParams.cc
+ sed -i 's:times-medium-r-normal--16:times-medium-r-normal--14:' xpdf/XPDFViewer.cc # FS#14217
- patch -Np1 -i "${srcdir}/${pkgname}-${_srcver}pl1.patch"
- patch -Np1 -i "${srcdir}/${pkgname}-${_srcver}pl2.patch"
- patch -Np1 -i "${srcdir}/${pkgname}-${_srcver}pl3.patch"
- patch -Np1 -i "${srcdir}/${pkgname}-${_srcver}pl4.patch"
- patch -Np1 -i "${srcdir}/${pkgname}-${_srcver}pl5.patch"
- patch -Np1 -i "${srcdir}/xpdf-3.00-xfont.patch"
- sed -i 's:/usr/share/fonts/type1/gsfonts:/usr/share/fonts/Type1:' xpdf/GlobalParams.cc
+ ./configure \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --enable-multithreaded \
+ --enable-wordlist \
+ --with-freetype2-library=/usr/lib \
+ --with-freetype2-includes=/usr/include/freetype2 \
+ --x-includes=/usr/include \
+ --with-Xm-library=/usr/lib \
+ --with-Xm-includes=/usr/include \
- ./configure \
- --prefix=/usr \
- --sysconfdir=/etc \
- --mandir=/usr/share/man \
- --enable-multithreaded \
- --enable-wordlist \
- --with-freetype2-library=/usr/lib \
- --with-freetype2-includes=/usr/include/freetype2 \
- --x-includes=/usr/include \
- --with-Xm-library=/usr/lib \
- --with-Xm-includes=/usr/include
- make
+ make
}
package() {
- cd "${srcdir}/${pkgname}-${_srcver}"
- make DESTDIR="${pkgdir}" install
+ cd "${srcdir}/${pkgname}-${pkgver%_*}"
+
+ make DESTDIR="${pkgdir}" install
+
+ install -Dm644 ../desktop "${pkgdir}/usr/share/applications/xpdf.desktop"
+ install -Dm644 xpdf/xpdfIcon.xpm "${pkgdir}/usr/share/pixmaps/xpdf.xpm"
- # remove some libs and manpages provided by poppler now
- for tool in pdffonts pdfimages pdfinfo pdftoppm pdftops pdftotext ; do
- rm -f "${pkgdir}/usr/bin/${tool}"
- rm -f "${pkgdir}/usr/share/man/man1/${tool}.1"
- done
- install -m755 -d ${pkgdir}/usr/share/applications
- install -m644 "${srcdir}/xpdf.desktop" "${pkgdir}/usr/share/applications/"
- install -m755 -d ${pkgdir}/usr/share/pixmaps
- install -m644 xpdf/xpdfIcon.xpm ${pkgdir}/usr/share/pixmaps/xpdf.xpm
+ # remove libs and manpages provided by poppler
+ # pdfdetach should go there too once it is in poppler
+ for tool in pdffonts pdfimages pdfinfo pdftoppm pdftops pdftotext ; do
+ rm "${pkgdir}/usr/bin/${tool}"
+ rm "${pkgdir}/usr/share/man/man1/${tool}.1"
+ done
}
diff --git a/extra/xpdf/char.patch b/extra/xpdf/char.patch
new file mode 100644
index 000000000..8e49393a6
--- /dev/null
+++ b/extra/xpdf/char.patch
@@ -0,0 +1,12 @@
+diff -aur old/xpdf/XPDFViewer.cc new/xpdf/XPDFViewer.cc
+--- old/xpdf/XPDFViewer.cc 2011-08-15 14:08:53.000000000 -0700
++++ new/xpdf/XPDFViewer.cc 2011-08-17 11:05:55.739431215 -0700
+@@ -1803,7 +1803,7 @@
+ menuPane = XmCreatePulldownMenu(toolBar, "zoomMenuPane", args, n);
+ for (i = 0; i < nZoomMenuItems; ++i) {
+ n = 0;
+- s = XmStringCreateLocalized(zoomMenuInfo[i].label);
++ s = XmStringCreateLocalized((char *)zoomMenuInfo[i].label);
+ XtSetArg(args[n], XmNlabelString, s); ++n;
+ XtSetArg(args[n], XmNuserData, (XtPointer)i); ++n;
+ sprintf(buf, "zoom%d", i);
diff --git a/extra/xpdf/desktop b/extra/xpdf/desktop
new file mode 100644
index 000000000..06830ecda
--- /dev/null
+++ b/extra/xpdf/desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=Xpdf
+Comment=Views Adobe PDF (acrobat) files
+Exec=xpdf
+Terminal=false
+Type=Application
+Icon=xpdf
+Categories=Office;
+MimeType=application/pdf;
diff --git a/extra/xpdf/install b/extra/xpdf/install
new file mode 100644
index 000000000..c6cf149dd
--- /dev/null
+++ b/extra/xpdf/install
@@ -0,0 +1,11 @@
+post_install() {
+ [[ -x /usr/bin/update-desktop-database ]] && update-desktop-database -q || true
+}
+
+post_upgrade() {
+ post_install
+}
+
+post_remove() {
+ post_install
+}
diff --git a/testing/cups/PKGBUILD b/testing/cups/PKGBUILD
index 628600839..4eae9e73f 100644
--- a/testing/cups/PKGBUILD
+++ b/testing/cups/PKGBUILD
@@ -1,10 +1,10 @@
-# $Id: PKGBUILD 134929 2011-08-09 13:34:46Z ibiru $
+# $Id: PKGBUILD 135845 2011-08-19 10:37:17Z andyrtr $
# Maintainer: Andreas Radke <andyrtr@archlinux.org>
pkgbase="cups"
pkgname=('libcups' 'cups')
-pkgver=1.4.8
-pkgrel=2
+pkgver=1.5.0
+pkgrel=1
arch=('i686' 'x86_64')
license=('GPL')
url="http://www.cups.org/"
@@ -16,10 +16,10 @@ source=(ftp://ftp.easysw.com/pub/cups/${pkgver}/cups-${pkgver}-source.tar.bz2
cups-no-gcrypt.patch
cups cups.logrotate cups.pam)
#options=('!emptydirs')
-md5sums=('0ec52d3f3c69bc2ab5ed70c594edbce6'
- '8ebd390197501ffd709f0ee546937fd5'
+md5sums=('e54ed09ede2340fc3014913333520fe4'
+ 'e0843e8d8c345792ac73a185260e69fe'
'9b8467a1e51d360096b70e2c3c081e6c'
- 'c9ede95cfc8e76571bd8156f0a573e3b'
+ '3733c23e77eb503bd94cc368e02830dc'
'9657daa21760bb0b5fa3d8b51d5e01a1'
'f861b18f4446c43918c8643dcbbd7f6d'
'96f82c38f3f540b53f3e5144900acf17')
@@ -28,7 +28,7 @@ md5sums=('0ec52d3f3c69bc2ab5ed70c594edbce6'
build() {
cd ${srcdir}/${pkgbase}-${pkgver}
- # Avahi support in the dnssd backend. patch from Fedora
+ # Avahi support in the dnssd backend. patch from Debian based on the Fedora work but brings it in a single file http://patch-tracker.debian.org/package/cups
patch -Np1 -i ${srcdir}/cups-avahi.patch
# Do not export SSL libs in cups-config
@@ -51,15 +51,11 @@ build() {
--enable-raw-printing \
--enable-dbus --with-dbusdir=/etc/dbus-1 \
--enable-ssl=yes --enable-gnutls \
- --disable-threads \
+ --enable-threads \
--enable-avahi\
--with-php=/usr/bin/php-cgi \
--with-pdftops=pdftops \
--with-optim="$CFLAGS"
-
- #reminder
- #Restored support for GNU TLS and OpenSSL with threading enabled (STR #3605) in cups 1.5b1
-
make
}
diff --git a/testing/cups/cups-avahi.patch b/testing/cups/cups-avahi.patch
index cf1056a75..7e9c8ecea 100644
--- a/testing/cups/cups-avahi.patch
+++ b/testing/cups/cups-avahi.patch
@@ -1,15 +1,33 @@
-diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
---- cups-1.4.5/backend/dnssd.c.avahi 2009-08-08 00:27:12.000000000 +0200
-+++ cups-1.4.5/backend/dnssd.c 2010-11-12 13:13:31.000000000 +0100
-@@ -22,6 +22,7 @@
+Description: Avahi support
+Bug: http://www.cups.org/str.php?L3066
+Author: Tim Waugh
+Origin: git clone http://twaugh.fedorapeople.org/cups-avahi.git (Aug 11, 2011)
+
+--- a/backend/dnssd.c
++++ b/backend/dnssd.c
+@@ -15,14 +15,21 @@
+ *
+ * Contents:
+ *
++ * next_txt_record() - Get next TXT record from a cups_txt_records_t.
++ * parse_txt_record_pair() - Read key/value pair in cups_txt_records_t.
+ * main() - Browse for printers.
+ * browse_callback() - Browse devices.
+ * browse_local_callback() - Browse local devices.
+ * compare_devices() - Compare two devices.
* exec_backend() - Execute the backend that corresponds to the
* resolved service name.
++ * device_type() - Get DNS-SD type enumeration from string.
* get_device() - Create or update a device.
-+* find_device()
* query_callback() - Process query data.
++ * avahi_client_callback() - Avahi client callback function.
++ * avahi_query_callback() - Avahi query callback function.
++ * avahi_browse_callback() - Avahi browse callback function.
++ * find_device() - Find a device from its name and domain.
* sigterm_handler() - Handle termination signals...
* unquote() - Unquote a name string.
-@@ -33,7 +34,18 @@
+ */
+@@ -33,7 +40,18 @@
#include "backend-private.h"
#include <cups/array.h>
@@ -29,7 +47,7 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
/*
-@@ -52,7 +64,12 @@ typedef enum
+@@ -53,7 +71,12 @@
typedef struct
{
@@ -42,7 +60,7 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
char *name, /* Service name */
*domain, /* Domain name */
*fullName, /* Full name */
-@@ -64,6 +81,20 @@ typedef struct
+@@ -65,6 +88,20 @@
sent; /* Did we list the device? */
} cups_device_t;
@@ -63,7 +81,7 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
/*
* Local globals...
-@@ -77,6 +108,7 @@ static int job_canceled = 0;
+@@ -78,6 +115,7 @@
* Local functions...
*/
@@ -71,7 +89,7 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
static void browse_callback(DNSServiceRef sdRef,
DNSServiceFlags flags,
uint32_t interfaceIndex,
-@@ -92,12 +124,6 @@ static void browse_local_callback(DNSSe
+@@ -93,12 +131,6 @@
const char *regtype,
const char *replyDomain,
void *context);
@@ -84,7 +102,7 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
static void query_callback(DNSServiceRef sdRef,
DNSServiceFlags flags,
uint32_t interfaceIndex,
-@@ -106,9 +132,111 @@ static void query_callback(DNSServiceRe
+@@ -107,9 +139,118 @@
uint16_t rrclass, uint16_t rdlen,
const void *rdata, uint32_t ttl,
void *context);
@@ -123,8 +141,9 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
+
+
+/*
-+ * cups_txt_records_t access functions
++ * 'next_txt_record()' - Get next TXT record from a cups_txt_records_t.
+ */
++
+static cups_txt_records_t *
+next_txt_record (cups_txt_records_t *txt)
+{
@@ -139,6 +158,11 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
+ return txt;
+}
+
++
++/*
++ * 'parse_txt_record_pair()' - Read key/value pair in cups_txt_records_t.
++ */
++
+static int
+parse_txt_record_pair (cups_txt_records_t *txt)
+{
@@ -193,10 +217,11 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
+
+ return 0;
+}
++
/*
* 'main()' - Browse for printers.
-@@ -119,6 +247,13 @@ main(int argc, /* I - Number of comm
+@@ -120,6 +261,13 @@
char *argv[]) /* I - Command-line arguments */
{
const char *name; /* Backend name */
@@ -210,7 +235,7 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
DNSServiceRef main_ref, /* Main service reference */
fax_ipp_ref, /* IPP fax service reference */
ipp_ref, /* IPP service reference */
-@@ -130,12 +265,11 @@ main(int argc, /* I - Number of comm
+@@ -133,12 +281,11 @@
pdl_datastream_ref, /* AppSocket service reference */
printer_ref, /* LPD service reference */
riousbprint_ref; /* Remote IO service reference */
@@ -228,7 +253,7 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
-@@ -194,6 +328,49 @@ main(int argc, /* I - Number of comm
+@@ -198,6 +345,49 @@
* Browse for different kinds of printers...
*/
@@ -243,8 +268,8 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
+ 0, avahi_client_callback, NULL, &error);
+ if (!client)
+ {
-+ perror ("ERROR: Unable to create avahi client");
-+ return (1);
++ perror ("DEBUG: Unable to create avahi client");
++ return (0);
+ }
+
+ avahi_service_browser_new (client, AVAHI_IF_UNSPEC,
@@ -278,7 +303,7 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
if (DNSServiceCreateConnection(&main_ref) != kDNSServiceErr_NoError)
{
perror("ERROR: Unable to create service connection");
-@@ -245,6 +422,7 @@ main(int argc, /* I - Number of comm
+@@ -258,6 +448,7 @@
riousbprint_ref = main_ref;
DNSServiceBrowse(&riousbprint_ref, kDNSServiceFlagsShareConnection, 0,
"_riousbprint._tcp", NULL, browse_callback, devices);
@@ -286,7 +311,7 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
/*
* Loop until we are killed...
-@@ -252,6 +430,9 @@ main(int argc, /* I - Number of comm
+@@ -265,6 +456,9 @@
while (!job_canceled)
{
@@ -296,7 +321,7 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
FD_ZERO(&input);
FD_SET(fd, &input);
-@@ -271,11 +452,35 @@ main(int argc, /* I - Number of comm
+@@ -284,11 +478,35 @@
}
else
{
@@ -332,15 +357,15 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
cups_device_t *best; /* Best matching device */
char device_uri[1024]; /* Device URI */
int count; /* Number of queries */
-@@ -285,6 +490,7 @@ main(int argc, /* I - Number of comm
- best = NULL, count = 0;
- device;
- device = (cups_device_t *)cupsArrayNext(devices))
+@@ -302,6 +520,7 @@
+ if (device->sent)
+ sent ++;
+
+#ifdef HAVE_DNSSD
- if (!device->ref && !device->sent)
- {
- /*
-@@ -313,14 +519,23 @@ main(int argc, /* I - Number of comm
+ if (device->ref)
+ count ++;
+
+@@ -333,14 +552,23 @@
count ++;
}
}
@@ -365,30 +390,15 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
if (!best)
best = device;
-@@ -372,6 +587,7 @@ main(int argc, /* I - Number of comm
- * 'browse_callback()' - Browse devices.
- */
-
-+#ifdef HAVE_DNSSD
- static void
- browse_callback(
- DNSServiceRef sdRef, /* I - Service reference */
-@@ -405,12 +621,14 @@ browse_callback(
-
- get_device((cups_array_t *)context, serviceName, regtype, replyDomain);
+@@ -401,6 +629,7 @@
}
-+#endif /* HAVE_DNSSD */
++#ifdef HAVE_DNSSD
/*
- * 'browse_local_callback()' - Browse local devices.
+ * 'browse_callback()' - Browse devices.
*/
-
-+#ifdef HAVE_DNSSD
- static void
- browse_local_callback(
- DNSServiceRef sdRef, /* I - Service reference */
-@@ -456,6 +674,7 @@ browse_local_callback(
+@@ -489,6 +718,7 @@
device->fullName);
device->sent = 1;
}
@@ -396,25 +406,32 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
/*
-@@ -528,6 +747,32 @@ exec_backend(char **argv) /* I - Comman
- exit(CUPS_BACKEND_STOP);
- }
+@@ -569,6 +799,41 @@
+
+ /*
++ * 'device_type()' - Get DNS-SD type enumeration from string.
++ */
++
+static int
+device_type (const char *regtype)
+{
+#ifdef HAVE_AVAHI
-+ if (!strcmp(regtype, "_ipp._tcp") ||
-+ !strcmp(regtype, "_ipp-tls._tcp"))
++ if (!strcmp(regtype, "_ipp._tcp"))
+ return (CUPS_DEVICE_IPP);
++ else if (!strcmp(regtype, "_ipps._tcp") ||
++ !strcmp(regtype, "_ipp-tls._tcp"))
++ return (CUPS_DEVICE_IPPS);
+ else if (!strcmp(regtype, "_fax-ipp._tcp"))
+ return (CUPS_DEVICE_FAX_IPP);
+ else if (!strcmp(regtype, "_printer._tcp"))
+ return (CUPS_DEVICE_PDL_DATASTREAM);
+#else
-+ if (!strcmp(regtype, "_ipp._tcp.") ||
-+ !strcmp(regtype, "_ipp-tls._tcp."))
++ if (!strcmp(regtype, "_ipp._tcp."))
+ return (CUPS_DEVICE_IPP);
++ else if (!strcmp(regtype, "_ipps._tcp.") ||
++ !strcmp(regtype, "_ipp-tls._tcp."))
++ return (CUPS_DEVICE_IPPS);
+ else if (!strcmp(regtype, "_fax-ipp._tcp."))
+ return (CUPS_DEVICE_FAX_IPP);
+ else if (!strcmp(regtype, "_printer._tcp."))
@@ -426,17 +443,21 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
+ return (CUPS_DEVICE_RIOUSBPRINT);
+}
+
-
- /*
++
++/*
* 'get_device()' - Create or update a device.
-@@ -550,18 +795,7 @@ get_device(cups_array_t *devices, /* I -
+ */
+
+@@ -589,20 +854,7 @@
*/
key.name = (char *)serviceName;
-
-- if (!strcmp(regtype, "_ipp._tcp.") ||
-- !strcmp(regtype, "_ipp-tls._tcp."))
+- if (!strcmp(regtype, "_ipp._tcp."))
- key.type = CUPS_DEVICE_IPP;
+- else if (!strcmp(regtype, "_ipps._tcp.") ||
+- !strcmp(regtype, "_ipp-tls._tcp."))
+- key.type = CUPS_DEVICE_IPPS;
- else if (!strcmp(regtype, "_fax-ipp._tcp."))
- key.type = CUPS_DEVICE_FAX_IPP;
- else if (!strcmp(regtype, "_printer._tcp."))
@@ -449,7 +470,7 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
for (device = cupsArrayFind(devices, &key);
device;
-@@ -581,8 +815,14 @@ get_device(cups_array_t *devices, /* I -
+@@ -622,8 +874,14 @@
free(device->domain);
device->domain = strdup(replyDomain);
@@ -464,7 +485,7 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
free(device->fullName);
device->fullName = strdup(fullName);
}
-@@ -602,6 +842,9 @@ get_device(cups_array_t *devices, /* I -
+@@ -643,6 +901,9 @@
device->domain = strdup(replyDomain);
device->type = key.type;
device->priority = 50;
@@ -474,7 +495,7 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
cupsArrayAdd(devices, device);
-@@ -609,7 +852,13 @@ get_device(cups_array_t *devices, /* I -
+@@ -650,13 +911,20 @@
* Set the "full name" of this service, which is used for queries...
*/
@@ -488,15 +509,14 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
device->fullName = strdup(fullName);
return (device);
-@@ -620,6 +869,7 @@ get_device(cups_array_t *devices, /* I -
- * 'query_callback()' - Process query data.
- */
+ }
+
+#ifdef HAVE_DNSSD
- static void
- query_callback(
- DNSServiceRef sdRef, /* I - Service reference */
-@@ -639,7 +889,7 @@ query_callback(
+ /*
+ * 'query_callback()' - Process query data.
+ */
+@@ -680,7 +948,7 @@
*ptr; /* Pointer into string */
cups_device_t dkey, /* Search key */
*device; /* Device */
@@ -505,13 +525,15 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
fprintf(stderr, "DEBUG2: query_callback(sdRef=%p, flags=%x, "
"interfaceIndex=%d, errorCode=%d, fullName=\"%s\", "
-@@ -673,84 +923,212 @@ query_callback(
+@@ -714,94 +982,233 @@
if ((ptr = strstr(name, "._")) != NULL)
*ptr = '\0';
-- if (strstr(fullName, "_ipp._tcp.") ||
-- strstr(fullName, "_ipp-tls._tcp."))
+- if (strstr(fullName, "_ipp._tcp."))
- dkey.type = CUPS_DEVICE_IPP;
+- else if (strstr(fullName, "_ipps._tcp.") ||
+- strstr(fullName, "_ipp-tls._tcp."))
+- dkey.type = CUPS_DEVICE_IPPS;
- else if (strstr(fullName, "_fax-ipp._tcp."))
- dkey.type = CUPS_DEVICE_FAX_IPP;
- else if (strstr(fullName, "_printer._tcp."))
@@ -528,7 +550,12 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
+}
+#endif /* HAVE_DNSSD */
+
++
+#ifdef HAVE_AVAHI
++/*
++ * 'avahi_client_callback()' - Avahi client callback function.
++ */
++
+static void
+avahi_client_callback(AvahiClient *client,
+ AvahiClientState state,
@@ -545,6 +572,11 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
+ }
+}
+
++
++/*
++ * 'avahi_query_callback()' - Avahi query callback function.
++ */
++
+static void
+avahi_query_callback(AvahiServiceResolver *resolver,
+ AvahiIfIndex interface,
@@ -614,6 +646,11 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
+ avahi_service_resolver_free (resolver);
+}
+
++
++/*
++ * 'avahi_browse_callback()' - Avahi browse callback function.
++ */
++
+static void
+avahi_browse_callback(AvahiServiceBrowser *browser,
+ AvahiIfIndex interface,
@@ -671,16 +708,21 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
+ }
+
+ break;
-
-- for (device = cupsArrayFind(devices, &dkey);
++
+ case AVAHI_BROWSER_REMOVE:
+ case AVAHI_BROWSER_ALL_FOR_NOW:
+ case AVAHI_BROWSER_CACHE_EXHAUSTED:
+ break;
-+ }
++ }
+}
+#endif /* HAVE_AVAHI */
+
+
+- for (device = cupsArrayFind(devices, &dkey);
++/*
++ * 'find_device()' - Find a device from its name and domain.
++ */
++
+static cups_device_t *
+find_device (cups_array_t *devices,
+ cups_txt_records_t *txt,
@@ -693,10 +735,10 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
device;
device = cupsArrayNext(devices))
{
-- if (strcasecmp(device->name, dkey.name) ||
-- strcasecmp(device->domain, dkey.domain))
-+ if (strcasecmp(device->name, dkey->name) ||
-+ strcasecmp(device->domain, dkey->domain))
+- if (_cups_strcasecmp(device->name, dkey.name) ||
+- _cups_strcasecmp(device->domain, dkey.domain))
++ if (_cups_strcasecmp(device->name, dkey->name) ||
++ _cups_strcasecmp(device->domain, dkey->domain))
{
device = NULL;
break;
@@ -745,13 +787,13 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
- break;
-
- datanext = data + datalen;
-+ char *key;
-+ char *value;
-
+-
- for (ptr = key; data < datanext && *data != '='; data ++)
- *ptr++ = *data;
- *ptr = '\0';
--
++ char *key;
++ char *value;
+
- if (data < datanext && *data == '=')
- {
- data ++;
@@ -759,18 +801,27 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
- if (data < datanext)
- memcpy(value, data, datanext - data);
- value[datanext - data] = '\0';
-- }
-- else
-- continue;
+ if (parse_txt_record_pair (txt))
+ goto next;
+- fprintf(stderr, "DEBUG2: query_callback: \"%s=%s\".\n",
+- key, value);
+- }
+- else
+- {
+- fprintf(stderr, "DEBUG2: query_callback: \"%s\" with no value.\n",
+- key);
+- continue;
+- }
+-
+- if (!_cups_strncasecmp(key, "usb_", 4))
+ key = txt->key;
+ value = txt->value;
- if (!strncasecmp(key, "usb_", 4))
++ if (!strncasecmp(key, "usb_", 4))
{
/*
-@@ -805,6 +1183,10 @@ query_callback(
+ * Add USB device ID information...
+@@ -856,6 +1263,10 @@
if (device->type == CUPS_DEVICE_PRINTER)
device->sent = 1;
}
@@ -781,7 +832,7 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
}
if (device->device_id)
-@@ -854,11 +1236,9 @@ query_callback(
+@@ -905,11 +1316,9 @@
}
}
@@ -794,27 +845,9 @@ diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
/*
* 'sigterm_handler()' - Handle termination signals...
*/
-diff -up cups-1.4.5/config.h.in.avahi cups-1.4.5/config.h.in
---- cups-1.4.5/config.h.in.avahi 2010-08-13 06:11:46.000000000 +0200
-+++ cups-1.4.5/config.h.in 2010-11-12 13:13:31.000000000 +0100
-@@ -344,6 +344,13 @@
-
-
- /*
-+ * Do we have Avahi for DNS Service Discovery?
-+ */
-+
-+#undef HAVE_AVAHI
-+
-+
-+/*
- * Do we have <sys/ioctl.h>?
- */
-
-diff -up cups-1.4.5/config-scripts/cups-dnssd.m4.avahi cups-1.4.5/config-scripts/cups-dnssd.m4
---- cups-1.4.5/config-scripts/cups-dnssd.m4.avahi 2009-08-29 00:54:34.000000000 +0200
-+++ cups-1.4.5/config-scripts/cups-dnssd.m4 2010-11-12 13:13:31.000000000 +0100
-@@ -27,6 +27,21 @@ AC_ARG_WITH(dnssd-includes, [ --with-dn
+--- a/config-scripts/cups-dnssd.m4
++++ b/config-scripts/cups-dnssd.m4
+@@ -23,6 +23,21 @@
DNSSDLIBS=""
DNSSD_BACKEND=""
@@ -836,12 +869,38 @@ diff -up cups-1.4.5/config-scripts/cups-dnssd.m4.avahi cups-1.4.5/config-scripts
if test x$enable_dnssd != xno; then
AC_CHECK_HEADER(dns_sd.h, [
case "$uname" in
-diff -up cups-1.4.5/cups/http-support.c.avahi cups-1.4.5/cups/http-support.c
---- cups-1.4.5/cups/http-support.c.avahi 2010-10-02 00:40:38.000000000 +0200
-+++ cups-1.4.5/cups/http-support.c 2010-11-12 13:28:45.000000000 +0100
-@@ -55,6 +55,11 @@
- # include <dns_sd.h>
- # include <poll.h>
+--- a/config.h.in
++++ b/config.h.in
+@@ -390,6 +390,13 @@
+
+
+ /*
++ * Do we have Avahi for DNS Service Discovery?
++ */
++
++#undef HAVE_AVAHI
++
++
++/*
+ * Do we have <sys/ioctl.h>?
+ */
+
+--- a/cups/http-support.c
++++ b/cups/http-support.c
+@@ -43,6 +43,10 @@
+ * http_copy_decode() - Copy and decode a URI.
+ * http_copy_encode() - Copy and encode a URI.
+ * http_resolve_cb() - Build a device URI for the given service name.
++ * avahi_resolve_uri_client_cb()
++ * - Avahi client callback for resolving URI.
++ * avahi_resolve_uri_resolver_cb()
++ * - Avahi resolver callback for resolving URI.
+ */
+
+ /*
+@@ -60,6 +64,11 @@
+ # include <sys/select.h>
+ # endif /* WIN32 */
#endif /* HAVE_DNSSD */
+#ifdef HAVE_AVAHI
+# include <avahi-client/client.h>
@@ -851,8 +910,8 @@ diff -up cups-1.4.5/cups/http-support.c.avahi cups-1.4.5/cups/http-support.c
/*
-@@ -121,6 +126,24 @@ static void resolve_callback(DNSService
- void *context);
+@@ -127,6 +136,24 @@
+ void *context);
#endif /* HAVE_DNSSD */
+#ifdef HAVE_AVAHI
@@ -876,7 +935,7 @@ diff -up cups-1.4.5/cups/http-support.c.avahi cups-1.4.5/cups/http-support.c
/*
* 'httpAssembleURI()' - Assemble a uniform resource identifier from its
-@@ -1351,16 +1374,27 @@ _httpResolveURI(
+@@ -1431,6 +1458,9 @@
if (strstr(hostname, "._tcp"))
{
@@ -884,15 +943,12 @@ diff -up cups-1.4.5/cups/http-support.c.avahi cups-1.4.5/cups/http-support.c
+ char *regtype, /* Pointer to type in hostname */
+ *domain; /* Pointer to domain in hostname */
#ifdef HAVE_DNSSD
- DNSServiceRef ref, /* DNS-SD master service reference */
- domainref, /* DNS-SD service reference for domain */
- localref; /* DNS-SD service reference for .local */
- int domainsent = 0, /* Send the domain resolve? */
- offline = 0; /* offline-report state set? */
-- char *regtype, /* Pointer to type in hostname */
-- *domain; /* Pointer to domain in hostname */
- _http_uribuf_t uribuf; /* URI buffer */
- struct pollfd polldata; /* Polling data */
+ # ifdef WIN32
+ # pragma comment(lib, "dnssd.lib")
+@@ -1449,6 +1479,17 @@
+ fd_set input_set; /* Input set for select() */
+ struct timeval stimeout; /* Timeout value for select() */
+ #endif /* HAVE_POLL */
+#else /* HAVE_AVAHI */
+ AvahiSimplePoll *simple_poll;
+ AvahiClient *client;
@@ -903,24 +959,28 @@ diff -up cups-1.4.5/cups/http-support.c.avahi cups-1.4.5/cups/http-support.c
+ _http_uribuf_t uribuf;
+ } user_data;
+#endif /* HAVE_DNSSD */
++
-
- if (logit)
-@@ -1398,8 +1432,13 @@ _httpResolveURI(
+ if (options & _HTTP_RESOLVE_STDERR)
+ fprintf(stderr, "DEBUG: Resolving \"%s\"...\n", hostname);
+@@ -1485,9 +1526,16 @@
if (domain)
*domain++ = '\0';
+#ifdef HAVE_DNSSD
- uribuf.buffer = resolved_uri;
- uribuf.bufsize = resolved_size;
+ uribuf.buffer = resolved_uri;
+ uribuf.bufsize = resolved_size;
+ uribuf.options = options;
+#else
+ user_data.uribuf.buffer = resolved_uri;
+ user_data.uribuf.bufsize = resolved_size;
++ user_data.uribuf.options = options;
+#endif
-
++
resolved_uri[0] = '\0';
-@@ -1414,6 +1453,7 @@ _httpResolveURI(
+ DEBUG_printf(("6_httpResolveURI: Resolving hostname=\"%s\", regtype=\"%s\", "
+@@ -1501,6 +1549,7 @@
uri = NULL;
@@ -928,7 +988,7 @@ diff -up cups-1.4.5/cups/http-support.c.avahi cups-1.4.5/cups/http-support.c
if (DNSServiceCreateConnection(&ref) == kDNSServiceErr_NoError)
{
localref = ref;
-@@ -1500,6 +1540,36 @@ _httpResolveURI(
+@@ -1608,6 +1657,36 @@
DNSServiceRefDeallocate(ref);
}
@@ -963,9 +1023,9 @@ diff -up cups-1.4.5/cups/http-support.c.avahi cups-1.4.5/cups/http-support.c
+ }
+#endif /* HAVE_DNSSD */
- if (logit)
+ if (options & _HTTP_RESOLVE_STDERR)
{
-@@ -1511,13 +1581,13 @@ _httpResolveURI(
+@@ -1619,13 +1698,13 @@
fputs("STATE: -connecting-to-device,offline-report\n", stderr);
}
@@ -979,13 +1039,17 @@ diff -up cups-1.4.5/cups/http-support.c.avahi cups-1.4.5/cups/http-support.c
-#endif /* HAVE_DNSSD */
+#endif /* HAVE_DNSSD || HAVE_AVAHI */
- if (logit && !uri)
- _cupsLangPuts(stderr, _("Unable to find printer!\n"));
-@@ -1722,6 +1792,105 @@ resolve_callback(
- }
+ if ((options & _HTTP_RESOLVE_STDERR) && !uri)
+ _cupsLangPrintFilter(stderr, "ERROR", _("Unable to find printer."));
+@@ -1895,6 +1974,116 @@
#endif /* HAVE_DNSSD */
+
+#ifdef HAVE_AVAHI
++/*
++ * 'avahi_resolve_uri_client_cb()' - Avahi client callback for resolving URI.
++ */
++
+static void
+avahi_resolve_uri_client_cb (AvahiClient *client,
+ AvahiClientState state,
@@ -1002,6 +1066,12 @@ diff -up cups-1.4.5/cups/http-support.c.avahi cups-1.4.5/cups/http-support.c
+ avahi_simple_poll_quit (simple_poll);
+}
+
++
++/*
++ * 'avahi_resolve_uri_resolver_cb()' - Avahi resolver callback for resolving
++ * URI.
++ */
++
+static void
+avahi_resolve_uri_resolver_cb (AvahiServiceResolver *resolver,
+ AvahiIfIndex interface,
@@ -1084,6 +1154,2003 @@ diff -up cups-1.4.5/cups/http-support.c.avahi cups-1.4.5/cups/http-support.c
+}
+#endif /* HAVE_AVAHI */
+
++
+ /*
+ * End of "$Id: http-support.c 9820 2011-06-10 22:06:26Z mike $".
+ */
+--- a/scheduler/Makefile
++++ b/scheduler/Makefile
+@@ -17,6 +17,7 @@
+
+ CUPSDOBJS = \
+ auth.o \
++ avahi.o \
+ banners.o \
+ cert.o \
+ classes.o \
+@@ -39,7 +40,8 @@
+ server.o \
+ statbuf.o \
+ subscriptions.o \
+- sysman.o
++ sysman.o \
++ timeout.o
+ LIBOBJS = \
+ filter.o \
+ mime.o \
+--- /dev/null
++++ b/scheduler/avahi.c
+@@ -0,0 +1,445 @@
++/*
++ * "$Id$"
++ *
++ * Avahi poll implementation for the CUPS scheduler.
++ *
++ * Copyright (C) 2010 Red Hat, Inc.
++ * Authors:
++ * Tim Waugh <twaugh@redhat.com>
++ *
++ * Distribution and use rights are outlined in the file "LICENSE.txt"
++ * "LICENSE" which should have been included with this file. If this
++ * file is missing or damaged, see the license at "http://www.cups.org/".
++ *
++ * Contents:
++ *
++ * watch_read_cb - Read callback for file descriptor
++ * watch_write_cb - Write callback for file descriptor
++ * watched_fd_add_select() - Call cupsdAddSelect() as needed
++ * watch_new() - Create a new file descriptor watch
++ * watch_free() - Free a file descriptor watch
++ * watch_update() - Update watched events for a file descriptor
++ * watch_get_events() - Get events that happened for a file descriptor
++ * timeout_cb() - Run a timed Avahi callback
++ * timeout_new() - Set a wakeup time
++ * timeout_update() - Update the expiration time for a timeout
++ * timeout_free() - Free a timeout
++ * compare_watched_fds() - Compare watched file descriptors for array sorting
++ * compare_timeouts() - Compare timeouts for array sorting
++ * avahi_cups_poll_new() - Create a new Avahi main loop object for CUPS
++ * avahi_cups_poll_free() - Free an Avahi main loop object for CUPS
++ * avahi_cups_poll_get() - Get the abstract poll API structure
++ */
++
++#include <config.h>
++
++#ifdef HAVE_AVAHI /* Applies to entire file... */
++
++/*
++ * Include necessary headers...
++ */
++
++#include "cupsd.h"
++
++#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
++# include <malloc.h>
++#endif /* HAVE_MALLOC_H && HAVE_MALLINFO */
++
++#ifdef HAVE_AVAHI
++# include <avahi-common/timeval.h>
++#endif /* HAVE_AVAHI */
++
++
++typedef struct
++{
++ AvahiCupsPoll *cups_poll;
++
++ int fd;
++ AvahiWatchEvent occurred;
++ cups_array_t *watches;
++} cupsd_watched_fd_t;
++
++struct AvahiWatch
++{
++ cupsd_watched_fd_t *watched_fd;
++
++ AvahiWatchEvent events;
++ AvahiWatchCallback callback;
++ void *userdata;
++};
++
++struct AvahiTimeout
++{
++ AvahiCupsPoll *cups_poll;
++ AvahiTimeoutCallback callback;
++ void *userdata;
++ cupsd_timeout_t *cupsd_timeout;
++};
++
++/*
++ * Local functions...
++ */
++
++static AvahiWatch * watch_new(const AvahiPoll *api,
++ int fd,
++ AvahiWatchEvent events,
++ AvahiWatchCallback callback,
++ void *userdata);
++static void watch_free(AvahiWatch *watch);
++static void watch_update(AvahiWatch *watch,
++ AvahiWatchEvent events);
++static AvahiWatchEvent watch_get_events(AvahiWatch *watch);
++static int compare_watches(AvahiWatch *p0,
++ AvahiWatch *p1);
++
++
++/*
++ * 'watch_read_cb' - Read callback for file descriptor
++ */
++
++static void
++watch_read_cb (void *userdata)
++{
++ AvahiWatch *watch;
++ cupsd_watched_fd_t *watched_fd = userdata;
++ watched_fd->occurred |= AVAHI_WATCH_IN;
++ for (watch = (AvahiWatch *)cupsArrayFirst(watched_fd->watches);
++ watch;
++ watch = (AvahiWatch *)cupsArrayNext(watched_fd->watches)) {
++ if (watch->events & watched_fd->occurred) {
++ (watch->callback) (watch, watched_fd->fd,
++ AVAHI_WATCH_IN, watch->userdata);
++ watched_fd->occurred &= ~AVAHI_WATCH_IN;
++ break;
++ }
++ }
++}
++
++
++/*
++ * 'watch_write_cb' - Write callback for file descriptor
++ */
++
++static void
++watch_write_cb (void *userdata)
++{
++ AvahiWatch *watch;
++ cupsd_watched_fd_t *watched_fd = userdata;
++ watched_fd->occurred |= AVAHI_WATCH_OUT;
++ for (watch = (AvahiWatch *)cupsArrayFirst(watched_fd->watches);
++ watch;
++ watch = (AvahiWatch *)cupsArrayNext(watched_fd->watches)) {
++ if (watch->events & watched_fd->occurred) {
++ (watch->callback) (watch, watched_fd->fd,
++ AVAHI_WATCH_OUT, watch->userdata);
++ watched_fd->occurred &= ~AVAHI_WATCH_OUT;
++ break;
++ }
++ }
++}
++
++
++/*
++ * 'watched_fd_add_select' - Call cupsdAddSelect() as needed
++ */
++
++static int /* O - Watches? */
++watched_fd_add_select (cupsd_watched_fd_t *watched_fd)
++{
++ AvahiWatch *watch;
++ cupsd_selfunc_t read_cb = NULL, write_cb = NULL;
++
++ for (watch = (AvahiWatch *)cupsArrayFirst(watched_fd->watches);
++ watch;
++ watch = (AvahiWatch *)cupsArrayNext(watched_fd->watches)) {
++ if (watch->events & (AVAHI_WATCH_IN |
++ AVAHI_WATCH_ERR |
++ AVAHI_WATCH_HUP)) {
++ read_cb = (cupsd_selfunc_t)watch_read_cb;
++ if (write_cb != NULL)
++ break;
++ }
++
++ if (watch->events & AVAHI_WATCH_OUT) {
++ write_cb = (cupsd_selfunc_t)watch_write_cb;
++ if (read_cb != NULL)
++ break;
++ }
++ }
++
++ if (read_cb || write_cb)
++ cupsdAddSelect (watched_fd->fd, read_cb, write_cb, watched_fd);
++ else
++ cupsdRemoveSelect (watched_fd->fd);
++
++ return (read_cb || write_cb);
++}
++
++/*
++ * 'watch_new' - Create a new file descriptor watch
++ */
++
++static AvahiWatch *
++watch_new (const AvahiPoll *api,
++ int fd,
++ AvahiWatchEvent events,
++ AvahiWatchCallback callback,
++ void *userdata)
++{
++ cupsd_watched_fd_t key, *watched_fd;
++ AvahiCupsPoll *cups_poll = api->userdata;
++ AvahiWatch *watch = malloc(sizeof(AvahiWatch));
++ if (watch == NULL)
++ return (NULL);
++
++ watch->events = events;
++ watch->callback = callback;
++ watch->userdata = userdata;
++
++ key.fd = fd;
++ watched_fd = cupsArrayFind (cups_poll->watched_fds, &key);
++ if (watched_fd == NULL) {
++ watched_fd = malloc(sizeof(cupsd_watched_fd_t));
++ if (watched_fd == NULL) {
++ free (watch);
++ return (NULL);
++ }
++
++ watched_fd->fd = fd;
++ watched_fd->occurred = 0;
++ watched_fd->cups_poll = cups_poll;
++ watched_fd->watches = cupsArrayNew ((cups_array_func_t)compare_watches,
++ NULL);
++ }
++
++ watch->watched_fd = watched_fd;
++ cupsArrayAdd(watched_fd->watches, watch);
++ watched_fd_add_select (watched_fd);
++ return (watch);
++}
++
++
++/*
++ * 'watch_free' - Free a file descriptor watch
++ */
++
++static void
++watch_free (AvahiWatch *watch)
++{
++ cupsd_watched_fd_t *watched_fd = watch->watched_fd;
++ AvahiCupsPoll *cups_poll = watched_fd->cups_poll;
++
++ cupsArrayRemove (watched_fd->watches, watch);
++ free (watch);
++
++ if (!watched_fd_add_select (watched_fd)) {
++ /* No more watches */
++ cupsArrayRemove (cups_poll->watched_fds, watched_fd);
++ free (watched_fd);
++ }
++}
++
++
++/*
++ * 'watch_update' - Update watched events for a file descriptor
++ */
++
++static void
++watch_update (AvahiWatch *watch,
++ AvahiWatchEvent events)
++{
++ watch->events = events;
++ watched_fd_add_select (watch->watched_fd);
++}
++
++
++/*
++ * 'watch_get_events' - Get events that happened for a file descriptor
++ */
++
++static AvahiWatchEvent
++watch_get_events (AvahiWatch *watch)
++{
++ return (watch->watched_fd->occurred);
++}
++
++
++/*
++ * 'compare_watches' - Compare watches for array sorting
++ */
++
++static int
++compare_watches (AvahiWatch *p0,
++ AvahiWatch *p1)
++{
++ if (p0->watched_fd->fd < p1->watched_fd->fd)
++ return (-1);
++
++ return ((p0->watched_fd->fd == p1->watched_fd->fd) ? 0 : 1);
++}
++
++
++/*
++ * 'timeout_cb()' - Run a timed Avahi callback
++ */
++
++static void
++timeout_cb (cupsd_timeout_t *cupsd_timeout, void *userdata)
++{
++ AvahiTimeout *timeout = userdata;
++ (timeout->callback) (timeout, timeout->userdata);
++}
++
++
++/*
++ * 'timeout_new' - Set a wakeup time
++ */
++
++static AvahiTimeout *
++timeout_new (const AvahiPoll *api,
++ const struct timeval *tv,
++ AvahiTimeoutCallback callback,
++ void *userdata)
++{
++ AvahiTimeout *timeout;
++ AvahiCupsPoll *cups_poll = api->userdata;
++
++ timeout = malloc(sizeof(AvahiTimeout));
++ if (timeout == NULL)
++ return (NULL);
++
++ timeout->cups_poll = cups_poll;
++ timeout->callback = callback;
++ timeout->userdata = userdata;
++ timeout->cupsd_timeout = cupsdAddTimeout (tv,
++ (cupsd_timeoutfunc_t)timeout_cb,
++ timeout);
++ cupsArrayAdd (cups_poll->timeouts, timeout);
++ return (timeout);
++}
++
++
++/*
++ * 'timeout_update' - Update the expiration time for a timeout
++ */
++
++static void
++timeout_update (AvahiTimeout *timeout,
++ const struct timeval *tv)
++{
++ cupsdUpdateTimeout (timeout->cupsd_timeout, tv);
++}
++
++
++/*
++ * ' timeout_free' - Free a timeout
++ */
++
++static void
++timeout_free (AvahiTimeout *timeout)
++{
++ cupsArrayRemove (timeout->cups_poll->timeouts, timeout);
++ cupsdRemoveTimeout (timeout->cupsd_timeout);
++ free (timeout);
++}
++
++
++/*
++ * 'compare_watched_fds' - Compare watched file descriptors for array sorting
++ */
++static int
++compare_watched_fds(cupsd_watched_fd_t *p0,
++ cupsd_watched_fd_t *p1)
++{
++ if (p0->fd != p1->fd)
++ return (p0->fd < p1->fd ? -1 : 1);
++
++ if (p0 == p1)
++ return (0);
++
++ return (p0 < p1 ? -1 : 1);
++}
++
++
++/*
++ * 'compare_timeouts' - Compare timeouts for array sorting
++ */
++static int
++compare_timeouts(AvahiTimeout *p0,
++ AvahiTimeout *p1)
++{
++ /*
++ * Just compare pointers to make it a stable sort.
++ */
++
++ if (p0->cupsd_timeout < p1->cupsd_timeout)
++ return (-1);
++ return ((p0->cupsd_timeout == p1->cupsd_timeout) ? 0 : 1);
++}
++
++
++/*
++ * 'avahi_cups_poll_new' - Create a new Avahi main loop object for CUPS
++ */
++
++AvahiCupsPoll *
++avahi_cups_poll_new (void)
++{
++ AvahiCupsPoll *cups_poll = malloc(sizeof(AvahiCupsPoll));
++ if (cups_poll == NULL)
++ return (NULL);
++
++ cups_poll->watched_fds = cupsArrayNew ((cups_array_func_t)compare_watched_fds,
++ NULL);
++ cups_poll->timeouts = cupsArrayNew ((cups_array_func_t)compare_timeouts,
++ NULL);
++
++ cups_poll->api.userdata = cups_poll;
++ cups_poll->api.watch_new = watch_new;
++ cups_poll->api.watch_free = watch_free;
++ cups_poll->api.watch_update = watch_update;
++ cups_poll->api.watch_get_events = watch_get_events;
++
++ cups_poll->api.timeout_new = timeout_new;
++ cups_poll->api.timeout_update = timeout_update;
++ cups_poll->api.timeout_free = timeout_free;
++
++ return (cups_poll);
++}
++
++
++/*
++ * 'avahi_cups_poll_free' - Free an Avahi main loop object for CUPS
++ */
++void
++avahi_cups_poll_free (AvahiCupsPoll *cups_poll)
++{
++ cupsd_watched_fd_t *watched_fd;
++
++ for (watched_fd = (cupsd_watched_fd_t*)cupsArrayFirst(cups_poll->watched_fds);
++ watched_fd;
++ watched_fd = (cupsd_watched_fd_t*)cupsArrayNext(cups_poll->watched_fds)){
++ cupsArrayClear (watched_fd->watches);
++ }
++
++ cupsArrayClear (cups_poll->watched_fds);
++ cupsArrayClear (cups_poll->timeouts);
++}
++
++
++/*
++ * 'avahi_cups_poll_get' - Get the abstract poll API structure
++ */
++
++const AvahiPoll *
++avahi_cups_poll_get (AvahiCupsPoll *cups_poll)
++{
++ return (&cups_poll->api);
++}
++
++
++#endif /* HAVE_AVAHI ... from top of file */
++
++/*
++ * End of "$Id$".
++ */
+--- /dev/null
++++ b/scheduler/avahi.h
+@@ -0,0 +1,49 @@
++/*
++ * "$Id$"
++ *
++ * Avahi poll implementation for the CUPS scheduler.
++ *
++ * Copyright (C) 2010 Red Hat, Inc.
++ * Authors:
++ * Tim Waugh <twaugh@redhat.com>
++ *
++ * Distribution and use rights are outlined in the file "LICENSE.txt"
++ * which should have been included with this file. If this file is
++ * file is missing or damaged, see the license at "http://www.cups.org/".
++ */
++
++#include <config.h>
++
++#ifdef HAVE_AVAHI
++# include <avahi-client/client.h>
++# include <avahi-client/publish.h>
++#endif /* HAVE_AVAHI */
++
++#ifdef HAVE_AUTHORIZATION_H
++# include <Security/Authorization.h>
++#endif /* HAVE_AUTHORIZATION_H */
++
++
++#ifdef HAVE_AVAHI
++typedef struct
++{
++ AvahiPoll api;
++ cups_array_t *watched_fds;
++ cups_array_t *timeouts;
++} AvahiCupsPoll;
++#endif /* HAVE_AVAHI */
++
++/*
++ * Prototypes...
++ */
++
++#ifdef HAVE_AVAHI
++extern AvahiCupsPoll * avahi_cups_poll_new(void);
++extern void avahi_cups_poll_free(AvahiCupsPoll *cups_poll);
++extern const AvahiPoll *avahi_cups_poll_get(AvahiCupsPoll *cups_poll);
++#endif /* HAVE_AVAHI */
++
++
++/*
++ * End of "$Id$".
++ */
+--- a/scheduler/cupsd.h
++++ b/scheduler/cupsd.h
+@@ -140,6 +140,15 @@
+
+ typedef void (*cupsd_selfunc_t)(void *data);
+
++#ifdef HAVE_AVAHI
++/*
++ * Timeout callback function type...
++ */
++
++typedef struct _cupsd_timeout_s cupsd_timeout_t;
++typedef void (*cupsd_timeoutfunc_t)(cupsd_timeout_t *timeout, void *data);
++#endif /* HAVE_AVAHI */
++
+
+ /*
+ * Globals...
+@@ -173,6 +182,11 @@
+ /* Running from launchd */
+ #endif /* HAVE_LAUNCH_H */
+
++#ifdef HAVE_AVAHI
++VAR cups_array_t *Timeouts; /* Timed callbacks for main loop */
++#endif /* HAVE_AVAHI */
++
++
+
+ /*
+ * Prototypes...
+@@ -242,6 +256,20 @@
+ extern void cupsdStartServer(void);
+ extern void cupsdStopServer(void);
+
++#ifdef HAVE_AVAHI
++extern void cupsdInitTimeouts(void);
++extern cupsd_timeout_t *cupsdAddTimeout (const struct timeval *tv,
++ cupsd_timeoutfunc_t cb,
++ void *data);
++extern cupsd_timeout_t *cupsdNextTimeout (long *delay);
++extern void cupsdRunTimeout (cupsd_timeout_t *timeout);
++extern void cupsdUpdateTimeout (cupsd_timeout_t *timeout,
++ const struct timeval *tv);
++extern void cupsdRemoveTimeout (cupsd_timeout_t *timeout);
++#endif /* HAVE_AVAHI */
++
++extern int cupsdRemoveFile(const char *filename);
++
+
+ /*
+ * End of "$Id: cupsd.h 9766 2011-05-11 22:17:34Z mike $".
+--- a/scheduler/main.c
++++ b/scheduler/main.c
+@@ -122,6 +122,10 @@
+ cupsd_listener_t *lis; /* Current listener */
+ time_t current_time, /* Current time */
+ activity, /* Client activity timer */
++#ifdef HAVE_AVAHI
++ avahi_client_time, /* Time for next Avahi client
++ check */
++#endif /* HAVE_AVAHI */
+ browse_time, /* Next browse send time */
+ senddoc_time, /* Send-Document time */
+ expire_time, /* Subscription expire time */
+@@ -148,6 +152,10 @@
+ int launchd_idle_exit;
+ /* Idle exit on select timeout? */
+ #endif /* HAVE_LAUNCHD */
++#ifdef HAVE_AVAHI
++ cupsd_timeout_t *tmo; /* Next scheduled timed callback */
++ long tmo_delay; /* Time before it must be called */
++#endif /* HAVE_AVAHI */
+
+
+ #ifdef HAVE_GETEUID
+@@ -527,6 +535,14 @@
+
+ httpInitialize();
+
++#ifdef HAVE_AVAHI
++ /*
++ * Initialize timed callback structures.
++ */
++
++ cupsdInitTimeouts();
++#endif /* HAVE_AVAHI */
++
+ cupsdStartServer();
+
+ /*
+@@ -657,6 +673,9 @@
+ */
+
+ current_time = time(NULL);
++#ifdef HAVE_AVAHI
++ avahi_client_time = current_time;
++#endif /* HAVE_AVAHI */
+ browse_time = current_time;
+ event_time = current_time;
+ expire_time = current_time;
+@@ -871,6 +890,26 @@
+ }
+ #endif /* __APPLE__ */
+
++#ifdef HAVE_AVAHI
++ /*
++ * If a timed callback is due, run it.
++ */
++
++ tmo = cupsdNextTimeout (&tmo_delay);
++ if (tmo && tmo_delay == 0)
++ cupsdRunTimeout (tmo);
++
++ /*
++ * Try to restart the Avahi client every 10 seconds if needed...
++ */
++
++ if ((current_time - avahi_client_time) >= 10)
++ {
++ avahi_client_time = current_time;
++ cupsdStartAvahiClient();
++ }
++#endif /* HAVE_AVAHI */
++
+ #ifndef __APPLE__
+ /*
+ * Update the network interfaces once a minute...
+@@ -1815,6 +1854,10 @@
+ cupsd_job_t *job; /* Job information */
+ cupsd_subscription_t *sub; /* Subscription information */
+ const char *why; /* Debugging aid */
++#ifdef HAVE_AVAHI
++ cupsd_timeout_t *tmo; /* Timed callback */
++ long tmo_delay; /* Seconds before calling it */
++#endif /* HAVE_AVAHI */
+
+
+ /*
+@@ -1857,6 +1900,19 @@
+ }
+ #endif /* __APPLE__ */
+
++#ifdef HAVE_AVAHI
++ /*
++ * See if there are any scheduled timed callbacks to run.
++ */
++
++ tmo = cupsdNextTimeout (&tmo_delay);
++ if (tmo)
++ {
++ timeout = tmo_delay;
++ why = "run a timed callback";
++ }
++#endif /* HAVE_AVAHI */
++
+ /*
+ * Check whether we are accepting new connections...
+ */
+--- /dev/null
++++ b/scheduler/timeout.c
+@@ -0,0 +1,195 @@
++/*
++ * "$Id$"
++ *
++ * Timeout functions for the Common UNIX Printing System (CUPS).
++ *
++ * Copyright (C) 2010 Red Hat, Inc.
++ * Authors:
++ * Tim Waugh <twaugh@redhat.com>
++ *
++ * Distribution and use rights are outlined in the file "LICENSE.txt"
++ * which should have been included with this file. If this file is
++ * file is missing or damaged, see the license at "http://www.cups.org/".
++ *
++ * Contents:
++ *
++ * cupsdInitTimeouts() - Initialise timeout structure.
++ * cupsdAddTimeout() - Add a timed callback.
++ * cupsdNextTimeout() - Find the next enabled timed callback.
++ * cupsdUpdateTimeout() - Adjust the time of a timed callback or disable it.
++ * cupsdRemoveTimeout() - Discard a timed callback.
++ * compare_timeouts() - Compare timed callbacks for array sorting.
++ */
++
++#include <config.h>
++
++#ifdef HAVE_AVAHI /* Applies to entire file... */
++
++/*
++ * Include necessary headers...
++ */
++
++#include "cupsd.h"
++
++#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
++# include <malloc.h>
++#endif /* HAVE_MALLOC_H && HAVE_MALLINFO */
++
++#ifdef HAVE_AVAHI
++# include <avahi-common/timeval.h>
++#endif /* HAVE_AVAHI */
++
++
++struct _cupsd_timeout_s
++{
++ struct timeval when;
++ int enabled;
++ cupsd_timeoutfunc_t callback;
++ void *data;
++};
++
++/*
++ * Local functions...
++ */
++
++/*
++ * 'compare_timeouts()' - Compare timed callbacks for array sorting.
++ */
++
++static int
++compare_timeouts (cupsd_timeout_t *p0, cupsd_timeout_t *p1)
++{
++ if (!p0->enabled || !p1->enabled)
++ {
++ if (!p0->enabled && !p1->enabled)
++ return (0);
++
++ return (p0->enabled ? -1 : 1);
++ }
++
++ return (avahi_timeval_compare (&p0->when, &p1->when));
++}
++
++
++/*
++ * 'cupsdInitTimeouts()' - Initialise timeout structures.
++ */
++
++void
++cupsdInitTimeouts(void)
++{
++ Timeouts = cupsArrayNew ((cups_array_func_t)compare_timeouts, NULL);
++}
++
++
++/*
++ * 'cupsdAddTimeout()' - Add a timed callback.
++ */
++
++cupsd_timeout_t * /* O - Timeout handle */
++cupsdAddTimeout(const struct timeval *tv, /* I - Absolute time */
++ cupsd_timeoutfunc_t cb, /* I - Callback function */
++ void *data) /* I - User data */
++{
++ cupsd_timeout_t *timeout;
++
++ timeout = malloc (sizeof(cupsd_timeout_t));
++ if (timeout != NULL)
++ {
++ timeout->enabled = (tv != NULL);
++ if (tv)
++ {
++ timeout->when.tv_sec = tv->tv_sec;
++ timeout->when.tv_usec = tv->tv_usec;
++ }
++
++ timeout->callback = cb;
++ timeout->data = data;
++ cupsArrayAdd (Timeouts, timeout);
++ }
++
++ return timeout;
++}
++
++
++/*
++ * 'cupsdNextTimeout()' - Find the next enabled timed callback.
++ */
++
++cupsd_timeout_t * /* O - Next enabled timeout or NULL */
++cupsdNextTimeout(long *delay) /* O - Seconds before scheduled */
++{
++ cupsd_timeout_t *first = cupsArrayFirst (Timeouts);
++ struct timeval curtime;
++
++ if (first && !first->enabled)
++ first = NULL;
++
++ if (first && delay)
++ {
++ gettimeofday (&curtime, NULL);
++ if (avahi_timeval_compare (&curtime, &first->when) > 0)
++ {
++ *delay = 0;
++ } else {
++ *delay = 1 + first->when.tv_sec - curtime.tv_sec;
++ if (first->when.tv_usec < curtime.tv_usec)
++ (*delay)--;
++ }
++ }
++
++ return (first);
++}
++
++
++/*
++ * 'cupsdRunTimeout()' - Run a timed callback.
++ */
++
++void
++cupsdRunTimeout(cupsd_timeout_t *timeout) /* I - Timeout */
++{
++ if (!timeout)
++ return;
++ timeout->enabled = 0;
++ if (!timeout->callback)
++ return;
++ timeout->callback (timeout, timeout->data);
++}
++
++/*
++ * 'cupsdUpdateTimeout()' - Adjust the time of a timed callback or disable it.
++ */
++
++void
++cupsdUpdateTimeout(cupsd_timeout_t *timeout, /* I - Timeout */
++ const struct timeval *tv) /* I - Absolute time or NULL */
++{
++ cupsArrayRemove (Timeouts, timeout);
++ timeout->enabled = (tv != NULL);
++ if (tv)
++ {
++ timeout->when.tv_sec = tv->tv_sec;
++ timeout->when.tv_usec = tv->tv_usec;
++ }
++ cupsArrayAdd (Timeouts, timeout);
++}
++
++
++/*
++ * 'cupsdRemoveTimeout()' - Discard a timed callback.
++ */
++
++void
++cupsdRemoveTimeout(cupsd_timeout_t *timeout) /* I - Timeout */
++{
++ cupsArrayRemove (Timeouts, timeout);
++ free (timeout);
++}
++
++
++#endif /* HAVE_AVAHI ... from top of file */
++
++/*
++ * End of "$Id$".
++ */
+--- a/cgi-bin/admin.c
++++ b/cgi-bin/admin.c
+@@ -1643,7 +1643,7 @@
+ else
+ local_protocols[0] = '\0';
+
+-#ifdef HAVE_DNSSD
++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
+ if (cgiGetVariable("BROWSE_LOCAL_DNSSD"))
+ {
+ if (local_protocols[0])
+@@ -1651,7 +1651,7 @@
+ else
+ strcat(local_protocols, "dnssd");
+ }
+-#endif /* HAVE_DNSSD */
++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
+
+ #ifdef HAVE_LDAP
+ if (cgiGetVariable("BROWSE_LOCAL_LDAP"))
+@@ -2718,9 +2718,9 @@
+ #endif /* HAVE_GSSAPI */
+ cgiSetVariable("KERBEROS", "");
+
+-#ifdef HAVE_DNSSD
++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
+ cgiSetVariable("HAVE_DNSSD", "1");
+-#endif /* HAVE_DNSSD */
++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
+
+ #ifdef HAVE_LDAP
+ cgiSetVariable("HAVE_LDAP", "1");
+--- a/scheduler/client.c
++++ b/scheduler/client.c
+@@ -4987,7 +4987,7 @@
+ !strncmp(host, "[::1]:", 6));
+ }
+
+-#ifdef HAVE_DNSSD
++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
+ /*
+ * Check if the hostname is something.local (Bonjour); if so, allow it.
+ */
+@@ -4996,7 +4996,7 @@
+ (!_cups_strcasecmp(end, ".local") || !_cups_strncasecmp(end, ".local:", 7) ||
+ !_cups_strcasecmp(end, ".local.") || !_cups_strncasecmp(end, ".local.:", 8)))
+ return (1);
+-#endif /* HAVE_DNSSD */
++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
+
+ /*
+ * Check if the hostname is an IP address...
+--- a/scheduler/dirsvc.c
++++ b/scheduler/dirsvc.c
+@@ -27,6 +27,7 @@
+ * ldap_connect() - Start new LDAP connection
+ * ldap_reconnect() - Reconnect to LDAP Server
+ * ldap_disconnect() - Disconnect from LDAP Server
++ * cupsdStartAvahiClient() - Start an Avahi client if needed
+ * cupsdStartBrowsing() - Start sending and receiving broadcast
+ * information.
+ * cupsdStartPolling() - Start polling servers as needed.
+@@ -45,6 +46,8 @@
+ * printer.
+ * dnssdPackTxtRecord() - Pack an array of key/value pairs into the TXT
+ * record format.
++ * avahiPackTxtRecord() - Pack an array of key/value pairs into an
++ * AvahiStringList.
+ * dnssdRegisterCallback() - DNSServiceRegister callback.
+ * dnssdRegisterPrinter() - Start sending broadcast information for a
+ * printer or update the broadcast contents.
+@@ -83,6 +86,7 @@
+ */
+
+ #include "cupsd.h"
++#include <assert.h>
+ #include <grp.h>
+
+ #ifdef HAVE_DNSSD
+@@ -97,6 +101,17 @@
+ # endif /* HAVE_SYSTEMCONFIGURATION */
+ # endif /* __APPLE__ */
+ #endif /* HAVE_DNSSD */
++#ifdef HAVE_AVAHI
++# include <avahi-common/domain.h>
++#endif /* HAVE_AVAHI */
++
++
++#ifdef HAVE_DNSSD
++typedef char *cupsd_txt_record_t;
++#endif /* HAVE_DNSSD */
++#ifdef HAVE_AVAHI
++typedef AvahiStringList *cupsd_txt_record_t;
++#endif /* HAVE_AVAHI */
+
+
+ /*
+@@ -159,27 +174,39 @@
+ static void update_smb(int onoff);
+
+
++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
++static cupsd_txt_record_t dnssdBuildTxtRecord(int *txt_len, cupsd_printer_t *p,
++ int for_lpd);
++static int dnssdComparePrinters(cupsd_printer_t *a, cupsd_printer_t *b);
++static void dnssdDeregisterPrinter(cupsd_printer_t *p);
++static void dnssdRegisterPrinter(cupsd_printer_t *p);
++static void dnssdStop(void);
++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
++
+ #ifdef HAVE_DNSSD
+ # ifdef HAVE_COREFOUNDATION
+ static void dnssdAddAlias(const void *key, const void *value,
+ void *context);
+ # endif /* HAVE_COREFOUNDATION */
+-static char *dnssdBuildTxtRecord(int *txt_len, cupsd_printer_t *p,
+- int for_lpd);
+-static int dnssdComparePrinters(cupsd_printer_t *a, cupsd_printer_t *b);
+-static void dnssdDeregisterPrinter(cupsd_printer_t *p);
+-static char *dnssdPackTxtRecord(int *txt_len, char *keyvalue[][2],
+- int count);
+ static void dnssdRegisterCallback(DNSServiceRef sdRef,
+ DNSServiceFlags flags,
+ DNSServiceErrorType errorCode,
+ const char *name, const char *regtype,
+ const char *domain, void *context);
+-static void dnssdRegisterPrinter(cupsd_printer_t *p);
+-static void dnssdStop(void);
+ static void dnssdUpdate(void);
+ #endif /* HAVE_DNSSD */
+
++#ifdef HAVE_AVAHI
++static AvahiStringList *avahiPackTxtRecord(char *keyvalue[][2],
++ int count);
++static void avahi_entry_group_cb (AvahiEntryGroup *group,
++ AvahiEntryGroupState state,
++ void *userdata);
++static void avahi_client_cb (AvahiClient *client,
++ AvahiClientState state,
++ void *userdata);
++#endif /* HAVE_AVAHI */
++
+ #ifdef HAVE_LDAP
+ static const char * const ldap_attrs[] =/* CUPS LDAP attributes */
+ {
+@@ -283,10 +310,10 @@
+ ldap_dereg_printer(p);
+ #endif /* HAVE_LDAP */
+
+-#ifdef HAVE_DNSSD
+- if (removeit && (BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDRef)
++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
++ if (removeit && (BrowseLocalProtocols & BROWSE_DNSSD))
+ dnssdDeregisterPrinter(p);
+-#endif /* HAVE_DNSSD */
++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
+ }
+
+
+@@ -702,10 +729,10 @@
+ slpRegisterPrinter(p); */
+ #endif /* HAVE_LIBSLP */
+
+-#ifdef HAVE_DNSSD
+- if ((BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDRef)
++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
++ if ((BrowseLocalProtocols & BROWSE_DNSSD))
+ dnssdRegisterPrinter(p);
+-#endif /* HAVE_DNSSD */
++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
+ }
+
+
+@@ -1419,6 +1446,27 @@
+ #endif /* HAVE_LDAP */
+
+
++#ifdef HAVE_AVAHI
++/*
++ * 'cupsdStartAvahiClient()' - Start an Avahi client if needed
++ */
++
++void
++cupsdStartAvahiClient(void)
++{
++ if (!AvahiCupsClient && !AvahiCupsClientConnecting)
++ {
++ if (!AvahiCupsPollHandle)
++ AvahiCupsPollHandle = avahi_cups_poll_new ();
++
++ if (AvahiCupsPollHandle)
++ avahi_client_new (avahi_cups_poll_get (AvahiCupsPollHandle),
++ AVAHI_CLIENT_NO_FAIL, avahi_client_cb, NULL, NULL);
++ }
++}
++#endif /* HAVE_AVAHI */
++
++
+ /*
+ * 'cupsdStartBrowsing()' - Start sending and receiving broadcast information.
+ */
+@@ -1542,13 +1590,16 @@
+ else
+ BrowseSocket = -1;
+
+-#ifdef HAVE_DNSSD
++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
+ if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_DNSSD)
+ {
++#ifdef HAVE_DNSSD
+ DNSServiceErrorType error; /* Error from service creation */
++#endif /* HAVE_DNSSD */
+ cupsd_listener_t *lis; /* Current listening socket */
+
+
++#ifdef HAVE_DNSSD
+ /*
+ * First create a "master" connection for all registrations...
+ */
+@@ -1573,6 +1624,7 @@
+ fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
+
+ cupsdAddSelect(fd, (cupsd_selfunc_t)dnssdUpdate, NULL, NULL);
++#endif /* HAVE_DNSSD */
+
+ /*
+ * Then get the port we use for registrations. If we are not listening
+@@ -1606,9 +1658,16 @@
+ */
+
+ cupsdUpdateDNSSDName();
++
++#ifdef HAVE_AVAHI
++ cupsdStartAvahiClient ();
++#endif /* HAVE_AVAHI */
++
++#ifdef HAVE_DNSSD
+ }
+- }
+ #endif /* HAVE_DNSSD */
++ }
++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
+
+ #ifdef HAVE_LIBSLP
+ if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP)
+@@ -1834,10 +1893,10 @@
+ BrowseSocket = -1;
+ }
+
+-#ifdef HAVE_DNSSD
+- if ((BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDRef)
++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
++ if ((BrowseLocalProtocols & BROWSE_DNSSD))
+ dnssdStop();
+-#endif /* HAVE_DNSSD */
++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
+
+ #ifdef HAVE_LIBSLP
+ if (((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP) &&
+@@ -1902,7 +1961,7 @@
+ }
+
+
+-#ifdef HAVE_DNSSD
++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
+ /*
+ * 'cupsdUpdateDNSSDName()' - Update the computer name we use for browsing...
+ */
+@@ -1910,8 +1969,14 @@
+ void
+ cupsdUpdateDNSSDName(void)
+ {
++#ifdef HAVE_DNSSD
+ DNSServiceErrorType error; /* Error from service creation */
+ char webif[1024]; /* Web interface share name */
++#endif /* HAVE_DNSSD */
++#ifdef HAVE_AVAHI
++ int ret; /* Error from service creation */
++ char webif[AVAHI_LABEL_MAX]; /* Web interface share name */
++#endif /* HAVE_AVAHI */
+ # ifdef HAVE_SYSTEMCONFIGURATION
+ SCDynamicStoreRef sc; /* Context for dynamic store */
+ CFDictionaryRef btmm; /* Back-to-My-Mac domains */
+@@ -2042,6 +2107,7 @@
+ else
+ strlcpy(webif, "CUPS Web Interface", sizeof(webif));
+
++#ifdef HAVE_DNSSD
+ if (WebIFRef)
+ DNSServiceRefDeallocate(WebIFRef);
+
+@@ -2054,9 +2120,45 @@
+ NULL)) != kDNSServiceErr_NoError)
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "DNS-SD web interface registration failed: %d", error);
++#endif /* HAVE_DNSSD */
++
++#ifdef HAVE_AVAHI
++ if (!AvahiCupsClient)
++ /*
++ * Client not yet running.
++ */
++ return;
++
++ if (AvahiWebIFGroup)
++ avahi_entry_group_reset (AvahiWebIFGroup);
++ else
++ AvahiWebIFGroup = avahi_entry_group_new (AvahiCupsClient,
++ avahi_entry_group_cb,
++ NULL);
++
++ if (AvahiWebIFGroup)
++ {
++ ret = avahi_entry_group_add_service (AvahiWebIFGroup,
++ AVAHI_IF_UNSPEC,
++ AVAHI_PROTO_UNSPEC,
++ 0, /* flags */
++ webif, /* name */
++ "_http._tcp", /* type */
++ NULL, /* domain */
++ NULL, /* host */
++ DNSSDPort, /* port */
++ "path=/", NULL);
++ if (ret == 0)
++ ret = avahi_entry_group_commit (AvahiWebIFGroup);
++
++ if (ret != 0)
++ cupsdLogMessage (CUPSD_LOG_ERROR,
++ "Avahi web interface registration failed: %d", ret);
++ }
++#endif /* HAVE_AVAHI */
+ }
+ }
+-#endif /* HAVE_DNSSD */
++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
+
+
+ #ifdef HAVE_LDAP
+@@ -2334,13 +2436,15 @@
+ "Bad Back to My Mac domain in dynamic store!");
+ }
+ # endif /* HAVE_COREFOUNDATION */
++#endif /* HAVE_DNSSD */
+
+
++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
+ /*
+ * 'dnssdBuildTxtRecord()' - Build a TXT record from printer info.
+ */
+
+-static char * /* O - TXT record */
++static cupsd_txt_record_t /* O - TXT record */
+ dnssdBuildTxtRecord(
+ int *txt_len, /* O - TXT record length */
+ cupsd_printer_t *p, /* I - Printer information */
+@@ -2379,7 +2483,12 @@
+ keyvalue[i ][0] = "ty";
+ keyvalue[i++][1] = p->make_model ? p->make_model : "Unknown";
+
+- snprintf(admin_hostname, sizeof(admin_hostname), "%s.local.", DNSSDHostName);
++ snprintf(admin_hostname, sizeof(admin_hostname),
++ "%s.local"
++#ifdef HAVE_DNSSD
++ "." /* terminating dot no good for Avahi */
++#endif /* HAVE_DNSSD */
++ , DNSSDHostName);
+ httpAssembleURIf(HTTP_URI_CODING_ALL, adminurl_str, sizeof(adminurl_str),
+ "http", NULL, admin_hostname, DNSSDPort, "/%s/%s",
+ (p->type & CUPS_PRINTER_CLASS) ? "classes" : "printers",
+@@ -2462,7 +2571,12 @@
+ * Then pack them into a proper txt record...
+ */
+
++#ifdef HAVE_DNSSD
+ return (dnssdPackTxtRecord(txt_len, keyvalue, i));
++#endif /* HAVE_DNSSD */
++#ifdef HAVE_AVAHI
++ return (avahiPackTxtRecord(keyvalue, i));
++#endif /* HAVE_AVAHI */
+ }
+
+
+@@ -2474,7 +2588,16 @@
+ dnssdComparePrinters(cupsd_printer_t *a,/* I - First printer */
+ cupsd_printer_t *b)/* I - Second printer */
+ {
+- return (_cups_strcasecmp(a->reg_name, b->reg_name));
++ if (!a->reg_name)
++ if (!b->reg_name)
++ return 0;
++ else
++ return -1;
++ else
++ if (!b->reg_name)
++ return 1;
++ else
++ return (_cups_strcasecmp(a->reg_name, b->reg_name));
+ }
+
+
+@@ -2489,6 +2612,10 @@
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdDeregisterPrinter(%s)", p->name);
+
++#ifdef HAVE_DNSSD
++ if (!DNSSDRef)
++ return;
++
+ /*
+ * Closing the socket deregisters the service
+ */
+@@ -2524,6 +2651,24 @@
+ free(p->printer_txt);
+ p->printer_txt = NULL;
+ }
++#endif /* HAVE_DNSSD */
++
++#ifdef HAVE_AVAHI
++ if (p->avahi_group)
++ {
++ avahi_entry_group_reset (p->avahi_group);
++ avahi_entry_group_free (p->avahi_group);
++ p->avahi_group = NULL;
++
++ if (p->ipp_txt)
++ avahi_string_list_free (p->ipp_txt);
++
++ if (p->printer_txt)
++ avahi_string_list_free (p->printer_txt);
++
++ p->ipp_txt = p->printer_txt = NULL;
++ }
++#endif /* HAVE_AVAHI */
+
+ /*
+ * Remove the printer from the array of DNS-SD printers, then clear the
+@@ -2533,8 +2678,10 @@
+ cupsArrayRemove(DNSSDPrinters, p);
+ cupsdClearString(&p->reg_name);
+ }
++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
+
+
++#ifdef HAVE_DNSSD
+ /*
+ * 'dnssdPackTxtRecord()' - Pack an array of key/value pairs into the
+ * TXT record format.
+@@ -2644,8 +2791,10 @@
+ LastEvent |= CUPSD_EVENT_PRINTER_MODIFIED;
+ }
+ }
++#endif /* HAVE_DNSSD */
+
+
++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
+ /*
+ * 'dnssdRegisterPrinter()' - Start sending broadcast information for a printer
+ * or update the broadcast contents.
+@@ -2654,20 +2803,40 @@
+ static void
+ dnssdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */
+ {
++#ifdef HAVE_DNSSD
+ DNSServiceErrorType se; /* dnssd errors */
+ char *ipp_txt, /* IPP TXT record buffer */
+ *printer_txt, /* LPD TXT record buffer */
+- name[1024], /* Service name */
+- *nameptr; /* Pointer into name */
++ name[1024]; /* Service name */
+ int ipp_len, /* IPP TXT record length */
+ printer_len, /* LPD TXT record length */
+ printer_port; /* LPD port number */
++#endif /* HAVE_DNSSD */
++#ifdef HAVE_AVAHI
++ int ret; /* Error code */
++ AvahiStringList *ipp_txt, /* IPP TXT record */
++ *printer_txt; /* LPD TXT record */
++ char name[AVAHI_LABEL_MAX], /* Service name */
++ fullsubtype[AVAHI_LABEL_MAX]; /* Full subtype */
++ char *regtype_copy, /* Writeable copy of reg type */
++ *subtype, /* Current service sub type */
++ *nextsubtype; /* Next service sub type */
++#endif /* HAVE_AVAHI */
++ char *nameptr; /* Pointer into name */
+ const char *regtype; /* Registration type */
+
+
++#ifdef HAVE_DNSSD
++ if (!DNSSDRef)
++ return;
++
+ cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdRegisterPrinter(%s) %s", p->name,
+ !p->ipp_ref ? "new" : "update");
+-
++#endif /* HAVE_DNSSD */
++#ifdef HAVE_AVAHI
++ cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdRegisterPrinter(%s) %s", p->name,
++ !p->avahi_group ? "new" : "update");
++#endif /* HAVE_AVAHI */
+ /*
+ * If per-printer sharing was just disabled make sure we're not
+ * registered before returning.
+@@ -2686,12 +2855,36 @@
+ if (p->info && strlen(p->info) > 0)
+ {
+ if (DNSSDComputerName)
+- snprintf(name, sizeof(name), "%s @ %s", p->info, DNSSDComputerName);
++ {
++ /*
++ * Make sure there is room for at least 15 characters of
++ * DNSSDComputerName.
++ */
++
++ assert(sizeof(name) >= 15 + 4);
++ nameptr = name + strlcpy(name, p->info,
++ sizeof(name) - 4 -
++ strnlen(DNSSDComputerName, 15));
++ nameptr += strlcpy(nameptr, " @ ", sizeof(name) - (nameptr - name));
++ strlcpy(nameptr, DNSSDComputerName, sizeof(name) - (nameptr - name));
++ }
+ else
+ strlcpy(name, p->info, sizeof(name));
+ }
+ else if (DNSSDComputerName)
+- snprintf(name, sizeof(name), "%s @ %s", p->name, DNSSDComputerName);
++ {
++ /*
++ * Make sure there is room for at least 15 characters of
++ * DNSSDComputerName.
++ */
++
++ assert(sizeof(name) >= 15 + 4);
++ nameptr = name + strlcpy(name, p->info,
++ sizeof(name) - 4 -
++ strnlen(DNSSDComputerName, 15));
++ nameptr += strlcpy(nameptr, " @ ", sizeof(name) - (nameptr - name));
++ strlcpy(nameptr, DNSSDComputerName, sizeof(name) - (nameptr - name));
++ }
+ else
+ strlcpy(name, p->name, sizeof(name));
+
+@@ -2712,6 +2905,7 @@
+ * Register IPP and (optionally) LPD...
+ */
+
++#ifdef HAVE_DNSSD
+ ipp_len = 0; /* anti-compiler-warning-code */
+ ipp_txt = dnssdBuildTxtRecord(&ipp_len, p, 0);
+
+@@ -2884,6 +3078,209 @@
+
+ if (printer_txt)
+ free(printer_txt);
++#endif /* HAVE_DNSSD */
++#ifdef HAVE_AVAHI
++ if (!AvahiCupsClient)
++ /*
++ * Client not running yet. The client callback will call us again later.
++ */
++ return;
++
++ ipp_txt = dnssdBuildTxtRecord(NULL, p, 0);
++ printer_txt = dnssdBuildTxtRecord(NULL, p, 1);
++ regtype = (p->type & CUPS_PRINTER_FAX) ? "_fax-ipp._tcp" : DNSSDRegType;
++
++ if (p->avahi_group && p->ipp_txt && ipp_txt &&
++ !avahi_string_list_equal (p->ipp_txt, ipp_txt))
++ {
++ /*
++ * Update the existing registration...
++ */
++
++ avahi_string_list_free (p->ipp_txt);
++
++ if (p->printer_txt)
++ avahi_string_list_free (p->printer_txt);
++
++ /*
++ * Update the service group entry.
++ */
++
++ regtype_copy = strdup (regtype);
++ subtype = strchr (regtype_copy, ',');
++ if (subtype)
++ *subtype = '\0';
++
++ cupsdLogMessage (CUPSD_LOG_DEBUG,
++ "Updating TXT record for %s (%s)", name, regtype_copy);
++ ret = avahi_entry_group_update_service_txt_strlst (p->avahi_group,
++ AVAHI_IF_UNSPEC,
++ AVAHI_PROTO_UNSPEC,
++ 0, name,
++ regtype_copy,
++ NULL, ipp_txt);
++ free (regtype_copy);
++
++ if (ret < 0)
++ goto update_failed;
++
++ p->ipp_txt = ipp_txt;
++ ipp_txt = NULL;
++
++ if (BrowseLocalProtocols & BROWSE_LPD)
++ {
++ ret = avahi_entry_group_update_service_txt_strlst (p->avahi_group,
++ AVAHI_IF_UNSPEC,
++ AVAHI_PROTO_UNSPEC,
++ 0, name,
++ "_printer._tcp", NULL,
++ printer_txt);
++ if (ret < 0)
++ goto update_failed;
++
++ p->printer_txt = printer_txt;
++ printer_txt = NULL;
++ }
++
++ ret = avahi_entry_group_commit (p->avahi_group);
++ if (ret < 0)
++ {
++ update_failed:
++ cupsdLogMessage (CUPSD_LOG_ERROR,
++ "Failed to update TXT record for %s: %d",
++ name, ret);
++ avahi_entry_group_reset (p->avahi_group);
++ avahi_entry_group_free (p->avahi_group);
++ p->avahi_group = NULL;
++ ipp_txt = p->ipp_txt;
++ p->ipp_txt = NULL;
++ }
++ }
++
++ if (!p->avahi_group)
++ {
++ /*
++ * Initial registration. Use the _fax subtype for fax queues...
++ */
++
++ p->avahi_group = avahi_entry_group_new (AvahiCupsClient,
++ avahi_entry_group_cb,
++ p);
++
++ cupsdLogMessage(CUPSD_LOG_DEBUG,
++ "Registering Avahi printer %s with name \"%s\" and "
++ "type \"%s\"", p->name, name, regtype);
++
++ if (!p->avahi_group)
++ {
++ ret = 0;
++ goto add_failed;
++ }
++
++ /*
++ * Add each service type (DNSSDRegType may contain several,
++ * separated by commas).
++ */
++
++ subtype = regtype_copy = strdup (regtype);
++ while (subtype && *subtype)
++ {
++ nextsubtype = strchr (subtype, ',');
++ if (nextsubtype)
++ *nextsubtype++ = '\0';
++
++ if (subtype == regtype_copy)
++ {
++ /*
++ * Main type entry.
++ */
++
++ cupsdLogMessage (CUPSD_LOG_DEBUG,
++ "Adding TXT record for %s (%s)", name, regtype_copy);
++ ret = avahi_entry_group_add_service_strlst (p->avahi_group,
++ AVAHI_IF_UNSPEC,
++ AVAHI_PROTO_UNSPEC,
++ 0, name, regtype_copy,
++ NULL, NULL,
++ DNSSDPort,
++ ipp_txt);
++ }
++ else
++ {
++ /*
++ * Sub-type entry.
++ */
++
++ snprintf (fullsubtype, sizeof(fullsubtype),
++ "%s._sub.%s", subtype, regtype_copy);
++ cupsdLogMessage (CUPSD_LOG_DEBUG,
++ "Adding TXT record for %s (%s)", name, fullsubtype);
++ ret = avahi_entry_group_add_service_subtype (p->avahi_group,
++ AVAHI_IF_UNSPEC,
++ AVAHI_PROTO_UNSPEC,
++ 0, name,
++ regtype_copy,
++ NULL, fullsubtype);
++ }
++
++ if (ret < 0)
++ {
++ free (regtype_copy);
++ goto add_failed;
++ }
++
++ subtype = nextsubtype;
++ }
++
++ free (regtype_copy);
++ p->ipp_txt = ipp_txt;
++ ipp_txt = NULL;
++
++ if (BrowseLocalProtocols & BROWSE_LPD)
++ {
++ cupsdLogMessage(CUPSD_LOG_DEBUG,
++ "Registering Avahi printer %s with name \"%s\" and "
++ "type \"_printer._tcp\"", p->name, name);
++
++ ret = avahi_entry_group_add_service_strlst (p->avahi_group,
++ AVAHI_IF_UNSPEC,
++ AVAHI_PROTO_UNSPEC,
++ 0, name,
++ "_printer._tcp", NULL, NULL,
++ 515,
++ printer_txt);
++ if (ret < 0)
++ goto add_failed;
++
++ p->printer_txt = printer_txt;
++ printer_txt = NULL;
++ }
++
++ ret = avahi_entry_group_commit (p->avahi_group);
++
++ if (ret < 0)
++ {
++ add_failed:
++ cupsdLogMessage (CUPSD_LOG_ERROR,
++ "Failed to add Avahi entry for %s: %d",
++ name, ret);
++ if (p->avahi_group)
++ {
++ avahi_entry_group_reset (p->avahi_group);
++ avahi_entry_group_free (p->avahi_group);
++ p->avahi_group = NULL;
++ }
++ ipp_txt = p->ipp_txt;
++ p->ipp_txt = NULL;
++ }
++ }
++
++ if (ipp_txt)
++ avahi_string_list_free (ipp_txt);
++
++ if (printer_txt)
++ avahi_string_list_free (printer_txt);
++#endif /* HAVE_AVAHI */
+ }
+
+
+@@ -2896,6 +3293,10 @@
+ {
+ cupsd_printer_t *p; /* Current printer */
+
++#ifdef HAVE_DNSSD
++ if (!DNSSDRef)
++ return;
++#endif /* HAVE_DNSSD */
+
+ /*
+ * De-register the individual printers
+@@ -2906,6 +3307,7 @@
+ p = (cupsd_printer_t *)cupsArrayNext(Printers))
+ dnssdDeregisterPrinter(p);
+
++#ifdef HAVE_DNSSD
+ /*
+ * Shutdown the rest of the service refs...
+ */
+@@ -2926,14 +3328,17 @@
+
+ DNSServiceRefDeallocate(DNSSDRef);
+ DNSSDRef = NULL;
++#endif /* HAVE_DNSSD */
+
+ cupsArrayDelete(DNSSDPrinters);
+ DNSSDPrinters = NULL;
+
+ DNSSDPort = 0;
+ }
++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
+
+
++#ifdef HAVE_DNSSD
+ /*
+ * 'dnssdUpdate()' - Handle DNS-SD queries.
+ */
+@@ -2955,6 +3360,147 @@
+ #endif /* HAVE_DNSSD */
+
+
++#ifdef HAVE_AVAHI
++/*
++ * 'avahiPackTxtRecord()' - Pack an array of key/value pairs into an
++ * AvahiStringList.
++ */
++
++static AvahiStringList * /* O - new string list */
++avahiPackTxtRecord(char *keyvalue[][2], /* I - Table of key value pairs */
++ int count) /* I - Number of items in table */
++{
++ AvahiStringList *strlst = NULL;
++ char **elements;
++ size_t len;
++ int i = 0;
++
++ elements = malloc ((1 + count) * sizeof (char *));
++ if (!elements)
++ goto cleanup;
++
++ for (i = 0; i < count; i++)
++ {
++ len = (1 + strlen (keyvalue[i][0]) +
++ (keyvalue[i][1] ? 1 + strlen (keyvalue[i][1]) : 1));
++ elements[i] = malloc (len * sizeof (char));
++ if (!elements[i])
++ goto cleanup;
++
++ snprintf (elements[i], len, "%s=%s", keyvalue[i][0], keyvalue[i][1]);
++ }
++
++ strlst = avahi_string_list_new_from_array ((const char **) elements, count);
++
++cleanup:
++ while (--i >= 0)
++ free (elements[i]);
++
++ free (elements);
++ return (strlst);
++}
++
++
++/*
++ * 'avahi_entry_group_cb()' - Avahi entry group callback function.
++ */
++static void
++avahi_entry_group_cb (AvahiEntryGroup *group,
++ AvahiEntryGroupState state,
++ void *userdata)
++{
++ char *name;
++
++ if (userdata)
++ name = ((cupsd_printer_t *) userdata)->reg_name;
++ else
++ name = "CUPS web interface";
++
++ switch (state)
++ {
++ case AVAHI_ENTRY_GROUP_UNCOMMITED:
++ case AVAHI_ENTRY_GROUP_REGISTERING:
++ break;
++
++ case AVAHI_ENTRY_GROUP_ESTABLISHED:
++ cupsdLogMessage (CUPSD_LOG_DEBUG,
++ "Avahi entry group established for %s", name);
++ break;
++
++ default:
++ cupsdLogMessage (CUPSD_LOG_DEBUG,
++ "Avahi entry group %s has state %d",
++ name, state);
++ break;
++ }
++}
++
++
++/*
++ * 'avahi_client_cb()' - Avahi client callback function.
++ */
++static void
++avahi_client_cb (AvahiClient *client,
++ AvahiClientState state,
++ void *userdata)
++{
++ cupsd_printer_t *printer;
++ switch (state)
++ {
++ case AVAHI_CLIENT_S_RUNNING:
++ /*
++ * Avahi client started successfully.
++ */
++ AvahiCupsClient = client;
++ AvahiCupsClientConnecting = 0;
++ cupsdLogMessage (CUPSD_LOG_DEBUG, "Avahi client started");
++
++ cupsdUpdateDNSSDName ();
++
++ for (printer = (cupsd_printer_t *)cupsArrayFirst(Printers);
++ printer;
++ printer = (cupsd_printer_t *)cupsArrayNext(Printers))
++ if (Browsing && (BrowseLocalProtocols & BROWSE_DNSSD) &&
++ (!(printer->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT |
++ CUPS_PRINTER_SCANNER))) && printer->shared)
++ dnssdRegisterPrinter (printer);
++
++ break;
++
++ case AVAHI_CLIENT_CONNECTING:
++ /*
++ * No Avahi daemon, client is waiting.
++ */
++ AvahiCupsClientConnecting = 1;
++ cupsdLogMessage (CUPSD_LOG_DEBUG, "Avahi client connecting");
++ break;
++
++ case AVAHI_CLIENT_FAILURE:
++ /*
++ * Avahi client failed, close it to allow a clean restart.
++ */
++ cupsdLogMessage (CUPSD_LOG_ERROR,
++ "Avahi client failed, "
++ "closing client to allow a clean restart");
++
++ for (printer = (cupsd_printer_t *)cupsArrayFirst(Printers);
++ printer;
++ printer = (cupsd_printer_t *)cupsArrayNext(Printers))
++ dnssdDeregisterPrinter (printer);
++
++ avahi_client_free(client);
++ AvahiCupsClientConnecting = 0;
++ AvahiCupsClient = NULL;
++
++ break;
++
++ default:
++ cupsdLogMessage (CUPSD_LOG_DEBUG, "Avahi client state: %d", state);
++ }
++}
++#endif /* HAVE_AVAHI */
++
++
+ /*
+ * 'get_auth_info_required()' - Get the auth-info-required value to advertise.
+ */
+--- a/scheduler/dirsvc.h
++++ b/scheduler/dirsvc.h
+@@ -31,6 +31,10 @@
+ # endif /* HAVE_LDAP_SSL_H */
+ #endif /* HAVE_LDAP */
++#ifdef HAVE_AVAHI
++# include <avahi-client/publish.h>
++#endif /* HAVE_AVAHI */
++
/*
- * End of "$Id: http-support.c 9322 2010-10-01 22:40:38Z mike $".
+ * Browse protocols...
+ */
+@@ -131,19 +135,22 @@
+ VAR cupsd_statbuf_t *PollStatusBuffer VALUE(NULL);
+ /* Status buffer for pollers */
+
+-#ifdef HAVE_DNSSD
++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
+ VAR char *DNSSDComputerName VALUE(NULL),
+ /* Computer/server name */
+ *DNSSDHostName VALUE(NULL),
+ /* Hostname */
+ *DNSSDRegType VALUE(NULL);
+ /* Bonjour registration type */
+-VAR cups_array_t *DNSSDAlias VALUE(NULL);
+- /* List of dynamic ServerAlias's */
+ VAR int DNSSDPort VALUE(0);
+ /* Port number to register */
+ VAR cups_array_t *DNSSDPrinters VALUE(NULL);
+ /* Printers we have registered */
++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
++
++#ifdef HAVE_DNSSD
++VAR cups_array_t *DNSSDAlias VALUE(NULL);
++ /* List of dynamic ServerAlias's */
+ VAR DNSServiceRef DNSSDRef VALUE(NULL),
+ /* Master DNS-SD service reference */
+ WebIFRef VALUE(NULL),
+@@ -152,6 +159,17 @@
+ /* Remote printer browse reference */
+ #endif /* HAVE_DNSSD */
+
++#ifdef HAVE_AVAHI
++VAR AvahiCupsPoll *AvahiCupsPollHandle VALUE(NULL);
++ /* AvahiCupsPoll object */
++VAR AvahiClient *AvahiCupsClient VALUE(NULL);
++ /* AvahiClient object */
++VAR int AvahiCupsClientConnecting VALUE(0);
++ /* Is AvahiClient object connecting? */
++VAR AvahiEntryGroup *AvahiWebIFGroup VALUE(NULL);
++ /* Web interface entry group */
++#endif /* HAVE_AVAHI */
++
+ #ifdef HAVE_LIBSLP
+ VAR SLPHandle BrowseSLPHandle VALUE(NULL);
+ /* SLP API handle */
+@@ -195,13 +213,14 @@
+ extern void cupsdRestartPolling(void);
+ extern void cupsdSaveRemoteCache(void);
+ extern void cupsdSendBrowseList(void);
++extern void cupsdStartAvahiClient(void);
+ extern void cupsdStartBrowsing(void);
+ extern void cupsdStartPolling(void);
+ extern void cupsdStopBrowsing(void);
+ extern void cupsdStopPolling(void);
+-#ifdef HAVE_DNSSD
++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
+ extern void cupsdUpdateDNSSDName(void);
+-#endif /* HAVE_DNSSD */
++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
+ #ifdef HAVE_LDAP
+ extern void cupsdUpdateLDAPBrowse(void);
+ #endif /* HAVE_LDAP */
+--- a/scheduler/ipp.c
++++ b/scheduler/ipp.c
+@@ -6087,7 +6087,7 @@
+ ippAddDate(con->response, IPP_TAG_PRINTER, "printer-current-time",
+ ippTimeToDate(curtime));
+
+-#ifdef HAVE_DNSSD
++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
+ if (!ra || cupsArrayFind(ra, "printer-dns-sd-name"))
+ {
+ if (printer->reg_name)
+@@ -6097,7 +6097,7 @@
+ ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_NOVALUE,
+ "printer-dns-sd-name", 0);
+ }
+-#endif /* HAVE_DNSSD */
++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
+
+ if (!ra || cupsArrayFind(ra, "printer-error-policy"))
+ ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_NAME,
+--- a/scheduler/printers.c
++++ b/scheduler/printers.c
+@@ -883,9 +883,9 @@
+ cupsdClearString(&p->alert);
+ cupsdClearString(&p->alert_description);
+
+-#ifdef HAVE_DNSSD
++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
+ cupsdClearString(&p->pdl);
+-#endif /* HAVE_DNSSD */
++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
+
+ cupsArrayDelete(p->filetypes);
+
+@@ -3765,7 +3765,7 @@
+ attr->values[i].string.text = _cupsStrAlloc(mimetype);
+ }
+
+-#ifdef HAVE_DNSSD
++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
+ {
+ char pdl[1024]; /* Buffer to build pdl list */
+ mime_filter_t *filter; /* MIME filter looping var */
+@@ -3821,7 +3821,7 @@
+
+ cupsdSetString(&p->pdl, pdl);
+ }
+-#endif /* HAVE_DNSSD */
++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
+ }
+
+
+--- a/scheduler/printers.h
++++ b/scheduler/printers.h
+@@ -16,6 +16,9 @@
+ #ifdef HAVE_DNSSD
+ # include <dns_sd.h>
+ #endif /* HAVE_DNSSD */
++#ifdef HAVE_AVAHI
++# include "avahi.h"
++#endif /* HAVE_AVAHI */
+ #include <cups/pwg-private.h>
+
+
+@@ -95,16 +98,23 @@
+ time_t marker_time; /* Last time marker attributes were updated */
+ _ppd_cache_t *pc; /* PPD cache and mapping data */
+
+-#ifdef HAVE_DNSSD
++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
+ char *reg_name, /* Name used for service registration */
+- *pdl, /* pdl value for TXT record */
+- *ipp_txt, /* IPP TXT record contents */
++ *pdl; /* pdl value for TXT record */
++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
++#ifdef HAVE_DNSSD
++ char *ipp_txt, /* IPP TXT record contents */
+ *printer_txt; /* LPD TXT record contents */
+ int ipp_len, /* IPP TXT record length */
+ printer_len; /* LPD TXT record length */
+ DNSServiceRef ipp_ref, /* Reference for _ipp._tcp,_cups */
+ printer_ref; /* Reference for _printer._tcp */
+ #endif /* HAVE_DNSSD */
++#ifdef HAVE_AVAHI
++ AvahiStringList *ipp_txt, /* IPP TXT record */
++ *printer_txt; /* LPD TXT record */
++ AvahiEntryGroup *avahi_group; /* Avahi entry group */
++#endif /* HAVE_AVAHI */
+ };
+
+
+--- a/scheduler/conf.c
++++ b/scheduler/conf.c
+@@ -650,7 +650,7 @@
+ Browsing = CUPS_DEFAULT_BROWSING;
+ DefaultShared = CUPS_DEFAULT_DEFAULT_SHARED;
+
+-#ifdef HAVE_DNSSD
++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
+ cupsdSetString(&DNSSDRegType, "_ipp._tcp,_cups");
+ #endif /* HAVE_DNSSD */
+
diff --git a/testing/cups/cups-no-gcrypt.patch b/testing/cups/cups-no-gcrypt.patch
index 203b4f4ac..42f71d0d4 100644
--- a/testing/cups/cups-no-gcrypt.patch
+++ b/testing/cups/cups-no-gcrypt.patch
@@ -1,17 +1,17 @@
diff -ruN cups-1.4.7.orig//config-scripts/cups-ssl.m4 cups-1.4.7/config-scripts/cups-ssl.m4
---- cups-1.4.7.orig//config-scripts/cups-ssl.m4 2011-01-11 08:05:58.000000000 +0100
-+++ cups-1.4.7/config-scripts/cups-ssl.m4 2011-08-02 10:44:26.011047900 +0200
-@@ -74,7 +74,6 @@
+--- cups-1.5.0.orig//config-scripts/cups-ssl.m4 2011-01-11 08:05:58.000000000 +0100
++++ cups-1.5.0/config-scripts/cups-ssl.m4 2011-08-02 10:44:26.011047900 +0200
+@@ -96,7 +96,6 @@
dnl Then look for GNU TLS...
if test $have_ssl = 0 -a "x$enable_gnutls" != "xno" -a "x$PKGCONFIG" != x; then
AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config)
- AC_PATH_PROG(LIBGCRYPTCONFIG,libgcrypt-config)
if $PKGCONFIG --exists gnutls; then
- if test "x$have_pthread" = xyes; then
- AC_MSG_WARN([The current version of GNU TLS cannot be made thread-safe.])
-@@ -96,16 +95,6 @@
- AC_DEFINE(HAVE_GNUTLS)
- fi
+ have_ssl=1
+ SSLLIBS=`$PKGCONFIG --libs gnutls`
+@@ -110,16 +109,6 @@
+ AC_DEFINE(HAVE_SSL)
+ AC_DEFINE(HAVE_GNUTLS)
fi
-
- if test $have_ssl = 1; then
@@ -26,14 +26,13 @@ diff -ruN cups-1.4.7.orig//config-scripts/cups-ssl.m4 cups-1.4.7/config-scripts/
fi
dnl Check for the OpenSSL library last...
-diff -ruN cups-1.4.7.orig//cups/http-private.h cups-1.4.7/cups/http-private.h
---- cups-1.4.7.orig//cups/http-private.h 2011-01-22 01:07:22.000000000 +0100
-+++ cups-1.4.7/cups/http-private.h 2011-08-02 10:42:43.341604107 +0200
-@@ -98,7 +98,6 @@
- * The GNU TLS library is more of a "bare metal" SSL/TLS library...
- */
+--- cups-1.5.0.orig//cups/http-private.h 2011-01-22 01:07:22.000000000 +0100
++++ cups-1.5.0/cups/http-private.h 2011-08-02 10:42:43.341604107 +0200
+@@ -93,7 +93,6 @@
+ # elif defined HAVE_GNUTLS
# include <gnutls/gnutls.h>
+ # include <gnutls/x509.h>
-# include <gcrypt.h>
-
- typedef struct
- {
+ # elif defined(HAVE_CDSASSL)
+ # include <CoreFoundation/CoreFoundation.h>
+ # include <Security/Security.h>
diff --git a/testing/gpsd/PKGBUILD b/testing/gpsd/PKGBUILD
new file mode 100644
index 000000000..d4c1119cd
--- /dev/null
+++ b/testing/gpsd/PKGBUILD
@@ -0,0 +1,78 @@
+# $Id: PKGBUILD 135847 2011-08-19 16:38:40Z andrea $
+# Maintainer: Andrea Scarpino <andrea@archlinux.org>
+# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
+# Contributor: dibblethewrecker dibblethewrecker.at.jiwe.dot.org
+# Contributor: Giacomo Rizzo <alt@free-os.it>
+
+pkgname=gpsd
+pkgver=3.0
+pkgrel=1
+pkgdesc="GPS daemon and library to support USB/serial GPS devices"
+arch=('i686' 'x86_64')
+url="http://gpsd.berlios.de"
+license=('BSD')
+depends=('python2' 'libusb' 'bluez' 'desktop-file-utils')
+optdepends=('php: generate a PHP status page for your GPS'
+ 'php-gd: image support for the PHP status page')
+makedepends=('scons' 'docbook-xsl' 'chrpath')
+backup=('etc/conf.d/gpsd' 'lib/udev/rules.d/99-gpsd-usb.rules')
+options=('!libtool' '!buildflags')
+install="${pkgname}.install"
+source=("http://download.berlios.de/${pkgname}/${pkgname}-${pkgver}.tar.gz"
+ 'gpsd')
+md5sums=('c63d41a26868e9bdd48d9e311a9cc42c'
+ 'e287d4b34a4eb1da27f12533ae9b6dd5')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ # fix python 2.7 path
+ sed -i -e "s|#![ ]*/usr/bin/python$|#!/usr/bin/python2|" \
+ -e "s|#![ ]*/usr/bin/env python$|#!/usr/bin/env python2|" \
+ $(find . -name '*.py')
+ sed -i 's|/usr/bin/env python|/usr/bin/env python2|' gegps gpscat gpsfake \
+ gpsprof xgps xgpsspeed
+
+ scons prefix=/usr \
+ systemd=yes \
+ libQgpsmm=no \
+ PYTHONPATH=/usr/bin/python2
+ scons build
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ export DESTDIR="${pkgdir}"
+ scons install
+
+ # Our own udev-install since the Makefile uses absolute paths
+ # Original file names are [mostly] unmodified: useful to match process name in case of error
+ # Following the switch from hotplug to udev helper scripts now live in /lib/udev/ instead of /etc/hotplug/
+ sed -i 's|GPSD_OPTIONS=""|GPSD_OPTIONS="-P /var/run/gpsd/gpsd.pid"|' packaging/deb/etc_default_gpsd
+ sed -i 's|"/var/run/gpsd.sock"|"/var/run/gpsd/gpsd.sock"|' packaging/deb/etc_default_gpsd
+ install -D -m644 "packaging/deb/etc_default_gpsd" "${pkgdir}/etc/conf.d/gpsd"
+
+ install -D -m644 "gpsd.rules" "${pkgdir}/lib/udev/rules.d/99-gpsd-usb.rules"
+
+ sed -i 's|/etc/default/gpsd|/etc/conf.d/gpsd|' gpsd.hotplug
+ install -D -m755 gpsd.hotplug "${pkgdir}/lib/udev/gpsd.hotplug"
+
+ # GPSD needs RPATH
+ chrpath -r /usr/lib/ "${pkgdir}"/usr/lib/libgps{,d}.so.20.0.0
+ chrpath -r /usr/lib/ "${pkgdir}"/usr/bin/{gpsdecode,gpsctl,gpspipe,gpxlogger,lcdgps}
+ chrpath -r /usr/lib/ "${pkgdir}"/usr/sbin/{gpsd,gpsdctl}
+
+ install -D -m644 packaging/X11/xgps.desktop \
+ "${pkgdir}/usr/share/applications/xgps.desktop"
+ install -D -m644 packaging/X11/xgpsspeed.desktop \
+ "${pkgdir}/usr/share/applications/xgpsspeed.desktop"
+ install -D -m644 packaging/X11/gpsd-logo.png \
+ "${pkgdir}/usr/share/gpsd/gpsd-logo.png"
+
+ install -D -m755 "${srcdir}/gpsd" "${pkgdir}/etc/rc.d/gpsd"
+
+ install -D -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+}
+md5sums=('c63d41a26868e9bdd48d9e311a9cc42c'
+ '0d5879df32833ca67a5491ce1ff98dcc')
diff --git a/testing/gpsd/gpsd b/testing/gpsd/gpsd
new file mode 100755
index 000000000..cc8b1ec74
--- /dev/null
+++ b/testing/gpsd/gpsd
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+[ -f /etc/conf.d/gpsd ] && . /etc/conf.d/gpsd
+
+NAME=gpsd
+DAEMON=/usr/sbin/$NAME
+PID=$(pidof -o %PPID /usr/sbin/gpsd)
+
+case "$1" in
+ start)
+ stat_busy "Starting gpsd"
+ [ ! -d /var/run/gpsd ] && install -d /var/run/gpsd
+ [ -z "$PID" ] && "$DAEMON" ${GPSD_OPTIONS} -F ${GPSD_SOCKET} ${DEVICES}
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon gpsd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping gpsd"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm -f /var/run/gpsd/$PID.pid &>/dev/null
+ rm_daemon gpsd
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/testing/gpsd/gpsd.install b/testing/gpsd/gpsd.install
new file mode 100644
index 000000000..ee661fcb1
--- /dev/null
+++ b/testing/gpsd/gpsd.install
@@ -0,0 +1,16 @@
+post_install() {
+ echo ">>> Note: the supplied gpsd udev rules are device-specific, so"
+ echo ">>> if your device isn't detected correctly, please use lsusb or"
+ echo ">>> another suitable tool to determine the proper device IDs and"
+ echo ">>> use the commented rules to fill in the blanks for your device."
+
+ update-desktop-database -q
+}
+
+post_upgrade() {
+ update-desktop-database -q
+}
+
+post_remove() {
+ update-desktop-database -q
+}
diff --git a/testing/inetutils/PKGBUILD b/testing/inetutils/PKGBUILD
new file mode 100644
index 000000000..13bfe53c3
--- /dev/null
+++ b/testing/inetutils/PKGBUILD
@@ -0,0 +1,79 @@
+# $Id: PKGBUILD 135874 2011-08-19 21:58:07Z eric $
+# Maintainer: Eric Bélanger <eric@archlinux.org>
+
+pkgname=inetutils
+pkgver=1.8
+pkgrel=4
+pkgdesc="A collection of common network programs"
+arch=('i686' 'x86_64')
+url="http://www.gnu.org/software/inetutils/"
+license=('GPL')
+groups=('base')
+depends=('readline' 'ncurses' 'pam')
+provides=('netkit-ftp' 'netkit-rsh' 'netkit-telnet' 'netkit-ntalk')
+conflicts=('netkit-ftp' 'netkit-rsh' 'netkit-telnet' 'netkit-ntalk')
+replaces=('netkit-ftp' 'netkit-rsh' 'netkit-telnet' 'netkit-ntalk')
+backup=('etc/conf.d/ftpd' 'etc/xinetd.d/telnet' 'etc/xinetd.d/talk' \
+ 'etc/xinetd.d/rexec' 'etc/xinetd.d/rlogin' 'etc/xinetd.d/rsh')
+options=('!emptydirs')
+install=inetutils.install
+source=(http://ftp.gnu.org/gnu/inetutils/${pkgname}-${pkgver}.tar.gz \
+ ftpd.rc ftpd.conf telnet.xinetd talk.xinetd rexec.xinetd rlogin.xinetd rsh.xinetd \
+ dnsdomainname domainname)
+md5sums=('ad8fdcdf1797b9ca258264a6b04e48fd'
+ 'c167200f6faeb64659e69ced2a9d672a'
+ 'e6e6e5990a2e8159a276fef8fbf54c04'
+ '8596208d119045543c5fb644e1d713d5'
+ '2c3655985cf122591d71d031af84ff90'
+ 'c490ea36751ac5f1d61d2c014959a3d1'
+ 'c25d8382a994de84d9c6962d804f689b'
+ 'c3aa508a9d1293a787341108cd49c1b7'
+ 'e38d244b31657a3c133109195aa30b45'
+ '3b17bf7d656b32d6d991792b1a2bc393')
+sha1sums=('598445859b511f73681e4d74a41d65cd6ae0f83e'
+ '84dc802b5e57b5e04c847572225a3b9612017155'
+ '68a590083b45997dfdb80e666b2de762f494ba74'
+ 'bfad98a4a62f1fff8779f076c6019ed07f9111af'
+ '27d99b910eec0fc26bd79ccc2c1de26608330298'
+ '87aa4f38ebee9dac5dcaa04cbc3f2f0906bec605'
+ '81f10b3b688e3952f793b35bcef63b5bf257a92b'
+ '81f4a8da823cf0bb14284fc71ee6108849691eda'
+ 'e94d1ebbef7464aff909d7a978636f87f3377522'
+ '03780e038f13660564d7dd9d8e1f1b6a4ebd6135')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr --libexec=/usr/sbin --localstatedir=/var \
+ --mandir=/usr/share/man --infodir=/usr/share/info \
+ --without-wrap --with-pam \
+ --enable-ftp --enable-ftpd \
+ --enable-telnet --enable-telnetd \
+ --enable-talk --enable-talkd \
+ --enable-rlogin --enable-rlogind \
+ --enable-rsh --enable-rshd \
+ --enable-rexec --enable-rexecd \
+ --enable-rcp --enable-hostname \
+ --disable-tftp --disable-tftpd \
+ --disable-ping --disable-ping6 \
+ --disable-logger --disable-syslogd \
+ --disable-inetd --disable-whois \
+ --disable-uucpd --disable-ifconfig --disable-traceroute
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -d "${pkgdir}/bin"
+ ln -s /usr/bin/hostname "${pkgdir}/bin/hostname"
+ install -D -m755 "${srcdir}/domainname" "${pkgdir}/bin/domainname"
+ install -D -m755 "${srcdir}/dnsdomainname" "${pkgdir}/bin/dnsdomainname"
+ install -D -m755 "${srcdir}/ftpd.rc" "${pkgdir}/etc/rc.d/ftpd"
+ install -D -m644 "${srcdir}/ftpd.conf" "${pkgdir}/etc/conf.d/ftpd"
+ install -D -m644 "${srcdir}/telnet.xinetd" "${pkgdir}/etc/xinetd.d/telnet"
+ install -D -m644 "${srcdir}/talk.xinetd" "${pkgdir}/etc/xinetd.d/talk"
+ install -D -m644 "${srcdir}/rexec.xinetd" "${pkgdir}/etc/xinetd.d/rexec"
+ install -D -m644 "${srcdir}/rlogin.xinetd" "${pkgdir}/etc/xinetd.d/rlogin"
+ install -D -m644 "${srcdir}/rsh.xinetd" "${pkgdir}/etc/xinetd.d/rsh"
+}
diff --git a/testing/inetutils/dnsdomainname b/testing/inetutils/dnsdomainname
new file mode 100644
index 000000000..c1a251161
--- /dev/null
+++ b/testing/inetutils/dnsdomainname
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+hostname -y "$@"
diff --git a/testing/inetutils/domainname b/testing/inetutils/domainname
new file mode 100644
index 000000000..093fdb0ec
--- /dev/null
+++ b/testing/inetutils/domainname
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+hostname -d "$@"
diff --git a/testing/inetutils/ftpd.conf b/testing/inetutils/ftpd.conf
new file mode 100644
index 000000000..f660f0035
--- /dev/null
+++ b/testing/inetutils/ftpd.conf
@@ -0,0 +1,4 @@
+#
+# Parameters to be passed to ftpd
+#
+FTPD_ARGS=""
diff --git a/testing/inetutils/ftpd.rc b/testing/inetutils/ftpd.rc
new file mode 100644
index 000000000..3d0d34421
--- /dev/null
+++ b/testing/inetutils/ftpd.rc
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/ftpd
+
+PID=$(pidof -o %PPID /usr/sbin/ftpd)
+case "$1" in
+ start)
+ stat_busy "Starting ftpd"
+ [ -z "$PID" ] && /usr/sbin/ftpd -D $FTPD_ARGS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon ftpd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping ftpd"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon ftpd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/testing/inetutils/inetutils.install b/testing/inetutils/inetutils.install
new file mode 100644
index 000000000..b338fa498
--- /dev/null
+++ b/testing/inetutils/inetutils.install
@@ -0,0 +1,20 @@
+infodir=/usr/share/info
+filelist=(inetutils.info.gz)
+
+post_install() {
+ [ -x usr/bin/install-info ] || return 0
+ for file in ${filelist[@]}; do
+ install-info $infodir/$file $infodir/dir 2> /dev/null
+ done
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+pre_remove() {
+ [ -x usr/bin/install-info ] || return 0
+ for file in ${filelist[@]}; do
+ install-info --delete $infodir/$file $infodir/dir 2> /dev/null
+ done
+}
diff --git a/testing/inetutils/rexec.xinetd b/testing/inetutils/rexec.xinetd
new file mode 100644
index 000000000..4659e4745
--- /dev/null
+++ b/testing/inetutils/rexec.xinetd
@@ -0,0 +1,10 @@
+service exec
+{
+ flags = REUSE
+ socket_type = stream
+ wait = no
+ user = root
+ server = /usr/sbin/rexecd
+ log_on_failure += USERID
+ disable = yes
+}
diff --git a/testing/inetutils/rlogin.xinetd b/testing/inetutils/rlogin.xinetd
new file mode 100644
index 000000000..5c72f86df
--- /dev/null
+++ b/testing/inetutils/rlogin.xinetd
@@ -0,0 +1,10 @@
+service login
+{
+ flags = REUSE
+ socket_type = stream
+ wait = no
+ user = root
+ server = /usr/sbin/rlogind
+ log_on_failure += USERID
+ disable = yes
+}
diff --git a/testing/inetutils/rsh.xinetd b/testing/inetutils/rsh.xinetd
new file mode 100644
index 000000000..a13738c31
--- /dev/null
+++ b/testing/inetutils/rsh.xinetd
@@ -0,0 +1,10 @@
+service shell
+{
+ flags = REUSE
+ socket_type = stream
+ wait = no
+ user = root
+ server = /usr/sbin/rshd
+ log_on_failure += USERID
+ disable = yes
+}
diff --git a/testing/inetutils/talk.xinetd b/testing/inetutils/talk.xinetd
new file mode 100644
index 000000000..6abef359c
--- /dev/null
+++ b/testing/inetutils/talk.xinetd
@@ -0,0 +1,10 @@
+service ntalk
+{
+ flags = REUSE
+ socket_type = dgram
+ wait = yes
+ user = root
+ server = /usr/sbin/talkd
+ log_on_failure += USERID
+ disable = yes
+}
diff --git a/testing/inetutils/telnet.xinetd b/testing/inetutils/telnet.xinetd
new file mode 100644
index 000000000..bd3a5e4b1
--- /dev/null
+++ b/testing/inetutils/telnet.xinetd
@@ -0,0 +1,10 @@
+service telnet
+{
+ flags = REUSE
+ socket_type = stream
+ wait = no
+ user = root
+ server = /usr/sbin/telnetd
+ log_on_failure += USERID
+ disable = yes
+}
diff --git a/testing/lvm2/PKGBUILD b/testing/lvm2/PKGBUILD
index c29ed8030..c2caf6563 100644
--- a/testing/lvm2/PKGBUILD
+++ b/testing/lvm2/PKGBUILD
@@ -1,10 +1,10 @@
-# $Id: PKGBUILD 135451 2011-08-13 22:32:08Z eric $
+# $Id: PKGBUILD 135887 2011-08-20 02:15:24Z eric $
# Maintainer: Eric Bélanger <eric@archlinux.org>
# Maintainer: Thomas Bächler <thomas@archlinux.org>
pkgbase=lvm2
pkgname=('lvm2' 'device-mapper')
-pkgver=2.02.87
+pkgver=2.02.88
pkgrel=1
arch=('i686' 'x86_64')
url="http://sourceware.org/lvm2/"
@@ -14,11 +14,11 @@ source=(ftp://sources.redhat.com/pub/lvm2/LVM2.${pkgver}.tgz
lvm2_install
lvm2_hook
11-dm-initramfs.rules)
-md5sums=('4c36c7f216edfe65a6193d2adc389ecd'
+md5sums=('321429cd1b1526a29cf6d75018b1e4bb'
'dcb82506d732cc7b10159a89b579dba8'
'8d613b84a175cd85f752a75198e40e15'
'69e40679cd8b3658bfc619e48baae125')
-sha1sums=('4b217d405133bdc6120568253574a49fae2caa4f'
+sha1sums=('05a4fb09cb5e3d680ad1b268c941968853fb1979'
'7f108b2f2056eb050fc898bf5190ecf9145aed8a'
'a0e0513c2efb183006e57e595d93ce18be297928'
'f6a554eea9557c3c236df2943bb6e7e723945c41')
diff --git a/testing/net-tools/PKGBUILD b/testing/net-tools/PKGBUILD
new file mode 100644
index 000000000..68a081571
--- /dev/null
+++ b/testing/net-tools/PKGBUILD
@@ -0,0 +1,43 @@
+# $Id: PKGBUILD 135870 2011-08-19 21:16:25Z eric $
+# Maintainer: Ronald van Haren <ronald.archlinux.org>
+# Contributor: judd <jvinet@zeroflux.org>
+
+pkgname=net-tools
+pkgver=1.60.20110819cvs
+pkgrel=1
+pkgdesc="Configuration tools for Linux networking"
+arch=(i686 x86_64)
+license=('GPL2')
+url="http://www.tazenda.demon.co.uk/phil/net-tools"
+depends=('glibc')
+
+# http://www.tazenda.demon.co.uk/phil/$pkgname/$pkgname-$pkgver.tar.bz2
+# use cvs checkout instead
+source=(ftp://ftp.archlinux.org/other/net-tools/net-tools-1.60.20110819cvs.tar.bz2
+ net-tools-1.60-miiioctl.patch
+ net-tools-1.60-nameif_strncpy.patch)
+#options=(!makeflags)
+install=net-tools.install
+sha1sums=('02946449191ff279f9f0f7fd7bc65ae21059a2bf'
+ '654a96bc6575efb4a2e04b49de45d448d240eb6e'
+ '7888000d8fe867e58b5b00fe2bcf6c3041d716b4')
+
+build() {
+ cd $srcdir/$pkgname-$pkgver
+ patch -Np1 -i ../net-tools-1.60-miiioctl.patch
+ patch -Np1 -i ${srcdir}/net-tools-1.60-nameif_strncpy.patch
+ yes "" | make
+}
+
+package() {
+ cd $srcdir/$pkgname-$pkgver
+ make BASEDIR=$pkgdir update
+
+ # the following is provided by yp-tools
+ rm "${pkgdir}"/bin/{nis,yp}domainname
+ rm "${pkgdir}"/usr/share/man/man1/{nis,yp}domainname.1
+
+ # hostname is provided by inetutils
+ rm "${pkgdir}"/bin/{hostname,dnsdomainname,domainname}
+ rm -rf "${pkgdir}"/usr/share/man/man1
+}
diff --git a/testing/net-tools/gcc340.patch b/testing/net-tools/gcc340.patch
new file mode 100644
index 000000000..8089bf217
--- /dev/null
+++ b/testing/net-tools/gcc340.patch
@@ -0,0 +1,46 @@
+diff -Naur net-tools-1.60-orig/hostname.c net-tools-1.60/hostname.c
+--- net-tools-1.60-orig/hostname.c 2001-04-08 10:04:23.000000000 -0700
++++ net-tools-1.60/hostname.c 2004-05-07 17:22:14.000000000 -0700
+@@ -78,6 +78,7 @@
+ fprintf(stderr, _("%s: name too long\n"), program_name);
+ break;
+ default:
++ ;
+ }
+ exit(1);
+ }
+@@ -98,6 +99,7 @@
+ fprintf(stderr, _("%s: name too long\n"), program_name);
+ break;
+ default:
++ ;
+ }
+ exit(1);
+ };
+@@ -117,6 +119,7 @@
+ fprintf(stderr, _("%s: name too long\n"), program_name);
+ break;
+ default:
++ ;
+ }
+ exit(1);
+ };
+@@ -174,6 +177,7 @@
+ printf("%s\n", hp->h_name);
+ break;
+ default:
++ ;
+ }
+ }
+
+diff -Naur net-tools-1.60-orig/lib/inet_sr.c net-tools-1.60/lib/inet_sr.c
+--- net-tools-1.60-orig/lib/inet_sr.c 2000-02-20 13:46:45.000000000 -0800
++++ net-tools-1.60/lib/inet_sr.c 2004-05-07 17:20:14.000000000 -0700
+@@ -105,6 +105,7 @@
+ case 2:
+ isnet = 0; break;
+ default:
++ ;
+ }
+
+ /* Fill in the other fields. */
diff --git a/testing/net-tools/net-tools-1.60-2.6-compilefix.patch b/testing/net-tools/net-tools-1.60-2.6-compilefix.patch
new file mode 100644
index 000000000..92ce90128
--- /dev/null
+++ b/testing/net-tools/net-tools-1.60-2.6-compilefix.patch
@@ -0,0 +1,23 @@
+diff -ruN net-tools-1.60.orig/lib/x25_sr.c net-tools-1.60/lib/x25_sr.c
+--- net-tools-1.60.orig/lib/x25_sr.c 2000-05-20 15:38:10.000000000 +0200
++++ net-tools-1.60/lib/x25_sr.c 2003-10-18 20:33:31.927574928 +0200
+@@ -22,6 +22,7 @@
+ #include <sys/socket.h>
+ #include <sys/ioctl.h>
+ #include <linux/x25.h>
++#include <linux/version.h>
+ #include <ctype.h>
+ #include <errno.h>
+ #include <netdb.h>
+@@ -77,7 +78,11 @@
+ rt.sigdigits=sigdigits;
+
+ /* x25_route_struct.address isn't type struct sockaddr_x25, Why? */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
+ memcpy(&rt.address, &sx25.sx25_addr, sizeof(x25_address));
++#else
++ memcpy(&rt.address, &sx25.sx25_addr, sizeof(struct x25_address));
++#endif
+
+ while (*args) {
+ if (!strcmp(*args,"device") || !strcmp(*args,"dev")) {
diff --git a/testing/net-tools/net-tools-1.60-miiioctl.patch b/testing/net-tools/net-tools-1.60-miiioctl.patch
new file mode 100644
index 000000000..6c7f0693d
--- /dev/null
+++ b/testing/net-tools/net-tools-1.60-miiioctl.patch
@@ -0,0 +1,17 @@
+--- net-tools-1.60.20110819cvs/include/mii.h 2011-08-19 10:14:00.743873299 +0200
++++ net-tools-1.60.20110819cvs/include/mii.h.new 2011-08-19 10:28:26.500524160 +0200
+@@ -14,11 +14,9 @@
+ /* network interface ioctl's for MII commands */
+ #ifndef SIOCGMIIPHY
+ #warning "SIOCGMIIPHY is not defined by your kernel source"
+-#define SIOCGMIIPHY (SIOCDEVPRIVATE) /* Read from current PHY */
+-#define SIOCGMIIREG (SIOCDEVPRIVATE+1) /* Read any PHY register */
+-#define SIOCSMIIREG (SIOCDEVPRIVATE+2) /* Write any PHY register */
+-#define SIOCGPARAMS (SIOCDEVPRIVATE+3) /* Read operational parameters */
+-#define SIOCSPARAMS (SIOCDEVPRIVATE+4) /* Set operational parameters */
++#define SIOCGMIIPHY 0x8947 /* Read from current PHY */
++#define SIOCGMIIREG 0x8948 /* Read any PHY register */
++#define SIOCSMIIREG 0x8949 /* Write any PHY register */
+ #endif
+
+ #include <linux/types.h>
diff --git a/testing/net-tools/net-tools-1.60-nameif.patch b/testing/net-tools/net-tools-1.60-nameif.patch
new file mode 100644
index 000000000..54def00c2
--- /dev/null
+++ b/testing/net-tools/net-tools-1.60-nameif.patch
@@ -0,0 +1,58 @@
+--- net-tools-1.60/nameif.c.nameif 2000-10-18 19:26:29.000000000 +0200
++++ net-tools-1.60/nameif.c 2003-03-19 11:02:01.000000000 +0100
+@@ -117,7 +117,8 @@
+ }
+
+ struct change {
+- struct change *next,**pprev;
++ struct change *next;
++ int found;
+ char ifname[IFNAMSIZ+1];
+ unsigned char mac[6];
+ };
+@@ -139,10 +140,7 @@
+ ch->ifname, pos);
+ if (parsemac(p,ch->mac) < 0)
+ complain(_("cannot parse MAC `%s' at %s"), p, pos);
+- if (clist)
+- clist->pprev = &ch->next;
+ ch->next = clist;
+- ch->pprev = &clist;
+ clist = ch;
+ return 0;
+ }
+@@ -200,7 +198,7 @@
+
+ void usage(void)
+ {
+- fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}"));
++ fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}\n"));
+ exit(1);
+ }
+
+@@ -277,21 +275,21 @@
+ ch = lookupmac(mac);
+ if (!ch)
+ continue;
+-
+- *ch->pprev = ch->next;
++
++ ch->found = 1;
+ if (strcmp(p, ch->ifname)) {
+ if (setname(p, ch->ifname) < 0)
+ complain(_("cannot change name of %s to %s: %s"),
+ p, ch->ifname, strerror(errno));
+ }
+- free(ch);
+ }
+ fclose(ifh);
+
+ while (clist) {
+ struct change *ch = clist;
+ clist = clist->next;
+- warning(_("interface '%s' not found"), ch->ifname);
++ if (!ch->found)
++ warning(_("interface '%s' not found"), ch->ifname);
+ free(ch);
+ }
+
diff --git a/testing/net-tools/net-tools-1.60-nameif_strncpy.patch b/testing/net-tools/net-tools-1.60-nameif_strncpy.patch
new file mode 100644
index 000000000..7568e21a2
--- /dev/null
+++ b/testing/net-tools/net-tools-1.60-nameif_strncpy.patch
@@ -0,0 +1,13 @@
+--- net-tools-1.60/nameif.c.ncpy 2006-10-03 14:24:21.000000000 +0200
++++ net-tools-1.60/nameif.c 2006-10-03 14:22:43.000000000 +0200
+@@ -100,8 +100,8 @@
+ struct ifreq ifr;
+ opensock();
+ memset(&ifr,0,sizeof(struct ifreq));
+- strcpy(ifr.ifr_name, oldname);
+- strcpy(ifr.ifr_newname, newname);
++ strncpy(ifr.ifr_name, oldname, IF_NAMESIZE);
++ strncpy(ifr.ifr_newname, newname, IF_NAMESIZE);
+ return ioctl(ctl_sk, SIOCSIFNAME, &ifr);
+ }
+
diff --git a/testing/net-tools/net-tools.install b/testing/net-tools/net-tools.install
new file mode 100644
index 000000000..9eee9e51b
--- /dev/null
+++ b/testing/net-tools/net-tools.install
@@ -0,0 +1,12 @@
+post_upgrade() {
+ if [ "$(vercmp $2 1.60-16)" -lt 0 ]; then
+ echo "hostname and {,yp,nis}domainname has moved:"
+ echo "----------"
+ echo "hostname is now in coreutils"
+ echo "domainname is now in yp-tools"
+ echo "their functionality might have changed slightly"
+ echo ""
+ echo "dnsdomainname remains in net-tools"
+ echo "----------"
+ fi
+}
diff --git a/testing/net-tools/net-tools.patch b/testing/net-tools/net-tools.patch
new file mode 100644
index 000000000..8af2d2159
--- /dev/null
+++ b/testing/net-tools/net-tools.patch
@@ -0,0 +1,30 @@
+diff -Naur net-tools-1.60-orig/mii-tool.c net-tools-1.60/mii-tool.c
+--- net-tools-1.60-orig/mii-tool.c 2000-05-21 07:31:17.000000000 -0700
++++ net-tools-1.60/mii-tool.c 2004-05-31 12:35:21.000000000 -0700
+@@ -379,16 +379,16 @@
+ /*--------------------------------------------------------------------*/
+
+ const char *usage =
+-"usage: %s [-VvRrwl] [-A media,... | -F media] [interface ...]
+- -V, --version display version information
+- -v, --verbose more verbose output
+- -R, --reset reset MII to poweron state
+- -r, --restart restart autonegotiation
+- -w, --watch monitor for link status changes
+- -l, --log with -w, write events to syslog
+- -A, --advertise=media,... advertise only specified media
+- -F, --force=media force specified media technology
+-media: 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD,
++"usage: %s [-VvRrwl] [-A media,... | -F media] [interface ...]\n\
++ -V, --version display version information\n\
++ -v, --verbose more verbose output\n\
++ -R, --reset reset MII to poweron state\n\
++ -r, --restart restart autonegotiation\n\
++ -w, --watch monitor for link status changes\n\
++ -l, --log with -w, write events to syslog\n\
++ -A, --advertise=media,... advertise only specified media\n\
++ -F, --force=media force specified media technology\n\
++media: 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD,\n\
+ (to advertise both HD and FD) 100baseTx, 10baseT\n";
+
+ int main(int argc, char **argv)
diff --git a/testing/perl/0001-Append-CFLAGS-and-LDFLAGS-to-their-Config.pm-counter.patch b/testing/perl/0001-Append-CFLAGS-and-LDFLAGS-to-their-Config.pm-counter.patch
new file mode 100644
index 000000000..1404460df
--- /dev/null
+++ b/testing/perl/0001-Append-CFLAGS-and-LDFLAGS-to-their-Config.pm-counter.patch
@@ -0,0 +1,83 @@
+From bb249b0b26c2e79a6f55355ef94889070f07fd21 Mon Sep 17 00:00:00 2001
+From: Niko Tyni <ntyni@debian.org>
+Date: Thu, 28 Apr 2011 09:18:54 +0300
+Subject: [PATCH] Append CFLAGS and LDFLAGS to their Config.pm counterparts in
+ EU::CBuilder
+
+Since ExtUtils::CBuilder 0.27_04 (bleadperl commit 06e8058f27e4),
+CFLAGS and LDFLAGS from the environment have overridden the Config.pm
+ccflags and ldflags settings. This can cause binary incompatibilities
+between the core Perl and extensions built with EU::CBuilder.
+
+Append to the Config.pm values rather than overriding them.
+---
+ .../lib/ExtUtils/CBuilder/Base.pm | 6 +++-
+ dist/ExtUtils-CBuilder/t/04-base.t | 25 +++++++++++++++++++-
+ 2 files changed, 28 insertions(+), 3 deletions(-)
+
+diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm
+index b572312..2255c51 100644
+--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm
++++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm
+@@ -40,11 +40,13 @@ sub new {
+ $self->{config}{$k} = $v unless exists $self->{config}{$k};
+ }
+ $self->{config}{cc} = $ENV{CC} if defined $ENV{CC};
+- $self->{config}{ccflags} = $ENV{CFLAGS} if defined $ENV{CFLAGS};
++ $self->{config}{ccflags} = join(" ", $self->{config}{ccflags}, $ENV{CFLAGS})
++ if defined $ENV{CFLAGS};
+ $self->{config}{cxx} = $ENV{CXX} if defined $ENV{CXX};
+ $self->{config}{cxxflags} = $ENV{CXXFLAGS} if defined $ENV{CXXFLAGS};
+ $self->{config}{ld} = $ENV{LD} if defined $ENV{LD};
+- $self->{config}{ldflags} = $ENV{LDFLAGS} if defined $ENV{LDFLAGS};
++ $self->{config}{ldflags} = join(" ", $self->{config}{ldflags}, $ENV{LDFLAGS})
++ if defined $ENV{LDFLAGS};
+
+ unless ( exists $self->{config}{cxx} ) {
+ my ($ccpath, $ccbase, $ccsfx ) = fileparse($self->{config}{cc}, qr/\.[^.]*/);
+diff --git a/dist/ExtUtils-CBuilder/t/04-base.t b/dist/ExtUtils-CBuilder/t/04-base.t
+index c3bf6b5..1bb15aa 100644
+--- a/dist/ExtUtils-CBuilder/t/04-base.t
++++ b/dist/ExtUtils-CBuilder/t/04-base.t
+@@ -1,7 +1,7 @@
+ #! perl -w
+
+ use strict;
+-use Test::More tests => 50;
++use Test::More tests => 64;
+ use Config;
+ use Cwd;
+ use File::Path qw( mkpath );
+@@ -326,6 +326,29 @@ is_deeply( $mksymlists_args,
+ "_prepare_mksymlists_args(): got expected arguments for Mksymlists",
+ );
+
++my %testvars = (
++ CFLAGS => 'ccflags',
++ LDFLAGS => 'ldflags',
++);
++
++while (my ($VAR, $var) = each %testvars) {
++ local $ENV{$VAR};
++ $base = ExtUtils::CBuilder::Base->new( quiet => 1 );
++ ok( $base, "ExtUtils::CBuilder::Base->new() returned true value" );
++ isa_ok( $base, 'ExtUtils::CBuilder::Base' );
++ like($base->{config}{$var}, qr/\Q$Config{$var}/,
++ "honours $var from Config.pm");
++
++ $ENV{$VAR} = "-foo -bar";
++ $base = ExtUtils::CBuilder::Base->new( quiet => 1 );
++ ok( $base, "ExtUtils::CBuilder::Base->new() returned true value" );
++ isa_ok( $base, 'ExtUtils::CBuilder::Base' );
++ like($base->{config}{$var}, qr/\Q$ENV{$VAR}/,
++ "honours $VAR from the environment");
++ like($base->{config}{$var}, qr/\Q$Config{$var}/,
++ "doesn't override $var from Config.pm with $VAR from the environment");
++}
++
+ #####
+
+ for ($source_file, $object_file, $lib_file) {
+--
+1.7.4.4
+
diff --git a/testing/perl/ChangeLog b/testing/perl/ChangeLog
new file mode 100644
index 000000000..9add39e20
--- /dev/null
+++ b/testing/perl/ChangeLog
@@ -0,0 +1,66 @@
+2011-06-22 Angel Velasquez <angvp@archlinux.org>
+ * Added a patch for ExtUtils doesnt overwrite CFLAGS and LDFLAGS
+ * Fixed #FS22197, FS#22441, FS#24767
+ * Rebuilt perl 5.14.1-2 against db 5.2.28
+
+2011-06-16 Angel Velasquez <angvp@archlinux.org>
+ * Fixed #FS24660
+ * Rebuilt against db 5.2.28
+
+2011-05-16 Angel Velasquez <angvp@archlinux.org>
+ * perl 5.14.0
+ * Removed patch for h2ph warning from 5.12.3
+ * Removed provides array, you can use corelist -v 5.14.0 to know the
+ modules included with the perl core, through Module::CoreList (thx j3nnn1
+ for the tip)
+
+2010-11-07 kevin <kevin@archlinux.org>
+
+ * perl 5.12.2-1
+ - Using /usr/bin/*_perl for script directories
+
+2010-11-06 kevin <kevin@archlinux.org>
+
+ - Removed otherlibdirs directive from Configure
+ - Removed /usr/*/perl5/site_perl/5.10.1 from INC
+ - Finally removed legacy dirs /usr/lib/perl5/current and
+ /usr/lib/perl5/site_perl/current from @INC
+
+2010-05-23 kevin <kevin@archlinux.org>
+
+ * perl 5.12.1-2
+ - Francois updated the provides array.
+
+2010-05-23 kevin <kevin@archlinux.org>
+
+ * perl 5.12.1-1
+
+2010-05-16 kevin <kevin@archlinux.org>
+
+ * perl 5.12.0-2
+
+2010-05-12 kevin <kevin@archlinux.org>
+
+ - FS#19411. Removed the for loop in perlbin.sh which didn't work on zsh.
+ This makes the loop variables unnecessary so the script no longer
+ pollutes the user's environment.
+ - FS#19427. Added /usr/*/perl5/site_perl/5.10.1 to otherlibdirs to support
+ user built modules.
+
+2010-05-09 kevin <kevin@archlinux.org>
+
+ * perl 5.12.0-1
+ - Modified perlbin.sh to only add existing dirs to PATH. Fixes FS#17402,
+ path points to non-existant directories
+
+2010-05-07 kevin <kevin@archlinux.org>
+
+ - Added this changelog.
+ - Added -Dinc_version_list=none to fix FS#19136, double entry in @INC.
+ This removes the duplicates and versioned directory entries.
+ - Change scriptdirs to /usr/lib/perl5/{core,vendor,site}_perl/bin to fix
+ Fix FS#13808, binaries don't follow FHS.
+ - Stopped using versioned directories in sitelib and sitearch.
+
+
+# vim: set ft=changelog ts=4 sw=4 et:
diff --git a/testing/perl/PKGBUILD b/testing/perl/PKGBUILD
new file mode 100644
index 000000000..56152f25d
--- /dev/null
+++ b/testing/perl/PKGBUILD
@@ -0,0 +1,109 @@
+# $Id: PKGBUILD 135875 2011-08-19 22:28:42Z eric $
+# Maintainer: Angel Velasquez <angvp@archlinux.org>
+# Contributor: kevin <kevin.archlinux.org>
+# Contributor: judd <jvinet.zeroflux.org>
+# Contributor: francois <francois.archlinux.org>
+pkgname=perl
+pkgver=5.14.1
+pkgrel=4
+pkgdesc="A highly capable, feature-rich programming language"
+arch=(i686 x86_64)
+license=('GPL' 'PerlArtistic')
+url="http://www.perl.org"
+groups=('base')
+depends=('gdbm' 'db' 'coreutils' 'glibc' 'sh')
+changelog=ChangeLog
+source=(http://www.cpan.org/src/5.0/perl-${pkgver}.tar.bz2
+perlbin.sh
+perlbin.csh
+provides.pl
+0001-Append-CFLAGS-and-LDFLAGS-to-their-Config.pm-counter.patch)
+install=perl.install
+options=('!makeflags' '!purge')
+md5sums=('97cd306a2c22929cc141a09568f43bb0'
+ '5ed2542fdb9a60682f215bd33701e61a'
+ '1f0cbbee783e8a6d32f01be5118e0d5e'
+ '6124591798c83c386975f7ef35514f0e'
+ 'c25d86206d649046538c3daab7874564')
+
+build() {
+ cd ${srcdir}/${pkgname}-${pkgver}
+
+ if [ "${CARCH}" = "x86_64" ]; then
+ # for x86_64
+ arch_opts="-Dcccdlflags='-fPIC'"
+ else
+ # for i686
+ arch_opts=""
+ fi
+ ./Configure -des -Dusethreads -Duseshrplib -Doptimize="${CFLAGS}" \
+ -Dprefix=/usr -Dinstallprefix=${pkgdir}/usr -Dvendorprefix=/usr \
+ -Dprivlib=/usr/share/perl5/core_perl \
+ -Darchlib=/usr/lib/perl5/core_perl \
+ -Dsitelib=/usr/share/perl5/site_perl \
+ -Dsitearch=/usr/lib/perl5/site_perl \
+ -Dvendorlib=/usr/share/perl5/vendor_perl \
+ -Dvendorarch=/usr/lib/perl5/vendor_perl \
+ -Dscriptdir=/usr/bin/core_perl \
+ -Dsitescript=/usr/bin/site_perl \
+ -Dvendorscript=/usr/bin/vendor_perl \
+ -Dinc_version_list=none \
+ -Dman1ext=1perl -Dman3ext=3perl ${arch_opts} \
+ -Dlddlflags="-shared ${LDFLAGS}" -Dldflags="${LDFLAGS}"
+ patch -Np1 -i $srcdir/0001-Append-CFLAGS-and-LDFLAGS-to-their-Config.pm-counter.patch
+ make
+}
+package() {
+ # hack to work around makepkg running the subshell in check_sanity()
+ new_provides=($(cd "$srcdir/perl-$pkgver"; ./perl -Ilib "$srcdir/provides.pl" .))
+ provides=(${new_provides[@]})
+
+ cd ${srcdir}/${pkgname}-${pkgver}
+ make install
+
+ ### Perl Settings ###
+ # Change man page extensions for site and vendor module builds.
+ # Use archlinux email address instead of my own.
+ sed -e '/^man1ext=/ s/1perl/1p/' -e '/^man3ext=/ s/3perl/3pm/' \
+ -e "/^cf_email=/ s/'.*'/'kevin@archlinux.org'/" \
+ -e "/^perladmin=/ s/'.*'/'kevin@archlinux.org'/" \
+ -i ${pkgdir}/usr/lib/perl5/core_perl/Config_heavy.pl
+
+ ### CPAN Settings ###
+ # Set CPAN default config to use the site directories.
+ sed -e '/(makepl_arg =>/ s/""/"INSTALLDIRS=site"/' \
+ -e '/(mbuildpl_arg =>/ s/""/"installdirs=site"/' \
+ -i ${pkgdir}/usr/share/perl5/core_perl/CPAN/FirstTime.pm
+
+ ### CPANPLUS Settings ###
+ # Set CPANPLUS default config to use the site directories.
+ sed -e "/{'makemakerflags'}/ s/'';/'INSTALLDIRS=site';/" \
+ -e "/{'buildflags'}/ s/'';/'installdirs=site';/" \
+ -i ${pkgdir}/usr/share/perl5/core_perl/CPANPLUS/Config.pm
+
+ # Profile script to set paths to perl scripts.
+ install -D -m755 ${srcdir}/perlbin.sh \
+ ${pkgdir}/etc/profile.d/perlbin.sh
+ # Profile script to set paths to perl scripts on csh. (FS#22441)
+ install -D -m755 ${srcdir}/perlbin.csh \
+ ${pkgdir}/etc/profile.d/perlbin.csh
+
+ (cd ${pkgdir}/usr/bin; mv perl${pkgver} perl)
+ (cd ${pkgdir}/usr/bin/core_perl; ln -sf c2ph pstruct; ln -sf s2p psed)
+ grep -Rl "${pkgdir}" ${pkgdir}/usr | \
+ xargs sed -i "s^${pkgdir}^^g"
+
+ # Remove all pod files *except* those under /usr/share/perl5/core_perl/pod/
+ # (FS#16488)
+ rm -f $pkgdir/usr/share/perl5/core_perl/*.pod
+ for d in $pkgdir/usr/share/perl5/core_perl/*; do
+ if [ -d $d -a $(basename $d) != "pod" ]; then
+ find $d -name *.pod -delete
+ fi
+ done
+ find $pkgdir/usr/lib -name *.pod -delete
+ find $pkgdir -name .packlist -delete
+ # Add /usr/lib/perl5/core_perl/CORE/ to standard library path (FS#24660)
+ install -dv ${pkgdir}/etc/ld.so.conf.d
+ echo "/usr/lib/perl5/core_perl/CORE" > ${pkgdir}/etc/ld.so.conf.d/perl.conf
+}
diff --git a/testing/perl/fix-h2ph-and-tests.patch b/testing/perl/fix-h2ph-and-tests.patch
new file mode 100644
index 000000000..a2d176ec6
--- /dev/null
+++ b/testing/perl/fix-h2ph-and-tests.patch
@@ -0,0 +1,104 @@
+From 8d66b3f930dc6d88b524d103e304308ae73a46e7 Mon Sep 17 00:00:00 2001
+From: Robin Barker <rmbarker@cpan.org>
+Date: Thu, 22 Apr 2010 11:51:20 +0100
+Subject: [PATCH 1/1] Fix h2ph and test
+
+---
+ lib/h2ph.t | 12 ++++++++++--
+ utils/h2ph.PL | 28 +++++++++++++++++++++++-----
+ 2 files changed, 33 insertions(+), 7 deletions(-)
+
+diff --git a/lib/h2ph.t b/lib/h2ph.t
+index 27dd7b9..8d62d46 100644
+--- a/lib/h2ph.t
++++ b/lib/h2ph.t
+@@ -18,7 +18,7 @@ if (!(-e $extracted_program)) {
+ exit 0;
+ }
+
+-plan(4);
++plan(5);
+
+ # quickly compare two text files
+ sub txt_compare {
+@@ -41,8 +41,16 @@ $result = runperl( progfile => 'lib/h2ph.pht',
+ stderr => 1 );
+ like( $result, qr/syntax OK$/, "output compiles");
+
++$result = runperl( progfile => '_h2ph_pre.ph',
++ switches => ['-c'],
++ stderr => 1 );
++like( $result, qr/syntax OK$/, "preamble compiles");
++
+ $result = runperl( switches => ["-w"],
+- prog => '$SIG{__WARN__} = sub { die $_[0] }; require q(lib/h2ph.pht);');
++ stderr => 1,
++ prog => <<'PROG' );
++$SIG{__WARN__} = sub { die $_[0] }; require q(lib/h2ph.pht);
++PROG
+ is( $result, '', "output free of warnings" );
+
+ # cleanup
+diff --git a/utils/h2ph.PL b/utils/h2ph.PL
+index 8f56db4..1255807 100644
+--- a/utils/h2ph.PL
++++ b/utils/h2ph.PL
+@@ -401,7 +401,10 @@ if ($opt_e && (scalar(keys %bad_file) > 0)) {
+ exit $Exit;
+
+ sub expr {
+- $new = '"(assembly code)"' and return if /\b__asm__\b/; # freak out.
++ if (/\b__asm__\b/) { # freak out
++ $new = '"(assembly code)"';
++ return
++ }
+ my $joined_args;
+ if(keys(%curargs)) {
+ $joined_args = join('|', keys(%curargs));
+@@ -770,7 +773,7 @@ sub inc_dirs
+ sub build_preamble_if_necessary
+ {
+ # Increment $VERSION every time this function is modified:
+- my $VERSION = 2;
++ my $VERSION = 3;
+ my $preamble = "$Dest_dir/_h2ph_pre.ph";
+
+ # Can we skip building the preamble file?
+@@ -798,7 +801,16 @@ sub build_preamble_if_necessary
+ # parenthesized value: d=(v)
+ $define{$_} = $1;
+ }
+- if ($define{$_} =~ /^([+-]?(\d+)?\.\d+([eE][+-]?\d+)?)[FL]?$/) {
++ if (/^(\w+)\((\w)\)$/) {
++ my($macro, $arg) = ($1, $2);
++ my $def = $define{$_};
++ $def =~ s/$arg/\$\{$arg\}/g;
++ print PREAMBLE <<DEFINE;
++unless (defined &$macro) { sub $macro(\$) { my (\$$arg) = \@_; \"$def\" } }
++
++DEFINE
++ } elsif
++ ($define{$_} =~ /^([+-]?(\d+)?\.\d+([eE][+-]?\d+)?)[FL]?$/) {
+ # float:
+ print PREAMBLE
+ "unless (defined &$_) { sub $_() { $1 } }\n\n";
+@@ -807,8 +819,14 @@ sub build_preamble_if_necessary
+ print PREAMBLE
+ "unless (defined &$_) { sub $_() { $1 } }\n\n";
+ } elsif ($define{$_} =~ /^\w+$/) {
+- print PREAMBLE
+- "unless (defined &$_) { sub $_() { &$define{$_} } }\n\n";
++ my $def = $define{$_};
++ if ($isatype{$def}) {
++ print PREAMBLE
++ "unless (defined &$_) { sub $_() { \"$def\" } }\n\n";
++ } else {
++ print PREAMBLE
++ "unless (defined &$_) { sub $_() { &$def } }\n\n";
++ }
+ } else {
+ print PREAMBLE
+ "unless (defined &$_) { sub $_() { \"",
+--
+1.6.5.2.74.g610f9.dirty
+
diff --git a/testing/perl/perl.install b/testing/perl/perl.install
new file mode 100644
index 000000000..3f7d58f23
--- /dev/null
+++ b/testing/perl/perl.install
@@ -0,0 +1,18 @@
+# arg 1: the new package version
+post_install() {
+ for ver in 5.8.{0,1,2,3,4,5,6,7,8}; do
+ [ -h usr/lib/perl5/$ver ] && rm usr/lib/perl5/$ver
+ [ -h usr/lib/perl5/site_perl/$ver ] && rm usr/lib/perl5/site_perl/$ver
+ [ -h usr/bin/perl$ver ] && rm usr/bin/perl$ver
+ done
+ return 0
+}
+
+post_upgrade() {
+ echo '- The directories /usr/lib/perl5/current, /usr/lib/perl5/site_perl/current,'
+ echo ' /usr/lib/perl5/site_perl/5.10.1, and /usr/share/perl5/site_perl/5.10.1'
+ echo ' have been removed from @INC.'
+
+ echo '- The script/binary directories are now /usr/bin/*_perl instead of'
+ echo ' /usr/lib/perl5/*_perl/bin which will be eventually removed.'
+}
diff --git a/testing/perl/perlbin.csh b/testing/perl/perlbin.csh
new file mode 100644
index 000000000..535f0b18d
--- /dev/null
+++ b/testing/perl/perlbin.csh
@@ -0,0 +1,15 @@
+# Set path to perl scriptdirs if they exist
+# https://wiki.archlinux.org/index.php/Perl_Policy#Binaries_and_Scripts
+# Added /usr/bin/*_perl dirs for scripts
+# Remove /usr/lib/perl5/*_perl/bin in next release
+
+[ -d /usr/bin/site_perl ] && setenv PATH ${PATH}:/usr/bin/site_perl
+[ -d /usr/lib/perl5/site_perl/bin ] && setenv PATH ${PATH}:/usr/lib/perl5/site_perl/bin
+
+[ -d /usr/bin/vendor_perl ] && setenv PATH ${PATH}:/usr/bin/vendor_perl
+[ -d /usr/lib/perl5/vendor_perl/bin ] && setenv PATH ${PATH}:/usr/lib/perl5/vendor_perl/bin
+
+[ -d /usr/bin/core_perl ] && setenv PATH ${PATH}:/usr/bin/core_perl
+
+# If you have modules in non-standard directories you can add them here.
+#export PERLLIB=dir1:dir2
diff --git a/testing/perl/perlbin.sh b/testing/perl/perlbin.sh
new file mode 100755
index 000000000..20f830436
--- /dev/null
+++ b/testing/perl/perlbin.sh
@@ -0,0 +1,18 @@
+# Set path to perl scriptdirs if they exist
+# https://wiki.archlinux.org/index.php/Perl_Policy#Binaries_and_Scripts
+# Added /usr/bin/*_perl dirs for scripts
+# Remove /usr/lib/perl5/*_perl/bin in next release
+
+[ -d /usr/bin/site_perl ] && PATH=$PATH:/usr/bin/site_perl
+[ -d /usr/lib/perl5/site_perl/bin ] && PATH=$PATH:/usr/lib/perl5/site_perl/bin
+
+[ -d /usr/bin/vendor_perl ] && PATH=$PATH:/usr/bin/vendor_perl
+[ -d /usr/lib/perl5/vendor_perl/bin ] && PATH=$PATH:/usr/lib/perl5/vendor_perl/bin
+
+[ -d /usr/bin/core_perl ] && PATH=$PATH:/usr/bin/core_perl
+
+export PATH
+
+# If you have modules in non-standard directories you can add them here.
+#export PERLLIB=dir1:dir2
+
diff --git a/testing/perl/provides.pl b/testing/perl/provides.pl
new file mode 100644
index 000000000..f5f5f20a0
--- /dev/null
+++ b/testing/perl/provides.pl
@@ -0,0 +1,272 @@
+# provides.pl
+##
+# Script for printing out a provides list of every CPAN distribution
+# that is bundled with perl.
+#
+# Justin Davis <jrcd83@gmail.com>
+
+use warnings 'FATAL' => 'all';
+use strict;
+
+package Common;
+
+sub evalver
+{
+ my ($path, $mod) = @_;
+ $mod ||= "";
+
+ open my $fh, '<', $path or die "open $path: $!";
+
+ while (<$fh>) {
+ next unless /\s*(?:\$${mod}::|\$)VERSION\s*=\s*(.+)/;
+ my $ver = eval $1;
+ return $ver unless $@;
+ warn qq{$path:$. bad version string "$ver"\n};
+ }
+
+ close $fh;
+ return undef;
+}
+
+#-----------------------------------------------------------------------------
+
+package Dists;
+
+sub maindistfile
+{
+ my ($dist, $dir) = @_;
+
+ # libpath is the modern style, installing modules under lib/
+ # with dirs matching the name components.
+ my $libpath = join q{/}, 'lib', split /-/, "${dist}.pm";
+
+ # dumbpath is an old style where there's no subdirs and just
+ # a .pm file.
+ my $dumbpath = $dist;
+ $dumbpath =~ s/\A.+-//;
+ $dumbpath .= ".pm";
+
+ my @paths = ($libpath, $dumbpath);
+ # Some modules (with simple names like XSLoader, lib, etc) are
+ # generated by Makefile.PL. Search through their generating code.
+ push @paths, "${dist}_pm.PL" if $dist =~ tr/-/-/ == 0;
+
+ for my $path (map { "$dir/$_" } @paths) { return $path if -f $path; }
+ return undef;
+}
+
+sub module_ver
+{
+ my ($dist, $dir) = @_;
+
+ my $path = maindistfile($dist, $dir) or return undef;
+
+ my $mod = $dist;
+ $mod =~ s/-/::/g;
+ my $ver = Common::evalver($path, $mod);
+ unless ($ver) {
+ warn "failed to find version in module file for $dist\n";
+ return undef;
+ }
+
+ return $ver;
+}
+
+sub changelog_ver
+{
+ my ($dist, $dir) = @_;
+
+ my $path;
+ for my $tmp (glob "$dir/{Changes,ChangeLog}") {
+ if (-f $tmp) { $path = $tmp; last; }
+ }
+ return undef unless $path;
+
+ open my $fh, '<', $path or die "open: $!";
+ while (<$fh>) {
+ return $1 if /\A\s*(?:$dist[ \t]*)?([0-9._]+)/;
+ return $1 if /\A\s*version\s+([0-9._]+)/i;
+ }
+ close $fh;
+
+ return undef;
+}
+
+# for some reason podlators has a VERSION file with perl code in it
+sub verfile_ver
+{
+ my ($dist, $dir) = @_;
+
+ my $path = "$dir/VERSION";
+ return undef unless -f $path; # no warning, only podlaters has it
+
+ return Common::evalver($path);
+}
+
+# scans a directory full of nicely separated dist. directories.
+sub scan_distroot
+{
+ my ($distroot) = @_;
+ opendir my $cpand, "$distroot" or die "failed to open $distroot";
+ my @dists = grep { !/^\./ && -d "$distroot/$_" } readdir $cpand;
+ closedir $cpand;
+
+ my @found;
+ for my $dist (@dists) {
+ my $distdir = "$distroot/$dist";
+ my $ver = (module_ver($dist, $distdir)
+ || changelog_ver($dist, $distdir)
+ || verfile_ver($dist, $distdir));
+
+ if ($ver) { push @found, [ $dist, $ver ]; }
+ else { warn "failed to find version for $dist\n"; }
+ }
+ return @found;
+}
+
+sub find
+{
+ my ($srcdir) = @_;
+ return map { scan_distroot($_) } glob "$srcdir/{cpan,dist}";
+}
+
+#-----------------------------------------------------------------------------
+
+package Modules;
+
+use HTTP::Tiny qw();
+use File::Find qw();
+use File::stat;
+
+*findfile = *File::Find::find;
+
+sub cpan_provider
+{
+ my ($module) = @_;
+ my $url = "http://cpanmetadb.appspot.com/v1.0/package/$module";
+ my $http = HTTP::Tiny->new;
+ my $resp = $http->get($url);
+ return undef unless $resp->{'success'};
+
+ my ($cpanpath) = $resp->{'content'} =~ /^distfile: (.*)$/m
+ or return undef;
+
+ my $dist = $cpanpath;
+ $dist =~ s{\A.+/}{}; # remove author directory
+ $dist =~ s{-[^-]+\z}{}; # remove version and extension
+ return ($dist eq 'perl' ? undef : $dist);
+}
+
+sub find
+{
+ my ($srcdir) = @_;
+ my $libdir = "$srcdir/lib/";
+ die "failed to find $libdir directory" unless -d $libdir;
+
+ # Find only the module files that have not changed since perl
+ # was extracted. We don't want the files perl just recently
+ # installed into lib/. We processed those already.
+ my @modfiles;
+ my $finder = sub {
+ return unless /[.]pm\z/;
+ push @modfiles, $_;
+ };
+ findfile({ 'no_chdir' => 1, 'wanted' => $finder }, $libdir);
+
+ # First we have to find what the oldest ctime actually is.
+ my $oldest = time;
+ @modfiles = map {
+ my $modfile = $_;
+ my $ctime = (stat $modfile)->ctime;
+ $oldest = $ctime if $ctime < $oldest;
+ [ $modfile, $ctime ]; # save ctime for later
+ } @modfiles;
+
+ # Then we filter out any file that was created more than a
+ # few seconds after that. Process the rest.
+ my @mods;
+ for my $modfile (@modfiles) {
+ my ($mod, $ctime) = @$modfile;
+ next if $ctime - $oldest > 5; # ignore newer files
+
+ my $path = $mod;
+ $mod =~ s{[.]pm\z}{};
+ $mod =~ s{\A$libdir}{};
+ $mod =~ s{/}{::}g;
+
+ my $ver = Common::evalver($path) || q{};
+ push @mods, [ $mod, $ver ];
+ }
+
+ # Convert modules names to the dist names who provide them.
+ my %seen;
+ my @dists;
+ for my $modref (@mods) {
+ my ($mod, $ver) = @$modref;
+ my $dist = cpan_provider($mod) or next; # filter out core modules
+ next if $seen{$dist}++; # avoid duplicate dists
+ push @dists, [ $dist, $ver ];
+ }
+ return @dists;
+}
+
+#-----------------------------------------------------------------------------
+
+package Dist2Pkg;
+
+sub name
+{
+ my ($name) = @_;
+ my $orig = $name;
+
+ # Package names should be lowercase and consist of alphanumeric
+ # characters only (and hyphens!)...
+ $name =~ tr/A-Z/a-z/;
+ $name =~ tr/_+/-/; # _ and +'s converted to - (ie Tabbed-Text+Wrap)
+ $name =~ tr/-a-z0-9+//cd; # Delete all other chars.
+ $name =~ tr/-/-/s;
+
+ # Delete leading or trailing hyphens...
+ $name =~ s/\A-|-\z//g;
+
+ die qq{Dist. name '$orig' completely violates packaging standards}
+ unless $name;
+
+ return "perl-$name";
+}
+
+sub version
+{
+ my ($version) = @_;
+
+ # Package versions should be numbers and decimal points only...
+ $version =~ tr/-/./;
+ $version =~ tr/_0-9.-//cd;
+
+ # Remove developer versions because pacman has no special logic
+ # to compare them to regular versions like perl does.
+ $version =~ s/_[^_]+\z//;
+
+ $version =~ tr/_//d; # delete other underscores
+ $version =~ tr/././s; # only one period at a time
+ $version =~ s/\A[.]|[.]\z//g; # shouldn't start or stop with a period
+
+ return $version;
+}
+
+#-----------------------------------------------------------------------------
+
+package main;
+
+my $perldir = shift or die "Usage: $0 [path to perl source directory]\n";
+die "$perldir is not a valid directory." unless -d $perldir;
+
+my @dists = sort { $a->[0] cmp $b->[0] }
+ (Dists::find($perldir), Modules::find($perldir));
+
+for my $dist (@dists) {
+ my ($name, $ver) = @$dist;
+ $name = Dist2Pkg::name($name);
+ $ver = Dist2Pkg::version($ver);
+ print "$name=$ver\n";
+}