From eb49f6926581f9f9d7e6d9853ad41533fd779c07 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 30 Oct 2013 15:38:01 +0100 Subject: use a little helper to determine architecture Architecture reported by `uname -a` and used by pacman are not neccessarily the same, so use a little helper. --- .gitignore | 1 + Makefile | 10 ++++++---- arch.c | 21 +++++++++++++++++++++ config.def.h | 2 +- 4 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 arch.c diff --git a/.gitignore b/.gitignore index 8ffca75..693b02f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *~ *.o +arch pacredir config.h avahi/pacdbserve.service diff --git a/Makefile b/Makefile index 78798a4..f41b033 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,6 @@ 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),) @@ -20,6 +19,9 @@ endif all: pacredir avahi/pacdbserve.service README.html +arch: arch.c config.h + $(CC) -o arch arch.c + pacredir: pacredir.c config.h $(CC) $(CFLAGS) -o pacredir pacredir.c \ -DVERSION="\"$(VERSION)\"" @@ -27,8 +29,8 @@ pacredir: pacredir.c config.h config.h: $(CP) config.def.h config.h -avahi/pacdbserve.service: avahi/pacdbserve.service.in - $(SED) 's/%ARCH%/$(ARCH)/' avahi/pacdbserve.service.in > avahi/pacdbserve.service +avahi/pacdbserve.service: arch avahi/pacdbserve.service.in + $(SED) 's/%ARCH%/$(shell ./arch)/' avahi/pacdbserve.service.in > avahi/pacdbserve.service README.html: README.md $(MD) README.md > README.html @@ -49,4 +51,4 @@ install-doc: README.html $(INSTALL) -D -m0644 README.html $(DESTDIR)/usr/share/doc/paccache/README.html clean: - $(RM) -f *.o *~ pacredir avahi/pacdbserve.service README.html + $(RM) -f *.o *~ arch pacredir avahi/pacdbserve.service README.html diff --git a/arch.c b/arch.c new file mode 100644 index 0000000..9a5f690 --- /dev/null +++ b/arch.c @@ -0,0 +1,21 @@ +/* + * (C) 2013 by Christian Hesse + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + */ + +#include +#include + +#include "config.h" + +/*** main ***/ +int main(int argc, char ** argv) { + /* just print the architecture */ + puts(ARCH); + + return EXIT_SUCCESS; +} + +// vim: set syntax=c: diff --git a/config.def.h b/config.def.h index 6df05cb..72bf6a8 100644 --- a/config.def.h +++ b/config.def.h @@ -19,7 +19,7 @@ # if defined __VFP_FP__ # define ARCH "armv6h" # else -# define ARCH "armv6l" +# define ARCH "arm" # endif #else # error Unknown architecture! -- cgit v1.2.3-70-g09d2