aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2014-01-04 22:56:07 +0100
committerGuilhem Moulin <guilhem@fripost.org>2015-06-07 04:27:55 +0200
commit3510a345f0f083d2c34f27c1bb3f762325a92826 (patch)
tree82af6ccb35bb9460d85e43694f8ccf2a13b51996
parent71f227f2e30630f7bfbe1e4520efb727779b3b16 (diff)
Use dpkg-architecture(1).
When compiling for x86_86 on a i386 machine or vice versa, the following warning appears: dpkg-architecture: warning: specified GNU system type x86_64-linux-gnu does not match gcc system type i486-linux-gnu, try setting a correct CC environment variable However this is harmless, even if the multilib approach is a bit hacky and does not replace a proper cross-compiler. Cf. bug #712000 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=712000
-rw-r--r--Makefile38
-rw-r--r--src/fripost-partman-udeb/Makefile7
-rwxr-xr-xsrc/getname.sh3
3 files changed, 19 insertions, 29 deletions
diff --git a/Makefile b/Makefile
index 910689b..d207c86 100644
--- a/Makefile
+++ b/Makefile
@@ -1,39 +1,35 @@
-ARCH ?= $(shell uname -m)
-ifeq (${ARCH}, x86_64)
-ARCH = amd64
-endif
-ifeq (${ARCH}, i686)
-ARCH = i386
-endif
+CC ?= gcc
+CC += -m$(shell dpkg-architecture -qDEB_HOST_ARCH_BITS $(patsubst %,-a%, ${ARCH}))
+DEB_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH $(patsubst %,-a%, ${ARCH}))
VERSION = 7.3.0
-ISOIMG = debian-${VERSION}-${ARCH}-netinst.iso
+ISOIMG = debian-${VERSION}-${DEB_ARCH}-netinst.iso
PRESEEDED = $(patsubst %.iso,%-preseeded.iso, ${ISOIMG})
UDEBS = $(shell ./src/getname.sh)
CHECKSUMS = MD5 SHA1 SHA256 SHA512
# Preseed
iso-preseed:
- make dist/${ARCH}/${PRESEEDED}
-dist/${ARCH}/${PRESEEDED}: preseed.cfg $(wildcard ./include/*) dist/${ARCH}/${ISOIMG} ${UDEBS}
- ./preseed.sh $@ dist/${ARCH}/${ISOIMG} ${UDEBS}
+ make dist/${DEB_ARCH}/${PRESEEDED}
+dist/${DEB_ARCH}/${PRESEEDED}: preseed.cfg $(wildcard ./include/*) dist/${DEB_ARCH}/${ISOIMG} ${UDEBS}
+ ./preseed.sh $@ dist/${DEB_ARCH}/${ISOIMG} ${UDEBS}
# Get, verify
-iso-get: dist/${ARCH}/${ISOIMG}
+iso-get: dist/${DEB_ARCH}/${ISOIMG}
iso-checksum: $(patsubst %,iso-checksum-%, ${CHECKSUMS})
# Verify a single digest
-iso-checksum-%: dist/${ARCH}/${ISOIMG} dist/${ARCH}/%SUMS dist/${ARCH}/%SUMS.sign
+iso-checksum-%: dist/${DEB_ARCH}/${ISOIMG} dist/${DEB_ARCH}/%SUMS dist/${DEB_ARCH}/%SUMS.sign
@echo Checking $* sum
- @cd dist/${ARCH}; grep "\s${ISOIMG}$$" $*SUMS | $$(echo $* | sed 's@.*@/usr/bin/\L&sum@') --strict -c
- gpg --verify dist/${ARCH}/$*SUMS.sign
+ @cd dist/${DEB_ARCH}; grep "\s${ISOIMG}$$" $*SUMS | $$(echo $* | sed 's@.*@/usr/bin/\L&sum@') --strict -c
+ gpg --verify dist/${DEB_ARCH}/$*SUMS.sign
# Download
-.PRECIOUS: dist/${ARCH}/%
-dist/${ARCH}/%:
- @[ -d dist/${ARCH} ] || mkdir -p dist/${ARCH}
- wget -nc -P dist/${ARCH} http://cdimage.debian.org/debian-cd/current/${ARCH}/iso-cd/$*
+.PRECIOUS: dist/${DEB_ARCH}/%
+dist/${DEB_ARCH}/%:
+ @[ -d dist/${DEB_ARCH} ] || mkdir -p dist/${DEB_ARCH}
+ wget -nc -P dist/${DEB_ARCH} http://cdimage.debian.org/debian-cd/current/${DEB_ARCH}/iso-cd/$*
# All udebs
udebs: ${UDEBS}
@@ -41,10 +37,10 @@ udebs: ${UDEBS}
# Single udeb; TODO: GPG sign
%.udeb: UDEB = $(shell ./src/getname.sh $*)
%.udeb: $(shell /usr/bin/git ls-files -- src/${UDEB})
- @cd src/${UDEB} && /usr/bin/debuild -i -us -uc -b -a${ARCH}
+ @cd src/${UDEB} && /usr/bin/debuild -e CC='${CC}' -i -us -uc -b -a${DEB_ARCH}
clean:
@for d in src/*-udeb/; do rm -fv $${d%-udeb/}_*.build $${d%-udeb/}_*.changes $${d%-udeb/}_*.udeb; cd $$d && dh_clean && cd -; done
- @rm -fv $(patsubst %,dist/${ARCH}/%SUMS, ${CHECKSUMS}) $(patsubst %,dist/${ARCH}/%SUMS.sign, ${CHECKSUMS})
+ @rm -fv $(patsubst %,dist/${DEB_ARCH}/%SUMS, ${CHECKSUMS}) $(patsubst %,dist/${DEB_ARCH}/%SUMS.sign, ${CHECKSUMS})
.PHONY: clean cleanall iso-get iso-checksum iso-preseed udebs
diff --git a/src/fripost-partman-udeb/Makefile b/src/fripost-partman-udeb/Makefile
index a1e0e73..1b96c14 100644
--- a/src/fripost-partman-udeb/Makefile
+++ b/src/fripost-partman-udeb/Makefile
@@ -1,13 +1,6 @@
CC ?= gcc
CFLAGS ?= -Wall -x c -s
-ifeq (${ARCH}, amd64)
-CFLAGS += -m64
-endif
-ifeq (${ARCH}, i386)
-CFLAGS += -m32
-endif
-
LIBS = lib/stdbuf.so
all: ${LIBS}
diff --git a/src/getname.sh b/src/getname.sh
index f9ed5ec..3bd5bf6 100755
--- a/src/getname.sh
+++ b/src/getname.sh
@@ -21,7 +21,8 @@ else
if [ -r "$dir/debian/files" ]; then
echo src/$(cut -d' ' -f1 "$dir/debian/files")
else
- sed -nr 's@^(\S+) \(([0-9.]+)\).*@src/\1_\2_all.udeb@p' "$dir/debian/changelog"
+ deb_arch=$(dpkg-architecture -qDEB_HOST_ARCH ${ARCH:+-a$ARCH})
+ sed -nr "s@^(\S+) \(([0-9.]+)\).*@src/\1_\2_${deb_arch}.udeb@p" "$dir/debian/changelog"
fi
done
fi