diff --git a/net/beanstalkd/Makefile b/net/beanstalkd/Makefile new file mode 100644 index 000000000..53749a917 --- /dev/null +++ b/net/beanstalkd/Makefile @@ -0,0 +1,48 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=beanstalkd +PKG_VERSION:=1.9 +PKG_RELEASE:=1 + +# for now, build from latest commit since releases are infrequent and +# useful fixes trickle in... +PKG_SOURCE_URL:=https://github.com/kr/beanstalkd.git +PKG_SOURCE_VERSION:=b7b4a6a14b7e8d096dc8cbc255b23be17a228cbb + +PKG_SOURCE_PROTO:=git +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-v$(PKG_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-v$(PKG_VERSION) + +PKG_MAINTAINER:=Philip Prindeville +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/package.mk + +define Package/beanstalkd + SECTION:=net + CATEGORY:=Network + TITLE:=Beanstalk +endef + +define Package/beanstalkd/description + Beanstalk is a simple, fast work queue. +endef + +define Build/Configure +endef + +define Build/Compile + cd $(PKG_BUILD_DIR) && make CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS)" LDFLAGS="$(TARGET_LDFLAGS)" PREFIX=/usr +endef + +define Package/beanstalkd/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/beanstalkd $(1)/usr/bin/beanstalkd + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/beanstalkd.init $(1)/etc/init.d/beanstalkd +endef + +$(eval $(call BuildPackage,beanstalkd)) diff --git a/net/beanstalkd/files/beanstalkd.init b/net/beanstalkd/files/beanstalkd.init new file mode 100644 index 000000000..992076d3a --- /dev/null +++ b/net/beanstalkd/files/beanstalkd.init @@ -0,0 +1,14 @@ +#!/bin/sh /etc/rc.common +# Beanstalk + +START=21 +STOP=11 + +USE_PROCD=1 +PROG=/usr/bin/beanstalkd + +start_service() { + procd_open_instance + procd_set_param command $PROG + procd_close_instance +} diff --git a/net/beanstalkd/patches/900-makefile.patch b/net/beanstalkd/patches/900-makefile.patch new file mode 100644 index 000000000..f948851e2 --- /dev/null +++ b/net/beanstalkd/patches/900-makefile.patch @@ -0,0 +1,116 @@ +diff --git a/Makefile b/Makefile +index a3f345f..fe5a083 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,17 +1,16 @@ +-PREFIX=/usr/local +-BINDIR=$(DESTDIR)$(PREFIX)/bin +-CFLAGS=-Wall -Werror\ +- -Wformat=2\ +- -g\ +- +-LDFLAGS= +-OS=$(shell uname|tr A-Z a-z) +-INSTALL=install +- +-VERS=$(shell ./vers.sh) +-TARG=beanstalkd +-MOFILE=main.o +-OFILES=\ ++PREFIX ?= /usr/local ++BINDIR = $(DESTDIR)$(PREFIX)/bin ++CFLAGS += -Wall -Werror -Wformat=2 -g ++LDFLAGS += ++LDLIBS ?= ++ ++OS ?= $(shell uname | tr 'A-Z' 'a-z') ++INSTALL ?= install ++ ++VERS = $(shell ./vers.sh) ++TARG = beanstalkd ++MOFILE = main.o ++OFILES = \ + $(OS).o\ + conn.o\ + file.o\ +@@ -29,52 +28,44 @@ OFILES=\ + vers.o\ + walg.o\ + +-TOFILES=\ ++TOFILES = \ + testheap.o\ + testjobs.o\ + testserv.o\ + testutil.o\ + +-HFILES=\ ++HFILES = \ + dat.h\ + sd-daemon.h\ + + ifeq ($(OS),linux) +- +-LDLIBS=\ +- -lrt\ +- ++ LDLIBS += -lrt + endif + +-CLEANFILES=\ ++CLEANFILES = \ + vers.c\ + +-.PHONY: all + all: $(TARG) + + $(TARG): $(OFILES) $(MOFILE) + $(LINK.o) -o $@ $^ $(LDLIBS) + +-.PHONY: install + install: $(BINDIR)/$(TARG) + + $(BINDIR)/%: % + $(INSTALL) -d $(dir $@) + $(INSTALL) $< $@ + +-CLEANFILES:=$(CLEANFILES) $(TARG) ++CLEANFILES := $(CLEANFILES) $(TARG) + + $(OFILES) $(MOFILE): $(HFILES) + +-.PHONY: clean + clean: + rm -f *.o $(CLEANFILES) + +-.PHONY: check + check: ct/_ctcheck + ct/_ctcheck + +-.PHONY: bench + bench: ct/_ctcheck + ct/_ctcheck -b + +@@ -88,11 +79,8 @@ ct/ct.o ct/_ctcheck.o: ct/ct.h ct/internal.h + + $(TOFILES): $(HFILES) ct/ct.h + +-CLEANFILES:=$(CLEANFILES) ct/_* ct/*.o ++CLEANFILES += ct/_* ct/*.o + +-ifneq ($(shell ./verc.sh),$(shell cat vers.c 2>/dev/null)) +-.PHONY: vers.c +-endif + vers.c: + ./verc.sh >vers.c + +@@ -100,3 +88,9 @@ doc/beanstalkd.1 doc/beanstalkd.1.html: doc/beanstalkd.ronn + ronn $< + + freebsd.o: darwin.c ++ ++.PHONY: all install clean check bench ++ ++ifneq ($(shell ./verc.sh),$(shell cat vers.c 2>/dev/null)) ++.PHONY: vers.c ++endif diff --git a/net/beanstalkd/patches/901-fix-headers.patch b/net/beanstalkd/patches/901-fix-headers.patch new file mode 100644 index 000000000..ba6de6d78 --- /dev/null +++ b/net/beanstalkd/patches/901-fix-headers.patch @@ -0,0 +1,11 @@ +--- a/sd-daemon.c 2017-02-16 18:50:20.000000000 -0700 ++++ b/sd-daemon.c 2017-02-16 19:21:09.086008361 -0700 +@@ -32,7 +32,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include diff --git a/net/beanstalkd/patches/902-replace-posix_fallocate.patch b/net/beanstalkd/patches/902-replace-posix_fallocate.patch new file mode 100644 index 000000000..18b07c188 --- /dev/null +++ b/net/beanstalkd/patches/902-replace-posix_fallocate.patch @@ -0,0 +1,18 @@ +--- a/linux.c ++++ b/linux.c +@@ -1,4 +1,6 @@ + #define _XOPEN_SOURCE 600 ++#include ++#include + #include + #include + #include +@@ -19,7 +19,7 @@ static int epfd; + int + rawfalloc(int fd, int len) + { +- return posix_fallocate(fd, 0, len); ++ return ftruncate(fd, len); + } + +