From 1672df911c618dc936fb2ddbd2b79b87d306b516 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Wed, 9 Nov 2011 19:48:45 -0600 Subject: [PATCH] conditionally apply arm patch for hardfp on all arches but arm softfp ones --- rpm-4.9.0-armhfp.patch | 156 +++++++++++++++++++++++++++++++++++++++++ rpm.spec | 12 +++- 2 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 rpm-4.9.0-armhfp.patch diff --git a/rpm-4.9.0-armhfp.patch b/rpm-4.9.0-armhfp.patch new file mode 100644 index 0000000..f31bbc6 --- /dev/null +++ b/rpm-4.9.0-armhfp.patch @@ -0,0 +1,156 @@ +diff -uNr rpm-4.9.0-orig//installplatform rpm-4.9.0/installplatform +--- rpm-4.9.0-orig//installplatform 2010-12-03 06:11:57.000000000 -0600 ++++ rpm-4.9.0/installplatform 2011-08-05 12:25:13.000000000 -0500 +@@ -19,7 +19,7 @@ + case "$arch" in + 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_' ;; + alpha*) SUBSTS='s_alpha_alpha_ s_alpha_alphaev5_ s_alpha_alphaev56_ s_alpha_alphapca56_ s_alpha_alphaev6_ s_alpha_alphaev67_' ;; +- 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_' ;; ++ 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_' ;; + sh4*) SUBSTS='s_sh4_sh4_ s_sh4_sh4a_' ;; + 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_' ;; + 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_' ;; +diff -uNr rpm-4.9.0-orig//lib/rpmrc.c rpm-4.9.0/lib/rpmrc.c +--- rpm-4.9.0-orig//lib/rpmrc.c 2011-08-05 12:23:04.000000000 -0500 ++++ rpm-4.9.0/lib/rpmrc.c 2011-08-05 12:25:13.000000000 -0500 +@@ -732,6 +732,56 @@ + } + #endif + ++#if defined(__linux__) && defined(__arm__) ++static int has_neon() ++{ ++ char buffer[4096], *p; ++ int fd = open("/proc/cpuinfo", O_RDONLY); ++ if (read(fd, &buffer, sizeof(buffer) - 1) == -1) { ++ rpmlog(RPMLOG_WARNING, _("read(/proc/cpuinfo) failed\n")); ++ close(fd); ++ return 0; ++ } ++ close(fd); ++ ++ p = strstr(buffer, "Features"); ++ p = strtok(p, "\n"); ++ p = strstr(p, "neon"); ++ p = strtok(p, " "); ++ if (p == NULL) { ++ rpmlog(RPMLOG_WARNING, _("/proc/cpuinfo has no 'Features' line\n")); ++ return 0; ++ } else if (strcmp(p, "neon") == 0) { ++ return 1; ++ } ++ return 0; ++} ++ ++static int has_hfp() ++{ ++ char buffer[4096], *p; ++ int fd = open("/proc/cpuinfo", O_RDONLY); ++ if (read(fd, &buffer, sizeof(buffer) - 1) == -1) { ++ rpmlog(RPMLOG_WARNING, _("read(/proc/cpuinfo) failed\n")); ++ close(fd); ++ return 0; ++ } ++ close(fd); ++ ++ p = strstr(buffer, "Features"); ++ p = strtok(p, "\n"); ++ p = strstr(p, "vfpv3"); ++ p = strtok(p, " "); ++ if (p == NULL) { ++ rpmlog(RPMLOG_WARNING, _("/proc/cpuinfo has no 'Features' line\n")); ++ return 0; ++ } else if (strcmp(p, "vfpv3") == 0) { ++ return 1; ++ } ++ return 0; ++} ++#endif ++ + + # if defined(__linux__) && defined(__i386__) + #include +@@ -1157,6 +1207,22 @@ + } + # endif /* sparc*-linux */ + ++# if defined(__linux__) && defined(__arm__) ++ { ++ if (strcmp(un.machine, "armv7l") == 0 ) { ++ if (has_neon() && has_hfp()) ++ strcpy(un.machine, "armv7hnl"); ++ else if (has_hfp()) ++ strcpy(un.machine, "armv7hl"); ++ } else if (strcmp(un.machine, "armv6l") == 0 ) { ++ if (has_neon() && has_hfp()) ++ strcpy(un.machine, "armv6hnl"); ++ else if (has_hfp()) ++ strcpy(un.machine, "armv6hl"); ++ } ++ } ++# endif /* arm*-linux */ ++ + # if defined(__GNUC__) && defined(__alpha__) + { + unsigned long amask, implver; +diff -uNr rpm-4.9.0-orig//macros.in rpm-4.9.0/macros.in +--- rpm-4.9.0-orig//macros.in 2011-08-05 12:23:04.000000000 -0500 ++++ rpm-4.9.0/macros.in 2011-08-05 12:25:13.000000000 -0500 +@@ -1032,7 +1032,7 @@ + + #------------------------------------------------------------------------------ + # arch macro for all supported ARM processors +-%arm armv3l armv4b armv4l armv4tl armv5tel armv5tejl armv6l armv7l ++%arm armv3l armv4b armv4l armv4tl armv5tel armv5tejl armv6l armv7l armv7hl armv7hnl + + #------------------------------------------------------------------------------ + # arch macro for all supported Sparc processors +diff -uNr rpm-4.9.0-orig//rpmrc.in rpm-4.9.0/rpmrc.in +--- rpm-4.9.0-orig//rpmrc.in 2011-08-05 12:23:04.000000000 -0500 ++++ rpm-4.9.0/rpmrc.in 2011-08-05 12:26:34.000000000 -0500 +@@ -66,6 +66,8 @@ + optflags: armv5tejl -O2 -g -march=armv5te + optflags: armv6l -O2 -g -march=armv6 + optflags: armv7l -O2 -g -march=armv7 ++optflags: armv7hl -O2 -g -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -mthumb ++optflags: armv7hnl -O2 -g -march=armv7-a -mfloat-abi=hard -mfpu=neon -mthumb + + optflags: atarist -O2 -g -fomit-frame-pointer + optflags: atariste -O2 -g -fomit-frame-pointer +@@ -140,6 +142,8 @@ + arch_canon: armv5tejl: armv5tejl 12 + arch_canon: armv6l: armv6l 12 + arch_canon: armv7l: armv7l 12 ++arch_canon: armv7hl: armv7hl 12 ++arch_canon: armv7hnl: armv7hnl 12 + + arch_canon: m68kmint: m68kmint 13 + arch_canon: atarist: m68kmint 13 +@@ -248,6 +252,8 @@ + buildarchtranslate: armv5tejl: armv5tejl + buildarchtranslate: armv6l: armv6l + buildarchtranslate: armv7l: armv7l ++buildarchtranslate: armv7hl: armv7hl ++buildarchtranslate: armv7hnl: armv7hnl + + buildarchtranslate: atarist: m68kmint + buildarchtranslate: atariste: m68kmint +@@ -336,6 +342,8 @@ + arch_compat: armv4tl: armv4l + arch_compat: armv4l: armv3l + arch_compat: armv3l: noarch ++arch_compat: armv7hnl: armv7hl ++arch_compat: armv7hl: noarch + + arch_compat: atarist: m68kmint noarch + arch_compat: atariste: m68kmint noarch +@@ -441,6 +449,9 @@ + buildarch_compat: armv4l: armv3l + buildarch_compat: armv3l: noarch + ++buildarch_compat: armv7hnl: armv7hl ++buildarch_compat: armv7hl: noarch ++ + buildarch_compat: hppa2.0: hppa1.2 + buildarch_compat: hppa1.2: hppa1.1 + buildarch_compat: hppa1.1: hppa1.0 diff --git a/rpm.spec b/rpm.spec index 723d2a5..e2721cd 100644 --- a/rpm.spec +++ b/rpm.spec @@ -21,7 +21,7 @@ Summary: The RPM package management system Name: rpm Version: %{rpmver} -Release: %{?snapver:0.%{snapver}.}3%{?dist} +Release: %{?snapver:0.%{snapver}.}4%{?dist} Group: System Environment/Base Url: http://www.rpm.org/ Source0: http://rpm.org/releases/rpm-4.9.x/%{name}-%{srcver}.tar.bz2 @@ -38,6 +38,8 @@ Patch2: rpm-4.8.90-fedora-specspo.patch Patch3: rpm-4.8.0-no-man-dirs.patch # gnupg2 comes installed by default, avoid need to drag in gnupg too Patch4: rpm-4.8.1-use-gpg2.patch +#conditionally applied patch for arm hardware floating point +Patch5: rpm-4.9.0-armhfp.patch # Patches already in upstream @@ -220,6 +222,11 @@ packages on a system. %patch305 -p1 -b .gnome-help %patch306 -p1 -b .debugedit-stabs-warn +# this patch cant be applied on softfp builds +%ifnarch armv3l armv4b armv4l armv4tl armv5tel armv5tejl armv6l armv7l +%patch5 -p1 -b .armhfp +%endif + %if %{with int_bdb} ln -s db-%{bdbver} db %endif @@ -432,6 +439,9 @@ exit 0 %doc COPYING doc/librpm/html/* %changelog +* Wed Nov 09 2011 Dennis Gilmore - 4.9.1.2-4 +- conditionally apply arm patch for hardfp on all arches but arm softfp ones + * Fri Oct 28 2011 Panu Matilainen - 4.9.1.2-3 - adjust db util prefix & dependency due to #749293 - warn but dont fail the build if STABS encountered by debugedit (#725378)