[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Endianess testing?



On Sat, Sep 26, 2015 at 02:26:42PM +0200, Ole Streicher wrote:
> how do I test the endianess of a system for the inclusion in
> debian/rules?
> 
> lscpu | fgrep -q "Little Endian"
> 
> comes in my mind; but is this safe? qemu-userland would probably report
> something wrong here?

You don't need to? dpkg knows.

amd64:

$ dpkg-architecture | grep ENDIAN
DEB_BUILD_ARCH_ENDIAN=little
DEB_HOST_ARCH_ENDIAN=little
DEB_TARGET_ARCH_ENDIAN=little

it's exported via /usr/share/dpkg/architecture.mk, too, you can do something like

include /usr/share/dpkg/architecture.mk
[...]
ifeq "$(DEB_HOST_ARCH_ENDIAN)" "big"
  <whatever>
endif

Same with little, obviously.

Regards,

Rene


Reply to: