Subject: [alpine-devel] [PATCH] main/nginx New package

From: Cameron Banta <[email-masked]>
Date: Mon, 1 Nov 2010 15:20:08 +0000

---
 main/nginx/APKBUILD    |   58 ++++++++++++++++++++++++++++++++++++++++++++
 main/nginx/nginx.confd |    7 +++++
 main/nginx/nginx.initd |   62 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 127 insertions(+), 0 deletions(-)
 create mode 100644 main/nginx/APKBUILD
 create mode 100644 main/nginx/nginx.confd
 create mode 100644 main/nginx/nginx.initd

diff --git a/main/nginx/APKBUILD b/main/nginx/APKBUILD
new file mode 100644
index 0000000..b35beab
--- /dev/null
+++ b/main/nginx/APKBUILD
@@ -0,0 +1,58 @@
+# Contributor: Cameron Banta <[email-masked]>
+# Maintainer: Cameron Banta <[email-masked]>
+pkgname=nginx
+pkgver=0.8.53
+pkgrel=0
+pkgdesc="nginx [engine x] is a HTTP and reverse proxy server"
+url="nginx.org"
+license="Custom"
+depends=
+makedepends="pcre-dev openssl-dev libcrypto1.0 zlib-dev"
+#install="$pkgname.pre-install $pkgname.post-install"
+install=
+subpackages=
+source="http://nginx.org/download/$pkgname-$pkgver.tar.gz
+	nginx.initd
+	nginx.confd
+	$install
+	"
+
+# append extra dependencies to -dev subpackage
+# remove if not used.
+# depends_dev="somepackage-dev"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+
+prepare() {
+	cd "$_builddir"
+	# apply patches here
+}
+
+build() {
+	cd "$_builddir"
+	./configure --prefix=/usr \
+		--conf-path=/etc/$pkgname/$pkgname.conf \
+		--pid-path=/var/run/$pkgname.pid \
+		--lock-path=/var/run/$pkgname.lock \
+		--error-log-path=/var/log/$pkgname/error.log \
+		--http-log-path=/var/log/$pkgname/access.log \
+		--with-http_ssl_module \
+		--with-http_gzip_static_module \
+		--http-client-body-temp-path=/tmp/$pkgname/client-body \
+		--http-proxy-temp-path=/tmp/$pkgname/proxy \
+		--http-fastcgi-temp-path=/tmp/$pkgname/fastcgi \
+		|| return 1 
+	make || return 1
+}
+
+package() {
+	cd "$_builddir"
+	make DESTDIR="$pkgdir" install
+
+	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+	install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
+}
+
+md5sums="717eaea1b34e8663849f64b9aa05a9da  nginx-0.8.53.tar.gz
+17e4af92572333c32fed04e2e0fc9b7e  nginx.initd
+cbcac88f5b728b1441891947a4babbcb  nginx.confd"
diff --git a/main/nginx/nginx.confd b/main/nginx/nginx.confd
new file mode 100644
index 0000000..486252b
--- /dev/null
+++ b/main/nginx/nginx.confd
@@ -0,0 +1,7 @@
+# Sample conf.d file for alpine linux
+
+#
+# Specify daemon options here.
+#
+
+sample_opts=""
diff --git a/main/nginx/nginx.initd b/main/nginx/nginx.initd
new file mode 100644
index 0000000..0464f5c
--- /dev/null
+++ b/main/nginx/nginx.initd
@@ -0,0 +1,62 @@
+#! /bin/sh
+
+### BEGIN INIT INFO
+# Provides:          nginx
+# Required-Start:    $all
+# Required-Stop:     $all
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: starts the nginx web server
+# Description:       starts nginx using start-stop-daemon
+### END INIT INFO
+
+PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/sbin/nginx
+NAME=nginx
+DESC=nginx
+
+test -x $DAEMON || exit 0
+
+# Include nginx defaults if available
+if [ -f /etc/conf.d/nginx ] ; then
+        . /etc/conf.d/nginx
+fi
+
+set -e
+
+case "$1" in
+  start)
+        echo -n "Starting $DESC: "
+        start-stop-daemon --start --quiet --pidfile /var/run/nginx.pid \
+                --exec $DAEMON -- $DAEMON_OPTS
+        echo "$NAME."
+        ;;
+  stop)
+        echo -n "Stopping $DESC: "
+        start-stop-daemon --stop --quiet --pidfile /var/run/nginx.pid \
+                --exec $DAEMON
+        echo "$NAME."
+        ;;
+  restart|force-reload)
+        echo -n "Restarting $DESC: "
+        start-stop-daemon --stop --quiet --pidfile \
+                /var/run/nginx.pid --exec $DAEMON
+        sleep 1
+        start-stop-daemon --start --quiet --pidfile \
+                /var/run/nginx.pid --exec $DAEMON -- $DAEMON_OPTS
+        echo "$NAME."
+        ;;
+  reload)
+      echo -n "Reloading $DESC configuration: "
+      start-stop-daemon --stop --signal HUP --quiet --pidfile /var/run/nginx.pid \
+          --exec $DAEMON 
+      echo "$NAME."
+      ;;
+  *)
+        N=/etc/init.d/$NAME
+        echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
+        exit 1   
+        ;;
+esac
+
+exit 0
-- 
1.7.3.2

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

---

From: Natanael Copa <[email-masked]>
Date: Mon, 01 Nov 2010 16:28:44 +0100

Thanks for the apkbuild.

We are in the middle of the 2.1 release. Is the release worth delaying
for this package?

> diff --git a/main/nginx/APKBUILD b/main/nginx/APKBUILD

We normally add new packages to testing/ first

> +++ b/main/nginx/APKBUILD

The 3 comment lines above should be removed.

> +_builddir="$srcdir"/$pkgname-$pkgver

[cutted the part that looked good]

> +++ b/main/nginx/nginx.initd

Should be #!/sbin/runscript

> +# Description:       starts nginx using start-stop-daemon

No. We use openrc (like gentoo) which does not understand the above
service dependency info.

The init.d needs to be rewritten to fit the rest of the system.

Thanks!

-nc

---

---

From: Cameron Banta <[email-masked]>
Date: Mon, 01 Nov 2010 10:57:34 -0500

> We are in the middle of the 2.1 release. Is the release worth delaying
No, this was intended for 2.2. Should I just keep it locally and wait 
until 2.1 is released before sending it?

> We normally add new packages to testing/ first
Sorry, I can move it there.
>> +# Contributor: Cameron Banta<[email-masked]>
>> +# Maintainer: Cameron Banta<[email-masked]>
>> +pkgname=nginx
>> +pkgver=0.8.53
>> +pkgrel=0
Ok, I'm looking for the gentoo init script.

-Cameron

---

---

From: Natanael Copa <[email-masked]>
Date: Mon, 01 Nov 2010 17:45:25 +0100

> until 2.1 is released before sending it?

nah... It missed the 2.1 train anyways (I just tagged it and branched it
and is working on setting up the build-2-1 vserver)

Thanks!
-nc

---