summaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
Diffstat (limited to 'user')
-rw-r--r--user/cups-filters/APKBUILD67
-rw-r--r--user/cups/APKBUILD135
-rw-r--r--user/cups/cups-no-export-ssllibs.patch12
-rw-r--r--user/cups/cups.logrotate8
-rw-r--r--user/cups/cups.pre-install8
-rw-r--r--user/cups/cupsd.initd44
-rw-r--r--user/cups/default-config-no-gssapi.patch26
-rw-r--r--user/emacs/APKBUILD140
-rw-r--r--user/emacs/gamedir.patch11
-rw-r--r--user/freetype/0001-Enable-table-validation-modules.patch34
-rw-r--r--user/freetype/0002-Enable-subpixel-rendering.patch25
-rw-r--r--user/freetype/0003-Enable-infinality-subpixel-hinting.patch27
-rw-r--r--user/freetype/0004-Enable-long-PCF-family-names.patch25
-rw-r--r--user/freetype/40-memcpy-fix.patch14
-rw-r--r--user/freetype/APKBUILD57
-rw-r--r--user/freetype/freetype-profile.sh12
-rw-r--r--user/gamin/APKBUILD58
-rw-r--r--user/gamin/fix-deprecated-const.patch56
-rw-r--r--user/gamin/fix-pthread-mutex.patch11
-rw-r--r--user/libevent/APKBUILD65
-rw-r--r--user/libevent/dont-test-fallback.patch16
-rw-r--r--user/libevent/fix-test-on-32bit.patch11
-rw-r--r--user/libevent/libressl.patch97
-rw-r--r--user/libevent/py3_dumpevents.patch30
-rw-r--r--user/libevent/py3_rpcgen.patch423
-rw-r--r--user/libpipeline/APKBUILD36
-rw-r--r--user/man-db/APKBUILD50
-rw-r--r--user/man-db/man-db-2.7.5-iconv.patch75
-rw-r--r--user/man-db/man-db.trigger3
-rw-r--r--user/mawk/APKBUILD37
-rw-r--r--user/mesa/APKBUILD252
-rw-r--r--user/mesa/disk_cache-stack-overflow.patch42
-rw-r--r--user/mesa/drmdeps.patch41
-rw-r--r--user/mesa/glx_ro_text_segm.patch28
-rw-r--r--user/mesa/musl-fix-includes.patch14
-rw-r--r--user/mesa/musl-fixes.patch22
-rw-r--r--user/mesa/python3-compat.patch106
-rw-r--r--user/postgresql/APKBUILD259
-rw-r--r--user/postgresql/conf-unix_socket_directories.patch14
-rw-r--r--user/postgresql/disable-broken-tests.patch119
-rw-r--r--user/postgresql/initdb.patch14
-rw-r--r--user/postgresql/perl-rpath.patch22
-rw-r--r--user/postgresql/pg-restore.confd16
-rw-r--r--user/postgresql/pg-restore.initd36
-rw-r--r--user/postgresql/pltcl_create_tables.sql13
-rw-r--r--user/postgresql/postgresql.confd59
-rw-r--r--user/postgresql/postgresql.initd220
-rw-r--r--user/postgresql/postgresql.pre-upgrade32
-rw-r--r--user/psmisc/APKBUILD63
-rw-r--r--user/psmisc/dont-underlink-peekfd.patch10
-rw-r--r--user/psmisc/fix-peekfd-on-ppc.patch19
-rw-r--r--user/psmisc/musl_ptregs.patch20
-rw-r--r--user/sharutils/APKBUILD41
53 files changed, 2721 insertions, 354 deletions
diff --git a/user/cups-filters/APKBUILD b/user/cups-filters/APKBUILD
new file mode 100644
index 000000000..66c662d11
--- /dev/null
+++ b/user/cups-filters/APKBUILD
@@ -0,0 +1,67 @@
+# Maintainer: Max Rees <maxcrees@me.com>
+pkgname=cups-filters
+pkgver=1.20.3
+pkgrel=0
+pkgdesc="OpenPrinting CUPS filters and backends"
+url="http://www.linuxfoundation.org/collaborate/workgroups/openprinting/pdf_as_standard_print_job_format"
+arch="all"
+license="GPL-2.0 and GPL-2.0-or-later and GPL-3.0 and MIT"
+depends="poppler-utils bc ttf-freefont"
+makedepends="cups-dev libjpeg-turbo-dev poppler-dev zlib-dev libpng-dev
+ tiff-dev lcms2-dev freetype-dev fontconfig-dev qpdf-dev dbus-dev linux-headers
+ coreutils gnutls-dev python3"
+checkdepends="ttf-dejavu"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-libs"
+source="http://www.openprinting.org/download/cups-filters/cups-filters-$pkgver.tar.xz"
+builddir="$srcdir/cups-filters-$pkgver"
+
+build() {
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --localstatedir=/var \
+ --disable-static \
+ --with-pdftops=pdftops \
+ --with-shell=/bin/sh \
+ --without-rcdir \
+ --without-rclevels \
+ --disable-avahi \
+ --disable-ghostscript \
+ --disable-mutool \
+ --with-test-font-path='/usr/share/fonts/ttf-dejavu/DejaVuSans.ttf'
+ # workaround parallel build issue by building libcupsfilters.la first
+ make libcupsfilters.la && make libfontembed.la && make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+ make -j1 DESTDIR="$pkgdir" install
+ # the pdf.utf-8 symlink isn't quite good enough
+ cd "$pkgdir"/usr/share/cups/charsets && \
+ ln -s pdf.utf-8.simple pdf.UTF-8
+}
+
+dev() {
+ default_dev
+ # cupsfilters.drv needs pcl.h
+ install -Dm644 "$builddir"/filter/pcl.h \
+ "$pkgdir"/usr/share/cups/ppdc/pcl.h
+}
+
+libs() {
+ pkgdesc="OpenPrinting CUPS filters and backends - cupsfilters and fontembed libraries"
+ install -d "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/lib*.so.* "$subpkgdir"/usr/lib/
+}
+
+sha512sums="402a53bf1ea12b14e6f8aa46f8f5e91b2caf9da3a8f14759568b5a45b9309f379fec542c843da5560cbcec2c4860babfee7e9c2f0c62f5fa6254025e9d867b31 cups-filters-1.20.3.tar.xz"
diff --git a/user/cups/APKBUILD b/user/cups/APKBUILD
new file mode 100644
index 000000000..39178391c
--- /dev/null
+++ b/user/cups/APKBUILD
@@ -0,0 +1,135 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=cups
+pkgver=2.2.7
+pkgrel=0
+pkgdesc="The CUPS Printing System"
+url="http://www.cups.org/"
+arch="all"
+license="GPL LGPL2+"
+# cupsUTF8ToCharset(CUPS_EUC_JP) of utfdemo.txt: FAIL (UTF-8 to EUC-JP on line 1)
+options="!check"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-libs ipptool $pkgname-client
+ $pkgname-lang $pkgname-openrc"
+depends_dev="openssl-dev zlib-dev"
+makedepends="$depends_dev libpaper-dev dbus-dev libjpeg-turbo-dev linux-headers
+ gnutls-dev linux-pam-dev"
+depends="cups-client poppler-utils openssl dbus"
+install="cups.pre-install"
+pkggroups="lp lpadmin"
+pkgusers="lp"
+source="https://github.com/apple/cups/releases/download/v$pkgver/cups-$pkgver-source.tar.gz
+ $pkgname.logrotate
+ cupsd.initd
+ cups-no-export-ssllibs.patch
+ default-config-no-gssapi.patch
+ "
+builddir="$srcdir/$pkgname-$pkgver"
+
+build() {
+ cd "$builddir"
+
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --libdir=/usr/lib \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --with-logdir=/var/log/cups \
+ --with-docdir=/usr/share/cups \
+ --with-rundir=/run/cups \
+ --with-cupsd-file-perm=0755 \
+ --with-cups-user=lp \
+ --with-cups-group=lp \
+ --with-system-groups=lpadmin \
+ --with-domainsocket=/run/cups/cups.sock \
+ --without-rcdir \
+ --without-php \
+ --enable-pam \
+ --enable-raw-printing \
+ --enable-dbus \
+ --with-dbusdir=/etc/dbus-1 \
+ --enable-libpaper \
+ --enable-ssl=yes \
+ --enable-gnutls \
+ --disable-launchd \
+ --with-optim="$CFLAGS"
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+
+ make BUILDROOT="$pkgdir" install
+
+ cd "$pkgdir"
+
+ # These no longer works since CUPS >= 1.6 (http://www.cups.org/str.php?L4120).
+ rm -rf usr/share/cups/banners/* \
+ usr/share/cups/data/testprint
+
+ install -D -m 644 "$srcdir"/cups.logrotate etc/logrotate.d/cups
+ install -D -m 755 "$srcdir"/cupsd.initd etc/init.d/cupsd
+
+ if [ -e usr/share/applications/cups.desktop ] ; then
+ sed -i 's|^Exec=htmlview http://localhost:631/|Exec=xdg-open http://localhost:631/|g' \
+ usr/share/applications/cups.desktop
+ fi
+ find usr/share/cups/model -name "*.ppd" | xargs gzip -n9f
+}
+
+libs() {
+ pkgdesc="CUPS libraries"
+ depends=""
+ replaces="libcups"
+
+ cd "$pkgdir"
+ _mv usr/lib/*.so*
+ install -d "$pkgdir"/etc/cups
+}
+
+ipptool() {
+ pkgdesc="Perform internet printing protocol requests"
+ depends=""
+
+ cd "$pkgdir"
+ _mv usr/bin/ipptool \
+ usr/share/cups/ipptool
+}
+
+client() {
+ pkgdesc="CUPS command-line client programs"
+ depends=""
+
+ cd "$pkgdir"
+ _mv usr/bin \
+ usr/sbin/accept \
+ usr/sbin/cupsaccept \
+ usr/sbin/cupsaddsmb \
+ usr/sbin/cupsctl \
+ usr/sbin/cupsdisable \
+ usr/sbin/cupsenable \
+ usr/sbin/lpadmin \
+ usr/sbin/lpc \
+ usr/sbin/lpinfo \
+ usr/sbin/lpmove \
+ usr/sbin/reject
+}
+
+_mv() {
+ local i; for i in "$@"; do
+ mkdir -p "$subpkgdir"/${i%/*}
+ mv "$pkgdir"/$i "$subpkgdir"/${i%/*}/
+ done
+}
+
+sha512sums="780a6a484f38967ff678456ec7b532aa8445a9562663e4e4f6f7a24aac6ec9e8eae36459ee3c025dff053d59ad1d9ecfb823e8a832bae9d384db3d1a10d8860e cups-2.2.7-source.tar.gz
+cf64211da59e79285f99d437c02fdd7db462855fb2920ec9563ba47bd8a9e5cbd10555094940ceedeb41ac805c4f0ddb9147481470112a11a76220d0298aef79 cups.logrotate
+2c2683f755a220166b3a1653fdd1a6daa9718c8f0bbdff2e2d5e61d1133306260d63a83d3ff41619b5cf84c4913fae5822b79553e2822858f38fa3613f4c7082 cupsd.initd
+7a8cd9ac33b0dd4627c72df4275db8ccd7cf8e201bce3833719b42f532f526bb347b842e3ea1ef0d61855b5c6e1088b5d20b68942f2c2c0acf504d8d9728efd3 cups-no-export-ssllibs.patch
+98bb97f4af69ea286fc3d398b8e57c32440e6b2d49fb7f79b418a4fe7f13441f3a610f65d3433d10d971ade808233c0b29b4d66160623ccaae919179384be918 default-config-no-gssapi.patch"
diff --git a/user/cups/cups-no-export-ssllibs.patch b/user/cups/cups-no-export-ssllibs.patch
new file mode 100644
index 000000000..e227bd182
--- /dev/null
+++ b/user/cups/cups-no-export-ssllibs.patch
@@ -0,0 +1,12 @@
+diff -up cups-1.5b1/config-scripts/cups-ssl.m4.no-export-ssllibs cups-1.5b1/config-scripts/cups-ssl.m4
+--- cups-1.6.2/config-scripts/cups-ssl.m4.no-export-ssllibs 2011-05-11 02:52:08.000000000 +0200
++++ cups-1.6.2/config-scripts/cups-ssl.m4 2011-05-23 17:47:27.000000000 +0200
+@@ -180,7 +180,7 @@
+ AC_SUBST(SSLFLAGS)
+ AC_SUBST(SSLLIBS)
+
+-EXPORT_SSLLIBS="$SSLLIBS"
++EXPORT_SSLLIBS=""
+ AC_SUBST(EXPORT_SSLLIBS)
+
+ dnl
diff --git a/user/cups/cups.logrotate b/user/cups/cups.logrotate
new file mode 100644
index 000000000..a50b058a3
--- /dev/null
+++ b/user/cups/cups.logrotate
@@ -0,0 +1,8 @@
+/var/log/cups/*log {
+ missingok
+ notifempty
+ delaycompress
+ postrotate
+ /etc/init.d/cupsd --quiet --ifstarted reload
+ endscript
+}
diff --git a/user/cups/cups.pre-install b/user/cups/cups.pre-install
new file mode 100644
index 000000000..cdb75cac5
--- /dev/null
+++ b/user/cups/cups.pre-install
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+addgroup -S lpadmin 2>/dev/null
+addgroup -S lp 2>/dev/null
+adduser -S -G lp -g lp lp 2>/dev/null
+addgroup lp lp 2>/dev/null
+
+exit 0
diff --git a/user/cups/cupsd.initd b/user/cups/cupsd.initd
new file mode 100644
index 000000000..ff0998784
--- /dev/null
+++ b/user/cups/cupsd.initd
@@ -0,0 +1,44 @@
+#!/sbin/openrc-run
+
+name="CUPS"
+
+extra_commands="checkconfig"
+extra_started_commands="reload"
+
+description_checkconfig="Test the configuration file"
+description_reload="Reload"
+
+: ${cfgfile:="/etc/cups/cupsd.conf"}
+
+command="/usr/sbin/cupsd"
+command_args="-f -c $cfgfile"
+command_background="yes"
+
+pidfile="/run/cups/$RC_SVCNAME.pid"
+
+depend() {
+ use net
+ before nfs
+ need dbus
+ after logger
+}
+
+checkconfig() {
+ $command $command_args -t >/dev/null 2>&1 \
+ || $command $command_args -t
+}
+
+start_pre() {
+ checkconfig || return 1
+
+ checkpath -q -d -m 0775 -o root:lp /var/cache/cups
+ checkpath -q -d -m 0775 -o root:lp /var/cache/cups/rss
+ checkpath -q -d -m 0755 -o root:lp /run/cups
+ checkpath -q -d -m 0511 -o lp:lpadmin /run/cups/certs
+}
+
+reload() {
+ ebegin "Reloading $name"
+ start-stop-daemon --signal HUP --pidfile "$pidfile"
+ eend $?
+}
diff --git a/user/cups/default-config-no-gssapi.patch b/user/cups/default-config-no-gssapi.patch
new file mode 100644
index 000000000..b12c55ddf
--- /dev/null
+++ b/user/cups/default-config-no-gssapi.patch
@@ -0,0 +1,26 @@
+--- a/conf/cupsd.conf.in
++++ b/conf/cupsd.conf.in
+@@ -145,12 +145,12 @@
+
+ # Job-related operations must be done by the owner or an administrator...
+ <Limit Create-Job Print-Job Print-URI Validate-Job>
+- AuthType Negotiate
++ AuthType Default
+ Order deny,allow
+ </Limit>
+
+ <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
+- AuthType Negotiate
++ AuthType Default
+ Require user @OWNER @SYSTEM
+ Order deny,allow
+ </Limit>
+@@ -171,7 +171,7 @@
+
+ # Only the owner or an administrator can cancel or authenticate a job...
+ <Limit Cancel-Job CUPS-Authenticate-Job>
+- AuthType Negotiate
++ AuthType Default
+ Require user @OWNER @CUPS_DEFAULT_PRINTOPERATOR_AUTH@
+ Order deny,allow
+ </Limit>
diff --git a/user/emacs/APKBUILD b/user/emacs/APKBUILD
new file mode 100644
index 000000000..0092c9070
--- /dev/null
+++ b/user/emacs/APKBUILD
@@ -0,0 +1,140 @@
+# Contributor: Timo Teräs <timo.teras@iki.fi>
+# Maintainer: Horst Burkhardt <horst@adelielinux.org>
+pkgname=emacs
+pkgver=26.1
+pkgrel=0
+pkgdesc="The extensible, customizable, self-documenting real-time display editor"
+arch="all"
+depends="emacs-nox"
+options="!check !dbg"
+url="https://www.gnu.org/software/emacs/emacs.html"
+license="GPL-3.0"
+makedepends="autoconf automake linux-headers paxmark
+ librsvg-dev giflib-dev libxpm-dev gtk+2.0-dev gconf-dev alsa-lib-dev
+ glib-dev fontconfig-dev libpng-dev
+ libxml2-dev pango-dev tiff-dev libjpeg-turbo-dev ncurses-dev
+ ncurses-libs gnutls-dev libxaw-dev"
+subpackages="$pkgname-doc $pkgname-nox $pkgname-x11 $pkgname-gtk2"
+source="ftp://ftp.gnu.org/gnu/emacs/emacs-$pkgver.tar.xz
+ gamedir.patch"
+
+prepare() {
+ cd "$builddir/$1"
+ default_prepare || return 1
+ ./autogen.sh || return 1
+}
+
+builddir="$srcdir/emacs-$pkgver"
+_build_variant() {
+ cd "$builddir/$1"
+ shift
+ CFLAGS=-fno-pie \
+ LDFLAGS=-no-pie \
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --libexecdir=/usr/lib \
+ --localstatedir=/var \
+ --without-makeinfo \
+ --with-gameuser=:games \
+ "${@}"
+ make
+}
+
+_build_x11() {
+ _build_variant x11 \
+ --with-x-toolkit=athena \
+ --without-toolkit-scroll-bars \
+ --without-dbus \
+ --with-xft \
+ --with-jpeg=yes \
+ --with-tiff=yes
+}
+
+_build_gtk2() {
+ _build_variant gtk2 \
+ --with-x-toolkit=gtk2 \
+ --with-xft \
+ --with-jpeg=yes \
+ --with-tiff=no
+}
+
+_build_nox() {
+ _build_variant nox \
+ --without-sound \
+ --without-x \
+ --without-file-notification
+}
+
+build() {
+ cd "$builddir"
+ mkdir -p nox
+ mv * nox || true
+ cp -a nox gtk2
+ cp -a nox x11
+ _build_x11
+ _build_nox
+ _build_gtk2
+}
+
+package() {
+ mkdir -p "$pkgdir"
+}
+
+doc() {
+ mkdir -p "$subpkgdir"
+ cd "$builddir/gtk2"
+ make DESTDIR="$subpkgdir" install
+ # remove conflict with ctags package
+ mv "$subpkgdir"/usr/share/man/man1/ctags.1.gz "$subpkgdir"/usr/share/man/man1/ctags.emacs.1.gz
+ # only keep info and man directories, all other is in the specific package
+ rm -rf "$subpkgdir"/usr/bin \
+ "$subpkgdir"/usr/lib \
+ "$subpkgdir"/usr/share/appdata \
+ "$subpkgdir"/usr/share/applications \
+ "$subpkgdir"/usr/share/emacs \
+ "$subpkgdir"/usr/share/icons \
+ "$subpkgdir"/var
+}
+
+_subpackage() {
+ cd "$builddir/$1"
+ make DESTDIR="$subpkgdir" install
+
+ # remove conflict with ctags package
+ mv "$subpkgdir"/usr/bin/ctags "$subpkgdir"/usr/bin/ctags.emacs
+ rm -rf "$subpkgdir"/usr/share/info \
+ "$subpkgdir"/usr/share/man
+
+ # fix user/root permissions on usr/share files
+ find "$subpkgdir"/usr/share/emacs/ -exec chown root:root {} \;
+ find "$subpkgdir"/usr/lib -perm -g+s,g+x ! -type d -exec chmod g-s {} \;
+ # fix perms on /var/games
+ chmod 775 "$subpkgdir"/var/games
+ chmod 775 "$subpkgdir"/var/games/emacs
+ chmod 664 "$subpkgdir"/var/games/emacs/*
+ chown -R root:games "$subpkgdir"/var/games
+}
+
+nox() {
+ pkgdesc="$pkgdesc - without X11"
+ depends="!emacs-x11 !emacs-gtk2"
+ _subpackage nox
+}
+
+x11() {
+ pkgdesc="$pkgdesc - with X11"
+ depends="!emacs-nox !emacs-gtk2 hicolor-icon-theme desktop-file-utils"
+ _subpackage x11
+}
+
+gtk2() {
+ pkgdesc="$pkgdesc - with GTK2"
+ depends="!emacs-nox !emacs-x11 hicolor-icon-theme desktop-file-utils"
+ _subpackage gtk2
+}
+
+sha512sums="537c2cfdd281151b360002419dde6280c313e07a937ed96405c67f754b3401ec5541091a3c0aa6690929bc33dd79e8e0d8844e7a6b014b7798c63cb15de210c2 emacs-26.1.tar.xz
+8898f309aeaf274366849bd5c56c8e2a1be94dfee2f01b20f1700bf26203f49b9600237e5090fc3d8eaad3ea246f803ffd493d0c04cb3512084a4e3bf58f8f5e gamedir.patch"
diff --git a/user/emacs/gamedir.patch b/user/emacs/gamedir.patch
new file mode 100644
index 000000000..c1bcbadd6
--- /dev/null
+++ b/user/emacs/gamedir.patch
@@ -0,0 +1,11 @@
+diff -urw emacs-25.1/lib-src/Makefile.in emacs-25.1-gamedir/lib-src/Makefile.in
+--- emacs-25.1/lib-src/Makefile.in 2016-06-29 09:49:18.000000000 +0000
++++ emacs-25.1-gamedir/lib-src/Makefile.in 2016-10-24 15:37:46.718699816 +0000
+@@ -414,7 +414,6 @@
+
+ update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h)
+ $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} \
+- -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
+ $< $(NTLIB) $(LOADLIBES) -o $@
+
+ emacsclient.res: ../nt/emacsclient.rc $(NTINC)/../icons/emacs.ico
diff --git a/user/freetype/0001-Enable-table-validation-modules.patch b/user/freetype/0001-Enable-table-validation-modules.patch
new file mode 100644
index 000000000..3e9451fa8
--- /dev/null
+++ b/user/freetype/0001-Enable-table-validation-modules.patch
@@ -0,0 +1,34 @@
+From c3680bf8d38cf759c1e33dcc2d2d51e0a4fea2f9 Mon Sep 17 00:00:00 2001
+From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
+Date: Tue, 23 Jun 2015 08:40:29 +0200
+Subject: [PATCH 1/3] Enable table validation modules
+
+---
+ modules.cfg | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/modules.cfg b/modules.cfg
+index f30049c38cc45159..7b8e50fe1b34584a 100644
+--- a/modules.cfg
++++ b/modules.cfg
+@@ -120,7 +120,7 @@ AUX_MODULES += cache
+ # TrueType GX/AAT table validation. Needs ftgxval.c below.
+ #
+ # No FT_CONFIG_OPTION_PIC support.
+-# AUX_MODULES += gxvalid
++AUX_MODULES += gxvalid
+
+ # Support for streams compressed with gzip (files with suffix .gz).
+ #
+@@ -143,7 +143,7 @@ AUX_MODULES += bzip2
+ # OpenType table validation. Needs ftotval.c below.
+ #
+ # No FT_CONFIG_OPTION_PIC support.
+-# AUX_MODULES += otvalid
++AUX_MODULES += otvalid
+
+ # Auxiliary PostScript driver component to share common code.
+ #
+--
+2.9.3
+
diff --git a/user/freetype/0002-Enable-subpixel-rendering.patch b/user/freetype/0002-Enable-subpixel-rendering.patch
new file mode 100644
index 000000000..dfb57966e
--- /dev/null
+++ b/user/freetype/0002-Enable-subpixel-rendering.patch
@@ -0,0 +1,25 @@
+From 96f09f08417887b2618c177bccfb6da2906568d9 Mon Sep 17 00:00:00 2001
+From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
+Date: Tue, 23 Jun 2015 08:43:07 +0200
+Subject: [PATCH 2/3] Enable subpixel rendering
+
+---
+ include/freetype/config/ftoption.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
+index 90c123ef93e9ea04..67a361dd41e0b026 100644
+--- a/include/freetype/config/ftoption.h
++++ b/include/freetype/config/ftoption.h
+@@ -122,7 +122,7 @@ FT_BEGIN_HEADER
+ /* 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
+
+
+ /*************************************************************************/
+--
+2.9.3
+
diff --git a/user/freetype/0003-Enable-infinality-subpixel-hinting.patch b/user/freetype/0003-Enable-infinality-subpixel-hinting.patch
new file mode 100644
index 000000000..bbfa2a2cd
--- /dev/null
+++ b/user/freetype/0003-Enable-infinality-subpixel-hinting.patch
@@ -0,0 +1,27 @@
+From 220e96a9a8d7aff6ad0f0f1aa12c79cdb563331c Mon Sep 17 00:00:00 2001
+From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
+Date: Mon, 29 Aug 2016 08:43:10 +0200
+Subject: [PATCH 3/3] Enable infinality subpixel hinting
+
+---
+ include/freetype/config/ftoption.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
+index 67a361dd41e0b026..c4812862518b66a6 100644
+--- a/include/freetype/config/ftoption.h
++++ b/include/freetype/config/ftoption.h
+@@ -675,8 +675,8 @@ FT_BEGIN_HEADER
+ /* [1] http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */
+ /* */
+ /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */
+-#define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2
+-/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 ) */
++/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2 */
++#define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 )
+
+
+ /*************************************************************************/
+--
+2.9.3
+
diff --git a/user/freetype/0004-Enable-long-PCF-family-names.patch b/user/freetype/0004-Enable-long-PCF-family-names.patch
new file mode 100644
index 000000000..675423a7c
--- /dev/null
+++ b/user/freetype/0004-Enable-long-PCF-family-names.patch
@@ -0,0 +1,25 @@
+From 62da6a0f7f5cb77859a793863c386c452411e2a6 Mon Sep 17 00:00:00 2001
+From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
+Date: Sun, 14 May 2017 18:09:31 +0200
+Subject: [PATCH 4/4] Enable long PCF family names
+
+---
+ include/freetype/config/ftoption.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
+index ebb44acdbbef9a47..0b39b417162707e4 100644
+--- a/include/freetype/config/ftoption.h
++++ b/include/freetype/config/ftoption.h
+@@ -865,7 +865,7 @@ FT_BEGIN_HEADER
+ /* If this option is activated, it can be controlled with the */
+ /* `no-long-family-names' property of the pcf driver module. */
+ /* */
+-/* #define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
++#define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES
+
+
+ /*************************************************************************/
+--
+2.13.0
+
diff --git a/user/freetype/40-memcpy-fix.patch b/user/freetype/40-memcpy-fix.patch
new file mode 100644
index 000000000..89e61cd0b
--- /dev/null
+++ b/user/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/user/freetype/APKBUILD b/user/freetype/APKBUILD
new file mode 100644
index 000000000..37ab71932
--- /dev/null
+++ b/user/freetype/APKBUILD
@@ -0,0 +1,57 @@
+# Contributor: Carlo Landmeter <clandmeter@gmail.com>
+# Maintainer: A. Wilcox <awilfox@adelielinux.org>
+pkgname=freetype
+pkgver=2.9.1
+pkgrel=0
+pkgdesc="TrueType font rendering library"
+url="https://www.freetype.org/"
+arch="all"
+license="GPL"
+options="!check"
+depends=""
+depends_dev=""
+makedepends="$depends_dev zlib-dev libpng-dev bzip2-dev"
+subpackages="$pkgname-dev"
+source="http://download.savannah.gnu.org/releases/freetype/freetype-$pkgver.tar.bz2
+ 40-memcpy-fix.patch
+ 0001-Enable-table-validation-modules.patch
+ 0003-Enable-infinality-subpixel-hinting.patch
+ 0004-Enable-long-PCF-family-names.patch
+
+ freetype-profile.sh
+ "
+
+# secfixes:
+# 2.9.1-r0:
+# - CVE-2018-6942
+# 2.7.1-r1:
+# - CVE-2017-8105
+# - CVE-2017-8287
+
+build() {
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --disable-static \
+ --with-bzip2 \
+ --with-png
+ make
+}
+
+package() {
+ cd "$builddir"
+ make DESTDIR="$pkgdir" install
+
+ install -Dm644 "$srcdir"/freetype-profile.sh \
+ "$pkgdir"/etc/profile.d/freetype.sh
+}
+
+sha512sums="856766e1f3f4c7dc8afb2b5ee991138c8b642c6a6e5e007cd2bc04ae58bde827f082557cf41bf541d97e8485f7fd064d10390d1ee597f19d1daed6c152e27708 freetype-2.9.1.tar.bz2
+9981be8a3ea6f2cf856860b87a4e895e4610c9d5ea4beb611815e757e6080e060f6853ace02dd8ea55e5888cdf4bae5ad5eadd2d8a123754bb3c0bfe7ef41dea 40-memcpy-fix.patch
+41a84be2631b53072a76b78c582575aa48b650ee7b00017d018381002bc25df10cf33da4954c95ef50db39f1fa566678e3b4ae9bfee1dfd705423fb53e53e494 0001-Enable-table-validation-modules.patch
+7b52a3d67750d59b2c98e83dab4e0a0ab263142c2ca7bd5f8be5f8fe9cd1dc1f4debad44111c7886665329d8d2a3163756455618a6615df8f85d82bb0372d4dd 0003-Enable-infinality-subpixel-hinting.patch
+64c20fbcbf48372ea35fe2e0dae8fec4be8c601c899a4a71913060c6ea4082a2f41d69701da511e09fee126bf198d560986469e2356bd088d2dd5961f437df63 0004-Enable-long-PCF-family-names.patch
+7100cde5b2ca16bfbe968fce3e2eba5ba49e6ed53792d5db889c8d89e572d7d80da1338ccc9eeb9b243664ca2337467e9f73c1074bee0b34c417f6c7832ed390 freetype-profile.sh"
diff --git a/user/freetype/freetype-profile.sh b/user/freetype/freetype-profile.sh
new file mode 100644
index 000000000..a4cc6423b
--- /dev/null
+++ b/user/freetype/freetype-profile.sh
@@ -0,0 +1,12 @@
+# Subpixel hinting mode can be chosen by setting the right TrueType interpreter
+# version. The available settings are:
+#
+# truetype:interpreter-version=35 # Classic mode (default in 2.6)
+# truetype:interpreter-version=38 # Infinality mode
+# truetype:interpreter-version=40 # Minimal mode (default in 2.7)
+#
+# There are more properties that can be set, separated by whitespace. Please
+# refer to the FreeType documentation for details.
+
+# Uncomment and configure below
+export FREETYPE_PROPERTIES="truetype:interpreter-version=38"
diff --git a/user/gamin/APKBUILD b/user/gamin/APKBUILD
new file mode 100644
index 000000000..360161d27
--- /dev/null
+++ b/user/gamin/APKBUILD
@@ -0,0 +1,58 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=gamin
+pkgver=0.1.10
+pkgrel=11
+pkgdesc="Gamin is a file and directory monitoring system defined to be a subset of the FAM (File Alteration Monitor) system."
+url="http://www.gnome.org/~veillard/gamin"
+arch="all"
+license="GPL"
+subpackages="$pkgname-dev"
+depends=
+makedepends="glib-dev"
+source="http://www.gnome.org/~veillard/$pkgname/sources/$pkgname-$pkgver.tar.gz
+ fix-deprecated-const.patch
+ fix-pthread-mutex.patch"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+prepare() {
+ cd "$_builddir"
+ update_config_sub
+ default_prepare
+}
+
+build() {
+ cd "$_builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --disable-static \
+ --with-threads \
+ --without-python \
+ --disable-debug-api \
+ --disable-debug \
+ --libexecdir=/usr/lib/gamin
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$_builddir"
+ # some kinde of race in the make install which is not solved with -j
+ export MKDIRPROG="mkdir -p"
+ make DESTDIR="$pkgdir" install
+}
+
+md5sums="b4ec549e57da470c04edd5ec2876a028 gamin-0.1.10.tar.gz
+f679aeb48fe9dd376c8828cc9b6941ab fix-deprecated-const.patch
+f05a8d9fe30b6ce2871795c06d74edc4 fix-pthread-mutex.patch"
+sha256sums="28085f0ae8be10eab582ff186af4fb0be92cc6c62b5cc19cd09b295c7c2899a1 gamin-0.1.10.tar.gz
+33af6c9a94b459506fc48892c169d89cb4ad7c68e160f0c4bc74475f19ce5a2f fix-deprecated-const.patch
+bfd5ee42e385367718a4dac8ab318f9a5881ab8b669e4020f87aacaef16a2f8e fix-pthread-mutex.patch"
+sha512sums="21bfe6fcf8fb3117cd5a08c8ce3b8d0d1dd23e478e60a95b76c20d02cc29b050dde086578d81037990484ff891c3e104d2cbbf3d294b4a79346b14a0cae075bb gamin-0.1.10.tar.gz
+c4c10bee70c7231db395cbfe5bdf513ade6be599a11a9d35888ddfaca42d619fe2b5e87c2b2bab469ea98ba718bc01711252313ba5f53c392379b669f5b2902b fix-deprecated-const.patch
+70628fc39521ea8bc4a40b009d0881f6ee540334a31b2f0cb67dde0f75808c69feb78088ad24c3c4a0dec9fa59e87960fd81d1a2e56963ce9268d0a5e14f88e8 fix-pthread-mutex.patch"
diff --git a/user/gamin/fix-deprecated-const.patch b/user/gamin/fix-deprecated-const.patch
new file mode 100644
index 000000000..3d5f6133f
--- /dev/null
+++ b/user/gamin/fix-deprecated-const.patch
@@ -0,0 +1,56 @@
+Description: Don't use deprecated G_CONST_RETURN. Fixes building with newer glib versions.
+Author: Matthias Klose <doko@ubuntu.com>
+Bug-Ubuntu: https://launchpad.net/bugs/829504
+
+Index: gamin/server/gam_node.c
+===================================================================
+--- gamin.orig/server/gam_node.c 2011-10-18 16:09:04.873780685 +0200
++++ gamin/server/gam_node.c 2011-10-18 16:09:01.965780543 +0200
+@@ -122,7 +122,7 @@
+ * it has finished with the string. If it must keep it longer, it
+ * should makes its own copy. The returned string must not be freed.
+ */
+-G_CONST_RETURN char *
++const char *
+ gam_node_get_path(GamNode * node)
+ {
+ g_assert(node);
+Index: gamin/server/gam_node.h
+===================================================================
+--- gamin.orig/server/gam_node.h 2011-10-18 16:09:04.729780677 +0200
++++ gamin/server/gam_node.h 2011-10-18 16:09:01.961780544 +0200
+@@ -58,7 +58,7 @@
+ void gam_node_set_is_dir (GamNode *node,
+ gboolean is_dir);
+
+-G_CONST_RETURN char *gam_node_get_path (GamNode *node);
++const char *gam_node_get_path (GamNode *node);
+
+ GList *gam_node_get_subscriptions (GamNode *node);
+
+Index: gamin/server/gam_subscription.c
+===================================================================
+--- gamin.orig/server/gam_subscription.c 2011-10-18 16:09:04.817780682 +0200
++++ gamin/server/gam_subscription.c 2011-10-18 16:09:01.965780543 +0200
+@@ -141,7 +141,7 @@
+ * @param sub the GamSubscription
+ * @returns The path being monitored. It should not be freed.
+ */
+-G_CONST_RETURN char *
++const char *
+ gam_subscription_get_path(GamSubscription * sub)
+ {
+ if (sub == NULL)
+Index: gamin/server/gam_subscription.h
+===================================================================
+--- gamin.orig/server/gam_subscription.h 2011-10-18 16:09:04.929780687 +0200
++++ gamin/server/gam_subscription.h 2011-10-18 16:09:01.965780543 +0200
+@@ -21,7 +21,7 @@
+
+ int gam_subscription_get_reqno (GamSubscription *sub);
+
+-G_CONST_RETURN char *gam_subscription_get_path (GamSubscription *sub);
++const char *gam_subscription_get_path (GamSubscription *sub);
+
+ GamListener *gam_subscription_get_listener (GamSubscription *sub);
+
diff --git a/user/gamin/fix-pthread-mutex.patch b/user/gamin/fix-pthread-mutex.patch
new file mode 100644
index 000000000..c8c5b0005
--- /dev/null
+++ b/user/gamin/fix-pthread-mutex.patch
@@ -0,0 +1,11 @@
+--- gamin-0.1.10.orig/libgamin/gam_data.c
++++ gamin-0.1.10/libgamin/gam_data.c
+@@ -470,7 +470,7 @@
+ }
+ if (is_threaded > 0) {
+ pthread_mutexattr_init(&attr);
+-#if defined(linux) || defined(PTHREAD_MUTEX_RECURSIVE_NP)
++#if defined(linux) && defined(PTHREAD_MUTEX_RECURSIVE_NP)
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
+ #else
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
diff --git a/user/libevent/APKBUILD b/user/libevent/APKBUILD
new file mode 100644
index 000000000..d49dfa5e1
--- /dev/null
+++ b/user/libevent/APKBUILD
@@ -0,0 +1,65 @@
+# Contributor: Sergei Lukin <sergej.lukin@gmail.com>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=libevent
+pkgver=2.1.8
+pkgrel=3
+pkgdesc="An event notification library"
+url="http://libevent.org/"
+arch="all"
+license="BSD"
+depends=""
+depends_dev="python3"
+makedepends="$depends_dev openssl-dev"
+subpackages="$pkgname-dev"
+source="https://github.com/$pkgname/$pkgname/releases/download/release-${pkgver}-stable/$pkgname-${pkgver}-stable.tar.gz
+ dont-test-fallback.patch
+ fix-test-on-32bit.patch
+ py3_dumpevents.patch
+ py3_rpcgen.patch
+ "
+
+# secfixes:
+# 2.1.8-r0:
+# - CVE-2016-10195
+# - CVE-2016-10196
+# - CVE-2016-10197
+
+builddir="$srcdir"/$pkgname-$pkgver-stable
+
+prepare() {
+ cd "$builddir"
+ default_prepare
+}
+
+build() {
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --disable-static
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+ make -j1 DESTDIR=$pkgdir install
+}
+
+dev() {
+ replaces="libevent"
+ default_dev
+ mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
+}
+
+sha512sums="a2fd3dd111e73634e4aeb1b29d06e420b15c024d7b47778883b5f8a4ff320b5057a8164c6d50b53bd196c79d572ce2639fe6265e03a93304b09c22b41e4c2a17 libevent-2.1.8-stable.tar.gz
+d059a592252f83a918f0b6237e2dbee1d05822c83372bcd0f658a25428cce109fd088c5dec8320fef4c1aa7a713ada53aae9b7c04d7ca9b039ed4a483ba84146 dont-test-fallback.patch
+7898a00eeab4af7ff3b7c1ee3b90e0d718beba435dfadf015f62084524b2b0f4049c8dd9e16926c61017c01faabf7a51c2f19be7f9532e01278d691acb98465d fix-test-on-32bit.patch
+1f51788db3797870392997d0314fb744ee54d3b1a326d1b67f522fc7af65d50210cb137e8213d35a788bbf3c97aac18cd9860de8af3cb8c82f25e3ae07d662ae py3_dumpevents.patch
+00d0b09425835638a5e29d96d70c855a5c57efb188157b80a3885a2dcbe88709b49ae57aeb6b8b590458a934116cf59934e6e32fbf684b2b3b8333c0dcac837e py3_rpcgen.patch"
diff --git a/user/libevent/dont-test-fallback.patch b/user/libevent/dont-test-fallback.patch
new file mode 100644
index 000000000..42a40094a
--- /dev/null
+++ b/user/libevent/dont-test-fallback.patch
@@ -0,0 +1,16 @@
+The libevent fallback monotonic clock is broken, but it should never be used
+anyway on musl, so disable testing it.
+
+(the brokenness involves gettimeofday, you don't want to know)
+
+--- libevent-2.1.8-stable/test/regress_util.c.old 2017-01-15 03:04:34.000000000 -0600
++++ libevent-2.1.8-stable/test/regress_util.c 2017-09-14 16:25:58.887687965 -0500
+@@ -1482,7 +1482,7 @@
+ { "monotonic_res_fallback", test_evutil_monotonic_res, TT_OFF_BY_DEFAULT, &basic_setup, (void*)"fallback" },
+ { "monotonic_prc", test_evutil_monotonic_prc, 0, &basic_setup, (void*)"" },
+ { "monotonic_prc_precise", test_evutil_monotonic_prc, 0, &basic_setup, (void*)"precise" },
+- { "monotonic_prc_fallback", test_evutil_monotonic_prc, 0, &basic_setup, (void*)"fallback" },
++ /* { "monotonic_prc_fallback", test_evutil_monotonic_prc, 0, &basic_setup, (void*)"fallback" }, */
+ { "date_rfc1123", test_evutil_date_rfc1123, 0, NULL, NULL },
+ END_OF_TESTCASES,
+ };
diff --git a/user/libevent/fix-test-on-32bit.patch b/user/libevent/fix-test-on-32bit.patch
new file mode 100644
index 000000000..ec120a78c
--- /dev/null
+++ b/user/libevent/fix-test-on-32bit.patch
@@ -0,0 +1,11 @@
+--- libevent-2.1.8-stable/test/regress_util.c.old 2018-03-04 21:14:24.344542520 -0600
++++ libevent-2.1.8-stable/test/regress_util.c 2018-03-04 21:24:23.788814572 -0600
+@@ -1411,7 +1411,7 @@
+ { 1255132800, "Sat, 10 Oct 2009 00:00:00 GMT"},
+ { 1289433600, "Thu, 11 Nov 2010 00:00:00 GMT"},
+ { 1323648000, "Mon, 12 Dec 2011 00:00:00 GMT"},
+-#ifndef _WIN32
++#if !defined(_WIN32) && (!defined(__SIZEOF_LONG__) || __SIZEOF_LONG__ > 4)
+ /** In win32 case we have max "23:59:59 January 18, 2038, UTC" for time32 */
+ { 4294967296, "Sun, 07 Feb 2106 06:28:16 GMT"} /* 2^32 */,
+ /** In win32 case we have max "23:59:59, December 31, 3000, UTC" for time64 */
diff --git a/user/libevent/libressl.patch b/user/libevent/libressl.patch
new file mode 100644
index 000000000..21a750c2c
--- /dev/null
+++ b/user/libevent/libressl.patch
@@ -0,0 +1,97 @@
+diff -ru a/openssl-compat.h b/openssl-compat.h
+--- a/openssl-compat.h
++++ b/openssl-compat.h
+@@ -1,7 +1,7 @@
+ #ifndef OPENSSL_COMPAT_H
+ #define OPENSSL_COMPAT_H
+
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+
+ static inline BIO_METHOD *BIO_meth_new(int type, const char *name)
+ {
+@@ -30,6 +30,6 @@
+
+ #define TLS_method SSLv23_method
+
+-#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
++#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) */
+
+ #endif /* OPENSSL_COMPAT_H */
+diff -ru a/sample/https-client.c b/sample/https-client.c
+--- a/sample/https-client.c
++++ b/sample/https-client.c
+@@ -312,7 +312,7 @@
+ }
+ uri[sizeof(uri) - 1] = '\0';
+
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ // Initialize OpenSSL
+ SSL_library_init();
+ ERR_load_crypto_strings();
+@@ -480,7 +480,7 @@
+ SSL_CTX_free(ssl_ctx);
+ if (type == HTTP && ssl)
+ SSL_free(ssl);
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ EVP_cleanup();
+ ERR_free_strings();
+
+@@ -492,7 +492,7 @@
+ CRYPTO_cleanup_all_ex_data();
+
+ sk_SSL_COMP_free(SSL_COMP_get_compression_methods());
+-#endif /*OPENSSL_VERSION_NUMBER < 0x10100000L */
++#endif /*OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) */
+
+ #ifdef _WIN32
+ WSACleanup();
+diff -ru a/sample/le-proxy.c b/sample/le-proxy.c
+--- a/sample/le-proxy.c
++++ b/sample/le-proxy.c
+@@ -259,7 +259,7 @@
+
+ if (use_ssl) {
+ int r;
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ SSL_library_init();
+ ERR_load_crypto_strings();
+ SSL_load_error_strings();
+diff -ru a/sample/openssl_hostname_validation.c b/sample/openssl_hostname_validation.c
+--- a/sample/openssl_hostname_validation.c
++++ b/sample/openssl_hostname_validation.c
+@@ -48,7 +48,7 @@
+
+ #define HOSTNAME_MAX_SIZE 255
+
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ #define ASN1_STRING_get0_data ASN1_STRING_data
+ #endif
+
+diff -ru a/test/regress_ssl.c b/test/regress_ssl.c
+--- a/test/regress_ssl.c
++++ b/test/regress_ssl.c
+@@ -186,7 +186,7 @@
+ void
+ init_ssl(void)
+ {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ SSL_library_init();
+ ERR_load_crypto_strings();
+ SSL_load_error_strings();
+@@ -194,6 +194,10 @@
+ if (SSLeay() != OPENSSL_VERSION_NUMBER) {
+ TT_DECLARE("WARN", ("Version mismatch for openssl: compiled with %lx but running with %lx", (unsigned long)OPENSSL_VERSION_NUMBER, (unsigned long) SSLeay()));
+ }
++ if (SSLeay() != LIBRESSL_VERSION_NUMBER) {
++ TT_DECLARE("WARN", ("Version mismatch for libressl: compiled with %lx but running with %lx", (unsigned long)LIBRESSL_VERSION_NUMBER, (unsigned long) SSLeay()));
++ }
++
+ #endif
+ }
+
diff --git a/user/libevent/py3_dumpevents.patch b/user/libevent/py3_dumpevents.patch
new file mode 100644
index 000000000..3c012ef89
--- /dev/null
+++ b/user/libevent/py3_dumpevents.patch
@@ -0,0 +1,30 @@
+--- libevent-2.1.8-stable/test/check-dumpevents.py 2016-10-04 14:55:31.000000000 -0500
++++ libevent-2.1.8-py3-rpcgen/test/check-dumpevents.py 2017-09-14 15:51:16.000000000 -0500
+@@ -15,12 +15,12 @@
+ got_inserted_pos = text.index("Inserted events:\n")
+ got_active_pos = text.index("Active events:\n")
+ except ValueError:
+- print >>sys.stderr, "Missing expected dividing line in dumpevents output"
++ sys.stderr.write("Missing expected dividing line in dumpevents output\n")
+ sys.exit(1)
+
+ if not (expect_inserted_pos < expect_active_pos <
+ got_inserted_pos < got_active_pos):
+- print >>sys.stderr, "Sections out of order in dumpevents output"
++ sys.stderr.write("Sections out of order in dumpevents output\n")
+ sys.exit(1)
+
+ now,T= text[1].split()
+@@ -45,10 +45,10 @@
+ if "Internal" not in s)
+
+ if cleaned_inserted != want_inserted:
+- print >>sys.stderr, "Inserted event lists were not as expected!"
++ sys.stderr.write("Inserted event lists were not as expected!\n")
+ sys.exit(1)
+
+ if set(got_active) != set(want_active):
+- print >>sys.stderr, "Active event lists were not as expected!"
++ sys.stderr.write("Active event lists were not as expected!\n")
+ sys.exit(1)
+
diff --git a/user/libevent/py3_rpcgen.patch b/user/libevent/py3_rpcgen.patch
new file mode 100644
index 000000000..2ebe974a6
--- /dev/null
+++ b/user/libevent/py3_rpcgen.patch
@@ -0,0 +1,423 @@
+--- libevent-2.1.8-stable/event_rpcgen.py 2016-12-06 03:44:11.000000000 -0600
++++ libevent-2.1.8-py3-rpcgen/event_rpcgen.py 2017-09-14 15:17:51.000000000 -0500
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python2
++#!/usr/bin/env python3
+ #
+ # Copyright (c) 2005-2007 Niels Provos <provos@citi.umich.edu>
+ # Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+@@ -36,10 +36,10 @@
+
+ def declare(s):
+ if not QUIETLY:
+- print s
++ print(s)
+
+ def TranslateList(mylist, mydict):
+- return map(lambda x: x % mydict, mylist)
++ return [x % mydict for x in mylist]
+
+ # Exception class for parse errors
+ class RpcGenError(Exception):
+@@ -57,7 +57,7 @@
+ declare(' Created struct: %s' % name)
+
+ def AddEntry(self, entry):
+- if self._tags.has_key(entry.Tag()):
++ if entry.Tag() in self._tags:
+ raise RpcGenError(
+ 'Entry "%s" duplicates tag number %d from "%s" '
+ 'around line %d' % (entry.Name(), entry.Tag(),
+@@ -78,7 +78,8 @@
+ def PrintIndented(self, file, ident, code):
+ """Takes an array, add indentation to each entry and prints it."""
+ for entry in code:
+- print >>file, '%s%s' % (ident, entry)
++ file.write('{}{}\n'.format(ident, entry))
++ #file.write('%s%s' % (ident, entry))
+
+ class StructCCode(Struct):
+ """ Knows how to generate C code for a struct """
+@@ -88,20 +89,19 @@
+
+ def PrintTags(self, file):
+ """Prints the tag definitions for a structure."""
+- print >>file, '/* Tag definition for %s */' % self._name
+- print >>file, 'enum %s_ {' % self._name.lower()
++ file.write('/* Tag definition for %s */\n' % self._name)
++ file.write('enum %s_ {\n' % self._name.lower())
+ for entry in self._entries:
+- print >>file, ' %s=%d,' % (self.EntryTagName(entry),
+- entry.Tag())
+- print >>file, ' %s_MAX_TAGS' % (self._name.upper())
+- print >>file, '};\n'
++ file.write(' %s=%d,\n' % (self.EntryTagName(entry), entry.Tag()))
++ file.write(' %s_MAX_TAGS\n' % (self._name.upper()))
++ file.write('};\n\n')
+
+ def PrintForwardDeclaration(self, file):
+- print >>file, 'struct %s;' % self._name
++ file.write('struct %s;\n' % self._name)
+
+ def PrintDeclaration(self, file):
+- print >>file, '/* Structure declaration for %s */' % self._name
+- print >>file, 'struct %s_access_ {' % self._name
++ file.write('/* Structure declaration for %s */\n' % self._name)
++ file.write('struct %s_access_ {\n' % self._name)
+ for entry in self._entries:
+ dcl = entry.AssignDeclaration('(*%s_assign)' % entry.Name())
+ dcl.extend(
+@@ -110,20 +110,19 @@
+ dcl.extend(
+ entry.AddDeclaration('(*%s_add)' % entry.Name()))
+ self.PrintIndented(file, ' ', dcl)
+- print >>file, '};\n'
++ file.write('};\n\n')
+
+- print >>file, 'struct %s {' % self._name
+- print >>file, ' struct %s_access_ *base;\n' % self._name
++ file.write('struct %s {\n' % self._name)
++ file.write(' struct %s_access_ *base;\n\n' % self._name)
+ for entry in self._entries:
+ dcl = entry.Declaration()
+ self.PrintIndented(file, ' ', dcl)
+- print >>file, ''
++ file.write('\n')
+ for entry in self._entries:
+- print >>file, ' ev_uint8_t %s_set;' % entry.Name()
+- print >>file, '};\n'
++ file.write(' ev_uint8_t %s_set;\n' % entry.Name())
++ file.write('};\n\n')
+
+- print >>file, \
+-"""struct %(name)s *%(name)s_new(void);
++ file.write("""struct %(name)s *%(name)s_new(void);
+ struct %(name)s *%(name)s_new_with_arg(void *);
+ void %(name)s_free(struct %(name)s *);
+ void %(name)s_clear(struct %(name)s *);
+@@ -133,7 +132,7 @@
+ void evtag_marshal_%(name)s(struct evbuffer *, ev_uint32_t,
+ const struct %(name)s *);
+ int evtag_unmarshal_%(name)s(struct evbuffer *, ev_uint32_t,
+- struct %(name)s *);""" % { 'name' : self._name }
++ struct %(name)s *);\n""" % { 'name' : self._name })
+
+
+ # Write a setting function of every variable
+@@ -146,22 +145,21 @@
+ self.PrintIndented(file, '', entry.AddDeclaration(
+ entry.AddFuncName()))
+
+- print >>file, '/* --- %s done --- */\n' % self._name
++ file.write('/* --- %s done --- */\n\n' % self._name)
+
+ def PrintCode(self, file):
+- print >>file, ('/*\n'
++ file.write(('/*\n'
+ ' * Implementation of %s\n'
+- ' */\n') % self._name
++ ' */\n\n') % self._name)
+
+- print >>file, \
+- 'static struct %(name)s_access_ %(name)s_base__ = {' % \
+- { 'name' : self._name }
++ file.write('static struct %(name)s_access_ %(name)s_base__ = {\n' % \
++ { 'name' : self._name })
+ for entry in self._entries:
+ self.PrintIndented(file, ' ', entry.CodeBase())
+- print >>file, '};\n'
++ file.write('};\n\n')
+
+ # Creation
+- print >>file, (
++ file.write((
+ 'struct %(name)s *\n'
+ '%(name)s_new(void)\n'
+ '{\n'
+@@ -176,77 +174,77 @@
+ ' event_warn("%%s: malloc", __func__);\n'
+ ' return (NULL);\n'
+ ' }\n'
+- ' tmp->base = &%(name)s_base__;\n') % { 'name' : self._name }
++ ' tmp->base = &%(name)s_base__;\n\n') % { 'name' : self._name })
+
+ for entry in self._entries:
+ self.PrintIndented(file, ' ', entry.CodeInitialize('tmp'))
+- print >>file, ' tmp->%s_set = 0;\n' % entry.Name()
++ file.write(' tmp->%s_set = 0;\n\n' % entry.Name())
+
+- print >>file, (
++ file.write((
+ ' return (tmp);\n'
+- '}\n')
++ '}\n\n'))
+
+ # Adding
+ for entry in self._entries:
+ if entry.Array():
+ self.PrintIndented(file, '', entry.CodeAdd())
+- print >>file, ''
++ file.write('\n')
+
+ # Assigning
+ for entry in self._entries:
+ self.PrintIndented(file, '', entry.CodeAssign())
+- print >>file, ''
++ file.write('\n')
+
+ # Getting
+ for entry in self._entries:
+ self.PrintIndented(file, '', entry.CodeGet())
+- print >>file, ''
++ file.write('\n')
+
+ # Clearing
+- print >>file, ( 'void\n'
++ file.write(( 'void\n'
+ '%(name)s_clear(struct %(name)s *tmp)\n'
+ '{'
+- ) % { 'name' : self._name }
++ '\n') % { 'name' : self._name })
+ for entry in self._entries:
+ self.PrintIndented(file, ' ', entry.CodeClear('tmp'))
+
+- print >>file, '}\n'
++ file.write('}\n\n')
+
+ # Freeing
+- print >>file, ( 'void\n'
++ file.write(( 'void\n'
+ '%(name)s_free(struct %(name)s *tmp)\n'
+ '{'
+- ) % { 'name' : self._name }
++ '\n') % { 'name' : self._name })
+
+ for entry in self._entries:
+ self.PrintIndented(file, ' ', entry.CodeFree('tmp'))
+
+- print >>file, (' free(tmp);\n'
+- '}\n')
++ file.write((' free(tmp);\n'
++ '}\n\n'))
+
+ # Marshaling
+- print >>file, ('void\n'
++ file.write(('void\n'
+ '%(name)s_marshal(struct evbuffer *evbuf, '
+ 'const struct %(name)s *tmp)'
+- '{') % { 'name' : self._name }
++ '{\n') % { 'name' : self._name })
+ for entry in self._entries:
+ indent = ' '
+ # Optional entries do not have to be set
+ if entry.Optional():
+ indent += ' '
+- print >>file, ' if (tmp->%s_set) {' % entry.Name()
++ file.write(' if (tmp->%s_set) {\n' % entry.Name())
+ self.PrintIndented(
+ file, indent,
+ entry.CodeMarshal('evbuf', self.EntryTagName(entry),
+ entry.GetVarName('tmp'),
+ entry.GetVarLen('tmp')))
+ if entry.Optional():
+- print >>file, ' }'
++ file.write(' }\n')
+
+- print >>file, '}\n'
++ file.write('}\n\n')
+
+ # Unmarshaling
+- print >>file, ('int\n'
++ file.write(('int\n'
+ '%(name)s_unmarshal(struct %(name)s *tmp, '
+ ' struct evbuffer *evbuf)\n'
+ '{\n'
+@@ -255,14 +253,14 @@
+ ' if (evtag_peek(evbuf, &tag) == -1)\n'
+ ' return (-1);\n'
+ ' switch (tag) {\n'
+- ) % { 'name' : self._name }
++ '\n') % { 'name' : self._name })
+ for entry in self._entries:
+- print >>file, ' case %s:\n' % self.EntryTagName(entry)
++ file.write(' case %s:\n' % self.EntryTagName(entry))
+ if not entry.Array():
+- print >>file, (
++ file.write((
+ ' if (tmp->%s_set)\n'
+ ' return (-1);'
+- ) % (entry.Name())
++ '\n') % (entry.Name()))
+
+ self.PrintIndented(
+ file, ' ',
+@@ -271,26 +269,26 @@
+ entry.GetVarName('tmp'),
+ entry.GetVarLen('tmp')))
+
+- print >>file, ( ' tmp->%s_set = 1;\n' % entry.Name() +
+- ' break;\n' )
+- print >>file, ( ' default:\n'
++ file.write(( ' tmp->%s_set = 1;\n' % entry.Name() +
++ ' break;\n' ))
++ file.write(( ' default:\n'
+ ' return -1;\n'
+ ' }\n'
+- ' }\n' )
++ ' }\n\n' ))
+ # Check if it was decoded completely
+- print >>file, ( ' if (%(name)s_complete(tmp) == -1)\n'
++ file.write(( ' if (%(name)s_complete(tmp) == -1)\n'
+ ' return (-1);'
+- ) % { 'name' : self._name }
++ '\n') % { 'name' : self._name })
+
+ # Successfully decoded
+- print >>file, ( ' return (0);\n'
+- '}\n')
++ file.write(( ' return (0);\n'
++ '}\n\n'))
+
+ # Checking if a structure has all the required data
+- print >>file, (
++ file.write((
+ 'int\n'
+ '%(name)s_complete(struct %(name)s *msg)\n'
+- '{' ) % { 'name' : self._name }
++ '{\n' ) % { 'name' : self._name })
+ for entry in self._entries:
+ if not entry.Optional():
+ code = [
+@@ -303,12 +301,12 @@
+ self.PrintIndented(
+ file, ' ',
+ entry.CodeComplete('msg', entry.GetVarName('msg')))
+- print >>file, (
++ file.write((
+ ' return (0);\n'
+- '}\n' )
++ '}\n\n' ))
+
+ # Complete message unmarshaling
+- print >>file, (
++ file.write((
+ 'int\n'
+ 'evtag_unmarshal_%(name)s(struct evbuffer *evbuf, '
+ 'ev_uint32_t need_tag, struct %(name)s *msg)\n'
+@@ -330,10 +328,10 @@
+ ' error:\n'
+ ' evbuffer_free(tmp);\n'
+ ' return (res);\n'
+- '}\n' ) % { 'name' : self._name }
++ '}\n\n' ) % { 'name' : self._name })
+
+ # Complete message marshaling
+- print >>file, (
++ file.write((
+ 'void\n'
+ 'evtag_marshal_%(name)s(struct evbuffer *evbuf, ev_uint32_t tag, '
+ 'const struct %(name)s *msg)\n'
+@@ -343,7 +341,7 @@
+ ' %(name)s_marshal(buf_, msg);\n'
+ ' evtag_marshal_buffer(evbuf, tag, buf_);\n '
+ ' evbuffer_free(buf_);\n'
+- '}\n' ) % { 'name' : self._name }
++ '}\n\n' ) % { 'name' : self._name })
+
+ class Entry:
+ def __init__(self, type, name, tag):
+@@ -420,7 +418,7 @@
+ "optaddarg" :
+ self._optaddarg and ", const %s value" % self._ctype or ""
+ }
+- for (k, v) in extradict.items():
++ for (k, v) in list(extradict.items()):
+ mapping[k] = v
+
+ return mapping
+@@ -1127,7 +1125,7 @@
+
+ codearrayassign = self._entry.CodeArrayAssign(
+ 'msg->%(name)s_data[off]' % self.GetTranslation(), 'value')
+- code += map(lambda x: ' ' + x, codearrayassign)
++ code += [' ' + x for x in codearrayassign]
+
+ code += TranslateList([
+ ' }',
+@@ -1168,7 +1166,7 @@
+
+ code = TranslateList(code, self.GetTranslation())
+
+- code += map(lambda x: ' ' + x, codearrayadd)
++ code += [' ' + x for x in codearrayadd]
+
+ code += TranslateList([
+ ' msg->%(name)s_set = 1;',
+@@ -1196,7 +1194,7 @@
+
+ code = TranslateList(code, translate)
+
+- code += map(lambda x: ' ' + x, tmp)
++ code += [' ' + x for x in tmp]
+
+ code += [
+ ' }',
+@@ -1261,7 +1259,7 @@
+ code = TranslateList(code, translate)
+
+ if codearrayfree:
+- code += map(lambda x: ' ' + x, codearrayfree)
++ code += [' ' + x for x in codearrayfree]
+ code += [
+ ' }' ]
+
+@@ -1687,23 +1685,23 @@
+
+ declare('... creating "%s"' % header_file)
+ header_fp = open(header_file, 'w')
+- print >>header_fp, factory.HeaderPreamble(filename)
++ header_fp.write(factory.HeaderPreamble(filename))
+
+ # Create forward declarations: allows other structs to reference
+ # each other
+ for entry in entities:
+ entry.PrintForwardDeclaration(header_fp)
+- print >>header_fp, ''
++ header_fp.write('\n')
+
+ for entry in entities:
+ entry.PrintTags(header_fp)
+ entry.PrintDeclaration(header_fp)
+- print >>header_fp, factory.HeaderPostamble(filename)
++ header_fp.write(factory.HeaderPostamble(filename))
+ header_fp.close()
+
+ declare('... creating "%s"' % impl_file)
+ impl_fp = open(impl_file, 'w')
+- print >>impl_fp, factory.BodyPreamble(filename, header_file)
++ impl_fp.write(factory.BodyPreamble(filename, header_file))
+ for entry in entities:
+ entry.PrintCode(impl_fp)
+ impl_fp.close()
+@@ -1713,16 +1711,16 @@
+ CommandLine(sys.argv).run()
+ sys.exit(0)
+
+- except RpcGenError, e:
+- print >>sys.stderr, e
++ except RpcGenError as e:
++ sys.stderr.write(e)
+ sys.exit(1)
+
+- except EnvironmentError, e:
++ except EnvironmentError as e:
+ if e.filename and e.strerror:
+- print >>sys.stderr, "%s: %s" % (e.filename, e.strerror)
++ sys.stderr.write("%s: %s" % (e.filename, e.strerror))
+ sys.exit(1)
+ elif e.strerror:
+- print >> sys.stderr, e.strerror
++ sys.stderr.write(e.strerror)
+ sys.exit(1)
+ else:
+ raise
diff --git a/user/libpipeline/APKBUILD b/user/libpipeline/APKBUILD
deleted file mode 100644
index d5a5fda67..000000000
--- a/user/libpipeline/APKBUILD
+++ /dev/null
@@ -1,36 +0,0 @@
-# Contributor: A. Wilcox <awilfox@adelielinux.org>
-# Maintainer: A. Wilcox <awilfox@adelielinux.org>
-pkgname=libpipeline
-pkgver=1.4.1
-pkgrel=0
-pkgdesc="C pipeline manipulation library"
-url="http://libpipeline.nongnu.org/"
-arch="all"
-license="GPL-3+"
-checkdepends="check-dev"
-subpackages="$pkgname-dev $pkgname-doc"
-source="http://download.savannah.nongnu.org/releases/libpipeline/libpipeline-$pkgver.tar.gz"
-
-build() {
- cd "$builddir"
- ./configure \
- --build=$CBUILD \
- --host=$CHOST \
- --prefix=/usr \
- --sysconfdir=/etc \
- --mandir=/usr/share/man \
- --localstatedir=/var
- make
-}
-
-package() {
- cd "$builddir"
- make DESTDIR="$pkgdir" install
-}
-
-check() {
- cd "$builddir"
- make check
-}
-
-sha512sums="835d65aa3f9436398b5421544ca7857fe9caed52cd2e70320ea04d6315825e648df930e1c225d4aaf0f2edda2a438f6c00f15c556fb9fd30311560fb8d966797 libpipeline-1.4.1.tar.gz"
diff --git a/user/man-db/APKBUILD b/user/man-db/APKBUILD
deleted file mode 100644
index a645b2b7e..000000000
--- a/user/man-db/APKBUILD
+++ /dev/null
@@ -1,50 +0,0 @@
-# Contributor: A. Wilcox <awilfox@adelielinux.org>
-# Maintainer: A. Wilcox <awilfox@adelielinux.org>
-pkgname=man-db
-pkgver=2.7.6.1
-pkgrel=2
-pkgdesc="The man command and related utilities for examining on-line help files"
-url="http://www.nongnu.org/man-db/"
-arch="all"
-license="GPL-2+"
-depends="groff less"
-makedepends_host="db-dev gettext-dev libpipeline-dev zlib-dev"
-subpackages="$pkgname-doc"
-[ "$CBUILD" != "$CHOST" ] || subpackages="$subpackages $pkgname-lang"
-options="!check" # requires //IGNORE in iconv
-source="http://download.savannah.nongnu.org/releases/man-db/man-db-$pkgver.tar.xz
- man-db.trigger
- man-db-2.7.5-iconv.patch"
-triggers="man-db.trigger=/usr/share/man"
-
-build() {
- cd "$builddir"
- ./configure \
- --build=$CBUILD \
- --host=$CHOST \
- --prefix=/usr \
- --sysconfdir=/etc \
- --mandir=/usr/share/man \
- --localstatedir=/var \
- --disable-setuid \
- --with-sections="1 1p 1x 2 2x 3 3p 3x 4 4x 5 5x 6 6x 7 7x 8 8x 9 0p tcl n l p o" \
- --enable-nls \
- --with-db=db
- make
-}
-
-check() {
- cd "$builddir"
- make check
-}
-
-package() {
- cd "$builddir"
- make DESTDIR="$pkgdir" install
- rm "${pkgdir}"/usr/lib/charset.alias
- rm -r "${pkgdir}"/usr/lib/tmpfiles.d # systemd
-}
-
-sha512sums="623c5e7f8b7c289908b2c926f8777293b8d39aeceef0d2509d701a8b0bfa81408650f655c8608318221786c751a79ee91124b07993de5298cd7fa6d8bb737301 man-db-2.7.6.1.tar.xz
-0d2ab0b42888178ffb83c5dd5eaac8005f047de56af55eb3046291318fd8ed8c4999a4ea0148367ea07c0a0490eb8b9bc726a03b46533ef51bec6a5747719b64 man-db.trigger
-bdf53b2868eb0652f8ca5bec340736a1923b52921bc1a33bde691f005be937f0a01dd32ff46d04ba956aa9c05b2cf276a03877de6c5fd1d997c4a5b029f330e2 man-db-2.7.5-iconv.patch"
diff --git a/user/man-db/man-db-2.7.5-iconv.patch b/user/man-db/man-db-2.7.5-iconv.patch
deleted file mode 100644
index 24fea8872..000000000
--- a/user/man-db/man-db-2.7.5-iconv.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-diff --git man-db-2.7.5/src/man.c man-db-fixed/src/man.c
-index bea684f..df5f5cb 100644
---- man-db-2.7.5/src/man.c
-+++ man-db-fixed/src/man.c
-@@ -1503,11 +1503,9 @@ static void add_output_iconv (pipeline *p,
- {
- debug ("add_output_iconv: source %s, target %s\n", source, target);
- if (source && target && !STREQ (source, target)) {
-- char *target_translit = xasprintf ("%s//TRANSLIT", target);
- pipeline_command_args (p, "iconv", "-c",
-- "-f", source, "-t", target_translit,
-+ "-f", source, "-t", target,
- NULL);
-- free (target_translit);
- }
- }
-
-diff --git man-db-2.7.5/src/manconv.c man-db-fixed/src/manconv.c
-index cae9b67..48b7a81 100644
---- man-db-2.7.5/src/manconv.c
-+++ man-db-fixed/src/manconv.c
-@@ -106,10 +106,9 @@ static int try_iconv (pipeline *p, const char *try_from_code, const char *to,
- static char *utf8 = NULL, *output = NULL;
- size_t utf8left = 0;
- iconv_t cd_utf8, cd = NULL;
-- int to_utf8 = STREQ (try_to_code, "UTF-8") ||
-- STRNEQ (try_to_code, "UTF-8//", 7);
-- const char *utf8_target = last ? "UTF-8//IGNORE" : "UTF-8";
-- int ignore_errors = (strstr (try_to_code, "//IGNORE") != NULL);;
-+ int to_utf8 = STREQ (try_to_code, "UTF-8");
-+ const char *utf8_target = "UTF-8";
-+ int ignore_errors = 0;
- int ret = 0;
-
- debug ("trying encoding %s -> %s\n", try_from_code, try_to_code);
-diff --git man-db-2.7.5/src/manconv_client.c man-db-fixed/src/manconv_client.c
-index 2949c75..7805f90 100644
---- man-db-2.7.5/src/manconv_client.c
-+++ man-db-fixed/src/manconv_client.c
-@@ -131,7 +131,7 @@ void add_manconv (pipeline *p, const char *source, const char *target)
- codes->from[2] = NULL;
- name = appendstr (name, "UTF-8:", source, NULL);
- }
-- codes->to = xasprintf ("%s//IGNORE", target);
-+ codes->to = xstrdup (target);
- /* informational only; no shell quoting concerns */
- name = appendstr (name, " -t ", codes->to, NULL);
- if (quiet >= 2)
-diff --git man-db-2.7.5/src/manconv_main.c man-db-fixed/src/manconv_main.c
-index 166a2b8..4e700e9 100644
---- man-db-2.7.5/src/manconv_main.c
-+++ man-db-fixed/src/manconv_main.c
-@@ -105,9 +105,6 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state)
- return 0;
- case 't':
- to_code = xstrdup (arg);
-- if (!strstr (to_code, "//"))
-- to_code = appendstr (to_code, "//TRANSLIT",
-- NULL);
- return 0;
- case 'd':
- debug_level = 1;
-diff --git man-db-2.7.5/src/whatis.c man-db-fixed/src/whatis.c
-index 39aa093..0a25c92 100644
---- man-db-2.7.5/src/whatis.c
-+++ man-db-fixed/src/whatis.c
-@@ -948,7 +948,7 @@ int main (int argc, char *argv[])
- display_seen = hashtable_create (&null_hashtable_free);
-
- #ifdef HAVE_ICONV
-- locale_charset = xasprintf ("%s//IGNORE", get_locale_charset ());
-+ locale_charset = xstrdup (get_locale_charset ());
- conv_to_locale = iconv_open (locale_charset, "UTF-8");
- free (locale_charset);
- #endif /* HAVE_ICONV */
diff --git a/user/man-db/man-db.trigger b/user/man-db/man-db.trigger
deleted file mode 100644
index fb76aa38c..000000000
--- a/user/man-db/man-db.trigger
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-exec /usr/bin/mandb /usr/share/man
diff --git a/user/mawk/APKBUILD b/user/mawk/APKBUILD
deleted file mode 100644
index bed717f6e..000000000
--- a/user/mawk/APKBUILD
+++ /dev/null
@@ -1,37 +0,0 @@
-# Contributor: A. Wilcox <awilfox@adelielinux.org>
-# Maintainer: A. Wilcox <awilfox@adelielinux.org>
-pkgname=mawk
-pkgver=20161120
-pkgrel=1
-pkgdesc="Pattern scanning and text processing language"
-url="http://invisible-island.net/mawk/mawk.html"
-arch="all"
-license="BSD-3-Clause"
-subpackages="$pkgname-doc"
-source="http://invisible-mirror.net/archives/$pkgname/$pkgname-1.3.4-$pkgver.tgz"
-builddir="$srcdir/$pkgname-1.3.4-$pkgver"
-
-build() {
- cd "$builddir"
- ./configure \
- --build=$CBUILD \
- --host=$CHOST \
- --prefix=/usr \
- --sysconfdir=/etc \
- --mandir=/usr/share/man \
- --localstatedir=/var
- make
-}
-
-package() {
- cd "$builddir"
- make DESTDIR="$pkgdir" install
- ln -s mawk "$pkgdir"/usr/bin/awk
-}
-
-check() {
- cd "$builddir"
- make check
-}
-
-sha512sums="c5edcbff4ab1e40eb9b178a045fcd426a5f3c93a3ab5bc1ca1fa85a0977b8c9060967fcbda4e4a6e9e68628f50a2814e22939676008dced529377d2cf9bda5b2 mawk-1.3.4-20161120.tgz"
diff --git a/user/mesa/APKBUILD b/user/mesa/APKBUILD
new file mode 100644
index 000000000..ceb22c20f
--- /dev/null
+++ b/user/mesa/APKBUILD
@@ -0,0 +1,252 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=mesa
+pkgver=17.3.1
+pkgrel=1
+pkgdesc="Mesa DRI OpenGL library"
+url="http://www.mesa3d.org"
+arch="all"
+license="LGPL"
+depends=
+subpackages="$pkgname-dev
+ $pkgname-dri-ati:_dri
+ $pkgname-dri-nouveau:_dri
+ $pkgname-dri-freedreno:_dri
+ $pkgname-dri-swrast:_dri
+ $pkgname-dri-virtio:_dri
+ $pkgname-glapi $pkgname-egl $pkgname-gl $pkgname-gles
+ $pkgname-xatracker $pkgname-osmesa $pkgname-gbm
+ $pkgname-libwayland-egl:_wayland
+ "
+_llvmver=4
+depends_dev="libdrm-dev dri2proto libxext-dev libxdamage-dev libxcb-dev glproto
+ dri3proto presentproto libxshmfence-dev"
+makedepends="$depends_dev expat-dev xextproto libxt-dev makedepend py3-mako
+ flex bison llvm$_llvmver-dev eudev-dev libvdpau-dev python3 py-libxml2
+ libxvmc-dev gettext zlib-dev wayland-dev libelf-dev wayland-protocols
+ autoconf automake libtool libxxf86vm-dev libx11-dev libxfixes-dev"
+source="https://mesa.freedesktop.org/archive/mesa-$pkgver.tar.xz
+ glx_ro_text_segm.patch
+ musl-fixes.patch
+ musl-fix-includes.patch
+ disk_cache-stack-overflow.patch
+ drmdeps.patch
+ python3-compat.patch
+ "
+replaces="mesa-dricore"
+
+_dri_driverdir=/usr/lib/xorg/modules/dri
+_dri_drivers="r200,radeon,nouveau,swrast"
+_gallium_drivers="r300,r600,radeonsi,nouveau,freedreno,swrast,virgl"
+_vulkan_drivers="radeon"
+
+builddir="$srcdir/mesa-$pkgver"
+
+_arch_opts=
+
+case "$CARCH" in
+x86* | pmmx)
+ _dri_drivers="${_dri_drivers},i915,i965"
+ _gallium_drivers="${_gallium_drivers},svga"
+ _vulkan_drivers="${_vulkan_drivers},intel"
+ subpackages="$subpackages $pkgname-dri-intel:_dri $pkgname-dri-vmwgfx:_dri"
+ ;;
+arm*)
+ _gallium_drivers="${_gallium_drivers},vc4"
+ case "$CARCH" in
+ armhf) CFLAGS="$CFLAGS -mfpu=neon";;
+ esac
+ ;;
+esac
+
+prepare() {
+ cd "$builddir"
+ default_prepare
+ libtoolize --force \
+ && aclocal \
+ && automake --add-missing \
+ && autoreconf
+}
+
+build() {
+ cd "$builddir"
+
+ export CFLAGS="$CFLAGS -D_XOPEN_SOURCE=700"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --with-dri-driverdir=$_dri_driverdir \
+ --disable-asm \
+ --disable-xvmc \
+ --enable-glx-rts \
+ --with-gallium-drivers=${_gallium_drivers} \
+ --with-dri-drivers=${_dri_drivers} \
+ --with-vulkan-drivers=${_vulkan_drivers} \
+ --with-llvm-prefix=/usr/lib/llvm$_llvmver \
+ --enable-llvm-shared-libs \
+ --enable-llvm \
+ --with-platforms=x11,drm,wayland \
+ --enable-shared-glapi \
+ --enable-gbm \
+ --disable-glx-tls \
+ --disable-nine \
+ --enable-dri \
+ --enable-dri3 \
+ --enable-glx \
+ --enable-osmesa \
+ --enable-gles1 \
+ --enable-gles2 \
+ --enable-egl \
+ --enable-texture-float \
+ --enable-xa \
+ --enable-vdpau \
+ $_arch_opts
+
+ make
+}
+
+check() {
+ cd "$builddir"
+ # Compiler test requires LLVM 3.8 and Python 2
+ for i in gtest util mapi; do
+ make -C "src/$i" check
+ done
+}
+
+package() {
+ cd "$builddir"
+ make -j1 DESTDIR="$pkgdir" install
+}
+
+egl() {
+ replaces="mesa"
+ pkgdesc="Mesa libEGL runtime libraries"
+ install -d "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libEGL.so* \
+ "$subpkgdir"/usr/lib/
+}
+
+gl() {
+ replaces="mesa"
+ pkgdesc="Mesa libGL runtime libraries"
+ install -d "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libGL.so* \
+ "$subpkgdir"/usr/lib/
+}
+
+glapi() {
+ replaces="$pkgname-gles"
+ pkgdesc="Mesa shared glapi"
+ install -d "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libglapi.so.* \
+ "$subpkgdir"/usr/lib/
+}
+
+gles() {
+ replaces="mesa"
+ pkgdesc="Mesa libGLESv2 runtime libraries"
+ install -d "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libGLES*.so* \
+ "$subpkgdir"/usr/lib/
+}
+
+xatracker() {
+ pkgdesc="Mesa XA state tracker for vmware"
+ install -d "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libxatracker*.so.* \
+ "$subpkgdir"/usr/lib/
+}
+
+osmesa() {
+ pkgdesc="Mesa offscreen rendering libraries"
+ install -d "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libOSMesa.so.* \
+ "$subpkgdir"/usr/lib/
+}
+
+gbm() {
+ pkgdesc="Mesa gbm library"
+ replaces="mesa"
+ install -d "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libgbm.so.* \
+ "$subpkgdir"/usr/lib/
+}
+
+_mv_dri() {
+ install -d "$subpkgdir"/$_dri_driverdir
+
+ while [ $# -gt 0 ]; do
+ mv "$pkgdir"/$_dri_driverdir/${1}.so \
+ "$subpkgdir"/$_dri_driverdir/ || return 1
+ shift
+ done
+}
+
+_mv_vdpau() {
+ local i
+ install -d "$subpkgdir"/usr/lib/vdpau
+ for i in "$@"; do
+ mv "$pkgdir"/usr/lib/vdpau/libvdpau_$i.* \
+ "$subpkgdir"/usr/lib/vdpau/ || return 1
+ done
+}
+
+_mv_gpipe() {
+ return 0
+ # http://cgit.freedesktop.org/mesa/mesa/commit/?id=44ec468e8033553c26a112cebba41c343db00eb1
+ # https://code.google.com/p/chromium/issues/detail?id=412089
+# local i
+# install -d "$subpkgdir"/usr/lib/gallium-pipe
+# for i in "$@"; do
+# mv "$pkgdir"/usr/lib/gallium-pipe/pipe_$i.* \
+# "$subpkgdir"/usr/lib/gallium-pipe/ || return 1
+# done
+}
+
+_dri() {
+ local n=${subpkgname##*-dri-}
+ pkgdesc="Mesa DRI driver for $n"
+ case $n in
+ ati)
+ _mv_dri radeon_dri r200_dri r300_dri r600_dri radeonsi_dri \
+ && _mv_vdpau r300 r600 radeonsi \
+ && _mv_gpipe r300 r600
+ ;;
+ intel)
+ _mv_dri i915_dri i965_dri
+ ;;
+ nouveau)
+ _mv_dri nouveau_dri nouveau_vieux_dri \
+ && _mv_vdpau nouveau \
+ && _mv_gpipe nouveau
+ ;;
+ freedreno)
+ _mv_dri msm_dri kgsl_dri
+ ;;
+ swrast)
+ _mv_dri swrast_dri kms_swrast_dri && _mv_gpipe swrast
+ ;;
+ vmwgfx)
+ _mv_dri vmwgfx_dri && _mv_gpipe vmwgfx
+ ;;
+ virtio)
+ _mv_dri virtio_gpu_dri
+ ;;
+ esac
+}
+
+_wayland() {
+ pkgdesc="Mesa libwayland-egl library"
+ mkdir -p "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libwayland-egl.so.* "$subpkgdir"/usr/lib/ \
+ || return 1
+}
+
+sha512sums="a2bd0123bf2df0db03197001a9e001b25f2609f3c6bf1bae66f3bc50c51d2558b5b77e232e81c1658c3a4dec88eda32a8b5a85c1fedc937a7441476228ef8238 mesa-17.3.1.tar.xz
+c3d4804ebc24c7216e4c9d4995fb92e116be7f478024b44808ee134a4c93bb51d1f66fe5fb6eca254f124c4abf6f81272b027824b3e2650a9607818bf793035a glx_ro_text_segm.patch
+edb9c221b093117f48fa298ae557f1d6ed9bbf32d7d262ad4ddb51d26ece94e3efac17670784606052b2ebe8d3dc2b221164f6b52f5282eb3318e6377932be04 musl-fixes.patch
+c7d91a660a033df91fac9c557039efc8669f0c26b2d35997d50753938b70d1af0bd110dcab3f8236eafab7d4be5dd7cd128a3e057e67e7e6a38a73fd6a7ef62e musl-fix-includes.patch
+f40ff04ac73c090c74d1955de6013c5aa41fb77f28b2b82d89cfc1880306a9ca1dde4581592db19f0a0ec6d85032f1ed5d953103ab0d075f9f0b7e459a028c45 disk_cache-stack-overflow.patch
+6800bc62aebfba22a2562c858c27391b47c5675020bd67f040da93ffe4d5d8ac828907a44c7cee6a4ebe63821b58c2515b4012f1f23473670b1de8670426a430 drmdeps.patch
+be91c579111e4ceadf094fcd55fff46ff12c360e2d89c98fac50fbd3bb2459dbd1209d562d27338b94b20bbeae5fca2dd881694bd0da55fca8cdfe253ae384f1 python3-compat.patch"
diff --git a/user/mesa/disk_cache-stack-overflow.patch b/user/mesa/disk_cache-stack-overflow.patch
new file mode 100644
index 000000000..3fad95259
--- /dev/null
+++ b/user/mesa/disk_cache-stack-overflow.patch
@@ -0,0 +1,42 @@
+The disk cache code tries to allocate a 256 Kbyte buffer on the stack.
+Since musl only gives 80 Kbyte of stack space per thread, this causes a trap.
+
+--- mesa-17.3.1/src/util/disk_cache.c.old 2017-12-21 11:31:22.000000000 -0600
++++ mesa-17.3.1/src/util/disk_cache.c 2017-12-29 01:17:15.625633901 -0600
+@@ -716,7 +716,7 @@
+ deflate_and_write_to_disk(const void *in_data, size_t in_data_size, int dest,
+ const char *filename)
+ {
+- unsigned char out[BUFSIZE];
++ unsigned char *out;
+
+ /* allocate deflate state */
+ z_stream strm;
+@@ -733,6 +733,11 @@
+ /* compress until end of in_data */
+ size_t compressed_size = 0;
+ int flush;
++
++ out = calloc(1, BUFSIZE);
++ if (out == NULL)
++ return 0;
++
+ do {
+ int remaining = in_data_size - BUFSIZE;
+ flush = remaining > 0 ? Z_NO_FLUSH : Z_FINISH;
+@@ -754,6 +759,7 @@
+ ssize_t written = write_all(dest, out, have);
+ if (written == -1) {
+ (void)deflateEnd(&strm);
++ free(out);
+ return 0;
+ }
+ } while (strm.avail_out == 0);
+@@ -768,6 +774,7 @@
+
+ /* clean up and return */
+ (void)deflateEnd(&strm);
++ free(out);
+ return compressed_size;
+ }
+
diff --git a/user/mesa/drmdeps.patch b/user/mesa/drmdeps.patch
new file mode 100644
index 000000000..edcb80643
--- /dev/null
+++ b/user/mesa/drmdeps.patch
@@ -0,0 +1,41 @@
+--- a/src/gallium/winsys/radeon/drm/Makefile.am 2017-08-10 11:45:20.737377457 -0400
++++ b/src/gallium/winsys/radeon/drm/Makefile.am 2017-08-10 11:50:23.414534307 -0400
+@@ -7,4 +7,6 @@
+
+ noinst_LTLIBRARIES = libradeonwinsys.la
+
++libradeonwinsys_la_LIBADD = -ldrm_radeon
++
+ libradeonwinsys_la_SOURCES = $(C_SOURCES)
+--- a/src/gallium/winsys/radeon/drm/Makefile.in 2017-08-10 11:45:25.577298181 -0400
++++ b/src/gallium/winsys/radeon/drm/Makefile.in 2017-08-10 11:57:11.151189074 -0400
+@@ -119,7 +119,7 @@
+ CONFIG_CLEAN_FILES =
+ CONFIG_CLEAN_VPATH_FILES =
+ LTLIBRARIES = $(noinst_LTLIBRARIES)
+-libradeonwinsys_la_LIBADD =
++libradeonwinsys_la_LIBADD = -ldrm_radeon
+ am__objects_1 = radeon_drm_bo.lo radeon_drm_cs.lo \
+ radeon_drm_surface.lo radeon_drm_winsys.lo
+ am_libradeonwinsys_la_OBJECTS = $(am__objects_1)
+--- a/src/gallium/winsys/amdgpu/drm/Makefile.am 2017-12-21 11:31:21.000000000 -0600
++++ b/src/gallium/winsys/amdgpu/drm/Makefile.am 2017-12-28 19:24:48.613693400 -0600
+@@ -11,6 +11,6 @@
+ noinst_LTLIBRARIES = libamdgpuwinsys.la
+
+ libamdgpuwinsys_la_LIBADD = \
+- $(top_builddir)/src/amd/addrlib/libamdgpu_addrlib.la
++ $(top_builddir)/src/amd/addrlib/libamdgpu_addrlib.la -ldrm_amdgpu
+
+ libamdgpuwinsys_la_SOURCES = $(C_SOURCES)
+--- a/src/gallium/winsys/amdgpu/drm/Makefile.in 2017-12-21 11:31:30.000000000 -0600
++++ b/src/gallium/winsys/amdgpu/drm/Makefile.in 2017-12-28 19:25:22.553597353 -0600
+@@ -572,7 +572,7 @@
+ AM_CXXFLAGS = $(AM_CFLAGS)
+ noinst_LTLIBRARIES = libamdgpuwinsys.la
+ libamdgpuwinsys_la_LIBADD = \
+- $(top_builddir)/src/amd/addrlib/libamdgpu_addrlib.la
++ $(top_builddir)/src/amd/addrlib/libamdgpu_addrlib.la -ldrm_amdgpu
+
+ libamdgpuwinsys_la_SOURCES = $(C_SOURCES)
+ all: all-am
diff --git a/user/mesa/glx_ro_text_segm.patch b/user/mesa/glx_ro_text_segm.patch
new file mode 100644
index 000000000..8cad4876b
--- /dev/null
+++ b/user/mesa/glx_ro_text_segm.patch
@@ -0,0 +1,28 @@
+2011-02-09 Jeremy Huddleston <jeremyhu@freedesktop.org
+
+ #240956
+ * configure.ac add support to enable readonly test segment on x86
+
+--- ./configure.ac.orig 2008-11-17 23:19:38.000000000 +0100
++++ ./configure.ac 2008-11-17 23:20:17.000000000 +0100
+@@ -499,6 +499,20 @@
+ enable_xcb=no
+ fi
+
++
++dnl readonly text segment on x86 hardened platforms
++AC_ARG_ENABLE([glx_rts],
++ [AS_HELP_STRING([--enable-glx-rts],
++ [on x86, use a readonly text segment for libGL @<:@default=disabled@:>@])],
++ [enable_glx_rts="$enableval"],
++ [enable_glx_rts=no])
++if test "x$enable_glx_rts" = xyes; then
++ DEFINES="$DEFINES -DGLX_X86_READONLY_TEXT"
++else
++ enable_glx_rts=no
++fi
++
++
+ dnl
+ dnl libGL configuration per driver
+ dnl
diff --git a/user/mesa/musl-fix-includes.patch b/user/mesa/musl-fix-includes.patch
new file mode 100644
index 000000000..2f6cc1d13
--- /dev/null
+++ b/user/mesa/musl-fix-includes.patch
@@ -0,0 +1,14 @@
+diff --git a/src/util/rand_xor.c b/src/util/rand_xor.c
+index de05fa6..016703c 100644
+--- a/src/util/rand_xor.c
++++ b/src/util/rand_xor.c
+@@ -24,6 +24,9 @@
+
+ #if defined(__linux__)
+ #include <sys/file.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <fcntl.h>
+ #include <unistd.h>
+ #else
+ #include <time.h>
diff --git a/user/mesa/musl-fixes.patch b/user/mesa/musl-fixes.patch
new file mode 100644
index 000000000..60140d445
--- /dev/null
+++ b/user/mesa/musl-fixes.patch
@@ -0,0 +1,22 @@
+--- ./src/gallium/winsys/svga/drm/vmw_screen.h.orig
++++ ./src/gallium/winsys/svga/drm/vmw_screen.h
+@@ -34,7 +34,7 @@
+ #ifndef VMW_SCREEN_H_
+ #define VMW_SCREEN_H_
+
+-
++#include <sys/stat.h>
+ #include "pipe/p_compiler.h"
+ #include "pipe/p_state.h"
+
+--- a/src/util/u_endian.h.orig 2016-11-04 12:16:00.480356454 +0100
++++ b/src/util/u_endian.h 2016-11-04 12:16:11.984347944 +0100
+@@ -27,7 +27,7 @@
+ #ifndef U_ENDIAN_H
+ #define U_ENDIAN_H
+
+-#if defined(__GLIBC__) || defined(ANDROID) || defined(__CYGWIN__)
++#if defined(__linux__) || defined(ANDROID) || defined(__CYGWIN__)
+ #include <endian.h>
+
+ #if __BYTE_ORDER == __LITTLE_ENDIAN
diff --git a/user/mesa/python3-compat.patch b/user/mesa/python3-compat.patch
new file mode 100644
index 000000000..8532f8c0c
--- /dev/null
+++ b/user/mesa/python3-compat.patch
@@ -0,0 +1,106 @@
+--- mesa-17.3.1/src/gallium/drivers/r600/egd_tables.py (original)
++++ mesa-17.3.1/src/gallium/drivers/r600/egd_tables.py (refactored)
+@@ -60,7 +60,7 @@
+ """
+ fragments = [
+ '"%s\\0" /* %s */' % (
+- te[0].encode('string_escape'),
++ te[0].encode('unicode-escape'),
+ ', '.join(str(idx) for idx in te[2])
+ )
+ for te in self.table
+@@ -217,10 +217,10 @@
+ strings = StringTable()
+ strings_offsets = IntTable("int")
+
+- print '/* This file is autogenerated by egd_tables.py from evergreend.h. Do not edit directly. */'
+- print
+- print CopyRight.strip()
+- print '''
++ print('/* This file is autogenerated by egd_tables.py from evergreend.h. Do not edit directly. */')
++ print()
++ print(CopyRight.strip())
++ print('''
+ #ifndef EG_TABLES_H
+ #define EG_TABLES_H
+
+@@ -242,20 +242,20 @@
+ unsigned name_offset;
+ unsigned op;
+ };
+-'''
+-
+- print 'static const struct eg_packet3 packet3_table[] = {'
++''')
++
++ print('static const struct eg_packet3 packet3_table[] = {')
+ for pkt in packets:
+- print '\t{%s, %s},' % (strings.add(pkt[5:]), pkt)
+- print '};'
+- print
+-
+- print 'static const struct eg_field egd_fields_table[] = {'
++ print('\t{%s, %s},' % (strings.add(pkt[5:]), pkt))
++ print('};')
++ print()
++
++ print('static const struct eg_field egd_fields_table[] = {')
+
+ fields_idx = 0
+ for reg in regs:
+ if len(reg.fields) and reg.own_fields:
+- print '\t/* %s */' % (fields_idx)
++ print('\t/* %s */' % (fields_idx))
+
+ reg.fields_idx = fields_idx
+
+@@ -266,34 +266,34 @@
+ while value[1] >= len(values_offsets):
+ values_offsets.append(-1)
+ values_offsets[value[1]] = strings.add(strip_prefix(value[0]))
+- print '\t{%s, %s(~0u), %s, %s},' % (
++ print('\t{%s, %s(~0u), %s, %s},' % (
+ strings.add(field.name), field.s_name,
+- len(values_offsets), strings_offsets.add(values_offsets))
++ len(values_offsets), strings_offsets.add(values_offsets)))
+ else:
+- print '\t{%s, %s(~0u)},' % (strings.add(field.name), field.s_name)
++ print('\t{%s, %s(~0u)},' % (strings.add(field.name), field.s_name))
+ fields_idx += 1
+
+- print '};'
+- print
+-
+- print 'static const struct eg_reg egd_reg_table[] = {'
++ print('};')
++ print()
++
++ print('static const struct eg_reg egd_reg_table[] = {')
+ for reg in regs:
+ if len(reg.fields):
+- print '\t{%s, %s, %s, %s},' % (strings.add(reg.name), reg.r_name,
+- len(reg.fields), reg.fields_idx if reg.own_fields else reg.fields_owner.fields_idx)
++ print('\t{%s, %s, %s, %s},' % (strings.add(reg.name), reg.r_name,
++ len(reg.fields), reg.fields_idx if reg.own_fields else reg.fields_owner.fields_idx))
+ else:
+- print '\t{%s, %s},' % (strings.add(reg.name), reg.r_name)
+- print '};'
+- print
++ print('\t{%s, %s},' % (strings.add(reg.name), reg.r_name))
++ print('};')
++ print()
+
+ strings.emit(sys.stdout, "egd_strings")
+
+- print
++ print()
+
+ strings_offsets.emit(sys.stdout, "egd_strings_offsets")
+
+- print
+- print '#endif'
++ print()
++ print('#endif')
+
+
+ def main():
diff --git a/user/postgresql/APKBUILD b/user/postgresql/APKBUILD
new file mode 100644
index 000000000..e618eeb39
--- /dev/null
+++ b/user/postgresql/APKBUILD
@@ -0,0 +1,259 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+# Contributor: G.J.R. Timmer <gjr.timmer@gmail.com>
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+pkgname=postgresql
+pkgver=10.0
+pkgrel=0
+pkgdesc="A sophisticated object-relational DBMS"
+url="http://www.postgresql.org/"
+arch="all"
+license="BSD"
+depends="postgresql-client tzdata"
+options="!checkroot"
+install="$pkgname.pre-upgrade"
+pkgusers="postgres"
+pkggroups="postgres"
+checkdepends="diffutils"
+depends_dev="openssl-dev"
+makedepends="$depends_dev libedit-dev zlib-dev libxml2-dev util-linux-dev
+ openldap-dev tcl-dev perl-dev python3-dev"
+subpackages="$pkgname-contrib $pkgname-dev $pkgname-doc libpq $pkgname-libs
+ $pkgname-client $pkgname-pltcl
+ $pkgname-plperl $pkgname-plperl-contrib:plperl_contrib
+ $pkgname-plpython3 $pkgname-plpython3-contrib:plpython3_contrib"
+source="https://ftp.postgresql.org/pub/source/v$pkgver/$pkgname-$pkgver.tar.bz2
+ initdb.patch
+ perl-rpath.patch
+ conf-unix_socket_directories.patch
+ disable-broken-tests.patch
+ $pkgname.initd
+ $pkgname.confd
+ pg-restore.initd
+ pg-restore.confd
+ pltcl_create_tables.sql
+ "
+builddir="$srcdir/$pkgname-$pkgver"
+options="!checkroot"
+
+# secfixes:
+# 9.6.4-r0:
+# - CVE-2017-7546
+# - CVE-2017-7547
+# - CVE-2017-7548
+# 9.6.3-r0:
+# - CVE-2017-7484
+# - CVE-2017-7485
+# - CVE-2017-7486
+
+prepare() {
+ default_prepare
+ cd "$builddir"
+
+ local file; for file in $pkgname.initd $pkgname.confd; do
+ sed "s|@VERSION@|${pkgver%.*}|" "$srcdir"/$file > $file
+ done
+}
+
+build() {
+ _configure
+ make world
+}
+
+# Note: (...) instead of {...} is NOT a typo!
+_configure() (
+ export CFLAGS="${CFLAGS/-Os/-O2}"
+ export CPPFLAGS="${CPPFLAGS/-Os/-O2}"
+
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --mandir=/usr/share/man \
+ --with-system-tzdata=/usr/share/zoneinfo \
+ --with-ldap \
+ --with-libedit-preferred \
+ --with-libxml \
+ --with-openssl \
+ --with-uuid=e2fs \
+ --disable-rpath \
+ --with-perl \
+ --with-python \
+ --with-tcl
+)
+
+check() {
+ cd "$builddir"
+
+ _run_tests src/test
+ _run_tests src/pl
+ _run_tests contrib
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+
+ make DESTDIR="$pkgdir" install install-docs
+
+ cd "$pkgdir"
+
+ install -d -m750 -o postgres -g postgres \
+ ./var/lib/postgresql \
+ ./var/log/$pkgname
+
+ install -D -m755 "$builddir"/postgresql.initd ./etc/init.d/postgresql
+ install -D -m644 "$builddir"/postgresql.confd ./etc/conf.d/postgresql
+
+ install -D -m755 "$srcdir"/pg-restore.initd ./etc/init.d/pg-restore
+ install -D -m644 "$srcdir"/pg-restore.confd ./etc/conf.d/pg-restore
+}
+
+dev() {
+ default_dev
+
+ _submv usr/bin/pg_config \
+ usr/bin/ecpg \
+ usr/lib/postgresql/pgxs
+}
+
+libpq() {
+ pkgdesc="PostgreSQL libraries"
+ depends=""
+
+ _submv usr/lib/libpq.so.*
+}
+
+libs() {
+ depends=""
+ default_libs
+}
+
+client() {
+ pkgdesc="PostgreSQL client"
+ depends=""
+
+ cd "$pkgdir"/usr/bin
+ mkdir -p "$subpkgdir"/usr/bin
+ mv clusterdb \
+ createdb \
+ createuser \
+ dropdb \
+ dropuser \
+ pg_basebackup \
+ pg_dump \
+ pg_dumpall \
+ pg_isready \
+ pg_receivewal \
+ pg_recvlogical \
+ pg_restore \
+ psql \
+ reindexdb \
+ vacuumdb \
+ "$subpkgdir"/usr/bin/
+}
+
+contrib() {
+ pkgdesc="Extension modules distributed with PostgreSQL"
+ depends=""
+
+ cd "$builddir"
+
+ # Avoid installing plperl and plpython extensions, these will be
+ # installed into separate subpackages.
+ sed -Ei -e 's/(.*_plperl)/#\1/' \
+ -e 's/(.*_plpython)/#\1/' \
+ contrib/Makefile
+
+ make -C contrib DESTDIR="$subpkgdir" install
+
+ mv "$subpkgdir"/usr/share/doc/postgresql/extension \
+ "$pkgdir"/usr/share/doc/postgresql/
+ rmdir -p "$subpkgdir"/usr/share/doc/postgresql || true
+}
+
+pltcl() {
+ pkgdesc="PL/Tcl procedural language for PostgreSQL"
+ depends="pgtcl"
+
+ _submv usr/lib/postgresql/pltcl.so \
+ usr/share/postgresql/extension/pltcl*
+
+ install -m 644 "$srcdir"/pltcl_create_tables.sql \
+ "$subpkgdir"/usr/share/postgresql/
+}
+
+plperl() {
+ pkgdesc="PL/Perl procedural language for PostgreSQL"
+ depends=""
+
+ _submv usr/lib/postgresql/plperl.so \
+ usr/share/postgresql/extension/plperl*
+}
+
+plperl_contrib() {
+ _plcontrib plperl "PL/Perl"
+
+ cd "$builddir"
+ make -C contrib/hstore_plperl DESTDIR="$subpkgdir" install
+}
+
+plpython3() {
+ pkgdesc="PL/Python3 procedural language for PostgreSQL"
+ depends="python3"
+
+ cd "$builddir"
+ make -C src/pl/plpython DESTDIR="$subpkgdir" install
+ rm -R "$subpkgdir"/usr/include
+}
+
+plpython3_contrib() {
+ _plcontrib plpython3 "PL/Python 3"
+
+ cd "$builddir"
+ make -C contrib/hstore_plpython DESTDIR="$subpkgdir" install
+ make -C contrib/ltree_plpython DESTDIR="$subpkgdir" install
+}
+
+_plcontrib() {
+ local subname="$1"
+ pkgdesc="$2 extension modules distributed with PostgreSQL"
+ depends="$pkgname-$subname"
+ install_if="$pkgname-$subname=$pkgver-r$pkgrel $pkgname-contrib=$pkgver-r$pkgrel"
+}
+
+_run_tests() {
+ local path="$1"; shift
+
+ msg "Running test suite at $path..."
+ # Note: some tests fail when running in parallel.
+ make -k -j 1 -C "$path" $@ check MAX_CONNECTIONS=5 || {
+ printf "\n%s\n\n" "Trying to find all regression.diffs files in build directory..." >&2
+ find "$path" -name regression.diffs | while read file; do
+ echo "=== test failure: $file ===" >&2
+ cat "$file" >&2
+ done
+ return 1
+ }
+}
+
+_submv() {
+ local path; for path in "$@"; do
+ mkdir -p "$subpkgdir/${path%/*}"
+ mv "$pkgdir"/$path "$subpkgdir"/${path%/*}/
+ done
+}
+
+sha512sums="88295af13db77a85a604c925aa627d383fdac62c1185119bba87753ce4167a13aed0f055a7a1329b3051f8757c6ba7529baed00a564ef0cfbee685720f282678 postgresql-10.0.tar.bz2
+1f8e7dc58f5b0a12427cf2fd904ffa898a34f23f3332c8382b94e0d991c007289e7913a69e04498f3d93fc5701855796c207b4b1cc4a0b366f586050124d7fcc initdb.patch
+5f9d8bb4957194069d01af8ab3abc6d4d83a7e7f8bd7ebe1caae5361d621a3e58f91b14b952958138a794e0a80bc154fbb7e3e78d211e2a95b9b7901335de854 perl-rpath.patch
+8439a6fdfdea0a4867daeb8bc23d6c825f30c00d91d4c39f48653f5ee77341f23282ce03a77aad94b5369700f11d2cb28d5aee360e59138352a9ab331a9f9d0f conf-unix_socket_directories.patch
+1966b2a3971f56fbecd8daa45965236d487683e13300e5c000e595bbadbbe9d0e1301fbbfa034f452abe8a4e4a427781f772370b9ff392bb03fc11ee43c9dee7 disable-broken-tests.patch
+224e80f9e62843fd248e625abdd0d9fe477729ff3f9a64fc5c86dd37bb7176d3504107fbed7ce578e3a1db7f60b8cf2abf5fe4862c81f76b6d026e29ca495cfc postgresql.initd
+a6d9cba5c7270484b3a22083b2b37742faefb01b6643040050c92235840c601b2e206ebda32804937b729c6cf42c79a558b921900e52fc420df2a03b5f29e1f7 postgresql.confd
+f5a1cba051e7d846c2d16703514601cb25729ed96b677c9bd0c199d64552120a8b14b238af01917fdb87106681e12dee6fff7447558155ba273e4f96be5e2892 pg-restore.initd
+c14a5684e914abb3b0ee71bbf15eed71a9264deacaa404a6e3af6bfc330d93e7598624d0ed11a94263106cc660f7f54c8ff57e759033cf606a795f69ff6c1c7c pg-restore.confd
+5c9bfd9e295dcf678298bf0aa974347a7c311d6e7c2aa76a6920fcb751d01fd1ab77abbec11f3c672f927ad9deaa88e04e370c0b5cd1b60087554c474b748731 pltcl_create_tables.sql"
diff --git a/user/postgresql/conf-unix_socket_directories.patch b/user/postgresql/conf-unix_socket_directories.patch
new file mode 100644
index 000000000..24c51e7b9
--- /dev/null
+++ b/user/postgresql/conf-unix_socket_directories.patch
@@ -0,0 +1,14 @@
+Creating socket in /tmp is silly, but unfortunately it's default location,
+so many clients expect it. Thus we preconfigure PostgreSQL to create socket
+both in /run/postgresql and /tmp.
+--- a/src/backend/utils/misc/postgresql.conf.sample
++++ b/src/backend/utils/misc/postgresql.conf.sample
+@@ -63,7 +63,7 @@
+ #port = 5432 # (change requires restart)
+ #max_connections = 100 # (change requires restart)
+ #superuser_reserved_connections = 3 # (change requires restart)
+-#unix_socket_directories = '/tmp' # comma-separated list of directories
++unix_socket_directories = '/run/postgresql,/tmp' # comma-separated list of directories
+ # (change requires restart)
+ #unix_socket_group = '' # (change requires restart)
+ #unix_socket_permissions = 0777 # begin with 0 to use octal notation
diff --git a/user/postgresql/disable-broken-tests.patch b/user/postgresql/disable-broken-tests.patch
new file mode 100644
index 000000000..0bb5b03fa
--- /dev/null
+++ b/user/postgresql/disable-broken-tests.patch
@@ -0,0 +1,119 @@
+These tests fail due to some really weird linking issue like:
+
+ ERROR: could not load library "<builddir>/tmp_install/usr/lib/postgresql/libpqwalreceiver.so": Error loading shared library libpq.so.5: No such file or directory (needed by <builddir>/tmp_install/usr/lib/postgresql/libpqwalreceiver.so)
+
+psql dynamically loads libpq and libpqwalreceiver libs using pg_dlopen()
+which is an alias for dlopen() on Linux. The above message comes from
+src/backend/utils/fmgr/dfmgr.c. The part "Error loading ..." is from
+pg_dlerror() which is alias for dlerror().
+
+LD_LIBRARY_PATH is set and passed correctly. However, the error
+disappeared when I've copied libpq.so* to /usr/lib...
+
+Also:
+
+ $ LD_LIBRARY_PATH=$(pwd) ldd postgresql/libpqwalreceiver.so
+ ldd (0x280d565e000)
+ libpq.so.5 => <builddir>/tmp_install/usr/lib/libpq.so.5 (0x280d520d000)
+ libc.musl-x86_64.so.1 => ldd (0x280d565e000)
+ libssl.so.43 => /lib/libssl.so.43 (0x280d4fc2000)
+ libcrypto.so.41 => /lib/libcrypto.so.41 (0x280d4c1c000)
+ libldap_r-2.4.so.2 => /usr/lib/libldap_r-2.4.so.2 (0x280d49d6000)
+ liblber-2.4.so.2 => /usr/lib/liblber-2.4.so.2 (0x280d47c9000)
+ libsasl2.so.3 => /usr/lib/libsasl2.so.3 (0x280d45b0000)
+ Error relocating postgresql/libpqwalreceiver.so: appendStringInfoChar: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: MyLatch: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: MemoryContextDelete: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: errstart: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: pg_atoi: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: TupleDescGetAttInMetadata: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: WalReceiverFunctions: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: WaitLatchOrSocket: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: MemoryContextReset: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: pfree: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: errmsg: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: tuplestore_puttuple: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: pchomp: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: appendStringInfoString: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: errfinish: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: pstrdup: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: palloc0: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: errdetail: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: ResetLatch: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: work_mem: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: AllocSetContextCreate: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: CurrentMemoryContext: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: tuplestore_begin_heap: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: BuildTupleFromCStrings: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: errcode: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: MyDatabaseId: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: GetDatabaseEncodingName: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: palloc: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: pg_lsn_in: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: ProcessInterrupts: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: elog_start: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: DirectFunctionCall1Coll: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: elog_finish: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: CreateTemplateTupleDesc: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: InterruptPending: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: TupleDescInitEntry: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: initStringInfo: symbol not found w
+
+These symbols are really not provided by libpq.
+
+I wasted one day trying to figure out what's going on here, but still
+have no idea. :(
+
+--- a/src/test/regress/parallel_schedule
++++ b/src/test/regress/parallel_schedule
+@@ -84,7 +84,7 @@
+ # ----------
+ # Another group of parallel tests
+ # ----------
+-test: brin gin gist spgist privileges init_privs security_label collate matview lock replica_identity rowsecurity object_address tablesample groupingsets drop_operator password
++test: brin gin gist spgist privileges init_privs security_label collate matview lock replica_identity rowsecurity tablesample groupingsets drop_operator password
+
+ # ----------
+ # Another group of parallel tests
+@@ -98,7 +98,7 @@
+ test: select_parallel
+
+ # no relation related tests can be put in this group
+-test: publication subscription
++test: publication
+
+ # ----------
+ # Another group of parallel tests
+--- a/src/test/modules/dummy_seclabel/Makefile
++++ b/src/test/modules/dummy_seclabel/Makefile
+@@ -6,7 +6,7 @@
+ EXTENSION = dummy_seclabel
+ DATA = dummy_seclabel--1.0.sql
+
+-REGRESS = dummy_seclabel
++#REGRESS = dummy_seclabel
+
+ ifdef USE_PGXS
+ PG_CONFIG = pg_config
+--- a/contrib/postgres_fdw/Makefile
++++ b/contrib/postgres_fdw/Makefile
+@@ -10,7 +10,7 @@
+ EXTENSION = postgres_fdw
+ DATA = postgres_fdw--1.0.sql
+
+-REGRESS = postgres_fdw
++#REGRESS = postgres_fdw
+
+ ifdef USE_PGXS
+ PG_CONFIG = pg_config
+--- a/contrib/dblink/Makefile
++++ b/contrib/dblink/Makefile
+@@ -10,7 +10,7 @@
+ dblink--unpackaged--1.0.sql
+ PGFILEDESC = "dblink - connect to other PostgreSQL databases"
+
+-REGRESS = paths dblink
++#REGRESS = paths dblink
+ REGRESS_OPTS = --dlpath=$(top_builddir)/src/test/regress
+ EXTRA_CLEAN = sql/paths.sql expected/paths.out
+
diff --git a/user/postgresql/initdb.patch b/user/postgresql/initdb.patch
new file mode 100644
index 000000000..59a872a49
--- /dev/null
+++ b/user/postgresql/initdb.patch
@@ -0,0 +1,14 @@
+diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
+--- a/src/bin/initdb/initdb.c
++++ b/src/bin/initdb/initdb.c
+@@ -3259,9 +3259,7 @@
+ /* translator: This is a placeholder in a shell command. */
+ appendPQExpBuffer(start_db_cmd, " -l %s start", _("logfile"));
+
+- printf(_("\nSuccess. You can now start the database server using:\n\n"
+- " %s\n\n"),
+- start_db_cmd->data);
++ printf(_("\nSuccess.\n\n"));
+
+ destroyPQExpBuffer(start_db_cmd);
+
diff --git a/user/postgresql/perl-rpath.patch b/user/postgresql/perl-rpath.patch
new file mode 100644
index 000000000..a2505acf7
--- /dev/null
+++ b/user/postgresql/perl-rpath.patch
@@ -0,0 +1,22 @@
+We configure Postgres with --disable-rpath because for the most part we
+want to leave it to ldconfig to determine where libraries are. However,
+for some reason the Perl package puts libperl.so in a nonstandard place
+and doesn't add that place to the ldconfig search path. I think this
+is a Perl packaging bug, myself, but apparently it's not going to change.
+So work around it by adding an rpath spec to plperl.so (only).
+
+Alpine notes:
+This patch is copied from Fedora.
+
+--- a/src/pl/plperl/GNUmakefile
++++ b/src/pl/plperl/GNUmakefile
+@@ -43,6 +43,9 @@
+
+ SHLIB_LINK = $(perl_embed_ldflags)
+
++# Force rpath to be used even though we disable it everywhere else
++SHLIB_LINK += $(rpath)
++
+ REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-extension=plperl --load-extension=plperlu
+ REGRESS = plperl plperl_lc plperl_trigger plperl_shared plperl_elog plperl_util plperl_init plperlu plperl_array
+ # if Perl can support two interpreters in one backend,
diff --git a/user/postgresql/pg-restore.confd b/user/postgresql/pg-restore.confd
new file mode 100644
index 000000000..84a179f6c
--- /dev/null
+++ b/user/postgresql/pg-restore.confd
@@ -0,0 +1,16 @@
+
+# Enable this to dump databases on shutdown and restore on boot
+#
+#PGDUMP="/var/lib/postgresql/backup/databases.pgdump"
+
+# The dump file will be deleted once restored unless KEEP_DUMP is set.
+# This is to avoid accidental restoring of running database. If you know what
+# you are doing and want keep the dump, then enable the KEEP_DUMP option
+# below.
+#
+#KEEP_DUMP=yes
+
+# If you enable KEEP_DUMP above you probably also want the --clean option
+# the the pg_dumpall command.
+#PG_DUMPALL_OPTS="--clean"
+
diff --git a/user/postgresql/pg-restore.initd b/user/postgresql/pg-restore.initd
new file mode 100644
index 000000000..e9fe65c19
--- /dev/null
+++ b/user/postgresql/pg-restore.initd
@@ -0,0 +1,36 @@
+#!/sbin/openrc-run
+
+extra_commands="${opts} dump restore purge"
+
+depend() {
+ need postgresql
+}
+
+restore() {
+ yesno "$PGDUMP" && return 0
+ ebegin "Restoring PostgreSQL $PGDUMP"
+ psql -U ${PG_USER:-postgres} ${PSQL_OPTS} -f "$PGDUMP" >/dev/null 2>/dev/null
+ local res=$?
+ yesno "$KEEP_DUMP" || rm -f "$PGDUMP"
+ eend $res
+ /etc/init.d/postgresql reload
+}
+
+dump() {
+ yesno "$PGDUMP" && return 0
+ mkdir -p "$( dirname "$PGDUMP" )"
+ ebegin "Saving PostgreSQL databases to $PGDUMP"
+ pg_dumpall -U ${PG_USER:-postgres} ${PG_DUMPALL_OPTS} -f "$PGDUMP"
+ eend $?
+}
+
+purge() {
+ yesno "$PGDUMP" && return 0
+ ebegin "Removing temporary $PGDUMP PostgreSQL backup"
+ rm -f "$PGDUMP"
+ eend $?
+}
+
+start() {
+ restore
+}
diff --git a/user/postgresql/pltcl_create_tables.sql b/user/postgresql/pltcl_create_tables.sql
new file mode 100644
index 000000000..76c7a954a
--- /dev/null
+++ b/user/postgresql/pltcl_create_tables.sql
@@ -0,0 +1,13 @@
+-- Create tables needed for PL/Tcl autoloading. This script should be run by
+-- the database administrator only.
+--
+-- Statements in this script are extracted from pltcl_loadmod script.
+--
+-- Author: G.J.R. Timmer
+-- Date: 2017-01-28
+
+create table pltcl_modules (modname name, modseq int2, modsrc text);
+create index pltcl_modules_i on pltcl_modules using btree (modname name_ops);
+
+create table pltcl_modfuncs (funcname name, modname name);
+create index pltcl_modfuncs_i on pltcl_modfuncs using hash (funcname name_ops);
diff --git a/user/postgresql/postgresql.confd b/user/postgresql/postgresql.confd
new file mode 100644
index 000000000..6a25cc381
--- /dev/null
+++ b/user/postgresql/postgresql.confd
@@ -0,0 +1,59 @@
+# Which port and socket to bind PostgreSQL.
+# This may be overriden in postgresql.conf.
+#port="5432"
+
+# How long to wait for server to start in seconds.
+#start_timeout=10
+
+# Number of seconds to wait for clients to disconnect from the server before
+# shutting down. Set to zero to disable this timeout.
+#nice_timeout=60
+
+# Timeout in seconds for rude quit - forecfully disconnect clients from server
+# and shut down. This is performed after nice_timeout exceeded. Terminated
+# client connections have their open transactions rolled back.
+# Set "rude_quit=no" to disable.
+#rude_quit="yes"
+#rude_timeout=30
+
+# Timeout in seconds for force quit - if the server still fails to shutdown,
+# you can force it to quit and a recover-run will execute on the next startup.
+# Set "force_quit=yes" to enable.
+#force_quit="no"
+#force_timeout="2"
+
+# Extra options to run postmaster with, e.g.:
+# -N is the maximal number of client connections
+# -B is the number of shared buffers (has to be at least 2x the value for -N)
+# Please read man postgres(1) for more options. Many of these options can be
+# set directly in the configuration file.
+#pg_opts="-N 512 -B 1024"
+
+# Pass extra environment variables. If you have to export environment variables
+# for the database process, this can be done here.
+# Don't forget to escape quotes.
+#env_vars="PGPASSFILE=\"/path/to/.pgpass\""
+
+# Location of postmaster.log. Default is $data_dir/postmaster.log.
+logfile="/var/log/postgresql/postmaster.log"
+
+# Automatically set up a new database if missing on startup.
+#auto_setup="yes"
+
+
+##############################################################################
+#
+# The following values should NOT be arbitrarily changed!
+#
+# The initscript uses these variables to inform PostgreSQL where to find
+# its data directory and configuration files.
+
+# Where the data directory is located/to be created.
+#data_dir="/var/lib/postgresql/@VERSION@/data"
+
+# Location of configuration files. Default is $data_dir.
+conf_dir="/etc/postgresql"
+
+# Additional options to pass to initdb.
+# See man initdb(1) for available options.
+#initdb_opts="--locale=en_US.UTF-8"
diff --git a/user/postgresql/postgresql.initd b/user/postgresql/postgresql.initd
new file mode 100644
index 000000000..846229a40
--- /dev/null
+++ b/user/postgresql/postgresql.initd
@@ -0,0 +1,220 @@
+#!/sbin/openrc-run
+
+extra_started_commands="reload"
+description_reload="Reload configuration"
+
+extra_stopped_commands="setup"
+description_setup="Initialize a new PostgreSQL cluster"
+
+# Note: Uppercase variables are here for backward compatibility.
+
+: ${user:=${PGUSER:-"postgres"}}
+: ${group:=${PGGROUP:-"postgres"}}
+
+: ${auto_setup:=${AUTO_SETUP:-"yes"}}
+: ${start_timeout:=${START_TIMEOUT:-10}}
+: ${nice_timeout:=${NICE_TIMEOUT:-60}}
+: ${rude_quit:=${RUDE_QUIT:-"yes"}}
+: ${rude_timeout:=${RUDE_TIMEOUT:-30}}
+: ${force_quit:=${FORCE_QUIT:-"no"}}
+: ${force_timeout:=${FORCE_TIMEOUT:-2}}
+
+: ${data_dir:=${PGDATA:-"/var/lib/postgresql/@VERSION@/data"}}
+: ${conf_dir:=$data_dir}
+: ${env_vars:=${PG_EXTRA_ENV:-}}
+: ${initdb_opts:=${PG_INITDB_OPTS:-}}
+: ${logfile:="$data_dir/postmaster.log"}
+: ${pg_opts:=${PGOPTS:-}}
+: ${port:=${PGPORT:-5432}}
+
+command="/usr/bin/postgres"
+
+conffile="$conf_dir/postgresql.conf"
+pidfile="$data_dir/postmaster.pid"
+start_stop_daemon_args="
+ --user $user
+ --group $group
+ --pidfile $pidfile
+ --wait 100"
+
+depend() {
+ use net
+ after firewall
+
+ if [ "$(get_config log_destination)" = "syslog" ]; then
+ use logger
+ fi
+}
+
+start_pre() {
+ check_deprecated_var WAIT_FOR_START start_timeout
+ check_deprecated_var WAIT_FOR_DISCONNECT nice_timeout
+ check_deprecated_var WAIT_FOR_CLEANUP rude_timeout
+ check_deprecated_var WAIT_FOR_QUIT force_timeout
+
+ if [ ! -d "$data_dir/base" ]; then
+ if yesno "$auto_setup"; then
+ setup || return 1
+ else
+ eerror "Database not found at: $data_dir"
+ eerror "Please make sure that 'data_dir' points to the right path."
+ eerror "You can run '/etc/init.d/postgresql setup' to setup a new database cluster."
+ return 1
+ fi
+ fi
+
+ local socket_dirs=$(get_config "unix_socket_directories" "/run/postgresql")
+ local port=$(get_config "port" "$port")
+
+ start_stop_daemon_args="$start_stop_daemon_args --env PGPORT=$port"
+
+ (
+ # Set the proper permission for the socket paths and create them if
+ # then don't exist.
+ set -f; IFS=","
+ for dir in $socket_dirs; do
+ if [ -e "${dir%/}/.s.PGSQL.$port" ]; then
+ eerror "Socket conflict. A server is already listening on:"
+ eerror " ${dir%/}/.s.PGSQL.$port"
+ eerror "Hint: Change 'port' to listen on a different socket."
+ return 1
+ elif [ "${dir%/}" != "/tmp" ]; then
+ checkpath -d -m 1775 -o $user:$group "$dir"
+ fi
+ done
+ )
+}
+
+start() {
+ local retval
+
+ ebegin "Starting PostgreSQL"
+
+ local var; for var in $env_vars; do
+ start_stop_daemon_args="$start_stop_daemon_args --env $var"
+ done
+
+ rm -f "$pidfile"
+ start-stop-daemon --start \
+ $start_stop_daemon_args \
+ --exec /usr/bin/pg_ctl \
+ -- start \
+ --silent \
+ -w --timeout="$start_timeout" \
+ --log="$logfile" \
+ --pgdata="$conf_dir" \
+ -o "--data-directory=$data_dir $pg_opts"
+ retval=$?
+
+ if [ $retval -ne 0 ]; then
+ eerror "Check the log for a possible explanation of the above error:"
+ eerror " $logfile"
+ fi
+ eend $retval
+}
+
+stop() {
+ local retry="SIGTERM/$nice_timeout"
+
+ yesno "$rude_quit" \
+ && retry="$retry/SIGINT/$rude_timeout" \
+ || rude_timeout=0
+
+ yesno "$force_quit" \
+ && retry="$retry/SIGQUIT/$force_timeout" \
+ || force_timeout=0
+
+ local seconds=$(( $nice_timeout + $rude_timeout + $force_timeout ))
+
+ ebegin "Stopping PostgreSQL (this can take up to $seconds seconds)"
+
+ start-stop-daemon --stop \
+ --exec "$command" \
+ --retry "$retry" \
+ --progress \
+ --pidfile "$pidfile"
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading PostgreSQL configuration"
+
+ start-stop-daemon --signal HUP --pidfile "$pidfile"
+ eend $?
+}
+
+setup() {
+ local bkpdir
+
+ ebegin "Creating a new PostgreSQL database cluster"
+
+ if [ -d "$data_dir/base" ]; then
+ eend 1 "$data_dir/base already exists!"; return 1
+ fi
+
+ # If data_dir exists, backup configs.
+ if [ -d "$data_dir" ]; then
+ bkpdir="$(mktemp -d)"
+ find "$data_dir" -type f -name "*.conf" -maxdepth 1 \
+ -exec mv -v {} "$bkpdir"/ \;
+ rm -rf "$data_dir"/*
+ fi
+
+ install -d -m 0700 -o $user -g $group "$data_dir"
+ install -d -m 0750 -o $user -g $group "$conf_dir"
+
+ cd "$data_dir" # to avoid the: could not change directory to "/root"
+ su $user -c "/usr/bin/initdb $initdb_opts --pgdata $data_dir"
+ local retval=$?
+
+ if [ -d "$bkpdir" ]; then
+ # Move backuped configs back.
+ mv -v "$bkpdir"/* "$data_dir"/
+ rm -rf "$bkpdir"
+ fi
+
+ if [ "${data_dir%/}" != "${conf_dir%/}" ]; then
+ # Move configs from data_dir to conf_dir and symlink them to data_dir.
+ local name newname
+ for name in postgresql.conf pg_hba.conf pg_ident.conf; do
+ newname="$name"
+ [ ! -e "$conf_dir"/$name ] || newname="$name.new"
+
+ mv "$data_dir"/$name "$conf_dir"/$newname
+ ln -s "$conf_dir"/$name "$data_dir"/$name
+ done
+ fi
+
+ eend $retval
+}
+
+
+get_config() {
+ local name="$1"
+ local default="${2:-}"
+
+ if [ ! -f "$conffile" ]; then
+ printf '%s\n' "$default"
+ return 1
+ fi
+ sed -En "/^\s*${name}\b/{ # find line starting with the name
+ s/^\s*${name}\s*=?\s*([^#]+).*/\1/; # capture the value
+ s/\s*$//; # trim trailing whitespaces
+ s/^['\"](.*)['\"]$/\1/; # remove delimiting quotes
+ p
+ }" "$conffile" \
+ | grep . || printf '%s\n' "$default"
+}
+
+check_deprecated_var() {
+ local old_name="$1"
+ local new_name="$2"
+
+ if [ -n "$(getval "$old_name")" ]; then
+ ewarn "Variable '$old_name' has been removed, please use '$new_name' instead."
+ fi
+}
+
+getval() {
+ eval "printf '%s\n' \"\$$1\""
+}
diff --git a/user/postgresql/postgresql.pre-upgrade b/user/postgresql/postgresql.pre-upgrade
new file mode 100644
index 000000000..6116252c1
--- /dev/null
+++ b/user/postgresql/postgresql.pre-upgrade
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+new="$1"
+old="$2"
+
+pgver=${new%.*}
+compare=$(apk version -t "$old" $pgver)
+
+# check if we upgrade from earlier than $pgver and if it is running
+if [ "$compare" != "<" ] || ! /etc/init.d/postgresql --quiet status; then
+ exit 0
+fi
+
+if [ -f /etc/conf.d/postgresql ]; then
+ . /etc/conf.d/postgresql
+fi
+
+cat <<EOF
+* You are upgrading to postgres $pgver wich is not compatible with the running
+* See: http://www.postgresql.org/docs/$pgver/static/upgrading.html
+*
+* The corresponding steps for Alpine Linux is:
+*
+* pg_dumpall -U ${PGUSER:-postgres} > dumpfile
+* /etc/init.d/postgresql stop
+* apk add -u postgresql
+* /etc/init.d/postgresql setup
+* /etc/init.d/postgresql start
+* psql -U ${PGUSER:-postgres} -f dumpfile
+*
+EOF
+exit 1
diff --git a/user/psmisc/APKBUILD b/user/psmisc/APKBUILD
deleted file mode 100644
index 01aa02009..000000000
--- a/user/psmisc/APKBUILD
+++ /dev/null
@@ -1,63 +0,0 @@
-# Contributor: A. Wilcox <awilfox@adelielinux.org>
-# Maintainer: A. Wilcox <awilfox@adelielinux.org>
-
-pkgname=psmisc
-pkgver=23.0
-pkgrel=0
-pkgdesc="Miscellaneous utilities that use the proc filesystem"
-url="https://gitlab.com/psmisc/psmisc"
-arch="all"
-license="GPLv2+"
-makedepends_build="autoconf>=2.69 automake gettext-dev"
-makedepends_host="ncurses-dev gettext-dev"
-checkdepends="dejagnu"
-subpackages="$pkgname-doc"
-[ "$CBUILD" != "$CHOST" ] || subpackages="$subpackages $pkgname-lang"
-source="$pkgname-$pkgver.tar.bz2::https://gitlab.com/$pkgname/$pkgname/repository/archive.tar.bz2?ref=v$pkgver
- dont-underlink-peekfd.patch
- fix-peekfd-on-ppc.patch
- musl_ptregs.patch
- "
-options="!strip"
-builddir="$srcdir/$pkgname-$pkgver"
-
-prepare() {
- ln -fs $pkgname-v$pkgver-* "$builddir"
-
- default_prepare
-
- cd "$builddir"
- sh autogen.sh
-}
-
-build() {
- cd "$builddir"
- ./configure \
- --build=$CBUILD \
- --host=$CHOST \
- --prefix=/usr \
- --sysconfdir=/etc \
- --mandir=/usr/share/man \
- --localstatedir=/var \
- --enable-harden-flags \
- --enable-ipv6 \
- --disable-selinux \
- ac_cv_func_malloc_0_nonnull=yes \
- ac_cv_func_realloc_0_nonnull=yes
- make
-}
-
-check() {
- cd "$builddir"
- make check
-}
-
-package() {
- cd "$builddir"
- make DESTDIR="$pkgdir" install
-}
-
-sha512sums="d4f1d90fb92f83b7583cd82a3c1027de0e53fbee85253d796878878d03a52fc220bd25beaec34c651a1ed547fc13919c5c014a522124308a7421d3f64238a70f psmisc-23.0.tar.bz2
-a68c75eb3c66a9df0d4e574a9439eeed0cd2dc97b3cad3fcd8b945619c2ec238b73bf479d1b55ddd4821471cd8934ee1fbc7871c92de7ef72c3d3f989ab62c9f dont-underlink-peekfd.patch
-b16139606e1ccaebd94b7b7a14f49f530b180f1fd24338008e4c4d48761b57953458c46e57b0f7ec191353514f68126f79c281875c4cd56ed2f1220ace131ce1 fix-peekfd-on-ppc.patch
-73dec9791e8cdb85cd3d9ef9be4d16e0fef481c6edc334ed9e954829444b1a92b87f7a3a2e6c1d09ac207bed828f214f5f2a95caa66540a7f2a6c58a6b8f6f2c musl_ptregs.patch"
diff --git a/user/psmisc/dont-underlink-peekfd.patch b/user/psmisc/dont-underlink-peekfd.patch
deleted file mode 100644
index e1623f193..000000000
--- a/user/psmisc/dont-underlink-peekfd.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- psmisc-23.0/Makefile.am.old 2017-06-12 00:29:46.000000000 +0000
-+++ psmisc-23.0/Makefile.am 2017-06-28 10:21:04.148955051 +0000
-@@ -65,6 +65,7 @@
- src_killall_SOURCES = src/killall.c src/comm.h src/signals.c src/signals.h src/i18n.h
- src_killall_LDADD = @LIBINTL@ @SELINUX_LIB@
- src_peekfd_SOURCES = src/peekfd.c
-+src_peekfd_LDADD = @LIBINTL@
- src_pslog_SOURCES = src/pslog.c
- src_pstree_SOURCES = src/pstree.c src/comm.h src/i18n.h
- src_pstree_LDADD = @LIBINTL@ @TERMCAP_LIB@ @SELINUX_LIB@
diff --git a/user/psmisc/fix-peekfd-on-ppc.patch b/user/psmisc/fix-peekfd-on-ppc.patch
deleted file mode 100644
index d9fc1d5f1..000000000
--- a/user/psmisc/fix-peekfd-on-ppc.patch
+++ /dev/null
@@ -1,19 +0,0 @@
---- psmisc-23.0/src/peekfd.c.old 2017-06-12 00:29:46.000000000 +0000
-+++ psmisc-23.0/src/peekfd.c 2017-06-28 10:15:18.635344983 +0000
-@@ -233,11 +233,11 @@
- if (WIFSTOPPED(status)) {
- #ifdef PPC
- struct pt_regs regs;
-- regs.gpr[0] = ptrace(PTRACE_PEEKUSER, pid, __WORDSIZE/8 * PT_R0, 0);
-- regs.gpr[3] = ptrace(PTRACE_PEEKUSER, pid, __WORDSIZE/8 * PT_R3, 0);
-- regs.gpr[4] = ptrace(PTRACE_PEEKUSER, pid, __WORDSIZE/8 * PT_R4, 0);
-- regs.gpr[5] = ptrace(PTRACE_PEEKUSER, pid, __WORDSIZE/8 * PT_R5, 0);
-- regs.orig_gpr3 = ptrace(PTRACE_PEEKUSER, pid, __WORDSIZE/8 * PT_ORIG_R3, 0);
-+ regs.gpr[0] = ptrace(PTRACE_PEEKUSER, pid, sizeof(void *) * PT_R0, 0);
-+ regs.gpr[3] = ptrace(PTRACE_PEEKUSER, pid, sizeof(void *) * PT_R3, 0);
-+ regs.gpr[4] = ptrace(PTRACE_PEEKUSER, pid, sizeof(void *) * PT_R4, 0);
-+ regs.gpr[5] = ptrace(PTRACE_PEEKUSER, pid, sizeof(void *) * PT_R5, 0);
-+ regs.orig_gpr3 = ptrace(PTRACE_PEEKUSER, pid, sizeof(void *) * PT_ORIG_R3, 0);
- #elif defined(ARM)
- struct pt_regs regs;
- ptrace(PTRACE_GETREGS, pid, 0, &regs);
diff --git a/user/psmisc/musl_ptregs.patch b/user/psmisc/musl_ptregs.patch
deleted file mode 100644
index 29fee6a2a..000000000
--- a/user/psmisc/musl_ptregs.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Author: Breno Leitao <brenohl@br.ibm.com>
-Date: Thu Apr 6 14:03:00 2017 -0300
-
- peekfd: Avoid pt_regs clash
-
-Index: psmisc-22.21/src/peekfd.c
-===================================================================
---- a/src/peekfd.c.old
-+++ b/src/peekfd.c
-@@ -27,7 +27,9 @@
- #include <sys/types.h>
- #include <sys/wait.h>
- #include <sys/syscall.h>
-+#define pt_regs uapi_pt_regs
- #include <asm/ptrace.h>
-+#undef pt_regs
- #include <byteswap.h>
- #include <endian.h>
- #include <sys/user.h>
-
diff --git a/user/sharutils/APKBUILD b/user/sharutils/APKBUILD
deleted file mode 100644
index 5aa36a130..000000000
--- a/user/sharutils/APKBUILD
+++ /dev/null
@@ -1,41 +0,0 @@
-# Contributor: A. Wilcox <awilfox@adelielinux.org>
-# Maintainer: A. Wilcox <awilfox@adelielinux.org>
-
-pkgname=sharutils
-pkgver=4.15.2
-pkgrel=0
-pkgdesc="Utilities for manipulating shell archives"
-url="https://www.gnu.org/software/sharutils/"
-arch="all"
-license="GPL-3.0+"
-depends="bzip2"
-makedepends_build="texinfo"
-makedepends_host="gettext-dev"
-subpackages="$pkgname-lang $pkgname-doc"
-source="https://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.xz"
-
-build() {
- cd "$builddir"
- ./configure \
- --build=$CBUILD \
- --host=$CHOST \
- --prefix=/usr \
- --sysconfdir=/etc \
- --mandir=/usr/share/man \
- --infodir=/usr/share/info \
- --localstatedir=/var
- make
-}
-
-check() {
- cd "$builddir"
- make check
-}
-
-package() {
- cd "$builddir"
- make DESTDIR="$pkgdir" install || return 1
- rm "$pkgdir"/usr/lib/charset.alias
-}
-
-sha512sums="80d0b804a0617e11e5c23dc0d59b218bbf93e40aaf5e9a5401a18ef9cb700390aab711e2b2e2f26c8fd5b8ef99a91d3405e01d02cadabcba7639979314e59f8d sharutils-4.15.2.tar.xz"