summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2012-01-23 23:15:06 +0000
committerroot <root@rshg054.dnsready.net>2012-01-23 23:15:06 +0000
commitc6c657b8bcf062b5d19eff6298b7754c11838080 (patch)
treeed6a14e27d40adfcc821fe921e95aa9e9ab4585b
parent164067832916c8e59219e1b0f30d7d04618a536e (diff)
Mon Jan 23 23:15:06 UTC 2012
-rw-r--r--community-staging/armagetronad/PKGBUILD42
-rw-r--r--community-staging/armagetronad/armagetronad.desktop11
-rw-r--r--community-staging/armagetronad/gcc43.patch210
-rw-r--r--community-staging/calibre/PKGBUILD73
-rw-r--r--community-staging/calibre/calibre-mount-helper28
-rw-r--r--community-staging/calibre/calibre.install12
-rw-r--r--community-staging/calibre/desktop_integration.patch68
-rw-r--r--community-staging/critter/PKGBUILD42
-rw-r--r--community-staging/critter/criticalmass-1.0.2-libpng15.patch31
-rw-r--r--community-staging/critter/critter-gcc43.patch69
-rw-r--r--community-staging/critter/critter.desktop9
-rw-r--r--community-staging/devil/PKGBUILD33
-rw-r--r--community-staging/devil/devil.install11
-rw-r--r--community-staging/devil/libpng14.patch33
-rw-r--r--community-staging/metapixel/PKGBUILD32
-rw-r--r--community-staging/metapixel/metapixel-1.0.2-libpng-1.5.patch174
-rw-r--r--community-staging/openttd/PKGBUILD38
-rw-r--r--community-staging/openttd/openttd.install17
-rw-r--r--community-staging/warzone2100/PKGBUILD29
-rw-r--r--community/chromaprint/PKGBUILD26
-rw-r--r--community/duplicity/PKGBUILD13
-rw-r--r--community/duplicity/duplicity-0.6.17-fix-memleak.patch29
-rw-r--r--community/libfaketime/PKGBUILD16
-rw-r--r--community/libfaketime/libfaketime-0.9.1-fix-README-NEWS.patch29
-rw-r--r--community/libfaketime/libfaketime-0.9.1-fix-as-needed.patch39
-rw-r--r--community/libvisual-projectm/PKGBUILD38
-rw-r--r--community/libvisual-projectm/libvisual-projectm-gcc-4.6.patch11
-rw-r--r--community/picard/PKGBUILD7
-rw-r--r--core/mdadm/PKGBUILD18
-rw-r--r--core/udev/PKGBUILD16
-rw-r--r--cross/cross-mips64el-unknown-linux-gnu-gcc-core-shared/PKGBUILD4
-rw-r--r--cross/cross-mips64el-unknown-linux-gnu-gcc-core/PKGBUILD2
-rw-r--r--cross/cross-mips64el-unknown-linux-gnu-glibc-headers/PKGBUILD8
-rw-r--r--cross/mips64el-unknown-linux-gnu-binutils/PKGBUILD53
-rw-r--r--cross/mips64el-unknown-linux-gnu-gcc/PKGBUILD292
-rw-r--r--cross/mips64el-unknown-linux-gnu-gcc/gcc-ada.install20
-rw-r--r--cross/mips64el-unknown-linux-gnu-gcc/gcc-fortran.install16
-rw-r--r--cross/mips64el-unknown-linux-gnu-gcc/gcc-go.install20
-rw-r--r--cross/mips64el-unknown-linux-gnu-gcc/gcc-hash-style-both.patch122
-rw-r--r--cross/mips64el-unknown-linux-gnu-gcc/gcc-libs.install16
-rw-r--r--cross/mips64el-unknown-linux-gnu-gcc/gcc.install20
-rw-r--r--cross/mips64el-unknown-linux-gnu-gcc/gcc_mips64el_lib.patch25
-rw-r--r--cross/mips64el-unknown-linux-gnu-gcc/gcc_pure64.patch26
-rw-r--r--cross/mips64el-unknown-linux-gnu-glibc/PKGBUILD24
-rw-r--r--extra/gstreamer0.10-ffmpeg/PKGBUILD6
-rw-r--r--extra/gstreamer0.10-python/PKGBUILD6
-rw-r--r--extra/kdeplasma-applets-networkmanagement/PKGBUILD8
-rw-r--r--extra/libgee/PKGBUILD6
-rw-r--r--extra/poppler/PKGBUILD8
-rw-r--r--extra/sg3_utils/PKGBUILD6
-rw-r--r--extra/xterm/PKGBUILD6
-rw-r--r--multilib/lib32-kmod/PKGBUILD41
-rw-r--r--multilib/lib32-udev/PKGBUILD11
-rw-r--r--staging/at-spi/PKGBUILD37
-rw-r--r--staging/at-spi/at-spi.install17
-rw-r--r--staging/cairomm/PKGBUILD27
-rw-r--r--staging/gstreamer0.10-good/PKGBUILD54
-rw-r--r--staging/gstreamer0.10-good/gstreamer0.10-good-plugins.install19
-rw-r--r--staging/poppler/PKGBUILD8
-rw-r--r--staging/vlc/PKGBUILD74
-rw-r--r--staging/vlc/vlc.install18
-rw-r--r--~mtjm/cups-usblp/PKGBUILD134
-rw-r--r--~mtjm/cups-usblp/cups68
-rw-r--r--~mtjm/cups-usblp/cups-avahi.patch3156
-rw-r--r--~mtjm/cups-usblp/cups-no-export-ssllibs.patch12
-rw-r--r--~mtjm/cups-usblp/cups-no-gcrypt.patch38
-rw-r--r--~mtjm/cups-usblp/cups.install26
-rw-r--r--~mtjm/cups-usblp/cups.logrotate8
-rw-r--r--~mtjm/cups-usblp/cups.pam3
69 files changed, 5564 insertions, 85 deletions
diff --git a/community-staging/armagetronad/PKGBUILD b/community-staging/armagetronad/PKGBUILD
new file mode 100644
index 000000000..94dfc61af
--- /dev/null
+++ b/community-staging/armagetronad/PKGBUILD
@@ -0,0 +1,42 @@
+# $Id: PKGBUILD 62638 2012-01-23 01:56:45Z svenstaro $
+# Maintainer: Mateusz Herych <heniekk@gmail.com>
+# Contributor: Filippo 'JoeyrS' Civiletti <joeyrs@gmail.com>
+
+pkgname=armagetronad
+pkgver=0.2.8.3.1
+pkgrel=3
+pkgdesc='A Tron Clone in 3D.'
+arch=('i686' 'x86_64')
+url='http://armagetronad.net/'
+license=('GPL')
+depends=('sdl_image' 'libxml2' 'sdl_mixer' 'mesa' 'ftgl')
+source=(http://downloads.sourceforge.net/sourceforge/armagetronad/armagetronad-$pkgver.src.tar.gz
+ armagetronad.desktop
+ gcc43.patch)
+md5sums=('ed8dbdec493de5cd4535a787f35eed1b'
+ '29d1b1231acadff12cf3014a3867ba5c'
+ '9045d99559ef33fc18136630e8de916c')
+
+build() {
+ cd armagetronad-$pkgver
+
+ # python2 fix
+ sed -i 's_#!/usr/bin/python_#!/usr/bin/python2_' language/update.py
+
+ sed -i 's|FTGL.h|ftgl.h|g' configure
+ sed -i 's|png_check_sig|png_sig_cmp|g' configure
+ patch -p1 < ../gcc43.patch
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --disable-games \
+ --enable-automakedefaults
+ make
+ make DESTDIR=$pkgdir install
+ install -D -m 644 $srcdir/armagetronad.desktop $pkgdir/usr/share/applications/armagetronad.desktop
+ rm -rf $pkgdir/usr/share/applnk
+ rm $pkgdir/usr/bin/armagetronad-uninstall
+ mv $pkgdir/usr/bin/armagetronad $pkgdir/usr/bin/armagetronad_bin
+ printf "#!/bin/bash\n/usr/bin/armagetronad_bin --configdir /etc/armagetronad --datadir /usr/share/armagetronad" > $pkgdir/usr/bin/armagetronad
+ chmod +x $pkgdir/usr/bin/armagetronad
+}
diff --git a/community-staging/armagetronad/armagetronad.desktop b/community-staging/armagetronad/armagetronad.desktop
new file mode 100644
index 000000000..125b4261d
--- /dev/null
+++ b/community-staging/armagetronad/armagetronad.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Name=Armagetronad
+GenericName=3D Tron clone
+GenericName[pl]=Klon gry Tron w 3D
+Exec=armagetronad
+Icon=/usr/share/armagetronad/desktop/icons/small/armagetronad.png
+Categories=Game;
+Terminal=false
+Type=Application
+Encoding=UTF-8
+StartupNotify=false
diff --git a/community-staging/armagetronad/gcc43.patch b/community-staging/armagetronad/gcc43.patch
new file mode 100644
index 000000000..358f48221
--- /dev/null
+++ b/community-staging/armagetronad/gcc43.patch
@@ -0,0 +1,210 @@
+diff -ur a/src/network/md5.cpp b/src/network/md5.cpp
+--- a/src/network/md5.cpp 2009-08-24 20:08:14.000000000 +0200
++++ b/src/network/md5.cpp 2009-08-24 20:21:51.000000000 +0200
+@@ -75,7 +75,7 @@
+ */
+
+ #include "md5.h"
+-
++#include<cstring>
+ #include <string>
+ #include <memory>
+
+Tylko w b/src/network: md5.cpp~
+diff -ur a/src/network/nNetwork.cpp b/src/network/nNetwork.cpp
+--- a/src/network/nNetwork.cpp 2009-08-24 20:08:14.000000000 +0200
++++ b/src/network/nNetwork.cpp 2009-08-24 20:20:40.000000000 +0200
+@@ -24,7 +24,7 @@
+ ***************************************************************************
+
+ */
+-
++#include<cstring>
+ #include "tMemManager.h"
+ #include "tInitExit.h"
+ #include "nSimulatePing.h"
+Tylko w b/src/network: nNetwork.cpp~
+diff -ur a/src/network/nNetwork.h b/src/network/nNetwork.h
+--- a/src/network/nNetwork.h 2009-08-24 20:08:14.000000000 +0200
++++ b/src/network/nNetwork.h 2009-08-24 20:21:18.000000000 +0200
+@@ -27,7 +27,7 @@
+
+ #ifndef ArmageTron_NET_H
+ #define ArmageTron_NET_H
+-
++#include<cstring>
+ #include "tError.h"
+ #include "tString.h"
+ #include "tHeap.h"
+Tylko w b/src/network: nNetwork.h~
+diff -ur a/src/network/nSocket.h b/src/network/nSocket.h
+--- a/src/network/nSocket.h 2009-08-24 20:08:14.000000000 +0200
++++ b/src/network/nSocket.h 2009-08-24 20:22:09.000000000 +0200
+@@ -33,7 +33,7 @@
+
+ #ifndef NET_SOCKET_H
+ #define NET_SOCKET_H
+-
++#include<cstring>
+ #include <iostream>
+ #include "tConsole.h"
+ #include "tException.h"
+Tylko w b/src/network: nSocket.h~
+diff -ur a/src/render/rModel.h b/src/render/rModel.h
+--- a/src/render/rModel.h 2009-08-24 20:08:14.000000000 +0200
++++ b/src/render/rModel.h 2009-08-24 20:20:57.000000000 +0200
+@@ -27,7 +27,7 @@
+
+ #ifndef ArmageTron_MODEL_H
+ #define ArmageTron_MODEL_H
+-
++#include<cstring>
+ #include "defs.h"
+ #include "tArray.h"
+ #include "tLinkedList.h"
+Tylko w b/src/render: rModel.h~
+diff -ur a/src/tools/tArray.cpp b/src/tools/tArray.cpp
+--- a/src/tools/tArray.cpp 2009-08-24 20:08:14.000000000 +0200
++++ b/src/tools/tArray.cpp 2009-08-24 20:22:25.000000000 +0200
+@@ -27,7 +27,7 @@
+ */
+
+ #define NO_MALLOC_REPLACEMENT
+-
++#include<cstring>
+ #include "tMemManager.h"
+ #include <iostream>
+ #include <stdlib.h>
+Tylko w b/src/tools: tArray.cpp~
+diff -ur a/src/tools/tCommandLine.cpp b/src/tools/tCommandLine.cpp
+--- a/src/tools/tCommandLine.cpp 2009-08-24 20:08:14.000000000 +0200
++++ b/src/tools/tCommandLine.cpp 2009-08-24 20:24:19.000000000 +0200
+@@ -30,7 +30,7 @@
+ #ifndef TCOMMANDLINE_H_INCLUDED
+ #include "tCommandLine.h"
+ #endif
+-
++#include<cstring>
+ #include "tLocale.h"
+ #include "tConfiguration.h"
+ #include "tException.h"
+Tylko w b/src/tools: tCommandLine.cpp~
+diff -ur a/src/tools/tConfiguration.cpp b/src/tools/tConfiguration.cpp
+--- a/src/tools/tConfiguration.cpp 2009-08-24 20:08:14.000000000 +0200
++++ b/src/tools/tConfiguration.cpp 2009-08-24 20:22:42.000000000 +0200
+@@ -24,7 +24,7 @@
+ ***************************************************************************
+
+ */
+-
++#include<cstring>
+ #include "config.h"
+ #include <fstream>
+ #include <iomanip>
+Tylko w b/src/tools: tConfiguration.cpp~
+diff -ur a/src/tools/tCrypt.cpp b/src/tools/tCrypt.cpp
+--- a/src/tools/tCrypt.cpp 2009-08-24 20:08:14.000000000 +0200
++++ b/src/tools/tCrypt.cpp 2009-08-24 20:22:54.000000000 +0200
+@@ -24,7 +24,7 @@
+ ***************************************************************************
+
+ */
+-
++#include<cstring>
+ #include "tCrypt.h"
+ #include "tMemManager.h"
+
+Tylko w b/src/tools: tCrypt.cpp~
+diff -ur a/src/tools/tDirectories.cpp b/src/tools/tDirectories.cpp
+--- a/src/tools/tDirectories.cpp 2009-08-24 20:08:14.000000000 +0200
++++ b/src/tools/tDirectories.cpp 2009-08-24 20:23:06.000000000 +0200
+@@ -27,7 +27,7 @@
+ */
+
+ #include "config.h"
+-
++#include<cstring>
+ #include <errno.h>
+ #include <sys/types.h>
+ #include <stdio.h>
+Tylko w b/src/tools: tDirectories.cpp~
+diff -ur a/src/tools/tError.cpp b/src/tools/tError.cpp
+--- a/src/tools/tError.cpp 2009-08-24 20:08:14.000000000 +0200
++++ b/src/tools/tError.cpp 2009-08-24 20:28:01.000000000 +0200
+@@ -24,8 +24,9 @@
+ ***************************************************************************
+
+ */
+-
++#include<cstring>
+ #include "config.h"
++#include<cstdlib>
+ #include <iostream>
+ #if HAVE_UNISTD_H
+ #include <unistd.h>
+Tylko w b/src/tools: tError.cpp~
+diff -ur a/src/tools/tLocale.cpp b/src/tools/tLocale.cpp
+--- a/src/tools/tLocale.cpp 2009-08-24 20:08:14.000000000 +0200
++++ b/src/tools/tLocale.cpp 2009-08-24 20:23:49.000000000 +0200
+@@ -30,7 +30,7 @@
+ #include "tConsole.h"
+ #include "tDirectories.h"
+ #include "tSafePTR.h"
+-
++#include<cstring>
+ #include <fstream>
+ #include <string>
+ #include <map>
+Tylko w b/src/tools: tLocale.cpp~
+diff -ur a/src/tools/tMemManager.cpp b/src/tools/tMemManager.cpp
+--- a/src/tools/tMemManager.cpp 2009-08-24 20:08:14.000000000 +0200
++++ b/src/tools/tMemManager.cpp 2009-08-24 20:24:42.000000000 +0200
+@@ -29,7 +29,7 @@
+ #define NO_MALLOC_REPLACEMENT
+
+ #include "defs.h"
+-
++#include<cstring>
+ #include <iostream>
+ #include <sstream>
+ #include <stdio.h> // need basic C IO since STL IO does memory management
+Tylko w b/src/tools: tMemManager.cpp~
+diff -ur a/src/tools/tRandom.cpp b/src/tools/tRandom.cpp
+--- a/src/tools/tRandom.cpp 2009-08-24 20:08:14.000000000 +0200
++++ b/src/tools/tRandom.cpp 2009-08-24 20:24:31.000000000 +0200
+@@ -29,7 +29,7 @@
+ #ifndef TRANDOM_H_INCLUDED
+ #include "tRandom.h"
+ #endif
+-
++#include<cstdlib>
+ #ifdef HAVE_STDLIB
+ #include <stdlib.h>
+ #endif
+Tylko w b/src/tools: tRandom.cpp~
+diff -ur a/src/tools/tString.cpp b/src/tools/tString.cpp
+--- a/src/tools/tString.cpp 2009-08-24 20:08:14.000000000 +0200
++++ b/src/tools/tString.cpp 2009-08-24 20:24:03.000000000 +0200
+@@ -24,7 +24,7 @@
+ ***************************************************************************
+
+ */
+-
++#include<cstring>
+ #include "tMemManager.h"
+ #include "tString.h"
+ #include "tLocale.h"
+Tylko w b/src/tools: tString.cpp~
+diff -ur a/src/tron/gAIBase.h b/src/tron/gAIBase.h
+--- a/src/tron/gAIBase.h 2009-08-24 20:08:14.000000000 +0200
++++ b/src/tron/gAIBase.h 2009-08-24 20:21:33.000000000 +0200
+@@ -29,7 +29,7 @@
+ #define ArmageTron_AIBASE_H
+
+ #include "rSDL.h"
+-
++#include<memory>
+ #include "eTimer.h"
+ #include "ePath.h"
+ #include "ePlayer.h"
+Tylko w b/src/tron: gAIBase.h~
diff --git a/community-staging/calibre/PKGBUILD b/community-staging/calibre/PKGBUILD
new file mode 100644
index 000000000..5f43241ff
--- /dev/null
+++ b/community-staging/calibre/PKGBUILD
@@ -0,0 +1,73 @@
+# $Id: PKGBUILD 62598 2012-01-22 12:14:47Z giovanni $
+# Maintainer: Giovanni Scafora <giovanni@archlinux.org>
+# Contributor: Petrov Roman <nwhisper@gmail.com>
+# Contributor: Andrea Fagiani <andfagiani _at_ gmail dot com>
+
+pkgname=calibre
+pkgver=0.8.36
+pkgrel=3
+pkgdesc="Ebook management application"
+arch=('i686' 'x86_64')
+url="http://calibre-ebook.com/"
+license=('GPL3')
+depends=('python2-dateutil' 'python2-cssutils' 'python2-cherrypy'
+ 'python-mechanize' 'podofo' 'libwmf' 'python-beautifulsoup'
+ 'imagemagick' 'poppler-qt' 'chmlib' 'python-lxml' 'libusb'
+ 'python-imaging' 'desktop-file-utils' 'shared-mime-info'
+ 'python-dnspython' 'unrar' 'python2-pyqt' 'icu')
+makedepends=('python2-pycountry')
+optdepends=('ipython: to use calibre-debug')
+install=calibre.install
+source=("http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.xz"
+ 'desktop_integration.patch'
+ 'calibre-mount-helper')
+md5sums=('cc009c02fa0db088d074fef8b983e78a'
+ '253ce4fe5d01f8ff76b63cd3825755ea'
+ '675cd87d41342119827ef706055491e7')
+
+build() {
+ cd "${srcdir}/${pkgname}"
+
+ #rm -rf src/{cherrypy,pyPdf}
+ rm -rf src/cherrypy
+ sed -i -e "s/ldflags = shlex.split(ldflags)/ldflags = shlex.split(ldflags) + ['-fPIC']/" setup/extensions.py
+ sed -i -e 's:\(#!/usr/bin/env[ ]\+python$\|#!/usr/bin/python$\):\12:g' \
+ $(find . -regex ".*.py\|.*.recipe")
+
+ python2 setup.py build
+# python2 setup.py resources
+ python2 setup.py translations
+}
+
+package() {
+ cd "${srcdir}/${pkgname}"
+
+ patch -Np1 -i "${srcdir}/desktop_integration.patch"
+
+ # More on desktop integration (e.g. enforce arch defaults)
+ sed -i -e "/self.create_uninstaller()/,/os.rmdir(config_dir)/d" \
+ -e "s|self.opts.staging_sharedir, 'man/man1'|self.opts.staging_root, 'usr/share/man/man1'|" \
+ -e "s|manpath, prog+'.1'+__appname__+'.bz2'|manpath, prog+'.1'+'.bz2'|" \
+ -e "s|old_udev = '/etc|old_udev = '${pkgdir}/etc|" \
+ -e "s/^Name=calibre/Name=Calibre/g" src/calibre/linux.py
+
+ # Fix the environment module location
+ sed -i -e "s|(prefix=.*)|(prefix='$pkgdir/usr')|g" setup/install.py
+
+ install -d "${pkgdir}/usr/lib/python2.7/site-packages"
+ python2 setup.py install --root="${pkgdir}" --prefix=/usr \
+ --staging-bindir="${pkgdir}/usr/bin" \
+ --staging-libdir="${pkgdir}/usr/lib" \
+ --staging-sharedir="${pkgdir}/usr/share"
+
+ find "${pkgdir}" -type d -empty -delete
+
+ # Decompress the man pages so makepkg will do it for us.
+ for decom in "${pkgdir}"/usr/share/man/man1/*.bz2; do
+ bzip2 -d "${decom}"
+ done
+
+ # See http://lwn.net/SubscriberLink/465311/7c299471a5399167/
+ rm -rf ${pkgdir}/usr/bin/calibre-mount-helper
+ install -m 755 ${srcdir}/calibre-mount-helper "${pkgdir}/usr/bin"
+}
diff --git a/community-staging/calibre/calibre-mount-helper b/community-staging/calibre/calibre-mount-helper
new file mode 100644
index 000000000..00cac4270
--- /dev/null
+++ b/community-staging/calibre/calibre-mount-helper
@@ -0,0 +1,28 @@
+#!/bin/sh -e
+# Replacement for upstream mount helper using udisks/eject
+# (C) 2010 Martin Pitt <mpitt@debian.org>
+
+ACTION="$1"
+DEV="$2"
+
+case "$ACTION" in
+ mount)
+ udisks --mount "$DEV"
+
+ # check if mount worked. If not, fail
+ # udisks does return 0 even if mount failed
+ mount | grep -q "$DEV" || exit 0
+ ;;
+
+ eject)
+ eject "$DEV"
+ ;;
+
+ cleanup)
+ ;;
+
+ *)
+ echo "unknown action" >&2
+ exit 1
+esac
+
diff --git a/community-staging/calibre/calibre.install b/community-staging/calibre/calibre.install
new file mode 100644
index 000000000..6210bd0ab
--- /dev/null
+++ b/community-staging/calibre/calibre.install
@@ -0,0 +1,12 @@
+post_install() {
+ update-desktop-database -q
+ update-mime-database usr/share/mime &> /dev/null
+}
+
+post_upgrade() {
+ post_install
+}
+
+post_remove() {
+ post_install
+}
diff --git a/community-staging/calibre/desktop_integration.patch b/community-staging/calibre/desktop_integration.patch
new file mode 100644
index 000000000..4dbf53757
--- /dev/null
+++ b/community-staging/calibre/desktop_integration.patch
@@ -0,0 +1,68 @@
+--- a/src/calibre/linux.py 2011-06-17 19:56:05.000000000 +0200
++++ b/src/calibre/linux.py 2011-06-18 00:07:46.000000000 +0200
+@@ -339,51 +339,39 @@
+
+ with TemporaryDirectory() as tdir:
+ with CurrentDir(tdir):
+- render_img('mimetypes/lrf.png', 'calibre-lrf.png')
+- check_call('xdg-icon-resource install --noupdate --context mimetypes --size 128 calibre-lrf.png application-lrf', shell=True)
+- self.icon_resources.append(('mimetypes', 'application-lrf', '128'))
+- check_call('xdg-icon-resource install --noupdate --context mimetypes --size 128 calibre-lrf.png text-lrs', shell=True)
+- self.icon_resources.append(('mimetypes', 'application-lrs',
+- '128'))
+- render_img('lt.png', 'calibre-gui.png')
+- check_call('xdg-icon-resource install --noupdate --size 128 calibre-gui.png calibre-gui', shell=True)
+- self.icon_resources.append(('apps', 'calibre-gui', '128'))
+- render_img('viewer.png', 'calibre-viewer.png')
+- check_call('xdg-icon-resource install --size 128 calibre-viewer.png calibre-viewer', shell=True)
+- self.icon_resources.append(('apps', 'calibre-viewer', '128'))
++ dir = os.path.join(self.opts.staging_sharedir,'../pixmaps')
++ os.mkdir(dir)
++ render_img('mimetypes/lrf.png', os.path.join(dir,'calibre-lrf.png'))
++ render_img('lt.png', os.path.join(dir, 'calibre-gui.png'))
++ render_img('viewer.png', os.path.join(dir, 'calibre-viewer.png'))
+
+ mimetypes = set([])
+ for x in all_input_formats():
+ mt = guess_type('dummy.'+x)[0]
+- if mt and 'chemical' not in mt and 'ctc-posml' not in mt:
++ if mt and 'chemical' not in mt and 'text' not in mt and 'pdf' not in mt and 'xhtml' not in mt:
+ mimetypes.add(mt)
+
+ def write_mimetypes(f):
+ f.write('MimeType=%s;\n'%';'.join(mimetypes))
+
+- f = open('calibre-lrfviewer.desktop', 'wb')
++ dir = os.path.join(self.opts.staging_sharedir,'../applications')
++ os.mkdir(dir)
++ f = open(os.path.join(dir, 'calibre-lrfviewer.desktop'), 'wb')
+ f.write(VIEWER)
+ f.close()
+- f = open('calibre-ebook-viewer.desktop', 'wb')
++ f = open(os.path.join(dir, 'calibre-ebook-viewer.desktop'), 'wb')
+ f.write(EVIEWER)
+ write_mimetypes(f)
+ f.close()
+- f = open('calibre-gui.desktop', 'wb')
++ f = open(os.path.join(dir, 'calibre-gui.desktop'), 'wb')
+ f.write(GUI)
+ write_mimetypes(f)
+ f.close()
+- des = ('calibre-gui.desktop', 'calibre-lrfviewer.desktop',
+- 'calibre-ebook-viewer.desktop')
+- for x in des:
+- cmd = ['xdg-desktop-menu', 'install', '--noupdate', './'+x]
+- check_call(' '.join(cmd), shell=True)
+- self.menu_resources.append(x)
+- check_call(['xdg-desktop-menu', 'forceupdate'])
+- f = open('calibre-mimetypes', 'wb')
++ dir = os.path.join(self.opts.staging_sharedir,'../mime/packages/')
++ os.makedirs(dir)
++ f = open(os.path.join(dir, 'calibre.xml'), 'wb')
+ f.write(MIME)
+ f.close()
+- self.mime_resources.append('calibre-mimetypes')
+- check_call('xdg-mime install ./calibre-mimetypes', shell=True)
+ except Exception:
+ if self.opts.fatal_errors:
+ raise
diff --git a/community-staging/critter/PKGBUILD b/community-staging/critter/PKGBUILD
new file mode 100644
index 000000000..429ab1ebf
--- /dev/null
+++ b/community-staging/critter/PKGBUILD
@@ -0,0 +1,42 @@
+# $Id: PKGBUILD 62631 2012-01-22 22:37:03Z lcarlier $
+# Contributor: Allan McRae <mcrae_allan@hotmail.com>
+# Maintainer: Daniel J Griffiths <griffithsdj@archlinux.us>
+
+pkgname=critter
+_origname=CriticalMass
+pkgver=1.0.2
+pkgrel=6
+pkgdesc="Critical Mass (aka Critter) is an SDL/OpenGL space shoot'em up game"
+arch=('i686' 'x86_64')
+url="http://sourceforge.net/projects/criticalmass"
+license=('GPL')
+depends=('sdl_image' 'sdl_mixer' 'mesa')
+source=(http://downloads.sourceforge.net/sourceforge/criticalmass/$_origname-${pkgver}.tar.bz2
+ critter-gcc43.patch
+ criticalmass-1.0.2-libpng15.patch
+ critter.desktop)
+md5sums=('e2aff114bffa717fb79c82e1dc473ebe'
+ 'e936920acce56bfa3b0123ca8b1193a6'
+ '76448ba5b7a42aec8fd2a5d1bc31b8e2'
+ '98c17809aed964c445adad09827035df')
+
+build() {
+ cd ${srcdir}/$_origname-${pkgver}
+
+ patch -Np1 -i ../critter-gcc43.patch
+ patch -Np0 -i ../criticalmass-1.0.2-libpng15.patch
+ sed -i 's|-lpng12|-lpng15|g' configure
+
+ ./configure --prefix=/usr --mandir=/usr/share/man
+ make
+}
+
+package() {
+ cd ${srcdir}/$_origname-${pkgver}
+
+ make DESTDIR=${pkgdir} install
+
+ install -Dm644 critter.png ${pkgdir}/usr/share/pixmaps/critter.png
+ install -Dm644 ../critter.desktop \
+ ${pkgdir}/usr/share/applications/critter.desktop
+}
diff --git a/community-staging/critter/criticalmass-1.0.2-libpng15.patch b/community-staging/critter/criticalmass-1.0.2-libpng15.patch
new file mode 100644
index 000000000..ac1b8c0c6
--- /dev/null
+++ b/community-staging/critter/criticalmass-1.0.2-libpng15.patch
@@ -0,0 +1,31 @@
+--- game/main.cpp
++++ game/main.cpp
+@@ -28,6 +28,8 @@
+ #include <sys/stat.h>
+ #include <sys/types.h>
+
++#include <zlib.h>
++
+ void migrateConfig( void)
+ {
+ //if onlineCheck is not set, default it to true
+--- utilssdl/PNG.cpp
++++ utilssdl/PNG.cpp
+@@ -45,7 +45,7 @@
+ {
+ png_size_t check;
+
+- check = fwrite( data, 1, length, (FILE *)(png->io_ptr));
++ check = fwrite( data, 1, length, (FILE *)(png_get_io_ptr(png)));
+ if( check != length)
+ {
+ png_error( png, "Write Error");
+@@ -72,7 +72,7 @@
+ return false;
+ }
+
+- if( setjmp(_png->jmpbuf))
++ if( setjmp(png_jmpbuf(_png)))
+ {
+ fclose( fp);
+ png_destroy_write_struct(&_png, (png_infopp)NULL);
diff --git a/community-staging/critter/critter-gcc43.patch b/community-staging/critter/critter-gcc43.patch
new file mode 100644
index 000000000..ade42d8e4
--- /dev/null
+++ b/community-staging/critter/critter-gcc43.patch
@@ -0,0 +1,69 @@
+diff -Naur CriticalMass-1.0.2-old/tinyxml/tinyxml.cpp CriticalMass-1.0.2/tinyxml/tinyxml.cpp
+--- CriticalMass-1.0.2-old/tinyxml/tinyxml.cpp 2003-03-03 12:34:58.000000000 +1000
++++ CriticalMass-1.0.2/tinyxml/tinyxml.cpp 2008-04-01 22:26:47.000000000 +1000
+@@ -22,7 +22,8 @@
+ */
+
+ #include "tinyxml.h"
+-
++#include <cstring>
++#include <cstdlib>
+
+ TiXmlNode::TiXmlNode( NodeType _type )
+ {
+diff -Naur CriticalMass-1.0.2-old/tinyxml/tinyxmlparser.cpp CriticalMass-1.0.2/tinyxml/tinyxmlparser.cpp
+--- CriticalMass-1.0.2-old/tinyxml/tinyxmlparser.cpp 2003-03-03 12:34:58.000000000 +1000
++++ CriticalMass-1.0.2/tinyxml/tinyxmlparser.cpp 2008-04-01 22:27:02.000000000 +1000
+@@ -24,7 +24,7 @@
+
+ #include "tinyxml.h"
+ #include <ctype.h>
+-
++#include <cstring>
+ const char* TiXmlBase::SkipWhiteSpace( const char* p )
+ {
+ while ( p && *p &&
+diff -Naur CriticalMass-1.0.2-old/utils/ResourceManager.cpp CriticalMass-1.0.2/utils/ResourceManager.cpp
+--- CriticalMass-1.0.2-old/utils/ResourceManager.cpp 2005-01-02 12:59:29.000000000 +1000
++++ CriticalMass-1.0.2/utils/ResourceManager.cpp 2008-04-01 22:27:19.000000000 +1000
+@@ -15,6 +15,7 @@
+ #include <iomanip>
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#include <cstring>
+
+ #include <Trace.hpp>
+ #include <ResourceManager.hpp>
+diff -Naur CriticalMass-1.0.2-old/utils/Value.hpp CriticalMass-1.0.2/utils/Value.hpp
+--- CriticalMass-1.0.2-old/utils/Value.hpp 2004-12-18 12:41:24.000000000 +1000
++++ CriticalMass-1.0.2/utils/Value.hpp 2008-04-01 22:27:39.000000000 +1000
+@@ -17,6 +17,7 @@
+
+ #include <stdio.h>
+ #include <string>
++#include <cstdlib>
+
+ #include <Trace.hpp>
+
+diff -Naur CriticalMass-1.0.2-old/utils/zStream.cpp CriticalMass-1.0.2/utils/zStream.cpp
+--- CriticalMass-1.0.2-old/utils/zStream.cpp 2005-08-01 06:06:14.000000000 +1000
++++ CriticalMass-1.0.2/utils/zStream.cpp 2008-04-01 22:28:03.000000000 +1000
+@@ -17,6 +17,7 @@
+ #include <zStream.hpp>
+ #include <zStreamBufferImplLZMA.hpp>
+ #include <zStreamBufferImplZLib.hpp>
++#include <cstdlib>
+
+ ofstream &operator<<( ofstream &outfile, Uint32 i)
+ {
+diff -Naur CriticalMass-1.0.2-old/utils/zStreamBufferImplZLib.cpp CriticalMass-1.0.2/utils/zStreamBufferImplZLib.cpp
+--- CriticalMass-1.0.2-old/utils/zStreamBufferImplZLib.cpp 2005-08-01 06:06:14.000000000 +1000
++++ CriticalMass-1.0.2/utils/zStreamBufferImplZLib.cpp 2008-04-01 22:28:23.000000000 +1000
+@@ -14,6 +14,7 @@
+ //
+ #include <Trace.hpp>
+ #include <zStreamBufferImplZLib.hpp>
++#include <cstdlib>
+
+ bool ziStreamBufferImplZLib::init( void)
+ {
diff --git a/community-staging/critter/critter.desktop b/community-staging/critter/critter.desktop
new file mode 100644
index 000000000..ded5a9fbf
--- /dev/null
+++ b/community-staging/critter/critter.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=Critical Mass
+Comment=SDL/OpenGL space shoot'em up game
+Exec=critter
+Icon=critter
+Terminal=false
+Type=Application
+StartupNotify=true
+Categories=Game;
diff --git a/community-staging/devil/PKGBUILD b/community-staging/devil/PKGBUILD
new file mode 100644
index 000000000..11ed311ba
--- /dev/null
+++ b/community-staging/devil/PKGBUILD
@@ -0,0 +1,33 @@
+# $Id: PKGBUILD 62634 2012-01-22 22:50:07Z lcarlier $
+# Maintainer: Laurent Carlier <lordheavym@gmail.org>
+# Contributor: damir <damir@archlinux.org>
+# Contributor: TheHoff <forums>
+
+pkgname=devil
+pkgver=1.7.8
+pkgrel=10
+pkgdesc="Library for reading several different image formats"
+arch=('i686' 'x86_64')
+url="http://openil.sourceforge.net/"
+depends=('libpng' 'libmng' 'jasper' 'lcms' 'openexr')
+install=devil.install
+options=('!libtool' '!docs' '!emptydirs')
+license=('GPL')
+source=(http://downloads.sourceforge.net/openil/DevIL-$pkgver.tar.gz libpng14.patch)
+md5sums=('7918f215524589435e5ec2e8736d5e1d'
+ '0f839ccefd43b0ee8b4b3f99806147fc')
+
+build() {
+ cd ${srcdir}/devil-$pkgver
+
+ patch -Np1 -i ${srcdir}/libpng14.patch
+
+ ./configure --prefix=/usr --enable-ILU
+ make
+}
+
+package() {
+ cd ${srcdir}/devil-$pkgver
+
+ make prefix=${pkgdir}/usr install
+}
diff --git a/community-staging/devil/devil.install b/community-staging/devil/devil.install
new file mode 100644
index 000000000..8336ac3d1
--- /dev/null
+++ b/community-staging/devil/devil.install
@@ -0,0 +1,11 @@
+infodir=usr/share/info
+
+post_upgrade() {
+ [ -x usr/bin/install-info ] || return 0
+ install-info $infodir/DevIL_manual.info.gz $infodir/dir 2> /dev/null
+}
+
+pre_remove() {
+ [ -x usr/bin/install-info ] || return 0
+ install-info --delete $infodir/DevIL_manual.info.gz $infodir/dir 2> /dev/null
+}
diff --git a/community-staging/devil/libpng14.patch b/community-staging/devil/libpng14.patch
new file mode 100644
index 000000000..b8434692b
--- /dev/null
+++ b/community-staging/devil/libpng14.patch
@@ -0,0 +1,33 @@
+diff -Nur devil-1.7.8.orig/src-IL/src/il_icon.c devil-1.7.8/src-IL/src/il_icon.c
+--- devil-1.7.8.orig/src-IL/src/il_icon.c 2009-03-08 09:10:09.000000000 +0200
++++ devil-1.7.8/src-IL/src/il_icon.c 2010-01-17 00:54:09.000000000 +0200
+@@ -525,7 +525,7 @@
+
+ // Expand low-bit-depth grayscale images to 8 bits
+ if (ico_color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) {
+- png_set_gray_1_2_4_to_8(ico_png_ptr);
++ png_set_expand_gray_1_2_4_to_8(ico_png_ptr);
+ }
+
+ // Expand RGB images with transparency to full alpha channels
+diff -Nur devil-1.7.8.orig/src-IL/src/il_png.c devil-1.7.8/src-IL/src/il_png.c
+--- devil-1.7.8.orig/src-IL/src/il_png.c 2009-03-08 09:10:09.000000000 +0200
++++ devil-1.7.8/src-IL/src/il_png.c 2010-01-17 00:55:26.000000000 +0200
+@@ -105,7 +105,7 @@
+ Read = iread(Signature, 1, 8);
+ iseek(-Read, IL_SEEK_CUR);
+
+- return png_check_sig(Signature, 8);
++ return png_sig_cmp(Signature, 0, 8) == 0;
+ }
+
+
+@@ -278,7 +278,7 @@
+
+ // Expand low-bit-depth grayscale images to 8 bits
+ if (png_color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) {
+- png_set_gray_1_2_4_to_8(png_ptr);
++ png_set_expand_gray_1_2_4_to_8(png_ptr);
+ }
+
+ // Expand RGB images with transparency to full alpha channels
diff --git a/community-staging/metapixel/PKGBUILD b/community-staging/metapixel/PKGBUILD
new file mode 100644
index 000000000..7767059ee
--- /dev/null
+++ b/community-staging/metapixel/PKGBUILD
@@ -0,0 +1,32 @@
+# $Id: PKGBUILD 62646 2012-01-23 04:17:52Z lfleischer $
+# Maintainer: Lukas Fleischer <archlinux at cryptocrack dot de>
+# Contributor: Daniel Isenmann <daniel.isenmann [at] gmx [dot] de>
+
+pkgname=metapixel
+pkgver=1.0.2
+pkgrel=3
+pkgdesc='A program for generating photomosaics.'
+arch=('i686' 'x86_64')
+url='http://www.complang.tuwien.ac.at/schani/metapixel/'
+license=('GPL')
+depends=('giflib' 'libjpeg' 'libpng' 'perl')
+source=("http://www.complang.tuwien.ac.at/schani/metapixel/files/${pkgname}-${pkgver}.tar.gz"
+ 'metapixel-1.0.2-libpng-1.5.patch')
+md5sums=('af5d77d38826756af213a08e3ada9941'
+ '1832a79790b07402735bfeb9f71f36e9')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ patch -p1 -i ../metapixel-1.0.2-libpng-1.5.patch
+
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ install -dm0755 "${pkgdir}/usr/share/man/man1"
+
+ make PREFIX="${pkgdir}/usr" install
+}
diff --git a/community-staging/metapixel/metapixel-1.0.2-libpng-1.5.patch b/community-staging/metapixel/metapixel-1.0.2-libpng-1.5.patch
new file mode 100644
index 000000000..ed787452f
--- /dev/null
+++ b/community-staging/metapixel/metapixel-1.0.2-libpng-1.5.patch
@@ -0,0 +1,174 @@
+--- metapixel-1.0.2.orig/rwimg/rwpng.c
++++ metapixel-1.0.2/rwimg/rwpng.c
+@@ -57,19 +57,39 @@
+ data->end_info = png_create_info_struct(data->png_ptr);
+ assert(data->end_info != 0);
+
++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
++ if (setjmp(png_jmpbuf((data->png_ptr))))
++#else
+ if (setjmp(data->png_ptr->jmpbuf))
++#endif
+ assert(0);
+
+- png_init_io(data->png_ptr, data->file);
+-
++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
++ png_init_io(data->png_ptr, data->file);
++ png_read_info(data->png_ptr, data->info_ptr);
++#else
++ png_init_io(data->png_ptr, data->file);
+ png_read_info(data->png_ptr, data->info_ptr);
++#endif
+
++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
++ *width = png_get_image_width(data->png_ptr, data->info_ptr);
++ *height = png_get_image_height(data->png_ptr, data->info_ptr);
++ {
++ png_byte value = png_get_bit_depth(data->png_ptr, data->info_ptr);
++ assert(value == 8 || value == 16);
++ value = png_get_color_type(data->png_ptr, data->info_ptr);
++ assert(value == PNG_COLOR_TYPE_RGB || value == PNG_COLOR_TYPE_RGB_ALPHA);
++ value = png_get_interlace_type(data->png_ptr, data->info_ptr);
++ assert(value == PNG_INTERLACE_NONE);
++ }
++#else
+ *width = data->info_ptr->width;
+ *height = data->info_ptr->height;
+-
+ assert(data->info_ptr->bit_depth == 8 || data->info_ptr->bit_depth == 16);
+ assert(data->info_ptr->color_type == PNG_COLOR_TYPE_RGB || data->info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA);
+ assert(data->info_ptr->interlace_type == PNG_INTERLACE_NONE);
++#endif
+
+ data->have_read = 0;
+
+@@ -81,32 +101,51 @@
+ {
+ png_data_t *data = (png_data_t*)_data;
+ int i;
+- int bps, spp;
++ int bps, spp, width;
+ unsigned char *row;
+
++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
++
++ if (setjmp(png_jmpbuf((data->png_ptr))))
++#else
+ if (setjmp(data->png_ptr->jmpbuf))
++#endif
+ assert(0);
+
++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
++ if(png_get_color_type(data->png_ptr, data->info_ptr) == PNG_COLOR_TYPE_RGB)
++#else
+ if (data->info_ptr->color_type == PNG_COLOR_TYPE_RGB)
++#endif
+ spp = 3;
+ else
+ spp = 4;
+
++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
++ if(png_get_bit_depth(data->png_ptr, data->info_ptr) == 16)
++#else
+ if (data->info_ptr->bit_depth == 16)
++#endif
+ bps = 2;
+ else
+ bps = 1;
+
+- row = (unsigned char*)malloc(data->info_ptr->width * spp * bps);
++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
++ width = png_get_image_width(data->png_ptr, data->info_ptr);
++#else
++ width = data->info_ptr->width:
++#endif
++
++ row = (unsigned char*)malloc(width * spp * bps);
+
+ for (i = 0; i < num_lines; ++i)
+ {
+ int j, channel;
+
+ png_read_row(data->png_ptr, (png_bytep)row, 0);
+- for (j = 0; j < data->info_ptr->width; ++j)
++ for (j = 0; j < width; ++j)
+ for (channel = 0; channel < 3; ++channel)
+- lines[i * data->info_ptr->width * 3 + j * 3 + channel] = row[j * spp * bps + channel * bps];
++ lines[i * width * 3 + j * 3 + channel] = row[j * spp * bps + channel * bps];
+ }
+
+ free(row);
+@@ -119,7 +158,11 @@
+ {
+ png_data_t *data = (png_data_t*)_data;
+
++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
++ if (setjmp(png_jmpbuf((data->png_ptr))))
++#else
+ if (setjmp(data->png_ptr->jmpbuf))
++#endif
+ assert(0);
+
+ if (data->have_read)
+@@ -148,7 +191,11 @@
+ data->info_ptr = png_create_info_struct(data->png_ptr);
+ assert(data->info_ptr != 0);
+
++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
++ if (setjmp(png_jmpbuf((data->png_ptr))))
++#else
+ if (setjmp(data->png_ptr->jmpbuf))
++#endif
+ assert(0);
+
+ if (pixel_stride == 4)
+@@ -156,6 +203,16 @@
+
+ png_init_io(data->png_ptr, data->file);
+
++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
++ png_set_IHDR(data->png_ptr, data->info_ptr,
++ width, height, 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
++ PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
++
++ /* Maybe does not need following. */
++ png_set_tRNS(data->png_ptr, data->info_ptr, NULL, 0, NULL);
++ png_set_PLTE(data->png_ptr, data->info_ptr, NULL, 0);
++ png_set_invalid(data->png_ptr, data->info_ptr, 0);
++#else
+ data->info_ptr->width = width;
+ data->info_ptr->height = height;
+ data->info_ptr->valid = 0;
+@@ -168,6 +225,7 @@
+ data->info_ptr->compression_type = PNG_COMPRESSION_TYPE_DEFAULT;
+ data->info_ptr->filter_type = PNG_FILTER_TYPE_DEFAULT;
+ data->info_ptr->interlace_type = PNG_INTERLACE_NONE;
++#endif
+
+ png_write_info(data->png_ptr, data->info_ptr);
+
+@@ -182,7 +240,11 @@
+ png_data_t *data = (png_data_t*)_data;
+ int i;
+
++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
++ if (setjmp(png_jmpbuf((data->png_ptr))))
++#else
+ if (setjmp(data->png_ptr->jmpbuf))
++#endif
+ assert(0);
+
+ for (i = 0; i < num_lines; ++i)
+@@ -194,7 +256,11 @@
+ {
+ png_data_t *data = (png_data_t*)_data;
+
++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
++ if (setjmp(png_jmpbuf((data->png_ptr))))
++#else
+ if (setjmp(data->png_ptr->jmpbuf))
++#endif
+ assert(0);
+
+ png_write_end(data->png_ptr, data->info_ptr);
diff --git a/community-staging/openttd/PKGBUILD b/community-staging/openttd/PKGBUILD
new file mode 100644
index 000000000..ee2ec74e6
--- /dev/null
+++ b/community-staging/openttd/PKGBUILD
@@ -0,0 +1,38 @@
+# $Id: PKGBUILD 62632 2012-01-22 22:37:56Z lcarlier $
+# Maintainer: Vesa Kaihlavirta <vegai@iki.fi>
+
+pkgname=openttd
+pkgver=1.1.5
+pkgrel=1
+pkgdesc='An engine for running Transport Tycoon Deluxe.'
+arch=('i686' 'x86_64')
+url='http://www.openttd.org'
+license=('GPL')
+depends=('libpng' 'sdl' 'icu' 'fontconfig' 'lzo2' 'hicolor-icon-theme' 'desktop-file-utils')
+install=openttd.install
+optdepends=('openttd-opengfx: free graphics'
+ 'openttd-opensfx: free soundset')
+source=("http://binaries.openttd.org/releases/${pkgver}/${pkgname}-${pkgver}-source.tar.xz")
+md5sums=('aea731c9f87c53955269446d580ee19e')
+
+build() {
+ cd ${pkgname}-${pkgver}
+
+ ./configure \
+ --prefix-dir=/usr \
+ --binary-name=${pkgname} \
+ --binary-dir=bin \
+ --data-dir=share/${pkgname} \
+ --install-dir=${pkgdir} \
+ --doc-dir=share/doc/${pkgname} \
+ --menu-name="OpenTTD" \
+ --personal-dir=.${pkgname}
+
+ make
+}
+
+package() {
+ cd ${pkgname}-${pkgver}
+
+ make install
+}
diff --git a/community-staging/openttd/openttd.install b/community-staging/openttd/openttd.install
new file mode 100644
index 000000000..85b22a1c5
--- /dev/null
+++ b/community-staging/openttd/openttd.install
@@ -0,0 +1,17 @@
+post_install() {
+ gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor > /dev/null 2>&1
+ update-desktop-database > /dev/null 2>&1
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+pre_remove() {
+ update-desktop-database > /dev/null 2>&1
+}
+
+post_remove() {
+ gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor > /dev/null 2>&1
+ update-desktop-database > /dev/null 2>&1
+}
diff --git a/community-staging/warzone2100/PKGBUILD b/community-staging/warzone2100/PKGBUILD
new file mode 100644
index 000000000..0fe2c8341
--- /dev/null
+++ b/community-staging/warzone2100/PKGBUILD
@@ -0,0 +1,29 @@
+# $Id: PKGBUILD 62625 2012-01-22 20:35:31Z lcarlier $
+# Maintainer: Vesa Kaihlavirta <vegai@iki.fi>
+# Contributor: Angelo Theodorou <encelo@users.sourceforge.net>
+
+pkgname=warzone2100
+pkgver=2.3.9
+pkgrel=2
+pkgdesc="3D realtime strategy game on a future Earth"
+url="http://wz2100.net/"
+arch=('i686' 'x86_64')
+license=('GPL')
+depends=('sdl_net' 'libgl' 'openal' 'libjpeg' 'libpng' 'libvorbis' 'libtheora' 'libmad' 'mesa' 'physfs' 'quesoglc' 'popt' 'ttf-dejavu')
+makedepends=('gawk' 'bison' 'flex' 'zip' 'unzip')
+source=("http://downloads.sourceforge.net/project/warzone2100/releases/${pkgver}/${pkgname}-${pkgver}.tar.gz")
+md5sums=('7185090a089c9c0e0eca7535a8f25dca')
+
+build() {
+ cd ${pkgname}-${pkgver}
+
+ ./configure --prefix=/usr --with-distributor="Arch linux"
+
+ make
+}
+
+package() {
+ cd ${pkgname}-${pkgver}
+
+ make DESTDIR=${pkgdir} install
+}
diff --git a/community/chromaprint/PKGBUILD b/community/chromaprint/PKGBUILD
new file mode 100644
index 000000000..ea7e1ef90
--- /dev/null
+++ b/community/chromaprint/PKGBUILD
@@ -0,0 +1,26 @@
+# $Id: PKGBUILD 62590 2012-01-22 09:25:04Z bisson $
+# Contributor: Wieland Hoffmann <the_mineo@web.de>
+# Maintainer: Gaetan Bisson <bisson@archlinux.org>
+
+pkgname=chromaprint
+pkgver=0.6
+pkgrel=2
+pkgdesc='Library that implements a custom algorithm for extracting fingerprints from any audio source'
+url='http://acoustid.org/chromaprint/'
+arch=('i686' 'x86_64')
+license=('LGPL')
+depends=('ffmpeg')
+makedepends=('cmake')
+source=("https://github.com/downloads/lalinsky/${pkgname}/${pkgname}-${pkgver}.tar.gz")
+sha1sums=('e8bcc1d0d8dfec86aa648b87ba3f69b6d589eae0')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_EXAMPLES=ON .
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+}
diff --git a/community/duplicity/PKGBUILD b/community/duplicity/PKGBUILD
index adcaa6edb..955bd64db 100644
--- a/community/duplicity/PKGBUILD
+++ b/community/duplicity/PKGBUILD
@@ -1,19 +1,21 @@
-# $Id: PKGBUILD 60285 2011-12-08 22:52:59Z lfleischer $
+# $Id: PKGBUILD 62636 2012-01-23 00:53:34Z lfleischer $
# Maintainer: Kaiting Chen <kaitocracy@gmail.com>
# Contributor: Aaron Schaefer <aaron@elasticdog.com>
pkgname=duplicity
pkgver=0.6.17
-pkgrel=3
+pkgrel=4
pkgdesc='A utility for encrypted, bandwidth-efficient backups using the rsync algorithm'
arch=('i686' 'x86_64')
url='http://www.nongnu.org/duplicity/'
license=('GPL')
depends=('librsync' 'ncftp' 'python2' 'python-boto' 'python-gnupginterface')
source=("http://savannah.nongnu.org/download/$pkgname/$pkgname-$pkgver.tar.gz"
- 'botobackend.patch')
+ 'botobackend.patch'
+ 'duplicity-0.6.17-fix-memleak.patch')
md5sums=('36423ab4e3b9aa90c5c44d9fa93fba0f'
- '49bbdc327230fe5985d18eaae37eec0c')
+ '49bbdc327230fe5985d18eaae37eec0c'
+ 'b77e98d006842414fdda9662c8081d3b')
build() {
cd "${srcdir}/${pkgname}-${pkgver}"
@@ -27,6 +29,9 @@ build() {
# add hotfix issued by upstream (FS#27390)
patch -p0 -i ../botobackend.patch
+ # fix a memory leak (upstream bug #908228)
+ patch -p0 -i ../duplicity-0.6.17-fix-memleak.patch
+
python2 setup.py install --root="$pkgdir" --optimize=1
# fix broken documentation permissions until upstream does (FS#27301)
diff --git a/community/duplicity/duplicity-0.6.17-fix-memleak.patch b/community/duplicity/duplicity-0.6.17-fix-memleak.patch
new file mode 100644
index 000000000..1c4c8daff
--- /dev/null
+++ b/community/duplicity/duplicity-0.6.17-fix-memleak.patch
@@ -0,0 +1,29 @@
+=== modified file 'duplicity/util.py'
+--- duplicity/util.py 2011-08-23 18:14:17 +0000
++++ duplicity/util.py 2012-01-20 21:50:01 +0000
+@@ -71,6 +71,10 @@
+ else:
+ raise
+
++class BlackHoleList(list):
++ def append(self, x):
++ pass
++
+ class FakeTarFile:
+ debug = 0
+ def __iter__(self):
+@@ -83,7 +87,12 @@
+ # yet. So we want to ignore ReadError exceptions, which are used to signal
+ # this.
+ try:
+- return tarfile.TarFile("arbitrary", mode, fp)
++ tf = tarfile.TarFile("arbitrary", mode, fp)
++ # Now we cause TarFile to not cache TarInfo objects. It would end up
++ # consuming a lot of memory over the lifetime of our long-lasting
++ # signature files otherwise.
++ tf.members = BlackHoleList()
++ return tf
+ except tarfile.ReadError:
+ return FakeTarFile()
+
+
diff --git a/community/libfaketime/PKGBUILD b/community/libfaketime/PKGBUILD
index a95ab380d..447f4b364 100644
--- a/community/libfaketime/PKGBUILD
+++ b/community/libfaketime/PKGBUILD
@@ -1,20 +1,28 @@
-# $Id: PKGBUILD 47438 2011-05-23 06:26:34Z lfleischer $
+# $Id: PKGBUILD 62627 2012-01-22 21:34:26Z lfleischer $
# Maintainer: Lukas Fleischer <archlinux at cryptocrack dot de>
# Contributor: Dan Serban
# Contributor: Ross Melin <rdmelin@gmail.com>
pkgname=libfaketime
-pkgver=0.8.1
+pkgver=0.9.1
pkgrel=1
pkgdesc='Report fake dates and times to programs without having to change the system-wide time.'
arch=('i686' 'x86_64')
url='http://www.code-wizards.com/projects/libfaketime/'
license=('GPL2')
-source=("http://www.code-wizards.com/projects/${pkgname}/${pkgname}-${pkgver}.tar.gz")
-md5sums=('113d75d73e39f0f5022dc7385628d57c')
+source=("http://www.code-wizards.com/projects/${pkgname}/${pkgname}-${pkgver}.tar.gz"
+ 'libfaketime-0.9.1-fix-as-needed.patch'
+ 'libfaketime-0.9.1-fix-README-NEWS.patch')
+md5sums=('ce3f996dfd5826b4ac62f1a7cc36ea27'
+ '90873e4df35283463ef54b159c318686'
+ 'b1b641a8e2298aa1646982e3bde96117')
build() {
cd "${pkgname}-${pkgver}"
+
+ patch -p1 -i ../libfaketime-0.9.1-fix-as-needed.patch
+ patch -p1 -i ../libfaketime-0.9.1-fix-README-NEWS.patch
+
make
}
diff --git a/community/libfaketime/libfaketime-0.9.1-fix-README-NEWS.patch b/community/libfaketime/libfaketime-0.9.1-fix-README-NEWS.patch
new file mode 100644
index 000000000..3d47c5404
--- /dev/null
+++ b/community/libfaketime/libfaketime-0.9.1-fix-README-NEWS.patch
@@ -0,0 +1,29 @@
+From c0c19a71c5481f3082afee2ac7962bd7abfcf134 Mon Sep 17 00:00:00 2001
+From: Lukas Fleischer <info@cryptocrack.de>
+Date: Sun, 22 Jan 2012 22:19:50 +0100
+Subject: [PATCH] Makefile: Fix installation of "README" and "NEWS"
+
+Initialize "INSTALL" in the top-level Makefile in order to avoid broken
+install(1) invocations such as:
+
+ dm0755 "/build/pkg/usr/share/doc/faketime/"
+ /bin/sh: dm0755: command not found
+
+Signed-off-by: Lukas Fleischer <info@cryptocrack.de>
+---
+ Makefile | 2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index f90e18e..d0225ba 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,3 +1,5 @@
++INSTALL = install
++
+ all:
+ $(MAKE) -C src all
+ $(MAKE) -C test all
+--
+1.7.8.4
+
diff --git a/community/libfaketime/libfaketime-0.9.1-fix-as-needed.patch b/community/libfaketime/libfaketime-0.9.1-fix-as-needed.patch
new file mode 100644
index 000000000..870349145
--- /dev/null
+++ b/community/libfaketime/libfaketime-0.9.1-fix-as-needed.patch
@@ -0,0 +1,39 @@
+From f0ee2ee1e0a2fa5f11614a55ab8543380faa9695 Mon Sep 17 00:00:00 2001
+From: Lukas Fleischer <info@cryptocrack.de>
+Date: Sun, 22 Jan 2012 21:47:52 +0100
+Subject: [PATCH] Fix linking with "-Wl,--as-needed"
+
+Reorder linker flags in order to ensure proper linking when using
+"--Wl,--as-needed". Read http://www.gentoo.org/proj/en/qa/asneeded.xml,
+especially "Importance of linking order" for details:
+
+ Basically, what the linker does is look for the symbols missing in a
+ given file (either an object file, a static archive or a library)
+ only in the files coming after it. When using the normal linking,
+ without --as-needed, this is not a problem, although there might be
+ some internal drawbacks on the linking stage, the files are linked
+ together without considering ordering. But with the flag, the
+ libraries that aren't used for resolving symbols are discarded and
+ thus not linked.
+
+Signed-off-by: Lukas Fleischer <info@cryptocrack.de>
+---
+ src/Makefile | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/Makefile b/src/Makefile
+index 9118815..d4a04b5 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -69,7 +69,7 @@ ${OBJ}: faketime.c
+ ${CC} -o $@ -c ${CFLAGS} ${EXTRA_FLAGS} $<
+
+ lib%.so.${SONAME}: %.o
+- ${CC} -o $@ -Wl,-soname,$@ ${LDFLAGS} $<
++ ${CC} -o $@ -Wl,-soname,$@ $< ${LDFLAGS}
+
+ clean:
+ @rm -f ${OBJ} ${LIBS}
+--
+1.7.8.4
+
diff --git a/community/libvisual-projectm/PKGBUILD b/community/libvisual-projectm/PKGBUILD
index ea201188d..76635d757 100644
--- a/community/libvisual-projectm/PKGBUILD
+++ b/community/libvisual-projectm/PKGBUILD
@@ -1,26 +1,36 @@
-# $Id: PKGBUILD 61634 2009-12-20 18:27:47Z andrea $
+# $Id: PKGBUILD 62640 2012-01-23 02:32:15Z lfleischer $
+# Maintainer: Lukas Fleischer <archlinux at cryptocrack dot de>
# Contributor: Alexander Baldeck <alexander@archlinux.org>
pkgname=libvisual-projectm
pkgver=2.0.1
-pkgrel=1
-pkgdesc="ProjectM XMMS plugin"
+pkgrel=3
+pkgdesc='ProjectM XMMS plugin.'
arch=('i686' 'x86_64')
-url="http://projectm.sourceforge.net/"
+url='http://projectm.sourceforge.net/'
license=('GPL')
depends=('projectm>=2.0.1' 'libvisual' 'sdl')
makedepends=('pkgconfig' 'cmake' 'libxext')
options=('!libtool')
-source=(http://downloads.sourceforge.net/projectm/projectM_libvisual-${pkgver}-Source.tar.gz)
-md5sums=('35e09b09210d48b437e3574bd00b15a8')
+source=("http://downloads.sourceforge.net/projectm/projectM_libvisual-${pkgver}-Source.tar.gz"
+ 'libvisual-projectm-gcc-4.6.patch')
+md5sums=('35e09b09210d48b437e3574bd00b15a8'
+ 'a1fa2fd4fc85b1f27e32d400e17a3196')
build() {
- cd ${srcdir}
- mkdir build
- cd build
- cmake ../projectM_libvisual-${pkgver}-Source \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DCMAKE_BUILD_TYPE=Release || return 1
- make || return
- make DESTDIR=${pkgdir} install || return
+ cd "${srcdir}"
+
+ # fix build failure with GCC 4.6 (taken from SVN, revision 1355)
+ (cd "projectM_libvisual-${pkgver}-Source" && patch -p3 -i ../libvisual-projectm-gcc-4.6.patch)
+
+ mkdir build && cd build
+
+ cmake "../projectM_libvisual-${pkgver}-Source" \
+ -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
+ make
+}
+
+package() {
+ cd "${srcdir}/build"
+ make DESTDIR="${pkgdir}" install
}
diff --git a/community/libvisual-projectm/libvisual-projectm-gcc-4.6.patch b/community/libvisual-projectm/libvisual-projectm-gcc-4.6.patch
new file mode 100644
index 000000000..0e1234f83
--- /dev/null
+++ b/community/libvisual-projectm/libvisual-projectm-gcc-4.6.patch
@@ -0,0 +1,11 @@
+--- trunk/src/projectM-libvisual/actor_projectM.cpp 2009/02/20 19:07:44 1210
++++ trunk/src/projectM-libvisual/actor_projectM.cpp 2011/05/06 12:04:58 1355
+@@ -209,7 +209,7 @@
+ * we aren't with projectm, so just ignore :) */
+ extern "C" VisPalette *lv_projectm_palette (VisPluginData *plugin)
+ {
+- return NULL;
++ return (VisPalette *) NULL;
+ }
+
+ /* This is where the real rendering happens! This function is what we call, many times
diff --git a/community/picard/PKGBUILD b/community/picard/PKGBUILD
index 9937c04db..a93739555 100644
--- a/community/picard/PKGBUILD
+++ b/community/picard/PKGBUILD
@@ -1,17 +1,18 @@
-# $Id: PKGBUILD 58419 2011-11-12 17:18:36Z ibiru $
+# $Id: PKGBUILD 62594 2012-01-22 09:34:17Z bisson $
# Maintainer: Gaetan Bisson <bisson@archlinux.org>
# Maintainer: Mateusz Herych <heniekk@gmail.com>
# Contributor: sysrq
pkgname=picard
pkgver=0.16
-pkgrel=3
+pkgrel=4
pkgdesc='Official MusicBrainz tagger'
url='http://musicbrainz.org/doc/MusicBrainz_Picard'
license=('GPL')
arch=('i686' 'x86_64')
depends=('python2-pyqt' 'mutagen' 'libofa' 'ffmpeg')
-optdepends=('libdiscid: CD-Lookup feature')
+optdepends=('libdiscid: CD lookup'
+ 'chromaprint: fingerprinting')
source=("http://ftp.musicbrainz.org/pub/musicbrainz/${pkgname}/${pkgname}-${pkgver}.tar.gz")
sha1sums=('274071410550ee29051bb0137d72602921a015f9')
diff --git a/core/mdadm/PKGBUILD b/core/mdadm/PKGBUILD
index 790e9f4d0..5c7819708 100644
--- a/core/mdadm/PKGBUILD
+++ b/core/mdadm/PKGBUILD
@@ -1,13 +1,13 @@
-# $Id: PKGBUILD 138138 2011-09-17 10:36:09Z tpowa $
+# $Id: PKGBUILD 147125 2012-01-22 11:01:03Z tpowa $
# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: Judd Vinet <jvinet@zeroflux.org>
pkgname=mdadm
-pkgver=3.2.2
-pkgrel=4
+pkgver=3.2.3
+pkgrel=1
pkgdesc="A tool for managing/monitoring Linux md device arrays, also known as Software RAID"
arch=(i686 x86_64)
license=('GPL')
-url="http://www.cse.unsw.edu.au/~neilb/source/mdadm/"
+url="http://neil.brown.name/blog/mdadm"
groups=('base')
conflicts=('mkinitcpio<0.7')
depends=('glibc')
@@ -18,23 +18,21 @@ source=(ftp://ftp.kernel.org/pub/linux/utils/raid/mdadm/mdadm-$pkgver.tar.bz2
mdadm_install
mdadm_hook
mdadm_udev_install
- disable-werror.patch
- linux-3.0.patch)
+ disable-werror.patch)
+
install=mdadm.install
replaces=('raidtools')
-md5sums=('12ee2fbf3beddb60601fb7a4c4905651'
+md5sums=('d789d6ecb9c1d5ebcc64f0fc52bca92f'
'6df172c8f77b280018cf87eb3d313f29'
'00cbed931db4f15b6ce49e3e7d433966'
'9b01e96b6c3c218fb61628c9281fe688'
'c8c0713f5c7da51822ee6f3911473a1c'
'cd258e1bf430c02a25f40b4329df9f57'
- '4ad87b74a4bc9a34621280abe0e0c3e4'
- 'c499b3edbf2c400c8a1984e18c7ce7fa')
+ '4ad87b74a4bc9a34621280abe0e0c3e4')
build() {
cd $srcdir/$pkgname-$pkgver
patch -Np0 -i ../disable-werror.patch
- patch -Np1 -i ../linux-3.0.patch
make CXFLAGS="$CFLAGS"
# build static mdassemble for Arch's initramfs
make MDASSEMBLE_AUTO=1 mdassemble
diff --git a/core/udev/PKGBUILD b/core/udev/PKGBUILD
index be706f13f..47ef4f793 100644
--- a/core/udev/PKGBUILD
+++ b/core/udev/PKGBUILD
@@ -1,4 +1,4 @@
-# $Id: PKGBUILD 147038 2012-01-21 00:32:06Z dreisner $
+# $Id: PKGBUILD 147123 2012-01-22 11:00:58Z tpowa $
# Maintainer: Tom Gundersen <teg@jklm.no>
# Contributor: Aaron Griffin <aaron@archlinux.org>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>
@@ -6,23 +6,20 @@
pkgbase="udev"
pkgname=('udev' 'udev-compat')
-pkgver=177
-pkgrel=3
+pkgver=178
+pkgrel=1
arch=(i686 x86_64)
url="http://git.kernel.org/?p=linux/hotplug/udev.git;a=summary"
license=('GPL')
groups=('base')
options=(!makeflags !libtool)
makedepends=('gobject-introspection' 'gperf' 'libxslt' 'usbutils' 'kmod')
-source=(ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/$pkgbase-$pkgver.tar.xz
- 0001-udevd-kill-hanging-event-processes-after-30-seconds.patch)
+source=(ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/$pkgbase-$pkgver.tar.xz)
+md5sums=('173cc6061e3a82dd6e9a1a5cf767a858')
build() {
cd $srcdir/$pkgbase-$pkgver
- # deal with broken drivers waiting for firmware to be loaded
- patch -p1 -i ../0001-udevd-kill-hanging-event-processes-after-30-seconds.patch
-
./configure --prefix=/usr \
--with-rootprefix= \
--sysconfdir=/etc \
@@ -103,5 +100,4 @@ package_udev-compat() {
mknod cpu/microcode c 10 184
}
-md5sums=('b4e00faf8153fd7202a7ef609284b0c3'
- '3e40dca1c4f8194b4633e3befb4da4d4')
+md5sums=('173cc6061e3a82dd6e9a1a5cf767a858')
diff --git a/cross/cross-mips64el-unknown-linux-gnu-gcc-core-shared/PKGBUILD b/cross/cross-mips64el-unknown-linux-gnu-gcc-core-shared/PKGBUILD
index 3c61dbfca..ca0ca775e 100644
--- a/cross/cross-mips64el-unknown-linux-gnu-gcc-core-shared/PKGBUILD
+++ b/cross/cross-mips64el-unknown-linux-gnu-gcc-core-shared/PKGBUILD
@@ -16,7 +16,7 @@ pkgdesc="The GNU Compiler Collection for the MIPS/Loongson2f architecture (share
url="http://www.gnu.org/software/binutils/"
arch=('i686' 'x86_64')
license=('GPL')
-depends=('libmpc' 'sh' "cross-${_target}-binutils" 'cloog' 'ppl')
+depends=('libmpc' 'sh' "${_target}-binutils" 'cloog' 'ppl')
makedepends=("cross-${_target}-glibc-headers"
"cross-${_target}-gcc-core")
options=('!ccache' '!distcc' '!emptydirs' '!libtool' '!strip')
@@ -28,7 +28,7 @@ build() {
mkdir gcc-build && cd gcc-build
mkdir ${_target}
- Copy headers for libgcc2
+# Copy headers for libgcc2
cp -av /usr/${_target}/usr/include ${_target}/include
CC_FOR_BUILD=${CHOST}-gcc \
diff --git a/cross/cross-mips64el-unknown-linux-gnu-gcc-core/PKGBUILD b/cross/cross-mips64el-unknown-linux-gnu-gcc-core/PKGBUILD
index da49a903f..831236d42 100644
--- a/cross/cross-mips64el-unknown-linux-gnu-gcc-core/PKGBUILD
+++ b/cross/cross-mips64el-unknown-linux-gnu-gcc-core/PKGBUILD
@@ -16,7 +16,7 @@ pkgdesc="The GNU Compiler Collection for the MIPS/Loongson2f architecture (stati
url="http://www.gnu.org/software/binutils/"
arch=('i686' 'x86_64')
license=('GPL')
-depends=('libmpc' 'sh' "cross-${_target}-binutils" 'cloog' 'ppl')
+depends=('libmpc' 'sh' "${_target}-binutils" 'cloog' 'ppl')
options=('!ccache' '!distcc' '!emptydirs' '!libtool' '!strip')
source=("ftp://ftp.gnu.org/gnu/gcc/gcc-${pkgver}/${_pkgname}-${pkgver}.tar.bz2")
md5sums=('028115c4fbfb6cfd75d6369f4a90d87e')
diff --git a/cross/cross-mips64el-unknown-linux-gnu-glibc-headers/PKGBUILD b/cross/cross-mips64el-unknown-linux-gnu-glibc-headers/PKGBUILD
index a83a1238a..7fed7839a 100644
--- a/cross/cross-mips64el-unknown-linux-gnu-glibc-headers/PKGBUILD
+++ b/cross/cross-mips64el-unknown-linux-gnu-glibc-headers/PKGBUILD
@@ -21,7 +21,7 @@ url="http://www.gnu.org/software/libc"
license=('GPL' 'LGPL')
groups=("${_target}-devel")
depends=("${_target}-linux-api-headers>=3.1.6" 'tzdata')
-makedepends=("cross-${_target}-binutils"
+makedepends=("${_target}-binutils"
"cross-${_target}-gcc-core")
options=('!strip')
install=glibc.install
@@ -187,8 +187,12 @@ package() {
# This will help gcc-shared to find headers for libgcc2
msg2 "Symlinking headers"
- rm -r ${pkgdir}${_sysroot}/include
+# rm -r ${pkgdir}${_sysroot}/include
ln -s ${_sysroot}/usr/include ${pkgdir}${_sysroot}/include
+ ln -s ${_sysroot}/usr/lib/crt1.o ${pkgdir}${_sysroot}/lib/
+ ln -s ${_sysroot}/usr/lib/crti.o ${pkgdir}${_sysroot}/lib/
+ ln -s ${_sysroot}/usr/lib/crtn.o ${pkgdir}${_sysroot}/lib/
+ ln -s ${_sysroot}/usr/lib/libc.so ${pkgdir}${_sysroot}/lib/
}
md5sums=('6ffdf5832192b92f98bdd125317c0dfc'
diff --git a/cross/mips64el-unknown-linux-gnu-binutils/PKGBUILD b/cross/mips64el-unknown-linux-gnu-binutils/PKGBUILD
new file mode 100644
index 000000000..0349036ec
--- /dev/null
+++ b/cross/mips64el-unknown-linux-gnu-binutils/PKGBUILD
@@ -0,0 +1,53 @@
+# Contributor: Vojtech Horky <vojta . horky at-symbol seznam . cz>
+
+_pkgname=binutils
+_target="mips64el-unknown-linux-gnu"
+_sysroot="/usr/${_target}"
+
+unset CFLAGS CXXFLAGS LDFLAGS
+
+pkgname=${_target}-binutils
+pkgver=2.22
+pkgrel=1
+pkgdesc="A set of programs to assemble and manipulate binary and object files for the MIPS architecture"
+url="http://www.gnu.org/software/binutils/"
+arch=('i686' 'x86_64')
+license=('GPL')
+depends=('zlib')
+provices=("cross-${pkgname}")
+source=("ftp://ftp.gnu.org/gnu/binutils/${_pkgname}-${pkgver}.tar.bz2")
+md5sums=('ee0f10756c84979622b992a4a61ea3f5')
+
+build() {
+ cd ${srcdir}/${_pkgname}-${pkgver}
+
+ CFLAGS=" -pipe "\
+ CXXFLAGS=" -pipe "\
+ ./configure --build=${CHOST} \
+ --host=${CHOST} \
+ --target=${_target} \
+ --prefix=/usr \
+ --disable-nls \
+ --disable-multilib \
+ --disable-werror \
+ --enable-ld=yes \
+ --enable-gold=no \
+ --with-sysroot=${_sysroot}
+
+ make
+}
+
+package() {
+
+ cd ${srcdir}/${_pkgname}-${pkgver}
+# Compat symlinks
+ ln -s ${_sysroot}/usr/lib ${pkgdir}${_sysroot}/lib
+ ln -s ${_sysroot}/lib ${pkgdir}${_sysroot}/lib32
+
+ make DESTDIR=${pkgdir} install
+
+ rm -r ${pkgdir}/usr/{lib,share}
+
+# Create include dir so gcc-core doesn't complain
+ mkdir -p ${pkgdir}${_sysroot}/usr/include
+}
diff --git a/cross/mips64el-unknown-linux-gnu-gcc/PKGBUILD b/cross/mips64el-unknown-linux-gnu-gcc/PKGBUILD
new file mode 100644
index 000000000..975db9f9d
--- /dev/null
+++ b/cross/mips64el-unknown-linux-gnu-gcc/PKGBUILD
@@ -0,0 +1,292 @@
+# $Id: PKGBUILD 145914 2012-01-04 01:24:56Z allan $
+# Maintainer: Allan McRae <allan@archlinux.org>
+
+# toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc
+# NOTE: libtool requires rebuilt with each new gcc version
+_pkgname=gcc
+_target="mips64el-unknown-linux-gnu"
+_sysroot="/usr/${_target}"
+_ARCH=mips
+
+unset LDFLAGS CFLAGS CXXFLAGS
+
+# Split package names must be changed manually
+pkgname=("${_target}-gcc" "${_target}-gcc-libs" "${_target}-gcc-fortran" "${_target}-gcc-objc") # "gcc-ada" "gcc-go")
+pkgver=4.6.2
+pkgrel=5
+_snapshot=4.6-20111223
+_libstdcppmanver=20111215 # Note: check source directory name when updating this
+pkgdesc="The GNU Compiler Collection for MIPS/Loongson2f processors"
+arch=('i686' 'x86_64')
+license=('GPL' 'LGPL' 'FDL' 'custom')
+url="http://gcc.gnu.org"
+makedepends=("${_target}-binutils>=2.22" "libmpc" "cloog" "ppl"
+ "cross-${_target}-gcc-core-shared"
+ "${_target}-glibc")
+checkdepends=('dejagnu')
+options=('!libtool' '!emptydirs' '!strip')
+source=(#ftp://gcc.gnu.org/pub/gcc/releases/gcc-${pkgver}/gcc-${pkgver}.tar.bz2
+ ftp://gcc.gnu.org/pub/gcc/snapshots/${_snapshot}/gcc-${_snapshot}.tar.bz2
+ ftp://gcc.gnu.org/pub/gcc/libstdc++/doxygen/libstdc++-man.${_libstdcppmanver}.tar.bz2
+ gcc_pure64.patch
+ gcc_mips64el_lib.patch
+ gcc-hash-style-both.patch)
+
+if [ -n "${_snapshot}" ]; then
+ _basedir="${srcdir}/gcc-${_snapshot}"
+else
+ _basedir="${srcdir}/gcc-${pkgver}"
+fi
+
+build() {
+ if [ ${NOEXTRACT} -eq 0 ]; then
+ cd ${_basedir}
+
+ # Do not install libiberty
+ sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
+
+ # Do not run fixincludes
+ sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
+
+ if [ "${CARCH}" = "x86_64" ]; then
+ patch -Np1 -i ${srcdir}/gcc_pure64.patch
+ fi
+ patch -Np0 -i ${srcdir}/gcc-hash-style-both.patch
+ patch -Np0 -i ${srcdir}/gcc_mips64el_lib.patch
+
+ echo ${pkgver} > gcc/BASE-VER
+
+ mkdir ${srcdir}/gcc-build
+ fi
+
+ cd ${srcdir}/gcc-build
+
+ CC_FOR_BUILD=${CHOST}-gcc \
+ CFLAGS=" -pipe " \
+ LDFLAGS= \
+ CFLAGS_FOR_TARGET=" -EL -march=loongson2f -mabi=n32 " \
+ CXXFLAGS_FOR_TARGET=" -EL -march=loongson2f -mabi=n32 " \
+ LDFLAGS_FOR_TARGET=" -EL " \
+ ${_basedir}/configure --prefix=/usr \
+ --build=${CHOST} \
+ --host=${CHOST} \
+ --target=${_target} \
+ --libexecdir=/usr/lib \
+ --with-sysroot=${_sysroot} \
+ --with-arch=loongson2f \
+ --with-abi=n32 \
+ --with-bugurl=https://bugs.parabolagnulinux.org/ \
+ --enable-languages=c,c++,fortran,lto,objc,obj-c++ \
+ --enable-shared \
+ --enable-threads=posix \
+ --with-system-zlib \
+ --enable-__cxa_atexit \
+ --disable-libunwind-exceptions \
+ --enable-clocale=gnu \
+ --enable-gnu-unique-object \
+ --enable-linker-build-id \
+ --with-ppl \
+ --enable-cloog-backend=isl \
+ --enable-lto \
+ --enable-gold \
+ --enable-ld=default \
+ --enable-plugin \
+ --with-plugin-ld=ld.gold \
+ --disable-multilib \
+ --disable-libssp \
+ --disable-libstdcxx-pch \
+ --enable-checking=release
+
+ make
+}
+
+check() {
+ cd gcc-build
+
+ # increase stack size to prevent test failures
+ # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31827
+ ulimit -s 32768
+
+ # do not abort on error as some are "expected"
+ make -k check || true
+ ${_basedir}/contrib/test_summary
+}
+
+
+package_mips64el-unknown-linux-gnu-gcc-libs()
+{
+ pkgdesc="Runtime libraries shipped by GCC"
+ groups=("${_target}-devel")
+ depends=("${_target}-glibc>=2.14")
+ install=gcc-libs.install
+
+ cd gcc-build
+ make -j1 -C ${_target}/libgcc DESTDIR=${pkgdir} install-shared
+ for lib in libmudflap libgomp libstdc++-v3/src; do
+ make -j1 -C $_target/$lib DESTDIR=${pkgdir} install-toolexeclibLTLIBRARIES
+ done
+ make -j1 -C $_target/libstdc++-v3/po DESTDIR=${pkgdir} install
+ make -j1 -C $_target/libgomp DESTDIR=${pkgdir} install-info
+
+ make -j1 DESTDIR=${pkgdir} install-target-libquadmath
+ make -j1 DESTDIR=${pkgdir} install-target-libgfortran
+ make -j1 DESTDIR=${pkgdir} install-target-libobjc
+
+ # remove unnecessary files installed by install-target-{libquadmath,libgfortran,libobjc}
+ rm -rf ${pkgdir}${_sysroot}/usr/lib{,32}/{gcc/,libgfortran.spec}
+
+ rm -rf ${pkgdir}/usr/share
+
+ # remove static libraries
+ find ${pkgdir} -name *.a -delete
+
+ # Install Runtime Library Exception
+ install -Dm644 ${_basedir}/COPYING.RUNTIME \
+ ${pkgdir}/usr/share/licenses/${_target}-gcc-libs/RUNTIME.LIBRARY.EXCEPTION
+}
+
+package_mips64el-unknown-linux-gnu-gcc()
+{
+ pkgdesc="The GNU Compiler Collection - C and C++ frontends"
+ depends=("${_target}-gcc-libs=$pkgver-$pkgrel" "${_target}-binutils>=2.22" 'libmpc' 'cloog' 'ppl')
+ groups=("${_target}-devel")
+ replaces=("cross-${_target}-gcc-core"
+ "cross-${_target}-gcc-core-shared")
+ install=gcc.install
+
+ cd gcc-build
+
+ # unfortunately it is much, much easier to install the lot and clean-up the mess...
+ make -j1 DESTDIR=${pkgdir} install
+
+ rm -rf ${pkgdir}/usr/share
+
+ rm -f $pkgdir/usr/bin/{{$_target-,}gfortran,{$_target-,}gccgo,gnat*}
+ rm -f $pkgdir${_sysroot}/lib{,32}/*.so*
+ rm -f $pkgdir${_sysroot}/lib{,32}/lib{ffi,gfortran,go{,begin},objc,quadmath}.a
+ rm -f $pkgdir${_sysroot}/lib{,32}/libgfortran.spec
+ rm -rf $pkgdir/usr/lib{,32}/gcc/$_target/${pkgver}/{ada{include,lib},finclude,include/objc}
+ rm -f $pkgdir/usr/lib{,32}/gcc/$_target/${pkgver}/include/{ffi{,target}.h,quadmath{,_weak}.h}
+ rm -f $pkgdir/usr/lib{,32}/gcc/$_target/${pkgver}/{cc1obj{,plus},f951,gnat1,go1,libgfortranbegin.a}
+ rm -rf $pkgdir/usr/lib{,32}/go
+
+ # many packages require these symlinks
+ install -dm755 ${pkgdir}/lib
+
+ ln -sf /usr/bin/cpp ${pkgdir}/lib/${_target}-cpp
+ ln -sf ${_target}-gcc ${pkgdir}/usr/bin/${_target}-cc
+ ln -sf ${_target}-g++ ${pkgdir}/usr/bin/${_target}-c++
+
+ # install gengtype for plugin support
+ install -m755 gcc/build/gengtype $pkgdir/usr/lib/gcc/$_target/${pkgver}/
+ install -m644 gcc/gtype.state $pkgdir/usr/lib/gcc/$_target/${pkgver}/
+
+ # POSIX conformance launcher scripts for c89 and c99
+ cat > $pkgdir/usr/bin/${_target}-c89 <<"EOF"
+#!/bin/sh
+fl="-std=c89"
+for opt; do
+ case "$opt" in
+ -ansi|-std=c89|-std=iso9899:1990) fl="";;
+ -std=*) echo "`basename $0` called with non ANSI/ISO C option $opt" >&2
+ exit 1;;
+ esac
+done
+exec mips64el-unknown-linux-gnu-gcc $fl ${1+"$@"}
+EOF
+
+ cat > $pkgdir/usr/bin/${_target}-c99 <<"EOF"
+#!/bin/sh
+fl="-std=c99"
+for opt; do
+ case "$opt" in
+ -std=c99|-std=iso9899:1999) fl="";;
+ -std=*) echo "`basename $0` called with non ISO C99 option $opt" >&2
+ exit 1;;
+ esac
+done
+exec mips64el-unknown-linux-gnu-gcc $fl ${1+"$@"}
+EOF
+
+ chmod 755 $pkgdir/usr/bin/${_target}-c{8,9}9
+
+ # Install Runtime Library Exception
+ install -Dm644 ${_basedir}/COPYING.RUNTIME \
+ ${pkgdir}/usr/share/licenses/${_target}-gcc/RUNTIME.LIBRARY.EXCEPTION
+}
+
+package_mips64el-unknown-linux-gnu-gcc-fortran()
+{
+ pkgdesc="Fortran front-end for GCC"
+ depends=("${_target}-gcc=$pkgver-$pkgrel")
+ install=gcc-fortran.install
+
+ cd gcc-build
+ make -j1 DESTDIR=${pkgdir} install-target-libquadmath
+ make -j1 DESTDIR=$pkgdir install-target-libgfortran
+ make -j1 -C $_target/libgomp DESTDIR=$pkgdir install-nodist_fincludeHEADERS
+ make -j1 -C gcc DESTDIR=$pkgdir fortran.install-{common,man,info}
+ install -Dm755 gcc/f951 $pkgdir/usr/lib/gcc/$_target/$pkgver/f951
+
+ # remove libraries included in gcc-libs
+ rm -f ${pkgdir}${_sysroot}/lib{,32}/lib{gfortran,quadmath}.so*
+ rm -fr ${pkgdir}/usr/share
+
+ # Install Runtime Library Exception
+ install -Dm644 ${_basedir}/COPYING.RUNTIME \
+ ${pkgdir}/usr/share/licenses/${_target}-gcc-fortran/RUNTIME.LIBRARY.EXCEPTION
+}
+
+package_mips64el-unknown-linux-gnu-gcc-objc()
+{
+ pkgdesc="Objective-C front-end for GCC"
+ depends=("${_target}-gcc=$pkgver-$pkgrel")
+
+ cd gcc-build
+ make -j1 DESTDIR=$pkgdir install-target-libobjc
+ install -dm755 $pkgdir/usr/lib/gcc/$_target/$pkgver/
+ install -m755 gcc/cc1obj{,plus} $pkgdir/usr/lib/gcc/$_target/$pkgver/
+
+ # remove libraries included in gcc-libs
+ rm -f ${pkgdir}${_sysroot}/lib{,32}/libobjc.so*
+
+ # Install Runtime Library Exception
+ install -Dm644 ${_basedir}/COPYING.RUNTIME \
+ ${pkgdir}/usr/share/licenses/${_target}-gcc-objc/RUNTIME.LIBRARY.EXCEPTION
+}
+
+package_gcc-ada()
+{
+ pkgdesc="Ada front-end for GCC (GNAT)"
+ depends=("${_target}-gcc=$pkgver-$pkgrel")
+ install=gcc-ada.install
+
+ cd gcc-build/gcc
+ make -j1 DESTDIR=$pkgdir ada.install-{common,info}
+ install -m755 gnat1 $pkgdir/usr/lib/gcc/$_target/$pkgver
+
+ # Install Runtime Library Exception
+ install -Dm644 ${_basedir}/COPYING.RUNTIME \
+ ${pkgdir}/usr/share/licenses/gcc-ada/RUNTIME.LIBRARY.EXCEPTION
+}
+
+package_gcc-go()
+{
+ pkgdesc="Go front-end for GCC"
+ depends=("${_target}-gcc=$pkgver-$pkgrel")
+ install=gcc-go.install
+
+ cd gcc-build
+ make -j1 DESTDIR=$pkgdir install-target-libgo
+ make -j1 -C gcc DESTDIR=$pkgdir go.install-{common,man,info}
+ install -Dm755 gcc/go1 $pkgdir/usr/lib/gcc/$_target/$pkgver/go1
+
+ # Install Runtime Library Exception
+ install -Dm644 ${_basedir}/COPYING.RUNTIME \
+ ${pkgdir}/usr/share/licenses/gcc-go/RUNTIME.LIBRARY.EXCEPTION
+}
+md5sums=('4755b9f6ac0abecbaa2097ed9738406a'
+ '450772ce32daed97d7383199f8797f33'
+ '4030ee1c08dd1e843c0225b772360e76'
+ '67e337993d821d72fccacbed52d48c34'
+ '4df25b623799b148a0703eaeec8fdf3f')
diff --git a/cross/mips64el-unknown-linux-gnu-gcc/gcc-ada.install b/cross/mips64el-unknown-linux-gnu-gcc/gcc-ada.install
new file mode 100644
index 000000000..df0553a4f
--- /dev/null
+++ b/cross/mips64el-unknown-linux-gnu-gcc/gcc-ada.install
@@ -0,0 +1,20 @@
+infodir=usr/share/info
+filelist=(gnat-style.info gnat_rm.info gnat_ugn.info)
+
+post_install() {
+ [ -x usr/bin/install-info ] || return 0
+ for file in ${filelist[@]}; do
+ install-info $infodir/$file.gz $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.gz $infodir/dir 2> /dev/null
+ done
+}
diff --git a/cross/mips64el-unknown-linux-gnu-gcc/gcc-fortran.install b/cross/mips64el-unknown-linux-gnu-gcc/gcc-fortran.install
new file mode 100644
index 000000000..b15d89a97
--- /dev/null
+++ b/cross/mips64el-unknown-linux-gnu-gcc/gcc-fortran.install
@@ -0,0 +1,16 @@
+infodir=usr/share/info
+file="gfortran.info"
+
+post_install() {
+ [ -x usr/bin/install-info ] || return 0
+ install-info $infodir/$file.gz $infodir/dir 2> /dev/null
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+pre_remove() {
+ [ -x usr/bin/install-info ] || return 0
+ install-info --delete $infodir/$file.gz $infodir/dir 2> /dev/null
+}
diff --git a/cross/mips64el-unknown-linux-gnu-gcc/gcc-go.install b/cross/mips64el-unknown-linux-gnu-gcc/gcc-go.install
new file mode 100644
index 000000000..7dc50dee5
--- /dev/null
+++ b/cross/mips64el-unknown-linux-gnu-gcc/gcc-go.install
@@ -0,0 +1,20 @@
+infodir=usr/share/info
+filelist=(gccgo.info)
+
+post_install() {
+ [ -x usr/bin/install-info ] || return 0
+ for file in ${filelist[@]}; do
+ install-info $infodir/$file.gz $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.gz $infodir/dir 2> /dev/null
+ done
+}
diff --git a/cross/mips64el-unknown-linux-gnu-gcc/gcc-hash-style-both.patch b/cross/mips64el-unknown-linux-gnu-gcc/gcc-hash-style-both.patch
new file mode 100644
index 000000000..8b59f4535
--- /dev/null
+++ b/cross/mips64el-unknown-linux-gnu-gcc/gcc-hash-style-both.patch
@@ -0,0 +1,122 @@
+--- gcc/config/alpha/linux-elf.h.orig 2010-12-09 23:27:07.000000000 +1000
++++ gcc/config/alpha/linux-elf.h 2011-03-11 10:01:47.770000457 +1000
+@@ -41,7 +41,7 @@
+
+ #define ELF_DYNAMIC_LINKER LINUX_DYNAMIC_LINKER
+
+-#define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \
++#define LINK_SPEC "-m elf64alpha --hash-style=both %{G*} %{relax:-relax} \
+ %{O*:-O3} %{!O*:-O1} \
+ %{shared:-shared} \
+ %{!shared: \
+--- gcc/config/i386/linux64.h.orig 2011-03-03 08:35:36.000000000 +1000
++++ gcc/config/i386/linux64.h 2011-03-11 10:01:47.770000457 +1000
+@@ -78,7 +78,7 @@
+ %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}"
+
+ #undef LINK_SPEC
+-#define LINK_SPEC "%{" SPEC_64 ":-m elf_x86_64} %{" SPEC_32 ":-m elf_i386} \
++#define LINK_SPEC "%{" SPEC_64 ":-m elf_x86_64} %{" SPEC_32 ":-m elf_i386} --hash-style=both \
+ %{shared:-shared} \
+ %{!shared: \
+ %{!static: \
+--- gcc/config/i386/linux.h.orig 2011-01-15 04:45:06.000000000 +1000
++++ gcc/config/i386/linux.h 2011-03-11 10:01:47.770000457 +1000
+@@ -104,7 +104,7 @@
+ { "dynamic_linker", LINUX_DYNAMIC_LINKER }
+
+ #undef LINK_SPEC
+-#define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
++#define LINK_SPEC "-m %(link_emulation) --hash-style=both %{shared:-shared} \
+ %{!shared: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+--- gcc/config/ia64/linux.h.orig 2010-12-09 23:27:07.000000000 +1000
++++ gcc/config/ia64/linux.h 2011-03-11 10:01:47.770000457 +1000
+@@ -64,7 +64,7 @@
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
+
+ #undef LINK_SPEC
+-#define LINK_SPEC "\
++#define LINK_SPEC "--hash-style=both \
+ %{shared:-shared} \
+ %{!shared: \
+ %{!static: \
+--- gcc/config/rs6000/linux64.h.orig 2011-02-11 03:30:10.000000000 +1000
++++ gcc/config/rs6000/linux64.h 2011-03-11 10:03:34.280000457 +1000
+@@ -389,11 +389,11 @@
+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
+
+
+-#define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \
++#define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux --hash-style=both %{!shared: %{!static: \
+ %{rdynamic:-export-dynamic} \
+ -dynamic-linker " LINUX_DYNAMIC_LINKER32 "}}"
+
+-#define LINK_OS_LINUX_SPEC64 "-m elf64ppc %{!shared: %{!static: \
++#define LINK_OS_LINUX_SPEC64 "-m elf64ppc --hash-style=both %{!shared: %{!static: \
+ %{rdynamic:-export-dynamic} \
+ -dynamic-linker " LINUX_DYNAMIC_LINKER64 "}}"
+
+--- gcc/config/rs6000/sysv4.h.orig 2011-01-28 04:36:03.000000000 +1000
++++ gcc/config/rs6000/sysv4.h 2011-03-11 10:01:47.773333792 +1000
+@@ -830,7 +830,7 @@
+ #define LINUX_DYNAMIC_LINKER \
+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
+
+-#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
++#define LINK_OS_LINUX_SPEC "-m elf32ppclinux --hash-style=both %{!shared: %{!static: \
+ %{rdynamic:-export-dynamic} \
+ -dynamic-linker " LINUX_DYNAMIC_LINKER "}}"
+
+--- gcc/config/s390/linux.h.orig 2010-12-09 23:27:07.000000000 +1000
++++ gcc/config/s390/linux.h 2011-03-11 10:01:47.770000457 +1000
+@@ -77,7 +77,7 @@
+
+ #undef LINK_SPEC
+ #define LINK_SPEC \
+- "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
++ "%{m31:-m elf_s390}%{m64:-m elf64_s390} --hash-style=both \
+ %{shared:-shared} \
+ %{!shared: \
+ %{static:-static} \
+--- gcc/config/sparc/linux64.h.orig 2011-02-17 23:57:21.000000000 +1000
++++ gcc/config/sparc/linux64.h 2011-03-11 10:01:47.770000457 +1000
+@@ -113,7 +113,7 @@
+ { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
+ { "link_arch", LINK_ARCH_SPEC },
+
+-#define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,%R/usr/lib %{shared:-shared} \
++#define LINK_ARCH32_SPEC "-m elf32_sparc --hash-style=both -Y P,%R/usr/lib %{shared:-shared} \
+ %{!shared: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+@@ -121,7 +121,7 @@
+ %{static:-static}} \
+ "
+
+-#define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
++#define LINK_ARCH64_SPEC "-m elf64_sparc --hash-style=both -Y P,%R/usr/lib64 %{shared:-shared} \
+ %{!shared: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+@@ -193,7 +193,7 @@
+ #else /* !SPARC_BI_ARCH */
+
+ #undef LINK_SPEC
+-#define LINK_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
++#define LINK_SPEC "-m elf64_sparc --hash-style=both -Y P,%R/usr/lib64 %{shared:-shared} \
+ %{!shared: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+--- gcc/config/sparc/linux.h.orig 2011-01-27 06:30:12.000000000 +1000
++++ gcc/config/sparc/linux.h 2011-03-11 10:01:47.770000457 +1000
+@@ -74,7 +74,7 @@
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+
+ #undef LINK_SPEC
+-#define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
++#define LINK_SPEC "-m elf32_sparc --hash-style=both -Y P,/usr/lib %{shared:-shared} \
+ %{!mno-relax:%{!r:-relax}} \
+ %{!shared: \
+ %{!static: \
diff --git a/cross/mips64el-unknown-linux-gnu-gcc/gcc-libs.install b/cross/mips64el-unknown-linux-gnu-gcc/gcc-libs.install
new file mode 100644
index 000000000..23553b8f0
--- /dev/null
+++ b/cross/mips64el-unknown-linux-gnu-gcc/gcc-libs.install
@@ -0,0 +1,16 @@
+infodir=usr/share/info
+filelist=(libgomp.info libquadmath.info)
+
+post_upgrade() {
+ [ -x usr/bin/install-info ] || return 0
+ for file in ${filelist[@]}; do
+ install-info $infodir/$file.gz $infodir/dir 2> /dev/null
+ done
+}
+
+pre_remove() {
+ [ -x usr/bin/install-info ] || return 0
+ for file in ${filelist[@]}; do
+ install-info --delete $infodir/$file.gz $infodir/dir 2> /dev/null
+ done
+}
diff --git a/cross/mips64el-unknown-linux-gnu-gcc/gcc.install b/cross/mips64el-unknown-linux-gnu-gcc/gcc.install
new file mode 100644
index 000000000..3407a5e1f
--- /dev/null
+++ b/cross/mips64el-unknown-linux-gnu-gcc/gcc.install
@@ -0,0 +1,20 @@
+infodir=usr/share/info
+filelist=(cpp.info cppinternals.info gcc.info gccinstall.info gccint.info)
+
+post_install() {
+ [ -x usr/bin/install-info ] || return 0
+ for file in ${filelist[@]}; do
+ install-info $infodir/$file.gz $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.gz $infodir/dir 2> /dev/null
+ done
+}
diff --git a/cross/mips64el-unknown-linux-gnu-gcc/gcc_mips64el_lib.patch b/cross/mips64el-unknown-linux-gnu-gcc/gcc_mips64el_lib.patch
new file mode 100644
index 000000000..425758e88
--- /dev/null
+++ b/cross/mips64el-unknown-linux-gnu-gcc/gcc_mips64el_lib.patch
@@ -0,0 +1,25 @@
+--- gcc/config/mips/t-linux64.orig 2011-04-09 20:28:51.729723495 -0300
++++ gcc/config/mips/t-linux64 2011-04-09 20:29:06.913724013 -0300
+@@ -18,7 +18,7 @@
+
+ MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
+ MULTILIB_DIRNAMES = n32 32 64
+-MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64
++MULTILIB_OSDIRNAMES = ../lib ../lib32 ../lib64
+
+ EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
+
+--- gcc/config/mips/linux64.h.orig 2011-04-09 20:27:06.909723735 -0300
++++ gcc/config/mips/linux64.h 2011-04-09 20:28:16.033723803 -0300
+@@ -35,9 +35,9 @@
+ %{!shared: \
+ %{profile:-lc_p} %{!profile:-lc}}"
+
+-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
++#define GLIBC_DYNAMIC_LINKER32 "/lib32/ld.so.1"
+ #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld.so.1"
+-#define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
++#define GLIBC_DYNAMIC_LINKERN32 "/lib/ld.so.1"
+ #define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
+ #define LINUX_DYNAMIC_LINKERN32 \
+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32)
diff --git a/cross/mips64el-unknown-linux-gnu-gcc/gcc_pure64.patch b/cross/mips64el-unknown-linux-gnu-gcc/gcc_pure64.patch
new file mode 100644
index 000000000..8c0baf8e2
--- /dev/null
+++ b/cross/mips64el-unknown-linux-gnu-gcc/gcc_pure64.patch
@@ -0,0 +1,26 @@
+diff -Naur gcc-4.2.0.orig/gcc/config/i386/linux64.h gcc-4.2.0/gcc/config/i386/linux64.h
+--- gcc-4.2.0.orig/gcc/config/i386/linux64.h 2007-05-16 19:21:19.000000000 -0400
++++ gcc-4.2.0/gcc/config/i386/linux64.h 2007-05-18 17:04:05.000000000 -0400
+@@ -49,8 +49,8 @@
+ When the -shared link option is used a final link is not being
+ done. */
+
+-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
+-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
++#define GLIBC_DYNAMIC_LINKER32 "/lib32/ld-linux.so.2"
++#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-linux-x86-64.so.2"
+
+ #undef LINK_SPEC
+ #define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \
+diff -Naur gcc-4.2.0.orig/gcc/config/i386/t-linux64 gcc-4.2.0/gcc/config/i386/t-linux64
+--- gcc-4.2.0.orig/gcc/config/i386/t-linux64 2007-05-16 19:21:19.000000000 -0400
++++ gcc-4.2.0/gcc/config/i386/t-linux64 2007-05-18 17:04:36.000000000 -0400
+@@ -6,7 +6,7 @@
+
+ MULTILIB_OPTIONS = m64/m32
+ MULTILIB_DIRNAMES = 64 32
+-MULTILIB_OSDIRNAMES = ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
++MULTILIB_OSDIRNAMES = ../lib ../lib32
+
+ LIBGCC = stmp-multilib
+ INSTALL_LIBGCC = install-multilib
diff --git a/cross/mips64el-unknown-linux-gnu-glibc/PKGBUILD b/cross/mips64el-unknown-linux-gnu-glibc/PKGBUILD
index e5e37beee..18de66776 100644
--- a/cross/mips64el-unknown-linux-gnu-glibc/PKGBUILD
+++ b/cross/mips64el-unknown-linux-gnu-glibc/PKGBUILD
@@ -4,11 +4,21 @@
# toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc
# NOTE: valgrind requires rebuilt with each major glibc version
+# NOTE: I had to run this after installing target-glibc to build target-gcc:
+# for lib in /usr/${_target}/usr/lib/*; do
+# ln -s ${lib} /usr/${_target}/lib/$(basename ${lib}
+# done
+# gcc build should probably add a -B flag to usr/lib instead
+
_pkgname=glibc
_target="mips64el-unknown-linux-gnu"
_sysroot="/usr/${_target}"
_ARCH=mips
+# Disable this after building final gcc
+# Otherwise you'll get ld: missing libc.so errors
+BOOTSTRAPING=true
+
unset CFLAGS CXXFLAGS LDFLAGS
pkgname=${_target}-glibc
@@ -21,7 +31,7 @@ url="http://www.gnu.org/software/libc"
license=('GPL' 'LGPL')
groups=("${_target}-devel")
depends=("${_target}-linux-api-headers>=3.1.6" 'tzdata')
-makedepends=("cross-${_target}-binutils"
+makedepends=("${_target}-binutils"
"cross-${_target}-gcc-core-shared"
"cross-${_target}-glibc-headers")
backup=(etc/gai.conf
@@ -174,7 +184,7 @@ build() {
# --libdir=${_sysroot}/usr/lib \
# --libexecdir=${_sysroot}/usr/lib \
-
+
# build libraries with hardening disabled
echo "build-programs=no" >> configparms
make
@@ -202,6 +212,16 @@ package() {
rm -f ${pkgdir}${_sysroot}/etc/ld.so.{cache,conf}
+# Compat symlinks
+ ln -s ${_sysroot}/usr/lib ${pkgdir}${_sysroot}/lib
+ ln -s ${_sysroot}/lib ${pkgdir}${_sysroot}/lib32
+
+# Fix libc.so to find correct libraries
+ if ${BOOTSTRAPING}; then
+ sed -i "s|/lib|${_sysroot}&|g" ${pkgdir}${_sysroot}/usr/lib/libc.so
+ sed -i "s|/lib|${_sysroot}&|g" ${pkgdir}${_sysroot}/usr/lib/libpthreads.so
+ fi
+
install -dm755 ${pkgdir}${_sysroot}/etc/rc.d
install -dm755 ${pkgdir}${_sysroot}/usr/sbin
install -dm755 ${pkgdir}${_sysroot}/usr/lib/locale
diff --git a/extra/gstreamer0.10-ffmpeg/PKGBUILD b/extra/gstreamer0.10-ffmpeg/PKGBUILD
index eed8e4f3d..0e4dade8f 100644
--- a/extra/gstreamer0.10-ffmpeg/PKGBUILD
+++ b/extra/gstreamer0.10-ffmpeg/PKGBUILD
@@ -1,8 +1,8 @@
-# $Id: PKGBUILD 138452 2011-09-23 18:40:52Z ibiru $
+# $Id: PKGBUILD 147131 2012-01-22 11:26:07Z andyrtr $
# Maintainer: Jan de Groot <jgc@archlinux.org>
pkgname=gstreamer0.10-ffmpeg
-pkgver=0.10.12
+pkgver=0.10.13
pkgrel=1
pkgdesc="Gstreamer FFMpeg Plugin"
arch=('i686' 'x86_64')
@@ -13,7 +13,7 @@ url="http://www.gstreamer.net"
groups=('gstreamer0.10-plugins')
options=('!libtool')
source=(http://gstreamer.freedesktop.org/src/gst-ffmpeg/gst-ffmpeg-${pkgver}.tar.bz2)
-sha256sums=('b17707102b4bfa5e0d5095be3608ee2d4388268eab822c9a0ce7a18011bdd73b')
+sha256sums=('76fca05b08e00134e3cb92fa347507f42cbd48ddb08ed3343a912def187fbb62')
build() {
cd "${srcdir}/gst-ffmpeg-${pkgver}"
diff --git a/extra/gstreamer0.10-python/PKGBUILD b/extra/gstreamer0.10-python/PKGBUILD
index a4e6c86ec..2af9448a8 100644
--- a/extra/gstreamer0.10-python/PKGBUILD
+++ b/extra/gstreamer0.10-python/PKGBUILD
@@ -1,8 +1,8 @@
-# $Id: PKGBUILD 109061 2011-02-05 16:24:50Z andyrtr $
+# $Id: PKGBUILD 147133 2012-01-22 11:30:42Z andyrtr $
# Maintainer: Jan de Groot <jgc@archlinux.org>
pkgname=gstreamer0.10-python
-pkgver=0.10.21
+pkgver=0.10.22
pkgrel=1
pkgdesc="Python bindings for GStreamer 0.10"
arch=('i686' 'x86_64')
@@ -12,7 +12,7 @@ depends=('pygobject>=2.20.0' 'gstreamer0.10-base>=0.10.32')
makedepends=('pkgconfig')
options=('!libtool')
source=(http://gstreamer.freedesktop.org/src/gst-python/gst-python-${pkgver}.tar.bz2)
-md5sums=('31340ae3e877797a10d088a226d74b16')
+md5sums=('937152fe896241f827689f4b53e79b22')
build() {
cd "${srcdir}/gst-python-${pkgver}"
diff --git a/extra/kdeplasma-applets-networkmanagement/PKGBUILD b/extra/kdeplasma-applets-networkmanagement/PKGBUILD
index 8dd7c0a3a..4b83ae0f5 100644
--- a/extra/kdeplasma-applets-networkmanagement/PKGBUILD
+++ b/extra/kdeplasma-applets-networkmanagement/PKGBUILD
@@ -4,12 +4,12 @@
pkgname=kdeplasma-applets-networkmanagement
epoch=1
-pkgver=0.9.0rc3
-_pkgver=0.8.98
+pkgver=0.9.0rc4
+_pkgver=0.8.99
pkgrel=1
pkgdesc="KDE control panel and widget network connections"
arch=('i686' 'x86_64')
-url="http://www.kde.org/"
+url='https://projects.kde.org/projects/extragear/base/networkmanagement'
license=('GPL')
depends=('kdebase-workspace' 'networkmanager')
makedepends=('cmake' 'python2' 'automoc4' 'mobile-broadband-provider-info'
@@ -18,7 +18,7 @@ optdepends=('mobile-broadband-provider-info: Database of mobile broadband servic
'openconnect: Cisco AnyConnect compatible VPN client')
install=${pkgname}.install
source=("http://download.kde.org/unstable/networkmanagement/${_pkgver}/src/networkmanagement-${_pkgver}.tar.bz2")
-sha1sums=('f46274c4cca722f37eef7418144c0c04bfe21e24')
+sha1sums=('18d625a25b90f9591a5cfdabcf77269eb3ba33e0')
build() {
cd "${srcdir}"
diff --git a/extra/libgee/PKGBUILD b/extra/libgee/PKGBUILD
index 8dc909b3d..6e974845c 100644
--- a/extra/libgee/PKGBUILD
+++ b/extra/libgee/PKGBUILD
@@ -1,9 +1,9 @@
-# $Id: PKGBUILD 142433 2011-11-09 18:26:23Z ibiru $
+# $Id: PKGBUILD 147137 2012-01-22 20:17:23Z ibiru $
# Maintainer : Ionut Biru <ibiru@archlinux.org>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
pkgname=libgee
-pkgver=0.6.3
+pkgver=0.6.4
pkgrel=1
pkgdesc="GObject collection library"
url="http://live.gnome.org/Libgee"
@@ -13,7 +13,7 @@ depends=('glib2')
makedepends=('gobject-introspection')
options=('!libtool')
source=(http://ftp.gnome.org/pub/GNOME/sources/libgee/0.6/$pkgname-$pkgver.tar.xz)
-sha256sums=('6b1ef59e26dd10feed279fdd7cc49c3391e124d31c46ac56c410ba0ce3bd1716')
+sha256sums=('55f39f3b28e676f6cbd9377d83edd031084436a4da41280a9503c94faffb1665')
build() {
cd "$srcdir/$pkgname-$pkgver"
diff --git a/extra/poppler/PKGBUILD b/extra/poppler/PKGBUILD
index bb1327fdd..bda699447 100644
--- a/extra/poppler/PKGBUILD
+++ b/extra/poppler/PKGBUILD
@@ -1,9 +1,9 @@
-# $Id: PKGBUILD 145182 2011-12-19 11:45:17Z jgc $
+# $Id: PKGBUILD 147127 2012-01-22 11:06:04Z andyrtr $
# Maintainer: Jan de Groot <jgc@archlinux.org>
pkgbase=poppler
pkgname=('poppler' 'poppler-glib' 'poppler-qt')
-pkgver=0.18.2
+pkgver=0.18.3
pkgrel=1
arch=(i686 x86_64)
license=('GPL')
@@ -14,14 +14,14 @@ _testtag=0d2bfd4af4c76a3bac27ccaff793d9129df7b57a
source=(http://poppler.freedesktop.org/${pkgbase}-${pkgver}.tar.gz
http://cgit.freedesktop.org/poppler/test/snapshot/test-${_testtag}.tar.bz2
git-fixes.patch)
-md5sums=('38616927823ef01937aab26872e957e4'
+md5sums=('d70d2d63d8acd29c97185f7e5f09c9b4'
'9dc64c254a31e570507bdd4ad4ba629a'
'af56b7b1b24a08f7498a0c7f5e862b93')
build() {
cd "${srcdir}/${pkgbase}-${pkgver}"
sed -i -e '/AC_PATH_XTRA/d' configure.ac
- patch -Np1 -i "${srcdir}/git-fixes.patch"
+ #patch -Np1 -i "${srcdir}/git-fixes.patch"
autoreconf -fi
diff --git a/extra/sg3_utils/PKGBUILD b/extra/sg3_utils/PKGBUILD
index eca1068a5..7392bd2d6 100644
--- a/extra/sg3_utils/PKGBUILD
+++ b/extra/sg3_utils/PKGBUILD
@@ -1,8 +1,8 @@
-#$Id: PKGBUILD 109019 2011-02-05 11:24:51Z andyrtr $
+#$Id: PKGBUILD 147121 2012-01-22 10:55:51Z andyrtr $
# Maintainer: Daniel Isenmann <daniel@archlinux.org>
pkgname=sg3_utils
-pkgver=1.30
+pkgver=1.33
pkgrel=1
pkgdesc="Generic SCSI utilities"
arch=(i686 x86_64)
@@ -11,7 +11,7 @@ license=('GPL' 'custom:BSD')
depends=('glibc')
options=('!libtool')
source=(http://sg.danny.cz/sg/p/${pkgname}-${pkgver}.tgz)
-md5sums=('8acb9328abe17d012db8c5f95f1d7d75')
+md5sums=('261e39f7161337330ba6bd57999be801')
build() {
cd "${srcdir}/${pkgname}-${pkgver}"
diff --git a/extra/xterm/PKGBUILD b/extra/xterm/PKGBUILD
index 77c59507d..d9a74afbd 100644
--- a/extra/xterm/PKGBUILD
+++ b/extra/xterm/PKGBUILD
@@ -1,9 +1,9 @@
-# $Id: PKGBUILD 145186 2011-12-19 11:53:19Z jgc $
+# $Id: PKGBUILD 147119 2012-01-22 10:53:02Z andyrtr $
# Maintainer: Jan de Groot <jgc@archlinux.org>
# Contributor: Alexander Baldeck <alexander@archlinux.org>
pkgname=xterm
-pkgver=276
+pkgver=278
pkgrel=1
pkgdesc="X Terminal Emulator"
arch=('i686' 'x86_64')
@@ -12,7 +12,7 @@ license=('custom')
depends=('libxft' 'libxaw' 'ncurses' 'xorg-luit' 'xbitmaps')
source=(ftp://invisible-island.net/${pkgname}/${pkgname}-${pkgver}.tgz
LICENSE)
-md5sums=('50ca8ee40e8a0992019f8f35042c9abb'
+md5sums=('3eeddfe35cb0a2db1924cfe0c20be443'
'10ecc3f8ee91e3189863a172f68282d2')
build() {
diff --git a/multilib/lib32-kmod/PKGBUILD b/multilib/lib32-kmod/PKGBUILD
new file mode 100644
index 000000000..5f860b7b3
--- /dev/null
+++ b/multilib/lib32-kmod/PKGBUILD
@@ -0,0 +1,41 @@
+# $Id: PKGBUILD 146696 2012-01-16 19:19:14Z dreisner $
+# Maintainer: Dave Reisner <dreisner@archlinux.org>
+
+pkgname=lib32-kmod
+_pkgbasename=kmod
+pkgver=4
+pkgrel=1
+pkgdesc="Linux kernel module handling"
+arch=('x86_64')
+url="http://git.profusion.mobi/cgit.cgi/kmod.git"
+license=('GPL2')
+depends=('lib32-glibc' 'lib32-zlib' "$_pkgbasename")
+makedepends=('gcc-multilib')
+options=('!libtool')
+source=("http://packages.profusion.mobi/$_pkgbasename/$_pkgbasename-$pkgver.tar.xz")
+md5sums=('e14450a066a48accd0af1995b3c0232d')
+
+build() {
+ cd "$_pkgbasename-$pkgver"
+
+ export CC="gcc -m32"
+ export PKG_CONFIG_PATH="/usr/lib32/pkgconfig"
+
+ ./configure \
+ --libdir=/usr/lib32 \
+ --sysconfdir=/etc \
+ --disable-tools \
+ --with-rootprefix= \
+ --with-zlib
+
+ make
+}
+
+package() {
+ make -C "$_pkgbasename-$pkgver" DESTDIR="$pkgdir" install
+
+ # nuke manpages and headers
+ rm -rf "$pkgdir"/usr/{share,include,bin}
+}
+
+# vim: ft=sh syn=sh et
diff --git a/multilib/lib32-udev/PKGBUILD b/multilib/lib32-udev/PKGBUILD
index 36240f6c1..a99efb154 100644
--- a/multilib/lib32-udev/PKGBUILD
+++ b/multilib/lib32-udev/PKGBUILD
@@ -1,21 +1,20 @@
-# $Id: PKGBUILD 60965 2011-12-19 19:41:38Z lcarlier $
+# $Id: PKGBUILD 62609 2012-01-22 19:02:33Z lcarlier $
# Maintainer: Aaron Griffin <aaron@archlinux.org>
# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
# Maintainer: Thomas Bächler <thomas@archlinux.org>
pkgname=('lib32-udev')
-pkgver=175
+pkgver=178
pkgrel=1
arch=('x86_64')
pkgdesc="The userspace dev tools (udev) (32-bit)"
url="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html"
license=('GPL')
options=(!makeflags !libtool)
-depends=('lib32-glibc' 'lib32-glib2' 'lib32-acl' 'lib32-libusb-compat' 'udev')
+depends=('lib32-glibc' 'lib32-glib2' 'lib32-acl' 'lib32-libusb-compat' 'lib32-kmod' 'lib32-util-linux' 'udev')
makedepends=('gcc-multilib' 'gperf')
-#source=(http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev-$pkgver.tar.bz2)
-source=(http://people.freedesktop.org/~kay/udev/udev-$pkgver.tar.bz2)
-md5sums=('2fc9c1efcbde98e3d73ffee7a77aea47')
+source=(ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/udev-$pkgver.tar.xz)
+md5sums=('173cc6061e3a82dd6e9a1a5cf767a858')
build() {
export CC="gcc -m32"
diff --git a/staging/at-spi/PKGBUILD b/staging/at-spi/PKGBUILD
new file mode 100644
index 000000000..8cb6c20e9
--- /dev/null
+++ b/staging/at-spi/PKGBUILD
@@ -0,0 +1,37 @@
+# $Id: PKGBUILD 147108 2012-01-22 10:16:03Z andyrtr $
+# Maintainer: Jan de Groot <jan@archlinux.org>
+
+pkgname=at-spi
+pkgver=1.32.0
+pkgrel=5
+pkgdesc="Assistive Technology Service Provider Interface"
+arch=('i686' 'x86_64')
+license=('GPL')
+depends=('libbonobo' 'libxtst' 'gtk2' 'gconf')
+makedepends=('pkgconfig' 'python2' 'intltool' 'libice' 'libsm')
+options=('!libtool' '!emptydirs')
+url="http://www.gnome.org"
+install=at-spi.install
+source=(http://ftp.gnome.org/pub/gnome/sources/${pkgname}/1.32/${pkgname}-${pkgver}.tar.bz2)
+sha256sums=('cc841dea746413eebadf0710dabec741450b37a06821c34526f505fe9d027039')
+
+# !! make sure you 'pacman -Rsc python' from your chroot before building the package or it would use python3 instead of the wanted python2 !!
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr --sysconfdir=/etc \
+ --localstatedir=/var --disable-static \
+ --libexecdir=/usr/lib/at-spi \
+ --enable-relocate
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ make GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/gconf/schemas"
+ gconf-merge-schema "${pkgdir}/usr/share/gconf/schemas/${pkgname}.schemas" --domain at-spi "${pkgdir}"/etc/gconf/schemas/*.schemas
+ rm -f "${pkgdir}"/etc/gconf/schemas/*.schemas
+}
diff --git a/staging/at-spi/at-spi.install b/staging/at-spi/at-spi.install
new file mode 100644
index 000000000..b4c75b51c
--- /dev/null
+++ b/staging/at-spi/at-spi.install
@@ -0,0 +1,17 @@
+pkgname=at-spi
+
+post_install() {
+ usr/sbin/gconfpkg --install ${pkgname}
+}
+
+pre_upgrade() {
+ pre_remove $1
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+pre_remove() {
+ usr/sbin/gconfpkg --uninstall ${pkgname}
+}
diff --git a/staging/cairomm/PKGBUILD b/staging/cairomm/PKGBUILD
new file mode 100644
index 000000000..d8c952616
--- /dev/null
+++ b/staging/cairomm/PKGBUILD
@@ -0,0 +1,27 @@
+# $Id: PKGBUILD 147110 2012-01-22 10:23:49Z andyrtr $
+# Maintainer: Kevin <kevin@archlinux.org>
+# Contributor: criminy <criminy@gmail.com>
+
+pkgname=cairomm
+pkgver=1.10.0
+pkgrel=2
+pkgdesc="C++ bindings to Cairo vector graphics library"
+arch=('i686' 'x86_64')
+url="http://www.cairographics.org"
+license=('LGPL' 'MPL')
+depends=('cairo' 'libsigc++')
+makedepends=('pkgconfig')
+source=(http://www.cairographics.org/releases/${pkgname}-${pkgver}.tar.gz)
+options=('!libtool' '!emptydirs')
+sha1sums=('f08bf8a331067f0d1e876523f07238fba6b26b99')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+}
diff --git a/staging/gstreamer0.10-good/PKGBUILD b/staging/gstreamer0.10-good/PKGBUILD
new file mode 100644
index 000000000..66e079f98
--- /dev/null
+++ b/staging/gstreamer0.10-good/PKGBUILD
@@ -0,0 +1,54 @@
+# $Id: PKGBUILD 147113 2012-01-22 10:40:14Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgbase=gstreamer0.10-good
+pkgname=('gstreamer0.10-good' 'gstreamer0.10-good-plugins')
+pkgver=0.10.30
+pkgrel=2
+arch=('i686' 'x86_64')
+license=('LGPL')
+makedepends=('intltool' 'pkgconfig' 'gstreamer0.10-base>=0.10.34' 'libavc1394' 'libiec61883' 'aalib' 'libshout' 'libdv' 'flac' 'gconf' 'wavpack' 'taglib' 'libsoup-gnome' 'v4l-utils' 'libcaca' 'bzip2' 'gdk-pixbuf2' 'libpulse' 'jack' 'udev')
+url="http://gstreamer.freedesktop.org/"
+options=(!libtool !emptydirs)
+source=(${url}/src/gst-plugins-good/gst-plugins-good-${pkgver}.tar.bz2)
+sha256sums=('b12cba90b27d8423cd0a808939098d19db3996cfb9bf528507c6321782e095f6')
+
+build() {
+ cd "${srcdir}/gst-plugins-good-${pkgver}"
+ sed -i '/AC_PATH_XTRA/d' configure.ac
+ autoreconf
+ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
+ --disable-static --enable-experimental \
+ --disable-schemas-install \
+ --disable-hal \
+ --disable-esd \
+ --with-package-name="GStreamer Good Plugins (Archlinux)" \
+ --with-package-origin="http://www.archlinux.org/"
+
+ make
+ sed -e 's/gst sys ext/gst/' -i Makefile
+}
+
+package_gstreamer0.10-good() {
+ depends=('gstreamer0.10-base>=0.10.34' 'bzip2')
+ pkgdesc="GStreamer Multimedia Framework Good plugin libraries"
+
+ cd "${srcdir}/gst-plugins-good-${pkgver}"
+ make GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 DESTDIR="${pkgdir}" install
+ rm -rf "${pkgdir}/etc/gconf"
+}
+
+package_gstreamer0.10-good-plugins() {
+ depends=("gstreamer0.10-good=${pkgver}" 'libavc1394' 'libiec61883' 'aalib' 'libshout' 'libdv' 'flac' 'gconf' 'wavpack' 'taglib' 'libsoup-gnome' 'v4l-utils' 'libcaca' 'libpng' 'libjpeg' 'jack' 'libpulse' 'udev')
+ pkgdesc="GStreamer Multimedia Framework Good Plugins (gst-plugins-good)"
+ groups=('gstreamer0.10-plugins')
+ replaces=('gstreamer0.10-aalib' 'gstreamer0.10-wavpack' 'gstreamer0.10-shout2' 'gstreamer0.10-taglib' 'gstreamer0.10-libcaca' 'gstreamer0.10-libpng' 'gstreamer0.10-jpeg' 'gstreamer0.10-cairo' 'gstreamer0.10-flac' 'gstreamer0.10-speex' 'gstreamer0.10-gdkpixbuf' 'gstreamer0.10-dv1394' 'gstreamer0.10-annodex' 'gstreamer0.10-gconf' 'gstreamer0.10-esd' 'gstreamer0.10-cdio' 'gstreamer0.10-dv' 'gstreamer0.10-soup' 'gstreamer0.10-pulse')
+ conflicts=('gstreamer0.10-aalib' 'gstreamer0.10-wavpack' 'gstreamer0.10-shout2' 'gstreamer0.10-taglib' 'gstreamer0.10-libcaca' 'gstreamer0.10-libpng' 'gstreamer0.10-jpeg' 'gstreamer0.10-cairo' 'gstreamer0.10-flac' 'gstreamer0.10-speex' 'gstreamer0.10-gdkpixbuf' 'gstreamer0.10-dv1394' 'gstreamer0.10-annodex' 'gstreamer0.10-gconf' 'gstreamer0.10-esd' 'gstreamer0.10-cdio' 'gstreamer0.10-dv' 'gstreamer0.10-bad-plugins<0.10.7' 'gstreamer0.10-soup' 'gstreamer0.10-pulse')
+ install=gstreamer0.10-good-plugins.install
+
+ cd "${srcdir}/gst-plugins-good-${pkgver}"
+ make -C sys DESTDIR="${pkgdir}" install
+ make -C ext GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/gconf/schemas"
+ install -m644 gconf/gstreamer-0.10.schemas "${pkgdir}/usr/share/gconf/schemas/gstreamer0.10-good-plugins.schemas"
+}
diff --git a/staging/gstreamer0.10-good/gstreamer0.10-good-plugins.install b/staging/gstreamer0.10-good/gstreamer0.10-good-plugins.install
new file mode 100644
index 000000000..e343beea5
--- /dev/null
+++ b/staging/gstreamer0.10-good/gstreamer0.10-good-plugins.install
@@ -0,0 +1,19 @@
+pkgname=gstreamer0.10-good-plugins
+
+post_install() {
+ usr/sbin/gconfpkg --install ${pkgname}
+}
+
+pre_upgrade() {
+ if [ -f usr/share/gconf/schemas/${pkgname}.schemas ]; then
+ pre_remove
+ fi
+}
+
+post_upgrade() {
+ post_install
+}
+
+pre_remove() {
+ usr/sbin/gconfpkg --uninstall ${pkgname}
+}
diff --git a/staging/poppler/PKGBUILD b/staging/poppler/PKGBUILD
index a34a01a83..d05f4945e 100644
--- a/staging/poppler/PKGBUILD
+++ b/staging/poppler/PKGBUILD
@@ -1,9 +1,9 @@
-# $Id: PKGBUILD 147049 2012-01-21 04:25:49Z eric $
+# $Id: PKGBUILD 147129 2012-01-22 11:12:11Z andyrtr $
# Maintainer: Jan de Groot <jgc@archlinux.org>
pkgbase=poppler
pkgname=('poppler' 'poppler-glib' 'poppler-qt')
-pkgver=0.18.2
+pkgver=0.18.3
pkgrel=2
arch=(i686 x86_64)
license=('GPL')
@@ -14,14 +14,14 @@ _testtag=0d2bfd4af4c76a3bac27ccaff793d9129df7b57a
source=(http://poppler.freedesktop.org/${pkgbase}-${pkgver}.tar.gz
http://cgit.freedesktop.org/poppler/test/snapshot/test-${_testtag}.tar.bz2
git-fixes.patch)
-md5sums=('38616927823ef01937aab26872e957e4'
+md5sums=('d70d2d63d8acd29c97185f7e5f09c9b4'
'9dc64c254a31e570507bdd4ad4ba629a'
'af56b7b1b24a08f7498a0c7f5e862b93')
build() {
cd "${srcdir}/${pkgbase}-${pkgver}"
sed -i -e '/AC_PATH_XTRA/d' configure.ac
- patch -Np1 -i "${srcdir}/git-fixes.patch"
+ #patch -Np1 -i "${srcdir}/git-fixes.patch"
autoreconf -fi
diff --git a/staging/vlc/PKGBUILD b/staging/vlc/PKGBUILD
new file mode 100644
index 000000000..52303eec2
--- /dev/null
+++ b/staging/vlc/PKGBUILD
@@ -0,0 +1,74 @@
+# $Id: PKGBUILD 147135 2012-01-22 12:28:59Z giovanni $
+# Maintainer: Giovanni Scafora <giovanni@archlinux.org>
+# Contributor: Sarah Hay <sarahhay@mb.sympatico.ca>
+# Contributor: Martin Sandsmark <martin.sandsmark@kde.org>
+
+pkgname=vlc
+pkgver=1.1.13
+pkgrel=2
+pkgdesc="A multi-platform MPEG, VCD/DVD, and DivX player"
+arch=('i686' 'x86_64')
+url="http://www.videolan.org/vlc/"
+license=('GPL')
+depends=('a52dec' 'fluidsynth' 'libmtp' 'libdvbpsi' 'libxpm' 'libcdio'
+ 'libdca' 'qt' 'libproxy' 'sdl_image' 'libdvdnav' 'mesa'
+ 'lua' 'v4l-utils' 'libcddb' 'smbclient' 'libmatroska' 'zvbi'
+ 'taglib' 'sysfsutils' 'libmpcdec' 'ffmpeg' 'faad2' 'libupnp'
+ 'libshout' 'libmad' 'fribidi' 'libmpeg2' 'libmodplug' 'xcb-util-keysyms'
+ 'ttf-freefont' 'libxv' 'libass' 'xdg-utils' 'desktop-file-utils')
+makedepends=('avahi' 'pkgconfig' 'live-media' 'libnotify'
+ 'flac' 'libtheora' 'alsa-lib' 'jack' 'kdelibs' 'udev'
+ 'libraw1394' 'libdc1394' 'libavc1394' 'libva' 'libpulse'
+ 'lirc-utils' 'gnutls' 'libcaca')
+optdepends=('avahi: for service discovery using bonjour protocol'
+ 'libnotify: for notification plugin'
+ 'ncurses: for ncurses interface support'
+ 'libdvdcss: for decoding encrypted DVDs'
+ 'lirc-utils: for lirc plugin'
+ 'libavc1394: for devices using the 1394ta AV/C'
+ 'libdc1394: for IEEE 1394 plugin'
+ 'kdelibs: KDE Solid hardware integration'
+ 'libpulse: PulseAudio support'
+ 'vdpau-video: vdpau back-end for nvidia'
+ 'libva-driver-intel: back-end for intel cards')
+conflicts=('vlc-plugin')
+replaces=('vlc-plugin')
+backup=('usr/share/vlc/http/.hosts'
+ 'usr/share/vlc/http/dialogs/.hosts'
+ 'usr/share/vlc/lua/http/.hosts'
+ 'usr/share/vlc/lua/http/dialogs/.hosts')
+options=('!libtool')
+install=vlc.install
+source=("http://download.videolan.org/pub/videolan/${pkgname}/${pkgver}/${pkgname}-${pkgver}.tar.bz2")
+md5sums=('9678fb7a04808b6e0de63746d35e4bb1')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ sed -i -e 's:truetype/freefont:TTF:g' modules/misc/freetype.c
+
+ ./configure --prefix=/usr \
+ --disable-rpath \
+ --enable-faad \
+ --enable-v4l \
+ --enable-snapshot \
+ --enable-dbus-control \
+ --enable-nls \
+ --enable-lirc \
+ --enable-pvr \
+ --enable-ncurses \
+ --with-live555-tree=/usr/lib/live \
+ --enable-upnp \
+ --enable-realrtsp
+ make
+}
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ make DESTDIR="${pkgdir}/" install
+
+ for res in 16 32 48 128; do
+ install -D -m644 "${srcdir}/vlc-${pkgver}/share/icons/${res}x${res}/vlc.png" \
+ "${pkgdir}/usr/share/icons/hicolor/${res}x${res}/apps/vlc.png"
+ done
+}
diff --git a/staging/vlc/vlc.install b/staging/vlc/vlc.install
new file mode 100644
index 000000000..dc4961cae
--- /dev/null
+++ b/staging/vlc/vlc.install
@@ -0,0 +1,18 @@
+post_install() {
+ xdg-icon-resource forceupdate --theme hicolor &> /dev/null
+ usr/lib/vlc/vlc-cache-gen -f /usr/lib/vlc/plugins
+ update-desktop-database -q
+}
+
+post_upgrade() {
+ post_install
+}
+
+pre_remove() {
+ rm -f usr/lib/vlc/plugins/plugins-*.dat
+}
+
+post_remove() {
+ xdg-icon-resource forceupdate --theme hicolor &> /dev/null
+ update-desktop-database -q
+}
diff --git a/~mtjm/cups-usblp/PKGBUILD b/~mtjm/cups-usblp/PKGBUILD
new file mode 100644
index 000000000..43687b104
--- /dev/null
+++ b/~mtjm/cups-usblp/PKGBUILD
@@ -0,0 +1,134 @@
+# $Id: PKGBUILD 135897 2011-08-20 06:24:46Z andyrtr $
+# Maintainer: Andreas Radke <andyrtr@archlinux.org>
+
+_pkgname="cups"
+pkgname="cups-usblp"
+pkgver=1.5.0
+pkgrel=1.1
+pkgdesc="The CUPS Printing System - daemon package, with usblp backend"
+arch=('i686' 'x86_64' 'mips64el')
+license=('GPL')
+url="http://www.cups.org/"
+depends=('acl' 'openslp' 'pam' "libcups>=${pkgver}" 'poppler>=0.12.3' 'dbus-core' 'hicolor-icon-theme')
+makedepends=('libtiff>=3.9.2-2' 'libpng>=1.4.0' 'acl' 'openslp' 'pam' 'xdg-utils' 'krb5' 'gnutls>=2.8.3' 'poppler>=0.12.3'
+ 'xinetd' 'gzip' 'autoconf' 'php' 'dbus-core' 'avahi' 'hicolor-icon-theme')
+optdepends=('php: for included phpcups.so module'
+ 'ghostscript: for non-PostScript printers to print with CUPS to convert PostScript to raster images'
+ 'foomatic-db: drivers use Ghostscript to convert PostScript to a printable form directly'
+ 'foomatic-db-engine: drivers use Ghostscript to convert PostScript to a printable form directly'
+ 'xdg-utils: xdg .desktop file support')
+provides=("${_pkgname}=${pkgver}")
+conflicts=("${_pkgname}")
+backup=(etc/cups/cupsd.conf
+ etc/cups/mime.convs
+ etc/cups/mime.types
+ etc/cups/snmp.conf
+ etc/cups/printers.conf
+ etc/cups/classes.conf
+ etc/cups/client.conf
+ etc/cups/subscriptions.conf
+ etc/dbus-1/system.d/cups.conf
+ etc/logrotate.d/cups
+ etc/pam.d/cups
+ etc/xinetd.d/cups-lpd)
+install=cups.install
+source=(ftp://ftp.easysw.com/pub/cups/${pkgver}/cups-${pkgver}-source.tar.bz2
+ cups-avahi.patch
+ cups-no-export-ssllibs.patch
+ cups-no-gcrypt.patch
+ cups cups.logrotate cups.pam)
+#options=('!emptydirs')
+md5sums=('e54ed09ede2340fc3014913333520fe4'
+ 'e0843e8d8c345792ac73a185260e69fe'
+ '9b8467a1e51d360096b70e2c3c081e6c'
+ '3733c23e77eb503bd94cc368e02830dc'
+ '9657daa21760bb0b5fa3d8b51d5e01a1'
+ 'f861b18f4446c43918c8643dcbbd7f6d'
+ '96f82c38f3f540b53f3e5144900acf17')
+
+# move client.conf man page for next update to the client pkg.
+
+build() {
+ cd ${srcdir}/${_pkgname}-${pkgver}
+ # 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
+ patch -Np1 -i "${srcdir}/cups-no-export-ssllibs.patch"
+
+ patch -Np1 -i "${srcdir}/cups-no-gcrypt.patch"
+
+ # Rebuild configure script for --enable-avahi.
+ aclocal -I config-scripts
+ autoconf -I config-scripts
+
+ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
+ --libdir=/usr/lib \
+ --with-logdir=/var/log/cups \
+ --with-docdir=/usr/share/cups/doc \
+ --with-cups-user=daemon \
+ --with-cups-group=lp \
+ --enable-pam=yes \
+ --disable-ldap \
+ --enable-raw-printing \
+ --enable-dbus --with-dbusdir=/etc/dbus-1 \
+ --enable-ssl=yes --enable-gnutls \
+ --enable-threads \
+ --enable-avahi\
+ --with-php=/usr/bin/php-cgi \
+ --with-pdftops=pdftops \
+ --with-optim="$CFLAGS" \
+ --disable-libusb
+ make
+}
+
+check() {
+ cd "$srcdir/$_pkgname-$pkgver"
+ #httpAddrGetList(workstation64): FAIL
+ #1 TESTS FAILED!
+ #make[1]: *** [testhttp] Error 1
+ make -k check || /bin/true
+}
+
+package() {
+ cd ${srcdir}/${_pkgname}-${pkgver}
+ make BUILDROOT=${pkgdir} install-data install-exec
+
+ # this one we ship in the libcups pkg
+ rm -f ${pkgdir}/usr/bin/cups-config
+
+ # kill the sysv stuff
+ rm -rf ${pkgdir}/etc/rc*.d
+ rm -rf ${pkgdir}/etc/init.d
+ install -D -m755 ../cups ${pkgdir}/etc/rc.d/cupsd
+ install -D -m644 ../cups.logrotate ${pkgdir}/etc/logrotate.d/cups
+ install -D -m644 ../cups.pam ${pkgdir}/etc/pam.d/cups
+
+ # fix perms on /var/spool and /etc
+ chmod 755 ${pkgdir}/var/spool
+ chmod 755 ${pkgdir}/etc
+
+ # serial backend needs to run as root (http://bugs.archlinux.org/task/20396)
+ chmod 700 ${pkgdir}/usr/lib/cups/backend/serial
+
+ # install ssl directory where to store the certs, solves some samba issues
+ install -dm700 -g lp ${pkgdir}/etc/cups/ssl
+ # remove directory from package, we create it in cups rc.d file
+ rm -rf ${pkgdir}/var/run
+# install -dm511 -g lp ${pkgdir}/var/run/cups/certs
+
+ # install some more configuration files that will get filled by cupsd
+ touch ${pkgdir}/etc/cups/printers.conf
+ touch ${pkgdir}/etc/cups/classes.conf
+ touch ${pkgdir}/etc/cups/client.conf
+ echo "# see 'man client.conf'" >> ${pkgdir}/etc/cups/client.conf
+ echo "ServerName /var/run/cups/cups.sock # alternative: ServerName hostname-or-ip-address[:port] of a remote server" >> ${pkgdir}/etc/cups/client.conf
+ touch ${pkgdir}/etc/cups/subscriptions.conf
+ chgrp lp ${pkgdir}/etc/cups/{printers.conf,classes.conf,client.conf,subscriptions.conf}
+
+ # fix .desktop file
+ sed -i 's|^Exec=htmlview http://localhost:631/|Exec=xdg-open http://localhost:631/|g' ${pkgdir}/usr/share/applications/cups.desktop
+
+ # compress some driver files, adopted from Fedora
+ find ${pkgdir}/usr/share/cups/model -name "*.ppd" | xargs gzip -n9f
+}
diff --git a/~mtjm/cups-usblp/cups b/~mtjm/cups-usblp/cups
new file mode 100644
index 000000000..744c8e663
--- /dev/null
+++ b/~mtjm/cups-usblp/cups
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+daemon_name=cupsd
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+#. /etc/conf.d/$daemon_name.conf
+
+get_pid() {
+ pidof -o %PPID $daemon_name
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting $daemon_name daemon"
+
+ PID=$(get_pid)
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$daemon_name.pid ] && rm -f /var/run/$daemon_name.pid
+ # RUN
+ $daemon_name
+ #
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ echo $(get_pid) > /var/run/$daemon_name.pid
+ add_daemon $daemon_name
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping $daemon_name daemon"
+ PID=$(get_pid)
+ # KILL
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ #
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/$daemon_name.pid &> /dev/null
+ rm_daemon $daemon_name
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+
+ status)
+ stat_busy "Checking $daemon_name status";
+ ck_status $daemon_name
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+esac
+
+exit 0
diff --git a/~mtjm/cups-usblp/cups-avahi.patch b/~mtjm/cups-usblp/cups-avahi.patch
new file mode 100644
index 000000000..7e9c8ecea
--- /dev/null
+++ b/~mtjm/cups-usblp/cups-avahi.patch
@@ -0,0 +1,3156 @@
+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.
+ * 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 +40,18 @@
+
+ #include "backend-private.h"
+ #include <cups/array.h>
+-#include <dns_sd.h>
++#ifdef HAVE_DNSSD
++# include <dns_sd.h>
++#endif /* HAVE_DNSSD */
++#ifdef HAVE_AVAHI
++# include <avahi-client/client.h>
++# include <avahi-client/lookup.h>
++# include <avahi-common/simple-watch.h>
++# include <avahi-common/domain.h>
++# include <avahi-common/error.h>
++# include <avahi-common/malloc.h>
++#define kDNSServiceMaxDomainName AVAHI_DOMAIN_NAME_MAX
++#endif /* HAVE_AVAHI */
+
+
+ /*
+@@ -53,7 +71,12 @@
+
+ typedef struct
+ {
++#ifdef HAVE_DNSSD
+ DNSServiceRef ref; /* Service reference for resolve */
++#endif /* HAVE_DNSSD */
++#ifdef HAVE_AVAHI
++ int resolved; /* Did we resolve the device? */
++#endif /* HAVE_AVAHI */
+ char *name, /* Service name */
+ *domain, /* Domain name */
+ *fullName, /* Full name */
+@@ -65,6 +88,20 @@
+ sent; /* Did we list the device? */
+ } cups_device_t;
+
++typedef struct
++{
++ char key[256];
++ char value[256];
++
++#ifdef HAVE_DNSSD
++ const uint8_t *data;
++ const uint8_t *datanext;
++ const uint8_t *dataend;
++#else /* HAVE_AVAHI */
++ AvahiStringList *txt;
++#endif /* HAVE_DNSSD */
++} cups_txt_records_t;
++
+
+ /*
+ * Local globals...
+@@ -78,6 +115,7 @@
+ * Local functions...
+ */
+
++#ifdef HAVE_DNSSD
+ static void browse_callback(DNSServiceRef sdRef,
+ DNSServiceFlags flags,
+ uint32_t interfaceIndex,
+@@ -93,12 +131,6 @@
+ const char *regtype,
+ const char *replyDomain,
+ void *context);
+-static int compare_devices(cups_device_t *a, cups_device_t *b);
+-static void exec_backend(char **argv);
+-static cups_device_t *get_device(cups_array_t *devices,
+- const char *serviceName,
+- const char *regtype,
+- const char *replyDomain);
+ static void query_callback(DNSServiceRef sdRef,
+ DNSServiceFlags flags,
+ uint32_t interfaceIndex,
+@@ -107,9 +139,118 @@
+ uint16_t rrclass, uint16_t rdlen,
+ const void *rdata, uint32_t ttl,
+ void *context);
++#endif /* HAVE_DNSSD */
++#ifdef HAVE_AVAHI
++static void avahi_client_callback (AvahiClient *client,
++ AvahiClientState state,
++ void *context);
++static void avahi_browse_callback (AvahiServiceBrowser *browser,
++ AvahiIfIndex interface,
++ AvahiProtocol protocol,
++ AvahiBrowserEvent event,
++ const char *serviceName,
++ const char *regtype,
++ const char *replyDomain,
++ AvahiLookupResultFlags flags,
++ void *context);
++#endif /* HAVE_AVAHI */
++
++static cups_device_t * find_device (cups_array_t *devices,
++ cups_txt_records_t *txt,
++ cups_device_t *dkey);
++static int compare_devices(cups_device_t *a, cups_device_t *b);
++static void exec_backend(char **argv);
++static cups_device_t *get_device(cups_array_t *devices,
++ const char *serviceName,
++ const char *regtype,
++ const char *replyDomain);
+ static void sigterm_handler(int sig);
+ static void unquote(char *dst, const char *src, size_t dstsize);
+
++#ifdef HAVE_AVAHI
++static AvahiSimplePoll *simple_poll = NULL;
++static int avahi_got_callback;
++#endif /* HAVE_AVAHI */
++
++
++/*
++ * '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)
++{
++#ifdef HAVE_DNSSD
++ txt->data = txt->datanext;
++#else /* HAVE_AVAHI */
++ txt->txt = avahi_string_list_get_next (txt->txt);
++ if (txt->txt == NULL)
++ return NULL;
++#endif /* HAVE_DNSSD */
++
++ 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)
++{
++#ifdef HAVE_DNSSD
++ uint8_t datalen;
++ uint8_t *data = txt->data;
++ char *ptr;
++
++ /*
++ * Read a key/value pair starting with an 8-bit length. Since the
++ * length is 8 bits and the size of the key/value buffers is 256, we
++ * don't need to check for overflow...
++ */
++
++ datalen = *data++;
++ if (!datalen || (data + datalen) >= txt->dataend)
++ return NULL;
++ txt->datanext = data + datalen;
++
++ for (ptr = txt->key; data < txt->datanext && *data != '='; data ++)
++ *ptr++ = *data;
++ *ptr = '\0';
++
++ if (data < txt->datanext && *data == '=')
++ {
++ data++;
++
++ if (data < datanext)
++ memcpy (txt->value, data, txt->datanext - data);
++ value[txt->datanext - data] = '\0';
++ }
++ else
++ return 1;
++#else /* HAVE_AVAHI */
++ char *key, *value;
++ size_t len;
++ avahi_string_list_get_pair (txt->txt, &key, &value, &len);
++ if (len > sizeof (txt->value) - 1)
++ len = sizeof (txt->value) - 1;
++
++ memcpy (txt->value, value, len);
++ txt->value[len] = '\0';
++ len = strlen (key);
++ if (len > sizeof (txt->key) - 1)
++ len = sizeof (txt->key) - 1;
++
++ memcpy (txt->key, key, len);
++ txt->key[len] = '\0';
++ avahi_free (key);
++ avahi_free (value);
++#endif /* HAVE_AVAHI */
++
++ return 0;
++}
++
+
+ /*
+ * 'main()' - Browse for printers.
+@@ -120,6 +261,13 @@
+ char *argv[]) /* I - Command-line arguments */
+ {
+ const char *name; /* Backend name */
++ cups_array_t *devices; /* Device array */
++ cups_device_t *device; /* Current device */
++ char uriName[1024]; /* Unquoted fullName for URI */
++#ifdef HAVE_DNSSD
++ int fd; /* Main file descriptor */
++ fd_set input; /* Input set for select() */
++ struct timeval timeout; /* Timeout for select() */
+ DNSServiceRef main_ref, /* Main service reference */
+ fax_ipp_ref, /* IPP fax service reference */
+ ipp_ref, /* IPP service reference */
+@@ -133,12 +281,11 @@
+ pdl_datastream_ref, /* AppSocket service reference */
+ printer_ref, /* LPD service reference */
+ riousbprint_ref; /* Remote IO service reference */
+- int fd; /* Main file descriptor */
+- fd_set input; /* Input set for select() */
+- struct timeval timeout; /* Timeout for select() */
+- cups_array_t *devices; /* Device array */
+- cups_device_t *device; /* Current device */
+- char uriName[1024]; /* Unquoted fullName for URI */
++#endif /* HAVE_DNSSD */
++#ifdef HAVE_AVAHI
++ AvahiClient *client;
++ int error;
++#endif /* HAVE_AVAHI */
+ #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
+ struct sigaction action; /* Actions for POSIX signals */
+ #endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+@@ -198,6 +345,49 @@
+ * Browse for different kinds of printers...
+ */
+
++#ifdef HAVE_AVAHI
++ if ((simple_poll = avahi_simple_poll_new ()) == NULL)
++ {
++ perror ("ERROR: Unable to create avahi simple poll object");
++ return (1);
++ }
++
++ client = avahi_client_new (avahi_simple_poll_get (simple_poll),
++ 0, avahi_client_callback, NULL, &error);
++ if (!client)
++ {
++ perror ("DEBUG: Unable to create avahi client");
++ return (0);
++ }
++
++ avahi_service_browser_new (client, AVAHI_IF_UNSPEC,
++ AVAHI_PROTO_UNSPEC,
++ "_fax-ipp._tcp", NULL, 0,
++ avahi_browse_callback, devices);
++ avahi_service_browser_new (client, AVAHI_IF_UNSPEC,
++ AVAHI_PROTO_UNSPEC,
++ "_ipp._tcp", NULL, 0,
++ avahi_browse_callback, devices);
++ avahi_service_browser_new (client, AVAHI_IF_UNSPEC,
++ AVAHI_PROTO_UNSPEC,
++ "_ipp-tls._tcp", NULL, 0,
++ avahi_browse_callback, devices);
++ avahi_service_browser_new (client, AVAHI_IF_UNSPEC,
++ AVAHI_PROTO_UNSPEC,
++ "_pdl-datastream._tcp",
++ NULL, 0,
++ avahi_browse_callback,
++ devices);
++ avahi_service_browser_new (client, AVAHI_IF_UNSPEC,
++ AVAHI_PROTO_UNSPEC,
++ "_printer._tcp", NULL, 0,
++ avahi_browse_callback, devices);
++ avahi_service_browser_new (client, AVAHI_IF_UNSPEC,
++ AVAHI_PROTO_UNSPEC,
++ "_riousbprint._tcp", NULL, 0,
++ avahi_browse_callback, devices);
++#endif /* HAVE_AVAHI */
++#ifdef HAVE_DNSSD
+ if (DNSServiceCreateConnection(&main_ref) != kDNSServiceErr_NoError)
+ {
+ perror("ERROR: Unable to create service connection");
+@@ -258,6 +448,7 @@
+ riousbprint_ref = main_ref;
+ DNSServiceBrowse(&riousbprint_ref, kDNSServiceFlagsShareConnection, 0,
+ "_riousbprint._tcp", NULL, browse_callback, devices);
++#endif /* HAVE_DNSSD */
+
+ /*
+ * Loop until we are killed...
+@@ -265,6 +456,9 @@
+
+ while (!job_canceled)
+ {
++ int announce = 0;
++
++#ifdef HAVE_DNSSD
+ FD_ZERO(&input);
+ FD_SET(fd, &input);
+
+@@ -284,11 +478,35 @@
+ }
+ else
+ {
++ announce = 1;
++ }
++#else /* HAVE_AVAHI */
++ int r;
++ avahi_got_callback = 0;
++ r = avahi_simple_poll_iterate (simple_poll, 1);
++ if (r != 0 && r != EINTR)
++ {
++ /*
++ * We've been told to exit the loop. Perhaps the connection to
++ * avahi failed.
++ */
++
++ break;
++ }
++
++ if (avahi_got_callback)
++ announce = 1;
++#endif /* HAVE_DNSSD */
++
++ if (announce)
++ {
+ /*
+ * Announce any devices we've found...
+ */
+
++#ifdef HAVE_DNSSD
+ DNSServiceErrorType status; /* DNS query status */
++#endif /* HAVE_DNSSD */
+ cups_device_t *best; /* Best matching device */
+ char device_uri[1024]; /* Device URI */
+ int count; /* Number of queries */
+@@ -302,6 +520,7 @@
+ if (device->sent)
+ sent ++;
+
++#ifdef HAVE_DNSSD
+ if (device->ref)
+ count ++;
+
+@@ -333,14 +552,23 @@
+ count ++;
+ }
+ }
+- else if (!device->sent)
++ else
++#endif /* HAVE_DNSSD */
++#ifdef HAVE_AVAHI
++ if (!device->resolved)
++ continue;
++ else
++#endif /* HAVE_AVAHI */
++ if (!device->sent)
+ {
++#ifdef HAVE_DNSSD
+ /*
+ * Got the TXT records, now report the device...
+ */
+
+ DNSServiceRefDeallocate(device->ref);
+ device->ref = 0;
++#endif /* HAVE_DNSSD */
+
+ if (!best)
+ best = device;
+@@ -401,6 +629,7 @@
+ }
+
+
++#ifdef HAVE_DNSSD
+ /*
+ * 'browse_callback()' - Browse devices.
+ */
+@@ -489,6 +718,7 @@
+ device->fullName);
+ device->sent = 1;
+ }
++#endif /* HAVE_DNSSD */
+
+
+ /*
+@@ -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"))
++ 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."))
++ 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_PRINTER);
++ else if (!strcmp(regtype, "_pdl-datastream._tcp."))
++ return (CUPS_DEVICE_PDL_DATASTREAM);
++#endif /* HAVE_AVAHI */
++
++ return (CUPS_DEVICE_RIOUSBPRINT);
++}
++
++
++/*
+ * 'get_device()' - Create or update a device.
+ */
+
+@@ -589,20 +854,7 @@
+ */
+
+ key.name = (char *)serviceName;
+-
+- 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."))
+- key.type = CUPS_DEVICE_PRINTER;
+- else if (!strcmp(regtype, "_pdl-datastream._tcp."))
+- key.type = CUPS_DEVICE_PDL_DATASTREAM;
+- else
+- key.type = CUPS_DEVICE_RIOUSBPRINT;
++ key.type = device_type (regtype);
+
+ for (device = cupsArrayFind(devices, &key);
+ device;
+@@ -622,8 +874,14 @@
+ free(device->domain);
+ device->domain = strdup(replyDomain);
+
++#ifdef HAVE_DNSSD
+ DNSServiceConstructFullName(fullName, device->name, regtype,
+ replyDomain);
++#else /* HAVE_AVAHI */
++ avahi_service_name_join (fullName, kDNSServiceMaxDomainName,
++ serviceName, regtype, replyDomain);
++#endif /* HAVE_DNSSD */
++
+ free(device->fullName);
+ device->fullName = strdup(fullName);
+ }
+@@ -643,6 +901,9 @@
+ device->domain = strdup(replyDomain);
+ device->type = key.type;
+ device->priority = 50;
++#ifdef HAVE_AVAHI
++ device->resolved = 0;
++#endif /* HAVE_AVAHI */
+
+ cupsArrayAdd(devices, device);
+
+@@ -650,13 +911,20 @@
+ * Set the "full name" of this service, which is used for queries...
+ */
+
++#ifdef HAVE_DNSSD
+ DNSServiceConstructFullName(fullName, serviceName, regtype, replyDomain);
++#else /* HAVE_AVAHI */
++ avahi_service_name_join (fullName, kDNSServiceMaxDomainName,
++ serviceName, regtype, replyDomain);
++#endif /* HAVE_DNSSD */
++
+ device->fullName = strdup(fullName);
+
+ return (device);
+ }
+
+
++#ifdef HAVE_DNSSD
+ /*
+ * 'query_callback()' - Process query data.
+ */
+@@ -680,7 +948,7 @@
+ *ptr; /* Pointer into string */
+ cups_device_t dkey, /* Search key */
+ *device; /* Device */
+-
++ cups_txt_records_t txt;
+
+ fprintf(stderr, "DEBUG2: query_callback(sdRef=%p, flags=%x, "
+ "interfaceIndex=%d, errorCode=%d, fullName=\"%s\", "
+@@ -714,94 +982,233 @@
+ if ((ptr = strstr(name, "._")) != NULL)
+ *ptr = '\0';
+
+- 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."))
+- dkey.type = CUPS_DEVICE_PRINTER;
+- else if (strstr(fullName, "_pdl-datastream._tcp."))
+- dkey.type = CUPS_DEVICE_PDL_DATASTREAM;
++ dkey.type = device_type (fullName);
++
++ txt.data = rdata;
++ txt.dataend = rdata + rdlen;
++ device = find_device ((cups_array_t *) context, &txt, &dkey);
++ if (!device)
++ fprintf(stderr, "DEBUG: Ignoring TXT record for \"%s\"...\n", fullName);
++}
++#endif /* HAVE_DNSSD */
++
++
++#ifdef HAVE_AVAHI
++/*
++ * 'avahi_client_callback()' - Avahi client callback function.
++ */
++
++static void
++avahi_client_callback(AvahiClient *client,
++ AvahiClientState state,
++ void *context)
++{
++ /*
++ * If the connection drops, quit.
++ */
++
++ if (state == AVAHI_CLIENT_FAILURE)
++ {
++ fprintf (stderr, "ERROR: Avahi connection failed\n");
++ avahi_simple_poll_quit (simple_poll);
++ }
++}
++
++
++/*
++ * 'avahi_query_callback()' - Avahi query callback function.
++ */
++
++static void
++avahi_query_callback(AvahiServiceResolver *resolver,
++ AvahiIfIndex interface,
++ AvahiProtocol protocol,
++ AvahiResolverEvent event,
++ const char *name,
++ const char *type,
++ const char *domain,
++ const char *host_name,
++ const AvahiAddress *address,
++ uint16_t port,
++ AvahiStringList *txt,
++ AvahiLookupResultFlags flags,
++ void *context)
++{
++ AvahiClient *client;
++ cups_device_t key,
++ *device;
++ char uqname[1024],
++ *ptr;
++ cups_txt_records_t txtr;
++
++ client = avahi_service_resolver_get_client (resolver);
++ if (event != AVAHI_RESOLVER_FOUND)
++ {
++ if (event == AVAHI_RESOLVER_FAILURE)
++ {
++ fprintf (stderr, "ERROR: %s\n",
++ avahi_strerror (avahi_client_errno (client)));
++ }
++
++ avahi_service_resolver_free (resolver);
++ return;
++ }
++
++ /*
++ * Set search key for device.
++ */
++
++ key.name = uqname;
++ unquote (uqname, name, sizeof (uqname));
++ if ((ptr = strstr(name, "._")) != NULL)
++ *ptr = '\0';
++
++ key.domain = (char *) domain;
++ key.type = device_type (type);
++
++ /*
++ * Find the device and the the TXT information.
++ */
++
++ txtr.txt = txt;
++ device = find_device ((cups_array_t *) context, &txtr, &key);
++ if (device)
++ {
++ /*
++ * Let the main loop know to announce the device.
++ */
++
++ device->resolved = 1;
++ avahi_got_callback = 1;
++ }
+ else
+- dkey.type = CUPS_DEVICE_RIOUSBPRINT;
++ fprintf (stderr, "DEBUG: Ignoring TXT record for \"%s\"...\n", name);
++
++ avahi_service_resolver_free (resolver);
++}
++
++
++/*
++ * 'avahi_browse_callback()' - Avahi browse callback function.
++ */
++
++static void
++avahi_browse_callback(AvahiServiceBrowser *browser,
++ AvahiIfIndex interface,
++ AvahiProtocol protocol,
++ AvahiBrowserEvent event,
++ const char *name,
++ const char *type,
++ const char *domain,
++ AvahiLookupResultFlags flags,
++ void *context)
++{
++ AvahiClient *client = avahi_service_browser_get_client (browser);
++
++ switch (event)
++ {
++ case AVAHI_BROWSER_FAILURE:
++ fprintf (stderr, "ERROR: %s\n",
++ avahi_strerror (avahi_client_errno (client)));
++ avahi_simple_poll_quit (simple_poll);
++ return;
++
++ case AVAHI_BROWSER_NEW:
++ /*
++ * This object is new on the network.
++ */
++
++ if (flags & AVAHI_LOOKUP_RESULT_LOCAL)
++ {
++ /*
++ * This comes from the local machine so ignore it.
++ */
++
++ fprintf (stderr, "DEBUG: ignoring local service %s\n", name);
++ }
++ else
++ {
++ /*
++ * Create a device entry for it if it doesn't yet exist.
++ */
++
++ get_device ((cups_array_t *)context, name, type, domain);
++
++ /*
++ * Now look for a TXT entry.
++ */
++
++ if (avahi_service_resolver_new (client, interface, protocol,
++ name, type, domain,
++ AVAHI_PROTO_UNSPEC, 0,
++ avahi_query_callback, context) == NULL)
++ {
++ fprintf (stderr, "ERROR: failed to resolve service %s: %s\n",
++ name, avahi_strerror (avahi_client_errno (client)));
++ }
++ }
++
++ break;
++
++ 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,
++ cups_device_t *dkey)
++{
++ cups_device_t *device;
++ char *ptr;
++
++ for (device = cupsArrayFind(devices, dkey);
+ device;
+ device = cupsArrayNext(devices))
+ {
+- 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;
+ }
+- else if (device->type == dkey.type)
++ else if (device->type == dkey->type)
+ {
+ /*
+ * Found it, pull out the priority and make and model from the TXT
+ * record and save it...
+ */
+
+- const uint8_t *data, /* Pointer into data */
+- *datanext, /* Next key/value pair */
+- *dataend; /* End of entire TXT record */
+- uint8_t datalen; /* Length of current key/value pair */
+- char key[256], /* Key string */
+- value[256], /* Value string */
+- make_and_model[512],
++ char make_and_model[512],
+ /* Manufacturer and model */
+ model[256], /* Model */
+- device_id[2048];/* 1284 device ID */
+-
++ device_id[2048]; /* 1284 device ID */
+
+ device_id[0] = '\0';
+ make_and_model[0] = '\0';
+
+ strcpy(model, "Unknown");
+
+- for (data = rdata, dataend = data + rdlen;
+- data < dataend;
+- data = datanext)
++ for (;;)
+ {
+- /*
+- * Read a key/value pair starting with an 8-bit length. Since the
+- * length is 8 bits and the size of the key/value buffers is 256, we
+- * don't need to check for overflow...
+- */
+-
+- datalen = *data++;
+-
+- if (!datalen || (data + datalen) >= dataend)
+- break;
+-
+- datanext = data + datalen;
+-
+- for (ptr = key; data < datanext && *data != '='; data ++)
+- *ptr++ = *data;
+- *ptr = '\0';
++ char *key;
++ char *value;
+
+- if (data < datanext && *data == '=')
+- {
+- data ++;
+-
+- if (data < datanext)
+- memcpy(value, data, datanext - data);
+- value[datanext - data] = '\0';
++ 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))
+ {
+ /*
+ * Add USB device ID information...
+@@ -856,6 +1263,10 @@
+ if (device->type == CUPS_DEVICE_PRINTER)
+ device->sent = 1;
+ }
++
++ next:
++ if (next_txt_record (txt) == NULL)
++ break;
+ }
+
+ if (device->device_id)
+@@ -905,11 +1316,9 @@
+ }
+ }
+
+- if (!device)
+- fprintf(stderr, "DEBUG: Ignoring TXT record for \"%s\"...\n", fullName);
++ return device;
+ }
+
+-
+ /*
+ * 'sigterm_handler()' - Handle termination signals...
+ */
+--- a/config-scripts/cups-dnssd.m4
++++ b/config-scripts/cups-dnssd.m4
+@@ -23,6 +23,21 @@
+ DNSSDLIBS=""
+ DNSSD_BACKEND=""
+
++AC_ARG_ENABLE(avahi, [ --enable-avahi turn on DNS Service Discovery support, default=no],
++ [if test x$enable_avahi = xyes; then
++ AC_MSG_CHECKING(for Avahi)
++ if $PKGCONFIG --exists avahi-client; then
++ AC_MSG_RESULT(yes)
++ CFLAGS="$CFLAGS `$PKGCONFIG --cflags avahi-client`"
++ DNSSDLIBS="`$PKGCONFIG --libs avahi-client`"
++ DNSSD_BACKEND="dnssd"
++ AC_DEFINE(HAVE_AVAHI)
++ enable_dnssd=no
++ else
++ AC_MSG_RESULT(no)
++ fi
++ fi])
++
+ if test x$enable_dnssd != xno; then
+ AC_CHECK_HEADER(dns_sd.h, [
+ case "$uname" in
+--- 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>
++# include <avahi-client/lookup.h>
++# include <avahi-common/simple-watch.h>
++#endif /* HAVE_AVAHI */
+
+
+ /*
+@@ -127,6 +136,24 @@
+ void *context);
+ #endif /* HAVE_DNSSD */
+
++#ifdef HAVE_AVAHI
++static void avahi_resolve_uri_client_cb(AvahiClient *client,
++ AvahiClientState state,
++ void *simple_poll);
++static void avahi_resolve_uri_resolver_cb(AvahiServiceResolver *resolver,
++ AvahiIfIndex interface,
++ AvahiProtocol protocol,
++ AvahiResolverEvent event,
++ const char *name,
++ const char *type,
++ const char *domain,
++ const char *host_name,
++ const AvahiAddress *address,
++ uint16_t port,
++ AvahiStringList *txt,
++ AvahiLookupResultFlags flags,
++ void *context);
++#endif /* HAVE_AVAHI */
+
+ /*
+ * 'httpAssembleURI()' - Assemble a uniform resource identifier from its
+@@ -1431,6 +1458,9 @@
+
+ if (strstr(hostname, "._tcp"))
+ {
++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
++ char *regtype, /* Pointer to type in hostname */
++ *domain; /* Pointer to domain in hostname */
+ #ifdef HAVE_DNSSD
+ # 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;
++ int error;
++ struct
++ {
++ AvahiSimplePoll *poll;
++ _http_uribuf_t uribuf;
++ } user_data;
++#endif /* HAVE_DNSSD */
++
+
+ 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.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';
+
+ DEBUG_printf(("6_httpResolveURI: Resolving hostname=\"%s\", regtype=\"%s\", "
+@@ -1501,6 +1549,7 @@
+
+ uri = NULL;
+
++#ifdef HAVE_DNSSD
+ if (DNSServiceCreateConnection(&ref) == kDNSServiceErr_NoError)
+ {
+ localref = ref;
+@@ -1608,6 +1657,36 @@
+
+ DNSServiceRefDeallocate(ref);
+ }
++#else /* HAVE_AVAHI */
++ if ((simple_poll = avahi_simple_poll_new ()) != NULL)
++ {
++ if ((client = avahi_client_new (avahi_simple_poll_get (simple_poll),
++ 0, avahi_resolve_uri_client_cb,
++ &simple_poll, &error)) != NULL)
++ {
++ user_data.poll = simple_poll;
++ if (avahi_service_resolver_new (client, AVAHI_IF_UNSPEC,
++ AVAHI_PROTO_UNSPEC, hostname,
++ regtype, domain, AVAHI_PROTO_UNSPEC, 0,
++ avahi_resolve_uri_resolver_cb,
++ &user_data) != NULL)
++ {
++ avahi_simple_poll_loop (simple_poll);
++
++ /*
++ * Collect the result.
++ */
++
++ if (resolved_uri[0])
++ uri = resolved_uri;
++ }
++
++ avahi_client_free (client);
++ }
++
++ avahi_simple_poll_free (simple_poll);
++ }
++#endif /* HAVE_DNSSD */
+
+ if (options & _HTTP_RESOLVE_STDERR)
+ {
+@@ -1619,13 +1698,13 @@
+ fputs("STATE: -connecting-to-device,offline-report\n", stderr);
+ }
+
+-#else
++#else /* HAVE_DNSSD || HAVE_AVAHI */
+ /*
+ * No DNS-SD support...
+ */
+
+ uri = NULL;
+-#endif /* HAVE_DNSSD */
++#endif /* HAVE_DNSSD || HAVE_AVAHI */
+
+ 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,
++ void *simple_poll)
++{
++ DEBUG_printf(("avahi_resolve_uri_client_callback(client=%p, state=%d, "
++ "simple_poll=%p)\n", client, state, simple_poll));
++
++ /*
++ * If the connection drops, quit.
++ */
++
++ if (state == AVAHI_CLIENT_FAILURE)
++ 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,
++ AvahiProtocol protocol,
++ AvahiResolverEvent event,
++ const char *name,
++ const char *type,
++ const char *domain,
++ const char *host_name,
++ const AvahiAddress *address,
++ uint16_t port,
++ AvahiStringList *txt,
++ AvahiLookupResultFlags flags,
++ void *context)
++{
++ const char *scheme; /* URI scheme */
++ char rp[256]; /* Remote printer */
++ AvahiStringList *pair;
++ char *value;
++ size_t valueLen = 0;
++ char addr[AVAHI_ADDRESS_STR_MAX];
++ struct
++ {
++ AvahiSimplePoll *poll;
++ _http_uribuf_t uribuf;
++ } *poll_uribuf = context;
++
++ DEBUG_printf(("avahi_resolve_uri_resolver_callback(resolver=%p, "
++ "interface=%d, protocol=%d, event=%d, name=\"%s\", "
++ "type=\"%s\", domain=\"%s\", host_name=\"%s\", address=%p, "
++ "port=%d, txt=%p, flags=%d, context=%p)\n",
++ resolver, interface, protocol, event, name, type, domain,
++ host_name, address, port, txt, flags, context));
++
++ if (event != AVAHI_RESOLVER_FOUND)
++ {
++ avahi_service_resolver_free (resolver);
++ avahi_simple_poll_quit (poll_uribuf->poll);
++ return;
++ }
++
++ /*
++ * Figure out the scheme from the full name...
++ */
++
++ if (strstr(type, "_ipp."))
++ scheme = "ipp";
++ else if (strstr(type, "_printer."))
++ scheme = "lpd";
++ else if (strstr(type, "_pdl-datastream."))
++ scheme = "socket";
++ else
++ scheme = "riousbprint";
++
++ /*
++ * Extract the "remote printer key from the TXT record...
++ */
++
++ if ((pair = avahi_string_list_find (txt, "rp")) != NULL)
++ {
++ avahi_string_list_get_pair (pair, NULL, &value, &valueLen);
++ rp[0] = '/';
++ memcpy (rp + 1, value, valueLen);
++ rp[valueLen + 1] = '\0';
++ }
++ else
++ rp[0] = '\0';
++
++ /*
++ * Assemble the final device URI...
++ */
++
++ avahi_address_snprint (addr, AVAHI_ADDRESS_STR_MAX, address);
++ httpAssembleURI(HTTP_URI_CODING_ALL, poll_uribuf->uribuf.buffer,
++ poll_uribuf->uribuf.bufsize, scheme, NULL,
++ addr, port, rp);
++ DEBUG_printf(("avahi_resolve_uri_resolver_callback: Resolved URI is \"%s\"\n",
++ poll_uribuf->uribuf.buffer));
++ avahi_simple_poll_quit (poll_uribuf->poll);
++}
++#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 */
++
+ /*
+ * 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/~mtjm/cups-usblp/cups-no-export-ssllibs.patch b/~mtjm/cups-usblp/cups-no-export-ssllibs.patch
new file mode 100644
index 000000000..9be3c819b
--- /dev/null
+++ b/~mtjm/cups-usblp/cups-no-export-ssllibs.patch
@@ -0,0 +1,12 @@
+diff -up cups-1.5b1/config-scripts/cups-ssl.m4.no-export-ssllibs cups-1.5b1/config-scripts/cups-ssl.m4
+--- cups-1.5b1/config-scripts/cups-ssl.m4.no-export-ssllibs 2011-05-11 02:52:08.000000000 +0200
++++ cups-1.5b1/config-scripts/cups-ssl.m4 2011-05-23 17:47:27.000000000 +0200
+@@ -164,7 +164,7 @@ AC_SUBST(IPPALIASES)
+ AC_SUBST(SSLFLAGS)
+ AC_SUBST(SSLLIBS)
+
+-EXPORT_SSLLIBS="$SSLLIBS"
++EXPORT_SSLLIBS=""
+ AC_SUBST(EXPORT_SSLLIBS)
+
+
diff --git a/~mtjm/cups-usblp/cups-no-gcrypt.patch b/~mtjm/cups-usblp/cups-no-gcrypt.patch
new file mode 100644
index 000000000..42f71d0d4
--- /dev/null
+++ b/~mtjm/cups-usblp/cups-no-gcrypt.patch
@@ -0,0 +1,38 @@
+diff -ruN cups-1.4.7.orig//config-scripts/cups-ssl.m4 cups-1.4.7/config-scripts/cups-ssl.m4
+--- 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
+ 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
+- if $PKGCONFIG --exists gcrypt; then
+- SSLLIBS="$SSLLIBS `$PKGCONFIG --libs gcrypt`"
+- SSLFLAGS="$SSLFLAGS `$PKGCONFIG --cflags gcrypt`"
+- elif test "x$LIBGCRYPTCONFIG" != x; then
+- SSLLIBS="$SSLLIBS `$LIBGCRYPTCONFIG --libs`"
+- SSLFLAGS="$SSLFLAGS `$LIBGCRYPTCONFIG --cflags`"
+- fi
+- fi
+ fi
+
+ dnl Check for the OpenSSL library last...
+--- 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>
+ # elif defined(HAVE_CDSASSL)
+ # include <CoreFoundation/CoreFoundation.h>
+ # include <Security/Security.h>
diff --git a/~mtjm/cups-usblp/cups.install b/~mtjm/cups-usblp/cups.install
new file mode 100644
index 000000000..47c3d9b82
--- /dev/null
+++ b/~mtjm/cups-usblp/cups.install
@@ -0,0 +1,26 @@
+post_install() {
+ if [ -x usr/bin/xdg-icon-resource ]; then
+ xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
+ fi
+ echo ">> If you use an HTTPS connection to CUPS, the first time you access"
+ echo ">> the interface it may take a very long time before the site comes up."
+ echo ">> This is because the first request triggers the generation of the CUPS"
+ echo ">> SSL certificates which can be a very time-consuming job."
+}
+
+post_upgrade() {
+ if [ -x usr/bin/xdg-icon-resource ]; then
+ xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
+ fi
+ if [ "`vercmp $2 1.4.7-2`" -lt 0 ]; then
+ # important upgrade notice
+ echo "daemon script has been renamed to /etc/rc.d/cupsd"
+ echo "change your entry in /etc/rc.conf"
+ fi
+}
+
+post_remove() {
+ if [ -x usr/bin/xdg-icon-resource ]; then
+ xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
+ fi
+}
diff --git a/~mtjm/cups-usblp/cups.logrotate b/~mtjm/cups-usblp/cups.logrotate
new file mode 100644
index 000000000..9c49bbdaf
--- /dev/null
+++ b/~mtjm/cups-usblp/cups.logrotate
@@ -0,0 +1,8 @@
+/var/log/cups/*log {
+ missingok
+ notifempty
+ delaycompress
+ postrotate
+ /bin/kill -HUP `cat /var/run/cups.pid 2>/dev/null` 2>/dev/null || true
+ endscript
+}
diff --git a/~mtjm/cups-usblp/cups.pam b/~mtjm/cups-usblp/cups.pam
new file mode 100644
index 000000000..53724d1f8
--- /dev/null
+++ b/~mtjm/cups-usblp/cups.pam
@@ -0,0 +1,3 @@
+auth required pam_unix.so
+account required pam_unix.so
+session required pam_unix.so