From fd4d172d1fb22533fd7ade366d3adc96468a2b7e Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Sun, 27 Oct 2013 23:13:53 +0100 Subject: make pacdbserve aware of architecture --- .gitignore | 1 + Makefile | 7 ++++++- avahi/pacdbserve.service | 15 --------------- avahi/pacdbserve.service.in | 15 +++++++++++++++ pacredir.c | 10 +++++++++- 5 files changed, 31 insertions(+), 17 deletions(-) delete mode 100644 avahi/pacdbserve.service create mode 100644 avahi/pacdbserve.service.in diff --git a/.gitignore b/.gitignore index e21dcd7..2e6e296 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *~ *.o pacredir +avahi/pacdbserve.service README.html diff --git a/Makefile b/Makefile index 9487510..1bb8d07 100644 --- a/Makefile +++ b/Makefile @@ -4,23 +4,28 @@ CC := gcc MD := markdown INSTALL := install RM := rm +SED := sed CFLAGS += -O2 -Wall -Werror CFLAGS += $(shell pkg-config --libs --cflags libcurl) CFLAGS += $(shell pkg-config --libs --cflags avahi-client) CFLAGS += $(shell pkg-config --libs --cflags libmicrohttpd) VERSION := $(shell git describe --tags --long 2>/dev/null) +ARCH := $(shell uname -m) # this is just a fallback in case you do not use git but downloaded # a release tarball... ifeq ($(VERSION),) VERSION := 0.0.1 endif -all: pacredir README.html +all: pacredir pacdbserve README.html pacredir: pacredir.c $(CC) $(CFLAGS) -o pacredir pacredir.c \ -DVERSION="\"$(VERSION)\"" +pacdbserve: avahi/pacdbserve.service.in + $(SED) 's/%ARCH%/$(ARCH)/' avahi/pacdbserve.service.in > avahi/pacdbserve.service + README.html: README.md $(MD) README.md > README.html diff --git a/avahi/pacdbserve.service b/avahi/pacdbserve.service deleted file mode 100644 index 38c8211..0000000 --- a/avahi/pacdbserve.service +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - %h - - - _pacdbserve._tcp - 7079 - - - diff --git a/avahi/pacdbserve.service.in b/avahi/pacdbserve.service.in new file mode 100644 index 0000000..ee6a9bb --- /dev/null +++ b/avahi/pacdbserve.service.in @@ -0,0 +1,15 @@ + + + + + + + + %h + + + _pacdbserve_%ARCH%._tcp + 7079 + + + diff --git a/pacredir.c b/pacredir.c index a55f143..7cc19f9 100644 --- a/pacredir.c +++ b/pacredir.c @@ -24,6 +24,14 @@ #include #include +#if defined __x86_64__ +# define ARCH "x86_64" +#elif defined __i386__ +# define ARCH "i686" +#else +# error Unknown architecture! +#endif + #define PAGE307 "307 temporary redirect" \ "307 temporary redirect: " \ "%s" @@ -31,7 +39,7 @@ "404 Not Found: %s" #define PORT 7077 #define PACSERVE "_pacserve._tcp" -#define PACDBSERVE "_pacdbserve._tcp" +#define PACDBSERVE "_pacdbserve_" ARCH "._tcp" #define SYNCPATH "/var/lib/pacman/sync" #define BADTIME 60 * 10 -- cgit v1.2.3-70-g09d2