summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2013-10-30 15:38:01 +0100
committerGravatar Christian Hesse <mail@eworm.de>2013-10-30 15:38:01 +0100
commiteb49f6926581f9f9d7e6d9853ad41533fd779c07 (patch)
tree9a1ce45b04477a2c19e366c3cea9b14ff6129da4
parentf38d0c991bcae3a894f3fc0b562f954e8e4ca2b6 (diff)
downloadpacredir-eb49f6926581f9f9d7e6d9853ad41533fd779c07.tar.gz
pacredir-eb49f6926581f9f9d7e6d9853ad41533fd779c07.tar.zst
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.
-rw-r--r--.gitignore1
-rw-r--r--Makefile10
-rw-r--r--arch.c21
-rw-r--r--config.def.h2
4 files changed, 29 insertions, 5 deletions
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 <mail@eworm.de>
+ *
+ * This software may be used and distributed according to the terms
+ * of the GNU General Public License, incorporated herein by reference.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#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!