From 5e26827d05c986d3f8a1f9c209e5e807146f2d4e Mon Sep 17 00:00:00 2001 From: Harish Kasiviswanathan Date: Wed, 7 Jun 2017 14:48:37 -0400 Subject: [PATCH] Support deb package build for other architectures Use build machine architecture to build debian package. Useful for building on Power8 and ARM64 machines. Change-Id: I97fc80a6723b139e753019a355f11ced0bba0dd4 Signed-off-by: Harish Kasiviswanathan --- DEBIAN/control | 2 +- src/Makefile | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/DEBIAN/control b/DEBIAN/control index 0c3484eb5a..779d712fac 100644 --- a/DEBIAN/control +++ b/DEBIAN/control @@ -1,5 +1,5 @@ Package: hsakmt-rocm-dev -Architecture: amd64 +Architecture: $arch Maintainer: Advanced Micro Devices Inc. Depends:libpci3 Priority: optional diff --git a/src/Makefile b/src/Makefile index db001a63ae..0ecf9d932f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -14,6 +14,7 @@ PACKAGE_MINOR_VER = 0 PACKAGE_PATCH_VER ?= 0 PACKAGE_VER = $(PACKAGE_MAJOR_VER).$(PACKAGE_MINOR_VER).$(PACKAGE_PATCH_VER) export PACKAGE_VER +DEB_BUILD_ARCH = $(shell dpkg --print-architecture | sed 's/ \*$i//g') # Compiler options CFLAGS += -fPIC # Position-independent code required to build shared library @@ -96,9 +97,10 @@ package-common: lnx64a deb: package-common @mkdir -p $(PACKAGE_DIR)/DEBIAN - @sed 's/\$$version/$(PACKAGE_VER)/g' $(DEBIAN_DIR)/control > $(PACKAGE_DIR)/DEBIAN/control + @sed 's/\$$version/$(PACKAGE_VER)/g;s/\$$arch/$(DEB_BUILD_ARCH)/g' $(DEBIAN_DIR)/control > $(PACKAGE_DIR)/DEBIAN/control + @fakeroot dpkg-deb --build $(PACKAGE_DIR) \ - $(BUILDDIR)/hsakmt-dev-$(PACKAGE_VER)-amd64.deb + $(BUILDDIR)/hsakmt-dev-$(PACKAGE_VER)-${DEB_BUILD_ARCH}.deb rpm: package-common @rpmbuild --define '_topdir $(BUILD_ROOT)/rpm' -ba $(THUNK_ROOT)/RPM/libhsakmt.spec