packages/net/beanstalkd/patches/900-makefile.patch
Philip Prindeville 8043fdf755 beanstalkd: add package
For now building from git using latest SHA (commits are relatively
infrequent).  Set priority to come up immediately after network
interfaces are brought up. Patches have been submitted upstream
(but not yet accepted) to fix:

* a somewhat cross-compile unfriendly makefile;
* a header inclusion issue which causes MUSL compilation warnings;
* using the somewhat arcane posix_fallocate() in favor of the
  more ubiquitous ftruncate() system call instead.

Hopefully the next release will include our submitted fixes and
we can transition to a numbered release.

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
2017-07-12 20:41:19 -06:00

116 lines
1.9 KiB
Diff

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