about summary refs log tree commit diff
path: root/pkgs/applications/science
diff options
context:
space:
mode:
authorMauricio Collares <mauricio@collares.org>2021-04-21 13:34:32 -0300
committerMasanori Ogino <167209+omasanori@users.noreply.github.com>2021-04-22 09:01:07 +0900
commitaebef1703fafa705282df3ece34121f18b9a1b1f (patch)
treeafa997e921d6378f8e213466f72d4b72c271cc07 /pkgs/applications/science
parentceaf48fdb215b131a4c9deeafcdaaa1370238ea2 (diff)
singular: import aarch64 support patch
Diffstat (limited to 'pkgs/applications/science')
-rw-r--r--pkgs/applications/science/math/singular/default.nix9
-rw-r--r--pkgs/applications/science/math/singular/redhat-aarch64.patch38
2 files changed, 44 insertions, 3 deletions
diff --git a/pkgs/applications/science/math/singular/default.nix b/pkgs/applications/science/math/singular/default.nix
index add89c95a0c18..172004b9e094f 100644
--- a/pkgs/applications/science/math/singular/default.nix
+++ b/pkgs/applications/science/math/singular/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchFromGitHub, gmp, bison, perl, ncurses, readline, coreutils, pkg-config
 , lib
 , fetchpatch
-, autoreconfHook269
+, autoreconfHook
 , sharutils
 , file
 , flint
@@ -48,7 +48,10 @@ stdenv.mkDerivation rec {
     fetchSubmodules = true;
   };
 
-  patches = lib.optionals enableDocs [
+  patches = [
+    # add aarch64 support to cpu-check.m4. copied from redhat.
+    ./redhat-aarch64.patch
+  ] ++ lib.optionals enableDocs [
     # singular supports building without 4ti2, bertini, normaliz or
     # topcom just fine, but the docbuilding does not skip manual pages
     # tagged as depending on those binaries (probably a bug in
@@ -96,7 +99,7 @@ stdenv.mkDerivation rec {
     bison
     perl
     pkg-config
-    autoreconfHook269
+    autoreconfHook
     sharutils # needed for regress.cmd install checks
   ] ++ lib.optionals enableDocs [
     doxygen
diff --git a/pkgs/applications/science/math/singular/redhat-aarch64.patch b/pkgs/applications/science/math/singular/redhat-aarch64.patch
new file mode 100644
index 0000000000000..e0db6e87f994a
--- /dev/null
+++ b/pkgs/applications/science/math/singular/redhat-aarch64.patch
@@ -0,0 +1,38 @@
+diff --git a/m4/cpu-check.m4 b/m4/cpu-check.m4
+index 3cf0a7f08..12bb926ac 100644
+--- a/m4/cpu-check.m4
++++ b/m4/cpu-check.m4
+@@ -37,6 +37,18 @@ if test "$ac_cv_singcpuname" = ppc; then
+   AC_DEFINE(SI_CPU_PPC,1,"PPC")
+   AC_SUBST(SI_CPU_PPC)
+ fi
++if test "$ac_cv_singcpuname" = arm -o "$ac_cv_singcpuname" = armel; then
++  AC_DEFINE(SI_CPU_ARM,1,"ARM")
++  AC_SUBST(SI_CPU_ARM)
++fi
++if test "$ac_cv_singcpuname" = aarch64; then
++  AC_DEFINE(SI_CPU_AARCH64,1,"AARCH64")
++  AC_SUBST(SI_CPU_AARCH64)
++fi
++if test "$ac_cv_singcpuname" = s390; then
++  AC_DEFINE(SI_CPU_S390,1,"S390")
++  AC_SUBST(SI_CPU_S390)
++fi
+ 
+ # UNAME and PATH
+ AC_MSG_CHECKING(uname for Singular)
+@@ -65,6 +77,14 @@ dnl testet on: ppc_Linux, 740/750 PowerMac G3, 512k L2 cache
+   [powerpc*|ppc*], [AC_DEFINE(HAVE_GENERIC_MULT,1,multiplication is fast on the cpu: a*b is with mod otherwise using tables of logartihms)],
+ dnl the following settings seems to be better on arm processors
+   [arm*], [],
++dnl FIXME: need to run some tests
++  [aarch64*], [
++            AC_DEFINE(HAVE_MULT_MOD,1,multiplication is fast on the cpu: a*b is with mod otherwise using tables of logartihms)
++            AC_DEFINE(HAVE_GENERIC_ADD,1,use branch for addition in Z/p otherwise it uses a generic add)
++            AC_DEFINE(HAVE_DIV_MOD,1,division using extend euclidian algorithm otherwise using tables of logartihms)
++            ],
++dnl FIXME: need to run some tests
++  [s390*], [AC_DEFINE(HAVE_GENERIC_ADD,1,use branch for addition in Z/p otherwise it uses a generic add)],
+   []
+ )
+