teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.9.0-armhfp.patch

1672df
diff -uNr rpm-4.9.0-orig//installplatform rpm-4.9.0/installplatform
1672df
--- rpm-4.9.0-orig//installplatform	2010-12-03 06:11:57.000000000 -0600
1672df
+++ rpm-4.9.0/installplatform	2011-08-05 12:25:13.000000000 -0500
1672df
@@ -19,7 +19,7 @@
1672df
 case "$arch" in
1672df
   i[3456]86|pentium[34]|athlon|geode) SUBSTS='s_i386_i386_ s_i386_i486_ s_i386_i586_ s_i386_i686_ s_i386_pentium3_ s_i386_pentium4_ s_i386_athlon_ s_i386_geode_' ;;
1672df
   alpha*) SUBSTS='s_alpha_alpha_ s_alpha_alphaev5_ s_alpha_alphaev56_ s_alpha_alphapca56_ s_alpha_alphaev6_ s_alpha_alphaev67_' ;;
1672df
-  arm*) SUBSTS='s_arm_arm_ s_arm_armv3l_ s_arm_armv4l_ s_arm_armv4tl_ s_arm_armv5tel_ s_arm_armv5tejl_ s_arm_armv6l_ s_arm_armv7l_' ;;
1672df
+  arm*) SUBSTS='s_arm_arm_ s_arm_armv3l_ s_arm_armv4l_ s_arm_armv4tl_ s_arm_armv5tel_ s_arm_armv5tejl_ s_arm_armv6l_ s_arm_armv7l_ s_arm_armv7hl_ s_arm_armv7hnl_' ;;
1672df
   sh4*) SUBSTS='s_sh4_sh4_ s_sh4_sh4a_' ;;
1672df
   sparc*) SUBSTS='s_sparc\(64\|64v\|v9v\|v9\)_sparc_ s_sparc64_sparcv9_;s_sparc\([^v]\|$\)_sparcv9\1_ s_sparcv9_sparc64_;s_sparc\([^6]\|$\)_sparc64\1_' ;;
1672df
   powerpc*|ppc*) SUBSTS='s_ppc64_ppc_ s_ppc\([^6ip]\|$\)_ppc64\1_ s_ppc\([^6ip]\|$\)_ppciseries_ s_ppc\([^6ip]\|$\)_ppcpseries_ s_ppc\([^6ip]\|$\)_ppc64iseries_ s_ppc\([^6ip]\|$\)_ppc64pseries_' ;;
1672df
diff -uNr rpm-4.9.0-orig//lib/rpmrc.c rpm-4.9.0/lib/rpmrc.c
1672df
--- rpm-4.9.0-orig//lib/rpmrc.c	2011-08-05 12:23:04.000000000 -0500
1672df
+++ rpm-4.9.0/lib/rpmrc.c	2011-08-05 12:25:13.000000000 -0500
1672df
@@ -732,6 +732,56 @@
1672df
 }
1672df
 #endif
1672df
 
1672df
+#if defined(__linux__) && defined(__arm__)
1672df
+static int has_neon()
1672df
+{
1672df
+        char buffer[4096], *p;
1672df
+        int fd = open("/proc/cpuinfo", O_RDONLY);
1672df
+        if (read(fd, &buffer, sizeof(buffer) - 1) == -1) {
1672df
+                rpmlog(RPMLOG_WARNING, _("read(/proc/cpuinfo) failed\n"));
1672df
+                close(fd);
1672df
+                return 0;
1672df
+        }
1672df
+        close(fd);
1672df
+
1672df
+        p = strstr(buffer, "Features");
1672df
+        p = strtok(p, "\n");
1672df
+        p = strstr(p, "neon");
1672df
+        p = strtok(p, " ");
1672df
+        if (p == NULL) {
1672df
+                rpmlog(RPMLOG_WARNING, _("/proc/cpuinfo has no 'Features' line\n"));
1672df
+                return 0;
1672df
+        } else if (strcmp(p, "neon") == 0) {
1672df
+                return 1;
1672df
+        }
1672df
+        return 0;
1672df
+}
1672df
+
1672df
+static int has_hfp()
1672df
+{
1672df
+        char buffer[4096], *p;
1672df
+        int fd = open("/proc/cpuinfo", O_RDONLY);
1672df
+        if (read(fd, &buffer, sizeof(buffer) - 1) == -1) {
1672df
+                rpmlog(RPMLOG_WARNING, _("read(/proc/cpuinfo) failed\n"));
1672df
+                close(fd);
1672df
+                return 0;
1672df
+        }
1672df
+        close(fd);
1672df
+
1672df
+        p = strstr(buffer, "Features");
1672df
+        p = strtok(p, "\n");
1672df
+        p = strstr(p, "vfpv3");
1672df
+        p = strtok(p, " ");
1672df
+        if (p == NULL) {
1672df
+                rpmlog(RPMLOG_WARNING, _("/proc/cpuinfo has no 'Features' line\n"));
1672df
+                return 0;
1672df
+        } else if (strcmp(p, "vfpv3") == 0) {
1672df
+                return 1;
1672df
+        }
1672df
+        return 0;
1672df
+}
1672df
+#endif
1672df
+
1672df
 
1672df
 #	if defined(__linux__) && defined(__i386__)
1672df
 #include <setjmp.h>
1672df
@@ -1157,6 +1207,22 @@
1672df
 	}
1672df
 #	endif	/* sparc*-linux */
1672df
 
1672df
+#	if defined(__linux__) && defined(__arm__)
1672df
+	{
1672df
+	    if (strcmp(un.machine, "armv7l") == 0 ) {
1672df
+	        if (has_neon() && has_hfp())
1672df
+                    strcpy(un.machine, "armv7hnl");
1672df
+                else if (has_hfp())
1672df
+                    strcpy(un.machine, "armv7hl");
1672df
+	    } else if (strcmp(un.machine, "armv6l") == 0 ) {
1672df
+	        if (has_neon() && has_hfp())
1672df
+                    strcpy(un.machine, "armv6hnl");
1672df
+                else if (has_hfp())
1672df
+                    strcpy(un.machine, "armv6hl");
1672df
+	    }
1672df
+	}
1672df
+#	endif	/* arm*-linux */
1672df
+
1672df
 #	if defined(__GNUC__) && defined(__alpha__)
1672df
 	{
1672df
 	    unsigned long amask, implver;
1672df
diff -uNr rpm-4.9.0-orig//macros.in rpm-4.9.0/macros.in
1672df
--- rpm-4.9.0-orig//macros.in	2011-08-05 12:23:04.000000000 -0500
1672df
+++ rpm-4.9.0/macros.in	2011-08-05 12:25:13.000000000 -0500
1672df
@@ -1032,7 +1032,7 @@
1672df
 
1672df
 #------------------------------------------------------------------------------
1672df
 # arch macro for all supported ARM processors
1672df
-%arm	armv3l armv4b armv4l armv4tl armv5tel armv5tejl armv6l armv7l
1672df
+%arm	armv3l armv4b armv4l armv4tl armv5tel armv5tejl armv6l armv7l armv7hl armv7hnl
1672df
 
1672df
 #------------------------------------------------------------------------------
1672df
 # arch macro for all supported Sparc processors
1672df
diff -uNr rpm-4.9.0-orig//rpmrc.in rpm-4.9.0/rpmrc.in
1672df
--- rpm-4.9.0-orig//rpmrc.in	2011-08-05 12:23:04.000000000 -0500
1672df
+++ rpm-4.9.0/rpmrc.in	2011-08-05 12:26:34.000000000 -0500
1672df
@@ -66,6 +66,8 @@
1672df
 optflags: armv5tejl -O2 -g -march=armv5te
1672df
 optflags: armv6l -O2 -g -march=armv6
1672df
 optflags: armv7l -O2 -g -march=armv7
1672df
+optflags: armv7hl -O2 -g -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -mthumb
1672df
+optflags: armv7hnl -O2 -g -march=armv7-a -mfloat-abi=hard -mfpu=neon -mthumb
1672df
 
1672df
 optflags: atarist -O2 -g -fomit-frame-pointer
1672df
 optflags: atariste -O2 -g -fomit-frame-pointer
1672df
@@ -140,6 +142,8 @@
1672df
 arch_canon:     armv5tejl: armv5tejl 	12
1672df
 arch_canon:     armv6l: armv6l 	12
1672df
 arch_canon:     armv7l: armv7l 	12
1672df
+arch_canon:     armv7hl: armv7hl 	12
1672df
+arch_canon:     armv7hnl: armv7hnl 	12
1672df
 
1672df
 arch_canon:	m68kmint: m68kmint	13
1672df
 arch_canon:	atarist: m68kmint	13
1672df
@@ -248,6 +252,8 @@
1672df
 buildarchtranslate: armv5tejl: armv5tejl
1672df
 buildarchtranslate: armv6l: armv6l
1672df
 buildarchtranslate: armv7l: armv7l
1672df
+buildarchtranslate: armv7hl: armv7hl
1672df
+buildarchtranslate: armv7hnl: armv7hnl
1672df
 
1672df
 buildarchtranslate: atarist: m68kmint
1672df
 buildarchtranslate: atariste: m68kmint
1672df
@@ -336,6 +342,8 @@
1672df
 arch_compat: armv4tl: armv4l
1672df
 arch_compat: armv4l: armv3l
1672df
 arch_compat: armv3l: noarch
1672df
+arch_compat: armv7hnl: armv7hl
1672df
+arch_compat: armv7hl: noarch
1672df
 
1672df
 arch_compat: atarist: m68kmint noarch
1672df
 arch_compat: atariste: m68kmint noarch
1672df
@@ -441,6 +449,9 @@
1672df
 buildarch_compat: armv4l: armv3l
1672df
 buildarch_compat: armv3l: noarch
1672df
 
1672df
+buildarch_compat: armv7hnl: armv7hl
1672df
+buildarch_compat: armv7hl: noarch
1672df
+
1672df
 buildarch_compat: hppa2.0: hppa1.2
1672df
 buildarch_compat: hppa1.2: hppa1.1
1672df
 buildarch_compat: hppa1.1: hppa1.0