X-Original-To: alpine-aports@lists.alpinelinux.org Received: from mx12.valuehost.ru (mx12.valuehost.ru [217.112.42.215]) by lists.alpinelinux.org (Postfix) with ESMTP id 3D9A35C66BD for ; Mon, 3 Dec 2018 10:54:13 +0000 (GMT) Received: from mx7.valuehost.ru (unknown [127.0.0.255]) by mx12.valuehost.ru (Postfix) with ESMTP id C31B24C4A8 for ; Mon, 3 Dec 2018 13:54:11 +0300 (MSK) From: alpine-mips-patches Date: Mon, 3 Dec 2018 10:26:31 +0000 Subject: [alpine-aports] [PATCH] community/dynamips: fix byte order detection To: alpine-aports@lists.alpinelinux.org Message-Id: <20181203105411.C31B24C4A8@mx12.valuehost.ru> X-Mailinglist: alpine-aports Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: Use the generic gcc/clang/suncc __BYTE_ORDER__ macro to detect platform byte order instead of hard-coded architecture detection which is wrong for ppc64le (always assumes POWER is big-endian) and lacks any knowledge of mips*. This change covers s390x too so remove s390x-support.patch. --- community/dynamips/APKBUILD | 6 ++-- community/dynamips/detect-byte-order.patch | 34 ++++++++++++++++++++++ community/dynamips/s390x-support.patch | 13 --------- 3 files changed, 37 insertions(+), 16 deletions(-) create mode 100644 community/dynamips/detect-byte-order.patch delete mode 100644 community/dynamips/s390x-support.patch diff --git a/community/dynamips/APKBUILD b/community/dynamips/APKBUILD index 5c8f62bef4..0013d974eb 100644 --- a/community/dynamips/APKBUILD +++ b/community/dynamips/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Francesco Colista pkgname=dynamips pkgver=0.2.18 -pkgrel=0 +pkgrel=1 pkgdesc="Cisco router emulator" url="https://github.com/GNS3/dynamips" arch="all" @@ -10,7 +10,7 @@ license="GPL-2.0" makedepends="cmake libpcap-dev libelf-dev linux-headers paxmark libnsl-dev" subpackages="$pkgname-doc" source="${pkgname}-${pkgver}.tar.gz::https://github.com/GNS3/${pkgname}/archive/v${pkgver}.tar.gz - s390x-support.patch" + detect-byte-order.patch" builddir="$srcdir"/$pkgname-$pkgver prepare() { @@ -36,4 +36,4 @@ package() { } sha512sums="d66e32d72ecc9ebff5232377ac9aa5b966ceb08884cc7f8dc4a8cf3f56305e7cefd677624ba66278f6603a3b275c384bd0ff3905932461b1f8056106cd272a4c dynamips-0.2.18.tar.gz -151f9c7d53c0edd9d300b3e84ce50d500018a533d6d131609ac0c25244db640d65d2322104c126e7c0e311cc0b197c07976f21fa28909a92d48cf31b6208431b s390x-support.patch" +d3beb4ddda4ca571a36f2333609db48126c0f6629adf39a985cedb1741356f415f33c82c56b69802955869c6741655476253c4ea4e8ef1461411cc52e411e429 detect-byte-order.patch" diff --git a/community/dynamips/detect-byte-order.patch b/community/dynamips/detect-byte-order.patch new file mode 100644 index 0000000000..0181be2a1d --- /dev/null +++ b/community/dynamips/detect-byte-order.patch @@ -0,0 +1,34 @@ +--- a/common/dynamips_common.h ++++ b/common/dynamips_common.h +@@ -50,21 +50,17 @@ + #define ARCH_BIG_ENDIAN 0x4321 + #define ARCH_LITTLE_ENDIAN 0x1234 + +-#if defined(PPC) || defined(__powerpc__) || defined(__ppc__) +-#define ARCH_BYTE_ORDER ARCH_BIG_ENDIAN +-#elif defined(__sparc) || defined(__sparc__) +-#define ARCH_BYTE_ORDER ARCH_BIG_ENDIAN +-#elif defined(__alpha) || defined(__alpha__) +-#define ARCH_BYTE_ORDER ARCH_LITTLE_ENDIAN +-#elif defined(__i386) || defined(__i386__) || defined(i386) +-#define ARCH_BYTE_ORDER ARCH_LITTLE_ENDIAN ++ ++#ifdef __BYTE_ORDER__ ++#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ++#define ARCH_BYTE_ORDER ARCH_BIG_ENDIAN ++#else ++#define ARCH_BYTE_ORDER ARCH_LITTLE_ENDIAN ++#endif ++#endif ++ ++#if defined(__i386) || defined(__i386__) || defined(i386) + #define ARCH_REGPARM_SUPPORTED 1 +-#elif defined(__x86_64__) +-#define ARCH_BYTE_ORDER ARCH_LITTLE_ENDIAN +-#elif defined(__ia64__) +-#define ARCH_BYTE_ORDER ARCH_LITTLE_ENDIAN +-#elif defined(__arm__) || defined (__aarch64__) +-#define ARCH_BYTE_ORDER ARCH_LITTLE_ENDIAN + #endif + + #ifndef ARCH_BYTE_ORDER diff --git a/community/dynamips/s390x-support.patch b/community/dynamips/s390x-support.patch deleted file mode 100644 index 529fe9a65b..0000000000 --- a/community/dynamips/s390x-support.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/common/dynamips_common.h b/common/dynamips_common.h -index 9c20f38..0c8ca2c 100644 ---- a/common/dynamips_common.h -+++ b/common/dynamips_common.h -@@ -50,7 +50,7 @@ - #define ARCH_BIG_ENDIAN 0x4321 - #define ARCH_LITTLE_ENDIAN 0x1234 - --#if defined(PPC) || defined(__powerpc__) || defined(__ppc__) -+#if defined(PPC) || defined(__powerpc__) || defined(__ppc__) || defined(__s390x__) - #define ARCH_BYTE_ORDER ARCH_BIG_ENDIAN - #elif defined(__sparc) || defined(__sparc__) - #define ARCH_BYTE_ORDER ARCH_BIG_ENDIAN -- 2.19.2 --- Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org Help: alpine-aports+help@lists.alpinelinux.org ---