Subject: [alpine-devel] [PATCH] new aport for yaws 1.96

From: Vitaliy Tokarev <[email-masked]>
Date: Thu, 27 Jun 2013 00:56:51 +0400

Yaws is a HTTP high perfomance 1.1 webserver particularly well
suited for dynamic-content web applications.
---
 testing/yaws/APKBUILD            | 66 ++++++++++++++++++++++++++++++++++++++++
 testing/yaws/yaws.init.d         | 52 +++++++++++++++++++++++++++++++
 testing/yaws/yaws.post-deinstall |  2 ++
 testing/yaws/yaws.post-install   |  2 ++
 testing/yaws/yaws.post-upgrade   |  2 ++
 5 files changed, 124 insertions(+)
 create mode 100644 testing/yaws/APKBUILD
 create mode 100755 testing/yaws/yaws.init.d
 create mode 100644 testing/yaws/yaws.post-deinstall
 create mode 100644 testing/yaws/yaws.post-install
 create mode 100644 testing/yaws/yaws.post-upgrade

diff --git a/testing/yaws/APKBUILD b/testing/yaws/APKBUILD
new file mode 100644
index 0000000..ef64db4
--- /dev/null
+++ b/testing/yaws/APKBUILD
@@ -0,0 +1,66 @@
+# Contributor: Vitaliy Tokarev <[email-masked]>
+# Maintainer:
+pkgname=yaws
+pkgver=1.96
+pkgrel=0
+pkgdesc="Yet Another Web Server, pure Erlang HTTP server/framework"
+url="http://yaws.hyber.org/"
+arch="all"
+license="BSD"
+depends=""
+depends_dev="linux-pam-dev erlang"
+makedepends="$depends_dev"
+options="!emptydirs"
+install="$pkgname.post-install $pkgname.post-upgrade $pkgname.post-deinstall"
+subpackages="$pkgname-doc $pkgname-web"
+source="http://yaws.hyber.org/download/$pkgname-$pkgver.tar.gz
+        yaws.init.d"
+
+_builddir="$srcdir/$pkgname-$pkgver"
+prepare() {
+	local i
+	cd "$_builddir"
+	for i in $source; do
+		case $i in
+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		esac
+	done
+}
+
+build() {
+	cd "$_builddir"
+    export ERLCFLAGS="-W"
+    ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
+    make || return 1
+}
+
+package() {
+	cd "$_builddir"
+    make DESTDIR="$pkgdir" install || return 1
+
+    # XXX: from arch linux
+    install -d "$pkgdir/usr/lib/erlang/lib"
+    ln -s /usr/lib/yaws "$pkgdir/usr/lib/erlang/lib/$pkgname-$pkgver"
+
+    # init.d
+    install -Dm755 "$srcdir/yaws.init.d" "$pkgdir/etc/init.d/yaws"
+
+    # License
+    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
+
+web() {
+    arch="noarch"
+    depends="yaws"
+    pkgdesc="Yet Another Web Server, pure Erlang HTTP server/framework (examples)"
+
+    mkdir -p "$subpkgdir"/var
+    mv "$pkgdir"/var/yaws "$subpkgdir"/var/
+}
+
+md5sums="7c9231b7d9880033c9d3bfba2aa3c901  yaws-1.96.tar.gz
+3a1445696bd25ae71631d13457980693  yaws.init.d"
+sha256sums="8d4f16d18937335ac021ca4c65c8ee81dc4d71f133718c7148856cc6bf1f55e2  yaws-1.96.tar.gz
+313ce8cacd25e8eed5717dfd9e79d1683a4038a64cffff6e93aacfd2fb11c261  yaws.init.d"
+sha512sums="821ffe530a265462df083a9408e1798616bf11f8c891955500f8de170f77de831defc65c2341d0552471dde253df16ae3d27d59eaa0ccd79b117f3070f49fb2c  yaws-1.96.tar.gz
+07ff290eb98be729445d797361503d01dfba29f050639632d251202267aa485655fd04798f4de8d66a83bb0a798280116f8b06d5b9e8810d3cb2d20c1c1bd1d6  yaws.init.d"
diff --git a/testing/yaws/yaws.init.d b/testing/yaws/yaws.init.d
new file mode 100755
index 0000000..5867acf
--- /dev/null
+++ b/testing/yaws/yaws.init.d
@@ -0,0 +1,52 @@
+#!/sbin/runscript
+#
+# Startup script for the Yaws Web Server (for Alpine Linux)
+#
+# config: /etc/conf.d/yaws
+#
+# description: yaws - Erlang enabled http server
+#
+# use: rc-update add yaws default
+#
+
+yaws=/usr/bin/yaws
+
+# By default we run with the default id
+# idopts="--id myserverid"
+
+conf="--conf /etc/yaws/yaws.conf"
+
+extra_started_commands="restart reload"
+extra_commands="query"
+
+depend() {
+       need net
+}
+
+
+start() {
+       ebegin "Starting yaws "
+       ${yaws} --daemon --heart ${conf}
+       eend $?
+}
+
+
+stop() {
+       ebegin "Stopping yaws "
+       ${yaws} --stop ${idopts}
+       eend $? "Failed to stop yaws"
+}
+
+
+reload() {
+       ebegin "Reloading yaws "
+       ${yaws} --hup ${idopts}
+       eend $? "Failed to reload yaws"
+}
+
+query() {
+       ebegin "Querying yaws "
+       ${yaws} --status ${idopts}
+       eend $?
+}
+
diff --git a/testing/yaws/yaws.post-deinstall b/testing/yaws/yaws.post-deinstall
new file mode 100644
index 0000000..60dd86d
--- /dev/null
+++ b/testing/yaws/yaws.post-deinstall
@@ -0,0 +1,2 @@
+#!/bin/sh
+rmdir --ignore-fail-on-non-empty /usr/var/log/yaws && exit 0
diff --git a/testing/yaws/yaws.post-install b/testing/yaws/yaws.post-install
new file mode 100644
index 0000000..17ac6d7
--- /dev/null
+++ b/testing/yaws/yaws.post-install
@@ -0,0 +1,2 @@
+#!/bin/sh
+mkdir -p /usr/var/log/yaws && exit 0
diff --git a/testing/yaws/yaws.post-upgrade b/testing/yaws/yaws.post-upgrade
new file mode 100644
index 0000000..17ac6d7
--- /dev/null
+++ b/testing/yaws/yaws.post-upgrade
@@ -0,0 +1,2 @@
+#!/bin/sh
+mkdir -p /usr/var/log/yaws && exit 0
-- 
1.8.2.3

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---