summaryrefslogtreecommitdiffstats
path: root/extra
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@gmail.com>2009-02-12 09:24:35 +0000
committerCarlo Landmeter <clandmeter@gmail.com>2009-02-12 09:24:35 +0000
commitdcd5b5be2cbd0a0505dc4b20fdeef4fef06ce8dc (patch)
tree45febbc2fbb58b2cd8fd00e7a53ad5ffca134563 /extra
parentf9e132166ed98a4bf79f2defd8acbdf2315fe0e9 (diff)
parenta2e7b0043cd02246557d9743e4ca725ac0013b2e (diff)
downloadaports-dcd5b5be2cbd0a0505dc4b20fdeef4fef06ce8dc.tar.bz2
aports-dcd5b5be2cbd0a0505dc4b20fdeef4fef06ce8dc.tar.xz
Merge commit 'ncopa/master'
Diffstat (limited to 'extra')
-rw-r--r--extra/acf-apk-tools/APKBUILD16
-rw-r--r--extra/acf-core/APKBUILD15
-rw-r--r--extra/acf-gnats/APKBUILD15
-rw-r--r--extra/acf-skins/APKBUILD15
-rw-r--r--extra/alsa-lib/APKBUILD19
-rw-r--r--extra/apr-util/APKBUILD32
-rw-r--r--extra/apr/APKBUILD35
-rw-r--r--extra/bitlib/APKBUILD21
-rw-r--r--extra/bzip2/APKBUILD40
-rw-r--r--extra/bzip2/bzip2-1.0.4-POSIX-shell.patch21
-rw-r--r--extra/bzip2/bzip2-1.0.4-makefile-CFLAGS.patch25
-rw-r--r--extra/bzip2/bzip2-1.0.4-man-links.patch12
-rw-r--r--extra/bzip2/bzip2-1.0.4-saneso.patch13
-rw-r--r--extra/ca-certificates/APKBUILD34
-rw-r--r--extra/ca-certificates/ca-certificates-20080514-warn-on-bad-symlinks.patch20
-rw-r--r--extra/ca-certificates/ca-certificates.install11
-rw-r--r--extra/cdrkit/APKBUILD30
-rw-r--r--extra/cgit/APKBUILD27
-rw-r--r--extra/chrony/APKBUILD54
-rw-r--r--extra/chrony/chrony-1.20-chrony.conf.example-gentoo.diff46
-rw-r--r--extra/chrony/chrony-1.20-conf.c-gentoo.diff11
-rw-r--r--extra/chrony/chrony-1.21-makefile.diff15
-rw-r--r--extra/chrony/chrony-1.23-sources.diff56
-rw-r--r--extra/chrony/chronyd.confd18
-rw-r--r--extra/chrony/chronyd.initd58
-rw-r--r--extra/clamav/APKBUILD39
-rw-r--r--extra/clamav/clamav-0.94.2-nls.patch71
-rw-r--r--extra/clamav/clamav.confd9
-rw-r--r--extra/clamav/clamav.initd39
-rw-r--r--extra/clamav/clamav.install10
-rw-r--r--extra/clamsmtp/APKBUILD34
-rw-r--r--extra/clamsmtp/clamsmtp.confd5
-rw-r--r--extra/clamsmtp/clamsmtp.initd25
-rw-r--r--extra/cmake/APKBUILD33
-rw-r--r--extra/db/APKBUILD31
-rw-r--r--extra/db46/APKBUILD56
-rw-r--r--extra/db46/patch.4.6.21.190
-rw-r--r--extra/db46/patch.4.6.21.227
-rw-r--r--extra/db46/patch.4.6.21.353
-rw-r--r--extra/db46/patch.4.6.21.41414
-rw-r--r--extra/diffutils/APKBUILD25
-rw-r--r--extra/dnsmasq/APKBUILD35
-rw-r--r--extra/dnsmasq/dnsmasq.confd4
-rw-r--r--extra/dnsmasq/dnsmasq.initd38
-rw-r--r--extra/dropbear/APKBUILD38
-rw-r--r--extra/dropbear/dropbear.confd6
-rw-r--r--extra/dropbear/dropbear.initd36
-rw-r--r--extra/dtach/APKBUILD23
-rw-r--r--extra/email/APKBUILD25
-rw-r--r--extra/email/email-3.1.0-doc.patch10
-rw-r--r--extra/email/email-3.1.0-ldflags.patch11
-rw-r--r--extra/ethtool/APKBUILD21
-rw-r--r--extra/fping/APKBUILD23
-rw-r--r--extra/freetype/10-bytecode.patch29
-rw-r--r--extra/freetype/20-enable-spr.patch11
-rw-r--r--extra/freetype/30-enable-valid.patch20
-rw-r--r--extra/freetype/40-memcpy-fix.patch14
-rw-r--r--extra/freetype/APKBUILD41
-rw-r--r--extra/gd/APKBUILD31
-rw-r--r--extra/gdb/50_all_gdb-pie-1.patch1330
-rw-r--r--extra/gdb/50_all_gdb-pie-2.patch2122
-rw-r--r--extra/gdb/APKBUILD41
-rw-r--r--extra/gettext/APKBUILD23
-rw-r--r--extra/glib/APKBUILD22
-rw-r--r--extra/gnats/APKBUILD32
-rw-r--r--extra/gnats/gnats.install8
-rw-r--r--extra/gnupg/APKBUILD21
-rw-r--r--extra/groff/APKBUILD22
-rw-r--r--extra/gzip/APKBUILD24
-rw-r--r--extra/haserl/APKBUILD21
-rw-r--r--extra/htop/APKBUILD21
-rw-r--r--extra/ipsec-tools/APKBUILD40
-rw-r--r--extra/ipsec-tools/racoon.confd19
-rw-r--r--extra/ipsec-tools/racoon.initd58
-rw-r--r--extra/irssi-svn/APKBUILD33
-rw-r--r--extra/irssi/APKBUILD24
-rw-r--r--extra/json4lua/APKBUILD15
-rw-r--r--extra/libassuan/APKBUILD18
-rw-r--r--extra/libcap/APKBUILD18
-rw-r--r--extra/libconfig/APKBUILD22
-rw-r--r--extra/libgcrypt/APKBUILD29
-rw-r--r--extra/libgcrypt/nocxx.patch15
-rw-r--r--extra/libgpg-error/APKBUILD32
-rw-r--r--extra/libgpg-error/nocxx.patch15
-rw-r--r--extra/libiconv/APKBUILD21
-rw-r--r--extra/libjpeg/APKBUILD35
-rw-r--r--extra/libksba/APKBUILD20
-rw-r--r--extra/libmcrypt/APKBUILD24
-rw-r--r--extra/libnet/APKBUILD36
-rw-r--r--extra/libnet/libnet-1.1.2.1-autotools.patch79
-rw-r--r--extra/libnet/libnet-1.1.2.1-fix-chksum.patch27
-rw-r--r--extra/libogg/APKBUILD27
-rw-r--r--extra/libogg/nocxx.patch15
-rw-r--r--extra/libpng/APKBUILD25
-rw-r--r--extra/libxml2/APKBUILD26
-rw-r--r--extra/lighttpd/APKBUILD79
-rw-r--r--extra/lighttpd/lighttpd.conf321
-rw-r--r--extra/lighttpd/lighttpd.confd12
-rw-r--r--extra/lighttpd/lighttpd.initd67
-rw-r--r--extra/lighttpd/lighttpd.install14
-rw-r--r--extra/lighttpd/lighttpd.logrotate17
-rw-r--r--extra/lighttpd/mime-types.conf76
-rw-r--r--extra/lighttpd/mod_cgi.conf33
-rw-r--r--extra/lighttpd/mod_fastcgi.conf17
-rw-r--r--extra/lighttpd/spawn-fcgi.confd35
-rw-r--r--extra/lighttpd/spawn-fcgi.initd51
-rw-r--r--extra/lpc/APKBUILD18
-rw-r--r--extra/lua/APKBUILD48
-rw-r--r--extra/lua/lua-5.1-make.patch64
-rw-r--r--extra/lua/lua-5.1-module_paths.patch30
-rw-r--r--extra/luaposix/APKBUILD18
-rw-r--r--extra/man/APKBUILD33
-rw-r--r--extra/man/man-troff.patch16
-rwxr-xr-xextra/man/whatis.periodic.daily9
-rw-r--r--extra/md5/APKBUILD19
-rw-r--r--extra/mini_httpd/APKBUILD45
-rw-r--r--extra/mini_httpd/mini_httpd.conf.sample48
-rw-r--r--extra/mini_httpd/mini_httpd.confd26
-rw-r--r--extra/mini_httpd/mini_httpd.initd29
-rw-r--r--extra/ncftp/APKBUILD38
-rw-r--r--extra/ncftp/ncftp.install11
-rw-r--r--extra/neon/APKBUILD27
-rw-r--r--extra/oidentd/APKBUILD34
-rw-r--r--extra/oidentd/oidentd.conf22
-rw-r--r--extra/oidentd/oidentd.confd4
-rw-r--r--extra/oidentd/oidentd.initd42
-rw-r--r--extra/opennhrp/APKBUILD33
-rw-r--r--extra/opennhrp/opennhrp-0.9.2-cflags.patch15
-rw-r--r--extra/opennhrp/opennhrp-0.9.2-fix-false-assert.patch13
-rw-r--r--extra/opennhrp/opennhrp.confd2
-rwxr-xr-xextra/opennhrp/opennhrp.initd32
-rw-r--r--extra/pcre/APKBUILD25
-rw-r--r--extra/pinentry/APKBUILD42
-rw-r--r--extra/pingu/APKBUILD23
-rw-r--r--extra/portmap/APKBUILD38
-rw-r--r--extra/portmap/portmap-6.0-tcpd.patch18
-rw-r--r--extra/portmap/portmap.confd5
-rw-r--r--extra/portmap/portmap.initd46
-rw-r--r--extra/portmap/portmap.install3
-rw-r--r--extra/postfix/APKBUILD56
-rw-r--r--extra/postfix/postfix.initd48
-rw-r--r--extra/postfix/postfix.install13
-rw-r--r--extra/pth/APKBUILD35
-rw-r--r--extra/pth/pth-2.0.5-parallelfix.patch15
-rw-r--r--extra/pth/pth-2.0.6-ldflags.patch17
-rw-r--r--extra/pth/pth-2.0.6-sigstack.patch22
-rw-r--r--extra/python/APKBUILD33
-rw-r--r--extra/python/python-2.6-internal-expat.patch33
-rw-r--r--extra/rsync/APKBUILD36
-rw-r--r--extra/rsync/rsyncd.conf10
-rw-r--r--extra/rsync/rsyncd.confd5
-rw-r--r--extra/rsync/rsyncd.initd23
-rw-r--r--extra/rsync/rsyncd.logrotate9
-rw-r--r--extra/run-parts/APKBUILD19
-rw-r--r--extra/sed/APKBUILD24
-rw-r--r--extra/sic/APKBUILD20
-rw-r--r--extra/sntpc/APKBUILD26
-rw-r--r--extra/sntpc/sntpc.confd9
-rw-r--r--extra/sntpc/sntpc.initd30
-rw-r--r--extra/sqlite/APKBUILD31
-rw-r--r--extra/sqlite/license.txt33
-rw-r--r--extra/ssmtp/APKBUILD32
-rw-r--r--extra/ssmtp/CVE-2008-3962.patch14
-rw-r--r--extra/ssmtp/generate_config.patch49
-rw-r--r--extra/strace/APKBUILD20
-rw-r--r--extra/subversion/APKBUILD38
-rw-r--r--extra/subversion/subversion.install10
-rw-r--r--extra/subversion/svnserve.confd10
-rw-r--r--extra/subversion/svnserve.initd44
-rw-r--r--extra/tar/APKBUILD22
-rw-r--r--extra/tcl/APKBUILD33
-rw-r--r--extra/tcpdump/APKBUILD24
-rw-r--r--extra/transmission/APKBUILD40
-rw-r--r--extra/transmission/transmission-1.34-configure-no-nls.patch47
-rw-r--r--extra/transmission/transmission-daemon.confd18
-rw-r--r--extra/transmission/transmission-daemon.initd21
-rw-r--r--extra/transmission/transmission.install9
-rw-r--r--extra/uiconv/APKBUILD17
-rw-r--r--extra/unfs3/APKBUILD22
-rw-r--r--extra/valgrind/APKBUILD36
-rw-r--r--extra/valgrind/valgrind-3.4.0-uclibc.patch12
-rw-r--r--extra/vim/APKBUILD211
-rw-r--r--extra/vim/vimrc15
-rw-r--r--extra/wget/APKBUILD26
-rw-r--r--extra/zip/10-zip-3.0-build.patch36
-rw-r--r--extra/zip/20-zip-3.0-exec-stack.patch22
-rw-r--r--extra/zip/30-zip-3.0-pic.patch15
-rw-r--r--extra/zip/APKBUILD30
-rw-r--r--extra/zonenotify/APKBUILD18
189 files changed, 10432 insertions, 0 deletions
diff --git a/extra/acf-apk-tools/APKBUILD b/extra/acf-apk-tools/APKBUILD
new file mode 100644
index 00000000..b195a2f1
--- /dev/null
+++ b/extra/acf-apk-tools/APKBUILD
@@ -0,0 +1,16 @@
+# Contributor: Mika Havela <mika.havela@gmail.com>
+pkgname=acf-apk-tools
+pkgver=0.1.5
+pkgrel=0
+pkgdesc="ACF module for apk"
+url="http://dev.alpinelinux.org/alpine/acf"
+license="GPL-2"
+depends="acf-core lua luaposix"
+source="http://dev.alpinelinux.org/alpine/acf/apk-tools/$pkgname-$pkgver.tar.bz2"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ make DESTDIR="$pkgdir" install
+}
+
+md5sums="6f5bb27ebf5e7b85cf3e78bbb06bea2d acf-apk-tools-0.1.5.tar.bz2"
diff --git a/extra/acf-core/APKBUILD b/extra/acf-core/APKBUILD
new file mode 100644
index 00000000..ce54b56b
--- /dev/null
+++ b/extra/acf-core/APKBUILD
@@ -0,0 +1,15 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=acf-core
+pkgver=0.4.20
+pkgrel=1
+pkgdesc="A web-based system administration interface framework"
+url="http://dev.alpinelinux.org/alpine/acf"
+license="GPL-2"
+depends="acf-skins lua luaposix md5"
+source="http://dev.alpinelinux.org/alpine/acf/core/$pkgname-$pkgver.tar.bz2"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ make DESTDIR="$pkgdir" install
+}
+md5sums="8c0721305651203f6e188bb7cfece380 acf-core-0.4.20.tar.bz2"
diff --git a/extra/acf-gnats/APKBUILD b/extra/acf-gnats/APKBUILD
new file mode 100644
index 00000000..b93338b1
--- /dev/null
+++ b/extra/acf-gnats/APKBUILD
@@ -0,0 +1,15 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=acf-gnats
+pkgver=0.3.5
+pkgrel=0
+pkgdesc="ACF module for gnats"
+url="http://dev.alpinelinux.org/alpine/acf"
+license="GPL-2"
+depends="acf-core gnats lua"
+source="http://dev.alpinelinux.org/alpine/acf/gnats/$pkgname-$pkgver.tar.bz2"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ make DESTDIR="$pkgdir" install
+}
+md5sums="0cc0496301fd6a8287e767fa13363519 acf-gnats-0.3.5.tar.bz2"
diff --git a/extra/acf-skins/APKBUILD b/extra/acf-skins/APKBUILD
new file mode 100644
index 00000000..08551f30
--- /dev/null
+++ b/extra/acf-skins/APKBUILD
@@ -0,0 +1,15 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=acf-skins
+pkgver=0.1.6
+pkgrel=0
+pkgdesc="Skins for ACF"
+url="http://dev.alpinelinux.org/alpine/acf"
+license="GPL-2"
+depends=""
+source="http://dev.alpinelinux.org/alpine/acf/skins/$pkgname-$pkgver.tar.bz2"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ make DESTDIR="$pkgdir" install
+}
+md5sums="d93b59939b2d1e63ccbd0af0ad840d7a acf-skins-0.1.6.tar.bz2"
diff --git a/extra/alsa-lib/APKBUILD b/extra/alsa-lib/APKBUILD
new file mode 100644
index 00000000..d253ca85
--- /dev/null
+++ b/extra/alsa-lib/APKBUILD
@@ -0,0 +1,19 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=alsa-lib
+pkgver=1.0.18
+pkgrel=0
+pkgdesc="An alternative implementation of Linux sound support"
+url="http://www.alsa-project.org"
+license="GPL"
+depends="uclibc"
+subpackages="$pkgname-dev"
+source="ftp://ftp.alsa-project.org/pub/lib/$pkgname-$pkgver.tar.bz2"
+
+build ()
+{
+ cd "$srcdir/$pkgname-$pkgver"
+ ./configure --prefix=/usr --disable-python
+ make || return 1
+ make -j1 DESTDIR="$pkgdir" install
+}
+md5sums="de60df7541fafe8c6a3397e0f105ff0e alsa-lib-1.0.18.tar.bz2"
diff --git a/extra/apr-util/APKBUILD b/extra/apr-util/APKBUILD
new file mode 100644
index 00000000..e41878c3
--- /dev/null
+++ b/extra/apr-util/APKBUILD
@@ -0,0 +1,32 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=apr-util
+pkgver=1.3.4
+pkgrel=0
+pkgdesc="The Apache Portable Runtime"
+url="http://apr.apache.org/"
+license="APACHE"
+depends="apr expat libuuid"
+subpackages="$pkgname-dev"
+makedepends="apr-dev expat-dev e2fsprogs-dev"
+source="http://www.apache.org/dist/apr/$pkgname-$pkgver.tar.bz2"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ ./configure --prefix=/usr \
+ --with-apr=/usr \
+ --without-pgsql \
+ --without-mysql \
+ --without-sqlite2 \
+ --without-sqlite3 \
+ --without-berkeley-db \
+ --without-gdbm \
+ --without-ldap-lib
+
+ make || return 1
+ make DESTDIR="$pkgdir" install
+
+ # we dont need this one
+ rm "$pkgdir"/usr/lib/*.exp
+}
+
+md5sums="adfbe525cf3914cf769340e8f6a6d14b apr-util-1.3.4.tar.bz2"
diff --git a/extra/apr/APKBUILD b/extra/apr/APKBUILD
new file mode 100644
index 00000000..275d6680
--- /dev/null
+++ b/extra/apr/APKBUILD
@@ -0,0 +1,35 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=apr
+pkgver=1.3.3
+pkgrel=0
+pkgdesc="The Apache Portable Runtime"
+url="http://apr.apache.org/"
+license="APACHE"
+depends="libuuid"
+makedepends="e2fsprogs-dev"
+subpackages="$pkgname-dev"
+source="http://www.apache.org/dist/$pkgname/$pkgname-$pkgver.tar.bz2"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ ./configure --prefix=/usr \
+ --datadir=/usr/share \
+ --enable-nonportable-atomics \
+ --with-devrandom=/dev/urandom
+ make || return 1
+ make DESTDIR=${pkgdir} install
+}
+
+# basicly everything thats not a *.so* file belongs to the -dev package
+# we override the pre-defined func.
+dev() {
+ local i
+ depends="$pkgname"
+ mkdir -p "$subpkgdir"
+ mv "$pkgdir"/* "$subpkgdir"/
+ mkdir -p "$pkgdir"/usr/lib
+ mv "$subpkgdir"/usr/lib/*.so* "$pkgdir"/usr/lib/
+ return 0
+}
+
+md5sums="2090c21dee4f0eb1512604127dcd158f apr-1.3.3.tar.bz2"
diff --git a/extra/bitlib/APKBUILD b/extra/bitlib/APKBUILD
new file mode 100644
index 00000000..91400afc
--- /dev/null
+++ b/extra/bitlib/APKBUILD
@@ -0,0 +1,21 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=bitlib
+pkgver=25
+pkgrel=0
+pkgdesc="A lua library providing bitwise operations"
+url="http://luaforge.net/projects/bitlib"
+license="MIT/X11"
+depends="uclibc lua"
+makedepends="lua-dev"
+subpackages="$pkgname-dev"
+source=http://luaforge.net/frs/download.php/3065/bitlib-$pkgver.tar.gz
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr
+ make || return 1
+ make DESTDIR="$pkgdir" install
+}
+
+md5sums="18f124c80c685f2269296a7172e600fe bitlib-25.tar.gz"
diff --git a/extra/bzip2/APKBUILD b/extra/bzip2/APKBUILD
new file mode 100644
index 00000000..491eefe1
--- /dev/null
+++ b/extra/bzip2/APKBUILD
@@ -0,0 +1,40 @@
+pkgname=bzip2
+pkgver=1.0.5
+pkgrel=0
+pkgdesc="A high-quality data compression program"
+url="http://sources.redhat.com/bzip2"
+license="BZIP2"
+depends="uclibc"
+source="http://www.bzip.org/$pkgver/$pkgname-$pkgver.tar.gz
+ bzip2-1.0.4-POSIX-shell.patch
+ bzip2-1.0.4-makefile-CFLAGS.patch
+ bzip2-1.0.4-man-links.patch
+ bzip2-1.0.4-saneso.patch
+ "
+subpackages="$pkgname-dev $pkgname-doc"
+
+build () {
+ local i
+ cd "$srcdir"/$pkgname-$pkgver
+ for i in ../*.patch; do
+ msg "Applying ${i##*/}"
+ patch -p1 < $i || return 1
+ done
+
+ # Fix man path
+ # Generate relative symlinks
+ sed -i \
+ -e 's:\$(PREFIX)/man:\$(PREFIX)/share/man:g' \
+ -e 's:ln -s -f $(PREFIX)/bin/:ln -s :' \
+ Makefile || return 1
+
+ # fixup broken version stuff
+ sed -i \
+ -e "s:1\.0\.4:$pkgver:" \
+ bzip2.1 bzip2.txt Makefile-libbz2_so manual.* || return 1
+
+ make -f Makefile-libbz2_so all || return 1
+ make all || return 1
+ make PREFIX="$pkgdir"/usr install || return 1
+}
+md5sums="3c15a0c8d1d3ee1c46a1634d00617b1a bzip2-1.0.5.tar.gz"
diff --git a/extra/bzip2/bzip2-1.0.4-POSIX-shell.patch b/extra/bzip2/bzip2-1.0.4-POSIX-shell.patch
new file mode 100644
index 00000000..74f8df00
--- /dev/null
+++ b/extra/bzip2/bzip2-1.0.4-POSIX-shell.patch
@@ -0,0 +1,21 @@
+bzgrep uses !/bin/sh but then uses the bashism ${var//} so replace those
+with calls to sed so POSIX shells work
+
+http://bugs.gentoo.org/193365
+
+--- a/bzgrep
++++ b/bzgrep
+@@ -63,10 +63,9 @@
+ bzip2 -cdfq "$i" | $grep $opt "$pat"
+ r=$?
+ else
+- j=${i//\\/\\\\}
+- j=${j//|/\\|}
+- j=${j//&/\\&}
+- j=`printf "%s" "$j" | tr '\n' ' '`
++ # the backslashes here are doubled up as we have to escape each one for the
++ # shell and then escape each one for the sed expression
++ j=`printf "%s" "${i}" | sed -e 's:\\\\:\\\\\\\\:g' -e 's:[|]:\\\\|:g' -e 's:[&]:\\\\&:g' | tr '\n' ' '`
+ bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
+ r=$?
+ fi
diff --git a/extra/bzip2/bzip2-1.0.4-makefile-CFLAGS.patch b/extra/bzip2/bzip2-1.0.4-makefile-CFLAGS.patch
new file mode 100644
index 00000000..85a3c6af
--- /dev/null
+++ b/extra/bzip2/bzip2-1.0.4-makefile-CFLAGS.patch
@@ -0,0 +1,25 @@
+--- a/Makefile
++++ b/Makefile
+@@ -18,10 +18,9 @@
+ CC=gcc
+ AR=ar
+ RANLIB=ranlib
+-LDFLAGS=
+
+ BIGFILES=-D_FILE_OFFSET_BITS=64
+-CFLAGS=-Wall -Winline -O2 -g $(BIGFILES)
++CFLAGS+=-Wall -Winline $(BIGFILES)
+
+ # Where you want it installed when you do 'make install'
+ PREFIX=/usr/local
+--- a/Makefile-libbz2_so
++++ b/Makefile-libbz2_so
+@@ -24,7 +24,7 @@
+ SHELL=/bin/sh
+ CC=gcc
+ BIGFILES=-D_FILE_OFFSET_BITS=64
+-CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES)
++CFLAGS+=-fpic -fPIC -Wall -Winline $(BIGFILES)
+
+ OBJS= blocksort.o \
+ huffman.o \
diff --git a/extra/bzip2/bzip2-1.0.4-man-links.patch b/extra/bzip2/bzip2-1.0.4-man-links.patch
new file mode 100644
index 00000000..2427d6a7
--- /dev/null
+++ b/extra/bzip2/bzip2-1.0.4-man-links.patch
@@ -0,0 +1,12 @@
+http://bugs.gentoo.org/172986
+
+--- bzip2-1.0.4/Makefile
++++ bzip2-1.0.4/Makefile
+@@ -85,4 +85,7 @@
+ cp -f bzip2.1 $(PREFIX)/share/man/man1
+ chmod a+r $(PREFIX)/share/man/man1/bzip2.1
++ ln -s bzip2.1 $(PREFIX)/share/man/man1/bunzip2.1
++ ln -s bzip2.1 $(PREFIX)/share/man/man1/bzcat.1
++ ln -s bzip2.1 $(PREFIX)/share/man/man1/bzip2recover.1
+ cp -f bzlib.h $(PREFIX)/include
+ chmod a+r $(PREFIX)/include/bzlib.h
diff --git a/extra/bzip2/bzip2-1.0.4-saneso.patch b/extra/bzip2/bzip2-1.0.4-saneso.patch
new file mode 100644
index 00000000..9a71342c
--- /dev/null
+++ b/extra/bzip2/bzip2-1.0.4-saneso.patch
@@ -0,0 +1,13 @@
+--- a/Makefile-libbz2_so
++++ b/Makefile-libbz2_so
+@@ -35,8 +35,8 @@
+ bzlib.o
+
+ all: $(OBJS)
+- $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.4 $(OBJS)
+- $(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.4
++ $(CC) $(LDFLAGS) -shared -Wl,-soname -Wl,libbz2.so.1 -o libbz2.so.1.0.4 $(OBJS)
++ $(CC) $(LDFLAGS) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.4
+ rm -f libbz2.so.1.0
+ ln -s libbz2.so.1.0.4 libbz2.so.1.0
+
diff --git a/extra/ca-certificates/APKBUILD b/extra/ca-certificates/APKBUILD
new file mode 100644
index 00000000..1ff7a0f4
--- /dev/null
+++ b/extra/ca-certificates/APKBUILD
@@ -0,0 +1,34 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=ca-certificates
+pkgver=20080809
+pkgrel=0
+pkgdesc="Common CA certificates PEM files"
+url="http://packages.debian.org/sid/ca-certificates"
+license="MPL GPL"
+depends="run-parts openssl"
+install=ca-certificates.install
+source="http://ftp.no.debian.org/debian/pool/main/c/$pkgname/${pkgname}_${pkgver}_all.deb
+ $pkgname-20080514-warn-on-bad-symlinks.patch
+ $install
+ "
+
+build () {
+ cd "$srcdir"
+ ar x "$srcdir"/${pkgname}_${pkgver}_all.deb || return 1
+ tar -zxf ./data.tar.gz
+ patch -p0 < "$srcdir"/$pkgname-20080514-warn-on-bad-symlinks.patch \
+ || return 1
+
+ mkdir -p "$pkgdir"
+ cp -Ra usr etc "$pkgdir"/
+ (
+ echo "# Automatically generated by ${pkgname}-${pkgver}-${pkgrel}"
+ echo "# $(date -u)"
+ echo "# Do not edit."
+ cd "$pkgdir"/usr/share/ca-certificates
+ find . -name '*.crt' | sort | cut -b3-
+ ) > "$pkgdir"/etc/ca-certificates.conf
+}
+md5sums="3c44f9c232c2335da26d969c716af44d ca-certificates_20080809_all.deb
+fda24bd37c6cd55b9dd2ea7ef7b59778 ca-certificates-20080514-warn-on-bad-symlinks.patch
+91f1c902b1065cddcd5d58bdcbb3ad7b ca-certificates.install"
diff --git a/extra/ca-certificates/ca-certificates-20080514-warn-on-bad-symlinks.patch b/extra/ca-certificates/ca-certificates-20080514-warn-on-bad-symlinks.patch
new file mode 100644
index 00000000..f9462da6
--- /dev/null
+++ b/extra/ca-certificates/ca-certificates-20080514-warn-on-bad-symlinks.patch
@@ -0,0 +1,20 @@
+http://bugs.gentoo.org/234816
+http://bugs.debian.org/495224
+
+Do not redirect error output from c_rehash in update-ca-certificates, as
+some errors, especially broken symlinks, can cause trouble for some
+applications like current openldap.
+
+2008-08-15 Martin von Gagern <Martin.vGagern@gmx.net>
+
+--- usr/sbin/update-ca-certificates
++++ usr/sbin/update-ca-certificates
+@@ -83,7 +83,7 @@
+ # only run if set of files has changed
+
+ if [ "$verbose" = 0 ]; then
+- c_rehash . > /dev/null 2>&1
++ c_rehash . > /dev/null
+ else
+ c_rehash .
+ fi
diff --git a/extra/ca-certificates/ca-certificates.install b/extra/ca-certificates/ca-certificates.install
new file mode 100644
index 00000000..5e27fe0e
--- /dev/null
+++ b/extra/ca-certificates/ca-certificates.install
@@ -0,0 +1,11 @@
+#!/bin/sh
+post_install() {
+ usr/sbin/update-ca-certificates --fresh &> /dev/null
+}
+
+case "$i" in
+ post_install|post_upgrade)
+ post_install
+ ;;
+esac
+exit 0;
diff --git a/extra/cdrkit/APKBUILD b/extra/cdrkit/APKBUILD
new file mode 100644
index 00000000..332e4723
--- /dev/null
+++ b/extra/cdrkit/APKBUILD
@@ -0,0 +1,30 @@
+pkgname=cdrkit
+pkgver=1.1.8
+pkgrel=1
+pkgdesc="Suite of programs for CD/DVD recording, ISO image creation, and audio CD extraction"
+url="http://cdrkit.org/"
+license="GPL2"
+depends="libcap file bzip2"
+makedepends="cmake libcap-dev bzip2-dev"
+source="http://$pkgname.org/releases/$pkgname-$pkgver.tar.gz"
+subpackages="$pkgname-doc"
+
+build ()
+{
+ cd "$srcdir/cdrkit-$pkgver"
+ make || return 1
+ make PREFIX="$pkgdir/usr" install || return 1
+ cd "$pkgdir/usr/bin"
+ ln -s wodim cdrecord || return 1
+ ln -s readom readcd || return 1
+ ln -s genisoimage mkisofs || return 1
+ ln -s genisoimage mkhybrid || return 1
+ ln -s icedax cdda2wav || return 1
+ cd "$pkgdir/usr/share/man/man1"
+ ln -s wodim.1 cdrecord.1 || return 1
+ ln -s readom.1 readcd.1 || return 1
+ ln -s genisoimage.1 mkisofs.1 || return 1
+ ln -s genisoimage.1 mkhybrid.1 || return 1
+ ln -s icedax.1 cdda2wav.1 || return 1
+}
+md5sums="97a9ea4e1bf59beb12aca649958d8c6c cdrkit-1.1.8.tar.gz"
diff --git a/extra/cgit/APKBUILD b/extra/cgit/APKBUILD
new file mode 100644
index 00000000..75676528
--- /dev/null
+++ b/extra/cgit/APKBUILD
@@ -0,0 +1,27 @@
+pkgname=cgit
+pkgver=0.8.2
+_gitver=1.6.1.1
+pkgdesc="a fast webinterface for git"
+url="http://hjemli.net/git/cgit"
+license=GPL-2
+makedepends="openssl-dev zlib-dev"
+depends="uclibc openssl zlib"
+source="
+ http://hjemli.net/git/cgit/snapshot/$pkgname-$pkgver.tar.gz
+ http://www.kernel.org/pub/software/scm/git/git-$_gitver.tar.bz2
+ "
+
+build() {
+ local makeopts="NO_ICONV=YesPlease NO_CURL=YesPlease"
+ cd "$srcdir/$pkgname-$pkgver"
+ rm -rf git
+ ln -s ../git-$_gitver git
+ make $makeopts || return 1
+ make $makeopts DESTDIR="$pkgdir" \
+ CGIT_SCRIPT_PATH=/usr/share/webapps/cgit \
+ install
+ ln -s cgit.cgi "$pkgdir"/usr/share/webapps/cgit/cgit
+}
+
+md5sums="6887c96f51c7f3bb2b9c8f6c6b0378f5 cgit-0.8.2.tar.gz
+d2b6925cb03e1e33911fdf9392946747 git-1.6.1.1.tar.bz2"
diff --git a/extra/chrony/APKBUILD b/extra/chrony/APKBUILD
new file mode 100644
index 00000000..3c3fbce7
--- /dev/null
+++ b/extra/chrony/APKBUILD
@@ -0,0 +1,54 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=chrony
+pkgver=1.23
+pkgrel=0
+pkgdesc="NTP client and server programs"
+url="http://chrony.sunsite.dk/"
+license="GPL-2"
+depends="uclibc"
+makedepends="texinfo"
+subpackages="$pkgname-doc"
+source="http://chrony.sunsite.dk/download/$pkgname-$pkgver.tar.gz
+ $pkgname-1.20-conf.c-gentoo.diff
+ $pkgname-1.20-chrony.conf.example-gentoo.diff
+ $pkgname-1.21-makefile.diff
+ $pkgname-1.23-sources.diff
+ chronyd.confd
+ chronyd.initd
+ "
+
+build() {
+ local i
+ cd "$srcdir/$pkgname-$pkgver"
+
+ for i in ../*.diff; do
+ msg "Applying $i"
+ patch -p1 < $i || return 1
+ done
+ sed -i "s:/etc/chrony:/etc/chrony/chrony:g" \
+ chrony*.[158] faq.txt chrony.texi || die "sed failed"
+
+ ./configure --prefix=/usr \
+ --infodir=/usr/share/info \
+ --mandir=/usr/share/man \
+ --disable-readline
+
+ make all docs || return 1
+ make DESTDIR="$pkgdir" install
+
+ mv "$pkgdir"/usr/doc "$pkgdir"/usr/share/
+ install -D -m644 examples/*.example "$pkgdir"/usr/share/doc/chrony/
+
+ install -m755 -D "$srcdir"/chronyd.initd "$pkgdir"/etc/init.d/chronyd
+ install -m644 -D "$srcdir"/chronyd.confd "$pkgdir"/etc/conf.d/chronyd
+ mkdir -p "$pkgdir"/var/lib/chrony \
+ "$pkgdir"/var/log/chrony \
+ "$pkgdir"/etc/chrony
+}
+md5sums="ffce77695e55d8efda19ab0b78309c23 chrony-1.23.tar.gz
+bd6bd57363865d3ed0c3187d0c9f7151 chrony-1.20-conf.c-gentoo.diff
+b2a23e02f7af50bebdd5d18bccdedbf0 chrony-1.20-chrony.conf.example-gentoo.diff
+d47015a34b6b2f9eebca77ef939cec72 chrony-1.21-makefile.diff
+39cbce9f66638b67623e1ee6bb0f943f chrony-1.23-sources.diff
+d5c09be46226774d22c08c5a4c28093a chronyd.confd
+dac8aa4913d7c323abfa1719ddd7e5e4 chronyd.initd"
diff --git a/extra/chrony/chrony-1.20-chrony.conf.example-gentoo.diff b/extra/chrony/chrony-1.20-chrony.conf.example-gentoo.diff
new file mode 100644
index 00000000..498b2417
--- /dev/null
+++ b/extra/chrony/chrony-1.20-chrony.conf.example-gentoo.diff
@@ -0,0 +1,46 @@
+--- a/examples/chrony.conf.example.orig 2003-06-16 11:59:01.000000000 -0400
++++ b/examples/chrony.conf.example 2003-06-16 12:00:13.000000000 -0400
+@@ -3,5 +3,5 @@
+ #
+ # This is an example chrony configuration file. You should copy it to
+-# /etc/chrony.conf after uncommenting and editing the options that you
++# /etc/chrony/chrony.conf after uncommenting and editing the options that you
+ # want to enable. I have not included the more obscure options. Refer
+ # to the documentation for these.
+@@ -91,5 +91,5 @@
+ # generally want this, so it is uncommented.
+
+-driftfile /etc/chrony.drift
++driftfile /etc/chrony/chrony.drift
+
+ # If you want to use the program called chronyc to configure aspects of
+@@ -100,5 +100,5 @@
+ # assumed by default.
+
+-keyfile /etc/chrony.keys
++keyfile /etc/chrony/chrony.keys
+
+ # Tell chronyd which numbered key in the file is used as the password
+@@ -158,6 +158,6 @@
+ ! log measurements statistics tracking
+
+-If you have real time clock support enabled (see below), you might want
+-this line instead:
++# If you have real time clock support enabled (see below), you might want
++# this line instead:
+
+ ! log measurements statistics tracking rtc
+@@ -269,5 +269,5 @@
+ # kernel. (Note, these options apply only to Linux.)
+
+-! rtcfile /etc/chrony.rtc
++! rtcfile /etc/chrony/chrony.rtc
+
+ # Your RTC can be set to keep Universal Coordinated Time (UTC) or local
+@@ -285,5 +285,5 @@
+ # using devfs), uncomment and edit the following line.
+
+-! rtcdevice /dev/misc/rtc
++rtcdevice /dev/misc/rtc
+
+ #######################################################################
diff --git a/extra/chrony/chrony-1.20-conf.c-gentoo.diff b/extra/chrony/chrony-1.20-conf.c-gentoo.diff
new file mode 100644
index 00000000..4917d445
--- /dev/null
+++ b/extra/chrony/chrony-1.20-conf.c-gentoo.diff
@@ -0,0 +1,11 @@
+--- a/conf.c.orig Sun May 12 14:07:31 2002
++++ b/conf.c Sun May 12 14:07:52 2002
+@@ -45,7 +45,7 @@
+
+ /* ================================================== */
+
+-#define DEFAULT_CONF_FILE "/etc/chrony.conf"
++#define DEFAULT_CONF_FILE "/etc/chrony/chrony.conf"
+
+ /* ================================================== */
+ /* Forward prototypes */
diff --git a/extra/chrony/chrony-1.21-makefile.diff b/extra/chrony/chrony-1.21-makefile.diff
new file mode 100644
index 00000000..2eec4e84
--- /dev/null
+++ b/extra/chrony/chrony-1.21-makefile.diff
@@ -0,0 +1,15 @@
+--- a/Makefile.in_old 2006-08-12 17:42:57.000000000 +0200
++++ b/Makefile.in 2006-08-12 17:44:35.000000000 +0200
+@@ -68,10 +68,10 @@
+ all : chronyd chronyc
+
+ chronyd : $(OBJS) $(EXTRA_OBJS)
+- $(CC) $(OPTFLAGS) -o chronyd $(OBJS) $(EXTRA_OBJS) $(LIBS) $(EXTRA_LIBS)
++ $(CC) $(OPTFLAGS) $(LDFLAGS) -o chronyd $(OBJS) $(EXTRA_OBJS) $(LIBS) $(EXTRA_LIBS)
+
+ chronyc : $(CLI_OBJS)
+- $(CC) $(OPTFLAGS) -o chronyc $(CLI_OBJS) @READLINE_LINK@ $(LIBS) $(EXTRA_CLI_LIBS)
++ $(CC) $(OPTFLAGS) $(LDFLAGS) -o chronyc $(CLI_OBJS) @READLINE_LINK@ $(LIBS) $(EXTRA_CLI_LIBS)
+
+ client.o : client.c
+ $(CC) $(CFLAGS) $(DEFS) @READLINE_COMPILE@ -c $<
diff --git a/extra/chrony/chrony-1.23-sources.diff b/extra/chrony/chrony-1.23-sources.diff
new file mode 100644
index 00000000..5f39ca33
--- /dev/null
+++ b/extra/chrony/chrony-1.23-sources.diff
@@ -0,0 +1,56 @@
+commit 2f2446c7dc074b2d1728a5e3f7a600c10cea2425
+Author: Goswin Brederlow <brederlo@informatik.uni-tuebingen.de>
+Date: Sat Mar 29 20:49:59 2008 +0000
+
+ Fix for chronyc "sources" command on 64 bit machines
+
+ (Taken from
+ http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=348412
+ )
+
+ Attached is a patchlet to make the "sources" command of chrony output properly
+ signed numbers. The chronyd code (see e.g. ntp.h) properly uses int32_t and
+ friends to get the right number of bits per datatype while client.c just uses
+ short, int, long. But long will be 64 bit or 32 bit depending on the cpu.
+
+diff --git a/client.c b/client.c
+index b7e5bcb..85d6e84 100644
+--- a/client.c
++++ b/client.c
+@@ -45,6 +45,12 @@
+ #include <readline/history.h>
+ #endif
+
++#ifdef HAS_STDINT_H
++#include <stdint.h>
++#elif defined(HAS_INTTYPES_H)
++#include <inttypes.h>
++#endif
++
+ /* ================================================== */
+
+ static int sock_fd;
+@@ -1383,16 +1389,16 @@ process_cmd_sources(char *line)
+ int n_sources, i;
+ int verbose = 0;
+
+- long orig_latest_meas, latest_meas, est_offset;
+- unsigned long ip_addr;
+- unsigned long latest_meas_err, est_offset_err;
+- unsigned long latest_meas_ago;
+- unsigned short poll, stratum;
+- unsigned short state, mode;
++ int32_t orig_latest_meas, latest_meas, est_offset;
++ uint32_t ip_addr;
++ uint32_t latest_meas_err, est_offset_err;
++ uint32_t latest_meas_ago;
++ uint16_t poll, stratum;
++ uint16_t state, mode;
+ double resid_freq, resid_skew;
+ const char *dns_lookup;
+ char hostname_buf[32];
+- unsigned short status;
++ uint16_t status;
+
+ /* Check whether to output verbose headers */
+ verbose = check_for_verbose_flag(line);
diff --git a/extra/chrony/chronyd.confd b/extra/chrony/chronyd.confd
new file mode 100644
index 00000000..560825c2
--- /dev/null
+++ b/extra/chrony/chronyd.confd
@@ -0,0 +1,18 @@
+# /etc/conf.d/chronyd
+
+CFGFILE="/etc/chrony/chrony.conf"
+
+# Configuration dependant options :
+# -s - Set system time from RTC if rtcfile directive present
+# -r - Reload sample histories if dumponexit directive present
+#
+# The combination of "-s -r" allows chronyd to perform long term averaging of
+# the gain or loss rate across system reboots and shutdowns.
+
+ARGS=""
+
+# devfs creates the device for RTC if it's compiled into kernel
+test -c /dev/rtc && {
+ grep -q '^rtcfile' "${CFGFILE}" && ARGS="${ARGS} -s"
+}
+grep -q '^dumponexit$' "${CFGFILE}" && ARGS="${ARGS} -r"
diff --git a/extra/chrony/chronyd.initd b/extra/chrony/chronyd.initd
new file mode 100644
index 00000000..49d7526b
--- /dev/null
+++ b/extra/chrony/chronyd.initd
@@ -0,0 +1,58 @@
+#!/sbin/runscript
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/chrony/files/chronyd.rc,v 1.8 2007/03/22 14:32:09 tove Exp $
+
+depend() {
+ need net
+ use dns
+}
+
+checkconfig() {
+ # Note that /etc/chrony/chrony.keys is *NOT* checked. This
+ # is because the user may have specified another key
+ # file, and we don't want to force the user to use that
+ # exact name for the key file.
+ if [ ! -f "${CFGFILE}" ] ; then
+ eerror "Please create ${CFGFILE} and the"
+ eerror "chrony key file (usually /etc/chrony/chrony.keys)"
+ eerror "by using the"
+ eerror ""
+ eerror " chrony.conf.example"
+ eerror " chrony.keys.example"
+ eerror ""
+ eerror "files (from the documentation directory)"
+ eerror "as templates."
+ return 1
+ else
+ # Actually, I tried it, and chrony seems to ignore the pidfile
+ # option. I'm going to leave it here anyway, since you never
+ # know if it might be handy
+ PIDFILE=`awk '/^ *pidfile/{print $2}' "${CFGFILE}"`
+ fi
+ return 0
+}
+
+start() {
+ checkconfig || return $?
+
+ [ -n "${PIDFILE}" ] || PIDFILE=/var/run/chronyd.pid
+
+ ebegin "Starting chronyd"
+ start-stop-daemon --start --quiet \
+ --exec /usr/sbin/chronyd \
+ --pidfile "${PIDFILE}" \
+ -- -f "${CFGFILE}" ${ARGS}
+ eend $? "Failed to start chronyd"
+}
+
+stop() {
+ checkconfig || return $?
+
+ [ -n "${PIDFILE}" ] || PIDFILE=/var/run/chronyd.pid
+
+ ebegin "Stopping chronyd"
+ start-stop-daemon --stop --quiet \
+ --pidfile "${PIDFILE}"
+ eend $? "Failed to stop chronyd"
+}
diff --git a/extra/clamav/APKBUILD b/extra/clamav/APKBUILD
new file mode 100644
index 00000000..28cafd4b
--- /dev/null
+++ b/extra/clamav/APKBUILD
@@ -0,0 +1,39 @@
+# Contributor: Carlo Landmeter <clandmeter at gmail>
+# Maintainer: Carlo Landmeter <clandmeter at gmail>
+pkgname=clamav
+pkgver=0.94.2
+pkgrel=0
+pkgdesc="An anti-virus toolkit for UNIX"
+url="http://www.clamav.net/"
+license="GPL"
+depends="zlib gmp"
+install=clamav.install
+makedepends="gmp-dev zlib-dev"
+subpackages="$pkgname-doc $pkgname-dev"
+source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
+ clamav.initd
+ clamav.confd
+ clamav-0.94.2-nls.patch
+ $install"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ patch -p0 -i "$srcdir/clamav-0.94.2-nls.patch" || return 1
+
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --disable-clamav
+ make || return 1
+ make DESTDIR="$pkgdir" install
+
+ install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+ install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
+}
+
+md5sums="1181e6d62341b84708f126cc353f7ebf clamav-0.94.2.tar.gz
+d0c708403940c51e52eb27ea1610a27d clamav.initd
+431dfe7403323e247a88b97beade5d78 clamav.confd
+328a0c3449a6b516e443d7db5a0d4d01 clamav-0.94.2-nls.patch"
diff --git a/extra/clamav/clamav-0.94.2-nls.patch b/extra/clamav/clamav-0.94.2-nls.patch
new file mode 100644
index 00000000..7e02a29d
--- /dev/null
+++ b/extra/clamav/clamav-0.94.2-nls.patch
@@ -0,0 +1,71 @@
+Patch to disable nls (gettext) support for clamd. Taken from gentoo:
+http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-antivirus/clamav/files/clamav-0.94-nls.patch?view=log
+
+--- clamav-milter/clamav-milter.c Fri Nov 21 22:24:41 2008
++++ clamav-milter/clamav-milter.c Mon Feb 2 09:30:14 2009
+@@ -113,6 +113,7 @@
+
+ #ifdef C_LINUX
+ #include <sys/sendfile.h> /* FIXME: use sendfile on BSD not Linux */
++#ifdef ENABLE_NLS
+ #include <libintl.h>
+ #include <locale.h>
+
+@@ -125,7 +126,8 @@
+ #define _(s) s
+ #define N_(s) s
+
+-#endif
++#endif /* ENABLE_NLS */
++#endif /* C_LINUX */
+
+ #ifdef USE_SYSLOG
+ #include <syslog.h>
+@@ -774,7 +776,7 @@
+ else
+ progname = "clamav-milter";
+
+-#ifdef C_LINUX
++#ifdef ENABLE_NLS
+ setlocale(LC_ALL, "");
+ bindtextdomain(progname, DATADIR"/clamav-milter/locale");
+ textdomain(progname);
+--- configure.in Wed Nov 26 12:15:08 2008
++++ configure.in Mon Feb 2 09:30:14 2009
+@@ -609,6 +609,14 @@
+ fi
+ fi
+
++AC_ARG_ENABLE([nls],
++ AC_HELP_STRING([--disable-nls], [disable NLS support]),
++ [want_nls=$enableval], [want_nls=yes]
++)
++if test $want_nls = yes; then
++ CPPFLAGS="$CPPFLAGS -DENABLE_NLS"
++fi
++
+ AC_ARG_ENABLE([ipv6],
+ [ --disable-ipv6 disable IPv6 support],
+ want_ipv6=$enableval, want_ipv6="yes")
+--- shared/getopt.c Fri Nov 21 22:24:42 2008
++++ shared/getopt.c Mon Feb 2 09:30:14 2009
+@@ -82,7 +82,7 @@
+
+ #ifndef _
+ /* This is for other GNU distributions with internationalized messages. */
+-# if defined HAVE_LIBINTL_H || defined _LIBC
++# if (defined(HAVE_LIBINTL_H) || defined(_LIBC)) && defined(ENABLE_NLS)
+ # include <libintl.h>
+ # ifndef _
+ # define _(msgid) gettext (msgid)
+--- shared/output.c Tue Nov 25 20:11:00 2008
++++ shared/output.c Mon Feb 2 09:30:14 2009
+@@ -61,7 +61,7 @@
+ pthread_mutex_t logg_mutex = PTHREAD_MUTEX_INITIALIZER;
+ #endif
+
+-#ifdef C_LINUX
++#if defined(C_LINUX) && defined(ENABLE_NLS)
+ #include <libintl.h>
+ #include <locale.h>
+
diff --git a/extra/clamav/clamav.confd b/extra/clamav/clamav.confd
new file mode 100644
index 00000000..0abb80c6
--- /dev/null
+++ b/extra/clamav/clamav.confd
@@ -0,0 +1,9 @@
+# Sample conf.d file for alpine linux
+
+#
+# Specify daemon $OPTS here.
+#
+
+OPTS=""
+USER="nobody"
+GROUP="nobody"
diff --git a/extra/clamav/clamav.initd b/extra/clamav/clamav.initd
new file mode 100644
index 00000000..980c53e7
--- /dev/null
+++ b/extra/clamav/clamav.initd
@@ -0,0 +1,39 @@
+#!/sbin/runscript
+
+# Sample init.d file for alpine linux.
+
+NAME=
+DAEMON=/usr/sbin/$NAME
+
+depend() {
+ need net
+}
+
+start() {
+ ebegin "Starting ${NAME}"
+ start-stop-daemon --start --quiet --background \
+ --make-pidfile --pidfile /var/run/${NAME}.pid \
+ --chuid ${USER}:${GROUP} \
+ --exec ${DAEMON} -- ${OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${NAME}"
+ start-stop-daemon --stop --quiet \
+ --exec ${DAEMON} \
+ --pidfile /var/run/${NAME}.pid \
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading ${NAME}"
+ if ! service_started "${NAME}" ; then
+ eend 1 "${NAME} is not started"
+ return 1
+ fi
+ start-stop-daemon --stop --oknodo --signal HUP \
+ --exec ${DAEMON} --pidfile /var/run/${NAME}.pid
+ eend $?
+}
+
diff --git a/extra/clamav/clamav.install b/extra/clamav/clamav.install
new file mode 100644
index 00000000..8d427d91
--- /dev/null
+++ b/extra/clamav/clamav.install
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+case "$1" in
+ post_install)
+ echo '*'
+ echo '* Adding new user clamav'
+ echo '*'
+ adduser -H -s /bin/false -D clamav 2>/dev/null
+ ;;
+esac
diff --git a/extra/clamsmtp/APKBUILD b/extra/clamsmtp/APKBUILD
new file mode 100644
index 00000000..aabb9f18
--- /dev/null
+++ b/extra/clamsmtp/APKBUILD
@@ -0,0 +1,34 @@
+# Contributor: Carlo Landmeter <clandmeter at gmail>
+# Maintainer: Carlo Landmeter <clandmeter at gmail>
+pkgname=clamsmtp
+pkgver=1.10
+pkgrel=0
+pkgdesc="An SMTP Virus Filter"
+url="http://memberwebs.com/stef/software/clamsmtp/"
+license="as-is"
+depends="uclibc"
+makedepends=""
+subpackages="$pkgname-doc"
+source="http://memberwebs.com/stef/software/clamsmtp/${pkgname}-${pkgver}.tar.gz
+clamsmtp.confd
+clamsmtp.initd"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info
+ make || return 1
+ make DESTDIR="$pkgdir" install || return 1
+
+ install -Dm644 doc/clamsmtpd.conf "$pkgdir"/etc/clamsmtpd.conf
+ install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+ install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
+ install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
+}
+
+md5sums="b068ba6e444859782bbdd88f290c1abf clamsmtp-1.10.tar.gz
+931e54718c735bca4f3347c903cff0ed clamsmtp.confd
+9db0f44bda7e56d53486223a2a927b0e clamsmtp.initd"
diff --git a/extra/clamsmtp/clamsmtp.confd b/extra/clamsmtp/clamsmtp.confd
new file mode 100644
index 00000000..a2c9cf52
--- /dev/null
+++ b/extra/clamsmtp/clamsmtp.confd
@@ -0,0 +1,5 @@
+#
+# Specify daemon $OPTS here.
+#
+
+OPTS="-p /var/run/clamsmtpd.pid"
diff --git a/extra/clamsmtp/clamsmtp.initd b/extra/clamsmtp/clamsmtp.initd
new file mode 100644
index 00000000..4ccfe6c0
--- /dev/null
+++ b/extra/clamsmtp/clamsmtp.initd
@@ -0,0 +1,25 @@
+#!/sbin/runscript
+
+# Sample init.d file for alpine linux.
+
+NAME=clamsmtpd
+DAEMON=/usr/sbin/$NAME
+
+depend() {
+ need net clamd
+}
+
+start() {
+ ebegin "Starting ${NAME}"
+ start-stop-daemon --start --quiet \
+ --exec ${DAEMON} -- ${OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${NAME}"
+ start-stop-daemon --stop --quiet \
+ --exec ${DAEMON} \
+ --pidfile /var/run/${NAME}.pid
+ eend $?
+}
diff --git a/extra/cmake/APKBUILD b/extra/cmake/APKBUILD
new file mode 100644
index 00000000..5a5c6650
--- /dev/null
+++ b/extra/cmake/APKBUILD
@@ -0,0 +1,33 @@
+pkgname=cmake
+pkgver=2.6.2
+pkgrel=0
+pkgdesc="CMake is a cross-platform open-source make system"
+url="http://www.cmake.org"
+license="CMake"
+depends="uclibc gcc g++"
+source="http://www.$pkgname.org/files/v2.6/$pkgname-$pkgver.tar.gz"
+subpackages="$pkgname-doc"
+
+
+parallel_opt() {
+ local i n
+ for i in $MAKEOPTS; do
+ case "$i" in
+ -j*) n=${i#-j};;
+ esac;
+ done
+ [ -n "$n" ] && echo "--parallel $n"
+}
+
+build ()
+{
+ cd $startdir/src/$pkgname-$pkgver
+ ./bootstrap --prefix=/usr \
+ --mandir=/share/man \
+ --docdir=/share/cmake-2.6/doc \
+ $(parallel_opt)
+
+ make || return 1
+ make DESTDIR="$pkgdir" install
+}
+md5sums="9e82aa3beb991aa8e5797cf330618d42 cmake-2.6.2.tar.gz"
diff --git a/extra/db/APKBUILD b/extra/db/APKBUILD
new file mode 100644
index 00000000..bc4c67db
--- /dev/null
+++ b/extra/db/APKBUILD
@@ -0,0 +1,31 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=db
+pkgver=4.7.25
+pkgrel=0
+pkgdesc="The Berkeley DB embedded database system"
+url="http://www.oracle.com/technology/software/products/berkeley-db/index.html"
+license="custom"
+depends="uclibc"
+makedepends=""
+subpackages="$pkgname-dev $pkgname-doc"
+source="http://download-uk.oracle.com/berkeley-$pkgname/$pkgname-$pkgver.tar.gz"
+
+build () {
+ cd "$srcdir/$pkgname-$pkgver"/build_unix
+
+ ../dist/configure --prefix=/usr \
+ --enable-compat185 \
+ --enable-shared \
+ --enable-static \
+ --disable-cxx
+
+ make LIBSO_LIBS=-lpthread || return 1
+ make DESTDIR="$pkgdir" install
+
+ mkdir -p "$pkgdir"/usr/share/doc
+ mv "$pkgdir"/usr/docs "$pkgdir"/usr/share/doc/$pkgname
+
+ install -m644 -D "$srcdir"/$pkgname-$pkgver/LICENSE \
+ "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+}
+md5sums="ec2b87e833779681a0c3a814aa71359e db-4.7.25.tar.gz"
diff --git a/extra/db46/APKBUILD b/extra/db46/APKBUILD
new file mode 100644
index 00000000..d7fc61e5
--- /dev/null
+++ b/extra/db46/APKBUILD
@@ -0,0 +1,56 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=db46
+pkgver=4.6.21
+pkgrel=4
+pkgdesc="The Berkeley DB embedded database system 4.6"
+url="http://www.oracle.com/technology/software/products/berkeley-db/index.html"
+license="custom"
+depends="uclibc"
+subpackages="$pkgname-dev $pkgname-doc"
+# Patches were found here:
+# http://www.oracle.com/technology/products/berkeley-db/db/update/4.6.21/patch.4.6.21.html
+source="http://download-uk.oracle.com/berkeley-db/db-$pkgver.tar.gz
+ patch.$pkgver.1
+ patch.$pkgver.2
+ patch.$pkgver.3
+ patch.$pkgver.4
+ "
+
+build () {
+ cd "$srcdir"/db-$pkgver
+ for i in ../patch.*; do
+ msg "Applying $i..."
+ patch -p0 < $i || return 1
+ done
+
+ cd build_unix
+ ../dist/configure --prefix=/usr \
+ --mandir=/usr/share/man \
+ --includedir=/usr/include/db4.6 \
+ --enable-compat185 \
+ --enable-shared \
+ --disable-static \
+ --disable-cxx
+ make LIBSO_LIBS=-lpthread || return 1
+ make DESTDIR="$pkgdir" install
+
+ cd "$pkgdir"/usr/bin
+ for i in db_*; do
+ mv $i db4.6_${i#db_}
+ done
+
+ cd "$pkgdir"/usr/lib
+ rm libdb.so libdb-4.so
+
+ mkdir -p "$pkgdir"/usr/share/doc
+ mv "$pkgdir"/usr/docs "$pkgdir"/usr/share/doc/$pkgname
+
+ install -D -m644 "$srcdir"/db-$pkgver/LICENSE \
+ "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+}
+
+md5sums="718082e7e35fc48478a2334b0bc4cd11 db-4.6.21.tar.gz
+4878872edfc53c6ecb871b1062a4bdaf patch.4.6.21.1
+55074e53d3acae2dcbeae8322f96e522 patch.4.6.21.2
+4ccd6c9e296fb448f7ffe352fe740507 patch.4.6.21.3
+ae7d3d587355fe85b512ef09b9a77d19 patch.4.6.21.4"
diff --git a/extra/db46/patch.4.6.21.1 b/extra/db46/patch.4.6.21.1
new file mode 100644
index 00000000..636bc51c
--- /dev/null
+++ b/extra/db46/patch.4.6.21.1
@@ -0,0 +1,90 @@
+*** dbinc/mp.h 2007-09-28 01:28:25.000000000 +1000
+--- dbinc/mp.h 2008-02-14 01:22:09.000000000 +1100
+***************
+*** 639,644 ****
+--- 639,647 ----
+ */
+ #define MP_TRUNC_RECOVER 0x01
+
++ /* Private flags to DB_MPOOLFILE->close. */
++ #define DB_MPOOL_NOLOCK 0x002 /* Already have mpf locked. */
++
+ #if defined(__cplusplus)
+ }
+ #endif
+*** mp/mp_fopen.c 2007-05-18 03:18:01.000000000 +1000
+--- mp/mp_fopen.c 2008-02-12 16:09:42.000000000 +1100
+***************
+*** 888,894 ****
+ * when we try to flush them.
+ */
+ deleted = 0;
+! MUTEX_LOCK(dbenv, mfp->mutex);
+ if (F_ISSET(dbmfp, MP_MULTIVERSION))
+ --mfp->multiversion;
+ if (--mfp->mpf_cnt == 0 || LF_ISSET(DB_MPOOL_DISCARD)) {
+--- 888,895 ----
+ * when we try to flush them.
+ */
+ deleted = 0;
+! if (!LF_ISSET(DB_MPOOL_NOLOCK))
+! MUTEX_LOCK(dbenv, mfp->mutex);
+ if (F_ISSET(dbmfp, MP_MULTIVERSION))
+ --mfp->multiversion;
+ if (--mfp->mpf_cnt == 0 || LF_ISSET(DB_MPOOL_DISCARD)) {
+***************
+*** 909,921 ****
+ }
+ }
+ if (mfp->block_cnt == 0) {
+ if ((t_ret =
+ __memp_mf_discard(dbmp, mfp)) != 0 && ret == 0)
+ ret = t_ret;
+ deleted = 1;
+ }
+ }
+! if (!deleted)
+ MUTEX_UNLOCK(dbenv, mfp->mutex);
+
+ done: /* Discard the DB_MPOOLFILE structure. */
+--- 910,928 ----
+ }
+ }
+ if (mfp->block_cnt == 0) {
++ /*
++ * We should never discard this mp file if our caller
++ * is holding the lock on it. See comment in
++ * __memp_sync_file.
++ */
++ DB_ASSERT(dbenv, !LF_ISSET(DB_MPOOL_NOLOCK));
+ if ((t_ret =
+ __memp_mf_discard(dbmp, mfp)) != 0 && ret == 0)
+ ret = t_ret;
+ deleted = 1;
+ }
+ }
+! if (!deleted && !LF_ISSET(DB_MPOOL_NOLOCK))
+ MUTEX_UNLOCK(dbenv, mfp->mutex);
+
+ done: /* Discard the DB_MPOOLFILE structure. */
+*** mp/mp_sync.c 2007-06-02 04:32:44.000000000 +1000
+--- mp/mp_sync.c 2008-02-12 16:09:42.000000000 +1100
+***************
+*** 755,761 ****
+ * This is important since we are called with the hash bucket
+ * locked. The mfp will get freed via the cleanup pass.
+ */
+! if (dbmfp != NULL && (t_ret = __memp_fclose(dbmfp, 0)) != 0 && ret == 0)
+ ret = t_ret;
+
+ --mfp->mpf_cnt;
+--- 755,762 ----
+ * This is important since we are called with the hash bucket
+ * locked. The mfp will get freed via the cleanup pass.
+ */
+! if (dbmfp != NULL &&
+! (t_ret = __memp_fclose(dbmfp, DB_MPOOL_NOLOCK)) != 0 && ret == 0)
+ ret = t_ret;
+
+ --mfp->mpf_cnt;
+
diff --git a/extra/db46/patch.4.6.21.2 b/extra/db46/patch.4.6.21.2
new file mode 100644
index 00000000..4e59f18a
--- /dev/null
+++ b/extra/db46/patch.4.6.21.2
@@ -0,0 +1,27 @@
+*** mp/mp_region.c 2007-05-18 03:18:01.000000000 +1000
+--- mp/mp_region.c 2008-06-24 13:15:56.000000000 +1000
+***************
+*** 249,256 ****
+ mtx_base = htab[0].mtx_hash;
+ }
+
+ if (mtx_base != MUTEX_INVALID)
+! mtx_base += reginfo_off * htab_buckets;
+
+ /* Allocate hash table space and initialize it. */
+ if ((ret = __env_alloc(infop,
+--- 249,262 ----
+ mtx_base = htab[0].mtx_hash;
+ }
+
++ /*
++ * We preallocated all of the mutexes in a block, so for regions after
++ * the first, we skip mutexes in use in earlier regions. Each region
++ * has the same number of buckets and there are two mutexes per hash
++ * bucket (the bucket mutex and the I/O mutex).
++ */
+ if (mtx_base != MUTEX_INVALID)
+! mtx_base += reginfo_off * htab_buckets * 2;
+
+ /* Allocate hash table space and initialize it. */
+ if ((ret = __env_alloc(infop,
diff --git a/extra/db46/patch.4.6.21.3 b/extra/db46/patch.4.6.21.3
new file mode 100644
index 00000000..e23a27a0
--- /dev/null
+++ b/extra/db46/patch.4.6.21.3
@@ -0,0 +1,53 @@
+*** sequence/sequence.c.orig 2007-05-17 10:18:04.000000000 -0700
+--- sequence/sequence.c 2008-08-14 12:24:23.000000000 -0700
+***************
+*** 252,257 ****
+--- 252,262 ----
+ if ((ret != DB_NOTFOUND && ret != DB_KEYEMPTY) ||
+ !LF_ISSET(DB_CREATE))
+ goto err;
++ if (IS_REP_CLIENT(dbenv) &&
++ !F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
++ ret = __db_rdonly(dbenv, "DB_SEQUENCE->open");
++ goto err;
++ }
+ ret = 0;
+
+ rp = &seq->seq_record;
+***************
+*** 304,310 ****
+ */
+ rp = seq->seq_data.data;
+ if (rp->seq_version == DB_SEQUENCE_OLDVER) {
+! oldver: rp->seq_version = DB_SEQUENCE_VERSION;
+ if (__db_isbigendian()) {
+ if (IS_DB_AUTO_COMMIT(dbp, txn)) {
+ if ((ret =
+--- 309,320 ----
+ */
+ rp = seq->seq_data.data;
+ if (rp->seq_version == DB_SEQUENCE_OLDVER) {
+! oldver: if (IS_REP_CLIENT(dbenv) &&
+! !F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
+! ret = __db_rdonly(dbenv, "DB_SEQUENCE->open");
+! goto err;
+! }
+! rp->seq_version = DB_SEQUENCE_VERSION;
+ if (__db_isbigendian()) {
+ if (IS_DB_AUTO_COMMIT(dbp, txn)) {
+ if ((ret =
+***************
+*** 713,718 ****
+--- 723,734 ----
+
+ MUTEX_LOCK(dbenv, seq->mtx_seq);
+
++ if (handle_check && IS_REP_CLIENT(dbenv) &&
++ !F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
++ ret = __db_rdonly(dbenv, "DB_SEQUENCE->get");
++ goto err;
++ }
++
+ if (rp->seq_min + delta > rp->seq_max) {
+ __db_errx(dbenv, "Sequence overflow");
+ ret = EINVAL;
diff --git a/extra/db46/patch.4.6.21.4 b/extra/db46/patch.4.6.21.4
new file mode 100644
index 00000000..7c1f7e2a
--- /dev/null
+++ b/extra/db46/patch.4.6.21.4
@@ -0,0 +1,1414 @@
+*** dbinc/repmgr.h 2007-10-31 10:23:52.000000000 -0700
+--- dbinc/repmgr.h 2007-10-31 10:23:53.000000000 -0700
+***************
+*** 36,41 ****
+--- 36,55 ----
+ #endif
+
+ /*
++ * The (arbitrary) maximum number of outgoing messages we're willing to hold, on
++ * a queue per connection, waiting for TCP buffer space to become available in
++ * the kernel. Rather than exceeding this limit, we simply discard additional
++ * messages (since this is always allowed by the replication protocol).
++ * As a special dispensation, if a message is destined for a specific remote
++ * site (i.e., it's not a broadcast), then we first try blocking the sending
++ * thread, waiting for space to become available (though we only wait a limited
++ * time). This is so as to be able to handle the immediate flood of (a
++ * potentially large number of) outgoing messages that replication generates, in
++ * a tight loop, when handling PAGE_REQ, LOG_REQ and ALL_REQ requests.
++ */
++ #define OUT_QUEUE_LIMIT 10
++
++ /*
+ * The system value is available from sysconf(_SC_HOST_NAME_MAX).
+ * Historically, the maximum host name was 256.
+ */
+***************
+*** 47,52 ****
+--- 61,71 ----
+ #define MAX_SITE_LOC_STRING (MAXHOSTNAMELEN+20)
+ typedef char SITE_STRING_BUFFER[MAX_SITE_LOC_STRING+1];
+
++ /* Default timeout values, in seconds. */
++ #define DB_REPMGR_DEFAULT_ACK_TIMEOUT (1 * US_PER_SEC)
++ #define DB_REPMGR_DEFAULT_CONNECTION_RETRY (30 * US_PER_SEC)
++ #define DB_REPMGR_DEFAULT_ELECTION_RETRY (10 * US_PER_SEC)
++
+ struct __repmgr_connection;
+ typedef struct __repmgr_connection REPMGR_CONNECTION;
+ struct __repmgr_queue; typedef struct __repmgr_queue REPMGR_QUEUE;
+***************
+*** 171,178 ****
+ #ifdef DB_WIN32
+ WSAEVENT event_object;
+ #endif
+! #define CONN_CONNECTING 0x01 /* nonblocking connect in progress */
+! #define CONN_DEFUNCT 0x02 /* socket close pending */
+ u_int32_t flags;
+
+ /*
+--- 190,198 ----
+ #ifdef DB_WIN32
+ WSAEVENT event_object;
+ #endif
+! #define CONN_CONGESTED 0x01 /* msg thread wait has exceeded timeout */
+! #define CONN_CONNECTING 0x02 /* nonblocking connect in progress */
+! #define CONN_DEFUNCT 0x04 /* socket close pending */
+ u_int32_t flags;
+
+ /*
+***************
+*** 180,189 ****
+ * send() function's thread. But if TCP doesn't have enough network
+ * buffer space for us when we first try it, we instead allocate some
+ * memory, and copy the message, and then send it as space becomes
+! * available in our main select() thread.
+ */
+ OUT_Q_HEADER outbound_queue;
+ int out_queue_length;
+
+ /*
+ * Input: while we're reading a message, we keep track of what phase
+--- 200,215 ----
+ * send() function's thread. But if TCP doesn't have enough network
+ * buffer space for us when we first try it, we instead allocate some
+ * memory, and copy the message, and then send it as space becomes
+! * available in our main select() thread. In some cases, if the queue
+! * gets too long we wait until it's drained, and then append to it.
+! * This condition variable's associated mutex is the normal per-repmgr
+! * db_rep->mutex, because that mutex is always held anyway whenever the
+! * output queue is consulted.
+ */
+ OUT_Q_HEADER outbound_queue;
+ int out_queue_length;
++ cond_var_t drained;
++ int blockers; /* ref count of msg threads waiting on us */
+
+ /*
+ * Input: while we're reading a message, we keep track of what phase
+*** dbinc_auto/int_def.in 2007-10-31 10:23:52.000000000 -0700
+--- dbinc_auto/int_def.in 2007-10-31 10:23:52.000000000 -0700
+***************
+*** 1420,1425 ****
+--- 1420,1428 ----
+ #define __repmgr_wake_waiting_senders __repmgr_wake_waiting_senders@DB_VERSION_UNIQUE_NAME@
+ #define __repmgr_await_ack __repmgr_await_ack@DB_VERSION_UNIQUE_NAME@
+ #define __repmgr_compute_wait_deadline __repmgr_compute_wait_deadline@DB_VERSION_UNIQUE_NAME@
++ #define __repmgr_await_drain __repmgr_await_drain@DB_VERSION_UNIQUE_NAME@
++ #define __repmgr_alloc_cond __repmgr_alloc_cond@DB_VERSION_UNIQUE_NAME@
++ #define __repmgr_free_cond __repmgr_free_cond@DB_VERSION_UNIQUE_NAME@
+ #define __repmgr_init_sync __repmgr_init_sync@DB_VERSION_UNIQUE_NAME@
+ #define __repmgr_close_sync __repmgr_close_sync@DB_VERSION_UNIQUE_NAME@
+ #define __repmgr_net_init __repmgr_net_init@DB_VERSION_UNIQUE_NAME@
+*** dbinc_auto/repmgr_ext.h 2007-10-31 10:23:52.000000000 -0700
+--- dbinc_auto/repmgr_ext.h 2007-10-31 10:23:52.000000000 -0700
+***************
+*** 21,30 ****
+ int __repmgr_handle_event __P((DB_ENV *, u_int32_t, void *));
+ void __repmgr_stash_generation __P((DB_ENV *));
+ int __repmgr_send __P((DB_ENV *, const DBT *, const DBT *, const DB_LSN *, int, u_int32_t));
+! int __repmgr_send_one __P((DB_ENV *, REPMGR_CONNECTION *, u_int, const DBT *, const DBT *));
+ int __repmgr_is_permanent __P((DB_ENV *, const DB_LSN *));
+! int __repmgr_bust_connection __P((DB_ENV *, REPMGR_CONNECTION *, int));
+! void __repmgr_cleanup_connection __P((DB_ENV *, REPMGR_CONNECTION *));
+ int __repmgr_find_site __P((DB_ENV *, const char *, u_int));
+ int __repmgr_pack_netaddr __P((DB_ENV *, const char *, u_int, ADDRINFO *, repmgr_netaddr_t *));
+ int __repmgr_getaddr __P((DB_ENV *, const char *, u_int, int, ADDRINFO **));
+--- 21,30 ----
+ int __repmgr_handle_event __P((DB_ENV *, u_int32_t, void *));
+ void __repmgr_stash_generation __P((DB_ENV *));
+ int __repmgr_send __P((DB_ENV *, const DBT *, const DBT *, const DB_LSN *, int, u_int32_t));
+! int __repmgr_send_one __P((DB_ENV *, REPMGR_CONNECTION *, u_int, const DBT *, const DBT *, int));
+ int __repmgr_is_permanent __P((DB_ENV *, const DB_LSN *));
+! int __repmgr_bust_connection __P((DB_ENV *, REPMGR_CONNECTION *));
+! int __repmgr_cleanup_connection __P((DB_ENV *, REPMGR_CONNECTION *));
+ int __repmgr_find_site __P((DB_ENV *, const char *, u_int));
+ int __repmgr_pack_netaddr __P((DB_ENV *, const char *, u_int, ADDRINFO *, repmgr_netaddr_t *));
+ int __repmgr_getaddr __P((DB_ENV *, const char *, u_int, int, ADDRINFO **));
+***************
+*** 39,44 ****
+--- 39,47 ----
+ int __repmgr_wake_waiting_senders __P((DB_ENV *));
+ int __repmgr_await_ack __P((DB_ENV *, const DB_LSN *));
+ void __repmgr_compute_wait_deadline __P((DB_ENV*, struct timespec *, db_timeout_t));
++ int __repmgr_await_drain __P((DB_ENV *, REPMGR_CONNECTION *, db_timeout_t));
++ int __repmgr_alloc_cond __P((cond_var_t *));
++ int __repmgr_free_cond __P((cond_var_t *));
+ int __repmgr_init_sync __P((DB_ENV *, DB_REP *));
+ int __repmgr_close_sync __P((DB_ENV *));
+ int __repmgr_net_init __P((DB_ENV *, DB_REP *));
+*** repmgr/repmgr_method.c 2007-10-31 10:23:52.000000000 -0700
+--- repmgr/repmgr_method.c 2007-10-31 10:23:53.000000000 -0700
+***************
+*** 196,204 ****
+ int ret;
+
+ /* Set some default values. */
+! db_rep->ack_timeout = 1 * US_PER_SEC; /* 1 second */
+! db_rep->connection_retry_wait = 30 * US_PER_SEC; /* 30 seconds */
+! db_rep->election_retry_wait = 10 * US_PER_SEC; /* 10 seconds */
+ db_rep->config_nsites = 0;
+ db_rep->peer = DB_EID_INVALID;
+ db_rep->perm_policy = DB_REPMGR_ACKS_QUORUM;
+--- 196,204 ----
+ int ret;
+
+ /* Set some default values. */
+! db_rep->ack_timeout = DB_REPMGR_DEFAULT_ACK_TIMEOUT;
+! db_rep->connection_retry_wait = DB_REPMGR_DEFAULT_CONNECTION_RETRY;
+! db_rep->election_retry_wait = DB_REPMGR_DEFAULT_ELECTION_RETRY;
+ db_rep->config_nsites = 0;
+ db_rep->peer = DB_EID_INVALID;
+ db_rep->perm_policy = DB_REPMGR_ACKS_QUORUM;
+***************
+*** 238,243 ****
+--- 238,244 ----
+ DB_ENV *dbenv;
+ {
+ DB_REP *db_rep;
++ REPMGR_CONNECTION *conn;
+ int ret;
+
+ db_rep = dbenv->rep_handle;
+***************
+*** 254,259 ****
+--- 255,266 ----
+
+ if ((ret = __repmgr_signal(&db_rep->queue_nonempty)) != 0)
+ goto unlock;
++
++ TAILQ_FOREACH(conn, &db_rep->connections, entries) {
++ if (conn->blockers > 0 &&
++ ((ret = __repmgr_signal(&conn->drained)) != 0))
++ goto unlock;
++ }
+ UNLOCK_MUTEX(db_rep->mutex);
+
+ return (__repmgr_wake_main_thread(dbenv));
+*** repmgr/repmgr_msg.c 2007-10-31 10:23:52.000000000 -0700
+--- repmgr/repmgr_msg.c 2007-10-31 10:23:53.000000000 -0700
+***************
+*** 183,192 ****
+
+ /*
+ * Acknowledges a message.
+- *
+- * !!!
+- * Note that this cannot be called from the select() thread, in case we call
+- * __repmgr_bust_connection(..., FALSE).
+ */
+ static int
+ ack_message(dbenv, generation, lsn)
+--- 183,188 ----
+***************
+*** 227,235 ****
+ rec2.size = 0;
+
+ conn = site->ref.conn;
+ if ((ret = __repmgr_send_one(dbenv, conn, REPMGR_ACK,
+! &control2, &rec2)) == DB_REP_UNAVAIL)
+! ret = __repmgr_bust_connection(dbenv, conn, FALSE);
+ }
+
+ UNLOCK_MUTEX(db_rep->mutex);
+--- 223,236 ----
+ rec2.size = 0;
+
+ conn = site->ref.conn;
++ /*
++ * It's hard to imagine anyone would care about a lost ack if
++ * the path to the master is so congested as to need blocking;
++ * so pass "blockable" argument as FALSE.
++ */
+ if ((ret = __repmgr_send_one(dbenv, conn, REPMGR_ACK,
+! &control2, &rec2, FALSE)) == DB_REP_UNAVAIL)
+! ret = __repmgr_bust_connection(dbenv, conn);
+ }
+
+ UNLOCK_MUTEX(db_rep->mutex);
+*** repmgr/repmgr_net.c 2007-10-31 10:23:52.000000000 -0700
+--- repmgr/repmgr_net.c 2007-10-31 10:23:53.000000000 -0700
+***************
+*** 63,69 ****
+ static void setup_sending_msg
+ __P((struct sending_msg *, u_int, const DBT *, const DBT *));
+ static int __repmgr_send_internal
+! __P((DB_ENV *, REPMGR_CONNECTION *, struct sending_msg *));
+ static int enqueue_msg
+ __P((DB_ENV *, REPMGR_CONNECTION *, struct sending_msg *, size_t));
+ static int flatten __P((DB_ENV *, struct sending_msg *));
+--- 63,69 ----
+ static void setup_sending_msg
+ __P((struct sending_msg *, u_int, const DBT *, const DBT *));
+ static int __repmgr_send_internal
+! __P((DB_ENV *, REPMGR_CONNECTION *, struct sending_msg *, int));
+ static int enqueue_msg
+ __P((DB_ENV *, REPMGR_CONNECTION *, struct sending_msg *, size_t));
+ static int flatten __P((DB_ENV *, struct sending_msg *));
+***************
+*** 73,85 ****
+ * __repmgr_send --
+ * The send function for DB_ENV->rep_set_transport.
+ *
+- * !!!
+- * This is only ever called as the replication transport call-back, which means
+- * it's either on one of our message processing threads or an application
+- * thread. It mustn't be called from the select() thread, because we might call
+- * __repmgr_bust_connection(..., FALSE) here, and that's not allowed in the
+- * select() thread.
+- *
+ * PUBLIC: int __repmgr_send __P((DB_ENV *, const DBT *, const DBT *,
+ * PUBLIC: const DB_LSN *, int, u_int32_t));
+ */
+--- 73,78 ----
+***************
+*** 126,134 ****
+ }
+
+ conn = site->ref.conn;
+ if ((ret = __repmgr_send_one(dbenv, conn, REPMGR_REP_MESSAGE,
+! control, rec)) == DB_REP_UNAVAIL &&
+! (t_ret = __repmgr_bust_connection(dbenv, conn, FALSE)) != 0)
+ ret = t_ret;
+ if (ret != 0)
+ goto out;
+--- 119,128 ----
+ }
+
+ conn = site->ref.conn;
++ /* Pass the "blockable" argument as TRUE. */
+ if ((ret = __repmgr_send_one(dbenv, conn, REPMGR_REP_MESSAGE,
+! control, rec, TRUE)) == DB_REP_UNAVAIL &&
+! (t_ret = __repmgr_bust_connection(dbenv, conn)) != 0)
+ ret = t_ret;
+ if (ret != 0)
+ goto out;
+***************
+*** 222,228 ****
+ if (site->state != SITE_CONNECTED)
+ return (NULL);
+
+! if (F_ISSET(site->ref.conn, CONN_CONNECTING))
+ return (NULL);
+ return (site);
+ }
+--- 216,222 ----
+ if (site->state != SITE_CONNECTED)
+ return (NULL);
+
+! if (F_ISSET(site->ref.conn, CONN_CONNECTING|CONN_DEFUNCT))
+ return (NULL);
+ return (site);
+ }
+***************
+*** 235,244 ****
+ *
+ * !!!
+ * Caller must hold dbenv->mutex.
+- *
+- * !!!
+- * Note that this cannot be called from the select() thread, in case we call
+- * __repmgr_bust_connection(..., FALSE).
+ */
+ static int
+ __repmgr_send_broadcast(dbenv, control, rec, nsitesp, npeersp)
+--- 229,234 ----
+***************
+*** 268,281 ****
+ !IS_VALID_EID(conn->eid))
+ continue;
+
+! if ((ret = __repmgr_send_internal(dbenv, conn, &msg)) == 0) {
+ site = SITE_FROM_EID(conn->eid);
+ nsites++;
+ if (site->priority > 0)
+ npeers++;
+ } else if (ret == DB_REP_UNAVAIL) {
+! if ((ret = __repmgr_bust_connection(
+! dbenv, conn, FALSE)) != 0)
+ return (ret);
+ } else
+ return (ret);
+--- 258,277 ----
+ !IS_VALID_EID(conn->eid))
+ continue;
+
+! /*
+! * Broadcast messages are either application threads committing
+! * transactions, or replication status message that we can
+! * afford to lose. So don't allow blocking for them (pass
+! * "blockable" argument as FALSE).
+! */
+! if ((ret = __repmgr_send_internal(dbenv,
+! conn, &msg, FALSE)) == 0) {
+ site = SITE_FROM_EID(conn->eid);
+ nsites++;
+ if (site->priority > 0)
+ npeers++;
+ } else if (ret == DB_REP_UNAVAIL) {
+! if ((ret = __repmgr_bust_connection(dbenv, conn)) != 0)
+ return (ret);
+ } else
+ return (ret);
+***************
+*** 301,339 ****
+ * intersperse writes that are part of two single messages.
+ *
+ * PUBLIC: int __repmgr_send_one __P((DB_ENV *, REPMGR_CONNECTION *,
+! * PUBLIC: u_int, const DBT *, const DBT *));
+ */
+ int
+! __repmgr_send_one(dbenv, conn, msg_type, control, rec)
+ DB_ENV *dbenv;
+ REPMGR_CONNECTION *conn;
+ u_int msg_type;
+ const DBT *control, *rec;
+ {
+ struct sending_msg msg;
+
+ setup_sending_msg(&msg, msg_type, control, rec);
+! return (__repmgr_send_internal(dbenv, conn, &msg));
+ }
+
+ /*
+ * Attempts a "best effort" to send a message on the given site. If there is an
+! * excessive backlog of message already queued on the connection, we simply drop
+! * this message, and still return 0 even in this case.
+ */
+ static int
+! __repmgr_send_internal(dbenv, conn, msg)
+ DB_ENV *dbenv;
+ REPMGR_CONNECTION *conn;
+ struct sending_msg *msg;
+ {
+! #define OUT_QUEUE_LIMIT 10 /* arbitrary, for now */
+ REPMGR_IOVECS iovecs;
+ SITE_STRING_BUFFER buffer;
+ int ret;
+ size_t nw;
+ size_t total_written;
+
+ DB_ASSERT(dbenv, !F_ISSET(conn, CONN_CONNECTING));
+ if (!STAILQ_EMPTY(&conn->outbound_queue)) {
+ /*
+--- 297,355 ----
+ * intersperse writes that are part of two single messages.
+ *
+ * PUBLIC: int __repmgr_send_one __P((DB_ENV *, REPMGR_CONNECTION *,
+! * PUBLIC: u_int, const DBT *, const DBT *, int));
+ */
+ int
+! __repmgr_send_one(dbenv, conn, msg_type, control, rec, blockable)
+ DB_ENV *dbenv;
+ REPMGR_CONNECTION *conn;
+ u_int msg_type;
+ const DBT *control, *rec;
++ int blockable;
+ {
+ struct sending_msg msg;
+
+ setup_sending_msg(&msg, msg_type, control, rec);
+! return (__repmgr_send_internal(dbenv, conn, &msg, blockable));
+ }
+
+ /*
+ * Attempts a "best effort" to send a message on the given site. If there is an
+! * excessive backlog of message already queued on the connection, what shall we
+! * do? If the caller doesn't mind blocking, we'll wait (a limited amount of
+! * time) for the queue to drain. Otherwise we'll simply drop the message. This
+! * is always allowed by the replication protocol. But in the case of a
+! * multi-message response to a request like PAGE_REQ, LOG_REQ or ALL_REQ we
+! * almost always get a flood of messages that instantly fills our queue, so
+! * blocking improves performance (by avoiding the need for the client to
+! * re-request).
+! *
+! * How long shall we wait? We could of course create a new timeout
+! * configuration type, so that the application could set it directly. But that
+! * would start to overwhelm the user with too many choices to think about. We
+! * already have an ACK timeout, which is the user's estimate of how long it
+! * should take to send a message to the client, have it be processed, and return
+! * a message back to us. We multiply that by the queue size, because that's how
+! * many messages have to be swallowed up by the client before we're able to
+! * start sending again (at least to a rough approximation).
+ */
+ static int
+! __repmgr_send_internal(dbenv, conn, msg, blockable)
+ DB_ENV *dbenv;
+ REPMGR_CONNECTION *conn;
+ struct sending_msg *msg;
++ int blockable;
+ {
+! DB_REP *db_rep;
+ REPMGR_IOVECS iovecs;
+ SITE_STRING_BUFFER buffer;
++ db_timeout_t drain_to;
+ int ret;
+ size_t nw;
+ size_t total_written;
+
++ db_rep = dbenv->rep_handle;
++
+ DB_ASSERT(dbenv, !F_ISSET(conn, CONN_CONNECTING));
+ if (!STAILQ_EMPTY(&conn->outbound_queue)) {
+ /*
+***************
+*** 344,358 ****
+ RPRINT(dbenv, (dbenv, "msg to %s to be queued",
+ __repmgr_format_eid_loc(dbenv->rep_handle,
+ conn->eid, buffer)));
+ if (conn->out_queue_length < OUT_QUEUE_LIMIT)
+ return (enqueue_msg(dbenv, conn, msg, 0));
+ else {
+ RPRINT(dbenv, (dbenv, "queue limit exceeded"));
+ STAT(dbenv->rep_handle->
+ region->mstat.st_msgs_dropped++);
+! return (0);
+ }
+ }
+
+ /*
+ * Send as much data to the site as we can, without blocking. Keep
+--- 360,393 ----
+ RPRINT(dbenv, (dbenv, "msg to %s to be queued",
+ __repmgr_format_eid_loc(dbenv->rep_handle,
+ conn->eid, buffer)));
++ if (conn->out_queue_length >= OUT_QUEUE_LIMIT &&
++ blockable && !F_ISSET(conn, CONN_CONGESTED)) {
++ RPRINT(dbenv, (dbenv,
++ "block msg thread, await queue space"));
++
++ if ((drain_to = db_rep->ack_timeout) == 0)
++ drain_to = DB_REPMGR_DEFAULT_ACK_TIMEOUT;
++ conn->blockers++;
++ ret = __repmgr_await_drain(dbenv,
++ conn, drain_to * OUT_QUEUE_LIMIT);
++ conn->blockers--;
++ if (db_rep->finished)
++ return (DB_TIMEOUT);
++ if (ret != 0)
++ return (ret);
++ if (STAILQ_EMPTY(&conn->outbound_queue))
++ goto empty;
++ }
+ if (conn->out_queue_length < OUT_QUEUE_LIMIT)
+ return (enqueue_msg(dbenv, conn, msg, 0));
+ else {
+ RPRINT(dbenv, (dbenv, "queue limit exceeded"));
+ STAT(dbenv->rep_handle->
+ region->mstat.st_msgs_dropped++);
+! return (blockable ? DB_TIMEOUT : 0);
+ }
+ }
++ empty:
+
+ /*
+ * Send as much data to the site as we can, without blocking. Keep
+***************
+*** 498,521 ****
+
+ /*
+ * Abandons a connection, to recover from an error. Upon entry the conn struct
+! * must be on the connections list.
+! *
+! * If the 'do_close' flag is true, we do the whole job; the clean-up includes
+! * removing the struct from the list and freeing all its memory, so upon return
+! * the caller must not refer to it any further. Otherwise, we merely mark the
+! * connection for clean-up later by the main thread.
+ *
+ * PUBLIC: int __repmgr_bust_connection __P((DB_ENV *,
+! * PUBLIC: REPMGR_CONNECTION *, int));
+ *
+ * !!!
+ * Caller holds mutex.
+ */
+ int
+! __repmgr_bust_connection(dbenv, conn, do_close)
+ DB_ENV *dbenv;
+ REPMGR_CONNECTION *conn;
+- int do_close;
+ {
+ DB_REP *db_rep;
+ int connecting, ret, eid;
+--- 533,553 ----
+
+ /*
+ * Abandons a connection, to recover from an error. Upon entry the conn struct
+! * must be on the connections list. For now, just mark it as unusable; it will
+! * be fully cleaned up in the top-level select thread, as soon as possible.
+ *
+ * PUBLIC: int __repmgr_bust_connection __P((DB_ENV *,
+! * PUBLIC: REPMGR_CONNECTION *));
+ *
+ * !!!
+ * Caller holds mutex.
++ *
++ * Must be idempotent
+ */
+ int
+! __repmgr_bust_connection(dbenv, conn)
+ DB_ENV *dbenv;
+ REPMGR_CONNECTION *conn;
+ {
+ DB_REP *db_rep;
+ int connecting, ret, eid;
+***************
+*** 526,537 ****
+ DB_ASSERT(dbenv, !TAILQ_EMPTY(&db_rep->connections));
+ eid = conn->eid;
+ connecting = F_ISSET(conn, CONN_CONNECTING);
+! if (do_close)
+! __repmgr_cleanup_connection(dbenv, conn);
+! else {
+! F_SET(conn, CONN_DEFUNCT);
+! conn->eid = -1;
+! }
+
+ /*
+ * When we first accepted the incoming connection, we set conn->eid to
+--- 558,566 ----
+ DB_ASSERT(dbenv, !TAILQ_EMPTY(&db_rep->connections));
+ eid = conn->eid;
+ connecting = F_ISSET(conn, CONN_CONNECTING);
+!
+! F_SET(conn, CONN_DEFUNCT);
+! conn->eid = -1;
+
+ /*
+ * When we first accepted the incoming connection, we set conn->eid to
+***************
+*** 557,563 ****
+ dbenv, ELECT_FAILURE_ELECTION)) != 0)
+ return (ret);
+ }
+! } else if (!do_close) {
+ /*
+ * One way or another, make sure the main thread is poked, so
+ * that we do the deferred clean-up.
+--- 586,592 ----
+ dbenv, ELECT_FAILURE_ELECTION)) != 0)
+ return (ret);
+ }
+! } else {
+ /*
+ * One way or another, make sure the main thread is poked, so
+ * that we do the deferred clean-up.
+***************
+*** 568,577 ****
+ }
+
+ /*
+! * PUBLIC: void __repmgr_cleanup_connection
+ * PUBLIC: __P((DB_ENV *, REPMGR_CONNECTION *));
+ */
+! void
+ __repmgr_cleanup_connection(dbenv, conn)
+ DB_ENV *dbenv;
+ REPMGR_CONNECTION *conn;
+--- 597,610 ----
+ }
+
+ /*
+! * PUBLIC: int __repmgr_cleanup_connection
+ * PUBLIC: __P((DB_ENV *, REPMGR_CONNECTION *));
++ *
++ * !!!
++ * Idempotent. This can be called repeatedly as blocking message threads (of
++ * which there could be multiples) wake up in case of error on the connection.
+ */
+! int
+ __repmgr_cleanup_connection(dbenv, conn)
+ DB_ENV *dbenv;
+ REPMGR_CONNECTION *conn;
+***************
+*** 580,596 ****
+ QUEUED_OUTPUT *out;
+ REPMGR_FLAT *msg;
+ DBT *dbt;
+
+ db_rep = dbenv->rep_handle;
+
+! TAILQ_REMOVE(&db_rep->connections, conn, entries);
+ if (conn->fd != INVALID_SOCKET) {
+! (void)closesocket(conn->fd);
+ #ifdef DB_WIN32
+! (void)WSACloseEvent(conn->event_object);
+ #endif
+ }
+
+ /*
+ * Deallocate any input and output buffers we may have.
+ */
+--- 613,643 ----
+ QUEUED_OUTPUT *out;
+ REPMGR_FLAT *msg;
+ DBT *dbt;
++ int ret;
+
+ db_rep = dbenv->rep_handle;
+
+! DB_ASSERT(dbenv, F_ISSET(conn, CONN_DEFUNCT) || db_rep->finished);
+!
+ if (conn->fd != INVALID_SOCKET) {
+! ret = closesocket(conn->fd);
+! conn->fd = INVALID_SOCKET;
+! if (ret == SOCKET_ERROR) {
+! ret = net_errno;
+! __db_err(dbenv, ret, "closing socket");
+! }
+ #ifdef DB_WIN32
+! if (!WSACloseEvent(conn->event_object) && ret != 0)
+! ret = net_errno;
+ #endif
++ if (ret != 0)
++ return (ret);
+ }
+
++ if (conn->blockers > 0)
++ return (__repmgr_signal(&conn->drained));
++
++ TAILQ_REMOVE(&db_rep->connections, conn, entries);
+ /*
+ * Deallocate any input and output buffers we may have.
+ */
+***************
+*** 614,620 ****
+--- 661,669 ----
+ __os_free(dbenv, out);
+ }
+
++ ret = __repmgr_free_cond(&conn->drained);
+ __os_free(dbenv, conn);
++ return (ret);
+ }
+
+ static int
+***************
+*** 1063,1069 ****
+
+ while (!TAILQ_EMPTY(&db_rep->connections)) {
+ conn = TAILQ_FIRST(&db_rep->connections);
+! __repmgr_cleanup_connection(dbenv, conn);
+ }
+
+ for (i = 0; i < db_rep->site_cnt; i++) {
+--- 1112,1118 ----
+
+ while (!TAILQ_EMPTY(&db_rep->connections)) {
+ conn = TAILQ_FIRST(&db_rep->connections);
+! (void)__repmgr_cleanup_connection(dbenv, conn);
+ }
+
+ for (i = 0; i < db_rep->site_cnt; i++) {
+*** repmgr/repmgr_posix.c 2007-10-31 10:23:52.000000000 -0700
+--- repmgr/repmgr_posix.c 2007-10-31 10:23:53.000000000 -0700
+***************
+*** 21,26 ****
+--- 21,28 ----
+ size_t __repmgr_guesstimated_max = (128 * 1024);
+ #endif
+
++ static int __repmgr_conn_work __P((DB_ENV *,
++ REPMGR_CONNECTION *, fd_set *, fd_set *, int));
+ static int finish_connecting __P((DB_ENV *, REPMGR_CONNECTION *));
+
+ /*
+***************
+*** 189,194 ****
+--- 191,284 ----
+ }
+
+ /*
++ * PUBLIC: int __repmgr_await_drain __P((DB_ENV *,
++ * PUBLIC: REPMGR_CONNECTION *, db_timeout_t));
++ *
++ * Waits for space to become available on the connection's output queue.
++ * Various ways we can exit:
++ *
++ * 1. queue becomes non-full
++ * 2. exceed time limit
++ * 3. connection becomes defunct (due to error in another thread)
++ * 4. repmgr is shutting down
++ * 5. any unexpected system resource failure
++ *
++ * In cases #3 and #5 we return an error code. Caller is responsible for
++ * distinguishing the remaining cases if desired.
++ *
++ * !!!
++ * Caller must hold repmgr->mutex.
++ */
++ int
++ __repmgr_await_drain(dbenv, conn, timeout)
++ DB_ENV *dbenv;
++ REPMGR_CONNECTION *conn;
++ db_timeout_t timeout;
++ {
++ DB_REP *db_rep;
++ struct timespec deadline;
++ int ret;
++
++ db_rep = dbenv->rep_handle;
++
++ __repmgr_compute_wait_deadline(dbenv, &deadline, timeout);
++
++ ret = 0;
++ while (conn->out_queue_length >= OUT_QUEUE_LIMIT) {
++ ret = pthread_cond_timedwait(&conn->drained,
++ &db_rep->mutex, &deadline);
++ switch (ret) {
++ case 0:
++ if (db_rep->finished)
++ goto out; /* #4. */
++ /*
++ * Another thread could have stumbled into an error on
++ * the socket while we were waiting.
++ */
++ if (F_ISSET(conn, CONN_DEFUNCT)) {
++ ret = DB_REP_UNAVAIL; /* #3. */
++ goto out;
++ }
++ break;
++ case ETIMEDOUT:
++ F_SET(conn, CONN_CONGESTED);
++ ret = 0;
++ goto out; /* #2. */
++ default:
++ goto out; /* #5. */
++ }
++ }
++ /* #1. */
++
++ out:
++ return (ret);
++ }
++
++ /*
++ * PUBLIC: int __repmgr_alloc_cond __P((cond_var_t *));
++ *
++ * Initialize a condition variable (in allocated space).
++ */
++ int
++ __repmgr_alloc_cond(c)
++ cond_var_t *c;
++ {
++ return (pthread_cond_init(c, NULL));
++ }
++
++ /*
++ * PUBLIC: int __repmgr_free_cond __P((cond_var_t *));
++ *
++ * Clean up a previously initialized condition variable.
++ */
++ int
++ __repmgr_free_cond(c)
++ cond_var_t *c;
++ {
++ return (pthread_cond_destroy(c));
++ }
++
++ /*
+ * PUBLIC: int __repmgr_init_sync __P((DB_ENV *, DB_REP *));
+ *
+ * Allocate/initialize all data necessary for thread synchronization. This
+***************
+*** 443,449 ****
+ REPMGR_RETRY *retry;
+ db_timespec timeout;
+ fd_set reads, writes;
+! int ret, flow_control, maxfd, nready;
+ u_int8_t buf[10]; /* arbitrary size */
+
+ flow_control = FALSE;
+--- 533,539 ----
+ REPMGR_RETRY *retry;
+ db_timespec timeout;
+ fd_set reads, writes;
+! int ret, flow_control, maxfd;
+ u_int8_t buf[10]; /* arbitrary size */
+
+ flow_control = FALSE;
+***************
+*** 477,482 ****
+--- 567,575 ----
+ * each one.
+ */
+ TAILQ_FOREACH(conn, &db_rep->connections, entries) {
++ if (F_ISSET(conn, CONN_DEFUNCT))
++ continue;
++
+ if (F_ISSET(conn, CONN_CONNECTING)) {
+ FD_SET((u_int)conn->fd, &reads);
+ FD_SET((u_int)conn->fd, &writes);
+***************
+*** 533,616 ****
+ return (ret);
+ }
+ }
+- nready = ret;
+-
+ LOCK_MUTEX(db_rep->mutex);
+
+- /*
+- * The first priority thing we must do is to clean up any
+- * pending defunct connections. Otherwise, if they have any
+- * lingering pending input, we get very confused if we try to
+- * process it.
+- *
+- * The TAILQ_FOREACH macro would be suitable here, except that
+- * it doesn't allow unlinking the current element, which is
+- * needed for cleanup_connection.
+- */
+- for (conn = TAILQ_FIRST(&db_rep->connections);
+- conn != NULL;
+- conn = next) {
+- next = TAILQ_NEXT(conn, entries);
+- if (F_ISSET(conn, CONN_DEFUNCT))
+- __repmgr_cleanup_connection(dbenv, conn);
+- }
+-
+ if ((ret = __repmgr_retry_connections(dbenv)) != 0)
+ goto out;
+- if (nready == 0)
+- continue;
+
+ /*
+! * Traverse the linked list. (Again, like TAILQ_FOREACH, except
+! * that we need the ability to unlink an element along the way.)
+ */
+ for (conn = TAILQ_FIRST(&db_rep->connections);
+ conn != NULL;
+ conn = next) {
+ next = TAILQ_NEXT(conn, entries);
+! if (F_ISSET(conn, CONN_CONNECTING)) {
+! if (FD_ISSET((u_int)conn->fd, &reads) ||
+! FD_ISSET((u_int)conn->fd, &writes)) {
+! if ((ret = finish_connecting(dbenv,
+! conn)) == DB_REP_UNAVAIL) {
+! if ((ret =
+! __repmgr_bust_connection(
+! dbenv, conn, TRUE)) != 0)
+! goto out;
+! } else if (ret != 0)
+! goto out;
+! }
+! continue;
+! }
+!
+! /*
+! * Here, the site is connected, and the FD_SET's are
+! * valid.
+! */
+! if (FD_ISSET((u_int)conn->fd, &writes)) {
+! if ((ret = __repmgr_write_some(
+! dbenv, conn)) == DB_REP_UNAVAIL) {
+! if ((ret =
+! __repmgr_bust_connection(dbenv,
+! conn, TRUE)) != 0)
+! goto out;
+! continue;
+! } else if (ret != 0)
+! goto out;
+! }
+!
+! if (!flow_control &&
+! FD_ISSET((u_int)conn->fd, &reads)) {
+! if ((ret = __repmgr_read_from_site(dbenv, conn))
+! == DB_REP_UNAVAIL) {
+! if ((ret =
+! __repmgr_bust_connection(dbenv,
+! conn, TRUE)) != 0)
+! goto out;
+! continue;
+! } else if (ret != 0)
+! goto out;
+! }
+ }
+
+ /*
+--- 626,650 ----
+ return (ret);
+ }
+ }
+ LOCK_MUTEX(db_rep->mutex);
+
+ if ((ret = __repmgr_retry_connections(dbenv)) != 0)
+ goto out;
+
+ /*
+! * Examine each connection, to see what work needs to be done.
+! *
+! * The TAILQ_FOREACH macro would be suitable here, except that
+! * it doesn't allow unlinking the current element, which is
+! * needed for cleanup_connection.
+ */
+ for (conn = TAILQ_FIRST(&db_rep->connections);
+ conn != NULL;
+ conn = next) {
+ next = TAILQ_NEXT(conn, entries);
+! if ((ret = __repmgr_conn_work(dbenv,
+! conn, &reads, &writes, flow_control)) != 0)
+! goto out;
+ }
+
+ /*
+***************
+*** 637,642 ****
+--- 671,719 ----
+ }
+
+ static int
++ __repmgr_conn_work(dbenv, conn, reads, writes, flow_control)
++ DB_ENV *dbenv;
++ REPMGR_CONNECTION *conn;
++ fd_set *reads, *writes;
++ int flow_control;
++ {
++ int ret;
++ u_int fd;
++
++ if (F_ISSET(conn, CONN_DEFUNCT)) {
++ /*
++ * Deferred clean-up, from an error that happened in another
++ * thread, while we were sleeping in select().
++ */
++ return (__repmgr_cleanup_connection(dbenv, conn));
++ }
++
++ ret = 0;
++ fd = (u_int)conn->fd;
++
++ if (F_ISSET(conn, CONN_CONNECTING)) {
++ if (FD_ISSET(fd, reads) || FD_ISSET(fd, writes))
++ ret = finish_connecting(dbenv, conn);
++ } else {
++ /*
++ * Here, the site is connected, and the FD_SET's are valid.
++ */
++ if (FD_ISSET(fd, writes))
++ ret = __repmgr_write_some(dbenv, conn);
++
++ if (ret == 0 && !flow_control && FD_ISSET(fd, reads))
++ ret = __repmgr_read_from_site(dbenv, conn);
++ }
++
++ if (ret == DB_REP_UNAVAIL) {
++ if ((ret = __repmgr_bust_connection(dbenv, conn)) != 0)
++ return (ret);
++ ret = __repmgr_cleanup_connection(dbenv, conn);
++ }
++ return (ret);
++ }
++
++ static int
+ finish_connecting(dbenv, conn)
+ DB_ENV *dbenv;
+ REPMGR_CONNECTION *conn;
+***************
+*** 657,662 ****
+--- 734,740 ----
+ goto err_rpt;
+ }
+
++ DB_ASSERT(dbenv, F_ISSET(conn, CONN_CONNECTING));
+ F_CLR(conn, CONN_CONNECTING);
+ return (__repmgr_send_handshake(dbenv, conn));
+
+***************
+*** 671,690 ****
+ "connecting to %s", __repmgr_format_site_loc(site, buffer));
+
+ /* If we've exhausted the list of possible addresses, give up. */
+! if (ADDR_LIST_NEXT(&site->net_addr) == NULL)
+ return (DB_REP_UNAVAIL);
+
+ /*
+ * This is just like a little mini-"bust_connection", except that we
+ * don't reschedule for later, 'cuz we're just about to try again right
+! * now.
+ *
+ * !!!
+ * Which means this must only be called on the select() thread, since
+ * only there are we allowed to actually close a connection.
+ */
+ DB_ASSERT(dbenv, !TAILQ_EMPTY(&db_rep->connections));
+! __repmgr_cleanup_connection(dbenv, conn);
+ ret = __repmgr_connect_site(dbenv, eid);
+ DB_ASSERT(dbenv, ret != DB_REP_UNAVAIL);
+ return (ret);
+--- 749,773 ----
+ "connecting to %s", __repmgr_format_site_loc(site, buffer));
+
+ /* If we've exhausted the list of possible addresses, give up. */
+! if (ADDR_LIST_NEXT(&site->net_addr) == NULL) {
+! STAT(db_rep->region->mstat.st_connect_fail++);
+ return (DB_REP_UNAVAIL);
++ }
+
+ /*
+ * This is just like a little mini-"bust_connection", except that we
+ * don't reschedule for later, 'cuz we're just about to try again right
+! * now. (Note that we don't have to worry about message threads
+! * blocking on a full output queue: that can't happen when we're only
+! * just connecting.)
+ *
+ * !!!
+ * Which means this must only be called on the select() thread, since
+ * only there are we allowed to actually close a connection.
+ */
+ DB_ASSERT(dbenv, !TAILQ_EMPTY(&db_rep->connections));
+! if ((ret = __repmgr_cleanup_connection(dbenv, conn)) != 0)
+! return (ret);
+ ret = __repmgr_connect_site(dbenv, eid);
+ DB_ASSERT(dbenv, ret != DB_REP_UNAVAIL);
+ return (ret);
+*** repmgr/repmgr_sel.c 2007-10-31 10:23:52.000000000 -0700
+--- repmgr/repmgr_sel.c 2007-10-31 10:23:53.000000000 -0700
+***************
+*** 36,45 ****
+
+ /*
+ * PUBLIC: int __repmgr_accept __P((DB_ENV *));
+- *
+- * !!!
+- * Only ever called in the select() thread, since we may call
+- * __repmgr_bust_connection(..., TRUE).
+ */
+ int
+ __repmgr_accept(dbenv)
+--- 36,41 ----
+***************
+*** 133,139 ****
+ case 0:
+ return (0);
+ case DB_REP_UNAVAIL:
+! return (__repmgr_bust_connection(dbenv, conn, TRUE));
+ default:
+ return (ret);
+ }
+--- 129,135 ----
+ case 0:
+ return (0);
+ case DB_REP_UNAVAIL:
+! return (__repmgr_bust_connection(dbenv, conn));
+ default:
+ return (ret);
+ }
+***************
+*** 254,263 ****
+ * starting with the "current" element of its address list and trying as many
+ * addresses as necessary until the list is exhausted.
+ *
+- * !!!
+- * Only ever called in the select() thread, since we may call
+- * __repmgr_bust_connection(..., TRUE).
+- *
+ * PUBLIC: int __repmgr_connect_site __P((DB_ENV *, u_int eid));
+ */
+ int
+--- 250,255 ----
+***************
+*** 332,338 ****
+ case 0:
+ break;
+ case DB_REP_UNAVAIL:
+! return (__repmgr_bust_connection(dbenv, con, TRUE));
+ default:
+ return (ret);
+ }
+--- 324,330 ----
+ case 0:
+ break;
+ case DB_REP_UNAVAIL:
+! return (__repmgr_bust_connection(dbenv, con));
+ default:
+ return (ret);
+ }
+***************
+*** 437,443 ****
+
+ DB_SET_DBT(rec, my_addr->host, strlen(my_addr->host) + 1);
+
+! return (__repmgr_send_one(dbenv, conn, REPMGR_HANDSHAKE, &cntrl, &rec));
+ }
+
+ /*
+--- 429,443 ----
+
+ DB_SET_DBT(rec, my_addr->host, strlen(my_addr->host) + 1);
+
+! /*
+! * It would of course be disastrous to block the select() thread, so
+! * pass the "blockable" argument as FALSE. Fortunately blocking should
+! * never be necessary here, because the hand-shake is always the first
+! * thing we send. Which is a good thing, because it would be almost as
+! * disastrous if we allowed ourselves to drop a handshake.
+! */
+! return (__repmgr_send_one(dbenv,
+! conn, REPMGR_HANDSHAKE, &cntrl, &rec, FALSE));
+ }
+
+ /*
+***************
+*** 854,859 ****
+--- 854,872 ----
+ conn->out_queue_length--;
+ if (--msg->ref_count <= 0)
+ __os_free(dbenv, msg);
++
++ /*
++ * We've achieved enough movement to free up at least
++ * one space in the outgoing queue. Wake any message
++ * threads that may be waiting for space. Clear the
++ * CONGESTED status so that when the queue reaches the
++ * high-water mark again, the filling thread will be
++ * allowed to try waiting again.
++ */
++ F_CLR(conn, CONN_CONGESTED);
++ if (conn->blockers > 0 &&
++ (ret = __repmgr_signal(&conn->drained)) != 0)
++ return (ret);
+ }
+ }
+
+*** repmgr/repmgr_util.c 2007-10-31 10:23:52.000000000 -0700
+--- repmgr/repmgr_util.c 2007-10-31 10:23:53.000000000 -0700
+***************
+*** 103,108 ****
+--- 103,113 ----
+ db_rep = dbenv->rep_handle;
+ if ((ret = __os_malloc(dbenv, sizeof(REPMGR_CONNECTION), &c)) != 0)
+ return (ret);
++ if ((ret = __repmgr_alloc_cond(&c->drained)) != 0) {
++ __os_free(dbenv, c);
++ return (ret);
++ }
++ c->blockers = 0;
+
+ c->fd = s;
+ c->flags = flags;
+*** repmgr/repmgr_windows.c 2007-10-31 10:23:52.000000000 -0700
+--- repmgr/repmgr_windows.c 2007-10-31 10:23:53.000000000 -0700
+***************
+*** 11,16 ****
+--- 11,19 ----
+ #define __INCLUDE_NETWORKING 1
+ #include "db_int.h"
+
++ /* Convert time-out from microseconds to milliseconds, rounding up. */
++ #define DB_TIMEOUT_TO_WINDOWS_TIMEOUT(t) (((t) + (US_PER_MS - 1)) / US_PER_MS)
++
+ typedef struct __ack_waiter {
+ HANDLE event;
+ const DB_LSN *lsnp;
+***************
+*** 120,136 ****
+ {
+ DB_REP *db_rep;
+ ACK_WAITER *me;
+! DWORD ret;
+! DWORD timeout;
+
+ db_rep = dbenv->rep_handle;
+
+ if ((ret = allocate_wait_slot(dbenv, &me)) != 0)
+ goto err;
+
+- /* convert time-out from microseconds to milliseconds, rounding up */
+ timeout = db_rep->ack_timeout > 0 ?
+! ((db_rep->ack_timeout + (US_PER_MS - 1)) / US_PER_MS) : INFINITE;
+ me->lsnp = lsnp;
+ if ((ret = SignalObjectAndWait(db_rep->mutex, me->event, timeout,
+ FALSE)) == WAIT_FAILED) {
+--- 123,137 ----
+ {
+ DB_REP *db_rep;
+ ACK_WAITER *me;
+! DWORD ret, timeout;
+
+ db_rep = dbenv->rep_handle;
+
+ if ((ret = allocate_wait_slot(dbenv, &me)) != 0)
+ goto err;
+
+ timeout = db_rep->ack_timeout > 0 ?
+! DB_TIMEOUT_TO_WINDOWS_TIMEOUT(db_rep->ack_timeout) : INFINITE;
+ me->lsnp = lsnp;
+ if ((ret = SignalObjectAndWait(db_rep->mutex, me->event, timeout,
+ FALSE)) == WAIT_FAILED) {
+***************
+*** 211,216 ****
+--- 212,296 ----
+ db_rep->waiters->first_free = slot;
+ }
+
++ /* (See requirements described in repmgr_posix.c.) */
++ int
++ __repmgr_await_drain(dbenv, conn, timeout)
++ DB_ENV *dbenv;
++ REPMGR_CONNECTION *conn;
++ db_timeout_t timeout;
++ {
++ DB_REP *db_rep;
++ db_timespec deadline, delta, now;
++ db_timeout_t t;
++ DWORD duration, ret;
++ int round_up;
++
++ db_rep = dbenv->rep_handle;
++
++ __os_gettime(dbenv, &deadline);
++ DB_TIMEOUT_TO_TIMESPEC(timeout, &delta);
++ timespecadd(&deadline, &delta);
++
++ while (conn->out_queue_length >= OUT_QUEUE_LIMIT) {
++ if (!ResetEvent(conn->drained))
++ return (GetLastError());
++
++ /* How long until the deadline? */
++ __os_gettime(dbenv, &now);
++ if (timespeccmp(&now, &deadline, >=)) {
++ F_SET(conn, CONN_CONGESTED);
++ return (0);
++ }
++ delta = deadline;
++ timespecsub(&delta, &now);
++ round_up = TRUE;
++ DB_TIMESPEC_TO_TIMEOUT(t, &delta, round_up);
++ duration = DB_TIMEOUT_TO_WINDOWS_TIMEOUT(t);
++
++ ret = SignalObjectAndWait(db_rep->mutex,
++ conn->drained, duration, FALSE);
++ LOCK_MUTEX(db_rep->mutex);
++ if (ret == WAIT_FAILED)
++ return (GetLastError());
++ else if (ret == WAIT_TIMEOUT) {
++ F_SET(conn, CONN_CONGESTED);
++ return (0);
++ } else
++ DB_ASSERT(dbenv, ret == WAIT_OBJECT_0);
++
++ if (db_rep->finished)
++ return (0);
++ if (F_ISSET(conn, CONN_DEFUNCT))
++ return (DB_REP_UNAVAIL);
++ }
++ return (0);
++ }
++
++ /*
++ * Creates a manual reset event, which is usually our best choice when we may
++ * have multiple threads waiting on a single event.
++ */
++ int
++ __repmgr_alloc_cond(c)
++ cond_var_t *c;
++ {
++ HANDLE event;
++
++ if ((event = CreateEvent(NULL, TRUE, FALSE, NULL)) == NULL)
++ return (GetLastError());
++ *c = event;
++ return (0);
++ }
++
++ int
++ __repmgr_free_cond(c)
++ cond_var_t *c;
++ {
++ if (CloseHandle(*c))
++ return (0);
++ return (GetLastError());
++ }
++
+ /*
+ * Make resource allocation an all-or-nothing affair, outside of this and the
+ * close_sync function. db_rep->waiters should be non-NULL iff all of these
+***************
+*** 488,493 ****
+--- 568,576 ----
+ * don't hurt anything flow-control-wise.
+ */
+ TAILQ_FOREACH(conn, &db_rep->connections, entries) {
++ if (F_ISSET(conn, CONN_DEFUNCT))
++ continue;
++
+ if (F_ISSET(conn, CONN_CONNECTING) ||
+ !STAILQ_EMPTY(&conn->outbound_queue) ||
+ (!flow_control || !IS_VALID_EID(conn->eid))) {
+***************
+*** 534,541 ****
+ conn != NULL;
+ conn = next) {
+ next = TAILQ_NEXT(conn, entries);
+! if (F_ISSET(conn, CONN_DEFUNCT))
+! __repmgr_cleanup_connection(dbenv, conn);
+ }
+
+ /*
+--- 617,626 ----
+ conn != NULL;
+ conn = next) {
+ next = TAILQ_NEXT(conn, entries);
+! if (F_ISSET(conn, CONN_DEFUNCT) &&
+! (ret = __repmgr_cleanup_connection(dbenv,
+! conn)) != 0)
+! goto unlock;
+ }
+
+ /*
+***************
+*** 587,597 ****
+ return (ret);
+ }
+
+- /*
+- * !!!
+- * Only ever called on the select() thread, since we may call
+- * __repmgr_bust_connection(..., TRUE).
+- */
+ static int
+ handle_completion(dbenv, conn)
+ DB_ENV *dbenv;
+--- 672,677 ----
+***************
+*** 651,660 ****
+ }
+ }
+
+! return (0);
+!
+! err: if (ret == DB_REP_UNAVAIL)
+! return (__repmgr_bust_connection(dbenv, conn, TRUE));
+ return (ret);
+ }
+
+--- 731,742 ----
+ }
+ }
+
+! err:
+! if (ret == DB_REP_UNAVAIL) {
+! if ((ret = __repmgr_bust_connection(dbenv, conn)) != 0)
+! return (ret);
+! ret = __repmgr_cleanup_connection(dbenv, conn);
+! }
+ return (ret);
+ }
+
+***************
+*** 708,714 ****
+ }
+
+ DB_ASSERT(dbenv, !TAILQ_EMPTY(&db_rep->connections));
+! __repmgr_cleanup_connection(dbenv, conn);
+ ret = __repmgr_connect_site(dbenv, eid);
+ DB_ASSERT(dbenv, ret != DB_REP_UNAVAIL);
+ return (ret);
+--- 790,797 ----
+ }
+
+ DB_ASSERT(dbenv, !TAILQ_EMPTY(&db_rep->connections));
+! if ((ret = __repmgr_cleanup_connection(dbenv, conn)) != 0)
+! return (ret);
+ ret = __repmgr_connect_site(dbenv, eid);
+ DB_ASSERT(dbenv, ret != DB_REP_UNAVAIL);
+ return (ret);
diff --git a/extra/diffutils/APKBUILD b/extra/diffutils/APKBUILD
new file mode 100644
index 00000000..89be666f
--- /dev/null
+++ b/extra/diffutils/APKBUILD
@@ -0,0 +1,25 @@
+# Maintainer: Leonardo Arena <rnalrd@gmail.com>
+pkgname=diffutils
+pkgver=2.8.1
+pkgrel=0
+pkgdesc="Show differences among files"
+subpackages="$pkgname-doc"
+arch=""
+url="http://www.gnu.org/software/diffutils/"
+license="GPL2"
+depends="uclibc"
+makedepends=""
+install=
+source="http://ftp.gnu.org/pub/gnu/diffutils/diffutils-2.8.1.tar.gz"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info
+ make || return 1
+ make check || return 1
+ make install DESTDIR=$pkgdir
+}
+md5sums="71f9c5ae19b60608f6c7f162da86a428 diffutils-2.8.1.tar.gz"
diff --git a/extra/dnsmasq/APKBUILD b/extra/dnsmasq/APKBUILD
new file mode 100644
index 00000000..a5ee1c9c
--- /dev/null
+++ b/extra/dnsmasq/APKBUILD
@@ -0,0 +1,35 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=dnsmasq
+pkgver=2.46
+pkgrel=0
+pkgdesc="Small forwarding DNS server"
+url="http://www.thekelleys.org.uk/dnsmasq/"
+license="GPL-2"
+depends="uclibc"
+subpackages="$pkgname-doc"
+source="http://www.thekelleys.org.uk/dnsmasq/$pkgname-$pkgver.tar.gz
+ $pkgname.initd
+ $pkgname.confd
+ "
+
+build() {
+ # src_unpack
+ cd "$srcdir/$pkgname-$pkgver"
+ sed -i -e 's/^AWK.*/AWK = awk/' Makefile
+ make PREFIX=/usr \
+ CFLAGS="$CFLAGS" \
+ DBUS_LIBS= \
+ DBUS_CFLAGS= \
+ DBUS_MINOR= \
+ all || return 1
+ make PREFIX=/usr \
+ DESTDIR="$pkgdir" \
+ DBUS_LIBS= \
+ DBUS_CFLAGS= \
+ DBUS_MINOR= \
+ install
+ install -D -m755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+ install -D -m644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
+ install dnsmasq.conf.example "$pkgdir"/etc/dnsmasq.conf
+}
+md5sums="79ec740d1a10ee75f13efa4ff36d0250 dnsmasq-2.46.tar.gz"
diff --git a/extra/dnsmasq/dnsmasq.confd b/extra/dnsmasq/dnsmasq.confd
new file mode 100644
index 00000000..47826dd5
--- /dev/null
+++ b/extra/dnsmasq/dnsmasq.confd
@@ -0,0 +1,4 @@
+# /etc/conf.d/dnsmasq: config file for /etc/init.d/dnsmasq
+
+# See the dnsmasq(8) man page for possible options to put here.
+DNSMASQ_OPTS=""
diff --git a/extra/dnsmasq/dnsmasq.initd b/extra/dnsmasq/dnsmasq.initd
new file mode 100644
index 00000000..44109e98
--- /dev/null
+++ b/extra/dnsmasq/dnsmasq.initd
@@ -0,0 +1,38 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Header: /var/cvsroot/gentoo-x86/net-dns/dnsmasq/files/dnsmasq-init,v 1.13 2008/01/29 15:06:30 flameeyes Exp $
+
+opts="reload"
+
+depend() {
+ provide dns
+ need localmount net
+ after bootmisc
+}
+
+start() {
+ ebegin "Starting ${SVCNAME}"
+ start-stop-daemon --start --exec /usr/sbin/dnsmasq \
+ --pidfile /var/run/dnsmasq.pid \
+ -- -x /var/run/dnsmasq.pid ${DNSMASQ_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${SVCNAME}"
+ start-stop-daemon --stop --exec /usr/sbin/dnsmasq \
+ --pidfile /var/run/dnsmasq.pid
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading ${SVCNAME}"
+ if ! service_started "${SVCNAME}" ; then
+ eend 1 "${SVCNAME} is not started"
+ return 1
+ fi
+ start-stop-daemon --stop --oknodo --signal HUP \
+ --exec /usr/sbin/dnsmasq --pidfile /var/run/dnsmasq.pid
+ eend $?
+}
diff --git a/extra/dropbear/APKBUILD b/extra/dropbear/APKBUILD
new file mode 100644
index 00000000..ca4af482
--- /dev/null
+++ b/extra/dropbear/APKBUILD
@@ -0,0 +1,38 @@
+# Contributor: Carlo Landmeter <clandmeter at gmail>
+pkgname=dropbear
+pkgver=0.52
+pkgrel=1
+pkgdesc="small SSH 2 client/server designed for small memory environments"
+url="http://matt.ucc.asn.au/dropbear/dropbear.html"
+license='MIT'
+depends="zlib"
+makedepends="zlib-dev"
+source="http://matt.ucc.asn.au/dropbear/releases/${pkgname}-${pkgver}.tar.bz2
+dropbear.initd
+dropbear.confd"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr \
+ --disable-lastlog
+ progs="dbclient dropbearkey dropbearconvert scp"
+ make PROGRAMS="dropbear ${progs}" MULTI=1 || return 1
+ install -Dm755 "$srcdir/$pkgname-$pkgver"/dropbearmulti "$pkgdir"/usr/bin/dropbearmulti || return 1
+ cd "$pkgdir/usr/bin" || return 1
+ for i in ${progs}; do
+ msg "linking ${i##*/}"
+ ln -s dropbearmulti $i || return 1
+ done
+ msg "linking dropbear"
+ mkdir -p "$pkgdir"/usr/sbin || return 1
+ cd "$pkgdir/usr/sbin" || return 1
+ ln -s ../bin/dropbearmulti dropbear || return 1
+ install -D -m755 "$srcdir"/dropbear.initd "$pkgdir"/etc/init.d/dropbear || return 1
+ install -D -m644 "$srcdir"/dropbear.confd "$pkgdir"/etc/conf.d/dropbear || return 1
+}
+
+md5sums="a1fc7adf601bca53330a792a9c873439 dropbear-0.52.tar.bz2
+34fea1c967596ebcd6d10d38444f2b92 dropbear.initd
+af73c487e2be37d65d0e8bf80489357e dropbear.confd"
+
diff --git a/extra/dropbear/dropbear.confd b/extra/dropbear/dropbear.confd
new file mode 100644
index 00000000..555f275d
--- /dev/null
+++ b/extra/dropbear/dropbear.confd
@@ -0,0 +1,6 @@
+# /etc/conf.d/dropbear: config file for /etc/init.d/dropbear
+
+# see `dropbear -h` for more information
+# -w disables root logins
+# -p # changes the port number to listen on
+DROPBEAR_OPTS=""
diff --git a/extra/dropbear/dropbear.initd b/extra/dropbear/dropbear.initd
new file mode 100644
index 00000000..afdee8c6
--- /dev/null
+++ b/extra/dropbear/dropbear.initd
@@ -0,0 +1,36 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/dropbear/files/dropbear.init.d,v 1.2 2004/07/14 23:57:35 agriffis Exp $
+
+depend() {
+ use logger dns
+ need net
+}
+
+check_config() {
+ if [ ! -e /etc/dropbear/ ] ; then
+ mkdir /etc/dropbear/
+ fi
+ if [ ! -e /etc/dropbear/dropbear_dss_host_key ] ; then
+ einfo "Generating DSS-Hostkey..."
+ /usr/bin/dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
+ fi
+ if [ ! -e /etc/dropbear/dropbear_rsa_host_key ] ; then
+ einfo "Generating RSA-Hostkey..."
+ /usr/bin/dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
+ fi
+}
+
+start() {
+ check_config || return 1
+ ebegin "Starting dropbear"
+ /usr/sbin/dropbear ${DROPBEAR_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping dropbear"
+ start-stop-daemon --stop --pidfile /var/run/dropbear.pid
+ eend $?
+}
diff --git a/extra/dtach/APKBUILD b/extra/dtach/APKBUILD
new file mode 100644
index 00000000..120ef4ee
--- /dev/null
+++ b/extra/dtach/APKBUILD
@@ -0,0 +1,23 @@
+# Maintainer: Carlo Landmeter <clandmeter at gmail.com>
+pkgname=dtach
+pkgver=0.8
+pkgrel=0
+pkgdesc="A program that emulates the detach feature of screen"
+url="http://dtach.sourceforge.net"
+license='GPL'
+depends="uclibc"
+makedepends=""
+source="http://surfnet.dl.sourceforge.net/sourceforge/dtach/dtach-0.8.tar.gz"
+subpackages="$pkgname-doc"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr
+ make || return 1
+ install -Dm755 "$srcdir"/dtach-0.8/dtach "$pkgdir"/usr/bin/dtach
+ install -Dm644 "$srcdir"/dtach-0.8/dtach.1 "$pkgdir"/usr/share/man/man1/dtach.1
+ install -Dm644 "$srcdir"/dtach-0.8/README "$pkgdir"/usr/share/doc/README
+}
+
+md5sums="ec5999f3b6bb67da19754fcb2e5221f3 dtach-0.8.tar.gz"
diff --git a/extra/email/APKBUILD b/extra/email/APKBUILD
new file mode 100644
index 00000000..a1301fe0
--- /dev/null
+++ b/extra/email/APKBUILD
@@ -0,0 +1,25 @@
+# Maintainer: Carlo Landmeter <clandmeter at gmail.com>
+pkgname=email
+pkgver=3.1.2
+pkgrel=0
+pkgdesc="A command line SMTP client that's simple"
+url="http://www.cleancode.org/projects/email"
+license="GPL"
+depends="uclibc openssl"
+makedepends="openssl-dev"
+source="http://www.cleancode.org/downloads/email/email-3.1.2.tar.bz2"
+
+subpackages="$pkgname-doc"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man
+ make || return 1
+ make DESTDIR="$pkgdir" install
+}
+
+md5sums="468c32758a01d1def084b5a7aaf631ac email-3.1.2.tar.bz2"
diff --git a/extra/email/email-3.1.0-doc.patch b/extra/email/email-3.1.0-doc.patch
new file mode 100644
index 00000000..d7467844
--- /dev/null
+++ b/extra/email/email-3.1.0-doc.patch
@@ -0,0 +1,10 @@
+--- email-3.1.0.orig/configure.in Thu Jan 1 12:00:53 2009
++++ email-3.1.0/configure.in Thu Jan 1 12:01:16 2009
+@@ -65,7 +65,6 @@
+ CFLAGS="$CFLAGS -DUSE_GNU_STRFTIME"
+ fi
+
+-AC_SUBST(docdir, ["\${prefix}/doc/email-${version}"])
+ AC_SUBST(ver, ["$version"])
+
+ CFLAGS="$CFLAGS -I$cwd -I$cwd/src -I$cwd/include -I../include -I$cwd/dlib/include"
diff --git a/extra/email/email-3.1.0-ldflags.patch b/extra/email/email-3.1.0-ldflags.patch
new file mode 100644
index 00000000..d08896ee
--- /dev/null
+++ b/extra/email/email-3.1.0-ldflags.patch
@@ -0,0 +1,11 @@
+--- email-3.1.0.orig/src/Makefile.in Tue Dec 30 13:16:08 2008
++++ email-3.1.0/src/Makefile.in Tue Dec 30 13:17:00 2008
+@@ -18,7 +18,7 @@
+ remotesmtp.o sig_file.o smtpcommands.o utils.o
+
+ all: $(FILES)
+- $(CC) $(CFLAGS) -o email $(FILES) $(OTHER_FILES) $(LDFLAGS) $(LIBS) $(DLIB)
++ $(CC) $(CFLAGS) -o email $(FILES) $(OTHER_FILES) $(DLIB) $(LDFLAGS) $(LIBS)
+
+ clean:
+ rm -f *.o *.d email
diff --git a/extra/ethtool/APKBUILD b/extra/ethtool/APKBUILD
new file mode 100644
index 00000000..50c92d40
--- /dev/null
+++ b/extra/ethtool/APKBUILD
@@ -0,0 +1,21 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=ethtool
+pkgver=6
+pkgrel=0
+pkgdesc="gkernel ethtool"
+url="http://sourceforge.net/projects/gkernel/"
+license="GPL"
+depends="uclibc"
+makedepends=""
+source="http://easynews.dl.sf.net/sourceforge/gkernel/$pkgname-$pkgver.tar.gz"
+subpackages="$pkgname-doc"
+
+build ()
+{
+ cd "$srcdir/$pkgname-$pkgver"
+ ./configure --prefix=/usr \
+ --mandir=/usr/share/man
+ make || return 1
+ make DESTDIR="$pkgdir" install
+}
+md5sums="3b721ec27f17ebf320ba8c505cf66d9c ethtool-6.tar.gz"
diff --git a/extra/fping/APKBUILD b/extra/fping/APKBUILD
new file mode 100644
index 00000000..11b4f181
--- /dev/null
+++ b/extra/fping/APKBUILD
@@ -0,0 +1,23 @@
+pkgname=fping
+pkgver=2.4_beta2
+_myver=2.4b2_to
+pkgrel=1
+pkgdesc="A utility to ping multiple hosts at once"
+url="http://www.fping.com/"
+license="fping"
+depends="uclibc"
+subpackages="$pkgname-doc"
+
+# what happened to upstream download? use gentoo distfiles meanwhile
+#source="http://www.$pkgname.com/download/$pkgname-${myver}.tar.gz"
+source=http://distfiles.gentoo.org/distfiles/fping-${_myver}.tar.gz
+
+
+build () {
+ cd $startdir/src/$pkgname-${_myver}
+ ./configure --prefix=/usr \
+ --mandir=/usr/share/man
+ make || return 1
+ make install DESTDIR="$pkgdir"
+}
+md5sums="d5e8be59e307cef76bc479e1684df705 fping-2.4b2_to.tar.gz"
diff --git a/extra/freetype/10-bytecode.patch b/extra/freetype/10-bytecode.patch
new file mode 100644
index 00000000..dd901ad6
--- /dev/null
+++ b/extra/freetype/10-bytecode.patch
@@ -0,0 +1,29 @@
+--- include/freetype/config/ftoption.h.old 2006-05-12 02:05:49.000000000 +0800
++++ include/freetype/config/ftoption.h 2006-10-02 01:22:50.000000000 +0800
+@@ -436,7 +436,7 @@
+ /* Do not #undef this macro here, since the build system might */
+ /* define it for certain configurations only. */
+ /* */
+-/* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
++#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+
+ /*************************************************************************/
+@@ -448,7 +448,7 @@
+ /* FT_PARAM_TAG_UNPATENTED_HINTING; or when the debug hook */
+ /* FT_DEBUG_HOOK_UNPATENTED_HINTING is globally activated. */
+ /* */
+-#define TT_CONFIG_OPTION_UNPATENTED_HINTING
++#undef TT_CONFIG_OPTION_UNPATENTED_HINTING
+
+
+ /*************************************************************************/
+@@ -480,7 +480,7 @@
+ /* http://partners.adobe.com/asn/developer/opentype/glyf.html */
+ /* http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html */
+ /* */
+-#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED
++#define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED
+
+
+ /*************************************************************************/
diff --git a/extra/freetype/20-enable-spr.patch b/extra/freetype/20-enable-spr.patch
new file mode 100644
index 00000000..217912aa
--- /dev/null
+++ b/extra/freetype/20-enable-spr.patch
@@ -0,0 +1,11 @@
+--- include/freetype/config/ftoption.h.spf 2007-01-18 14:27:34.000000000 -0500
++++ include/freetype/config/ftoption.h 2007-01-18 14:27:48.000000000 -0500
+@@ -92,7 +92,7 @@
+ /* This is done to allow FreeType clients to run unmodified, forcing */
+ /* them to display normal gray-level anti-aliased glyphs. */
+ /* */
+-/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
++#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING
+
+
+ /*************************************************************************/
diff --git a/extra/freetype/30-enable-valid.patch b/extra/freetype/30-enable-valid.patch
new file mode 100644
index 00000000..b61a7922
--- /dev/null
+++ b/extra/freetype/30-enable-valid.patch
@@ -0,0 +1,20 @@
+--- modules.cfg.orig 2006-07-07 21:01:09.000000000 -0400
++++ modules.cfg 2006-07-07 21:01:54.000000000 -0400
+@@ -110,7 +110,7 @@
+ AUX_MODULES += cache
+
+ # TrueType GX/AAT table validation. Needs ftgxval.c below.
+-# AUX_MODULES += gxvalid
++AUX_MODULES += gxvalid
+
+ # Support for streams compressed with gzip (files with suffix .gz).
+ #
+@@ -124,7 +124,7 @@
+
+ # OpenType table validation. Needs ftotval.c below.
+ #
+-# AUX_MODULES += otvalid
++AUX_MODULES += otvalid
+
+ # Auxiliary PostScript driver component to share common code.
+ #
diff --git a/extra/freetype/40-memcpy-fix.patch b/extra/freetype/40-memcpy-fix.patch
new file mode 100644
index 00000000..95c1cd64
--- /dev/null
+++ b/extra/freetype/40-memcpy-fix.patch
@@ -0,0 +1,14 @@
+--- src/psaux/psobjs.c~ 2006-04-26 16:38:17.000000000 +0200
++++ src/psaux/psobjs.c 2006-09-10 15:01:13.000000000 +0200
+@@ -165,6 +165,11 @@
+ return PSaux_Err_Invalid_Argument;
+ }
+
++ if ( length < 0 ) {
++ FT_ERROR(( "ps_table_add: invalid length\n" ));
++ return PSaux_Err_Invalid_Argument;
++ }
++
+ /* grow the base block if needed */
+ if ( table->cursor + length > table->capacity )
+ {
diff --git a/extra/freetype/APKBUILD b/extra/freetype/APKBUILD
new file mode 100644
index 00000000..e7f2a87f
--- /dev/null
+++ b/extra/freetype/APKBUILD
@@ -0,0 +1,41 @@
+# Contributor: Carlo Landmeter <clandmeter at gmail>
+# Maintainer: Carlo Landmeter <clandmeter at gmail>
+pkgname=freetype
+pkgver=2.3.8
+pkgrel=0
+pkgdesc="TrueType font rendering library"
+url="http://freetype.sourceforge.net"
+license="GPL"
+depends="zlib"
+makedepends="zlib-dev"
+subpackages="$pkgname-dev"
+source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
+10-bytecode.patch
+20-enable-spr.patch
+30-enable-valid.patch
+40-memcpy-fix.patch
+"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ for i in "$srcdir"/*.patch; do
+ msg "Applying ${i}"
+ patch -p0 -i $i || return 1
+ done
+
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --disable-static
+ make || return 1
+ make -j1 DESTDIR="$pkgdir" install
+
+}
+
+md5sums="ebd7d255fd72b7f86c94501b80c50009 freetype-2.3.8.tar.gz
+9ff19e742968c29e3ba52b08d6bf0a50 10-bytecode.patch
+376b94c06b113a62a3437e4130bb3fc3 20-enable-spr.patch
+3f6c5739843dcbc110ee0f243c4f6bdb 30-enable-valid.patch
+bd2d808a0c00dcf9f1d1c0a9a8227ad9 40-memcpy-fix.patch"
diff --git a/extra/gd/APKBUILD b/extra/gd/APKBUILD
new file mode 100644
index 00000000..b7e58fe8
--- /dev/null
+++ b/extra/gd/APKBUILD
@@ -0,0 +1,31 @@
+# Contributor: Carlo Landmeter <clandmeter at gmail>
+# Maintainer: Carlo Landmeter <clandmeter at gmail>
+pkgname=gd
+pkgver=2.0.35
+pkgrel=1
+pkgdesc="Library for the dynamic creation of images by programmers"
+url="http://www.libgd.org/"
+license="custom"
+depends="libpng libjpeg freetype zlib"
+makedepends="libpng-dev libjpeg-dev freetype-dev zlib-dev"
+subpackages="$pkgname-dev $pkgname-doc"
+source="http://www.libgd.org/releases/${pkgname}-${pkgver}.tar.bz2"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --with-png \
+ --with-freetype \
+ --with-jpeg \
+ --without-xpm \
+ --without-fontconfig
+ make || return 1
+ make DESTDIR="$pkgdir" install
+ install -D -m644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
+}
+
+md5sums="6c6c3dbb7bf079e0bb5fbbfd3bb8a71c gd-2.0.35.tar.bz2"
diff --git a/extra/gdb/50_all_gdb-pie-1.patch b/extra/gdb/50_all_gdb-pie-1.patch
new file mode 100644
index 00000000..a20771f6
--- /dev/null
+++ b/extra/gdb/50_all_gdb-pie-1.patch
@@ -0,0 +1,1330 @@
+2007-11-02 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Port to GDB-6.7.1.
+
+2007-11-02 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Port to post-GDB-6.7.1 multi-PC breakpoints.
+
+2007-11-09 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * solib-svr4.c (svr4_current_sos): Fix segfault on NULL EXEC_BFD.
+
+2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Port to GDB-6.8pre.
+
+2008-02-27 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Port to gdb-6.7.50.20080227.
+
+Index: gdb/dwarf2read.c
+===================================================================
+--- a/gdb/dwarf2read.c 2008-02-27 08:57:20.000000000 +0100
++++ b/gdb/dwarf2read.c 2008-02-27 08:57:31.000000000 +0100
+@@ -1217,7 +1217,7 @@ dwarf2_build_psymtabs (struct objfile *o
+ else
+ dwarf2_per_objfile->loc_buffer = NULL;
+
+- if (mainline
++ if ((mainline == 1)
+ || (objfile->global_psymbols.size == 0
+ && objfile->static_psymbols.size == 0))
+ {
+Index: gdb/auxv.c
+===================================================================
+--- a/gdb/auxv.c 2008-01-16 17:27:37.000000000 +0100
++++ b/gdb/auxv.c 2008-02-27 08:57:31.000000000 +0100
+@@ -80,7 +80,7 @@ procfs_xfer_auxv (struct target_ops *ops
+ Return 1 if an entry was read into *TYPEP and *VALP. */
+ int
+ target_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
+- gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
++ gdb_byte *endptr, ULONGEST *typep, CORE_ADDR *valp)
+ {
+ const int sizeof_auxv_field = TYPE_LENGTH (builtin_type_void_data_ptr);
+ gdb_byte *ptr = *readptr;
+@@ -105,9 +105,10 @@ target_auxv_parse (struct target_ops *op
+ an error getting the information. On success, return 1 after
+ storing the entry's value field in *VALP. */
+ int
+-target_auxv_search (struct target_ops *ops, CORE_ADDR match, CORE_ADDR *valp)
++target_auxv_search (struct target_ops *ops, ULONGEST match, CORE_ADDR *valp)
+ {
+- CORE_ADDR type, val;
++ CORE_ADDR val;
++ ULONGEST at_type;
+ gdb_byte *data;
+ LONGEST n = target_read_alloc (ops, TARGET_OBJECT_AUXV, NULL, &data);
+ gdb_byte *ptr = data;
+@@ -117,10 +118,10 @@ target_auxv_search (struct target_ops *o
+ return n;
+
+ while (1)
+- switch (target_auxv_parse (ops, &ptr, data + n, &type, &val))
++ switch (target_auxv_parse (ops, &ptr, data + n, &at_type, &val))
+ {
+ case 1: /* Here's an entry, check it. */
+- if (type == match)
++ if (at_type == match)
+ {
+ xfree (data);
+ *valp = val;
+@@ -143,7 +144,8 @@ target_auxv_search (struct target_ops *o
+ int
+ fprint_target_auxv (struct ui_file *file, struct target_ops *ops)
+ {
+- CORE_ADDR type, val;
++ CORE_ADDR val;
++ ULONGEST at_type;
+ gdb_byte *data;
+ LONGEST len = target_read_alloc (ops, TARGET_OBJECT_AUXV, NULL,
+ &data);
+@@ -153,14 +155,14 @@ fprint_target_auxv (struct ui_file *file
+ if (len <= 0)
+ return len;
+
+- while (target_auxv_parse (ops, &ptr, data + len, &type, &val) > 0)
++ while (target_auxv_parse (ops, &ptr, data + len, &at_type, &val) > 0)
+ {
+ extern int addressprint;
+ const char *name = "???";
+ const char *description = "";
+ enum { dec, hex, str } flavor = hex;
+
+- switch (type)
++ switch (at_type)
+ {
+ #define TAG(tag, text, kind) \
+ case tag: name = #tag; description = text; flavor = kind; break
+@@ -213,7 +215,7 @@ fprint_target_auxv (struct ui_file *file
+ }
+
+ fprintf_filtered (file, "%-4s %-20s %-30s ",
+- paddr_d (type), name, description);
++ paddr_d (at_type), name, description);
+ switch (flavor)
+ {
+ case dec:
+Index: gdb/auxv.h
+===================================================================
+--- a/gdb/auxv.h 2008-01-01 23:53:09.000000000 +0100
++++ b/gdb/auxv.h 2008-02-27 08:57:31.000000000 +0100
+@@ -35,14 +35,14 @@ struct target_ops; /* Forward declarati
+ Return 1 if an entry was read into *TYPEP and *VALP. */
+ extern int target_auxv_parse (struct target_ops *ops,
+ gdb_byte **readptr, gdb_byte *endptr,
+- CORE_ADDR *typep, CORE_ADDR *valp);
++ ULONGEST *typep, CORE_ADDR *valp);
+
+ /* Extract the auxiliary vector entry with a_type matching MATCH.
+ Return zero if no such entry was found, or -1 if there was
+ an error getting the information. On success, return 1 after
+ storing the entry's value field in *VALP. */
+ extern int target_auxv_search (struct target_ops *ops,
+- CORE_ADDR match, CORE_ADDR *valp);
++ ULONGEST match, CORE_ADDR *valp);
+
+ /* Print the contents of the target's AUXV on the specified file. */
+ extern int fprint_target_auxv (struct ui_file *file, struct target_ops *ops);
+Index: gdb/breakpoint.h
+===================================================================
+--- a/gdb/breakpoint.h 2008-02-01 17:24:46.000000000 +0100
++++ b/gdb/breakpoint.h 2008-02-27 08:57:31.000000000 +0100
+@@ -144,6 +144,7 @@ enum enable_state
+ automatically enabled and reset when the call
+ "lands" (either completes, or stops at another
+ eventpoint). */
++ bp_startup_disabled,
+ bp_permanent /* There is a breakpoint instruction hard-wired into
+ the target's code. Don't try to write another
+ breakpoint instruction on top of it, or restore
+@@ -823,6 +824,10 @@ extern void remove_thread_event_breakpoi
+
+ extern void disable_breakpoints_in_shlibs (void);
+
++extern void disable_breakpoints_at_startup (int silent);
++
++extern void re_enable_breakpoints_at_startup (void);
++
+ /* This function returns TRUE if ep is a catchpoint. */
+ extern int ep_is_catchpoint (struct breakpoint *);
+
+Index: gdb/symfile-mem.c
+===================================================================
+--- a/gdb/symfile-mem.c 2008-01-01 23:53:13.000000000 +0100
++++ b/gdb/symfile-mem.c 2008-02-27 08:57:31.000000000 +0100
+@@ -108,7 +108,7 @@ symbol_file_add_from_memory (struct bfd
+ }
+
+ objf = symbol_file_add_from_bfd (nbfd, from_tty,
+- sai, 0, OBJF_SHARED);
++ sai, 2, OBJF_SHARED);
+
+ /* This might change our ideas about frames already looked at. */
+ reinit_frame_cache ();
+Index: gdb/infrun.c
+===================================================================
+--- a/gdb/infrun.c 2008-02-27 08:57:20.000000000 +0100
++++ b/gdb/infrun.c 2008-02-27 08:57:31.000000000 +0100
+@@ -2277,6 +2277,11 @@ process_event_stop_test:
+ #endif
+ target_terminal_inferior ();
+
++ /* For PIE executables, we dont really know where the
++ breakpoints are going to be until we start up the
++ inferior. */
++ re_enable_breakpoints_at_startup ();
++
+ /* If requested, stop when the dynamic linker notifies
+ gdb of events. This allows the user to get control
+ and place breakpoints in initializer routines for
+Index: gdb/objfiles.c
+===================================================================
+--- a/gdb/objfiles.c 2008-01-01 23:53:12.000000000 +0100
++++ b/gdb/objfiles.c 2008-02-27 08:57:31.000000000 +0100
+@@ -49,6 +49,9 @@
+ #include "source.h"
+ #include "addrmap.h"
+
++#include "auxv.h"
++#include "elf/common.h"
++
+ /* Prototypes for local functions */
+
+ static void objfile_alloc_data (struct objfile *objfile);
+@@ -260,7 +263,19 @@ init_entry_point_info (struct objfile *o
+ CORE_ADDR
+ entry_point_address (void)
+ {
+- return symfile_objfile ? symfile_objfile->ei.entry_point : 0;
++ int ret;
++ CORE_ADDR entry_addr;
++
++ /* Find the address of the entry point of the program from the
++ auxv vector. */
++ ret = target_auxv_search (&current_target, AT_ENTRY, &entry_addr);
++ if (ret == 1)
++ return entry_addr;
++ /*if (ret == 0 || ret == -1)*/
++ else
++ {
++ return symfile_objfile ? symfile_objfile->ei.entry_point : 0;
++ }
+ }
+
+ /* Create the terminating entry of OBJFILE's minimal symbol table.
+Index: gdb/solib-svr4.c
+===================================================================
+--- a/gdb/solib-svr4.c 2008-02-27 08:57:19.000000000 +0100
++++ b/gdb/solib-svr4.c 2008-02-27 08:59:06.000000000 +0100
+@@ -31,6 +31,8 @@
+ #include "gdbcore.h"
+ #include "target.h"
+ #include "inferior.h"
++#include "auxv.h"
++#include "command.h"
+
+ #include "gdb_assert.h"
+
+@@ -246,7 +248,9 @@ static char *debug_loader_name;
+
+ /* Local function prototypes */
+
++#if 0
+ static int match_main (char *);
++#endif
+
+ static CORE_ADDR bfd_lookup_symbol (bfd *, char *);
+
+@@ -349,10 +353,12 @@ scan_dyntag (int dyntag, bfd *abfd, CORE
+ int arch_size, step, sect_size;
+ long dyn_tag;
+ CORE_ADDR dyn_ptr, dyn_addr;
++ CORE_ADDR entry_addr;
+ gdb_byte *bufend, *bufstart, *buf;
+ Elf32_External_Dyn *x_dynp_32;
+ Elf64_External_Dyn *x_dynp_64;
+ struct bfd_section *sect;
++ int ret;
+
+ if (abfd == NULL)
+ return 0;
+@@ -360,19 +366,74 @@ scan_dyntag (int dyntag, bfd *abfd, CORE
+ if (arch_size == -1)
+ return 0;
+
++ /* The auxv vector based relocatable files reading is limited to the main
++ executable. */
++ gdb_assert (abfd == exec_bfd || ptr == NULL);
++
++ if (ptr != NULL)
++ {
++ /* Find the address of the entry point of the program from the
++ auxv vector. */
++ ret = target_auxv_search (&current_target, AT_ENTRY, &entry_addr);
++
++ if (ret == 0 || ret == -1)
++ {
++ /* No auxv info, maybe an older kernel. Fake our way through. */
++ entry_addr = bfd_get_start_address (exec_bfd);
++
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "elf_locate_base: program entry address not found. Using bfd's 0x%s for %s\n",
++ paddr_nz (entry_addr), exec_bfd->filename);
++ }
++ else
++ {
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "elf_locate_base: found program entry address 0x%s for %s\n",
++ paddr_nz (entry_addr), exec_bfd->filename);
++ }
++ }
++
+ /* Find the start address of the .dynamic section. */
+ sect = bfd_get_section_by_name (abfd, ".dynamic");
+ if (sect == NULL)
+- return 0;
++ {
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "elf_locate_base: .dynamic section not found in %s -- return now\n",
++ exec_bfd->filename);
++ return 0;
++ }
++ else
++ {
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "elf_locate_base: .dynamic section found in %s\n",
++ exec_bfd->filename);
++ }
++
+ dyn_addr = bfd_section_vma (abfd, sect);
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "elf_locate_base: .dynamic addr 0x%s\n",
++ paddr_nz (dyn_addr));
+
+ /* Read in .dynamic from the BFD. We will get the actual value
+ from memory later. */
+ sect_size = bfd_section_size (abfd, sect);
+ buf = bufstart = alloca (sect_size);
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "elf_locate_base: read in .dynamic section\n");
+ if (!bfd_get_section_contents (abfd, sect,
+ buf, 0, sect_size))
+- return 0;
++ {
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "elf_locate_base: couldn't read .dynamic section -- return now\n");
++ return 0;
++ }
+
+ /* Iterate over BUF and scan for DYNTAG. If found, set PTR and return. */
+ step = (arch_size == 32) ? sizeof (Elf32_External_Dyn)
+@@ -405,9 +466,43 @@ scan_dyntag (int dyntag, bfd *abfd, CORE
+ CORE_ADDR ptr_addr;
+
+ ptr_addr = dyn_addr + (buf - bufstart) + arch_size / 8;
++ if (ptr != NULL)
++ {
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "elf_locate_base: unrelocated ptr addr 0x%s\n",
++ paddr_nz (ptr_addr));
++ ptr_addr += entry_addr - bfd_get_start_address (exec_bfd);
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "elf_locate_base: relocated ptr addr 0x%s"
++ " (auxv entry 0x%s, bfd start address 0x%s)"
++ " for %s\n",
++ paddr_nz (ptr_addr), paddr_nz (entry_addr),
++ paddr_nz (bfd_get_start_address (exec_bfd)),
++ exec_bfd->filename);
++ }
+ if (target_read_memory (ptr_addr, ptr_buf, arch_size / 8) == 0)
+- dyn_ptr = extract_typed_address (ptr_buf,
+- builtin_type_void_data_ptr);
++ {
++ dyn_ptr = extract_typed_address (ptr_buf,
++ builtin_type_void_data_ptr);
++ if (ptr != NULL)
++ {
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "elf_locate_base: Tag entry has value 0x%s -- return now\n",
++ paddr_nz (dyn_ptr));
++ }
++ }
++ else
++ {
++ if (ptr != NULL)
++ {
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "elf_locate_base: Couldn't read tag entry value -- return now\n");
++ }
++ }
+ *ptr = dyn_ptr;
+ }
+ return 1;
+@@ -544,6 +639,10 @@ solib_svr4_r_map (void)
+ {
+ struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
+
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "solib_svr4_r_map: read at 0x%s\n",
++ paddr_nz (debug_base + lmo->r_map_offset));
+ return read_memory_typed_address (debug_base + lmo->r_map_offset,
+ builtin_type_void_data_ptr);
+ }
+@@ -713,6 +812,11 @@ svr4_current_sos (void)
+ struct so_list *head = 0;
+ struct so_list **link_ptr = &head;
+ CORE_ADDR ldsomap = 0;
++ const char *filename = exec_bfd ? exec_bfd->filename : "<none>";
++
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "svr4_current_sos: exec_bfd %s\n", filename);
+
+ /* Always locate the debug struct, in case it has moved. */
+ debug_base = 0;
+@@ -721,10 +825,19 @@ svr4_current_sos (void)
+ /* If we can't find the dynamic linker's base structure, this
+ must not be a dynamically linked executable. Hmm. */
+ if (! debug_base)
+- return svr4_default_sos ();
++ {
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "svr4_current_sos: no DT_DEBUG found in %s -- return now\n",
++ filename);
++ return svr4_default_sos ();
++ }
+
+ /* Walk the inferior's link map list, and build our list of
+ `struct so_list' nodes. */
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "svr4_current_sos: walk link map in %s\n", filename);
+ lm = solib_svr4_r_map ();
+
+ while (lm)
+@@ -740,23 +853,103 @@ svr4_current_sos (void)
+ new->lm_info->lm = xzalloc (lmo->link_map_size);
+ make_cleanup (xfree, new->lm_info->lm);
+
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "svr4_current_sos: read lm at 0x%s\n", paddr_nz(lm));
+ read_memory (lm, new->lm_info->lm, lmo->link_map_size);
+
+ lm = LM_NEXT (new);
+
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "svr4_current_sos: is first link entry? %d\n",
++ IGNORE_FIRST_LINK_MAP_ENTRY (new));
++
+ /* For SVR4 versions, the first entry in the link map is for the
+ inferior executable, so we must ignore it. For some versions of
+ SVR4, it has no name. For others (Solaris 2.3 for example), it
+ does have a name, so we can no longer use a missing name to
+ decide when to ignore it. */
+- if (IGNORE_FIRST_LINK_MAP_ENTRY (new) && ldsomap == 0)
+- free_so (new);
++ if (exec_bfd != NULL && IGNORE_FIRST_LINK_MAP_ENTRY (new) && ldsomap == 0)
++ {
++ /* It is the first link map entry, i.e. it is the main executable. */
++
++ if (bfd_get_start_address (exec_bfd) == entry_point_address ())
++ {
++ /* Non-pie case, main executable has not been relocated. */
++ free_so (new);
++ }
++ else
++ {
++ /* Pie case, main executable has been relocated. */
++ struct so_list *gdb_solib;
++
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "svr4_current_sos: Processing first link map entry\n");
++ strncpy (new->so_name, exec_bfd->filename,
++ SO_NAME_MAX_PATH_SIZE - 1);
++ new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
++ strcpy (new->so_original_name, new->so_name);
++ /*new->main = 1;*/
++ new->main_relocated = 0;
++
++ if (debug_solib)
++ {
++ fprintf_unfiltered (gdb_stdlog,
++ "svr4_current_sos: Processing nameless DSO\n");
++ fprintf_unfiltered (gdb_stdlog,
++ "svr4_current_sos: adding name %s\n",
++ new->so_name);
++ }
++
++ for (gdb_solib = master_so_list ();
++ gdb_solib;
++ gdb_solib = gdb_solib->next)
++ {
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "svr4_current_sos: compare gdb %s and new %s\n",
++ gdb_solib->so_name, new->so_name);
++ if (strcmp (gdb_solib->so_name, new->so_name) == 0)
++ if (gdb_solib->main_relocated)
++ {
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "svr4_current_sos: found main relocated\n");
++ break;
++ }
++ }
++
++ if ((gdb_solib && !gdb_solib->main_relocated) || (!gdb_solib))
++ {
++ add_to_target_sections (0 /*from_tty*/, &current_target, new);
++ new->main = 1;
++ }
++
++ /* We need this in the list of shared libs we return because
++ solib_add_stub will loop through it and add the symbol file. */
++ new->next = 0;
++ *link_ptr = new;
++ link_ptr = &new->next;
++ }
++ } /* End of IGNORE_FIRST_LINK_MAP_ENTRY */
+ else
+ {
++ /* This is not the first link map entry, i.e. is not the main
++ executable. Note however that it could be the DSO supplied on
++ certain systems (i.e. Linux 2.6) containing information about
++ the vsyscall page. We must ignore such entry. This entry is
++ nameless (just like the one for the main executable, sigh). */
++
+ int errcode;
+ char *buffer;
+
+ /* Extract this shared object's name. */
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "svr4_current_sos: read LM_NAME\n");
++
+ target_read_string (LM_NAME (new), &buffer,
+ SO_NAME_MAX_PATH_SIZE - 1, &errcode);
+ if (errcode != 0)
+@@ -764,23 +957,35 @@ svr4_current_sos (void)
+ safe_strerror (errcode));
+ else
+ {
+- strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
+- new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+- strcpy (new->so_original_name, new->so_name);
+- }
+- xfree (buffer);
+-
+- /* If this entry has no name, or its name matches the name
+- for the main executable, don't include it in the list. */
+- if (! new->so_name[0]
+- || match_main (new->so_name))
+- free_so (new);
+- else
+- {
+- new->next = 0;
+- *link_ptr = new;
+- link_ptr = &new->next;
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "svr4_current_sos: LM_NAME is <%s>\n",
++ buffer);
++ /* The name could be empty, in which case it is the
++ system supplied DSO. */
++ if (strcmp (buffer, "") == 0)
++ free_so (new);
++ else
++ {
++ strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
++ new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
++ strcpy (new->so_original_name, new->so_name);
++ if (debug_solib)
++ {
++ fprintf_unfiltered (gdb_stdlog,
++ "svr4_current_sos: Processing DSO: %s\n",
++ new->so_name);
++ fprintf_unfiltered (gdb_stdlog,
++ "svr4_current_sos: first link entry %d\n",
++ IGNORE_FIRST_LINK_MAP_ENTRY (new));
++ }
++
++ new->next = 0;
++ *link_ptr = new;
++ link_ptr = &new->next;
++ }
+ }
++ xfree (buffer);
+ }
+
+ /* On Solaris, the dynamic linker is not in the normal list of
+@@ -796,6 +1001,9 @@ svr4_current_sos (void)
+ if (head == NULL)
+ return svr4_default_sos ();
+
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog, "svr4_current_sos: ENDS %s\n", filename);
++
+ return head;
+ }
+
+@@ -875,7 +1083,7 @@ svr4_fetch_objfile_link_map (struct objf
+ /* On some systems, the only way to recognize the link map entry for
+ the main executable file is by looking at its name. Return
+ non-zero iff SONAME matches one of the known main executable names. */
+-
++#if 0
+ static int
+ match_main (char *soname)
+ {
+@@ -889,6 +1097,7 @@ match_main (char *soname)
+
+ return (0);
+ }
++#endif
+
+ /* Return 1 if PC lies in the dynamic symbol resolution code of the
+ SVR4 run time loader. */
+@@ -1040,6 +1249,11 @@ enable_break (void)
+ /* Find the .interp section; if not found, warn the user and drop
+ into the old breakpoint at symbol code. */
+ interp_sect = bfd_get_section_by_name (exec_bfd, ".interp");
++
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "enable_break: search for .interp in %s\n",
++ exec_bfd->filename);
+ if (interp_sect)
+ {
+ unsigned int interp_sect_size;
+@@ -1074,6 +1288,9 @@ enable_break (void)
+ if (tmp_fd >= 0)
+ tmp_bfd = bfd_fopen (tmp_pathname, gnutarget, FOPEN_RB, tmp_fd);
+
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "enable_break: opening %s\n", tmp_pathname);
+ if (tmp_bfd == NULL)
+ goto bkpt_at_symbol;
+
+@@ -1180,6 +1397,9 @@ enable_break (void)
+ if (sym_addr != 0)
+ {
+ create_solib_event_breakpoint (load_addr + sym_addr);
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "enable_break: solib bp set\n");
+ return 1;
+ }
+
+@@ -1440,6 +1660,8 @@ svr4_solib_create_inferior_hook (void)
+ while (stop_signal != TARGET_SIGNAL_TRAP);
+ stop_soon = NO_STOP_QUIETLY;
+ #endif /* defined(_SCO_DS) */
++
++ disable_breakpoints_at_startup (1);
+ }
+
+ static void
+@@ -1620,6 +1842,75 @@ svr4_lp64_fetch_link_map_offsets (void)
+
+ return lmp;
+ }
++void
++info_linkmap_command (char *cmd, int from_tty)
++{
++ CORE_ADDR lm;
++
++ /* Make sure we've looked up the inferior's dynamic linker's base
++ structure. */
++ if (! debug_base)
++ {
++ debug_base = locate_base ();
++
++ /* If we can't find the dynamic linker's base structure, this
++ must not be a dynamically linked executable. Hmm. */
++ if (! debug_base)
++ {
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "svr4_print_linkmap: no DT_DEBUG found in %s -- return now\n",
++ exec_bfd->filename);
++ return;
++ }
++ }
++
++ /* Walk the inferior's link map list, and print the info. */
++
++ lm = solib_svr4_r_map ();
++ while (lm)
++ {
++ int errcode;
++ char *buffer;
++ CORE_ADDR load_addr;
++
++ struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
++ struct so_list *new
++ = (struct so_list *) xmalloc (sizeof (struct so_list));
++ struct cleanup *old_chain = make_cleanup (xfree, new);
++
++ memset (new, 0, sizeof (*new));
++
++ new->lm_info = xmalloc (sizeof (struct lm_info));
++ make_cleanup (xfree, new->lm_info);
++
++ new->lm_info->lm = xmalloc (lmo->link_map_size);
++ make_cleanup (xfree, new->lm_info->lm);
++ memset (new->lm_info->lm, 0, lmo->link_map_size);
++
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "svr4_print_linkmap: read lm at 0x%s\n", paddr_nz(lm));
++ read_memory (lm, new->lm_info->lm, lmo->link_map_size);
++
++ lm = LM_NEXT (new);
++
++ /* Load address. */
++ load_addr = LM_ADDR_CHECK (new, NULL);
++ /* Shared object's name. */
++ target_read_string (LM_NAME (new), &buffer,
++ SO_NAME_MAX_PATH_SIZE - 1, &errcode);
++ make_cleanup (xfree, buffer);
++ if (errcode != 0)
++ {
++ warning ("svr4_print_linkmap: Can't read pathname for load map: %s\n",
++ safe_strerror (errcode));
++ }
++ fprintf_filtered (gdb_stdout, "%-8s %-30s\n", paddr(load_addr), buffer);
++ do_cleanups (old_chain);
++ }
++}
++
+
+
+ struct target_so_ops svr4_so_ops;
+@@ -1678,4 +1969,7 @@ _initialize_svr4_solib (void)
+ svr4_so_ops.in_dynsym_resolve_code = svr4_in_dynsym_resolve_code;
+ svr4_so_ops.lookup_lib_global_symbol = elf_lookup_lib_symbol;
+ svr4_so_ops.same = svr4_same;
++
++ add_info ("linkmap", info_linkmap_command,
++ "Display the inferior's linkmap.");
+ }
+Index: gdb/varobj.c
+===================================================================
+--- a/gdb/varobj.c 2008-02-04 08:49:04.000000000 +0100
++++ b/gdb/varobj.c 2008-02-27 08:57:31.000000000 +0100
+@@ -1078,6 +1078,62 @@ install_new_value (struct varobj *var, s
+ return changed;
+ }
+
++void
++varobj_refresh (void)
++{
++ struct varobj *var;
++ struct varobj_root *croot;
++ int mycount = rootcount;
++ char * name;
++
++ croot = rootlist;
++ while ((croot != NULL) && (mycount > 0))
++ {
++ var = croot->rootvar;
++
++ /* Get rid of the memory for the old expression. This also
++ leaves var->root->exp == NULL, which is ok for the parsing
++ below. */
++ free_current_contents (&var->root->exp);
++
++ value_free (var->value);
++ var->type = NULL;
++
++ name = xstrdup (var->name);
++
++ /* Reparse the expression. Wrap the call to parse expression,
++ so we can return a sensible error. */
++ if (!gdb_parse_exp_1 (&name, var->root->valid_block, 0, &var->root->exp))
++ {
++ return;
++ }
++
++ /* We definitively need to catch errors here.
++ If evaluate_expression succeeds we got the value we wanted.
++ But if it fails, we still go on with a call to evaluate_type() */
++ if (gdb_evaluate_expression (var->root->exp, &var->value))
++ {
++ /* no error */
++ release_value (var->value);
++ if (value_lazy (var->value))
++ gdb_value_fetch_lazy (var->value);
++ }
++ else
++ var->value = evaluate_type (var->root->exp);
++
++ var->type = value_type (var->value);
++
++ mycount--;
++ croot = croot->next;
++ }
++
++ if (mycount || (croot != NULL))
++ warning
++ ("varobj_refresh: assertion failed - wrong tally of root vars (%d:%d)",
++ rootcount, mycount);
++}
++
++
+ /* Update the values for a variable and its children. This is a
+ two-pronged attack. First, re-parse the value for the root's
+ expression to see if it's changed. Then go all the way
+Index: gdb/solist.h
+===================================================================
+--- a/gdb/solist.h 2008-01-07 16:19:58.000000000 +0100
++++ b/gdb/solist.h 2008-02-27 08:57:31.000000000 +0100
+@@ -61,6 +61,8 @@ struct so_list
+ bfd *abfd;
+ char symbols_loaded; /* flag: symbols read in yet? */
+ char from_tty; /* flag: print msgs? */
++ char main; /* flag: is this the main executable? */
++ char main_relocated; /* flag: has it been relocated yet? */
+ struct objfile *objfile; /* objfile for loaded lib */
+ struct section_table *sections;
+ struct section_table *sections_end;
+@@ -127,9 +129,15 @@ void free_so (struct so_list *so);
+ /* Return address of first so_list entry in master shared object list. */
+ struct so_list *master_so_list (void);
+
++/* Return address of first so_list entry in master shared object list. */
++struct so_list *master_so_list (void);
++
+ /* Find solib binary file and open it. */
+ extern int solib_open (char *in_pathname, char **found_pathname);
+
++/* Add the list of sections in so_list to the target to_sections. */
++extern void add_to_target_sections (int, struct target_ops *, struct so_list *);
++
+ /* FIXME: gdbarch needs to control this variable */
+ extern struct target_so_ops *current_target_so_ops;
+
+@@ -140,4 +148,6 @@ struct symbol *solib_global_lookup (cons
+ const domain_enum domain,
+ struct symtab **symtab);
+
++/* Controls the printing of debugging output. */
++extern int debug_solib;
+ #endif
+Index: gdb/varobj.h
+===================================================================
+--- a/gdb/varobj.h 2008-01-30 08:17:31.000000000 +0100
++++ b/gdb/varobj.h 2008-02-27 08:57:31.000000000 +0100
+@@ -122,4 +122,6 @@ extern void varobj_invalidate (void);
+
+ extern int varobj_editable_p (struct varobj *var);
+
++extern void varobj_refresh(void);
++
+ #endif /* VAROBJ_H */
+Index: gdb/symfile.c
+===================================================================
+--- a/gdb/symfile.c 2008-01-29 23:47:20.000000000 +0100
++++ b/gdb/symfile.c 2008-02-27 08:57:31.000000000 +0100
+@@ -47,6 +47,7 @@
+ #include "readline/readline.h"
+ #include "gdb_assert.h"
+ #include "block.h"
++#include "varobj.h"
+ #include "observer.h"
+ #include "exec.h"
+ #include "parser-defs.h"
+@@ -778,7 +779,7 @@ syms_from_objfile (struct objfile *objfi
+
+ /* Now either addrs or offsets is non-zero. */
+
+- if (mainline)
++ if (mainline == 1)
+ {
+ /* We will modify the main symbol table, make sure that all its users
+ will be cleaned up if an error occurs during symbol reading. */
+@@ -806,7 +807,7 @@ syms_from_objfile (struct objfile *objfi
+
+ We no longer warn if the lowest section is not a text segment (as
+ happens for the PA64 port. */
+- if (!mainline && addrs && addrs->other[0].name)
++ if (/*!mainline &&*/ addrs && addrs->other[0].name)
+ {
+ asection *lower_sect;
+ asection *sect;
+@@ -975,17 +976,21 @@ new_symfile_objfile (struct objfile *obj
+ /* If this is the main symbol file we have to clean up all users of the
+ old main symbol file. Otherwise it is sufficient to fixup all the
+ breakpoints that may have been redefined by this symbol file. */
+- if (mainline)
++ if (mainline == 1)
+ {
+ /* OK, make it the "real" symbol file. */
+ symfile_objfile = objfile;
+
+ clear_symtab_users ();
+ }
+- else
++ else if (mainline == 0)
+ {
+ breakpoint_re_set ();
+ }
++ else
++ {
++ /* Don't reset breakpoints or it will screw up PIE. */
++ }
+
+ /* We're done reading the symbol file; finish off complaints. */
+ clear_complaints (&symfile_complaints, 0, verbo);
+@@ -1028,7 +1033,7 @@ symbol_file_add_with_addrs_or_offsets (b
+ interactively wiping out any existing symbols. */
+
+ if ((have_full_symbols () || have_partial_symbols ())
+- && mainline
++ && (mainline == 1)
+ && from_tty
+ && !query ("Load new symbol table from \"%s\"? ", name))
+ error (_("Not confirmed."));
+@@ -1212,6 +1217,10 @@ symbol_file_clear (int from_tty)
+ symfile_objfile->name)
+ : !query (_("Discard symbol table? "))))
+ error (_("Not confirmed."));
++#ifdef CLEAR_SOLIB
++ CLEAR_SOLIB ();
++#endif
++
+ free_all_objfiles ();
+
+ /* solib descriptors may have handles to objfiles. Since their
+@@ -2466,6 +2475,8 @@ reread_symbols (void)
+ /* Discard cleanups as symbol reading was successful. */
+ discard_cleanups (old_cleanups);
+
++ init_entry_point_info (objfile);
++
+ /* If the mtime has changed between the time we set new_modtime
+ and now, we *want* this to be out of date, so don't call stat
+ again now. */
+@@ -2834,6 +2845,7 @@ clear_symtab_users (void)
+ breakpoint_re_set ();
+ set_default_breakpoint (0, 0, 0, 0);
+ clear_pc_function_cache ();
++ varobj_refresh ();
+ observer_notify_new_objfile (NULL);
+
+ /* Clear globals which might have pointed into a removed objfile.
+Index: gdb/breakpoint.c
+===================================================================
+--- a/gdb/breakpoint.c 2008-02-27 08:57:20.000000000 +0100
++++ b/gdb/breakpoint.c 2008-02-27 08:57:31.000000000 +0100
+@@ -923,7 +923,7 @@ update_watchpoint (struct breakpoint *b,
+ value_release_to_mark (mark);
+
+ /* Look at each value on the value chain. */
+- for (; v; v = next)
++ for (; v; v = value_next (v))
+ {
+ /* If it's a memory location, and GDB actually needed
+ its contents to evaluate the expression, then we
+@@ -3882,7 +3882,8 @@ describe_other_breakpoints (CORE_ADDR pc
+ printf_filtered (" (thread %d)", b->thread);
+ printf_filtered ("%s%s ",
+ ((b->enable_state == bp_disabled ||
+- b->enable_state == bp_call_disabled)
++ b->enable_state == bp_call_disabled ||
++ b->enable_state == bp_startup_disabled)
+ ? " (disabled)"
+ : b->enable_state == bp_permanent
+ ? " (permanent)"
+@@ -4534,6 +4535,62 @@ disable_breakpoints_in_unloaded_shlib (s
+ }
+ }
+
++void
++disable_breakpoints_at_startup (int silent)
++{
++ struct breakpoint *b;
++ int disabled_startup_breaks = 0;
++
++ if (bfd_get_start_address (exec_bfd) != entry_point_address ())
++ {
++ ALL_BREAKPOINTS (b)
++ {
++ if (((b->type == bp_breakpoint) ||
++ (b->type == bp_hardware_breakpoint)) &&
++ b->enable_state == bp_enabled &&
++ !b->loc->duplicate)
++ {
++ b->enable_state = bp_startup_disabled;
++ if (!silent)
++ {
++ if (!disabled_startup_breaks)
++ {
++ target_terminal_ours_for_output ();
++ warning ("Temporarily disabling breakpoints:");
++ }
++ disabled_startup_breaks = 1;
++ warning ("breakpoint #%d addr 0x%s", b->number, paddr_nz(b->loc->address));
++ }
++ }
++ }
++ }
++}
++
++/* Try to reenable any breakpoints after startup. */
++void
++re_enable_breakpoints_at_startup (void)
++{
++ struct breakpoint *b;
++
++ if (bfd_get_start_address (exec_bfd) != entry_point_address ())
++ {
++ ALL_BREAKPOINTS (b)
++ if (b->enable_state == bp_startup_disabled)
++ {
++ char buf[1];
++
++ /* Do not reenable the breakpoint if the shared library
++ is still not mapped in. */
++ if (target_read_memory (b->loc->address, buf, 1) == 0)
++ {
++ /*printf ("enabling breakpoint at 0x%s\n", paddr_nz(b->loc->address));*/
++ b->enable_state = bp_enabled;
++ }
++ }
++ }
++}
++
++
+ static void
+ create_fork_vfork_event_catchpoint (int tempflag, char *cond_string,
+ enum bptype bp_kind)
+Index: gdb/solib.c
+===================================================================
+--- a/gdb/solib.c 2008-01-07 16:19:58.000000000 +0100
++++ b/gdb/solib.c 2008-02-27 08:57:31.000000000 +0100
+@@ -79,6 +79,8 @@ set_solib_ops (struct gdbarch *gdbarch,
+
+ /* external data declarations */
+
++int debug_solib;
++
+ /* FIXME: gdbarch needs to control this variable, or else every
+ configuration needs to call set_solib_ops. */
+ struct target_so_ops *current_target_so_ops;
+@@ -102,6 +104,8 @@ The search path for loading non-absolute
+ value);
+ }
+
++void add_to_target_sections (int, struct target_ops *, struct so_list *);
++
+ /*
+
+ GLOBAL FUNCTION
+@@ -391,7 +395,6 @@ free_so (struct so_list *so)
+ xfree (so);
+ }
+
+-
+ /* Return address of first so_list entry in master shared object list. */
+ struct so_list *
+ master_so_list (void)
+@@ -399,7 +402,6 @@ master_so_list (void)
+ return so_list_head;
+ }
+
+-
+ /* A small stub to get us past the arg-passing pinhole of catch_errors. */
+
+ static int
+@@ -411,15 +413,40 @@ symbol_add_stub (void *arg)
+ /* Have we already loaded this shared object? */
+ ALL_OBJFILES (so->objfile)
+ {
+- if (strcmp (so->objfile->name, so->so_name) == 0)
++ /* Found an already loaded shared library. */
++ if (strcmp (so->objfile->name, so->so_name) == 0
++ && !so->main)
+ return 1;
++ /* Found an already loaded main executable. This could happen in
++ two circumstances.
++ First case: the main file has already been read in
++ as the first thing that gdb does at startup, and the file
++ hasn't been relocated properly yet. Therefor we need to read
++ it in with the proper section info.
++ Second case: it has been read in with the correct relocation,
++ and therefore we need to skip it. */
++ if (strcmp (so->objfile->name, so->so_name) == 0
++ && so->main
++ && so->main_relocated)
++ return 1;
+ }
+
+ sap = build_section_addr_info_from_section_table (so->sections,
+ so->sections_end);
+
+- so->objfile = symbol_file_add (so->so_name, so->from_tty,
+- sap, 0, OBJF_SHARED);
++ if (so->main)
++ {
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "symbol_add_stub: adding symbols for main\n");
++ so->objfile = symbol_file_add (so->so_name, /*so->from_tty*/ 0,
++ sap, 1, 0);
++ so->main_relocated = 1;
++ }
++ else
++ so->objfile = symbol_file_add (so->so_name, so->from_tty,
++ sap, 0, OBJF_SHARED);
++
+ free_section_addr_info (sap);
+
+ return (1);
+@@ -545,6 +572,10 @@ update_solib_list (int from_tty, struct
+ }
+ else
+ {
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "update_solib_list: compare gdb:%s and inferior:%s\n",
++ gdb->so_original_name, i->so_original_name);
+ if (! strcmp (gdb->so_original_name, i->so_original_name))
+ break;
+ }
+@@ -599,28 +630,7 @@ update_solib_list (int from_tty, struct
+ /* Fill in the rest of each of the `struct so_list' nodes. */
+ for (i = inferior; i; i = i->next)
+ {
+- i->from_tty = from_tty;
+-
+- /* Fill in the rest of the `struct so_list' node. */
+- catch_errors (solib_map_sections, i,
+- "Error while mapping shared library sections:\n",
+- RETURN_MASK_ALL);
+-
+- /* If requested, add the shared object's sections to the TARGET's
+- section table. Do this immediately after mapping the object so
+- that later nodes in the list can query this object, as is needed
+- in solib-osf.c. */
+- if (target)
+- {
+- int count = (i->sections_end - i->sections);
+- if (count > 0)
+- {
+- int space = target_resize_to_sections (target, count);
+- memcpy (target->to_sections + space,
+- i->sections,
+- count * sizeof (i->sections[0]));
+- }
+- }
++ add_to_target_sections (from_tty, target, i);
+
+ /* Notify any observer that the shared object has been
+ loaded now that we've added it to GDB's tables. */
+@@ -716,6 +726,41 @@ solib_add (char *pattern, int from_tty,
+ }
+ }
+
++void
++add_to_target_sections (int from_tty, struct target_ops *target, struct so_list *solib)
++{
++ /* If this is set, then the sections have been already added to the
++ target list. */
++ if (solib->main)
++ return;
++
++ solib->from_tty = from_tty;
++
++ /* Fill in the rest of the `struct so_list' node. */
++ catch_errors (solib_map_sections, solib,
++ "Error while mapping shared library sections:\n",
++ RETURN_MASK_ALL);
++
++ /* If requested, add the shared object's sections to the TARGET's
++ section table. Do this immediately after mapping the object so
++ that later nodes in the list can query this object, as is needed
++ in solib-osf.c. */
++ if (target)
++ {
++ int count = (solib->sections_end - solib->sections);
++ if (count > 0)
++ {
++ int space = target_resize_to_sections (target, count);
++ if (debug_solib)
++ fprintf_unfiltered (gdb_stdlog,
++ "add_to_target_sections: add %s to to_sections\n",
++ solib->so_original_name);
++ memcpy (target->to_sections + space,
++ solib->sections,
++ count * sizeof (solib->sections[0]));
++ }
++ }
++}
+
+ /*
+
+@@ -1035,4 +1080,12 @@ This takes precedence over the environme
+ reload_shared_libraries,
+ show_solib_search_path,
+ &setlist, &showlist);
++
++ add_setshow_boolean_cmd ("solib", no_class, &debug_solib,
++ _("\
++Set debugging of GNU/Linux shlib module.\n"), _("\
++Show debugging status of GNU/Linux shlib module.\n"), _("\
++Enables printf debugging output of GNU/Linux shlib module.\n"),
++ NULL, NULL,
++ &setdebuglist, &showdebuglist);
+ }
+Index: gdb/elfread.c
+===================================================================
+--- a/gdb/elfread.c 2008-01-01 23:53:09.000000000 +0100
++++ b/gdb/elfread.c 2008-02-27 08:57:31.000000000 +0100
+@@ -644,7 +644,7 @@ elf_symfile_read (struct objfile *objfil
+ /* If we are reinitializing, or if we have never loaded syms yet,
+ set table to empty. MAINLINE is cleared so that *_read_psymtab
+ functions do not all also re-initialize the psymbol table. */
+- if (mainline)
++ if (mainline == 1)
+ {
+ init_psymbol_list (objfile, 0);
+ mainline = 0;
+Index: gdb/Makefile.in
+===================================================================
+--- a/gdb/Makefile.in 2008-02-27 08:57:20.000000000 +0100
++++ b/gdb/Makefile.in 2008-02-27 08:57:31.000000000 +0100
+@@ -1914,7 +1914,7 @@ amd64-tdep.o: amd64-tdep.c $(defs_h) $(a
+ $(dummy_frame_h) $(frame_h) $(frame_base_h) $(frame_unwind_h) \
+ $(inferior_h) $(gdbcmd_h) $(gdbcore_h) $(objfiles_h) $(regcache_h) \
+ $(regset_h) $(symfile_h) $(gdb_assert_h) $(amd64_tdep_h) \
+- $(i387_tdep_h)
++ $(i387_tdep_h) $(exceptions_h)
+ annotate.o: annotate.c $(defs_h) $(annotate_h) $(value_h) $(target_h) \
+ $(gdbtypes_h) $(breakpoint_h)
+ arch-utils.o: arch-utils.c $(defs_h) $(arch_utils_h) $(buildsym_h) \
+Index: gdb/amd64-tdep.c
+===================================================================
+--- a/gdb/amd64-tdep.c 2008-02-27 08:57:19.000000000 +0100
++++ b/gdb/amd64-tdep.c 2008-02-27 08:57:31.000000000 +0100
+@@ -36,6 +36,7 @@
+ #include "symfile.h"
+ #include "dwarf2-frame.h"
+ #include "gdb_assert.h"
++#include "exceptions.h"
+
+ #include "amd64-tdep.h"
+ #include "i387-tdep.h"
+@@ -731,16 +732,28 @@ amd64_alloc_frame_cache (void)
+ Any function that doesn't start with this sequence will be assumed
+ to have no prologue and thus no valid frame pointer in %rbp. */
+
+-static CORE_ADDR
+-amd64_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
+- struct amd64_frame_cache *cache)
++struct amd64_analyze_prologue_data
++ {
++ CORE_ADDR pc, current_pc;
++ struct amd64_frame_cache *cache;
++ CORE_ADDR retval;
++ };
++
++static int
++amd64_analyze_prologue_1 (void *data_pointer)
+ {
++ struct amd64_analyze_prologue_data *data = data_pointer;
++ CORE_ADDR pc = data->pc, current_pc = data->current_pc;
++ struct amd64_frame_cache *cache = data->cache;
+ static gdb_byte proto[3] = { 0x48, 0x89, 0xe5 }; /* movq %rsp, %rbp */
+ gdb_byte buf[3];
+ gdb_byte op;
+
+ if (current_pc <= pc)
+- return current_pc;
++ {
++ data->retval = current_pc;
++ return 1;
++ }
+
+ op = read_memory_unsigned_integer (pc, 1);
+
+@@ -753,18 +766,57 @@ amd64_analyze_prologue (CORE_ADDR pc, CO
+
+ /* If that's all, return now. */
+ if (current_pc <= pc + 1)
+- return current_pc;
++ {
++ data->retval = current_pc;
++ return 1;
++ }
+
+ /* Check for `movq %rsp, %rbp'. */
+ read_memory (pc + 1, buf, 3);
+ if (memcmp (buf, proto, 3) != 0)
+- return pc + 1;
++ {
++ data->retval = pc + 1;
++ return 1;
++ }
+
+ /* OK, we actually have a frame. */
+ cache->frameless_p = 0;
+- return pc + 4;
++ data->retval = pc + 4;
++ return 1;
+ }
+
++ data->retval = pc;
++ return 1;
++}
++
++/* Catch memory read errors and return just PC in such case.
++ It occurs very early on enable_break->new_symfile_objfile->
++ ->breakpoint_re_set->decode_line_1->decode_variable_1->
++ ->find_function_start_sal */
++
++static CORE_ADDR
++amd64_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
++ struct amd64_frame_cache *cache)
++{
++ int status;
++ struct amd64_analyze_prologue_data data;
++ struct ui_file *saved_gdb_stderr;
++
++ /* Suppress error messages. */
++ saved_gdb_stderr = gdb_stderr;
++ gdb_stderr = ui_file_new ();
++
++ data.pc = pc;
++ data.current_pc = current_pc;
++ data.cache = cache;
++ status = catch_errors (amd64_analyze_prologue_1, &data, "", RETURN_MASK_ALL);
++
++ /* Stop suppressing error messages. */
++ ui_file_delete (gdb_stderr);
++ gdb_stderr = saved_gdb_stderr;
++
++ if (status)
++ return data.retval;
+ return pc;
+ }
+
diff --git a/extra/gdb/50_all_gdb-pie-2.patch b/extra/gdb/50_all_gdb-pie-2.patch
new file mode 100644
index 00000000..946d0550
--- /dev/null
+++ b/extra/gdb/50_all_gdb-pie-2.patch
@@ -0,0 +1,2122 @@
+Index: gdb-6.8/gdb/testsuite/configure
+===================================================================
+--- gdb-6.8.orig/gdb/testsuite/configure 2007-12-29 06:01:30.000000000 -0800
++++ gdb-6.8/gdb/testsuite/configure 2008-03-30 09:00:52.000000000 -0700
+@@ -3104,7 +3104,7 @@
+
+
+
+- ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
++ ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.pie/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
+ cat >confcache <<\_ACEOF
+ # This file is a shell script that caches the results of configure
+ # tests run on this system so they can be shared between configure
+@@ -3665,6 +3665,7 @@
+ "gdb.dwarf2/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.dwarf2/Makefile" ;;
+ "gdb.fortran/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.fortran/Makefile" ;;
+ "gdb.server/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.server/Makefile" ;;
++ "gdb.pie/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.pie/Makefile" ;;
+ "gdb.java/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.java/Makefile" ;;
+ "gdb.mi/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.mi/Makefile" ;;
+ "gdb.modula2/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.modula2/Makefile" ;;
+Index: gdb-6.8/gdb/testsuite/configure.ac
+===================================================================
+--- gdb-6.8.orig/gdb/testsuite/configure.ac 2007-10-25 13:30:26.000000000 -0700
++++ gdb-6.8/gdb/testsuite/configure.ac 2008-03-30 09:00:22.000000000 -0700
+@@ -114,7 +114,7 @@
+ gdb.ada/Makefile \
+ gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile \
+ gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \
+- gdb.fortran/Makefile gdb.server/Makefile \
++ gdb.fortran/Makefile gdb.server/Makefile gdb.pie/Makefile \
+ gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile \
+ gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile \
+ gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile])
+Index: gdb-6.8/gdb/testsuite/gdb.pie/Makefile.in
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-6.8/gdb/testsuite/gdb.pie/Makefile.in 2008-03-30 08:59:12.000000000 -0700
+@@ -0,0 +1,19 @@
++VPATH = @srcdir@
++srcdir = @srcdir@
++
++EXECUTABLES =
++MISCELLANEOUS = arch.inc
++
++all info install-info dvi install uninstall installcheck check:
++ @echo "Nothing to be done for $@..."
++
++clean mostlyclean:
++ -rm -f *~ *.o a.out *.x *.ci *.tmp
++ -rm -f core core.coremaker coremaker.core corefile $(EXECUTABLES)
++ -rm -f $(MISCELLANEOUS)
++
++distclean maintainer-clean realclean: clean
++ -rm -f *~ core
++ -rm -f Makefile config.status config.log
++ -rm -f *-init.exp
++ -rm -fr *.log summary detail *.plog *.sum *.psum site.*
+Index: gdb-6.8/gdb/testsuite/gdb.pie/attach.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-6.8/gdb/testsuite/gdb.pie/attach.c 2008-03-30 08:59:12.000000000 -0700
+@@ -0,0 +1,20 @@
++/* This program is intended to be started outside of gdb, and then
++ attached to by gdb. Thus, it simply spins in a loop. The loop
++ is exited when & if the variable 'should_exit' is non-zero. (It
++ is initialized to zero in this program, so the loop will never
++ exit unless/until gdb sets the variable to non-zero.)
++ */
++#include <stdio.h>
++
++int should_exit = 0;
++
++int main ()
++{
++ int local_i = 0;
++
++ while (! should_exit)
++ {
++ local_i++;
++ }
++ return 0;
++}
+Index: gdb-6.8/gdb/testsuite/gdb.pie/attach.exp
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-6.8/gdb/testsuite/gdb.pie/attach.exp 2008-03-30 08:59:12.000000000 -0700
+@@ -0,0 +1,432 @@
++# Copyright 1997, 1999, 2002 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
++
++# Please email any bugs, comments, and/or additions to this file to:
++# bug-gdb@prep.ai.mit.edu
++
++if $tracelevel then {
++ strace $tracelevel
++ }
++
++set prms_id 0
++set bug_id 0
++
++# On HP-UX 11.0, this test is causing a process running the program
++# "attach" to be left around spinning. Until we figure out why, I am
++# commenting out the test to avoid polluting tiamat (our 11.0 nightly
++# test machine) with these processes. RT
++#
++# Setting the magic bit in the target app should work. I added a
++# "kill", and also a test for the R3 register warning. JB
++if { [istarget "hppa*-*-hpux*"] } {
++ return 0
++}
++
++# are we on a target board
++if [is_remote target] then {
++ return 0
++}
++
++set testfile "attach"
++set srcfile ${testfile}.c
++set srcfile2 ${testfile}2.c
++set binfile ${objdir}/${subdir}/${testfile}
++set binfile2 ${objdir}/${subdir}/${testfile}2
++set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}]
++set cleanupfile ${objdir}/${subdir}/${testfile}.awk
++
++#execute_anywhere "rm -f ${binfile} ${binfile2}"
++remote_exec build "rm -f ${binfile} ${binfile2}"
++# For debugging this test
++#
++#log_user 1
++
++# Clean out any old files from past runs.
++#
++remote_exec build "${cleanupfile}"
++
++# build the first test case
++#
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug "additional_flags= -fpie -pie"}] != "" } {
++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
++}
++
++# Build the in-system-call test
++
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug "additional_flags= -fpie -pie"}] != "" } {
++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
++}
++
++if [get_compiler_info ${binfile}] {
++ return -1
++}
++
++proc do_attach_tests {} {
++ global gdb_prompt
++ global binfile
++ global escapedbinfile
++ global srcfile
++ global testfile
++ global objdir
++ global subdir
++ global timeout
++
++ # Start the program running and then wait for a bit, to be sure
++ # that it can be attached to.
++ #
++ set testpid [eval exec $binfile &]
++ exec sleep 2
++
++ # Verify that we cannot attach to nonsense.
++ #
++ send_gdb "attach abc\n"
++ gdb_expect {
++ -re ".*Illegal process-id: abc.*$gdb_prompt $"\
++ {pass "attach to nonsense is prohibited"}
++ -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"\
++ {
++ # Response expected from /proc-based systems.
++ pass "attach to nonsense is prohibited"
++ }
++ -re "Attaching to.*$gdb_prompt $"\
++ {fail "attach to nonsense is prohibited (bogus pid allowed)"}
++ -re "$gdb_prompt $" {fail "attach to nonsense is prohibited"}
++ timeout {fail "(timeout) attach to nonsense is prohibited"}
++ }
++
++ # Verify that we cannot attach to what appears to be a valid
++ # process ID, but is a process that doesn't exist. Traditionally,
++ # most systems didn't have a process with ID 0, so we take that as
++ # the default. However, there are a few exceptions.
++ #
++ set boguspid 0
++ if { [istarget "*-*-*bsd*"] } {
++ # In FreeBSD 5.0, PID 0 is used for "swapper". Use -1 instead
++ # (which should have the desired effect on any version of
++ # FreeBSD, and probably other *BSD's too).
++ set boguspid -1
++ }
++ send_gdb "attach $boguspid\n"
++ gdb_expect {
++ -re "Attaching to.*, process $boguspid.*No such process.*$gdb_prompt $"\
++ {
++ # Response expected on ptrace-based systems (i.e. HP-UX 10.20).
++ pass "attach to nonexistent process is prohibited"
++ }
++ -re "Attaching to.*, process $boguspid failed.*Hint.*$gdb_prompt $"\
++ {
++ # Response expected on ttrace-based systems (i.e. HP-UX 11.0).
++ pass "attach to nonexistent process is prohibited"
++ }
++ -re "Attaching to.*, process $boguspid.*denied.*$gdb_prompt $"\
++ {pass "attach to nonexistent process is prohibited"}
++ -re "Attaching to.*, process $boguspid.*not permitted.*$gdb_prompt $"\
++ {pass "attach to nonexistent process is prohibited"}
++ -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"\
++ {
++ # Response expected from /proc-based systems.
++ pass "attach to nonexistent process is prohibited"
++ }
++ -re "$gdb_prompt $" {fail "attach to nonexistent process is prohibited"}
++ timeout {
++ fail "(timeout) attach to nonexistent process is prohibited"
++ }
++ }
++
++ # Verify that we can attach to the process by first giving its
++ # executable name via the file command, and using attach with
++ # the process ID.
++ #
++ # (Actually, the test system appears to do this automatically
++ # for us. So, we must also be prepared to be asked if we want
++ # to discard an existing set of symbols.)
++ #
++ send_gdb "file $binfile\n"
++ gdb_expect {
++ -re "Load new symbol table from.*y or n.*$" {
++ send_gdb "y\n"
++ gdb_expect {
++ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\
++ {pass "(re)set file, before attach1"}
++ -re "$gdb_prompt $" {fail "(re)set file, before attach1"}
++ timeout {fail "(timeout) (re)set file, before attach1"}
++ }
++ }
++ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\
++ {pass "set file, before attach1"}
++ -re "$gdb_prompt $" {fail "set file, before attach1"}
++ timeout {fail "(timeout) set file, before attach1"}
++ }
++
++ send_gdb "attach $testpid\n"
++ gdb_expect {
++ -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*main.*at .*$srcfile:.*$gdb_prompt $"\
++ {pass "attach1, after setting file"}
++ -re "$gdb_prompt $" {fail "attach1, after setting file"}
++ timeout {fail "(timeout) attach1, after setting file"}
++ }
++
++ # Verify that we can "see" the variable "should_exit" in the
++ # program, and that it is zero.
++ #
++ send_gdb "print should_exit\n"
++ gdb_expect {
++ -re ".* = 0.*$gdb_prompt $"\
++ {pass "after attach1, print should_exit"}
++ -re "$gdb_prompt $" {fail "after attach1, print should_exit"}
++ timeout {fail "(timeout) after attach1, print should_exit"}
++ }
++
++ # Detach the process.
++ #
++ send_gdb "detach\n"
++ gdb_expect {
++ -re "Detaching from program: .*$escapedbinfile.*$gdb_prompt $"\
++ {pass "attach1 detach"}
++ -re "$gdb_prompt $" {fail "attach1 detach"}
++ timeout {fail "(timeout) attach1 detach"}
++ }
++
++ # Wait a bit for gdb to finish detaching
++ #
++ exec sleep 5
++
++ # Purge the symbols from gdb's brain. (We want to be certain
++ # the next attach, which won't be preceded by a "file" command,
++ # is really getting the executable file without our help.)
++ #
++ set old_timeout $timeout
++ set timeout 15
++ send_gdb "file\n"
++ gdb_expect {
++ -re ".*gdb internal error.*$" {
++ fail "Internal error, prob. Memory corruption"
++ }
++ -re "No executable file now.*Discard symbol table.*y or n.*$" {
++ send_gdb "y\n"
++ gdb_expect {
++ -re "No symbol file now.*$gdb_prompt $"\
++ {pass "attach1, purging symbols after detach"}
++ -re "$gdb_prompt $" {fail "attach1, purging symbols after detach"}
++ timeout {fail "(timeout) attach1, purging symbols after detach"}
++ }
++ }
++ -re "$gdb_prompt $" {fail "attach1, purging file after detach"}
++ timeout {
++ fail "(timeout) attach1, purging file after detach"
++ }
++ }
++ set timeout $old_timeout
++
++ # Verify that we can attach to the process just by giving the
++ # process ID.
++ #
++ send_gdb "attach $testpid\n"
++ gdb_expect {
++ -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*$gdb_prompt $"\
++ {pass "attach2"}
++ -re "$gdb_prompt $" {fail "attach2"}
++ timeout {fail "(timeout) attach2"}
++ }
++
++ # Verify that we can modify the variable "should_exit" in the
++ # program.
++ #
++ send_gdb "set should_exit=1\n"
++ gdb_expect {
++ -re "$gdb_prompt $" {pass "after attach2, set should_exit"}
++ timeout {fail "(timeout) after attach2, set should_exit"}
++ }
++
++ # Verify that the modification really happened.
++ #
++ send_gdb "tbreak 19\n"
++ gdb_expect {
++ -re "Breakpoint .*at.*$srcfile, line 19.*$gdb_prompt $"\
++ {pass "after attach2, set tbreak postloop"}
++ -re "$gdb_prompt $" {fail "after attach2, set tbreak postloop"}
++ timeout {fail "(timeout) after attach2, set tbreak postloop"}
++ }
++ send_gdb "continue\n"
++ gdb_expect {
++ -re "main.*at.*$srcfile:19.*$gdb_prompt $"\
++ {pass "after attach2, reach tbreak postloop"}
++ -re "$gdb_prompt $" {fail "after attach2, reach tbreak postloop"}
++ timeout {fail "(timeout) after attach2, reach tbreak postloop"}
++ }
++
++ # Allow the test process to exit, to cleanup after ourselves.
++ #
++ send_gdb "continue\n"
++ gdb_expect {
++ -re "Program exited normally.*$gdb_prompt $"\
++ {pass "after attach2, exit"}
++ -re "$gdb_prompt $" {fail "after attach2, exit"}
++ timeout {fail "(timeout) after attach2, exit"}
++ }
++
++ # Make sure we don't leave a process around to confuse
++ # the next test run (and prevent the compile by keeping
++ # the text file busy), in case the "set should_exit" didn't
++ # work.
++ #
++ remote_exec build "kill -9 ${testpid}"
++ # Start the program running and then wait for a bit, to be sure
++ # that it can be attached to.
++ #
++ set testpid [eval exec $binfile &]
++ exec sleep 2
++
++ # Verify that we can attach to the process, and find its a.out
++ # when we're cd'd to some directory that doesn't contain the
++ # a.out. (We use the source path set by the "dir" command.)
++ #
++ send_gdb "dir ${objdir}/${subdir}\n"
++ gdb_expect {
++ -re ".*Source directories searched: .*$gdb_prompt $"\
++ {pass "set source path"}
++ -re "$gdb_prompt $" {fail "set source path"}
++ timeout {fail "(timeout) set source path"}
++ }
++
++ send_gdb "cd /tmp\n"
++ gdb_expect {
++ -re ".*Working directory /tmp.*$gdb_prompt $"\
++ {pass "cd away from process' a.out"}
++ -re "$gdb_prompt $" {fail "cd away from process' a.out"}
++ timeout {fail "(timeout) cd away from process' a.out"}
++ }
++
++ # Explicitly flush out any knowledge of the previous attachment.
++ send_gdb "symbol\n"
++ gdb_expect {
++ -re ".*Discard symbol table from.*y or n. $"\
++ {send_gdb "y\n"
++ gdb_expect {
++ -re ".*No symbol file now.*$gdb_prompt $"\
++ {pass "before attach3, flush symbols"}
++ -re "$gdb_prompt $" {fail "before attach3, flush symbols"}
++ timeout {fail "(timeout) before attach3, flush symbols"}
++ }
++ }
++ -re ".*No symbol file now.*$gdb_prompt $"\
++ {pass "before attach3, flush symbols"}
++ -re "$gdb_prompt $" {fail "before attach3, flush symbols"}
++ timeout {fail "(timeout) before attach3, flush symbols"}
++ }
++ send_gdb "exec\n"
++ gdb_expect {
++ -re ".*No executable file now.*$gdb_prompt $"\
++ {pass "before attach3, flush exec"}
++ -re "$gdb_prompt $" {fail "before attach3, flush exec"}
++ timeout {fail "(timeout) before attach3, flush exec"}
++ }
++
++ send_gdb "attach $testpid\n"
++ gdb_expect {
++ -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*$gdb_prompt $"\
++ {pass "attach when process' a.out not in cwd"}
++ -re "$gdb_prompt $" {fail "attach when process' a.out not in cwd"}
++ timeout {fail "(timeout) attach when process' a.out not in cwd"}
++ }
++
++ send_gdb "kill\n"
++ gdb_expect {
++ -re ".*Kill the program being debugged.*y or n. $"\
++ {send_gdb "y\n"
++ gdb_expect {
++ -re "$gdb_prompt $" {pass "after attach3, exit"}
++ timeout {fail "(timeout) after attach3, exit"}
++ }
++ }
++ -re "$gdb_prompt $" {fail "after attach3, exit"}
++ timeout {fail "(timeout) after attach3, exit"}
++ }
++
++ # Another "don't leave a process around"
++ remote_exec build "kill -9 ${testpid}"
++}
++
++proc do_call_attach_tests {} {
++ global gdb_prompt
++ global binfile2
++
++ # Start the program running and then wait for a bit, to be sure
++ # that it can be attached to.
++ #
++ set testpid [eval exec $binfile2 &]
++ exec sleep 2
++
++ # Attach
++ #
++ gdb_test "file $binfile2" ".*" "force switch to gdb64, if necessary"
++ send_gdb "attach $testpid\n"
++ gdb_expect {
++ -re ".*warning: reading register.*I.*O error.*$gdb_prompt $" {
++ fail "attach call, read register 3 error"
++ }
++ -re "Attaching to.*process $testpid.*libc.*$gdb_prompt $" {
++ pass "attach call"
++ }
++ -re "$gdb_prompt $" {fail "attach call"}
++ timeout {fail "(timeout) attach call"}
++ }
++
++ # See if other registers are problems
++ #
++ send_gdb "i r r3\n"
++ gdb_expect {
++ -re ".*warning: reading register.*$gdb_prompt $" {
++ pass "CHFts23490: known bug"
++ }
++ -re ".*r3.*$gdb_prompt $" {
++ pass "Bug fixed, Yayyy!"
++ }
++ timeout { fail "timeout on info reg" }
++ }
++
++ # Get rid of the process
++ #
++ gdb_test "p should_exit = 1" ".*"
++ gdb_test "c" ".*Program exited normally.*"
++
++ # Be paranoid
++ #
++ remote_exec build "kill -9 ${testpid}"
++
++}
++
++
++# Start with a fresh gdb
++#
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++# This is a test of gdb's ability to attach to a running process.
++#
++do_attach_tests
++
++# Test attaching when the target is inside a system call
++#
++gdb_exit
++gdb_start
++
++gdb_reinitialize_dir $srcdir/$subdir
++do_call_attach_tests
++
++return 0
+Index: gdb-6.8/gdb/testsuite/gdb.pie/attach2.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-6.8/gdb/testsuite/gdb.pie/attach2.c 2008-03-30 08:59:12.000000000 -0700
+@@ -0,0 +1,24 @@
++/* This program is intended to be started outside of gdb, and then
++ attached to by gdb. Thus, it simply spins in a loop. The loop
++ is exited when & if the variable 'should_exit' is non-zero. (It
++ is initialized to zero in this program, so the loop will never
++ exit unless/until gdb sets the variable to non-zero.)
++ */
++#include <stdio.h>
++#include <stdlib.h>
++#include <unistd.h>
++
++int should_exit = 0;
++
++int main ()
++{
++ int local_i = 0;
++
++ sleep( 10 ); /* System call causes register fetch to fail */
++ /* This is a known HPUX "feature" */
++ while (! should_exit)
++ {
++ local_i++;
++ }
++ return (0);
++}
+Index: gdb-6.8/gdb/testsuite/gdb.pie/break.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-6.8/gdb/testsuite/gdb.pie/break.c 2008-03-30 08:59:12.000000000 -0700
+@@ -0,0 +1,146 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 1992, 1993, 1994, 1995, 1999, 2002, 2003 Free Software
++ Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++ Please email any bugs, comments, and/or additions to this file to:
++ bug-gdb@prep.ai.mit.edu */
++
++#ifdef vxworks
++
++# include <stdio.h>
++
++/* VxWorks does not supply atoi. */
++static int
++atoi (z)
++ char *z;
++{
++ int i = 0;
++
++ while (*z >= '0' && *z <= '9')
++ i = i * 10 + (*z++ - '0');
++ return i;
++}
++
++/* I don't know of any way to pass an array to VxWorks. This function
++ can be called directly from gdb. */
++
++vxmain (arg)
++char *arg;
++{
++ char *argv[2];
++
++ argv[0] = "";
++ argv[1] = arg;
++ main (2, argv, (char **) 0);
++}
++
++#else /* ! vxworks */
++# include <stdio.h>
++# include <stdlib.h>
++#endif /* ! vxworks */
++
++#ifdef PROTOTYPES
++extern int marker1 (void);
++extern int marker2 (int a);
++extern void marker3 (char *a, char *b);
++extern void marker4 (long d);
++#else
++extern int marker1 ();
++extern int marker2 ();
++extern void marker3 ();
++extern void marker4 ();
++#endif
++
++/*
++ * This simple classical example of recursion is useful for
++ * testing stack backtraces and such.
++ */
++
++#ifdef PROTOTYPES
++int factorial(int);
++
++int
++main (int argc, char **argv, char **envp)
++#else
++int
++main (argc, argv, envp)
++int argc;
++char *argv[], **envp;
++#endif
++{
++#ifdef usestubs
++ set_debug_traps(); /* set breakpoint 5 here */
++ breakpoint();
++#endif
++ if (argc == 12345) { /* an unlikely value < 2^16, in case uninited */ /* set breakpoint 6 here */
++ fprintf (stderr, "usage: factorial <number>\n");
++ return 1;
++ }
++ printf ("%d\n", factorial (atoi ("6"))); /* set breakpoint 1 here */
++ /* set breakpoint 12 here */
++ marker1 (); /* set breakpoint 11 here */
++ marker2 (43); /* set breakpoint 20 here */
++ marker3 ("stack", "trace"); /* set breakpoint 21 here */
++ marker4 (177601976L);
++ argc = (argc == 12345); /* This is silly, but we can step off of it */ /* set breakpoint 2 here */
++ return argc; /* set breakpoint 10 here */
++}
++
++#ifdef PROTOTYPES
++int factorial (int value)
++#else
++int factorial (value)
++int value;
++#endif
++{
++ if (value > 1) { /* set breakpoint 7 here */
++ value *= factorial (value - 1);
++ }
++ return (value); /* set breakpoint 19 here */
++}
++
++#ifdef PROTOTYPES
++int multi_line_if_conditional (int a, int b, int c)
++#else
++int multi_line_if_conditional (a, b, c)
++ int a, b, c;
++#endif
++{
++ if (a /* set breakpoint 3 here */
++ && b
++ && c)
++ return 0;
++ else
++ return 1;
++}
++
++#ifdef PROTOTYPES
++int multi_line_while_conditional (int a, int b, int c)
++#else
++int multi_line_while_conditional (a, b, c)
++ int a, b, c;
++#endif
++{
++ while (a /* set breakpoint 4 here */
++ && b
++ && c)
++ {
++ a--, b--, c--;
++ }
++ return 0;
++}
+Index: gdb-6.8/gdb/testsuite/gdb.pie/break.exp
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-6.8/gdb/testsuite/gdb.pie/break.exp 2008-03-30 08:59:12.000000000 -0700
+@@ -0,0 +1,973 @@
++# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999,
++# 2000, 2002, 2003, 2004
++# Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++# Please email any bugs, comments, and/or additions to this file to:
++# bug-gdb@prep.ai.mit.edu
++
++# This file was written by Rob Savoye. (rob@cygnus.com)
++
++# Test the same stuff but with PIE executables
++
++if $tracelevel then {
++ strace $tracelevel
++}
++
++
++#
++# test running programs
++#
++set prms_id 0
++set bug_id 0
++
++set testfile "break"
++set srcfile ${testfile}.c
++set srcfile1 ${testfile}1.c
++set binfile ${objdir}/${subdir}/${testfile}
++
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug "additional_flags=-w -fpie -pie"}] != "" } {
++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
++}
++
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug "additional_flags=-w -fpie -pie"}] != "" } {
++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
++}
++
++if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug "additional_flags=-w -fpie -pie"}] != "" } {
++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
++}
++
++if [get_compiler_info ${binfile}] {
++ return -1
++}
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++if [target_info exists gdb_stub] {
++ gdb_step_for_stub;
++}
++#
++# test simple breakpoint setting commands
++#
++
++# Test deleting all breakpoints when there are none installed,
++# GDB should not prompt for confirmation.
++# Note that gdb-init.exp provides a "delete_breakpoints" proc
++# for general use elsewhere.
++
++send_gdb "delete breakpoints\n"
++gdb_expect {
++ -re "Delete all breakpoints.*$" {
++ send_gdb "y\n"
++ gdb_expect {
++ -re "$gdb_prompt $" {
++ fail "Delete all breakpoints when none (unexpected prompt)"
++ }
++ timeout { fail "Delete all breakpoints when none (timeout after unexpected prompt)" }
++ }
++ }
++ -re ".*$gdb_prompt $" { pass "Delete all breakpoints when none" }
++ timeout { fail "Delete all breakpoints when none (timeout)" }
++}
++
++#
++# test break at function
++#
++gdb_test "break main" \
++ "Breakpoint.*at.* file .*$srcfile, line.*" \
++ "breakpoint function"
++
++#
++# test break at quoted function
++#
++gdb_test "break \"marker2\"" \
++ "Breakpoint.*at.* file .*$srcfile1, line.*" \
++ "breakpoint quoted function"
++
++#
++# test break at function in file
++#
++gdb_test "break $srcfile:factorial" \
++ "Breakpoint.*at.* file .*$srcfile, line.*" \
++ "breakpoint function in file"
++
++set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
++
++#
++# test break at line number
++#
++# Note that the default source file is the last one whose source text
++# was printed. For native debugging, before we've executed the
++# program, this is the file containing main, but for remote debugging,
++# it's wherever the processor was stopped when we connected to the
++# board. So, to be sure, we do a list command.
++#
++gdb_test "list main" \
++ ".*main \\(argc, argv, envp\\).*" \
++ "use `list' to establish default source file"
++gdb_test "break $bp_location1" \
++ "Breakpoint.*at.* file .*$srcfile, line $bp_location1\\." \
++ "breakpoint line number"
++
++#
++# test duplicate breakpoint
++#
++gdb_test "break $bp_location1" \
++ "Note: breakpoint \[0-9\]+ also set at pc.*Breakpoint \[0-9\]+ at.* file .*$srcfile, line $bp_location1\\." \
++ "breakpoint duplicate"
++
++set bp_location2 [gdb_get_line_number "set breakpoint 2 here"]
++
++#
++# test break at line number in file
++#
++gdb_test "break $srcfile:$bp_location2" \
++ "Breakpoint.*at.* file .*$srcfile, line $bp_location2\\." \
++ "breakpoint line number in file"
++
++set bp_location3 [gdb_get_line_number "set breakpoint 3 here"]
++set bp_location4 [gdb_get_line_number "set breakpoint 4 here"]
++
++#
++# Test putting a break at the start of a multi-line if conditional.
++# Verify the breakpoint was put at the start of the conditional.
++#
++gdb_test "break multi_line_if_conditional" \
++ "Breakpoint.*at.* file .*$srcfile, line $bp_location3\\." \
++ "breakpoint at start of multi line if conditional"
++
++gdb_test "break multi_line_while_conditional" \
++ "Breakpoint.*at.* file .*$srcfile, line $bp_location4\\." \
++ "breakpoint at start of multi line while conditional"
++
++set bp_location5 [gdb_get_line_number "set breakpoint 5 here"]
++set bp_location6 [gdb_get_line_number "set breakpoint 6 here"]
++
++#
++# check to see what breakpoints are set
++#
++if [target_info exists gdb_stub] {
++ set main_line $bp_location5
++} else {
++ set main_line $bp_location6
++}
++
++if {$hp_aCC_compiler} {
++ set proto "\\(int\\)"
++} else {
++ set proto ""
++}
++
++set bp_location7 [gdb_get_line_number "set breakpoint 7 here"]
++set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1]
++set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1]
++
++gdb_test "info break" \
++ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
++\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.*
++\[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile1:($bp_location8|$bp_location9).*
++\[0-9\]+\[\t \]+breakpoint keep y.* in factorial$proto at .*$srcfile:$bp_location7.*
++\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.*
++\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.*
++\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location2.*
++\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_if_conditional at .*$srcfile:$bp_location3.*
++\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_while_conditional at .*$srcfile:$bp_location4" \
++ "breakpoint info"
++
++# FIXME: The rest of this test doesn't work with anything that can't
++# handle arguments.
++# Huh? There doesn't *appear* to be anything that passes arguments
++# below.
++if [istarget "mips-idt-*"] then {
++ return
++}
++
++#
++# run until the breakpoint at main is hit. For non-stubs-using targets.
++#
++if ![target_info exists use_gdb_stub] {
++ if [istarget "*-*-vxworks*"] then {
++ send_gdb "run vxmain \"2\"\n"
++ set timeout 120
++ verbose "Timeout is now $timeout seconds" 2
++ } else {
++ send_gdb "run\n"
++ }
++ gdb_expect {
++ -re "The program .* has been started already.*y or n. $" {
++ send_gdb "y\n"
++ exp_continue
++ }
++ -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $"\
++ { pass "run until function breakpoint" }
++ -re ".*$gdb_prompt $" { fail "run until function breakpoint" }
++ timeout { fail "run until function breakpoint (timeout)" }
++ }
++} else {
++ if ![target_info exists gdb_stub] {
++ gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.*\{.*" "stub continue"
++ }
++}
++
++#
++# run until the breakpoint at a line number
++#
++gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location1.*$bp_location1\[\t \]+printf.*factorial.*" \
++ "run until breakpoint set at a line number"
++
++#
++# Run until the breakpoint set in a function in a file
++#
++for {set i 6} {$i >= 1} {incr i -1} {
++ gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, factorial \\(value=$i\\) at .*$srcfile:$bp_location7.*$bp_location7\[\t \]+.*if .value > 1. \{.*" \
++ "run until file:function($i) breakpoint"
++}
++
++#
++# Run until the breakpoint set at a quoted function
++#
++gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, (0x\[0-9a-f\]+ in )?marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*" \
++ "run until quoted breakpoint"
++#
++# run until the file:function breakpoint at a line number in a file
++#
++gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location2.*$bp_location2\[\t \]+argc = \\(argc == 12345\\);.*" \
++ "run until file:linenum breakpoint"
++
++# Test break at offset +1
++set bp_location10 [gdb_get_line_number "set breakpoint 10 here"]
++
++gdb_test "break +1" \
++ "Breakpoint.*at.* file .*$srcfile, line $bp_location10\\." \
++ "breakpoint offset +1"
++
++# Check to see if breakpoint is hit when stepped onto
++
++gdb_test "step" \
++ ".*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location10.*$bp_location10\[\t \]+return argc;.*breakpoint 10 here.*" \
++ "step onto breakpoint"
++
++#
++# delete all breakpoints so we can start over, course this can be a test too
++#
++delete_breakpoints
++
++#
++# test temporary breakpoint at function
++#
++
++gdb_test "tbreak main" "Breakpoint.*at.* file .*$srcfile, line.*" "Temporary breakpoint function"
++
++#
++# test break at function in file
++#
++
++gdb_test "tbreak $srcfile:factorial" "Breakpoint.*at.* file .*$srcfile, line.*" \
++ "Temporary breakpoint function in file"
++
++#
++# test break at line number
++#
++send_gdb "tbreak $bp_location1\n"
++gdb_expect {
++ -re "Breakpoint.*at.* file .*$srcfile, line $bp_location1.*$gdb_prompt $" { pass "Temporary breakpoint line number #1" }
++ -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number #1" }
++ timeout { fail "breakpoint line number #1 (timeout)" }
++}
++
++gdb_test "tbreak $bp_location6" "Breakpoint.*at.* file .*$srcfile, line $bp_location6.*" "Temporary breakpoint line number #2"
++
++#
++# test break at line number in file
++#
++send_gdb "tbreak $srcfile:$bp_location2\n"
++gdb_expect {
++ -re "Breakpoint.*at.* file .*$srcfile, line $bp_location2.*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" }
++ -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" }
++ timeout { fail "Temporary breakpoint line number in file #1 (timeout)" }
++}
++
++set bp_location11 [gdb_get_line_number "set breakpoint 11 here"]
++gdb_test "tbreak $srcfile:$bp_location11" "Breakpoint.*at.* file .*$srcfile, line $bp_location11.*" "Temporary breakpoint line number in file #2"
++
++#
++# check to see what breakpoints are set (temporary this time)
++#
++gdb_test "info break" "Num Type.*Disp Enb Address.*What.*\[\r\n\]
++\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$main_line.*\[\r\n\]
++\[0-9\]+\[\t \]+breakpoint del.*y.*in factorial$proto at .*$srcfile:$bp_location7.*\[\r\n\]
++\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location1.*\[\r\n\]
++\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location6.*\[\r\n\]
++\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location2.*\[\r\n\]
++\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location11.*" \
++ "Temporary breakpoint info"
++
++
++#***********
++
++# Verify that catchpoints for fork, vfork and exec don't trigger
++# inappropriately. (There are no calls to those system functions
++# in this test program.)
++#
++if ![runto_main] then { fail "break tests suppressed" }
++
++send_gdb "catch\n"
++gdb_expect {
++ -re "Catch requires an event name.*$gdb_prompt $"\
++ {pass "catch requires an event name"}
++ -re "$gdb_prompt $"\
++ {fail "catch requires an event name"}
++ timeout {fail "(timeout) catch requires an event name"}
++}
++
++
++set name "set catch fork, never expected to trigger"
++send_gdb "catch fork\n"
++gdb_expect {
++ -re "Catchpoint \[0-9\]* .fork..*$gdb_prompt $"
++ {pass $name}
++ -re "Catch of fork not yet implemented.*$gdb_prompt $"
++ {pass $name}
++ -re "$gdb_prompt $"
++ {fail $name}
++ timeout {fail "(timeout) $name"}
++}
++
++
++set name "set catch vfork, never expected to trigger"
++send_gdb "catch vfork\n"
++
++# If we are on HP-UX 10.20, we expect an error message to be
++# printed if we type "catch vfork" at the gdb gdb_prompt. This is
++# because on HP-UX 10.20, we cannot catch vfork events.
++
++if [istarget "hppa*-hp-hpux10.20"] then {
++ gdb_expect {
++ -re "Catch of vfork events not supported on HP-UX 10.20..*$gdb_prompt $"
++ {pass $name}
++ -re "$gdb_prompt $"
++ {fail $name}
++ timeout {fail "(timeout) $name"}
++ }
++} else {
++ gdb_expect {
++ -re "Catchpoint \[0-9\]* .vfork..*$gdb_prompt $"
++ {pass $name}
++ -re "Catch of vfork not yet implemented.*$gdb_prompt $"
++ {pass $name}
++ -re "$gdb_prompt $"
++ {fail $name}
++ timeout {fail "(timeout) $name"}
++ }
++}
++
++set name "set catch exec, never expected to trigger"
++send_gdb "catch exec\n"
++gdb_expect {
++ -re "Catchpoint \[0-9\]* .exec..*$gdb_prompt $"
++ {pass $name}
++ -re "Catch of exec not yet implemented.*$gdb_prompt $"
++ {pass $name}
++ -re "$gdb_prompt $" {fail $name}
++ timeout {fail "(timeout) $name"}
++}
++
++# Verify that GDB responds gracefully when asked to set a breakpoint
++# on a nonexistent source line.
++#
++send_gdb "break 999\n"
++gdb_expect {
++ -re "No line 999 in file .*$gdb_prompt $"\
++ {pass "break on non-existent source line"}
++ -re "$gdb_prompt $"\
++ {fail "break on non-existent source line"}
++ timeout {fail "(timeout) break on non-existent source line"}
++}
++
++# Run to the desired default location. If not positioned here, the
++# tests below don't work.
++#
++gdb_test "until $bp_location1" "main .* at .*:$bp_location1.*" "until bp_location1"
++
++
++# Verify that GDB allows one to just say "break", which is treated
++# as the "default" breakpoint. Note that GDB gets cute when printing
++# the informational message about other breakpoints at the same
++# location. We'll hit that bird with this stone too.
++#
++send_gdb "break\n"
++gdb_expect {
++ -re "Breakpoint \[0-9\]*.*$gdb_prompt $"\
++ {pass "break on default location, 1st time"}
++ -re "$gdb_prompt $"\
++ {fail "break on default location, 1st time"}
++ timeout {fail "(timeout) break on default location, 1st time"}
++}
++
++send_gdb "break\n"
++gdb_expect {
++ -re "Note: breakpoint \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\
++ {pass "break on default location, 2nd time"}
++ -re "$gdb_prompt $"\
++ {fail "break on default location, 2nd time"}
++ timeout {fail "(timeout) break on default location, 2nd time"}
++}
++
++send_gdb "break\n"
++gdb_expect {
++ -re "Note: breakpoints \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\
++ {pass "break on default location, 3rd time"}
++ -re "$gdb_prompt $"\
++ {fail "break on default location, 3rd time"}
++ timeout {fail "(timeout) break on default location, 3rd time"}
++}
++
++send_gdb "break\n"
++gdb_expect {
++ -re "Note: breakpoints \[0-9\]*, \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\
++ {pass "break on default location, 4th time"}
++ -re "$gdb_prompt $"\
++ {fail "break on default location, 4th time"}
++ timeout {fail "(timeout) break on default location, 4th time"}
++}
++
++# Verify that a "silent" breakpoint can be set, and that GDB is indeed
++# "silent" about its triggering.
++#
++if ![runto_main] then { fail "break tests suppressed" }
++
++send_gdb "break $bp_location1\n"
++gdb_expect {
++ -re "Breakpoint (\[0-9\]*) at .*, line $bp_location1.*$gdb_prompt $"\
++ {pass "set to-be-silent break bp_location1"}
++ -re "$gdb_prompt $"\
++ {fail "set to-be-silent break bp_location1"}
++ timeout {fail "(timeout) set to-be-silent break bp_location1"}
++}
++
++send_gdb "commands $expect_out(1,string)\n"
++send_gdb "silent\n"
++send_gdb "end\n"
++gdb_expect {
++ -re ".*$gdb_prompt $"\
++ {pass "set silent break bp_location1"}
++ timeout {fail "(timeout) set silent break bp_location1"}
++}
++
++send_gdb "info break $expect_out(1,string)\n"
++gdb_expect {
++ -re "\[0-9\]*\[ \t\]*breakpoint.*:$bp_location1\r\n\[ \t\]*silent.*$gdb_prompt $"\
++ {pass "info silent break bp_location1"}
++ -re "$gdb_prompt $"\
++ {fail "info silent break bp_location1"}
++ timeout {fail "(timeout) info silent break bp_location1"}
++}
++send_gdb "continue\n"
++gdb_expect {
++ -re "Continuing.\r\n$gdb_prompt $"\
++ {pass "hit silent break bp_location1"}
++ -re "$gdb_prompt $"\
++ {fail "hit silent break bp_location1"}
++ timeout {fail "(timeout) hit silent break bp_location1"}
++}
++send_gdb "bt\n"
++gdb_expect {
++ -re "#0 main .* at .*:$bp_location1.*$gdb_prompt $"\
++ {pass "stopped for silent break bp_location1"}
++ -re "$gdb_prompt $"\
++ {fail "stopped for silent break bp_location1"}
++ timeout {fail "(timeout) stopped for silent break bp_location1"}
++}
++
++# Verify that GDB can at least parse a breakpoint with the
++# "thread" keyword. (We won't attempt to test here that a
++# thread-specific breakpoint really triggers appropriately.
++# The gdb.threads subdirectory contains tests for that.)
++#
++set bp_location12 [gdb_get_line_number "set breakpoint 12 here"]
++send_gdb "break $bp_location12 thread 999\n"
++gdb_expect {
++ -re "Unknown thread 999.*$gdb_prompt $"\
++ {pass "thread-specific breakpoint on non-existent thread disallowed"}
++ -re "$gdb_prompt $"\
++ {fail "thread-specific breakpoint on non-existent thread disallowed"}
++ timeout {fail "(timeout) thread-specific breakpoint on non-existent thread disallowed"}
++}
++send_gdb "break $bp_location12 thread foo\n"
++gdb_expect {
++ -re "Junk after thread keyword..*$gdb_prompt $"\
++ {pass "thread-specific breakpoint on bogus thread ID disallowed"}
++ -re "$gdb_prompt $"\
++ {fail "thread-specific breakpoint on bogus thread ID disallowed"}
++ timeout {fail "(timeout) thread-specific breakpoint on bogus thread ID disallowed"}
++}
++
++# Verify that GDB responds gracefully to a breakpoint command with
++# trailing garbage.
++#
++send_gdb "break $bp_location12 foo\n"
++gdb_expect {
++ -re "Junk at end of arguments..*$gdb_prompt $"\
++ {pass "breakpoint with trailing garbage disallowed"}
++ -re "$gdb_prompt $"\
++ {fail "breakpoint with trailing garbage disallowed"}
++ timeout {fail "(timeout) breakpoint with trailing garbage disallowed"}
++}
++
++# Verify that GDB responds gracefully to a "clear" command that has
++# no matching breakpoint. (First, get us off the current source line,
++# which we know has a breakpoint.)
++#
++send_gdb "next\n"
++gdb_expect {
++ -re ".*$gdb_prompt $"\
++ {pass "step over breakpoint"}
++ timeout {fail "(timeout) step over breakpoint"}
++}
++send_gdb "clear 81\n"
++gdb_expect {
++ -re "No breakpoint at 81..*$gdb_prompt $"\
++ {pass "clear line has no breakpoint disallowed"}
++ -re "$gdb_prompt $"\
++ {fail "clear line has no breakpoint disallowed"}
++ timeout {fail "(timeout) clear line has no breakpoint disallowed"}
++}
++send_gdb "clear\n"
++gdb_expect {
++ -re "No breakpoint at this line..*$gdb_prompt $"\
++ {pass "clear current line has no breakpoint disallowed"}
++ -re "$gdb_prompt $"\
++ {fail "clear current line has no breakpoint disallowed"}
++ timeout {fail "(timeout) clear current line has no breakpoint disallowed"}
++}
++
++# Verify that we can set and clear multiple breakpoints.
++#
++# We don't test that it deletes the correct breakpoints. We do at
++# least test that it deletes more than one breakpoint.
++#
++gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #1"
++gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #2"
++gdb_test "clear marker3" {Deleted breakpoints [0-9]+ [0-9]+.*}
++
++# Verify that a breakpoint can be set via a convenience variable.
++#
++send_gdb "set \$foo=$bp_location11\n"
++gdb_expect {
++ -re "$gdb_prompt $"\
++ {pass "set convenience variable \$foo to bp_location11"}
++ timeout {fail "(timeout) set convenience variable \$foo to bp_location11"}
++}
++send_gdb "break \$foo\n"
++gdb_expect {
++ -re "Breakpoint (\[0-9\]*) at .*, line $bp_location11.*$gdb_prompt $"\
++ {pass "set breakpoint via convenience variable"}
++ -re "$gdb_prompt $"\
++ {fail "set breakpoint via convenience variable"}
++ timeout {fail "(timeout) set breakpoint via convenience variable"}
++}
++
++# Verify that GDB responds gracefully to an attempt to set a
++# breakpoint via a convenience variable whose type is not integer.
++#
++send_gdb "set \$foo=81.5\n"
++gdb_expect {
++ -re "$gdb_prompt $"\
++ {pass "set convenience variable \$foo to 81.5"}
++ timeout {fail "(timeout) set convenience variable \$foo to 81.5"}
++}
++send_gdb "break \$foo\n"
++gdb_expect {
++ -re "Convenience variables used in line specs must have integer values..*$gdb_prompt $"\
++ {pass "set breakpoint via non-integer convenience variable disallowed"}
++ -re "$gdb_prompt $"\
++ {fail "set breakpoint via non-integer convenience variable disallowed"}
++ timeout {fail "(timeout) set breakpoint via non-integer convenience variable disallowed"}
++}
++
++# Verify that we can set and trigger a breakpoint in a user-called function.
++#
++send_gdb "break marker2\n"
++gdb_expect {
++ -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location8|$bp_location9).*$gdb_prompt $"\
++ {pass "set breakpoint on to-be-called function"}
++ -re "$gdb_prompt $"\
++ {fail "set breakpoint on to-be-called function"}
++ timeout {fail "(timeout) set breakpoint on to-be-called function"}
++}
++send_gdb "print marker2(99)\n"
++gdb_expect {
++ -re "The program being debugged stopped while in a function called from GDB.\r\nWhen the function .marker2$proto. is done executing, GDB will silently\r\nstop .instead of continuing to evaluate the expression containing\r\nthe function call...*$gdb_prompt $"\
++ {pass "hit breakpoint on called function"}
++ -re "$gdb_prompt $"\
++ {fail "hit breakpoint on called function"}
++ timeout {fail "(timeout) hit breakpoint on called function"}
++}
++
++# As long as we're stopped (breakpointed) in a called function,
++# verify that we can successfully backtrace & such from here.
++#
++# In this and the following test, the _sr4export check apparently is needed
++# for hppa*-*-hpux.
++#
++send_gdb "bt\n"
++gdb_expect {
++ -re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*_sr4export.*$gdb_prompt $"\
++ {pass "backtrace while in called function"}
++ -re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*function called from gdb.*$gdb_prompt $"\
++ {pass "backtrace while in called function"}
++ -re "$gdb_prompt $"\
++ {fail "backtrace while in called function"}
++ timeout {fail "(timeout) backtrace while in called function"}
++}
++
++# Return from the called function. For remote targets, it's important to do
++# this before runto_main, which otherwise may silently stop on the dummy
++# breakpoint inserted by GDB at the program's entry point.
++#
++send_gdb "finish\n"
++gdb_expect {
++ -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.* in _sr4export.*$gdb_prompt $"\
++ {pass "finish from called function"}
++ -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*function called from gdb.*$gdb_prompt $"\
++ {pass "finish from called function"}
++ -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*Value returned.*$gdb_prompt $"\
++ {pass "finish from called function"}
++ -re "$gdb_prompt $"\
++ {fail "finish from called function"}
++ timeout {fail "(timeout) finish from called function"}
++}
++
++# Verify that GDB responds gracefully to a "finish" command with
++# arguments.
++#
++if ![runto_main] then { fail "break tests suppressed" }
++
++send_gdb "finish 123\n"
++gdb_expect {
++ -re "The \"finish\" command does not take any arguments.\r\n$gdb_prompt $"\
++ {pass "finish with arguments disallowed"}
++ -re "$gdb_prompt $"\
++ {fail "finish with arguments disallowed"}
++ timeout {fail "(timeout) finish with arguments disallowed"}
++}
++
++# Verify that GDB responds gracefully to a request to "finish" from
++# the outermost frame. On a stub that never exits, this will just
++# run to the stubs routine, so we don't get this error... Thus the
++# second condition.
++#
++
++send_gdb "finish\n"
++gdb_expect {
++ -re "\"finish\" not meaningful in the outermost frame.\r\n$gdb_prompt $"\
++ {pass "finish from outermost frame disallowed"}
++ -re "Run till exit from.*\r\n$gdb_prompt $" {
++ pass "finish from outermost frame disallowed"
++ }
++ -re "$gdb_prompt $"\
++ {fail "finish from outermost frame disallowed"}
++ timeout {fail "(timeout) finish from outermost frame disallowed"}
++}
++
++# Verify that we can explicitly ask GDB to stop on all shared library
++# events, and that it does so.
++#
++if [istarget "hppa*-*-hpux*"] then {
++ if ![runto_main] then { fail "break tests suppressed" }
++
++ send_gdb "set stop-on-solib-events 1\n"
++ gdb_expect {
++ -re "$gdb_prompt $"\
++ {pass "set stop-on-solib-events"}
++ timeout {fail "(timeout) set stop-on-solib-events"}
++ }
++
++ send_gdb "run\n"
++ gdb_expect {
++ -re ".*Start it from the beginning.*y or n. $"\
++ {send_gdb "y\n"
++ gdb_expect {
++ -re ".*Stopped due to shared library event.*$gdb_prompt $"\
++ {pass "triggered stop-on-solib-events"}
++ -re "$gdb_prompt $"\
++ {fail "triggered stop-on-solib-events"}
++ timeout {fail "(timeout) triggered stop-on-solib-events"}
++ }
++ }
++ -re "$gdb_prompt $"\
++ {fail "rerun for stop-on-solib-events"}
++ timeout {fail "(timeout) rerun for stop-on-solib-events"}
++ }
++
++ send_gdb "set stop-on-solib-events 0\n"
++ gdb_expect {
++ -re "$gdb_prompt $"\
++ {pass "reset stop-on-solib-events"}
++ timeout {fail "(timeout) reset stop-on-solib-events"}
++ }
++}
++
++# Hardware breakpoints are unsupported on HP-UX. Verify that GDB
++# gracefully responds to requests to create them.
++#
++if [istarget "hppa*-*-hpux*"] then {
++ if ![runto_main] then { fail "break tests suppressed" }
++
++ send_gdb "hbreak\n"
++ gdb_expect {
++ -re "No hardware breakpoint support in the target.*$gdb_prompt $"\
++ {pass "hw breaks disallowed"}
++ -re "$gdb_prompt $"\
++ {fail "hw breaks disallowed"}
++ timeout {fail "(timeout) hw breaks disallowed"}
++ }
++
++ send_gdb "thbreak\n"
++ gdb_expect {
++ -re "No hardware breakpoint support in the target.*$gdb_prompt $"\
++ {pass "temporary hw breaks disallowed"}
++ -re "$gdb_prompt $"\
++ {fail "temporary hw breaks disallowed"}
++ timeout {fail "(timeout) temporary hw breaks disallowed"}
++ }
++}
++
++#********
++
++
++#
++# Test "next" over recursive function call.
++#
++
++proc test_next_with_recursion {} {
++ global gdb_prompt
++ global decimal
++ global binfile
++
++ if [target_info exists use_gdb_stub] {
++ # Reload the program.
++ delete_breakpoints
++ gdb_load ${binfile};
++ } else {
++ # FIXME: should be using runto
++ gdb_test "kill" "" "kill program" "Kill the program being debugged.*y or n. $" "y"
++
++ delete_breakpoints
++ }
++
++ gdb_test "break factorial" "Breakpoint $decimal at .*" "break at factorial"
++
++ # Run until we call factorial with 6
++
++ if [istarget "*-*-vxworks*"] then {
++ send_gdb "run vxmain \"6\"\n"
++ } else {
++ gdb_run_cmd
++ }
++ gdb_expect {
++ -re "Break.* factorial .value=6. .*$gdb_prompt $" {}
++ -re ".*$gdb_prompt $" {
++ fail "run to factorial(6)";
++ gdb_suppress_tests;
++ }
++ timeout { fail "run to factorial(6) (timeout)" ; gdb_suppress_tests }
++ }
++
++ # Continue until we call factorial recursively with 5.
++
++ if [gdb_test "continue" \
++ "Continuing.*Break.* factorial .value=5. .*" \
++ "continue to factorial(5)"] then { gdb_suppress_tests }
++
++ # Do a backtrace just to confirm how many levels deep we are.
++
++ if [gdb_test "backtrace" \
++ "#0\[ \t\]+ factorial .value=5..*" \
++ "backtrace from factorial(5)"] then { gdb_suppress_tests }
++
++ # Now a "next" should position us at the recursive call, which
++ # we will be performing with 4.
++
++ if [gdb_test "next" \
++ ".* factorial .value - 1.;.*" \
++ "next to recursive call"] then { gdb_suppress_tests }
++
++ # Disable the breakpoint at the entry to factorial by deleting them all.
++ # The "next" should run until we return to the next line from this
++ # recursive call to factorial with 4.
++ # Buggy versions of gdb will stop instead at the innermost frame on
++ # the line where we are trying to "next" to.
++
++ delete_breakpoints
++
++ if [istarget "mips*tx39-*"] {
++ set timeout 60
++ }
++ # We used to set timeout here for all other targets as well. This
++ # is almost certainly wrong. The proper timeout depends on the
++ # target system in use, and how we communicate with it, so there
++ # is no single value appropriate for all targets. The timeout
++ # should be established by the Dejagnu config file(s) for the
++ # board, and respected by the test suite.
++ #
++ # For example, if I'm running GDB over an SSH tunnel talking to a
++ # portmaster in California talking to an ancient 68k board running
++ # a crummy ROM monitor (a situation I can only wish were
++ # hypothetical), then I need a large timeout. But that's not the
++ # kind of knowledge that belongs in this file.
++
++ gdb_test next "\[0-9\]*\[\t \]+return \\(value\\);.*" \
++ "next over recursive call"
++
++ # OK, we should be back in the same stack frame we started from.
++ # Do a backtrace just to confirm.
++
++ set result [gdb_test "backtrace" \
++ "#0\[ \t\]+ factorial .value=120.*\r\n#1\[ \t\]+ \[0-9a-fx\]+ in factorial .value=6..*" \
++ "backtrace from factorial(5.1)"]
++ if { $result != 0 } { gdb_suppress_tests }
++
++ if [target_info exists gdb,noresults] { gdb_suppress_tests }
++ gdb_continue_to_end "recursive next test"
++ gdb_stop_suppressing_tests;
++}
++
++test_next_with_recursion
++
++
++#********
++
++# build a new file with optimization enabled so that we can try breakpoints
++# on targets with optimized prologues
++
++set binfileo2 ${objdir}/${subdir}/${testfile}o2
++
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}O0.o" object {debug "additional_flags=-w -O2 -fpie -pie"}] != "" } {
++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
++}
++
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}O1.o" object {debug "additional_flags=-w -O2 -fpie -pie"}] != "" } {
++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
++}
++
++if { [gdb_compile "${binfile}O0.o ${binfile}O1.o" "${binfileo2}" executable {debug "additional_flags=-w -fpie -pie"}] != "" } {
++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
++}
++
++if [get_compiler_info ${binfileo2}] {
++ return -1
++}
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfileo2}
++
++if [target_info exists gdb_stub] {
++ gdb_step_for_stub;
++}
++
++#
++# test break at function
++#
++gdb_test "break main" \
++ "Breakpoint.*at.* file .*$srcfile, line.*" \
++ "breakpoint function, optimized file"
++
++#
++# test break at function
++#
++gdb_test "break marker4" \
++ "Breakpoint.*at.* file .*$srcfile1, line.*" \
++ "breakpoint small function, optimized file"
++
++#
++# run until the breakpoint at main is hit. For non-stubs-using targets.
++#
++if ![target_info exists use_gdb_stub] {
++ if [istarget "*-*-vxworks*"] then {
++ send_gdb "run vxmain \"2\"\n"
++ set timeout 120
++ verbose "Timeout is now $timeout seconds" 2
++ } else {
++ send_gdb "run\n"
++ }
++ gdb_expect {
++ -re "The program .* has been started already.*y or n. $" {
++ send_gdb "y\n"
++ exp_continue
++ }
++ -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $"\
++ { pass "run until function breakpoint, optimized file" }
++ -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$gdb_prompt $"\
++ { pass "run until function breakpoint, optimized file (code motion)" }
++ -re ".*$gdb_prompt $" { fail "run until function breakpoint, optimized file" }
++ timeout { fail "run until function breakpoint, optimized file (timeout)" }
++ }
++} else {
++ if ![target_info exists gdb_stub] {
++ gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.*\{.*" "stub continue, optimized file"
++ }
++}
++
++#
++# run until the breakpoint at a small function
++#
++
++#
++# Add a second pass pattern. The behavior differs here between stabs
++# and dwarf for one-line functions. Stabs preserves two line symbols
++# (one before the prologue and one after) with the same line number,
++# but dwarf regards these as duplicates and discards one of them.
++# Therefore the address after the prologue (where the breakpoint is)
++# has no exactly matching line symbol, and GDB reports the breakpoint
++# as if it were in the middle of a line rather than at the beginning.
++
++set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1]
++set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1]
++send_gdb "continue\n"
++gdb_expect {
++ -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" {
++ pass "run until breakpoint set at small function, optimized file"
++ }
++ -re "Breakpoint $decimal, $hex in marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" {
++ pass "run until breakpoint set at small function, optimized file"
++ }
++ -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location14\[\r\n\]+$bp_location14\[\t \]+void marker4.*" {
++ # marker4() is defined at line 46 when compiled with -DPROTOTYPES
++ pass "run until breakpoint set at small function, optimized file (line bp_location14)"
++ }
++ -re ".*$gdb_prompt " {
++ fail "run until breakpoint set at small function, optimized file"
++ }
++ timeout {
++ fail "run until breakpoint set at small function, optimized file (timeout)"
++ }
++}
++
++
++# Reset the default arguments for VxWorks
++if [istarget "*-*-vxworks*"] {
++ set timeout 10
++ verbose "Timeout is now $timeout seconds" 2
++ send_gdb "set args main\n"
++ gdb_expect -re ".*$gdb_prompt $" {}
++}
+Index: gdb-6.8/gdb/testsuite/gdb.pie/break1.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-6.8/gdb/testsuite/gdb.pie/break1.c 2008-03-30 08:59:12.000000000 -0700
+@@ -0,0 +1,44 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 1992, 1993, 1994, 1995, 1999, 2002, 2003 Free Software
++ Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++ Please email any bugs, comments, and/or additions to this file to:
++ bug-gdb@prep.ai.mit.edu */
++
++/* The code for this file was extracted from the gdb testsuite
++ testcase "break.c". */
++
++/* The following functions do nothing useful. They are included
++ simply as places to try setting breakpoints at. They are
++ explicitly "one-line functions" to verify that this case works
++ (some versions of gcc have or have had problems with this).
++
++ These functions are in a separate source file to prevent an
++ optimizing compiler from inlining them and optimizing them away. */
++
++#ifdef PROTOTYPES
++int marker1 (void) { return (0); } /* set breakpoint 15 here */
++int marker2 (int a) { return (1); } /* set breakpoint 8 here */
++void marker3 (char *a, char *b) {} /* set breakpoint 17 here */
++void marker4 (long d) {} /* set breakpoint 14 here */
++#else
++int marker1 () { return (0); } /* set breakpoint 16 here */
++int marker2 (a) int a; { return (1); } /* set breakpoint 9 here */
++void marker3 (a, b) char *a, *b; {} /* set breakpoint 18 here */
++void marker4 (d) long d; {} /* set breakpoint 13 here */
++#endif
+Index: gdb-6.8/gdb/testsuite/gdb.pie/corefile.exp
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-6.8/gdb/testsuite/gdb.pie/corefile.exp 2008-03-30 08:59:12.000000000 -0700
+@@ -0,0 +1,243 @@
++# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
++# Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++# Please email any bugs, comments, and/or additions to this file to:
++# bug-gdb@prep.ai.mit.edu
++
++# This file was written by Fred Fish. (fnf@cygnus.com)
++
++if $tracelevel then {
++ strace $tracelevel
++}
++
++set prms_id 0
++set bug_id 0
++
++# are we on a target board
++if ![isnative] then {
++ return
++}
++
++set testfile "coremaker"
++set srcfile ${testfile}.c
++set binfile ${objdir}/${subdir}/${testfile}
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug "additional_flags=-fpie -pie"}] != "" } {
++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
++}
++
++# Create and source the file that provides information about the compiler
++# used to compile the test case.
++if [get_compiler_info ${binfile}] {
++ return -1;
++}
++
++# Create a core file named "corefile" rather than just "core", to
++# avoid problems with sys admin types that like to regularly prune all
++# files named "core" from the system.
++#
++# Arbitrarily try setting the core size limit to "unlimited" since
++# this does not hurt on systems where the command does not work and
++# allows us to generate a core on systems where it does.
++#
++# Some systems append "core" to the name of the program; others append
++# the name of the program to "core"; still others (like Linux, as of
++# May 2003) create cores named "core.PID". In the latter case, we
++# could have many core files lying around, and it may be difficult to
++# tell which one is ours, so let's run the program in a subdirectory.
++set found 0
++set coredir "${objdir}/${subdir}/coredir.[getpid]"
++file mkdir $coredir
++catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\""
++# remote_exec host "${binfile}"
++foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" {
++ if [remote_file build exists $i] {
++ remote_exec build "mv $i ${objdir}/${subdir}/corefile"
++ set found 1
++ }
++}
++# Check for "core.PID".
++if { $found == 0 } {
++ set names [glob -nocomplain -directory $coredir core.*]
++ if {[llength $names] == 1} {
++ set corefile [file join $coredir [lindex $names 0]]
++ remote_exec build "mv $corefile ${objdir}/${subdir}/corefile"
++ set found 1
++ }
++}
++if { $found == 0 } {
++ # The braindamaged HPUX shell quits after the ulimit -c above
++ # without executing ${binfile}. So we try again without the
++ # ulimit here if we didn't find a core file above.
++ # Oh, I should mention that any "braindamaged" non-Unix system has
++ # the same problem. I like the cd bit too, it's really neat'n stuff.
++ catch "system \"(cd ${objdir}/${subdir}; ${binfile}; true) >/dev/null 2>&1\""
++ foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" {
++ if [remote_file build exists $i] {
++ remote_exec build "mv $i ${objdir}/${subdir}/corefile"
++ set found 1
++ }
++ }
++}
++
++# Try to clean up after ourselves.
++remote_file build delete [file join $coredir coremmap.data]
++remote_exec build "rmdir $coredir"
++
++if { $found == 0 } {
++ warning "can't generate a core file - core tests suppressed - check ulimit -c"
++ return 0
++}
++
++#
++# Test that we can simply startup with a "-core=corefile" command line arg
++# and recognize that the core file is a valid, usable core file.
++# To do this, we must shutdown the currently running gdb and restart
++# with the -core args. We can't use gdb_start because it looks for
++# the first gdb prompt, and the message we are looking for occurs
++# before the first prompt. Also, we can't include GDBFLAGS because
++# if it is empty, this confuses gdb with an empty argument that it
++# grumbles about (said grumbling currently being ignored in gdb_start).
++# **FIXME**
++#
++# Another problem is that on some systems (solaris for example), there
++# is apparently a limit on the length of a fully specified path to
++# the coremaker executable, at about 80 chars. For this case, consider
++# it a pass, but note that the program name is bad.
++
++gdb_exit
++if $verbose>1 then {
++ send_user "Spawning $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile\n"
++}
++
++set oldtimeout $timeout
++set timeout [expr "$timeout + 60"]
++verbose "Timeout is now $timeout seconds" 2
++eval "spawn $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile"
++expect {
++ -re "Couldn't find .* registers in core file.*$gdb_prompt $" {
++ fail "args: -core=corefile (couldn't find regs)"
++ }
++ -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
++ pass "args: -core=corefile"
++ }
++ -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
++ pass "args: -core=corefile (with bad program name)"
++ }
++ -re ".*registers from core file: File in wrong format.* $" {
++ fail "args: -core=corefile (could not read registers from core file)"
++ }
++ -re ".*$gdb_prompt $" { fail "args: -core=corefile" }
++ timeout { fail "(timeout) starting with -core" }
++}
++
++
++#
++# Test that startup with both an executable file and -core argument.
++# See previous comments above, they are still applicable.
++#
++
++close;
++
++if $verbose>1 then {
++ send_user "Spawning $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile\n"
++}
++
++
++eval "spawn $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile";
++expect {
++ -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
++ pass "args: execfile -core=corefile"
++ }
++ -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
++ pass "args: execfile -core=corefile (with bad program name)"
++ }
++ -re ".*registers from core file: File in wrong format.* $" {
++ fail "args: execfile -core=corefile (could not read registers from core file)"
++ }
++ -re ".*$gdb_prompt $" { fail "args: execfile -core=corefile" }
++ timeout { fail "(timeout) starting with -core" }
++}
++set timeout $oldtimeout
++verbose "Timeout is now $timeout seconds" 2
++
++close;
++
++# Now restart normally.
++
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++# Test basic corefile recognition via core-file command.
++
++send_gdb "core-file $objdir/$subdir/corefile\n"
++gdb_expect {
++ -re ".* program is being debugged already.*y or n. $" {
++ # gdb_load may connect us to a gdbserver.
++ send_gdb "y\n"
++ exp_continue;
++ }
++ -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
++ pass "core-file command"
++ }
++ -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
++ pass "core-file command (with bad program name)"
++ }
++ -re ".*registers from core file: File in wrong format.* $" {
++ fail "core-file command (could not read registers from core file)"
++ }
++ -re ".*$gdb_prompt $" { fail "core-file command" }
++ timeout { fail "(timeout) core-file command" }
++}
++
++# Test correct mapping of corefile sections by printing some variables.
++
++gdb_test "print coremaker_data" "\\\$$decimal = 202"
++gdb_test "print coremaker_bss" "\\\$$decimal = 10"
++gdb_test "print coremaker_ro" "\\\$$decimal = 201"
++
++gdb_test "print func2::coremaker_local" "\\\$$decimal = \\{0, 1, 2, 3, 4\\}"
++
++# Somehow we better test the ability to read the registers out of the core
++# file correctly. I don't think the other tests do this.
++
++gdb_test "bt" "abort.*func2.*func1.*main.*" "backtrace in corefile.exp"
++gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp"
++
++# Test ability to read mmap'd data
++
++gdb_test "x/8bd buf1" ".*:.*0.*1.*2.*3.*4.*5.*6.*7" "accessing original mmap data in core file"
++setup_xfail "*-*-sunos*" "*-*-ultrix*" "*-*-aix*"
++set test "accessing mmapped data in core file"
++gdb_test_multiple "x/8bd buf2" "$test" {
++ -re ".*:.*0.*1.*2.*3.*4.*5.*6.*7.*$gdb_prompt $" {
++ pass "$test"
++ }
++ -re "0x\[f\]*:.*Cannot access memory at address 0x\[f\]*.*$gdb_prompt $" {
++ fail "$test (mapping failed at runtime)"
++ }
++ -re "0x.*:.*Cannot access memory at address 0x.*$gdb_prompt $" {
++ fail "$test (mapping address not found in core file)"
++ }
++}
++
++# test reinit_frame_cache
++
++gdb_load ${binfile}
++gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(\\).*" "up in corefile.exp (reinit)"
++
++gdb_test "core" "No core file now."
+Index: gdb-6.8/gdb/testsuite/gdb.pie/coremaker.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-6.8/gdb/testsuite/gdb.pie/coremaker.c 2008-03-30 08:59:12.000000000 -0700
+@@ -0,0 +1,142 @@
++/* Copyright 1992, 1993, 1994, 1995, 1996, 1999
++ Free Software Foundation, Inc.
++
++ This file is part of GDB.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or (at
++ your option) any later version.
++
++ This program is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330,
++ Boston, MA 02111-1307, USA. */
++
++/* Simple little program that just generates a core dump from inside some
++ nested function calls. */
++
++#include <stdio.h>
++#include <sys/types.h>
++#include <fcntl.h>
++#include <sys/mman.h>
++#include <signal.h>
++#include <stdlib.h>
++#include <unistd.h>
++
++#ifndef __STDC__
++#define const /**/
++#endif
++
++#define MAPSIZE (8 * 1024)
++
++/* Don't make these automatic vars or we will have to walk back up the
++ stack to access them. */
++
++char *buf1;
++char *buf2;
++
++int coremaker_data = 1; /* In Data section */
++int coremaker_bss; /* In BSS section */
++
++const int coremaker_ro = 201; /* In Read-Only Data section */
++
++/* Note that if the mapping fails for any reason, we set buf2
++ to -1 and the testsuite notices this and reports it as
++ a failure due to a mapping error. This way we don't have
++ to test for specific errors when running the core maker. */
++
++void
++mmapdata ()
++{
++ int j, fd;
++
++ /* Allocate and initialize a buffer that will be used to write
++ the file that is later mapped in. */
++
++ buf1 = (char *) malloc (MAPSIZE);
++ for (j = 0; j < MAPSIZE; ++j)
++ {
++ buf1[j] = j;
++ }
++
++ /* Write the file to map in */
++
++ fd = open ("coremmap.data", O_CREAT | O_RDWR, 0666);
++ if (fd == -1)
++ {
++ perror ("coremmap.data open failed");
++ buf2 = (char *) -1;
++ return;
++ }
++ write (fd, buf1, MAPSIZE);
++
++ /* Now map the file into our address space as buf2 */
++
++ buf2 = (char *) mmap (0, MAPSIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
++ if (buf2 == (char *) -1)
++ {
++ perror ("mmap failed");
++ return;
++ }
++
++ /* Verify that the original data and the mapped data are identical.
++ If not, we'd rather fail now than when trying to access the mapped
++ data from the core file. */
++
++ for (j = 0; j < MAPSIZE; ++j)
++ {
++ if (buf1[j] != buf2[j])
++ {
++ fprintf (stderr, "mapped data is incorrect");
++ buf2 = (char *) -1;
++ return;
++ }
++ }
++}
++
++void
++func2 ()
++{
++ int coremaker_local[5];
++ int i;
++
++#ifdef SA_FULLDUMP
++ /* Force a corefile that includes the data section for AIX. */
++ {
++ struct sigaction sa;
++
++ sigaction (SIGABRT, (struct sigaction *)0, &sa);
++ sa.sa_flags |= SA_FULLDUMP;
++ sigaction (SIGABRT, &sa, (struct sigaction *)0);
++ }
++#endif
++
++ /* Make sure that coremaker_local doesn't get optimized away. */
++ for (i = 0; i < 5; i++)
++ coremaker_local[i] = i;
++ coremaker_bss = 0;
++ for (i = 0; i < 5; i++)
++ coremaker_bss += coremaker_local[i];
++ coremaker_data = coremaker_ro + 1;
++ abort ();
++}
++
++void
++func1 ()
++{
++ func2 ();
++}
++
++int main ()
++{
++ mmapdata ();
++ func1 ();
++ return 0;
++}
++
diff --git a/extra/gdb/APKBUILD b/extra/gdb/APKBUILD
new file mode 100644
index 00000000..b6905cd2
--- /dev/null
+++ b/extra/gdb/APKBUILD
@@ -0,0 +1,41 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=gdb
+pkgver=6.8
+pkgrel=2
+pkgdesc="The GNU Debugger"
+url="http://sources.redhat.com/gdb/"
+license="GPL3"
+depends="ncurses expat readline"
+makedepends="ncurses-dev expat-dev readline-dev"
+subpackages="$pkgname-doc"
+source="http://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.bz2
+ 50_all_gdb-pie-1.patch
+ 50_all_gdb-pie-2.patch
+ "
+# patches were found here:
+# http://distfiles.gentoo.org/distfiles/$pkgname-$pkgver-patches-1.3.tar.lzma
+
+build () {
+ cd "$srcdir/$pkgname-$pkgver"
+ for i in ../*.patch; do
+ msg "Applying $i"
+ patch -p1 < $i || return 1
+ done
+
+ ./configure --prefix=/usr \
+ --with-system-readline \
+ --disable-nls \
+ --disable-werror \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info
+ make || return 1
+ make DESTDIR="$pkgdir" install || return 1
+ rm -f "$pkgdir"/usr/share/info/dir
+ # those are provided by binutils
+ rm -rf "$pkgdir"/usr/include
+ rm -rf "$pkgdir"/usr/lib
+}
+
+md5sums="c9da266b884fb8fa54df786dfaadbc7a gdb-6.8.tar.bz2
+7d5bcb23ffbadb9ce6ac24f37003f619 50_all_gdb-pie-1.patch
+33992db76732d26c6d1a3703b52e2c94 50_all_gdb-pie-2.patch"
diff --git a/extra/gettext/APKBUILD b/extra/gettext/APKBUILD
new file mode 100644
index 00000000..958e1131
--- /dev/null
+++ b/extra/gettext/APKBUILD
@@ -0,0 +1,23 @@
+# Maintainer: Carlo Landmeter <clandmeter at gmail.com>
+pkgname=gettext
+pkgver=0.17
+pkgrel=0
+pkgdesc="GNU locale utilities"
+url="http://www.gnu.org/software/gettext/gettext.html"
+license='GPL'
+depends="libiconv expat ncurses"
+makedepends="libiconv-dev"
+source="ftp://ftp.mirror.nl/pub/mirror/gnu/gettext/gettext-0.17.tar.gz"
+subpackages="$pkgname-doc $pkgname-dev"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr \
+ --mandir=/usr/share/man
+ unset MAKEFLAGS
+ make || return 1
+ make DESTDIR="$pkgdir/" install
+}
+
+md5sums="58a2bc6d39c0ba57823034d55d65d606 gettext-0.17.tar.gz"
diff --git a/extra/glib/APKBUILD b/extra/glib/APKBUILD
new file mode 100644
index 00000000..b0d5aa4e
--- /dev/null
+++ b/extra/glib/APKBUILD
@@ -0,0 +1,22 @@
+# Maintainer: Carlo Landmeter <clandmeter at gmail.com>
+pkgname=glib
+pkgver=2.18.3
+pkgrel=0
+pkgdesc="Common C routines used by Gtk+ and other libs"
+url="http://www.gtk.org"
+license='GPL'
+depends="gettext libiconv"
+makedepends="gettext-dev libiconv-dev pkgconfig"
+source="http://ftp.gnome.org/pub/gnome/sources/glib/2.18/glib-2.18.3.tar.bz2"
+subpackages="$pkgname-doc $pkgname-dev"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr \
+ --mandir=/usr/share/man
+ make || return 1
+ make DESTDIR="$pkgdir/" install
+}
+
+md5sums="f13996a7bd57525d796a6593f26a7771 glib-2.18.3.tar.bz2"
diff --git a/extra/gnats/APKBUILD b/extra/gnats/APKBUILD
new file mode 100644
index 00000000..a0198633
--- /dev/null
+++ b/extra/gnats/APKBUILD
@@ -0,0 +1,32 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=gnats
+pkgver=4.1.0
+pkgrel=1
+pkgdesc="The GNU Bug Tracking System"
+url="http://www.gnu.org/software/gnats/"
+license="GPL-2"
+depends="uclibc postfix"
+makedepends="texinfo"
+install="gnats.install"
+source="http://ftp.gnu.org/pub/gnu/$pkgname/$pkgname-$pkgver.tar.gz
+ $install"
+subpackages="$pkgname-doc"
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ # make install needs gnats user
+ sudo sh $srcdir/$install pre_install || return 1
+
+ AWK=awk ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --sharedstatedir=/var/lib \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info
+
+ make || return 1
+ make DESTDIR="$pkgdir/" install
+ rm -f "$pkgdir"/gnats.el
+}
+
+md5sums="2add3df79336f2e193c8a9a513aefe22 gnats-4.1.0.tar.gz
+ab30988614f7bc89da1da07c01ea8ecb gnats.install"
diff --git a/extra/gnats/gnats.install b/extra/gnats/gnats.install
new file mode 100644
index 00000000..c0f21c88
--- /dev/null
+++ b/extra/gnats/gnats.install
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+case "$1" in
+ pre_install)
+ adduser -h /var/lib/gnatsdb -D gnats 2>/dev/null
+ ;;
+esac
+exit 0
diff --git a/extra/gnupg/APKBUILD b/extra/gnupg/APKBUILD
new file mode 100644
index 00000000..fa1387b7
--- /dev/null
+++ b/extra/gnupg/APKBUILD
@@ -0,0 +1,21 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=gnupg
+pkgver=2.0.10
+pkgrel=0
+pkgdesc="GNU Privacy Guard 2 - a PGP replacement tool"
+url="http://www.gnupg.org/"
+license="GPL"
+depends="curl zlib libksba libgcrypt libgpg-error pth pinentry libiconv"
+makedepends="curl-dev libassuan libksba-dev libgcrypt-dev libgpg-error-dev
+ pth-dev zlib-dev libiconv-dev"
+subpackages="$pkgname-doc"
+source="ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-$pkgver.tar.bz2"
+
+build () {
+ cd "$srcdir/$pkgname-$pkgver"
+ ./configure --prefix=/usr \
+ --disable-nls
+ make || return 1
+ make DESTDIR="$pkgdir" install
+}
+md5sums="1cb778dd555f87685a8fde2f7113725e gnupg-2.0.10.tar.bz2"
diff --git a/extra/groff/APKBUILD b/extra/groff/APKBUILD
new file mode 100644
index 00000000..3777167a
--- /dev/null
+++ b/extra/groff/APKBUILD
@@ -0,0 +1,22 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=groff
+pkgver=1.20.1
+pkgrel=0
+pkgdesc="GNU troff text-formatting system"
+url="http://www.gnu.org/software/groff/groff.html"
+license="GPL"
+depends="uclibc uclibc++"
+makedepends="perl texinfo uclibc++-dev"
+subpackages="$pkgname-doc"
+source="ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz"
+
+build () {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ export CXX=g++-uc
+ ./configure --prefix=/usr --without-x
+
+ make || return 1
+ make DESTDIR="$pkgdir" install
+}
+md5sums="48fa768dd6fdeb7968041dd5ae8e2b02 groff-1.20.1.tar.gz"
diff --git a/extra/gzip/APKBUILD b/extra/gzip/APKBUILD
new file mode 100644
index 00000000..acc55ebd
--- /dev/null
+++ b/extra/gzip/APKBUILD
@@ -0,0 +1,24 @@
+# Contributor: Leonardo Arena <rnalrd@gmail.com>
+pkgname=gzip
+pkgver=1.3.12
+pkgrel=0
+pkgdesc="A popular data compression program"
+subpackages="$pkgname-doc"
+arch=""
+url="http://www.gnu.org/software/gzip/"
+license="GPL2"
+depends="uclibc"
+makedepends=""
+install=
+source="http://ftp.gnu.org/gnu/gzip/gzip-1.3.12.tar.gz"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info
+ make || return 1
+ make DESTDIR=$pkgdir install
+}
+md5sums="b5bac2d21840ae077e0217bc5e4845b1 gzip-1.3.12.tar.gz"
diff --git a/extra/haserl/APKBUILD b/extra/haserl/APKBUILD
new file mode 100644
index 00000000..7df80584
--- /dev/null
+++ b/extra/haserl/APKBUILD
@@ -0,0 +1,21 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=haserl
+pkgver=0.9.25
+pkgrel=0
+pkgdesc="Html And Shell Embedded Report Language"
+url="http://haserl.sourceforge.net/"
+license="GPL-2"
+depends="lua uclibc"
+makedepends="lua-dev"
+source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz"
+subpackages="$pkgname-doc"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr --with-lua || return 1
+ make || return 1
+ make DESTDIR="$pkgdir/" install
+}
+
+md5sums="906c634a2af4ac3a4b656ef4e244c4cd haserl-0.9.25.tar.gz"
diff --git a/extra/htop/APKBUILD b/extra/htop/APKBUILD
new file mode 100644
index 00000000..a9adbea6
--- /dev/null
+++ b/extra/htop/APKBUILD
@@ -0,0 +1,21 @@
+# Maintainer:Carlo Landmeter
+pkgname=htop
+pkgver=0.8.1
+pkgrel=0
+pkgdesc="An interactive process viewer for Linux"
+url="http://htop.sourceforge.net"
+license='GPL'
+depends='ncurses uclibc'
+makedepends="ncurses-dev"
+source="http://surfnet.dl.sourceforge.net/sourceforge/htop/$pkgname-$pkgver.tar.gz"
+
+subpackages="$pkgname-doc"
+
+build() {
+ cd $startdir/src/$pkgname-$pkgver
+ ./configure --prefix=/usr --mandir=/usr/share/man
+ make || return 1
+ make prefix=$startdir/pkg/usr mandir=$startdir/pkg/usr/share/man install
+}
+
+md5sums='f0b259ca29175656de48bf0fa0a2e619 htop-0.8.1.tar.gz'
diff --git a/extra/ipsec-tools/APKBUILD b/extra/ipsec-tools/APKBUILD
new file mode 100644
index 00000000..f58b0658
--- /dev/null
+++ b/extra/ipsec-tools/APKBUILD
@@ -0,0 +1,40 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=ipsec-tools
+pkgver=0.8_alpha20090126
+_myver=0.8-alpha20090126
+pkgrel=0
+pkgdesc="User-space IPsec tools for various IPsec implementations"
+url="http://ipsec-tools.sourceforge.net/"
+license="BSD"
+depends="openssl uclibc"
+makedepends="openssl-dev"
+subpackages="$pkgname-doc $pkgname-dev"
+source="http://downloads.sourceforge.net/$pkgname/$pkgname-$_myver.tar.gz
+ racoon.initd
+ racoon.confd
+ "
+
+build() {
+ cd "$srcdir/$pkgname-$_myver"
+
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --localstatedir=/var/lib \
+ --with-kernel-headers=/usr/include \
+ --disable-security-context \
+ --enable-adminport \
+ --enable-dpd \
+ --enable-frag \
+ --enable-hybrid \
+ --enable-ipv6 \
+ --enable-natt
+ make || return 1
+ make DESTDIR="$pkgdir" install
+
+ install -D -m755 ../racoon.initd "$pkgdir"/etc/init.d/racoon
+ install -D -m644 ../racoon.confd "$pkgdir"/etc/conf.d/racoon
+}
+
+md5sums="0fc1cc3fd2a014d11e33400202ee09fc ipsec-tools-0.8-alpha20090126.tar.gz"
diff --git a/extra/ipsec-tools/racoon.confd b/extra/ipsec-tools/racoon.confd
new file mode 100644
index 00000000..66f8ed76
--- /dev/null
+++ b/extra/ipsec-tools/racoon.confd
@@ -0,0 +1,19 @@
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-firewall/ipsec-tools/files/racoon.conf.d,v 1.3 2004/07/14 23:29:57 agriffis Exp $
+
+# Config file for /etc/init.d/racoon
+
+# See the manual pages for racoon or run `racoon --help`
+# for valid command-line options
+
+RACOON_OPTS="-4"
+
+RACOON_CONF="/etc/racoon/racoon.conf"
+RACOON_PSK_FILE="/etc/racoon/psk.txt"
+SETKEY_CONF="/etc/ipsec.conf"
+
+# Comment or remove the following if you don't want the policy tables
+# to be flushed when racoon is stopped.
+
+RACOON_RESET_TABLES="true"
diff --git a/extra/ipsec-tools/racoon.initd b/extra/ipsec-tools/racoon.initd
new file mode 100644
index 00000000..16fdec7e
--- /dev/null
+++ b/extra/ipsec-tools/racoon.initd
@@ -0,0 +1,58 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ before netmount
+ use net
+}
+
+checkconfig() {
+ if [ ! -e ${SETKEY_CONF} ] ; then
+ eerror "You need to configure setkey before starting racoon."
+ return 1
+ fi
+ if [ ! -e ${RACOON_CONF} ] ; then
+ eerror "You need a configuration file to start racoon."
+ return 1
+ fi
+ if [ ! -z ${RACOON_PSK_FILE} ] ; then
+ if [ ! -f ${RACOON_PSK_FILE} ] ; then
+ eerror "PSK file not found as specified."
+ eerror "Set RACOON_PSK_FILE in /etc/conf.d/racoon."
+ return 1
+ fi
+ case "`ls -Lldn ${RACOON_PSK_FILE}`" in
+ -r--------*)
+ ;;
+ *)
+ eerror "Your defined PSK file should be mode 400 for security!"
+ return 1
+ ;;
+ esac
+ fi
+}
+
+start() {
+ checkconfig || return 1
+ einfo "Loading ipsec policies from ${SETKEY_CONF}."
+ /usr/sbin/setkey -f ${SETKEY_CONF}
+ if [ $? -eq 1 ] ; then
+ eerror "Error while loading ipsec policies"
+ fi
+ ebegin "Starting racoon"
+ start-stop-daemon -S -x /usr/sbin/racoon -- -f ${RACOON_CONF} ${RACOON_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping racoon"
+ start-stop-daemon -K -p /var/run/racoon.pid
+ eend $?
+ if [ -n "${RACOON_RESET_TABLES}" ]; then
+ ebegin "Flushing policy entries"
+ /usr/sbin/setkey -F
+ /usr/sbin/setkey -FP
+ eend $?
+ fi
+}
diff --git a/extra/irssi-svn/APKBUILD b/extra/irssi-svn/APKBUILD
new file mode 100644
index 00000000..301c8832
--- /dev/null
+++ b/extra/irssi-svn/APKBUILD
@@ -0,0 +1,33 @@
+# Maintainer: Carlo Landmeter <clandmeter at gmail.com>
+pkgname=irssi-svn
+pkgver=20090104
+pkgrel=0
+pkgdesc="A modular textUI IRC client with IPv6 support"
+url="http://irssi.org"
+license='GPL'
+depends="glib ncurses openssl"
+makedepends="glib-dev openssl-dev ncurses-dev"
+source="http://www.irssi.org/files/snapshots/irssi-20090104.tar.gz"
+subpackages="$pkgname-doc $pkgname-dev $pkgname-perl"
+
+build() {
+ cd "$srcdir"/irssi-0.8.13-svn
+
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --with-perl=module
+ make || return 1
+ make DESTDIR="$pkgdir/" install
+
+}
+
+perl() {
+ depends="$pkgname perl"
+ mkdir -p "$subpkgdir"/usr
+ mv "$pkgdir"/usr/lib "$subpkgdir"/usr/
+ mkdir -p "$subpkgdir"/usr/share/irssi
+ mv "$pkgdir"/usr/share/irssi/scripts "$subpkgdir"/usr/share/irssi/
+}
+
+md5sums="27dcecc11b971d428e5783b4088e1c49 irssi-20090104.tar.gz"
diff --git a/extra/irssi/APKBUILD b/extra/irssi/APKBUILD
new file mode 100644
index 00000000..eb12e945
--- /dev/null
+++ b/extra/irssi/APKBUILD
@@ -0,0 +1,24 @@
+# Maintainer: Carlo Landmeter <clandmeter at gmail.com>
+pkgname=irssi
+pkgver=0.8.12
+pkgrel=0
+pkgdesc="A modular textUI IRC client with IPv6 support"
+url="http://irssi.org/"
+license='GPL'
+depends="glib ncurses openssl"
+makedepends="glib-dev openssl-dev ncurses-dev"
+source="http://irssi.org/files/irssi-0.8.12.tar.bz2"
+subpackages="$pkgname-doc"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --with-perl=no
+ make || return 1
+ make DESTDIR="$pkgdir/" install
+}
+
+md5sums="e407b557b3cfc7c91ce4de2571dd79cb irssi-0.8.12.tar.bz2"
diff --git a/extra/json4lua/APKBUILD b/extra/json4lua/APKBUILD
new file mode 100644
index 00000000..bceb0ca8
--- /dev/null
+++ b/extra/json4lua/APKBUILD
@@ -0,0 +1,15 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=json4lua
+pkgver=0.9.20
+pkgrel=0
+pkgdesc="JSON encoding / decoding module for Lua"
+url="http://json.luaforge.net/"
+license="GPL-2"
+depends="lua"
+source="http://luaforge.net/frs/download.php/1375/JSON4Lua-$pkgver.zip"
+
+build() {
+ install -D "$srcdir"/json/json.lua "$pkgdir"/usr/share/lua/5.1/json.lua
+}
+
+md5sums="0a2071a24d7752f52d5cc9cac8800743 JSON4Lua-0.9.20.zip"
diff --git a/extra/libassuan/APKBUILD b/extra/libassuan/APKBUILD
new file mode 100644
index 00000000..2b2498c4
--- /dev/null
+++ b/extra/libassuan/APKBUILD
@@ -0,0 +1,18 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=libassuan
+pkgver=1.0.5
+pkgrel=0
+pkgdesc="Libassuan is the IPC library used by some GnuPG related software"
+url="ftp://ftp.gnupg.org/gcrypt/libgcrypt"
+license="GPL"
+makedepends="pth-dev"
+subpackages="$pkgname-doc"
+source="ftp://ftp.gnupg.org/gcrypt/$pkgname/$pkgname-$pkgver.tar.bz2"
+
+build () {
+ cd "$srcdir"/$pkgname-$pkgver
+ ./configure --prefix=/usr
+ make || return 1
+ make DESTDIR="$pkgdir" install
+}
+md5sums="c2db0974fcce4401f48f3fa41c4edc5a libassuan-1.0.5.tar.bz2"
diff --git a/extra/libcap/APKBUILD b/extra/libcap/APKBUILD
new file mode 100644
index 00000000..36c09984
--- /dev/null
+++ b/extra/libcap/APKBUILD
@@ -0,0 +1,18 @@
+pkgname=libcap
+pkgver=2.16
+pkgrel=1
+pkgdesc="POSIX 1003.1e capabilities"
+license="GPL"
+url="http://www.friedhoff.org/posixfilecaps.html"
+depends="uclibc"
+makedepends=""
+source="http://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/$pkgname-$pkgver.tar.gz
+ "
+subpackages="$pkgname-doc $pkgname-dev"
+
+build ()
+{
+ cd "$srcdir/$pkgname-$pkgver"
+ make lib=/lib prefix=/usr LIBATTR=no DESTDIR="$pkgdir" install
+}
+md5sums="9e075fda242c4070ba76407064c13302 libcap-2.16.tar.gz"
diff --git a/extra/libconfig/APKBUILD b/extra/libconfig/APKBUILD
new file mode 100644
index 00000000..cf1d05a9
--- /dev/null
+++ b/extra/libconfig/APKBUILD
@@ -0,0 +1,22 @@
+pkgname=libconfig
+pkgver=1.3.1
+pkgrel=0
+pkgdesc="a simple library for manipulating structured configuration files"
+url="http://www.hyperrealm.com/libconfig/"
+license='LGPL'
+depends="uclibc"
+source="http://www.hyperrealm.com/$pkgname/$pkgname-$pkgver.tar.gz"
+subpackages="$pkgname-doc $pkgname-dev"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr \
+ --mandir=/usr/share/man \
+ --disable-cxx
+ make || return 1
+ make DESTDIR="$pkgdir/" install
+}
+
+md5sums="" #generate with 'abuild checksum'
+md5sums="f02bfa27a21b3040089026975b9dc0b8 libconfig-1.3.1.tar.gz"
diff --git a/extra/libgcrypt/APKBUILD b/extra/libgcrypt/APKBUILD
new file mode 100644
index 00000000..53368d13
--- /dev/null
+++ b/extra/libgcrypt/APKBUILD
@@ -0,0 +1,29 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=libgcrypt
+pkgver=1.4.3
+pkgrel=0
+pkgdesc="general purpose crypto library based on the code used in GnuPG"
+url="http://www.gnupg.org"
+license="LGPL"
+depends="libgpg-error"
+makedepends="libgpg-error-dev texinfo"
+subpackages="$pkgname-dev $pkgname-doc"
+source="ftp://ftp.franken.de/pub/crypt/mirror/ftp.gnupg.org/gcrypt/$pkgname/$pkgname-$pkgver.tar.bz2
+ nocxx.patch"
+
+build () {
+ cd "$srcdir"/$pkgname-$pkgver
+
+ msg "Punting useless cpp checks..."
+ patch configure < "$srcdir"/nocxx.patch || return 1
+
+ ./configure --prefix=/usr \
+ --disable-padlock-support \
+ --disable-static
+
+ make || return 1
+ make -j1 DESTDIR="$pkgdir" install || return 1
+ rm -f ${pkgdir}/usr/share/info/dir
+}
+md5sums="46e50e811ed51f1e0e8dd677dded967d libgcrypt-1.4.3.tar.bz2
+28513788ba4d556ccd538867dc6205ab nocxx.patch"
diff --git a/extra/libgcrypt/nocxx.patch b/extra/libgcrypt/nocxx.patch
new file mode 100644
index 00000000..beb1ab90
--- /dev/null
+++ b/extra/libgcrypt/nocxx.patch
@@ -0,0 +1,15 @@
+--- a/configure 2004-12-07 21:34:23.205172545 +0000
++++ b/configure 2004-12-07 21:37:17.726654782 +0000
+@@ -5148,10 +5148,8 @@
+ :
+ else
+ { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+-See \`config.log' for more details." >&5
+-echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+-See \`config.log' for more details." >&2;}
+- { (exit 1); exit 1; }; }
++See \`config.log' for more details." >&5;}
++ { echo "C++ sucks, ignoring ..." >&5; }; }
+ fi
+
+ ac_ext=cc
diff --git a/extra/libgpg-error/APKBUILD b/extra/libgpg-error/APKBUILD
new file mode 100644
index 00000000..a51b0d3f
--- /dev/null
+++ b/extra/libgpg-error/APKBUILD
@@ -0,0 +1,32 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=libgpg-error
+pkgver=1.6
+pkgrel=0
+pkgdesc="Support library for libgcrypt"
+url="http://www.gnupg.org"
+license="LGPL"
+depends="uclibc"
+subpackages="$pkgname-dev $pkgname-lisp"
+source="ftp://ftp.franken.de/pub/crypt/mirror/ftp.gnupg.org/gcrypt/$pkgname/$pkgname-$pkgver.tar.bz2
+ nocxx.patch
+ "
+
+build () {
+ cd "$srcdir"/$pkgname-$pkgver
+ msg "Punting useless check for cpp..."
+ patch configure < ../nocxx.patch || return 1
+
+ ./configure --prefix=/usr \
+ --disable-nls
+
+ make || return 1
+ make -j1 DESTDIR="$pkgdir" install
+}
+
+lisp() {
+ mkdir -p "$subpkgdir"/usr/
+ mv "$pkgdir"/usr/share "$subpkgdir"/usr/share/
+}
+
+md5sums="f3e9870e213518b407a959f8d29cd554 libgpg-error-1.6.tar.bz2
+28513788ba4d556ccd538867dc6205ab nocxx.patch"
diff --git a/extra/libgpg-error/nocxx.patch b/extra/libgpg-error/nocxx.patch
new file mode 100644
index 00000000..beb1ab90
--- /dev/null
+++ b/extra/libgpg-error/nocxx.patch
@@ -0,0 +1,15 @@
+--- a/configure 2004-12-07 21:34:23.205172545 +0000
++++ b/configure 2004-12-07 21:37:17.726654782 +0000
+@@ -5148,10 +5148,8 @@
+ :
+ else
+ { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+-See \`config.log' for more details." >&5
+-echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+-See \`config.log' for more details." >&2;}
+- { (exit 1); exit 1; }; }
++See \`config.log' for more details." >&5;}
++ { echo "C++ sucks, ignoring ..." >&5; }; }
+ fi
+
+ ac_ext=cc
diff --git a/extra/libiconv/APKBUILD b/extra/libiconv/APKBUILD
new file mode 100644
index 00000000..6cd441ca
--- /dev/null
+++ b/extra/libiconv/APKBUILD
@@ -0,0 +1,21 @@
+# Maintainer: Carlo Landmeter <clandmeter at gmail.com>
+pkgname=libiconv
+pkgver=1.12
+pkgrel=0
+pkgdesc="GNU charset conversion library for libc which doesn't implement it"
+url="http://www.gnu.org/software/libiconv"
+license='LGPL'
+depends="uclibc"
+source="http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.12.tar.gz"
+subpackages="$pkgname-doc $pkgname-dev"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr \
+ --mandir=/usr/share/man
+ make || return 1
+ make DESTDIR="$pkgdir/" install
+}
+
+md5sums="c2be282595751535a618ae0edeb8f648 libiconv-1.12.tar.gz"
diff --git a/extra/libjpeg/APKBUILD b/extra/libjpeg/APKBUILD
new file mode 100644
index 00000000..54545ff0
--- /dev/null
+++ b/extra/libjpeg/APKBUILD
@@ -0,0 +1,35 @@
+# Contributor: Carlo Landmeter <clandmeter at gmail>
+# Maintainer: Carlo Landmeter <clandmeter at gmail>
+pkgname=libjpeg
+pkgver=6b
+pkgrel=1
+pkgdesc="Library of JPEG support functions"
+url="http://www.ijg.org/"
+license="custom"
+depends=""
+makedepends="libtool"
+install=
+subpackages="$pkgname-doc $pkgname-dev"
+source="ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v${pkgver}.tar.gz"
+
+build() {
+ cd "$srcdir/jpeg-$pkgver"
+
+ cp /usr/share/libtool/config/config.guess ./
+ cp /usr/share/libtool/config/config.sub ./
+ sed -i "s|./libtool|libtool|" configure
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --enable-shared \
+ --enable-static
+ make || return 1
+ for i in bin lib include share/man/man1; do
+ mkdir -p "$pkgdir"/usr/"$i"
+ done
+ make prefix="$pkgdir"/usr mandir="$pkgdir"/usr/share/man/man1 install
+ install -Dm644 jpegint.h "$pkgdir"/usr/include/jpegint.h
+}
+
+md5sums="dbd5f3b47ed13132f04c685d608a7547 jpegsrc.v6b.tar.gz"
diff --git a/extra/libksba/APKBUILD b/extra/libksba/APKBUILD
new file mode 100644
index 00000000..47049370
--- /dev/null
+++ b/extra/libksba/APKBUILD
@@ -0,0 +1,20 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=libksba
+pkgver=1.0.3
+pkgrel=0
+pkgdesc="Libksba is a CMS and X.509 access library"
+url="ftp://ftp.gnupg.org/gcrypt/alpha/libksba"
+license="GPL"
+depends="libgpg-error uclibc"
+makedepends="libgpg-error-dev"
+subpackages="$pkgname-dev $pkgname-doc"
+source="ftp://ftp.gnupg.org/gcrypt/$pkgname/$pkgname-$pkgver.tar.bz2"
+
+build () {
+ cd "$srcdir"/$pkgname-$pkgver
+
+ ./configure --prefix=/usr
+ make || return 1
+ make DESTDIR=$startdir/pkg install
+}
+md5sums="91682491186d4ed43fff351aab2f5aad libksba-1.0.3.tar.bz2"
diff --git a/extra/libmcrypt/APKBUILD b/extra/libmcrypt/APKBUILD
new file mode 100644
index 00000000..905d880f
--- /dev/null
+++ b/extra/libmcrypt/APKBUILD
@@ -0,0 +1,24 @@
+# Contributor: Carlo Landmeter <clandmeter at gmail>
+# Maintainer: Carlo Landmeter <clandmeter at gmail>
+pkgname=libmcrypt
+pkgver=2.5.8
+pkgrel=0
+pkgdesc="A library which provides a uniform interface to several symmetric encryption algorithms"
+url="http://mcrypt.sourceforge.net/"
+license="GPL"
+depends="uclibc"
+makedepends="libtool uclibc++-dev"
+install=
+subpackages="$pkgname-doc $pkgname-dev"
+source="http://downloads.sourceforge.net/mcrypt/${pkgname}-${pkgver}.tar.bz2"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr \
+ --mandir=/usr/share/man
+ make || return 1
+ make DESTDIR="$pkgdir" install
+}
+
+md5sums="c4f491dd411a09e9de3b8702ea6f73eb libmcrypt-2.5.8.tar.bz2"
diff --git a/extra/libnet/APKBUILD b/extra/libnet/APKBUILD
new file mode 100644
index 00000000..e756acc0
--- /dev/null
+++ b/extra/libnet/APKBUILD
@@ -0,0 +1,36 @@
+# Contributor: Mika Havela <mika.havela@gmail.com>
+# Maintainer: Your Name <youremail@domain.com>
+pkgname=libnet
+pkgver=1.1.2.1
+pkgrel=0
+pkgdesc="A generic networking API that provides access to several protocols."
+url="http://www.packetfactory.net/libnet/"
+license="BSD"
+depends="uclibc"
+makedepends="autoconf automake libtool"
+subpackages="$pkgname-dev"
+source="http://www.packetfactory.net/libnet/dist/$pkgname-$pkgver.tar.gz
+ libnet-1.1.2.1-autotools.patch
+ libnet-1.1.2.1-fix-chksum.patch
+ "
+
+build() {
+ local i
+ cd "$srcdir/$pkgname"
+ for i in ../*.patch; do
+ msg "Applyting $i"
+ patch -p1 < $i || return 1
+ done
+
+ aclocal
+ libtoolize --force || return 1
+ autoconf && automake || return 1
+
+ ./configure --prefix=/usr
+ make || return 1
+ make DESTDIR="$pkgdir" install
+}
+
+md5sums="be845c41170d72c7db524f3411b50256 libnet-1.1.2.1.tar.gz
+7e928170600bea8ed4a0d079b83c80ac libnet-1.1.2.1-autotools.patch
+668189bf87cda8daeaf250146bd88331 libnet-1.1.2.1-fix-chksum.patch"
diff --git a/extra/libnet/libnet-1.1.2.1-autotools.patch b/extra/libnet/libnet-1.1.2.1-autotools.patch
new file mode 100644
index 00000000..0f4c6509
--- /dev/null
+++ b/extra/libnet/libnet-1.1.2.1-autotools.patch
@@ -0,0 +1,79 @@
+Patch ripped from Debian. Add support for building a shared
+libnet library (for PIC loving). Also fixes typo for installing
+the libnet-config script.
+
+http://bugs.gentoo.org/show_bug.cgi?id=82926
+
+--- libnet-1.1.2.1.orig/src/Makefile.am
++++ libnet-1.1.2.1/src/Makefile.am
+@@ -8,9 +8,9 @@
+
+ include $(top_srcdir)/Makefile.am.common
+
+-lib_LIBRARIES = libnet.a
++lib_LTLIBRARIES = libnet.la
+
+-libnet_a_SOURCES = libnet_asn1.c \
++libnet_la_SOURCES = libnet_asn1.c \
+ libnet_build_802.1q.c \
+ libnet_build_802.1x.c \
+ libnet_build_802.2.c \
+@@ -57,15 +57,20 @@
+ libnet_version.c \
+ libnet_write.c
+
+-EXTRA_libnet_a_SOURCES = libnet_link_bpf.c \
+- libnet_link_dlpi.c \
+- libnet_link_linux.c \
+- libnet_link_nit.c \
+- libnet_link_none.c \
+- libnet_link_pf.c \
+- libnet_link_snit.c \
+- libnet_link_snoop.c \
+- libnet_link_win32.c
+-
+-libnet_a_LIBADD = @LIBOBJS@
++libnet_la_LIBADD = @LTLIBOBJS@
+
++# Here are a set of rules to help you update your library version
++# information:
++#
++# 1. If the library source code has changed at all since the last
++# update, then increment REVISION (`C:R:A' becomes `C:r+1:A').
++#
++# 2. If any interfaces have been added, removed, or changed since the
++# last update, increment CURRENT, and set REVISION to 0.
++#
++# 3. If any interfaces have been added since the last public release,
++# then increment AGE.
++#
++# 4. If any interfaces have been removed since the last public release,
++# then set AGE to 0.
++libnet_la_LDFLAGS = -version-info 4:0:3 # CURRENT[:REVISION[:AGE]]
+--- libnet-1.1.2.1.orig/configure.in
++++ libnet-1.1.2.1/configure.in
+@@ -21,7 +21,7 @@
+ dnl
+ AC_PROG_CC
+ AC_PROG_INSTALL
+-AC_PROG_RANLIB
++AC_PROG_LIBTOOL
+
+ AC_CHECK_HEADERS(sys/sockio.h)
+
+--- libnet-1.1.2.1.orig/Makefile.am
++++ libnet-1.1.2.1/Makefile.am
+@@ -12,4 +12,4 @@
+
+ EXTRA_DIST = Makefile.am.common
+
+-bin_scripts = libnet-config
++bin_SCRIPTS = libnet-config
+--- libnet-1.1.2.1.orig/sample/Makefile.am
++++ libnet-1.1.2.1/sample/Makefile.am
+@@ -60,4 +60,4 @@
+ ip_link_SOURCES = ip_link.c
+ sebek_SOURCES = sebek.c
+
+-LDADD = $(top_srcdir)/src/libnet.a
++LDADD = $(top_srcdir)/src/libnet.la
diff --git a/extra/libnet/libnet-1.1.2.1-fix-chksum.patch b/extra/libnet/libnet-1.1.2.1-fix-chksum.patch
new file mode 100644
index 00000000..e6f9bbc6
--- /dev/null
+++ b/extra/libnet/libnet-1.1.2.1-fix-chksum.patch
@@ -0,0 +1,27 @@
+Fix a bug in chksum calculation for odd sized UDP packets.
+
+http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=284729
+
+--- libnet-1.1.2.1/src/libnet_checksum.c
++++ libnet-1.1.2.1/src/libnet_checksum.c
+@@ -42,8 +42,10 @@
+ libnet_in_cksum(u_int16_t *addr, int len)
+ {
+ int sum;
++ u_int16_t last_byte;
+
+ sum = 0;
++ last_byte = 0;
+
+ while (len > 1)
+ {
+@@ -52,7 +54,8 @@
+ }
+ if (len == 1)
+ {
+- sum += *(u_int16_t *)addr;
++ *(u_int8_t*)&last_byte = *(u_int8_t*)addr;
++ sum += last_byte;
+ }
+
+ return (sum);
diff --git a/extra/libogg/APKBUILD b/extra/libogg/APKBUILD
new file mode 100644
index 00000000..d7920f88
--- /dev/null
+++ b/extra/libogg/APKBUILD
@@ -0,0 +1,27 @@
+# Contributor: Mika Havela <mika.havela@gmail.com>
+pkgname=libogg
+pkgver=1.1.3
+pkgrel=0
+pkgdesc="Ogg bitstream and framing library"
+url="http://xiph.org/ogg/"
+license="as-is"
+depends="uclibc"
+subpackages="$pkgname-doc $pkgname-dev"
+source="http://downloads.xiph.org/releases/ogg/$pkgname-$pkgver.tar.gz
+ nocxx.patch
+ "
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ msg "Punting useless CXX check..."
+ patch -p1 < "$srcdir"/nocxx.patch || return 1
+
+ ./configure --prefix=/usr
+ make || return 1
+ make -j1 DESTDIR="$pkgdir" install
+
+ install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
+}
+
+md5sums="eaf7dc6ebbff30975de7527a80831585 libogg-1.1.3.tar.gz"
diff --git a/extra/libogg/nocxx.patch b/extra/libogg/nocxx.patch
new file mode 100644
index 00000000..beb1ab90
--- /dev/null
+++ b/extra/libogg/nocxx.patch
@@ -0,0 +1,15 @@
+--- a/configure 2004-12-07 21:34:23.205172545 +0000
++++ b/configure 2004-12-07 21:37:17.726654782 +0000
+@@ -5148,10 +5148,8 @@
+ :
+ else
+ { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+-See \`config.log' for more details." >&5
+-echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+-See \`config.log' for more details." >&2;}
+- { (exit 1); exit 1; }; }
++See \`config.log' for more details." >&5;}
++ { echo "C++ sucks, ignoring ..." >&5; }; }
+ fi
+
+ ac_ext=cc
diff --git a/extra/libpng/APKBUILD b/extra/libpng/APKBUILD
new file mode 100644
index 00000000..3667d4bb
--- /dev/null
+++ b/extra/libpng/APKBUILD
@@ -0,0 +1,25 @@
+# Contributor: Carlo Landmeter <clandmeter at gmail>
+# Maintainer: Carlo Landmeter <clandmeter at gmail>
+pkgname=libpng
+pkgver=1.2.34
+pkgrel=0
+pkgdesc="Portable Network Graphics library"
+url="http://www.libpng.org/"
+license="GPL"
+depends="zlib"
+makedepends="zlib-dev"
+subpackages="$pkgname-doc $pkgname-dev"
+source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz"
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info
+ make || return 1
+ make DESTDIR="$pkgdir" install
+ install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE || return 1
+}
+
+md5sums="6ca3e836887fa5f5f509c36e194f8c00 libpng-1.2.34.tar.gz"
diff --git a/extra/libxml2/APKBUILD b/extra/libxml2/APKBUILD
new file mode 100644
index 00000000..1b613c3c
--- /dev/null
+++ b/extra/libxml2/APKBUILD
@@ -0,0 +1,26 @@
+# Contributor: Carlo Landmeter <clandmeter at gmail>
+# Maintainer: Carlo Landmeter <clandmeter at gmail>
+pkgname=libxml2
+pkgver=2.7.2
+pkgrel=0
+pkgdesc="XML parsing library, version 2"
+url="http://www.xmlsoft.org/"
+license="MIT"
+depends="zlib"
+makedepends="zlib-dev"
+subpackages="$pkgname-doc $pkgname-dev"
+source="ftp://ftp.xmlsoft.org/${pkgname}/${pkgname}-${pkgver}.tar.gz"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info
+ make || return 1
+ make -j1 DESTDIR="$pkgdir" install
+ install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
+}
+
+md5sums="dc43ff7ae6aded45f578c87b7b0c8766 libxml2-2.7.2.tar.gz"
diff --git a/extra/lighttpd/APKBUILD b/extra/lighttpd/APKBUILD
new file mode 100644
index 00000000..29db9b69
--- /dev/null
+++ b/extra/lighttpd/APKBUILD
@@ -0,0 +1,79 @@
+pkgname=lighttpd
+pkgver=1.4.20
+pkgrel=2
+pkgdesc="a secure, fast, compliant and very flexible web-server"
+url="http://www.lighttpd.net/"
+license="custom"
+install="$pkgname.install"
+depends="pcre openssl zlib bzip2 lua"
+makedepends="flex pcre-dev openssl-dev zlib-dev bzip2-dev lua-dev pkgconfig"
+source="http://www.$pkgname.net/download/$pkgname-$pkgver.tar.bz2
+ $pkgname.initd
+ $pkgname.confd
+ $pkgname.install
+ $pkgname.logrotate
+ spawn-fcgi.confd
+ spawn-fcgi.initd
+ lighttpd.conf
+ mime-types.conf
+ mod_cgi.conf
+ mod_fastcgi.conf
+ "
+subpackages="$pkgname-dev $pkgname-doc"
+
+build() {
+ local i
+ cd $srcdir/$pkgname-$pkgver
+ ./configure --prefix=/usr \
+ --enable-lfs \
+ --libdir=/usr/lib/lighttpd \
+ --without-mysql \
+ --without-ldap \
+ --without-attr \
+ --without-kerberos5 \
+ --without-fam \
+ --without-webdav-props \
+ --without-webdav-locks \
+ --without-gdbm \
+ --without-memcache \
+ --with-bzip2 \
+ --with-openssl \
+ --with-lua || return 1
+
+ make || return 1
+ make DESTDIR="$pkgdir" install || return 1
+
+ # create dirs
+ install -d -m755 "$pkgdir"/var/run/lighttpd/ \
+ "$pkgdir"/var/log/lighttpd/ \
+ "$pkgdir"/etc/lighttpd/ \
+ "$pkgdir"/var/www/localhost/htdocs
+
+ # lighttpd
+ install -D -m755 "$srcdir"/lighttpd.initd "$pkgdir"/etc/init.d/lighttpd
+ install -D -m644 "$srcdir"/lighttpd.confd "$pkgdir"/etc/conf.d/lighttpd
+ install -D -m644 "$srcdir"/lighttpd.logrotate \
+ "$pkgdir"/etc/logrotate.d/lighttpd
+
+ # spawn-fcgi
+ install -D -m755 "$srcdir"/spawn-fcgi.initd \
+ "$pkgdir"/etc/init.d/spawn-fcgi
+ install -D -m644 "$srcdir"/spawn-fcgi.confd \
+ "$pkgdir"/etc/conf.d/spawn-fcgi
+
+ # config files
+ for i in lighttpd.conf mime-types.conf mod_cgi.conf mod_fastcgi.conf; do
+ install -m644 "$srcdir"/$i "$pkgdir"/etc/lighttpd/$i
+ done
+}
+md5sums="ed6ee0bb714f393219a32768d86984d8 lighttpd-1.4.20.tar.bz2
+6910842e8ba496e8aa984ab30a46eb72 lighttpd.initd
+0dede109282bfe685bdec6b35f0e4b6b lighttpd.confd
+9b1aa3c58f50afee7c03b414c28de6f6 lighttpd.install
+ad091c9157134890499f26d170352c9f lighttpd.logrotate
+1d925aed297ec4541fb230dd19e11bc1 spawn-fcgi.confd
+78bc6ceac57ecaa47abf4d5df857fe57 spawn-fcgi.initd
+df5b2360ea380d988bf16905ab214286 lighttpd.conf
+fef397e7bcf1b741dea211a555e1803c mime-types.conf
+9c1407e95f62ed22da66c4ef5f69c3b5 mod_cgi.conf
+f3363e39832f1b6678468b482d121afb mod_fastcgi.conf"
diff --git a/extra/lighttpd/lighttpd.conf b/extra/lighttpd/lighttpd.conf
new file mode 100644
index 00000000..778a4062
--- /dev/null
+++ b/extra/lighttpd/lighttpd.conf
@@ -0,0 +1,321 @@
+###############################################################################
+# Default lighttpd.conf for Gentoo.
+# $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/conf/lighttpd.conf,v 1.3 2005/09/01 14:22:35 ka0ttic Exp $
+###############################################################################
+
+# {{{ variables
+var.basedir = "/var/www/localhost"
+var.logdir = "/var/log/lighttpd"
+var.statedir = "/var/lib/lighttpd"
+# }}}
+
+# {{{ modules
+# At the very least, mod_access and mod_accesslog should be enabled.
+# All other modules should only be loaded if necessary.
+# NOTE: the order of modules is important.
+server.modules = (
+# "mod_rewrite",
+# "mod_redirect",
+# "mod_alias",
+ "mod_access",
+# "mod_cml",
+# "mod_trigger_b4_dl",
+# "mod_auth",
+# "mod_status",
+# "mod_setenv",
+# "mod_proxy",
+# "mod_simple_vhost",
+# "mod_evhost",
+# "mod_userdir",
+# "mod_compress",
+# "mod_ssi",
+# "mod_usertrack",
+# "mod_expire",
+# "mod_secdownload",
+# "mod_rrdtool",
+# "mod_webdav",
+ "mod_accesslog"
+)
+# }}}
+
+# {{{ includes
+include "mime-types.conf"
+# uncomment for cgi support
+# include "mod_cgi.conf"
+# uncomment for php/fastcgi support
+# include "mod_fastcgi.conf"
+# }}}
+
+# {{{ server settings
+server.username = "lighttpd"
+server.groupname = "lighttpd"
+
+server.document-root = var.basedir + "/htdocs"
+server.pid-file = "/var/run/lighttpd.pid"
+
+server.errorlog = var.logdir + "/error.log"
+# log errors to syslog instead
+# server.errorlog-use-syslog = "enable"
+
+server.indexfiles = ("index.php", "index.html",
+ "index.htm", "default.htm")
+
+# server.tag = "lighttpd"
+
+server.follow-symlink = "enable"
+
+# event handler (defaults to "poll")
+# see performance.txt
+#
+# for >= linux-2.4
+# server.event-handler = "linux-rtsig"
+# for >= linux-2.6
+# server.event-handler = "linux-sysepoll"
+# for FreeBSD
+# server.event-handler = "freebsd-kqueue"
+
+# chroot to directory (defaults to no chroot)
+# server.chroot = "/"
+
+# bind to port (defaults to 80)
+# server.port = 81
+
+# bind to name (defaults to all interfaces)
+# server.bind = "grisu.home.kneschke.de"
+
+# error-handler for status 404
+# server.error-handler-404 = "/error-handler.html"
+# server.error-handler-404 = "/error-handler.php"
+
+# Format: <errorfile-prefix><status-code>.html
+# -> ..../status-404.html for 'File not found'
+# server.errorfile-prefix = var.basedir + "/error/status-"
+
+# FAM support for caching stat() calls
+# requires that lighttpd be built with USE=fam
+# server.stat-cache-engine = "fam"
+# }}}
+
+# {{{ mod_staticfile
+
+# which extensions should not be handled via static-file transfer
+# (extensions that are usually handled by mod_cgi, mod_fastcgi, etc).
+static-file.exclude-extensions = (".php", ".pl", ".cgi", ".fcgi")
+# }}}
+
+# {{{ mod_accesslog
+accesslog.filename = var.logdir + "/access.log"
+# }}}
+
+# {{{ mod_dirlisting
+# enable directory listings
+# dir-listing.activate = "enable"
+#
+# don't list hidden files/directories
+# dir-listing.hide-dotfiles = "enable"
+#
+# use a different css for directory listings
+# dir-listing.external-css = "/path/to/dir-listing.css"
+#
+# list of regular expressions. files that match any of the
+# specified regular expressions will be excluded from directory
+# listings.
+# dir-listing.exclude = ("^\.", "~$")
+# }}}
+
+# {{{ mod_access
+# see access.txt
+
+url.access-deny = ("~", ".inc")
+# }}}
+
+# {{{ mod_userdir
+# see userdir.txt
+#
+# userdir.path = "public_html"
+# userdir.exclude-user = ("root")
+# }}}
+
+# {{{ mod_ssi
+# see ssi.txt
+#
+# ssi.extension = (".shtml")
+# }}}
+
+# {{{ mod_ssl
+# see ssl.txt
+#
+# ssl.engine = "enable"
+# ssl.pemfile = "server.pem"
+# }}}
+
+# {{{ mod_status
+# see status.txt
+#
+# status.status-url = "/server-status"
+# status.config-url = "/server-config"
+# }}}
+
+# {{{ mod_simple_vhost
+# see simple-vhost.txt
+#
+# If you want name-based virtual hosting add the next three settings and load
+# mod_simple_vhost
+#
+# document-root =
+# virtual-server-root + virtual-server-default-host + virtual-server-docroot
+# or
+# virtual-server-root + http-host + virtual-server-docroot
+#
+# simple-vhost.server-root = "/home/weigon/wwwroot/servers/"
+# simple-vhost.default-host = "grisu.home.kneschke.de"
+# simple-vhost.document-root = "/pages/"
+# }}}
+
+# {{{ mod_compress
+# see compress.txt
+#
+# compress.cache-dir = var.statedir + "/cache/compress"
+# compress.filetype = ("text/plain", "text/html")
+# }}}
+
+# {{{ mod_proxy
+# see proxy.txt
+#
+# proxy.server = ( ".php" =>
+# ( "localhost" =>
+# (
+# "host" => "192.168.0.101",
+# "port" => 80
+# )
+# )
+# )
+# }}}
+
+# {{{ mod_auth
+# see authentication.txt
+#
+# auth.backend = "plain"
+# auth.backend.plain.userfile = "lighttpd.user"
+# auth.backend.plain.groupfile = "lighttpd.group"
+
+# auth.backend.ldap.hostname = "localhost"
+# auth.backend.ldap.base-dn = "dc=my-domain,dc=com"
+# auth.backend.ldap.filter = "(uid=$)"
+
+# auth.require = ( "/server-status" =>
+# (
+# "method" => "digest",
+# "realm" => "download archiv",
+# "require" => "user=jan"
+# ),
+# "/server-info" =>
+# (
+# "method" => "digest",
+# "realm" => "download archiv",
+# "require" => "valid-user"
+# )
+# )
+# }}}
+
+# {{{ mod_rewrite
+# see rewrite.txt
+#
+# url.rewrite = (
+# "^/$" => "/server-status"
+# )
+# }}}
+
+# {{{ mod_redirect
+# see redirect.txt
+#
+# url.redirect = (
+# "^/wishlist/(.+)" => "http://www.123.org/$1"
+# )
+# }}}
+
+# {{{ mod_evhost
+# define a pattern for the host url finding
+# %% => % sign
+# %0 => domain name + tld
+# %1 => tld
+# %2 => domain name without tld
+# %3 => subdomain 1 name
+# %4 => subdomain 2 name
+#
+# evhost.path-pattern = "/home/storage/dev/www/%3/htdocs/"
+# }}}
+
+# {{{ mod_expire
+# expire.url = (
+# "/buggy/" => "access 2 hours",
+# "/asdhas/" => "access plus 1 seconds 2 minutes"
+# )
+# }}}
+
+# {{{ mod_rrdtool
+# see rrdtool.txt
+#
+# rrdtool.binary = "/usr/bin/rrdtool"
+# rrdtool.db-name = var.statedir + "/lighttpd.rrd"
+# }}}
+
+# {{{ mod_setenv
+# see setenv.txt
+#
+# setenv.add-request-header = ( "TRAV_ENV" => "mysql://user@host/db" )
+# setenv.add-response-header = ( "X-Secret-Message" => "42" )
+# }}}
+
+# {{{ mod_trigger_b4_dl
+# see trigger_b4_dl.txt
+#
+# trigger-before-download.gdbm-filename = "/home/weigon/testbase/trigger.db"
+# trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
+# trigger-before-download.trigger-url = "^/trigger/"
+# trigger-before-download.download-url = "^/download/"
+# trigger-before-download.deny-url = "http://127.0.0.1/index.html"
+# trigger-before-download.trigger-timeout = 10
+# }}}
+
+# {{{ mod_cml
+# see cml.txt
+#
+# don't forget to add index.cml to server.indexfiles
+# cml.extension = ".cml"
+# cml.memcache-hosts = ( "127.0.0.1:11211" )
+# }}}
+
+# {{{ mod_webdav
+# see webdav.txt
+#
+# $HTTP["url"] =~ "^/dav($|/)" {
+# webdav.activate = "enable"
+# webdav.is-readonly = "enable"
+# }
+# }}}
+
+# {{{ extra rules
+#
+# set Content-Encoding and reset Content-Type for browsers that
+# support decompressing on-thy-fly (requires mod_setenv)
+# $HTTP["url"] =~ "\.gz$" {
+# setenv.add-response-header = ("Content-Encoding" => "x-gzip")
+# mimetype.assign = (".gz" => "text/plain")
+# }
+
+# $HTTP["url"] =~ "\.bz2$" {
+# setenv.add-response-header = ("Content-Encoding" => "x-bzip2")
+# mimetype.assign = (".bz2" => "text/plain")
+# }
+#
+# }}}
+
+# {{{ debug
+# debug.log-request-header = "enable"
+# debug.log-response-header = "enable"
+# debug.log-request-handling = "enable"
+# debug.log-file-not-found = "enable"
+# }}}
+
+# vim: set ft=conf foldmethod=marker et :
diff --git a/extra/lighttpd/lighttpd.confd b/extra/lighttpd/lighttpd.confd
new file mode 100644
index 00000000..70d41705
--- /dev/null
+++ b/extra/lighttpd/lighttpd.confd
@@ -0,0 +1,12 @@
+# /etc/conf.d/lighttpd
+
+# Location of a shell used by the 'include_shell' directive
+# in the lighttpd's configuration file
+#export SHELL="/bin/bash"
+
+# Location of the lighttpd configuration file
+LIGHTTPD_CONF="/etc/lighttpd/lighttpd.conf"
+
+# Location of the lighttpd pid file
+LIGHTTPD_PID="/var/run/lighttpd.pid"
+
diff --git a/extra/lighttpd/lighttpd.initd b/extra/lighttpd/lighttpd.initd
new file mode 100644
index 00000000..80aaacc5
--- /dev/null
+++ b/extra/lighttpd/lighttpd.initd
@@ -0,0 +1,67 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/lighttpd.initd-1.4.13-r3,v 1.2 2007/10/12 20:54:46 swegener Exp $
+
+opts="reload graceful"
+
+depend() {
+ need net
+ use mysql logger spawn-fcgi ldap slapd
+ after famd
+ after sshd
+}
+
+checkconfig() {
+ if [ ! -f "${LIGHTTPD_CONF}" ] ; then
+ ewarn "${LIGHTTPD_CONF} does not exist."
+ return 1
+ fi
+
+ /usr/sbin/lighttpd -t -f ${LIGHTTPD_CONF} >/dev/null
+}
+
+start() {
+ checkconfig || return 1
+
+ ebegin "Starting lighttpd"
+ start-stop-daemon --start --quiet --exec /usr/sbin/lighttpd \
+ --pidfile "${LIGHTTPD_PID}" -- -f "${LIGHTTPD_CONF}"
+ eend $?
+}
+
+stop() {
+ local rv=0
+ ebegin "Stopping lighttpd"
+ start-stop-daemon --stop --quiet --pidfile "${LIGHTTPD_PID}"
+ eend $?
+}
+
+reload() {
+ if ! service_started "${SVCNAME}" ; then
+ eerror "${SVCNAME} isn't running"
+ return 1
+ fi
+ checkconfig || return 1
+
+ ebegin "Re-opening lighttpd log files"
+ start-stop-daemon --stop --oknodo --quiet --pidfile "${LIGHTTPD_PID}" \
+ --signal HUP
+ eend $?
+}
+
+graceful() {
+ if ! service_started "${SVCNAME}" ; then
+ eerror "${SVCNAME} isn't running"
+ return 1
+ fi
+ checkconfig || return 1
+
+ ebegin "Gracefully stopping lighttpd"
+ start-stop-daemon --stop --oknodo --quiet --pidfile "${LIGHTTPD_PID}" \
+ --signal INT
+ if eend $? ; then
+ rm -f "${LIGHTTPD_PID}"
+ start
+ fi
+}
diff --git a/extra/lighttpd/lighttpd.install b/extra/lighttpd/lighttpd.install
new file mode 100644
index 00000000..63235f3c
--- /dev/null
+++ b/extra/lighttpd/lighttpd.install
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+
+case $1 in
+ pre_install)
+ adduser -H -h /var/www/localhost/htdocs -s /bin/false -D \
+ lighttpd 2>/dev/null
+ ;;
+ post_install)
+ chown lighttpd:lighttpd /var/*/lighttpd
+ ;;
+esac
+
+exit 0
diff --git a/extra/lighttpd/lighttpd.logrotate b/extra/lighttpd/lighttpd.logrotate
new file mode 100644
index 00000000..76f0ef3f
--- /dev/null
+++ b/extra/lighttpd/lighttpd.logrotate
@@ -0,0 +1,17 @@
+# $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/lighttpd.logrotate,v 1.2 2006/05/30 19:49:29 bangert Exp $
+# lighttpd logrotate script for Gentoo
+
+/var/log/lighttpd/*.log {
+ daily
+ missingok
+ copytruncate
+ rotate 7
+ compress
+ notifempty
+ sharedscripts
+ postrotate
+ if [ -f /var/run/lighttpd.pid ]; then \
+ /etc/init.d/lighttpd reload > /dev/null 2>&1 || true ; \
+ fi;
+ endscript
+}
diff --git a/extra/lighttpd/mime-types.conf b/extra/lighttpd/mime-types.conf
new file mode 100644
index 00000000..3c365777
--- /dev/null
+++ b/extra/lighttpd/mime-types.conf
@@ -0,0 +1,76 @@
+###############################################################################
+# Default mime-types.conf for Gentoo.
+# include'd from lighttpd.conf.
+# $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/conf/mime-types.conf,v 1.2 2005/08/27 12:36:13 ka0ttic Exp $
+###############################################################################
+
+# {{{ mime types
+mimetype.assign = (
+ ".pdf" => "application/pdf",
+ ".sig" => "application/pgp-signature",
+ ".spl" => "application/futuresplash",
+ ".class" => "application/octet-stream",
+ ".ps" => "application/postscript",
+ ".torrent" => "application/x-bittorrent",
+ ".dvi" => "application/x-dvi",
+ ".gz" => "application/x-gzip",
+ ".pac" => "application/x-ns-proxy-autoconfig",
+ ".swf" => "application/x-shockwave-flash",
+ ".tar.gz" => "application/x-tgz",
+ ".tgz" => "application/x-tgz",
+ ".tar" => "application/x-tar",
+ ".zip" => "application/zip",
+ ".mp3" => "audio/mpeg",
+ ".m3u" => "audio/x-mpegurl",
+ ".wma" => "audio/x-ms-wma",
+ ".wax" => "audio/x-ms-wax",
+ ".ogg" => "application/ogg",
+ ".wav" => "audio/x-wav",
+ ".gif" => "image/gif",
+ ".jpg" => "image/jpeg",
+ ".jpeg" => "image/jpeg",
+ ".png" => "image/png",
+ ".xbm" => "image/x-xbitmap",
+ ".xpm" => "image/x-xpixmap",
+ ".xwd" => "image/x-xwindowdump",
+ ".css" => "text/css",
+ ".html" => "text/html",
+ ".htm" => "text/html",
+ ".js" => "text/javascript",
+ ".asc" => "text/plain",
+ ".c" => "text/plain",
+ ".h" => "text/plain",
+ ".cc" => "text/plain",
+ ".cpp" => "text/plain",
+ ".hh" => "text/plain",
+ ".hpp" => "text/plain",
+ ".conf" => "text/plain",
+ ".log" => "text/plain",
+ ".text" => "text/plain",
+ ".txt" => "text/plain",
+ ".diff" => "text/plain",
+ ".patch" => "text/plain",
+ ".ebuild" => "text/plain",
+ ".eclass" => "text/plain",
+ ".rtf" => "application/rtf",
+ ".bmp" => "image/bmp",
+ ".tif" => "image/tiff",
+ ".tiff" => "image/tiff",
+ ".ico" => "image/x-icon",
+ ".dtd" => "text/xml",
+ ".xml" => "text/xml",
+ ".mpeg" => "video/mpeg",
+ ".mpg" => "video/mpeg",
+ ".mov" => "video/quicktime",
+ ".qt" => "video/quicktime",
+ ".avi" => "video/x-msvideo",
+ ".asf" => "video/x-ms-asf",
+ ".asx" => "video/x-ms-asf",
+ ".wmv" => "video/x-ms-wmv",
+ ".bz2" => "application/x-bzip",
+ ".tbz" => "application/x-bzip-compressed-tar",
+ ".tar.bz2" => "application/x-bzip-compressed-tar"
+ )
+# }}}
+
+# vim: set ft=conf foldmethod=marker et :
diff --git a/extra/lighttpd/mod_cgi.conf b/extra/lighttpd/mod_cgi.conf
new file mode 100644
index 00000000..1cb3770f
--- /dev/null
+++ b/extra/lighttpd/mod_cgi.conf
@@ -0,0 +1,33 @@
+###############################################################################
+# mod_cgi.conf
+# include'd by lighttpd.conf.
+# $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/conf/mod_cgi.conf,v 1.1 2005/08/27 12:36:13 ka0ttic Exp $
+###############################################################################
+
+#
+# see cgi.txt for more information on using mod_cgi
+#
+
+server.modules += ("mod_cgi")
+
+# NOTE: this requires mod_alias
+alias.url = (
+ "/cgi-bin/" => var.basedir + "/cgi-bin/"
+)
+
+#
+# Note that you'll also want to enable the
+# cgi-bin alias via mod_alias (above).
+#
+
+$HTTP["url"] =~ "^/cgi-bin/" {
+ # disable directory listings
+ dir-listing.activate = "disable"
+ # only allow cgi's in this directory
+ cgi.assign = (
+ ".pl" => "/usr/bin/perl",
+ ".cgi" => "/usr/bin/perl"
+ )
+}
+
+# vim: set ft=conf foldmethod=marker et :
diff --git a/extra/lighttpd/mod_fastcgi.conf b/extra/lighttpd/mod_fastcgi.conf
new file mode 100644
index 00000000..ca1369af
--- /dev/null
+++ b/extra/lighttpd/mod_fastcgi.conf
@@ -0,0 +1,17 @@
+###############################################################################
+# mod_fastcgi.conf
+# include'd by lighttpd.conf.
+# $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/conf/mod_fastcgi.conf-1.4.13-r2,v 1.1 2007/04/01 23:22:00 robbat2 Exp $
+###############################################################################
+
+server.modules += ("mod_fastcgi")
+fastcgi.server = ( ".php" =>
+ ( "localhost" =>
+ (
+ "socket" => "/var/run/lighttpd/lighttpd-fastcgi-php-" + PID + ".socket",
+ "bin-path" => "/usr/bin/php-cgi"
+ )
+ )
+ )
+
+# vim: set ft=conf foldmethod=marker et :
diff --git a/extra/lighttpd/spawn-fcgi.confd b/extra/lighttpd/spawn-fcgi.confd
new file mode 100644
index 00000000..2a88806a
--- /dev/null
+++ b/extra/lighttpd/spawn-fcgi.confd
@@ -0,0 +1,35 @@
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/spawn-fcgi.confd,v 1.1 2005/02/14 11:39:01 ka0ttic Exp $
+
+# Configuration file for the FCGI-Part of /etc/init.d/lighttpd
+
+## Set this to "yes" to enable SPAWNFCGI
+ENABLE_SPAWNFCGI="yes"
+
+## ABSOLUTE path to the spawn-fcgi binary
+SPAWNFCGI="/usr/bin/spawn-fcgi"
+
+## ABSOLUTE path to the PHP binary
+FCGIPROGRAM="/usr/bin/php-cgi"
+
+## bind to tcp-port on localhost
+FCGIPORT="1026"
+
+## number of PHP childs to spawn
+PHP_FCGI_CHILDREN=5
+
+## number of request server by a single php-process until is will be restarted
+PHP_FCGI_MAX_REQUESTS=1000
+
+## IP adresses where PHP should access server connections from
+FCGI_WEB_SERVER_ADDRS="127.0.0.1"
+
+# allowed environment variables sperated by spaces
+ALLOWED_ENV="PATH USER"
+# do NOT change line below
+ALLOWED_ENV="$ALLOWED_ENV PHP_FCGI_MAX_REQUESTS FCGI_WEB_SERVER_ADDRS"
+
+## if this script is run as root switch to the following user
+USERID=lighttpd
+GROUPID=lighttpd
diff --git a/extra/lighttpd/spawn-fcgi.initd b/extra/lighttpd/spawn-fcgi.initd
new file mode 100644
index 00000000..63daa750
--- /dev/null
+++ b/extra/lighttpd/spawn-fcgi.initd
@@ -0,0 +1,51 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/spawn-fcgi.initd,v 1.2 2007/04/02 12:46:08 uberlord Exp $
+
+SPAWNFCGI_PID="/var/run/spawn-fcgi.pid"
+
+depend() {
+ need net
+}
+
+start() {
+ local my_end
+
+ ebegin "Starting spawn-fcgi"
+ export PHP_FCGI_MAX_REQUESTS FCGI_WEB_SERVER_ADDRS
+
+ EX="${SPAWNFCGI} -p ${FCGIPORT} -f ${FCGIPROGRAM} -u ${USERID} \
+ -g ${GROUPID} -C ${PHP_FCGI_CHILDREN}"
+
+ # copy the allowed environment variables
+ unset E
+ for i in ${ALLOWED_ENV}; do
+ E="${E} ${i}=${!i}"
+ done
+
+ # clean environment and set up a new one
+ env - ${E} ${EX} 2>${SPAWNFCGI_PID}
+ my_end=$?
+ if [ "$my_end" != "0" ]; then
+ [ -f ${SPAWNFCGI_PID} ] && rm -f ${SPAWNFCGI_PID}
+ eend $my_end
+ fi
+
+ #extract parent-process-id and write it back to the file
+ FCGI_PPID=`cat ${SPAWNFCGI_PID} | cut -d':' -f4`
+ echo ${FCGI_PPID} > ${SPAWNFCGI_PID}
+ eend 0
+}
+
+stop() {
+ ebegin "Stopping spawn-fcgi"
+ if ! kill `cat ${SPAWNFCGI_PID}` ; then
+ eend $?
+ return 1
+ fi
+ if [ -w ${SPAWNFCGI_PID} ]; then
+ rm ${SPAWNFCGI_PID}
+ fi
+ eend 0
+}
diff --git a/extra/lpc/APKBUILD b/extra/lpc/APKBUILD
new file mode 100644
index 00000000..af2b8a08
--- /dev/null
+++ b/extra/lpc/APKBUILD
@@ -0,0 +1,18 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=lpc
+pkgver=1.0.0
+pkgrel=0
+pkgdesc="Lua Process Call"
+url="http://lua.net-core.org/sputnik.lua?p=Telesto:About"
+license="MIT/X11"
+depends="uclibc lua-dev"
+source="http://lua.net-core.org/dl/telesto/lpc-$pkgver.tar.gz"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ make CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS -shared"
+ # does not respect DESTDIR
+ make install PREFIX="$pkgdir"/usr
+}
+
+md5sums="fce047808fbdfe3f9439557c7afae871 lpc-1.0.0.tar.gz"
diff --git a/extra/lua/APKBUILD b/extra/lua/APKBUILD
new file mode 100644
index 00000000..e5ddf934
--- /dev/null
+++ b/extra/lua/APKBUILD
@@ -0,0 +1,48 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=lua
+pkgver=5.1.4
+pkgrel=1
+pkgdesc="A powerful light-weight programming language designed for extending applications."
+url="http://www.lua.org/"
+license="MIT"
+depends="readline"
+makedepends="readline-dev"
+subpackages="$pkgname-dev $pkgname-doc"
+source="http://www.$pkgname.org/ftp/$pkgname-$pkgver.tar.gz
+ lua-5.1-make.patch
+ lua-5.1-module_paths.patch
+ "
+
+build ()
+{
+ cd "$srcdir"/$pkgname-$pkgver
+ for i in ../*.patch; do
+ msg "Applying $i"
+ patch -p1 < $i || return 1
+ done
+
+ # correct lua versioning
+ sed -i -e 's/\(LIB_VERSION = \)6:1:1/\16:4:1/' src/Makefile
+
+ # we want packages to find our things
+ sed -i -e 's:/usr/local:/usr:' etc/lua.pc
+
+ cd src
+ make CFLAGS=" -DLUA_USE_LINUX $CFLAGS" \
+ RPATH="/usr/lib" \
+ LUA_LIBS="-lreadline" \
+ LIB_LIBS="-lm -ldl" \
+ V=$pkgver \
+ gentoo_all || return 1
+
+ cd "$srcdir/$pkgname-$pkgver"
+ make INSTALL_TOP="$pkgdir"/usr INSTALL_LIB="$pkgdir"/usr/lib \
+ V=$pkgver gentoo_install || return 1
+
+ install -D -m 644 etc/lua.pc "$pkgdir"/usr/lib/pkgconfig/lua.pc
+ install -D -m 644 doc/lua.1 "$pkgdir"/usr/share/man/man1/lua.1
+ install -D -m 644 doc/luac.1 "$pkgdir"/usr/share/man/man1/luac.1
+}
+md5sums="d0870f2de55d59c1c8419f36e8fac150 lua-5.1.4.tar.gz
+0145ff6036eb6bfdab427dc8f0c3f3c0 lua-5.1-make.patch
+e60ef15deefb72a5930c498f1184aced lua-5.1-module_paths.patch"
diff --git a/extra/lua/lua-5.1-make.patch b/extra/lua/lua-5.1-make.patch
new file mode 100644
index 00000000..d051a21c
--- /dev/null
+++ b/extra/lua/lua-5.1-make.patch
@@ -0,0 +1,64 @@
+--- lua-5.1.1.orig/Makefile 2006-06-02 12:53:38.000000000 +0200
++++ lua-5.1.1/Makefile 2006-11-16 02:16:53.000000000 +0100
+@@ -127,3 +127,22 @@
+ .PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho newer
+
+ # (end of Makefile)
++
++# Use libtool for binary installs, etc.
++
++export V
++export LIBTOOL = libtool --quiet --tag=CC
++# See libtool manual about how to set this
++
++gentoo_clean:
++ cd src; $(MAKE) $@
++
++gentoo_test: gentoo_linux
++ test/lua.static test/hello.lua
++
++gentoo_install:
++ mkdir -p $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB)
++ cd src; $(LIBTOOL) --mode=install $(INSTALL_EXEC) lua luac $(INSTALL_BIN)
++ cd src; $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
++ cd src; $(LIBTOOL) --mode=install $(INSTALL_DATA) liblua.la $(INSTALL_LIB)
++ cd src; $(LIBTOOL) --mode=install $(INSTALL_DATA) liblua.a $(INSTALL_LIB)
+--- lua-5.1.1.orig/src/Makefile 2006-03-22 01:41:49.000000000 +0100
++++ lua-5.1.1/src/Makefile 2006-11-16 02:10:27.000000000 +0100
+@@ -176,3 +176,36 @@
+ ltm.h lzio.h lmem.h lopcodes.h lundump.h
+
+ # (end of Makefile)
++
++export LIBTOOL = libtool --quiet --tag=CC
++export LIB_VERSION = 6:1:1
++
++# The following rules use libtool for compiling and linking in order to
++# provide shared library support.
++
++LIB_NAME = liblua.la
++LIB_OBJS = $(CORE_O:.o=.lo) $(LIB_O:.o=.lo)
++
++%.lo %.o: %.c
++ $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
++
++$(LIB_NAME): $(LIB_OBJS)
++ $(LIBTOOL) --mode=link $(CC) -version-info $(LIB_VERSION) \
++ -rpath $(RPATH) -o $(LIB_NAME) $(LIB_OBJS) $(LIB_LIBS)
++
++$(LIB_NAME:.la=.a): $(LIB_OBJS)
++ $(LIBTOOL) --mode=link $(CC) -static -o $(LIB_NAME:.la=.a) $(LIB_OBJS)
++
++$(LUA_T): $(LUA_O) $(LIB_NAME)
++ $(LIBTOOL) --mode=link $(CC) -Wl,-E -o $@ $(LUA_O) $(LUA_LIBS) -llua
++
++lua_test: $(LUA_O) $(LIB_NAME)
++ $(LIBTOOL) --mode=link $(CC) -static -Wl,-E -o $@ $(LUA_O) $(LIB_NAME) $(LUA_LIBS)
++
++$(LUAC_T): $(LUAC_O) $(LIB_NAME)
++ $(LIBTOOL) --mode=link $(CC) -static -o $@ $(LUAC_O) $(LIB_NAME)
++
++gentoo_clean:
++ $(LIBTOOL) --mode=clean $(RM) $(ALL_O:.o=.lo) $(LIB_NAME) lua luac
++
++gentoo_all: $(LIB_NAME) $(LIB_NAME:.la=.a) $(LUA_T) lua_test $(LUAC_T)
diff --git a/extra/lua/lua-5.1-module_paths.patch b/extra/lua/lua-5.1-module_paths.patch
new file mode 100644
index 00000000..29ac4c3b
--- /dev/null
+++ b/extra/lua/lua-5.1-module_paths.patch
@@ -0,0 +1,30 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## src_luaconf.h.dpatch by John V. Belmonte <jbelmonte@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Set Lua's default PATH and CPATH.
+
+@DPATCH@
+diff -urNad trunk~/src/luaconf.h trunk/src/luaconf.h
+--- trunk~/src/luaconf.h 2006-02-10 12:44:06.000000000 -0500
++++ trunk/src/luaconf.h 2006-02-17 21:32:55.000000000 -0500
+@@ -83,13 +83,17 @@
+
+ #else
+ #define LUA_ROOT "/usr/local/"
++#define LUA_ROOT2 "/usr/"
+ #define LUA_LDIR LUA_ROOT "share/lua/5.1/"
++#define LUA_LDIR2 LUA_ROOT2 "share/lua/5.1/"
+ #define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
++#define LUA_CDIR2 LUA_ROOT2 "lib/lua/5.1/"
+ #define LUA_PATH_DEFAULT \
+ "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
+- LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua"
++ LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \
++ LUA_LDIR2"?.lua;" LUA_LDIR2"?/init.lua"
+ #define LUA_CPATH_DEFAULT \
+- "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
++ "./?.so;" LUA_CDIR"?.so;" LUA_CDIR2"?.so;" LUA_CDIR"loadall.so"
+ #endif
+
+
diff --git a/extra/luaposix/APKBUILD b/extra/luaposix/APKBUILD
new file mode 100644
index 00000000..7b85aeaf
--- /dev/null
+++ b/extra/luaposix/APKBUILD
@@ -0,0 +1,18 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=luaposix
+pkgver=5.1.4
+pkgrel=0
+pkgdesc="POSIX library for Lua"
+url="http://luaforge.net/projects/luaposix/"
+license="MIT"
+depends="uclibc"
+makedepends="lua-dev"
+source="http://luaforge.net/frs/download.php/3572/$pkgname-$pkgver.tar.gz"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ make PREFIX=/usr || return 1
+ make PREFIX=/usr DESTDIR="$pkgdir" install
+}
+
+md5sums="073019b1a52bfddb94e2521553b47ef5 luaposix-5.1.4.tar.gz"
diff --git a/extra/man/APKBUILD b/extra/man/APKBUILD
new file mode 100644
index 00000000..1363e3cb
--- /dev/null
+++ b/extra/man/APKBUILD
@@ -0,0 +1,33 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=man
+pkgver=1.6f
+pkgrel=0
+pkgdesc="A utility for reading man pages"
+url="http://primates.ximian.com/~flucifredi/man/"
+license="GPL"
+depends="groff"
+subpackages="$pkgname-doc"
+source="http://primates.ximian.com/~flucifredi/$pkgname/$pkgname-$pkgver.tar.gz
+ whatis.periodic.daily
+ $pkgname-troff.patch"
+
+build () {
+ local i
+ cd "$srcdir/$pkgname-$pkgver"
+ for i in ../*.patch; do
+ msg "Applying $i"
+ patch -p1 -i $i || return 1
+ done
+
+ ./configure -confdir=/etc +sgid +fhs +lang none
+
+ make || return 1
+ make PREFIX="$pkgdir" install || return 1
+
+ sed -i "s|-Tlatin1||g" "$pkgdir"/etc/man.conf
+ install -D -m744 ../whatis.periodic.daily \
+ "$pkgdir"/etc/periodic/daily/whatis
+}
+md5sums="67aaaa6df35215e812fd7d89472c44b6 man-1.6f.tar.gz
+9cb02e4491777430a9ad3b503e87ec0d whatis.periodic.daily
+21541cb3073259f7fb9335675ca41b0e man-troff.patch"
diff --git a/extra/man/man-troff.patch b/extra/man/man-troff.patch
new file mode 100644
index 00000000..e08e9316
--- /dev/null
+++ b/extra/man/man-troff.patch
@@ -0,0 +1,16 @@
+diff -Naur man-1.5p-orig/src/man.conf.in man-1.5p/src/man.conf.in
+--- man-1.5p-orig/src/man.conf.in 2005-01-08 10:50:45.000000000 -0800
++++ man-1.5p/src/man.conf.in 2005-03-18 13:22:17.000000000 -0800
+@@ -88,9 +88,9 @@
+ # If you have a new troff (version 1.18.1?) and its colored output
+ # causes problems, add the -c option to TROFF, NROFF, JNROFF.
+ #
+-TROFF @troff@
+-NROFF @nroff@
+-JNROFF @jnroff@
++TROFF @troff@ -c
++NROFF @nroff@ -c
++JNROFF @jnroff@ -c
+ EQN @eqn@
+ NEQN @neqn@
+ JNEQN @jneqn@
diff --git a/extra/man/whatis.periodic.daily b/extra/man/whatis.periodic.daily
new file mode 100755
index 00000000..00d40dd9
--- /dev/null
+++ b/extra/man/whatis.periodic.daily
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Make sure MANPATH is complete
+. /etc/profile
+. /etc/profile.d/* 2>/dev/null
+
+# Update the "whatis" database
+/usr/sbin/makewhatis -u -w
+
diff --git a/extra/md5/APKBUILD b/extra/md5/APKBUILD
new file mode 100644
index 00000000..93e3747a
--- /dev/null
+++ b/extra/md5/APKBUILD
@@ -0,0 +1,19 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=md5
+pkgver=1.1.2
+pkgrel=0
+pkgdesc="Basic cryptographic facilities for Lua"
+url="http://www.keplerproject.org/md5/"
+license="MIT"
+depends="uclibc lua"
+makedepends="lua-dev"
+source="http://luaforge.net/frs/download.php/3355/$pkgname-$pkgver.tar.gz"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ make CFLAGS="$CFLAGS" || return 1
+ make PREFIX="$pkgdir"/usr install
+}
+
+md5sums="68874cff64547f2157d5ecdc3572b544 md5-1.1.2.tar.gz"
diff --git a/extra/mini_httpd/APKBUILD b/extra/mini_httpd/APKBUILD
new file mode 100644
index 00000000..27519797
--- /dev/null
+++ b/extra/mini_httpd/APKBUILD
@@ -0,0 +1,45 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=mini_httpd
+pkgver=1.19
+pkgrel=0
+pkgdesc="Small forking webserver with ssl and ipv6 support"
+url="http://www.acme.com/software/mini_httpd/"
+license="BSD"
+depends="uclibc openssl"
+makedepends="openssl-dev"
+subpackages="$pkgname-doc"
+source="http://www.acme.com/software/mini_httpd/$pkgname-$pkgver.tar.gz
+ $pkgname.confd
+ $pkgname.conf.sample
+ $pkgname.initd
+ "
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ make CFLAGS="${CFLAGS} -DUSE_SSL" \
+ LDFLAGS="${LDFLAGS}" \
+ SSL_LIBS="-lssl -lcrypto" \
+ || return 1
+# SSL_DEFS="-DUSE_SSL" \
+
+ # does not respect DESTDIR
+ make install \
+ BINDIR="$pkgdir"/usr/sbin \
+ MANDIR="$pkgdir"/usr/share/man
+
+ # rename htpasswd to mini_htpasswd
+ mv "$pkgdir"/usr/sbin/htpasswd "$pkgdir"/usr/sbin/mini_htpasswd
+ mv "$pkgdir"/usr/share/man/man1/htpasswd.1 \
+ "$pkgdir"/usr/share/man/man1/mini_htpasswd.1
+
+ mkdir -p "$pkgdir"/var/www/localhost/htdocs
+ install -D -m644 ../mini_httpd.conf.sample \
+ "$pkgdir"/etc/mini_httpd.conf
+ install -D -m755 ../mini_httpd.initd "$pkgdir"/etc/init.d/mini_httpd
+ install -D -m644 ../mini_httpd.confd "$pkgdir"/etc/conf.d/mini_httpd
+}
+
+md5sums="7c68293ad265ecfe2edea917912f6f1f mini_httpd-1.19.tar.gz
+8ec70211497d79a26d33006b0ce19aa0 mini_httpd.confd
+fd62c1809f658400acf2082eacd08bb8 mini_httpd.conf.sample
+ec52d2db1ce52f1b088d474aeefe9da8 mini_httpd.initd"
diff --git a/extra/mini_httpd/mini_httpd.conf.sample b/extra/mini_httpd/mini_httpd.conf.sample
new file mode 100644
index 00000000..f215652f
--- /dev/null
+++ b/extra/mini_httpd/mini_httpd.conf.sample
@@ -0,0 +1,48 @@
+## /etc/mini_httpd.conf
+##
+## do not leave empty lines in here!
+## format is: key=value
+##
+## run in debug-mode?
+#debug
+##
+## what interface to bind to?
+## (default is binding to any interface)
+#host=www.example.org
+port=80
+#port=443
+user=nobody
+##
+## CGI:
+## ? match a single char
+## * matches any string excluding "/"
+## ** matches any string including "/"
+## separate multiple patterns with "|"
+#cgipat=**.sh|**.cgi
+##
+## chroot:
+chroot
+#nochroot
+##
+logfile=/var/log/mini_httpd.log
+pidfile=/var/run/mini_httpd.pid
+##
+#charset=iso-8859-1
+##
+## control the caching: (in secs)
+#maxage 60
+##
+## useless setting (just modifies the http-header)
+## (see mini_httpd(8) and http://www.w3.org/P3P/ for more info)
+#p3p
+##
+## virtual hosting:
+#vhost
+##
+## cache-control: send this "max-age" in all HTTP-responses:
+#max-age=0
+##
+## ssl:
+#nossl
+#ssl
+#certfile=/etc/mini_httpd/mini_httpd.pem
diff --git a/extra/mini_httpd/mini_httpd.confd b/extra/mini_httpd/mini_httpd.confd
new file mode 100644
index 00000000..b5e9a8f2
--- /dev/null
+++ b/extra/mini_httpd/mini_httpd.confd
@@ -0,0 +1,26 @@
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/www-servers/mini_httpd/files/mini_httpd.confd-1.19,v 1.2 2007/08/26 21:20:21 bangert Exp $
+
+## Config file for /etc/init.d/mini_httpd
+
+## the startup-dir of mini_httpd is the docroot, so we specify it here
+## and the init-script does a "cd" prior to startup:
+MINI_HTTPD_DOCROOT="/var/www/localhost/htdocs"
+
+## There are 2 ways to configure mini_httpd:
+## 1) specify all params on the cmd-line
+## 2) use a config-file (and start with "-C <conf-file>")
+## Note: 1) and 2) can be mixed.
+##
+## We choose 1) here -- if you have a more complicated setup read
+## mini_httpd(8) for details on 2).
+
+# MINI_HTTPD_OPTS="-p 8080 -u nobody -r -i /var/run/mini_httpd.pid -l /var/log/mini_httpd.log -d ${MINI_HTTPD_DOCROOT}"
+
+## to add cgi-support you should switch over to a config-file, a sample can
+## be found in your DOCDESTTREE (/usr/share/doc/mini_httpd-xxxx) named
+## mini_httpd.conf.sample.gz
+## copy the sample to /etc/mini_httpd.conf and replace the MINI_HTTPD_OPTS-line
+## above by:
+MINI_HTTPD_OPTS="-C /etc/mini_httpd.conf"
diff --git a/extra/mini_httpd/mini_httpd.initd b/extra/mini_httpd/mini_httpd.initd
new file mode 100644
index 00000000..ccaf53d3
--- /dev/null
+++ b/extra/mini_httpd/mini_httpd.initd
@@ -0,0 +1,29 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/www-servers/mini_httpd/files/mini_httpd.init,v 1.2 2007/08/26 21:20:21 bangert Exp $
+
+depend() {
+ need net
+}
+
+start() {
+ ebegin "Starting mini_httpd"
+ if [ ! -d "$MINI_HTTPD_DOCROOT" ]; then
+ eend 1 "MINI_HTTPD_DOCROOT not set correctly in /etc/conf.d/mini_httpd"
+ exit 1
+ fi
+ start-stop-daemon --quiet --start --startas /usr/sbin/mini_httpd \
+ --pidfile /var/run/mini_httpd.pid -- ${MINI_HTTPD_OPTS}
+ eend $?
+}
+
+stop() {
+ local rc
+
+ ebegin "Stopping mini_httpd"
+ start-stop-daemon --quiet --stop --pidfile /var/run/mini_httpd.pid
+ rc=$?
+ rm -f /var/run/mini_httpd.pid
+ eend $rc
+}
diff --git a/extra/ncftp/APKBUILD b/extra/ncftp/APKBUILD
new file mode 100644
index 00000000..2c157f34
--- /dev/null
+++ b/extra/ncftp/APKBUILD
@@ -0,0 +1,38 @@
+# Maintainer: Carlo Landmeter <clandmeter at gmail>
+pkgname=ncftp
+pkgver=3.2.2
+pkgrel=1
+pkgdesc="A set of free application programs implementing FTP"
+url="http://www.ncftp.com/"
+license="custom"
+depends="uclibc"
+makedepends="ncurses-dev"
+install="$pkgname.install"
+source="ftp://ftp.$pkgname.com/$pkgname/$pkgname-$pkgver-src.tar.bz2
+ncftp.install"
+subpackages="$pkgname-doc $pkgname-bookmarks"
+
+build () {
+ cd "${srcdir}/${pkgname}-${pkgver}" || return 1
+ install -d "${pkgdir}"/usr/share | return 1
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man || return 1
+ cd "${srcdir}/${pkgname}-${pkgver}"/libncftp
+ make shared || return 1
+ make PREFIX="${pkgdir}"/usr soinstall || return 1
+ cd "${srcdir}/${pkgname}-${pkgver}" || return 1
+ make || return 1
+ make DESTDIR="$pkgdir" install || return 1
+ install -D doc/LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}"/LICENSE || return 1
+}
+
+bookmarks () {
+ depends="ncurses"
+ install=""
+ mkdir -p "$subpkgdir"/usr/bin || return 1
+ mv "$pkgdir"/usr/bin/ncftpbookmarks "$subpkgdir"/usr/bin/ || return 1
+}
+
+md5sums="b2b4b2fd38c81754b8f13895d784d491 ncftp-3.2.2-src.tar.bz2
+14748964fb593df0e2914a61941cb3c0 ncftp.install"
diff --git a/extra/ncftp/ncftp.install b/extra/ncftp/ncftp.install
new file mode 100644
index 00000000..3532be46
--- /dev/null
+++ b/extra/ncftp/ncftp.install
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+case "$1" in
+ post_install)
+ echo '*'
+ echo '* If you like to install the ncurses based bookmark manager run: '
+ echo '*'
+ echo '* apk_add ncftp-bookmarks'
+ echo '*'
+ ;;
+esac
diff --git a/extra/neon/APKBUILD b/extra/neon/APKBUILD
new file mode 100644
index 00000000..e6af49c7
--- /dev/null
+++ b/extra/neon/APKBUILD
@@ -0,0 +1,27 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=neon
+pkgver=0.28.3
+pkgrel=1
+pkgdesc="HTTP and WebDAV client library with a C interface"
+url="http://www.webdav.org/neon/"
+license="GPL LGPL"
+depends="openssl zlib expat"
+makedepends="expat-dev openssl-dev zlib-dev"
+subpackages="$pkgname-dev $pkgname-doc"
+source="http://www.webdav.org/$pkgname/$pkgname-$pkgver.tar.gz"
+
+build () {
+ cd "$srcdir/$pkgname-$pkgver"
+ ./configure --prefix=/usr \
+ --with-ssl \
+ --with-expat \
+ --disable-gssapi \
+ --disable-nls \
+ --disable-socks \
+ --enable-shared \
+ --disable-static \
+
+ make || return 1
+ make DESTDIR="$pkgdir" install
+}
+md5sums="47599a328862ce64ac3c52726d6daa12 neon-0.28.3.tar.gz"
diff --git a/extra/oidentd/APKBUILD b/extra/oidentd/APKBUILD
new file mode 100644
index 00000000..130283f7
--- /dev/null
+++ b/extra/oidentd/APKBUILD
@@ -0,0 +1,34 @@
+# Contributor: Carlo Landmeter <clandmeter@gmail.com>
+pkgname=oidentd
+pkgver=2.0.8
+pkgrel=0
+pkgdesc="Configurable IDENT server that supports NAT/IP masq."
+url="http://dev.ojnk.net/"
+license="GPL"
+depends="uclibc"
+makedepends=""
+subpackages="$pkgname-doc"
+source="http://downloads.sourceforge.net/ojnk/$pkgname-$pkgver.tar.gz
+oidentd.conf
+oidentd.initd
+oidentd.confd"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info
+ make || return 1
+ make DESTDIR="$pkgdir" install
+ install -D -m755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+ install -D -m644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
+ install -D -m644 "$srcdir"/$pkgname.conf "$pkgdir"/etc/$pkgname.conf
+
+}
+
+md5sums="c3d9a56255819ef8904b867284386911 oidentd-2.0.8.tar.gz
+d9c40e4d6a0bde685a359ad49b4eada2 oidentd.conf
+89a027c3b8245f6c5e79930d16d485f7 oidentd.initd
+05a43d3987754f179f4e31bbe61ff315 oidentd.confd"
diff --git a/extra/oidentd/oidentd.conf b/extra/oidentd/oidentd.conf
new file mode 100644
index 00000000..03b28d82
--- /dev/null
+++ b/extra/oidentd/oidentd.conf
@@ -0,0 +1,22 @@
+# Configuration for oidentd
+# see oidentd.conf(5)
+#
+default {
+ default {
+ deny spoof
+ deny spoof_all
+ deny spoof_privport
+ allow random
+ allow random_numeric
+ allow numeric
+ deny hide
+ }
+}
+
+# you may want to hide root connections
+#user "root" {
+# default {
+# force reply "UNKNOWN"
+# }
+#}
+
diff --git a/extra/oidentd/oidentd.confd b/extra/oidentd/oidentd.confd
new file mode 100644
index 00000000..3116889e
--- /dev/null
+++ b/extra/oidentd/oidentd.confd
@@ -0,0 +1,4 @@
+# oidentd start-up options
+USER="nobody"
+GROUP="nobody"
+OPTIONS=""
diff --git a/extra/oidentd/oidentd.initd b/extra/oidentd/oidentd.initd
new file mode 100644
index 00000000..c40b058d
--- /dev/null
+++ b/extra/oidentd/oidentd.initd
@@ -0,0 +1,42 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/www/viewcvs.gentoo.org/raw_cvs/gentoo-x86/net-misc/oidentd/files/oidentd-2.0.7-init,v 1.4 2007/10/24 11:38:14 uberlord Exp $
+
+depend() {
+ need net
+}
+
+check_config() {
+ if [ -z "${USER}" ]
+ then
+ eerror "Please set \$USER in /etc/conf.d/oidentd!"
+ return 1
+ fi
+ if [ -z "${GROUP}" ]
+ then
+ eerror "Please set \$GROUP in /etc/conf.d/oidentd!"
+ return 1
+ fi
+
+ if [ "$(sysctl -n security.bsd.see_other_uids 2>/dev/null)" = "0" ]; then
+ eerror "${SVCNAME} cannot work if the sysctl security.bsd.see_other_uids is 0"
+ return 1
+ fi
+}
+
+
+start() {
+ check_config || return 1
+ ebegin "Starting oidentd"
+ OPTIONS="${OPTIONS} -u ${USER} -g ${GROUP}"
+ start-stop-daemon --start --quiet --exec /usr/sbin/oidentd -- $OPTIONS
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping oidentd"
+ start-stop-daemon --stop --quiet --exec /usr/sbin/oidentd
+ eend $?
+}
+
diff --git a/extra/opennhrp/APKBUILD b/extra/opennhrp/APKBUILD
new file mode 100644
index 00000000..c3ac6559
--- /dev/null
+++ b/extra/opennhrp/APKBUILD
@@ -0,0 +1,33 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=opennhrp
+pkgver=0.9.2
+pkgrel=0
+pkgdesc="NBMA Next Hop Resolution Protocol daemon"
+url="http://sourceforge.net/projects/opennhrp"
+license="GPL-3"
+depends="uclibc"
+subpackages="$pkgname-doc"
+source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.bz2
+ $pkgname-$pkgver-cflags.patch
+ $pkgname-$pkgver-fix-false-assert.patch
+ $pkgname.initd
+ $pkgname.confd
+ "
+
+build() {
+ cd "$srcdir"/$pkgname-$pkgver
+ for i in ../*.patch; do
+ msg "Applying $i"
+ patch -p1 < $i || return 1
+ done
+
+ make || return 1
+ make DESTDIR="$pkgdir" install
+ install -Dm755 "$srcdir"/opennhrp.initd "$pkgdir"/etc/init.d/opennhrp
+ install -Dm644 "$srcdir"/opennhrp.confd "$pkgdir"/etc/cond.d/opennhrp
+}
+md5sums="71a017151292461aaee572c908ac9ac7 opennhrp-0.9.2.tar.bz2
+492cd3e372481684512e06dbcbd8218a opennhrp-0.9.2-cflags.patch
+cedb10c6b448a581ebb2d8273b309773 opennhrp-0.9.2-fix-false-assert.patch
+85821b61c02427146b866b7582157cfd opennhrp.initd
+8eee86233728dc0d156bbfee6d98f338 opennhrp.confd"
diff --git a/extra/opennhrp/opennhrp-0.9.2-cflags.patch b/extra/opennhrp/opennhrp-0.9.2-cflags.patch
new file mode 100644
index 00000000..9eeeb66a
--- /dev/null
+++ b/extra/opennhrp/opennhrp-0.9.2-cflags.patch
@@ -0,0 +1,15 @@
+--- opennhrp-0.9.2/Makefile.orig Tue Feb 3 14:51:18 2009
++++ opennhrp-0.9.2/Makefile Tue Feb 3 14:51:07 2009
+@@ -22,9 +22,9 @@
+ INSTALL=install
+ INSTALLDIR=$(INSTALL) -d
+
+-CFLAGS=-Werror -Wall -Wstrict-prototypes -std=gnu99 -O2 \
+- -DOPENNHRP_VERSION=\"$(FULL_VERSION)\"
+-LDFLAGS=
++CFLAGS?=-Werror -Wall -Wstrict-prototypes -O2
++CFLAGS+=-std=gnu99 -DOPENNHRP_VERSION=\"$(FULL_VERSION)\"
++LDFLAGS?=
+
+ DESTDIR=
+ SBINDIR=/usr/sbin
diff --git a/extra/opennhrp/opennhrp-0.9.2-fix-false-assert.patch b/extra/opennhrp/opennhrp-0.9.2-fix-false-assert.patch
new file mode 100644
index 00000000..67b44ab5
--- /dev/null
+++ b/extra/opennhrp/opennhrp-0.9.2-fix-false-assert.patch
@@ -0,0 +1,13 @@
+diff -ru opennhrp-0.9.2.orig/nhrp/nhrp_peer.c opennhrp-0.9.2/nhrp/nhrp_peer.c
+--- opennhrp-0.9.2.orig/nhrp/nhrp_peer.c 2009-02-02 13:12:46 +0000
++++ opennhrp-0.9.2/nhrp/nhrp_peer.c 2009-02-02 13:36:51 +0000
+@@ -1260,7 +1260,8 @@
+ {
+ char tmp[NHRP_PEER_FORMAT_LEN];
+
+- NHRP_BUG_ON(peer->flags & NHRP_PEER_FLAG_REMOVED);
++ if (peer->flags & NHRP_PEER_FLAG_REMOVED)
++ return;
+
+ nhrp_debug("Removing %s %s",
+ nhrp_peer_type[peer->type],
diff --git a/extra/opennhrp/opennhrp.confd b/extra/opennhrp/opennhrp.confd
new file mode 100644
index 00000000..c3bece16
--- /dev/null
+++ b/extra/opennhrp/opennhrp.confd
@@ -0,0 +1,2 @@
+# Uncomment the row below to enable verbose logging.
+#OPENNHRP_OPTS=-v
diff --git a/extra/opennhrp/opennhrp.initd b/extra/opennhrp/opennhrp.initd
new file mode 100755
index 00000000..ac7ea6a5
--- /dev/null
+++ b/extra/opennhrp/opennhrp.initd
@@ -0,0 +1,32 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/net-snmp/files/snmpd.rc7,v 1.1 2006/11/26 21:37:22 cedk Exp $
+
+PIDFILE=/var/run/opennhrp.pid
+
+depend() {
+ use logger
+ need net
+}
+
+checkconfig() {
+ if [ ! -e /etc/opennhrp/opennhrp.conf ] ; then
+ eerror "You need an /etc/opennhrp/opennhrp.conf config file to run opennhrp"
+ return 1
+ fi
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Starting opennhrp"
+ start-stop-daemon --start --quiet --pidfile $PIDFILE \
+ --exec /usr/sbin/opennhrp -- -d -p $PIDFILE 2> /dev/null
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping opennhrp"
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE
+ eend $?
+}
diff --git a/extra/pcre/APKBUILD b/extra/pcre/APKBUILD
new file mode 100644
index 00000000..c0352bc0
--- /dev/null
+++ b/extra/pcre/APKBUILD
@@ -0,0 +1,25 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=pcre
+pkgver=7.8
+pkgrel=0
+pkgdesc="Perl-compatible regular expression library"
+url="http://pcre.sourceforge.net"
+license="BSD"
+depends="uclibc"
+makedepends=""
+source="ftp://ftp.csx.cam.ac.uk/pub/software/programming/$pkgname/$pkgname-$pkgver.tar.bz2"
+subpackages="$pkgname-dev $pkgname-doc"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ ./configure --prefix=/usr \
+ --disable-cpp \
+ --with-match-limit-recursion=8192 \
+ --htmldir=/usr/share/doc/$pkgname-$pkgver/html \
+ --docdir=/usr/share/doc/$pkgname-$pkgver
+
+ make || return 1
+ make DESTDIR="$pkgdir" install || return 1
+}
+
+md5sums="141132d6af14dccc7b08fa797e4fd441 pcre-7.8.tar.bz2"
diff --git a/extra/pinentry/APKBUILD b/extra/pinentry/APKBUILD
new file mode 100644
index 00000000..5322ebe7
--- /dev/null
+++ b/extra/pinentry/APKBUILD
@@ -0,0 +1,42 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=pinentry
+pkgver=0.7.5
+_uiconv_ver=0.3
+pkgrel=0
+pkgdesc="Collection of simple PIN or passphrase entry dialogs which utilize the Assuan protocol"
+url="http://www.gnupg.org/aegypten2"
+license="GPL-2"
+depends="ncurses libcap"
+makedepends="ncurses-dev libcap-dev"
+subpackages="$pkgname-doc"
+source="ftp://ftp.gnupg.org/gcrypt/$pkgname/$pkgname-$pkgver.tar.gz
+ http://git.alpinelinux.org/cgit/uiconv/snapshot/uiconv-$_uiconv_ver.tar.bz2
+ "
+
+build () {
+ # we build it against uiconv to avoid the bloaty GNU libiconv.
+ # it will be linked statically so we don't need it in depends
+ cd "$srcdir/uiconv-$_uiconv_ver"
+ make
+ make DESTDIR="$srcdir" PREFIX=/uiconv install
+
+ cd "$srcdir"/$pkgname-$pkgver
+
+ # the configure script have a broken --with-libiconv-prefix option
+ # so we set the -I and -L flags hard
+ export CFLAGS="$CFLAGS -I $srcdir/uiconv/include"
+ export LDFLAGS="$LDFLAGS -L $srcdir/uiconv/lib"
+
+ ./configure --prefix=/usr \
+ --disable-pinentry-gtk \
+ --disable-pinentry-gtk2 \
+ --disable-pinentry-qt \
+ --enable-pinentry-curses \
+ --enable-fallback-curses \
+ --with-libiconv-prefix="$srcdir"/uiconv
+
+ make || return 1
+ make DESTDIR="$pkgdir" install
+}
+md5sums="ca492afbbb59cd19f1c875533f18b269 pinentry-0.7.5.tar.gz
+5cd7f80085324d08cb976fec674cd98d uiconv-0.3.tar.bz2"
diff --git a/extra/pingu/APKBUILD b/extra/pingu/APKBUILD
new file mode 100644
index 00000000..2ded6af6
--- /dev/null
+++ b/extra/pingu/APKBUILD
@@ -0,0 +1,23 @@
+# Contributor: Natanael Copa <ncopa@alpinelinux.org>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=pingu
+pkgver=0.2
+pkgrel=0
+pkgdesc="Small daemon that pings hosts and executes a script when status change"
+url="http://dev.alpinelinux.org/cgit/cgit.cgi/pingu"
+license="GPL"
+depends="uclibc"
+source="http://dev.alpinelinux.org/cgit/cgit.cgi/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2
+ pingu.initd
+ "
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ make || return 1
+ make BINDIR=/usr/sbin DESTDIR="$pkgdir" install
+ install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+}
+
+md5sums="5f7b72e4eb0af88a5d568b383513591f pingu-0.2.tar.bz2
+2b06ea0dbb9ccfc8e0d5afb7fb6aee6a pingu.initd"
diff --git a/extra/portmap/APKBUILD b/extra/portmap/APKBUILD
new file mode 100644
index 00000000..e35ff4c0
--- /dev/null
+++ b/extra/portmap/APKBUILD
@@ -0,0 +1,38 @@
+pkgname=portmap
+pkgver=6.0
+pkgrel=1
+pkgdesc="RPC connection manager"
+url="http://neil.brown.name/portmap/"
+license="GPL"
+depends="uclibc"
+makedepends=""
+install="$pkgname.install"
+subpackages="$pkgname-doc"
+source="http://neil.brown.name/$pkgname/$pkgname-$pkgver.tgz
+ $pkgname-6.0-tcpd.patch
+ $pkgname.install
+ $pkgname.confd
+ $pkgname.initd"
+
+build ()
+{
+ cd "$srcdir"/portmap_$pkgver
+ for i in ../*.patch; do
+ msg "Applying $i"
+ patch -p1 < $i || return 1
+ done
+
+ make NO_TCP_WRAPPER=NO || return 1
+ mkdir -p "$pkgdir"/sbin
+ mkdir -p "$pkgdir"/usr/share/man/man8
+ make BASEDIR="$pkgdir" install
+ mkdir -p "$pkgdir"/etc/init.d "$pkgdir"/etc/conf.d
+ install -m 755 "$startdir"/$pkgname.initd $pkgdir/etc/init.d/$pkgname
+ install -m 644 "$startdir"/$pkgname.confd $pkgdir/etc/conf.d/$pkgname
+}
+
+md5sums="ac108ab68bf0f34477f8317791aaf1ff portmap-6.0.tgz
+bdcd217a0d459c75116d0b5aa90a372b portmap-6.0-tcpd.patch
+b726a64e91b47244a7539288338c6bbd portmap.install
+56b0f47cda2003f3394ef7c37ec4cdff portmap.confd
+2944aa0387aba4ed6219d7856e5e8fb0 portmap.initd"
diff --git a/extra/portmap/portmap-6.0-tcpd.patch b/extra/portmap/portmap-6.0-tcpd.patch
new file mode 100644
index 00000000..c6af8f8c
--- /dev/null
+++ b/extra/portmap/portmap-6.0-tcpd.patch
@@ -0,0 +1,18 @@
+Enable compile without tcp-wrappers
+
+Patch by Timothy Redaelli <drizzt@gentoo.org>
+
+http://bugs.gentoo.org/178242
+
+--- portmap_6.0/pmap_check.c
++++ portmap_6.0/pmap_check.c
+@@ -44,7 +44,9 @@
+ #include <netinet/in.h>
+ #include <rpc/rpcent.h>
+ #endif
++#ifdef HOSTS_ACCESS
+ #include <tcpd.h>
++#endif
+ #include <arpa/inet.h>
+ #include <grp.h>
+
diff --git a/extra/portmap/portmap.confd b/extra/portmap/portmap.confd
new file mode 100644
index 00000000..c2756c99
--- /dev/null
+++ b/extra/portmap/portmap.confd
@@ -0,0 +1,5 @@
+# /etc/conf.d/portmap: config file for /etc/init.d/portmap
+
+# Options for `portmap`.
+# For a full list, just run `portmap -h`.
+#PORTMAP_OPTS="-l"
diff --git a/extra/portmap/portmap.initd b/extra/portmap/portmap.initd
new file mode 100644
index 00000000..65d23d74
--- /dev/null
+++ b/extra/portmap/portmap.initd
@@ -0,0 +1,46 @@
+#!/sbin/runscript
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-nds/portmap/files/portmap.rc6,v 1.12 2007/06/13 07:52:44 vapier Exp $
+
+depend() {
+ use net
+ before inetd
+ before xinetd
+}
+
+start() {
+ ebegin "Starting portmap"
+ start-stop-daemon --start --quiet --exec /sbin/portmap -- ${PORTMAP_OPTS}
+ local ret=$?
+ eend ${ret}
+ # without, if a service depending on portmap is started too fast,
+ # connecting to portmap will fail -- azarah
+ sleep 1
+ return ${ret}
+}
+
+stop() {
+ ebegin "Stopping portmap"
+ start-stop-daemon --stop --quiet --exec /sbin/portmap
+ eend $?
+}
+
+restart() {
+ # Dump the portmapper's table before stopping
+ ebegin "Saving portmap table"
+ local pmap=$(pmap_dump)
+ eend $?
+
+ # Stop and restart portmapper
+ svc_stop
+ sleep 1
+ svc_start
+
+ # Reload the portmapper's table
+ if [ -n "${pmap}" ] ; then
+ ebegin "Reloading portmap table"
+ echo "${pmap}" | pmap_set
+ eend $?
+ fi
+}
diff --git a/extra/portmap/portmap.install b/extra/portmap/portmap.install
new file mode 100644
index 00000000..b0dcfb9c
--- /dev/null
+++ b/extra/portmap/portmap.install
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+adduser -h /dev/null -s /bin/false -D rpc 2>/dev/null || true
diff --git a/extra/postfix/APKBUILD b/extra/postfix/APKBUILD
new file mode 100644
index 00000000..9c135121
--- /dev/null
+++ b/extra/postfix/APKBUILD
@@ -0,0 +1,56 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=postfix
+pkgver=2.5.6
+pkgrel=0
+pkgdesc="Secure and fast drop-in replacement for Sendmail (MTA)"
+url="http://www.postfix.org/"
+license="IPL-1"
+depends="db pcre openssl"
+makedepends="db-dev pcre-dev openssl-dev"
+install=postfix.install
+subpackages="$pkgname-doc"
+source="ftp://ftp.porcupine.org/mirrors/$pkgname-release/official/$pkgname-$pkgver.tar.gz
+ $pkgname.initd
+ $install
+ "
+
+build () {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ sed -i -e "s|#define HAS_NIS|//#define HAS_NIS|g" \
+ -e "/^#define ALIAS_DB_MAP/s|:/etc/aliases|:/etc/postfix/aliases|" \
+ src/util/sys_defs.h || return 1
+ sed -i -e "s:/usr/local/:/usr/:g" conf/master.cf || return 1
+
+ make DEBUG="" \
+ OPT="$CFLAGS" \
+ CCARGS="-DHAS_PCRE -DUSE_TLS -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\"" \
+ AUXLIBS="$LDFLAGS -lpcre -lcrypt -lpthread -lssl -lcrypto" \
+ makefiles || return 1
+ make OPT="$CFLAGS" || return 1
+
+ sh postfix-install \
+ -non-interactive \
+ install_root="$pkgdir" \
+ config_directory=/usr/share/doc/$pkgname/defaults \
+ readme_directory=/usr/share/doc/$pkgname/readme \
+ manpage_directory=/usr/share/man \
+ || return 1
+ for i in postdrop postqueue; do
+ chgrp postdrop "$pkgdir"/usr/sbin/$i
+ chmod g+s "$pkgdir"/usr/sbin/$i
+ done
+
+ mkdir -p "$pkgdir"/etc/postfix
+ mv "$pkgdir"/usr/share/doc/$pkgname/defaults/*.cf \
+ "$pkgdir"/usr/share/doc/$pkgname/defaults/post*-* \
+ "$pkgdir"/usr/share/doc/$pkgname/defaults/aliases \
+ "$pkgdir"/etc/postfix/ || return 1
+
+ install -d -o postfix -g postfix "$pkgdir"/var/spool/postfix
+ install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+ install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/${pkgname}/LICENSE
+}
+md5sums="ec2cb63b53f5f36c3ca91da8f3bc9407 postfix-2.5.6.tar.gz
+8416354d402f3be288fa98b60af86240 postfix.initd
+a62143036f227a7e781b57a97457d180 postfix.install"
diff --git a/extra/postfix/postfix.initd b/extra/postfix/postfix.initd
new file mode 100644
index 00000000..b2396b3a
--- /dev/null
+++ b/extra/postfix/postfix.initd
@@ -0,0 +1,48 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/mail-mta/postfix/files/postfix.rc6.2.5,v 1.3 2008/08/18 14:18:40 falco Exp $
+
+# If you plan to simultaneously use several Postfix instances, don't forget
+# to specify your alternate_config_directories variable in your main main.cf file.
+# Then make a symlink from /etc/init.d/postfix to /etc/init.d/postfix.alt,
+# prepare your new /etc/postfix.alt environment, and at least change these working paths:
+# queue_directory = /var/spool/postfix.alt
+# data_directory = /var/lib/postfix.alt
+
+CONF_DIR="/etc/postfix"
+CONF_OPT="${SVCNAME##*.}"
+if [ -n ${CONF_OPT} -a ${SVCNAME} != "postfix" ]; then
+ CONF_DIR="${CONF_DIR}.${CONF_OPT}"
+fi
+
+opts="${opts} reload"
+
+depend() {
+ use logger dns ypbind amavisd mysql postgresql antivirus postfix_greylist net saslauthd
+ if [ "${SVCNAME}" = "postfix" ]; then
+ provide mta
+ fi
+}
+
+start() {
+ ebegin "Starting postfix (${CONF_DIR})"
+ if [ ! -d ${CONF_DIR} ]; then
+ eend 1 "${CONF_DIR} does not exist"
+ return 1
+ fi
+ /usr/sbin/postfix -c ${CONF_DIR} start >/dev/null 2>&1
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping postfix (${CONF_DIR})"
+ /usr/sbin/postfix -c ${CONF_DIR} stop >/dev/null 2>&1
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading postfix (${CONF_DIR})"
+ /usr/sbin/postfix -c ${CONF_DIR} reload >/dev/null 2>&1
+ eend $?
+}
diff --git a/extra/postfix/postfix.install b/extra/postfix/postfix.install
new file mode 100644
index 00000000..d2d0813a
--- /dev/null
+++ b/extra/postfix/postfix.install
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+case "$1" in
+ pre_install)
+ addgroup postfix 2>/dev/null
+ addgroup postdrop 2>/dev/null
+ adduser postfix -h /var/spool/postfix -G postfix,mail 2>/dev/null
+ ;;
+ post_install)
+ chown postfix /var/spool/postfix/* /var/lib/postfix
+ chgrp postdrop /var/spool/postfix/maildrop /var/spool/postfix/public
+esac
+exit 0
diff --git a/extra/pth/APKBUILD b/extra/pth/APKBUILD
new file mode 100644
index 00000000..ce5cc5e1
--- /dev/null
+++ b/extra/pth/APKBUILD
@@ -0,0 +1,35 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=pth
+pkgver=2.0.7
+pkgrel=0
+pkgdesc="The GNU Portable Threads."
+url="http://www.gnu.org/software/pth"
+license="LGPL-2.1"
+depends="uclibc"
+subpackages="$pkgname-dev $pkgname-doc"
+source="ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz
+ pth-2.0.5-parallelfix.patch
+ pth-2.0.6-ldflags.patch
+ pth-2.0.6-sigstack.patch
+ "
+
+build () {
+ cd "$srcdir"/$pkgname-$pkgver
+
+ for i in ../*.patch; do
+ msg "Applying $i..."
+ patch -p1 < $i || return 1
+ done
+
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --mandir=/usr/share/man
+
+ make || return 1
+ make -j1 DESTDIR="$pkgdir" install
+}
+md5sums="9cb4a25331a4c4db866a31cbe507c793 pth-2.0.7.tar.gz
+7bbd4f3328807c740c86db94e93e48ad pth-2.0.5-parallelfix.patch
+942fa4be28117756cd579937b257b9cc pth-2.0.6-ldflags.patch
+04e43157d758a3dc7925c35e6dd1e39c pth-2.0.6-sigstack.patch"
diff --git a/extra/pth/pth-2.0.5-parallelfix.patch b/extra/pth/pth-2.0.5-parallelfix.patch
new file mode 100644
index 00000000..1c8200a4
--- /dev/null
+++ b/extra/pth/pth-2.0.5-parallelfix.patch
@@ -0,0 +1,15 @@
+--- a/Makefile.in 2005-11-08 05:58:55.000000000 +1100
++++ b/Makefile.in 2005-11-08 06:29:02.000000000 +1100
+@@ -148,10 +148,9 @@
+
+ # be aware of libtool when building the objects
+ .SUFFIXES:
+-.SUFFIXES: .c .o .lo
+-.c.o:
++%.o: %.c $(TARGET_PREQ)
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) $<
+-.c.lo:
++%.lo: %.c $(TARGET_PREQ)
+ $(LIBTOOL) --mode=compile --quiet $(CC) -c $(CPPFLAGS) $(CFLAGS) $<
+
+ # the default target
diff --git a/extra/pth/pth-2.0.6-ldflags.patch b/extra/pth/pth-2.0.6-ldflags.patch
new file mode 100644
index 00000000..7a4a5ab3
--- /dev/null
+++ b/extra/pth/pth-2.0.6-ldflags.patch
@@ -0,0 +1,17 @@
+Index: pth-2.0.6/Makefile.in
+===================================================================
+--- pth-2.0.6.orig/Makefile.in
++++ pth-2.0.6/Makefile.in
+@@ -168,10 +168,10 @@ pth_p.h: $(S)pth_p.h.in
+
+ # build the static and possibly shared libraries
+ libpth.la: $(LOBJS)
+- $(LIBTOOL) --mode=link --quiet $(CC) -o libpth.la $(LOBJS) \
++ $(LIBTOOL) --mode=link --quiet $(CC) $(LDFLAGS) -o libpth.la $(LOBJS) \
+ -rpath $(libdir) -version-info `$(SHTOOL) version -lc -dlibtool $(_VERSION_FILE)`
+ libpthread.la: pthread.lo $(LOBJS)
+- $(LIBTOOL) --mode=link --quiet $(CC) -o libpthread.la pthread.lo $(LOBJS) \
++ $(LIBTOOL) --mode=link --quiet $(CC) $(LDFLAGS) -o libpthread.la pthread.lo $(LOBJS) \
+ -rpath $(libdir) -version-info `$(SHTOOL) version -lc -dlibtool $(_VERSION_FILE)`
+
+ # build the manual pages
diff --git a/extra/pth/pth-2.0.6-sigstack.patch b/extra/pth/pth-2.0.6-sigstack.patch
new file mode 100644
index 00000000..3914dea7
--- /dev/null
+++ b/extra/pth/pth-2.0.6-sigstack.patch
@@ -0,0 +1,22 @@
+diff -urNp pth-2.0.6.old/aclocal.m4 pth-2.0.6/aclocal.m4
+--- pth-2.0.6.old/aclocal.m4 2004-12-31 21:33:19.000000000 +0200
++++ pth-2.0.6/aclocal.m4 2006-09-20 14:46:59.000000000 +0300
+@@ -1522,6 +1522,7 @@ int main(int argc, char *argv[])
+ int sksize;
+ char result[1024];
+ int i;
++exit (1);
+ sksize = 32768;
+ skbuf = (char *)malloc(sksize*2+2*sizeof(union alltypes));
+ if (skbuf == NULL)
+diff -urNp pth-2.0.6.old/configure pth-2.0.6/configure
+--- pth-2.0.6.old/configure 2005-11-22 09:49:21.000000000 +0200
++++ pth-2.0.6/configure 2006-09-20 14:55:23.000000000 +0300
+@@ -24735,6 +24735,7 @@ int main(int argc, char *argv[])
+ int sksize;
+ char result[1024];
+ int i;
++exit (1);
+ sksize = 32768;
+ skbuf = (char *)malloc(sksize*2+2*sizeof(union alltypes));
+ if (skbuf == NULL)
diff --git a/extra/python/APKBUILD b/extra/python/APKBUILD
new file mode 100644
index 00000000..4f5930cd
--- /dev/null
+++ b/extra/python/APKBUILD
@@ -0,0 +1,33 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=python
+pkgver=2.6.1
+pkgrel=0
+pkgdesc="A high-level scripting language"
+url="http://www.python.org"
+license="custom"
+subpackages="$pkgname-dev $pkgname-doc"
+depends="db expat openssl zlib"
+makedepends="db-dev expat-dev openssl-dev zlib-dev"
+source="http://www.$pkgname.org/ftp/$pkgname/$pkgver/Python-$pkgver.tar.bz2
+ $pkgname-2.6-internal-expat.patch
+ "
+
+build() {
+ cd "$srcdir/Python-$pkgver"
+ for i in ../*.patch; do
+ msg "Apply $i"
+ patch -p1 < $i || return 1
+ done
+
+ ./configure --prefix=/usr \
+ --enable-shared \
+ --with-threads \
+ --enable-unicode \
+ --disable-gdbm
+
+ make || return 1
+ make DESTDIR="$pkgdir" install
+ install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+}
+md5sums="e81c2f0953aa60f8062c05a4673f2be0 Python-2.6.1.tar.bz2
+9d64df5e0a6aed149a792c7bff16e3d9 python-2.6-internal-expat.patch"
diff --git a/extra/python/python-2.6-internal-expat.patch b/extra/python/python-2.6-internal-expat.patch
new file mode 100644
index 00000000..f345db8c
--- /dev/null
+++ b/extra/python/python-2.6-internal-expat.patch
@@ -0,0 +1,33 @@
+--- a/setup.py 2008-04-22 12:12:24.613554757 +0300
++++ b/setup.py 2008-04-22 12:13:09.276544063 +0300
+@@ -1035,18 +1035,15 @@
+ #
+ # More information on Expat can be found at www.libexpat.org.
+ #
+- expatinc = os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')
+- define_macros = [
+- ('HAVE_EXPAT_CONFIG_H', '1'),
+- ]
++ # Use system expat
++ expatinc = '/usr/include'
++ define_macros = []
+
+ exts.append(Extension('pyexpat',
+ define_macros = define_macros,
+ include_dirs = [expatinc],
++ libraries = ['expat'],
+ sources = ['pyexpat.c',
+- 'expat/xmlparse.c',
+- 'expat/xmlrole.c',
+- 'expat/xmltok.c',
+ ],
+ ))
+
+@@ -1058,6 +1055,7 @@
+ exts.append(Extension('_elementtree',
+ define_macros = define_macros,
+ include_dirs = [expatinc],
++ libraries = ['expat'],
+ sources = ['_elementtree.c'],
+ ))
+
diff --git a/extra/rsync/APKBUILD b/extra/rsync/APKBUILD
new file mode 100644
index 00000000..294f6cdf
--- /dev/null
+++ b/extra/rsync/APKBUILD
@@ -0,0 +1,36 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=rsync
+pkgver=3.0.5
+pkgrel=0
+pkgdesc="A file transfer program to keep remote files in sync"
+url="http://samba.anu.edu.au/rsync/"
+license="GPL3"
+depends="uclibc"
+source="http://$pkgname.samba.org/ftp/$pkgname/$pkgname-$pkgver.tar.gz
+ rsyncd.initd
+ rsyncd.confd
+ rsyncd.conf
+ rsyncd.logrotate
+ "
+subpackages="$pkgname-doc"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ ./prepare-source || return 1
+ ./configure --prefix=/usr \
+ --with-included-popt \
+ --disable-acl-support \
+ --disable-xattr-support || return 1
+ make || return 1
+ make DESTDIR="$pkgdir" install || return 1
+ install -D -m 755 ../rsyncd.initd ${pkgdir}/etc/init.d/rsyncd
+ install -D -m 644 ../rsyncd.conf ${pkgdir}/etc/rsyncd.conf
+ install -D -m 644 ../rsyncd.confd ${pkgdir}/etc/conf.d/rsyncd
+ install -D -m 644 ../rsyncd.logrotate ${pkgdir}/etc/logrotate.d/rsyncd
+}
+
+md5sums="a130e736c011572cb423b6245e97fc4b rsync-3.0.5.tar.gz
+492d13dbba49a9e7c77c89d01b4f617a rsyncd.initd
+e5e62e8cef29e09c22e8ba8152ec1751 rsyncd.confd
+a99211a14af1766ba849035241cd5bb2 rsyncd.conf
+169cafc6907a4c3787bb0462e9d6a5c2 rsyncd.logrotate"
diff --git a/extra/rsync/rsyncd.conf b/extra/rsync/rsyncd.conf
new file mode 100644
index 00000000..b6dd5994
--- /dev/null
+++ b/extra/rsync/rsyncd.conf
@@ -0,0 +1,10 @@
+# /etc/rsyncd.conf
+
+# Minimal configuration file for rsync daemon
+# See rsync(1) and rsyncd.conf(5) man pages for help
+
+# This line is required by the /etc/init.d/rsyncd script
+pid file = /var/run/rsyncd.pid
+use chroot = yes
+read only = yes
+
diff --git a/extra/rsync/rsyncd.confd b/extra/rsync/rsyncd.confd
new file mode 100644
index 00000000..c3d897ed
--- /dev/null
+++ b/extra/rsync/rsyncd.confd
@@ -0,0 +1,5 @@
+# /etc/conf.d/rsyncd: config file for /etc/init.d/rsyncd
+
+# see man pages for rsync or run `rsync --help`
+# for valid cmdline options
+#RSYNC_OPTS=""
diff --git a/extra/rsync/rsyncd.initd b/extra/rsync/rsyncd.initd
new file mode 100644
index 00000000..1b202822
--- /dev/null
+++ b/extra/rsync/rsyncd.initd
@@ -0,0 +1,23 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/rsync/files/rsyncd.init.d,v 1.5 2007/02/23 11:33:59 uberlord Exp $
+
+depend() {
+ use net
+}
+
+start() {
+ ebegin "Starting rsyncd"
+ start-stop-daemon --start --exec /usr/bin/rsync \
+ --pidfile /var/run/rsyncd.pid \
+ -- --daemon ${RSYNC_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping rsyncd"
+ start-stop-daemon --stop --exec /usr/bin/rsync \
+ --pidfile /var/run/rsyncd.pid
+ eend $?
+}
diff --git a/extra/rsync/rsyncd.logrotate b/extra/rsync/rsyncd.logrotate
new file mode 100644
index 00000000..34bcf72d
--- /dev/null
+++ b/extra/rsync/rsyncd.logrotate
@@ -0,0 +1,9 @@
+/var/log/rsync.log {
+ compress
+ maxage 365
+ rotate 7
+ size=+1024k
+ notifempty
+ missingok
+ copytruncate
+}
diff --git a/extra/run-parts/APKBUILD b/extra/run-parts/APKBUILD
new file mode 100644
index 00000000..1fd3f949
--- /dev/null
+++ b/extra/run-parts/APKBUILD
@@ -0,0 +1,19 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=run-parts
+pkgver=2.30
+pkgrel=0
+pkgdesc="run-parts from the debianutils package"
+url="http://packages.qa.debian.org/d/debianutils.html"
+license="GPL"
+depends="uclibc"
+subpackages="$pkgname-doc"
+source="http://ftp.debian.org/debian/pool/main/d/debianutils/debianutils_$pkgver.tar.gz"
+
+build () {
+ cd $srcdir/debianutils-$pkgver
+ ./configure --prefix=/usr
+ make
+ install -D -m755 run-parts $pkgdir/usr/bin/run-parts
+ install -D -m644 run-parts.8 $pkgdir/usr/share/man/man8/run-parts.8
+}
+md5sums="7fdd5f8395162d8728d4b79e97b9819e debianutils_2.30.tar.gz"
diff --git a/extra/sed/APKBUILD b/extra/sed/APKBUILD
new file mode 100644
index 00000000..ca678eaa
--- /dev/null
+++ b/extra/sed/APKBUILD
@@ -0,0 +1,24 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=sed
+pkgver=4.1.5
+pkgrel=2
+subpackages="$pkgname-doc"
+pkgdesc="GNU stream editor"
+url="http://www.gnu.org/software/sed"
+license="GPL"
+depends="uclibc"
+makedepends=""
+source="ftp://ftp.gnu.org/pub/gnu/$pkgname/$pkgname-$pkgver.tar.gz"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ ./configure --prefix=/usr \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --disable-i18n \
+ --disable-nls
+ make || return 1
+ make DESTDIR="$pkgdir" install
+}
+
+md5sums="7a1cbbbb3341287308e140bd4834c3ba sed-4.1.5.tar.gz"
diff --git a/extra/sic/APKBUILD b/extra/sic/APKBUILD
new file mode 100644
index 00000000..72e197ea
--- /dev/null
+++ b/extra/sic/APKBUILD
@@ -0,0 +1,20 @@
+# Contributor: Natanael Copa <ncopa@alpinelinux.org>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=sic
+pkgver=1.0
+pkgrel=0
+pkgdesc="an extremely simple IRC client"
+url="http://www.suckless.org/programs/sic.html"
+license="GPL"
+depends="uclibc"
+subpackages="$pkgname-doc"
+source="http://code.suckless.org/dl/tools/sic-$pkgver.tar.gz"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ make PREFIX=/usr || return 1
+ make DESTDIR="$pkgdir" PREFIX=/usr install
+}
+
+md5sums="d73d07d5de3ea06e9e83b90d26749202 sic-1.0.tar.gz"
diff --git a/extra/sntpc/APKBUILD b/extra/sntpc/APKBUILD
new file mode 100644
index 00000000..b1315e06
--- /dev/null
+++ b/extra/sntpc/APKBUILD
@@ -0,0 +1,26 @@
+# Contributor: Natanael Copa <ncopa@alpinelinux.org>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=sntpc
+pkgver=0.9
+pkgrel=0
+pkgdesc="Simple NTP client"
+url="http://dev.alpinelinux.org/cgit/cgit.cgi/sntpc"
+license="GPL-2"
+depends="uclibc"
+source="http://dev.alpinelinux.org/cgit/cgit.cgi/sntpc/snapshot/sntpc-0.9.tar.bz2
+ sntpc.initd
+ sntpc.confd
+ "
+
+build() {
+ cd "$srcdir/$pkgname"
+
+ make || return 1
+ install -m755 -D sntpc "$pkgdir"/usr/sbin/sntpc
+ install -m755 -D "$srcdir"/sntpc.initd "$pkgdir"/etc/init.d/sntpc
+ install -m644 -D "$srcdir"/sntpc.confd "$pkgdir"/etc/conf.d/sntpc
+}
+
+md5sums="f42fb17ef688e0cea7e0267b1ec837ee sntpc-0.9.tar.bz2
+c5018237685af2cddb0b4ede1751bee1 sntpc.initd
+4ea1ceee01f94080be86188bde8f9adc sntpc.confd"
diff --git a/extra/sntpc/sntpc.confd b/extra/sntpc/sntpc.confd
new file mode 100644
index 00000000..a92e4be8
--- /dev/null
+++ b/extra/sntpc/sntpc.confd
@@ -0,0 +1,9 @@
+#
+# Set time sync interval (in seconds) here.
+# Setting SNTPC_INTERVAL to 0 will make sntp run once and just exit
+#
+
+SNTPC_INTERVAL="0"
+
+# The NTP server to use as time source
+SNTPC_HOST=pool.ntp.org
diff --git a/extra/sntpc/sntpc.initd b/extra/sntpc/sntpc.initd
new file mode 100644
index 00000000..a97e51bd
--- /dev/null
+++ b/extra/sntpc/sntpc.initd
@@ -0,0 +1,30 @@
+#!/sbin/runscript
+
+NAME=sntpc
+DAEMON=/usr/sbin/$NAME
+
+depend() {
+ need net
+}
+
+start() {
+ local msg opts
+ if [ "$SNTPC_INTERVAL" = "0" ]; then
+ msg="Setting time from NTP source"
+ else
+ msg="Starting ${NAME}"
+ opts="-d"
+ fi
+ ebegin "$msg"
+ start-stop-daemon --start --quiet --name sntpc \
+ --exec ${DAEMON} -- \
+ -i ${SNTPC_INTERVAL} $opts ${SNTPC_HOST}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${NAME}"
+ start-stop-daemon --stop --quiet \
+ --exec ${DAEMON}
+ eend $?
+}
diff --git a/extra/sqlite/APKBUILD b/extra/sqlite/APKBUILD
new file mode 100644
index 00000000..dd4ac36e
--- /dev/null
+++ b/extra/sqlite/APKBUILD
@@ -0,0 +1,31 @@
+# Maintainer: Carlo Landmeter <clandmeter at gmail>
+pkgname=sqlite
+pkgver=3.6.10
+pkgrel=0
+pkgdesc="A C library that implements an SQL database engine"
+url="http://www.sqlite.org/"
+license="custom"
+depends=""
+makedepends=""
+source="http://www.sqlite.org/$pkgname-$pkgver.tar.gz
+ license.txt"
+
+subpackages="$pkgname-doc $pkgname-dev"
+
+build ()
+{
+ cd ${srcdir}/${pkgname}-${pkgver}
+ ./configure --prefix=/usr \
+ --enable-threadsafe \
+ --disable-static \
+ --disable-tcl \
+ --disable-readline \
+ || return 1
+ make || return 1
+ make DESTDIR=${pkgdir} install || return 1
+ install -Dm0644 sqlite3.1 ${pkgdir}/usr/share/man/man1/sqlite3.1
+ install -Dm644 ${srcdir}/license.txt ${pkgdir}/usr/share/licenses/${pkgname}/license.txt
+}
+
+md5sums="a03bdc86df4025b6881d58557e4b5bd3 sqlite-3.6.10.tar.gz
+c1cdbc5544034d9012e421e75a5e4890 license.txt"
diff --git a/extra/sqlite/license.txt b/extra/sqlite/license.txt
new file mode 100644
index 00000000..118c5d5e
--- /dev/null
+++ b/extra/sqlite/license.txt
@@ -0,0 +1,33 @@
+SQLite Copyright
+SQLite is in the
+Public Domain
+
+
+All of the deliverable code in SQLite has been dedicated to the public domain by the authors. All code authors, and representatives of the companies they work for, have signed affidavits dedicating their contributions to the public domain and originals of those signed affidavits are stored in a firesafe at the main offices of Hwaci. Anyone is free to copy, modify, publish, use, compile, sell, or distribute the original SQLite code, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
+
+The previous paragraph applies to the deliverable code in SQLite - those parts of the SQLite library that you actually bundle and ship with a larger application. Portions of the documentation and some code used as part of the build process might fall under other licenses. The details here are unclear. We do not worry about the licensing of the documentation and build code so much because none of these things are part of the core deliverable SQLite library.
+
+All of the deliverable code in SQLite has been written from scratch. No code has been taken from other projects or from the open internet. Every line of code can be traced back to its original author, and all of those authors have public domain dedications on file. So the SQLite code base is clean and is uncontaminated with licensed code from other projects.
+Obtaining An Explicit License To Use SQLite
+
+Even though SQLite is in the public domain and does not require a license, some users want to obtain a license anyway. Some reasons for obtaining a license include:
+You are using SQLite in a jurisdiction that does not recognize the public domain.
+You are using SQLite in a jurisdiction that does not recognize the right of an author to dedicate their work to the public domain.
+You want to hold a tangible legal document as evidence that you have the legal right to use and distribute SQLite.
+Your legal department tells you that you have to purchase a license.
+
+If you feel like you really have to purchase a license for SQLite, Hwaci, the company that employs the architect and principal developers of SQLite, will sell you one.
+Contributed Code
+
+In order to keep SQLite completely free and unencumbered by copyright, all new contributors to the SQLite code base are asked to dedicate their contributions to the public domain. If you want to send a patch or enhancement for possible inclusion in the SQLite source tree, please accompany the patch with the following statement:
+The author or authors of this code dedicate any and all copyright interest in this code to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this code under copyright law.
+
+We are not able to accept patches or changes to SQLite that are not accompanied by a statement such as the above. In addition, if you make changes or enhancements as an employee, then a simple statement such as the above is insufficient. You must also send by surface mail a copyright release signed by a company officer. A signed original of the copyright release should be mailed to:
+Hwaci
+6200 Maple Cove Lane
+Charlotte, NC 28269
+USA
+
+A template copyright release is available in PDF or HTML. You can use this release to make future changes.
+
+see http://www.sqlite.org/copyright.html \ No newline at end of file
diff --git a/extra/ssmtp/APKBUILD b/extra/ssmtp/APKBUILD
new file mode 100644
index 00000000..2f63b689
--- /dev/null
+++ b/extra/ssmtp/APKBUILD
@@ -0,0 +1,32 @@
+#Contributor: Leonardo Arena <rnalrd@gmail.com>
+pkgname=ssmtp
+pkgver=2.62
+pkgrel=0
+pkgdesc="Extremely simple MTA to get mail off the system to a mail hub"
+subpackages="$pkgname-doc"
+arch=""
+url="http://packages.debian.org/source/lenny/ssmtp"
+license="GPL-2"
+depends="uclibc"
+makedepends="openssl-dev"
+install=
+source="http://ftp.debian.org/debian/pool/main/s/$pkgname/${pkgname}_${pkgver}.orig.tar.gz
+ CVE-2008-3962.patch
+ generate_config.patch"
+
+build() {
+ cd "$srcdir/$pkgname"
+ patch generate_config ../../generate_config.patch
+ sed -i -e 's:$(CC) -o:$(CC) @LDFLAGS@ -o:' Makefile.in
+ patch -p1 ssmtp.c ../../CVE-2008-3962.patch
+
+ ./configure --prefix=/usr \
+ --mandir=/usr/share/man \
+ --sysconfdir=/etc \
+ --enable-ssl
+ make || return 1
+ make prefix="$pkgdir"/usr etcdir="$pkgdir"/etc mandir="$pkgdir"/usr/share/man install
+}
+md5sums="257ac04e62ab7e3616e220333a1140cb ssmtp_2.62.orig.tar.gz
+18f0686f1b8888d187f06dcff3b6212a CVE-2008-3962.patch
+c70c395fe71589ca8b10b666455d5071 generate_config.patch"
diff --git a/extra/ssmtp/CVE-2008-3962.patch b/extra/ssmtp/CVE-2008-3962.patch
new file mode 100644
index 00000000..fca144fa
--- /dev/null
+++ b/extra/ssmtp/CVE-2008-3962.patch
@@ -0,0 +1,14 @@
+--- ssmtp.orig/ssmtp.c
++++ ssmtp/ssmtp.c
+@@ -485,6 +485,11 @@ char *from_format(char *str, bool_t over
+ die("from_format() -- snprintf() failed");
+ }
+ }
++ else {
++ if(snprintf(buf, BUF_SZ, "%s", str) == -1) {
++ die("from_format() -- snprintf() failed");
++ }
++ }
+ }
+
+ #if 0
diff --git a/extra/ssmtp/generate_config.patch b/extra/ssmtp/generate_config.patch
new file mode 100644
index 00000000..dd4baf9f
--- /dev/null
+++ b/extra/ssmtp/generate_config.patch
@@ -0,0 +1,49 @@
+--- src/ssmtp/generate_config 2004-07-23 05:58:48.000000000 +0000
++++ generate_config 2009-01-27 10:09:11.000000000 +0000
+@@ -4,7 +4,7 @@
+ # Figure out the system's mailname
+ #
+
+-syshostname=`hostname --fqdn`
++syshostname="localhost"
+ if test -f /etc/mailname
+ then
+ mailname="`head -1 /etc/mailname`"
+@@ -15,23 +15,7 @@
+ mailname=$syshostname
+ fi
+
+-echo "Please enter the mail name of your system."
+-echo "This is the hostname portion of the address to be shown"
+-echo "on outgoing news and mail messages headers."
+-echo "The default is $syshostname, your system's host name."
+-echo
+-echo -n "Mail name [$syshostname]: "
+-read mailname
+-echo
+-
+-echo -n "Please enter the SMTP port number [25]: "
+-read smtpport
+-if test -z "$smtpport"
+-then
+- mailhub=$mailhub
+-else
+- mailhub="$mailhub:$smtpport"
+-fi
++mailhub="$mailhub:$smtpport"
+
+ #
+ # Generate configuration file
+@@ -56,11 +40,5 @@
+ # Where will the mail seem to come from?
+ #rewriteDomain=`echo -n $mailname`
+ # The full hostname
+-hostname=`hostname --fqdn`
++#hostname="localhost"
+ EOF
+-
+-echo
+-echo
+-echo "Please check the configuration file $1 for correctness."
+-echo
+-echo
diff --git a/extra/strace/APKBUILD b/extra/strace/APKBUILD
new file mode 100644
index 00000000..eb1f88c2
--- /dev/null
+++ b/extra/strace/APKBUILD
@@ -0,0 +1,20 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=strace
+pkgver=4.5.18
+pkgrel=0
+pkgdesc="A useful diagnositic, instructional, and debugging tool"
+url="http://sourceforge.net/projects/strace/"
+license="BSD"
+depends="uclibc"
+source="http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.bz2"
+subpackages="$pkgname-doc"
+
+build ()
+{
+ cd "$srcdir/$pkgname-$pkgver"
+ ./configure --prefix=/usr \
+
+ make || return 1
+ make -j1 DESTDIR="$pkgdir" install
+}
+md5sums="e9449fcee97e6a8ed73934c883c870e0 strace-4.5.18.tar.bz2"
diff --git a/extra/subversion/APKBUILD b/extra/subversion/APKBUILD
new file mode 100644
index 00000000..4cbcc527
--- /dev/null
+++ b/extra/subversion/APKBUILD
@@ -0,0 +1,38 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=subversion
+pkgver=1.5.5
+pkgrel=0
+pkgdesc="Replacement for CVS, another versioning system (svn)"
+url="http://subversion.tigris.org/"
+license="apache bsd"
+depends="apr apr-util expat neon openssl uclibc zlib"
+makedepends="apr-dev apr-util-dev expat-dev neon-dev openssl-dev zlib-dev
+ e2fsprogs-dev libuuid"
+install="$pkgname.install"
+subpackages="$pkgname-dev $pkgname-doc"
+source="http://svn.collab.net/tarballs/$pkgname-$pkgver.tar.gz
+ svnserve.confd
+ svnserve.initd
+ $install
+ "
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr \
+ --disable-nls \
+ --without-apxs \
+ --disable-javahl \
+ --without-jdk
+
+ make external-all || return 1
+ make local-all || return 1
+ make -j1 DESTDIR="$pkgdir" install || return 1
+
+ install -Dm755 "$srcdir"/svnserve.initd "$pkgdir"/etc/init.d/svnserve
+ install -Dm644 "$srcdir"/svnserve.confd "$pkgdir"/etc/conf.d/svnserve
+}
+md5sums="532c7d49b3cd33d712289a5ef03b7749 subversion-1.5.5.tar.gz
+d084a7558053784886bc858b94fa9186 svnserve.confd
+06cf9328f63a935654971052a2c3594a svnserve.initd
+517b0819f3544df9dbee1f90f4289f34 subversion.install"
diff --git a/extra/subversion/subversion.install b/extra/subversion/subversion.install
new file mode 100644
index 00000000..b61563cc
--- /dev/null
+++ b/extra/subversion/subversion.install
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+case "$1" in
+ pre_install)
+ addgroup svnusers 2>/dev/null
+ adduser svn -D -h /var/svn -G svnusers 2>/dev/null
+ ;;
+esac
+exit 0
+
diff --git a/extra/subversion/svnserve.confd b/extra/subversion/svnserve.confd
new file mode 100644
index 00000000..b487a409
--- /dev/null
+++ b/extra/subversion/svnserve.confd
@@ -0,0 +1,10 @@
+# The commented variables in this file are the defaults that are used
+# in the init-script. You don't need to uncomment them except to
+# customize them to different values.
+
+# Options for svnserve
+#SVNSERVE_OPTS="--root=/var/svn"
+
+# User and group as which to run svnserve
+SVNSERVE_USER="svn"
+SVNSERVE_GROUP="svnusers"
diff --git a/extra/subversion/svnserve.initd b/extra/subversion/svnserve.initd
new file mode 100644
index 00000000..036d0187
--- /dev/null
+++ b/extra/subversion/svnserve.initd
@@ -0,0 +1,44 @@
+#!/sbin/runscript
+# Copyright 2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Header: /var/cvsroot/gentoo-x86/dev-util/subversion/files/svnserve.initd,v 1.2 2005/08/25 13:59:48 pauldv Exp $
+
+opts="$opts setup"
+
+depend() {
+ need net
+}
+
+start() {
+ ebegin "Starting svnserve"
+ # Ensure that we run from a readable working dir, and that we do not
+ # lock filesystems when being run from such a location.
+ cd /
+ start-stop-daemon --start --quiet --background --make-pidfile \
+ --pidfile /var/run/svnserve.pid --exec /usr/bin/svnserve \
+ --chuid ${SVNSERVE_USER:-apache}:${SVNSERVE_GROUP:-apache} -- \
+ --foreground --daemon ${SVNSERVE_OPTS:---root=/var/svn}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping svnserve"
+ start-stop-daemon --stop --quiet --pidfile /var/run/svnserve.pid
+ eend $?
+}
+
+setup() {
+ local root=${SVNSERVE_ROOT:-/var/svn}
+ ebeging "Setting up svnserve repositories in $root"
+ if [ -e "$root/repos" ]; then
+ eend 1 "$root/repos already exist"
+ return 1
+ fi
+
+ svnadmin create "$root"/repos
+ chown -Rf "${SVNSERVE_USER}:${SVNSERVE_GROUP}" "$root/repos"
+ mkdir -p "$root/conf"
+ chmod -Rf go-rwx "$root/conf"
+ chmod -Rf o-rwx "$root/repos"
+ eend $?
+}
diff --git a/extra/tar/APKBUILD b/extra/tar/APKBUILD
new file mode 100644
index 00000000..fcf1f82f
--- /dev/null
+++ b/extra/tar/APKBUILD
@@ -0,0 +1,22 @@
+# Maintainer: Carlo Landmeter <clandmeter at gmail.com>
+pkgname=tar
+pkgver=1.21
+pkgrel=0
+pkgdesc="Utility used to store, backup, and transport files"
+url="http://www.gnu.org"
+license='GPL'
+depends="uclibc"
+makedepends=""
+source="ftp://ftp.gnu.org/gnu/tar/$pkgname-$pkgver.tar.gz"
+subpackages="$pkgname-doc"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr \
+ --mandir=/usr/share/man
+ make || return 1
+ make DESTDIR="$pkgdir/" install
+}
+
+md5sums="e7ae56b3bf924d5108b57b544b247c50 tar-1.21.tar.gz"
diff --git a/extra/tcl/APKBUILD b/extra/tcl/APKBUILD
new file mode 100644
index 00000000..12205b0f
--- /dev/null
+++ b/extra/tcl/APKBUILD
@@ -0,0 +1,33 @@
+# Maintainer: Carlo Landmeter <clandmeter at gmail.com>
+pkgname=tcl
+pkgver=8.5.6
+pkgrel=0
+pkgdesc="The Tcl scripting language"
+url="http://tcl.sourceforge.net/"
+license="custom"
+depends="uclibc"
+makedepends=""
+source="http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname$pkgver-src.tar.gz"
+subpackages="$pkgname-doc $pkgname-dev"
+
+build ()
+{
+ cd ${srcdir}/tcl${pkgver}/unix
+ ./configure --prefix=/usr \
+ --mandir=/usr/share/man \
+ --disable-64bit
+ make || return 1
+ make INSTALL_ROOT=${pkgdir} install install-private-headers
+ ln -sf tclsh8.5 ${pkgdir}/usr/bin/tclsh
+ install -Dm644 ../license.terms ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
+ sed -i \
+ -e "s,^TCL_BUILD_LIB_SPEC='-L.*/unix,TCL_BUILD_LIB_SPEC='-L/usr/lib," \
+ -e "s,^TCL_SRC_DIR='.*',TCL_SRC_DIR='/usr/include'," \
+ -e "s,^TCL_BUILD_STUB_LIB_SPEC='-L.*/unix,TCL_BUILD_STUB_LIB_SPEC='-L/usr/lib," \
+ -e "s,^TCL_BUILD_STUB_LIB_PATH='.*/unix,TCL_BUILD_STUB_LIB_PATH='/usr/lib," \
+ -e "s,^TCL_LIB_FILE='libtcl8.5..TCL_DBGX..so',TCL_LIB_FILE=\"libtcl8.5\$\{TCL_DBGX\}.so\"," \
+ -e "s,^TCL_CC_SEARCH_FLAGS='\(.*\)',TCL_CC_SEARCH_FLAGS='\1:/usr/lib'," \
+ -e "s,^TCL_LD_SEARCH_FLAGS='\(.*\)',TCL_LD_SEARCH_FLAGS='\1:/usr/lib'," \
+ ${pkgdir}/usr/lib/tclConfig.sh
+}
+md5sums="d0b0b3ff7600ff63135c710b575265cd tcl8.5.6-src.tar.gz"
diff --git a/extra/tcpdump/APKBUILD b/extra/tcpdump/APKBUILD
new file mode 100644
index 00000000..ad9f5323
--- /dev/null
+++ b/extra/tcpdump/APKBUILD
@@ -0,0 +1,24 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=tcpdump
+pkgver=4.0.0
+pkgrel=1
+pkgdesc="A tool for network monitoring and data acquisition"
+url="http://www.tcpdump.org"
+license="BSD"
+depends="libpcap openssl"
+makedepends="libpcap-dev openssl-dev"
+source="http://www.$pkgname.org/release/$pkgname-$pkgver.tar.gz"
+subpackages="$pkgname-doc"
+
+build ()
+{
+ cd "$srcdir/$pkgname-$pkgver"
+ ./configure --prefix=/usr \
+ --mandir=/usr/share/man \
+ --enable-ipv6
+ make || return 1
+ make DESTDIR="$pkgdir" install
+ rm -f "$pkgdir"/usr/sbin/tcpdump.4*
+}
+
+md5sums="b22ca72890df2301d922c9f2d17867f9 tcpdump-4.0.0.tar.gz"
diff --git a/extra/transmission/APKBUILD b/extra/transmission/APKBUILD
new file mode 100644
index 00000000..e2fe39a7
--- /dev/null
+++ b/extra/transmission/APKBUILD
@@ -0,0 +1,40 @@
+# Maintainer:Carlo Landmeter
+pkgname=transmission
+pkgver=1.34
+pkgel=0
+pkgdesc="Fast, easy, and fee BitToent client (CLI tools daemon and webinterface)"
+url="http://www.tansmissionbt.com"
+install=transmission.install
+license="MIT"
+depends="curl"
+makedepends="openssl-dev pkgconfig curl-dev"
+source="http://download.m0k.org/transmission/files/transmission-$pkgver.tar.bz2
+ transmission-1.34-configure-no-nls.patch
+ transmission-daemon.initd
+ transmission-daemon.confd
+ transmission.install
+ "
+subpackages="$pkgname-doc"
+
+build() {
+ cd $srcdir/$pkgname-$pkgver
+
+ for i in ../*.patch; do
+ msg "Applying ${i##*/}"
+ patch -p1 -i $i || return 1
+ done
+
+ ./configure --prefix=/usr \
+ --mandir=/usr/share/man \
+ --disable-gtk \
+ --disable-nls
+ make || return 1
+ make prefix="$pkgdir"/usr mandir="$pkgdir"/usr/share/man install
+ install -D -m755 "$srcdir"/transmission-daemon.initd "$pkgdir"/etc/init.d/transmission-daemon
+ install -D -m644 "$srcdir"/transmission-daemon.confd "$pkgdir"/etc/conf.d/transmission-daemon
+}
+md5sums="c4ef93639bcb895c1b3d279b2f4e27b3 transmission-1.34.tar.bz2
+44b65993bb089851976386853e4128df transmission-1.34-configure-no-nls.patch
+b3b921242bdc3b33a8ac05fc30653b6c transmission-daemon.initd
+89478a70fcd93463e1dd8d751da994da transmission-daemon.confd
+4e338c4f7c902e132707b9e87b9bf1b5 transmission.install"
diff --git a/extra/transmission/transmission-1.34-configure-no-nls.patch b/extra/transmission/transmission-1.34-configure-no-nls.patch
new file mode 100644
index 00000000..551d6246
--- /dev/null
+++ b/extra/transmission/transmission-1.34-configure-no-nls.patch
@@ -0,0 +1,47 @@
+--- transmission-1.34.orig/configure Fri Nov 28 15:54:27 2008
++++ transmission-1.34/configure Fri Nov 28 15:57:05 2008
+@@ -23735,22 +23735,7 @@
+ ;;
+ esac
+
+-if test -n "0.23"; then
+- { echo "$as_me:$LINENO: checking for intltool >= 0.23" >&5
+-echo $ECHO_N "checking for intltool >= 0.23... $ECHO_C" >&6; }
+
+- INTLTOOL_REQUIRED_VERSION_AS_INT=`echo 0.23 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
+- INTLTOOL_APPLIED_VERSION=`awk -F\" '/\\$VERSION / { print $ 2; }' ${ac_aux_dir}/intltool-update.in`
+- INTLTOOL_APPLIED_VERSION_AS_INT=`awk -F\" '/\\$VERSION / { split($ 2, VERSION, "."); print VERSION[1] * 1000 + VERSION[2] * 100 + VERSION[3];}' ${ac_aux_dir}/intltool-update.in`
+-
+- { echo "$as_me:$LINENO: result: $INTLTOOL_APPLIED_VERSION found" >&5
+-echo "${ECHO_T}$INTLTOOL_APPLIED_VERSION found" >&6; }
+- test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" ||
+- { { echo "$as_me:$LINENO: error: Your intltool is too old. You need intltool 0.23 or later." >&5
+-echo "$as_me: error: Your intltool is too old. You need intltool 0.23 or later." >&2;}
+- { (exit 1); exit 1; }; }
+-fi
+-
+ INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
+ INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
+ INTLTOOL_KEYS_RULE='%.keys: %.keys.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
+@@ -23909,21 +23894,6 @@
+ else
+ { echo "$as_me:$LINENO: result: no" >&5
+ echo "${ECHO_T}no" >&6; }
+-fi
+-
+-
+-if test -z "$XGETTEXT" -o -z "$MSGMERGE" -o -z "$MSGFMT"; then
+- { { echo "$as_me:$LINENO: error: GNU gettext tools not found; required for intltool" >&5
+-echo "$as_me: error: GNU gettext tools not found; required for intltool" >&2;}
+- { (exit 1); exit 1; }; }
+-fi
+-xgversion="`$XGETTEXT --version|grep '(GNU ' 2> /dev/null`"
+-mmversion="`$MSGMERGE --version|grep '(GNU ' 2> /dev/null`"
+-mfversion="`$MSGFMT --version|grep '(GNU ' 2> /dev/null`"
+-if test -z "$xgversion" -o -z "$mmversion" -o -z "$mfversion"; then
+- { { echo "$as_me:$LINENO: error: GNU gettext tools not found; required for intltool" >&5
+-echo "$as_me: error: GNU gettext tools not found; required for intltool" >&2;}
+- { (exit 1); exit 1; }; }
+ fi
+
+ # Use the tools built into the package, not the ones that are installed.
diff --git a/extra/transmission/transmission-daemon.confd b/extra/transmission/transmission-daemon.confd
new file mode 100644
index 00000000..c1f338f0
--- /dev/null
+++ b/extra/transmission/transmission-daemon.confd
@@ -0,0 +1,18 @@
+#
+# transmission-daemon options
+#
+# -a --acl <list> Access Control List. (Default: +127.0.0.1)
+# -b --blocklist Enable peer blocklists
+# -B --no-blocklist Disable peer blocklists
+# -f --foreground Run in the foreground instead of daemonizing
+# -g --config-dir <path> Where to look for configuration files
+# -p --port <port> RPC port (Default: 9091)
+# -t --auth Require authentication
+# -T --no-auth Don't require authentication
+# -u --username <username> Set username for authentication
+# -v --password <password> Set password for authentication
+# -w --download-dir <path> Where to save downloaded data
+#
+# NOTE: webif does not work without the -f switch
+#
+TD_OPTS="-f -g /var/lib/transmission/.config -w /var/lib/transmission"
diff --git a/extra/transmission/transmission-daemon.initd b/extra/transmission/transmission-daemon.initd
new file mode 100644
index 00000000..af9461cc
--- /dev/null
+++ b/extra/transmission/transmission-daemon.initd
@@ -0,0 +1,21 @@
+#!/sbin/runscript
+
+depend() {
+ need net
+}
+
+start() {
+ ebegin "Starting transmission-daemon"
+ start-stop-daemon --start --quiet --background --make-pidfile \
+ --chuid transmission:transmission \
+ --pidfile /var/run/transmission-daemon.pid \
+ --exec /usr/bin/transmission-daemon -- ${TD_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping transmission-daemon"
+ start-stop-daemon --stop --quiet \
+ --pidfile /var/run/transmission-daemon.pid \
+ eend $?
+}
diff --git a/extra/transmission/transmission.install b/extra/transmission/transmission.install
new file mode 100644
index 00000000..870b5e29
--- /dev/null
+++ b/extra/transmission/transmission.install
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+case $1 in
+ pre_install)
+ adduser -h /var/lib/transmission -s /bin/false -D transmission 2>/dev/null
+ ;;
+esac
+
+exit 0
diff --git a/extra/uiconv/APKBUILD b/extra/uiconv/APKBUILD
new file mode 100644
index 00000000..3814bb56
--- /dev/null
+++ b/extra/uiconv/APKBUILD
@@ -0,0 +1,17 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=uiconv
+pkgver=0.3
+pkgrel=0
+pkgdesc="Micro iconv implementation"
+url="http://git.alpinelinux.org/cgit/uiconv"
+license="GPL"
+depends="uclibc"
+source="http://git.alpinelinux.org/cgit/$pkgname/snapshots/$pkgname-$pkgver.tar.bz2"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ make || return 1
+ make DESTDIR="$pkgdir" PREFIX=/usr/uiconv install
+}
+
+md5sums="5cd7f80085324d08cb976fec674cd98d uiconv-0.3.tar.bz2"
diff --git a/extra/unfs3/APKBUILD b/extra/unfs3/APKBUILD
new file mode 100644
index 00000000..28de3015
--- /dev/null
+++ b/extra/unfs3/APKBUILD
@@ -0,0 +1,22 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=unfs3
+pkgver=0.9.22
+pkgrel=0
+pkgdesc="a user-space implementation of the NFSv3 server specification"
+url="http://unfs3.sourceforge.net/"
+license='GPL'
+depends="uclibc"
+makedepends="flex"
+source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz"
+subpackages="$pkgname-doc"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr \
+ --mandir=/usr/share/man
+ make -j1 || return 1
+ make DESTDIR="$pkgdir/" install
+}
+
+md5sums="ddf679a5d4d80096a59f3affc64f16e5 unfs3-0.9.22.tar.gz"
diff --git a/extra/valgrind/APKBUILD b/extra/valgrind/APKBUILD
new file mode 100644
index 00000000..a84f8bab
--- /dev/null
+++ b/extra/valgrind/APKBUILD
@@ -0,0 +1,36 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=valgrind
+pkgver=3.4.0
+pkgrel=0
+pkgdesc="A tool to help find memory-management problems in programs"
+url="http://valgrind.org/"
+license="GPL"
+depends="uclibc"
+# it seems like busybox sed works but the configure script requires GNU sed
+makedepends="sed"
+subpackages="$pkgname-dev $pkgname-doc"
+source="http://$pkgname.org/downloads/$pkgname-$pkgver.tar.bz2
+ $pkgname-3.4.0-uclibc.patch
+ "
+
+build() {
+ local i
+ cd "$srcdir/$pkgname-$pkgver"
+ for i in ../*.patch; do
+ msg "Applying $i"
+ patch -p1 < $i || return 1
+ done
+
+ # make sure our CFLAGS are respected
+ sed -e 's:^CFLAGS="-Wno-long-long":CFLAGS="$CFLAGS -Wno-long-long":' \
+ -i configure.in
+ ./configure --prefix=/usr \
+ --without-mpicc \
+ --mandir=/usr/share/man || return 1
+
+ make || return 1
+ make DESTDIR="$pkgdir" install || return 1
+}
+
+md5sums="1b0fe1219e1a583ff8c2db54ed2265e6 valgrind-3.4.0.tar.bz2
+37bc90d0783bc0f8ba5754c8407e3dcc valgrind-3.4.0-uclibc.patch"
diff --git a/extra/valgrind/valgrind-3.4.0-uclibc.patch b/extra/valgrind/valgrind-3.4.0-uclibc.patch
new file mode 100644
index 00000000..db655199
--- /dev/null
+++ b/extra/valgrind/valgrind-3.4.0-uclibc.patch
@@ -0,0 +1,12 @@
+--- valgrind-3.4.0/drd/drd_pthread_intercepts.c.orig Thu Jan 22 14:37:52 2009
++++ valgrind-3.4.0/drd/drd_pthread_intercepts.c Thu Jan 22 14:38:12 2009
+@@ -122,9 +122,6 @@
+ /* PTHREAD_MUTEX_TIMED_NP */
+ /* PTHREAD_MUTEX_NORMAL */
+ case PTHREAD_MUTEX_DEFAULT:
+-#if defined(HAVE_PTHREAD_MUTEX_ADAPTIVE_NP)
+- case PTHREAD_MUTEX_ADAPTIVE_NP:
+-#endif
+ return mutex_type_default_mutex;
+ }
+ return mutex_type_invalid_mutex;
diff --git a/extra/vim/APKBUILD b/extra/vim/APKBUILD
new file mode 100644
index 00000000..a6091b3f
--- /dev/null
+++ b/extra/vim/APKBUILD
@@ -0,0 +1,211 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=vim
+_srcver=7.2
+_patchver=079
+pkgver=$_srcver.$_patchver
+pkgrel=1
+pkgdesc="advanced text editor"
+url="http://www.vim.org"
+license='GPL'
+depends="ncurses ncurses-terminfo"
+makedepends="ncurses-dev"
+subpackages="$pkgname-doc"
+
+# those patches dont apply. exclude them
+_patchexclude="007 036 041 049 071 072 074"
+
+# use "abuild patchlist >> APKBUILD" to generate the list of patches
+source="ftp://ftp.vim.org/pub/vim/unix/vim-7.2.tar.bz2
+ vimrc
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.001
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.002
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.003
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.004
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.005
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.006
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.008
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.009
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.010
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.011
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.012
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.013
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.014
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.015
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.016
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.017
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.018
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.019
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.020
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.021
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.022
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.023
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.024
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.025
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.026
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.027
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.028
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.029
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.030
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.031
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.032
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.033
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.034
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.035
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.037
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.038
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.039
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.040
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.042
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.043
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.044
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.045
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.046
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.047
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.048
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.050
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.051
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.052
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.053
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.054
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.055
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.056
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.057
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.058
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.059
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.060
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.061
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.062
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.063
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.064
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.065
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.066
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.067
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.068
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.069
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.070
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.073
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.075
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.076
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.077
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.078
+ ftp://ftp.vim.org/pub/vim/patches/7.2/7.2.079
+ "
+
+# this function is only for generating the patches list
+excluded() {
+ local i
+ for i in $_patchexclude; do
+ if [ "$1" = "$i" ]; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+# this generates the patches list
+patchlist() {
+ local i j
+ for i in $(seq 1 $_patchver); do
+ local v=$(printf "%0.3i" $i)
+ if excluded $v; then
+ continue
+ fi
+ echo -e "\tftp://ftp.vim.org/pub/vim/patches/7.2/$_srcver.$v"
+ done
+}
+
+
+build() {
+ local i
+ cd "$srcdir/${pkgname}72"
+
+ for i in ../"$_srcver".* ; do
+ msg "Applying ${i##*/}"
+ patch -p0 < $i || return 1
+ done
+
+ # Read vimrc from /etc/vim
+ echo '#define SYS_VIMRC_FILE "/etc/vim/vimrc"' >> src/feature.h
+
+ ./configure --prefix=/usr \
+ --without-x \
+ --disable-nls
+ make || return 1
+ make DESTDIR="$pkgdir/" install
+ install -D "$srcdir"/vimrc "$pkgdir"/etc/vim/vimrc
+}
+
+md5sums="f0901284b338e448bfd79ccca0041254 vim-7.2.tar.bz2
+97aecde2ab504e543a96bec84b3b5638 vimrc
+7c2dc4a956cf315e546e347bc349968c 7.2.001
+7f16f80814f1e071a689806c2056b39d 7.2.002
+0de916fdfd450a4a0d95bed44ae2c398 7.2.003
+25cc99ad42b25b16a4610e2fad9cdab4 7.2.004
+a5b7b1c7c5b75aa7d730b0b9aa491558 7.2.005
+a93a72cd40c37da91dc634dc8dddefec 7.2.006
+e65c8c2223eea5289d8cbef2e867a5de 7.2.008
+ab1566b69bd0e0c82a866f00675ffe0e 7.2.009
+d69f559bfb5436c157e8069a829ca50d 7.2.010
+05334a6bb31402bfd49d82ea6f59a57b 7.2.011
+a11dcd5552f36544a9e27978b5359935 7.2.012
+8bc70978291aadea9c82072b623c955d 7.2.013
+a87826187cb77ad2e567a40c1609eea4 7.2.014
+47a466fbfdbca616f519fc4afa0432df 7.2.015
+fd08bac73d7ffcabf53bd25a63dff893 7.2.016
+0f0284d87f6f52101802dbe1a45d54c3 7.2.017
+38d06ba325b716c1177c1012d781bada 7.2.018
+661ca021fb70c24ef4df229512cfb14b 7.2.019
+cb2c5ca0f9a9718fb635874925432dd8 7.2.020
+9073d2311ae7101c143237a45afb4efa 7.2.021
+48ccb0deec77a3bb91bf967dacb43492 7.2.022
+d77ed8aa4de30d4dbd17a7998ae8f269 7.2.023
+cf983237e5e866ef459870fee2754bac 7.2.024
+ab32defa4b2cfb509ccb34d4858b1223 7.2.025
+5e96c227c7765b1e0f03f44cb5b750f6 7.2.026
+f26b7ee0f271eacbb3652dbdf92dd860 7.2.027
+fc54a3d35bdc7b7a7660c6d2274f7b74 7.2.028
+d53630dc8f3a823f54dfba73dcd47b36 7.2.029
+208f8ed2db2665ebfc17674f78d47c6d 7.2.030
+3387583af86faa78e10be979214071f3 7.2.031
+eca017686205ec8658bf9fa8c73f7af6 7.2.032
+88c91b84ffc772fd57f86475f7ba90f1 7.2.033
+c3d6eaaa0b74df423f90afaaafa3a0de 7.2.034
+f4c35dae581d671dc271407d377f7199 7.2.035
+1c6501c366cc8df205955f3e4d3ebba9 7.2.037
+ed3479ddb4ded7b74c82af5e50b0e4a6 7.2.038
+2a61f28f6f793c5a43abded6e59b6506 7.2.039
+4c493255ae227498016f30a0002ec1cc 7.2.040
+99baedef8a9c908774b7ed74deacf184 7.2.042
+87035b208c9377c28d796b1e48ab8aac 7.2.043
+b127def242996b4e7d7e870cab3e4b45 7.2.044
+5233327e4c97d310e3793b223892ea8d 7.2.045
+9ecfa0454f5a329996b273cb12369962 7.2.046
+35e16f4e7198e861a71322fee2cb7909 7.2.047
+84ef9658181f49bfbd7a61ec87dd0b8d 7.2.048
+27a9700e39e266a31df702677acea52c 7.2.050
+89ce3f5b513510fb288a4a301e7494c7 7.2.051
+5992bb56b07a9b9b4e3504f1f2f2c79c 7.2.052
+3fe570c1317fee8a71ede17197358e02 7.2.053
+5b047e8e8413c4807d74a6d9716474a2 7.2.054
+c276080d95de2fafa9706f247c35ff74 7.2.055
+5b65e2654a78dcc4c15dc49dbce5418e 7.2.056
+cab5a9ddf0ab180089d84bf9ec685574 7.2.057
+80991ff846f88222e3266dab6b07e2b8 7.2.058
+89cede639caf8beed5ea071790445e26 7.2.059
+9781d833263060308a9622dd097ad378 7.2.060
+71b4bc625bc1cdd68747262d329db551 7.2.061
+9243a773d19966dbfd98b7aff3fe3ab7 7.2.062
+08155711f8db2dfce217ec5a34253a76 7.2.063
+fd692f9624ec0170800b3d9a2a9a53cb 7.2.064
+ee1a8dc311c7580608e3bd2196a7d042 7.2.065
+8d1d5f8aefabf0abcb54de5247893246 7.2.066
+fa0ccca2decdd2db64947658b04b8c99 7.2.067
+ca5ab057205023613020ca920d903028 7.2.068
+f3e6f3dd76278a9f7e396955faa4ca31 7.2.069
+805cdc76da46e73ae908038e09efae16 7.2.070
+0d77ee653eabe4b7fdb640d768d7c1be 7.2.073
+d7eccf57f8fc04cf0385f85eff3d989a 7.2.075
+99750c988d0c48f56cb12a04b78aebc2 7.2.076
+1967f5e7fa4cec07bd67cc47925ec3c8 7.2.077
+7b285d2ba24fdd2390b4aaba08fcf5f6 7.2.078
+a3385578174d3867f17ab287276db49b 7.2.079"
diff --git a/extra/vim/vimrc b/extra/vim/vimrc
new file mode 100644
index 00000000..e3017342
--- /dev/null
+++ b/extra/vim/vimrc
@@ -0,0 +1,15 @@
+set nocompatible " Use Vim defaults (much better!)
+set bs=2 " Allow backspacing over everything in insert mode
+set ai " Always set auto-indenting on
+set history=50 " keep 50 lines of command history
+set ruler " Show the cursor position all the time
+
+" Don't use Ex mode, use Q for formatting
+map Q gq
+
+" When doing tab completion, give the following files lower priority.
+set suffixes+=.info,.aux,.log,.dvi,.bbl,.out,.o,.lo
+
+set nomodeline
+syntax on
+autocmd BufRead APKBUILD set filetype=sh
diff --git a/extra/wget/APKBUILD b/extra/wget/APKBUILD
new file mode 100644
index 00000000..93e4c337
--- /dev/null
+++ b/extra/wget/APKBUILD
@@ -0,0 +1,26 @@
+# Contributor: Carlo Landmeter <clandmeter at gmail>
+# Maintainer: Carlo Landmeter <clandmeter at gmail>
+pkgname=wget
+pkgver=1.11.4
+pkgrel=0
+pkgdesc="A network utility to retrieve files from the Web"
+url="http://www.gnu.org/software/wget/wget.html"
+license="GPL3"
+depends="openssl"
+makedepends="openssl-dev"
+subpackages="$pkgname-doc"
+source="ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --disable-nls
+ make || return 1
+ make DESTDIR="$pkgdir" install
+}
+
+md5sums="69e8a7296c0e12c53bd9ffd786462e87 wget-1.11.4.tar.gz"
diff --git a/extra/zip/10-zip-3.0-build.patch b/extra/zip/10-zip-3.0-build.patch
new file mode 100644
index 00000000..5ddad23b
--- /dev/null
+++ b/extra/zip/10-zip-3.0-build.patch
@@ -0,0 +1,36 @@
+respect build environment settings
+
+--- unix/configure Wed Jan 28 22:22:13 2009
++++ unix/configure Wed Jan 28 22:23:54 2009
+@@ -18,7 +18,7 @@
+
+ CC=${1-cc}
+ CFLAGS=${2-"-I. -DUNIX"}
+-LFLAGS1=''
++LFLAGS1="${LDFLAGS}"
+ LFLAGS2=''
+ LN="ln -s"
+
+@@ -118,7 +118,7 @@
+ fi
+
+ # optimization flags
+-if test -n "${CFLAGS_OPT}"; then
++if false; then
+ CFLAGS="${CFLAGS} ${CFLAGS_OPT}"
+ CFLAGS_BZ="${CFLAGS_BZ} ${CFLAGS_OPT}"
+ fi
+@@ -220,13 +220,6 @@
+ echo Check for the C preprocessor
+ # on SVR4, cc -E does not produce correct assembler files. Need /lib/cpp.
+ CPP="${CC} -E"
+-# solaris as(1) needs -P, maybe others as well ?
+-[ -f /usr/ccs/lib/cpp ] && CPP="/usr/ccs/lib/cpp -P"
+-[ -f /usr/lib/cpp ] && CPP=/usr/lib/cpp
+-[ -f /lib/cpp ] && CPP=/lib/cpp
+-[ -f /usr/bin/cpp ] && CPP=/usr/bin/cpp
+-[ -f /xenix ] && CPP="${CC} -E"
+-[ -f /lynx.os ] && CPP="${CC} -E"
+
+ echo "#include <stdio.h>" > conftest.c
+ $CPP conftest.c >/dev/null 2>/dev/null || CPP="${CC} -E"
diff --git a/extra/zip/20-zip-3.0-exec-stack.patch b/extra/zip/20-zip-3.0-exec-stack.patch
new file mode 100644
index 00000000..d85fb117
--- /dev/null
+++ b/extra/zip/20-zip-3.0-exec-stack.patch
@@ -0,0 +1,22 @@
+add proper GNU stack markings so we dont get the default: executable
+
+--- crc_i386.S Wed Jan 28 22:22:13 2009
++++ crc_i386.S Wed Jan 28 22:27:04 2009
+@@ -302,3 +302,7 @@
+ #endif /* i386 || _i386 || _I386 || __i386 */
+
+ #endif /* !USE_ZLIB && !CRC_TABLE_ONLY */
++
++#if defined __ELF__ && defined __linux__
++.section .note.GNU-stack,"",@progbits
++#endif
+--- match.S Wed Jan 28 22:22:13 2009
++++ match.S Wed Jan 28 22:27:04 2009
+@@ -405,3 +405,7 @@
+ #endif /* i386 || _I386 || _i386 || __i386 */
+
+ #endif /* !USE_ZLIB */
++
++#if defined __ELF__ && defined __linux__
++.section .note.GNU-stack,"",@progbits
++#endif
diff --git a/extra/zip/30-zip-3.0-pic.patch b/extra/zip/30-zip-3.0-pic.patch
new file mode 100644
index 00000000..14a8821b
--- /dev/null
+++ b/extra/zip/30-zip-3.0-pic.patch
@@ -0,0 +1,15 @@
+if our toolchain generates PIC by default, then do not use the hand written
+assembly files as none of it is PIC friendly.
+
+--- unix/configure Wed Jan 28 22:23:54 2009
++++ unix/configure Wed Jan 28 22:29:51 2009
+@@ -228,6 +228,9 @@
+ echo Check if we can use asm code
+ OBJA=""
+ OCRCU8=""
++piclib="$(echo | $CPP -dM $CFLAGS - | grep -i __pic__)"
++echo "Checking if compiler wants to create pic code"
++[ "$piclib" == "" ] && \
+ if eval "$CPP match.S > _match.s 2>/dev/null"; then
+ if test ! -s _match.s || grep error < _match.s > /dev/null; then
+ :
diff --git a/extra/zip/APKBUILD b/extra/zip/APKBUILD
new file mode 100644
index 00000000..4998c35b
--- /dev/null
+++ b/extra/zip/APKBUILD
@@ -0,0 +1,30 @@
+# Maintainer: Carlo Landmeter <clandmeter at gmail.com>
+pkgname=zip
+pkgver=3.0
+pkgrel=0
+pkgdesc="Creates PKZIP-compatible .zip files"
+url="http://www.info-zip.org/pub/infozip/Zip.html"
+license="AS IS"
+depends="uclibc"
+makedepends=""
+source="ftp://ftp.info-${pkgname}.org/pub/info${pkgname}/src/${pkgname}30.zip
+10-zip-3.0-build.patch
+20-zip-3.0-exec-stack.patch
+30-zip-3.0-pic.patch"
+subpackages="$pkgname-doc"
+
+build ()
+{
+ cd "${srcdir}/${pkgname}30"
+ for i in ../*.patch; do
+ msg "Applying $i"
+ patch -p0 < $i || return 1
+ done
+ make -f unix/Makefile LOCAL_ZIP="${CFLAGS} ${CPPFLAGS}" prefix=/usr generic || return 1
+ make -f unix/Makefile prefix=${pkgdir}/usr MANDIR=${pkgdir}/usr/share/man install
+}
+
+md5sums="e88492c8abd68fa9cfba72bc08757dba zip30.zip
+c86c527b6ad487aef02954bb1607ff07 10-zip-3.0-build.patch
+f6490facf87e501b5d0c7095949515a7 20-zip-3.0-exec-stack.patch
+f0b90de421d370f1b40b0f681d3829d8 30-zip-3.0-pic.patch"
diff --git a/extra/zonenotify/APKBUILD b/extra/zonenotify/APKBUILD
new file mode 100644
index 00000000..9709eba4
--- /dev/null
+++ b/extra/zonenotify/APKBUILD
@@ -0,0 +1,18 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=zonenotify
+pkgver=0.1
+pkgrel=0
+pkgdesc="Utility to send NS_NOTIFY packets to slave DNS servers"
+arch=""
+url="http://www.morettoni.net/zonenotify.en.html"
+license='BSD'
+depends="uclibc"
+source="http://www.morettoni.net/bsd/$pkgname-$pkgver.tar.gz"
+
+build() {
+ cd "$srcdir/$pkgname"
+ make || return 1
+ install -D zonenotify "$pkgdir"/usr/bin/zonenotify
+}
+
+md5sums="1cb15b505eaa22440c7a26ea34af2514 zonenotify-0.1.tar.gz"