aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/lcalc
diff options
context:
space:
mode:
authorMx Kookie <kookie@spacekookie.de>2020-10-31 19:35:09 +0100
committerMx Kookie <kookie@spacekookie.de>2020-10-31 19:35:09 +0100
commitc4625b175f8200f643fd6e11010932ea44c78433 (patch)
treebce3f89888c8ac3991fa5569a878a9eab6801ccc /infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/lcalc
parent49f735974dd103039ddc4cb576bb76555164a9e7 (diff)
parentd661aa56a8843e991261510c1bb28fdc2f6975ae (diff)
Add 'infra/libkookie/' from commit 'd661aa56a8843e991261510c1bb28fdc2f6975ae'
git-subtree-dir: infra/libkookie git-subtree-mainline: 49f735974dd103039ddc4cb576bb76555164a9e7 git-subtree-split: d661aa56a8843e991261510c1bb28fdc2f6975ae
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/lcalc')
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/lcalc/default.nix97
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/lcalc/makefile.patch113
2 files changed, 210 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/lcalc/default.nix b/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/lcalc/default.nix
new file mode 100644
index 000000000000..3f00547efcec
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/lcalc/default.nix
@@ -0,0 +1,97 @@
+{ stdenv
+, fetchurl
+, fetchpatch
+, pari
+}:
+
+stdenv.mkDerivation rec {
+ version = "1.23";
+ pname = "lcalc";
+
+ src = fetchurl {
+ # original at http://oto.math.uwaterloo.ca/~mrubinst/L_function_public/CODE/L-${version}.tar.gz, no longer available
+ # "newer" version at google code https://code.google.com/archive/p/l-calc/source/default/source
+ url = "mirror://sageupstream/lcalc/lcalc-${version}.tar.bz2";
+ sha256 = "1c6dsdshgxhqppjxvxhp8yhpxaqvnz3d1mlh26r571gkq8z2bm43";
+ };
+
+ preConfigure = "cd src";
+
+ buildInputs = [
+ pari
+ ];
+
+ patches = [
+ # Port to newer pari
+ (fetchpatch {
+ url = "https://git.sagemath.org/sage.git/plain/build/pkgs/lcalc/patches/pari-2.7.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
+ sha256 = "1x3aslldm8njjm7p9g9s9w2c91kphnci2vpkxkrcxfihw3ayss6c";
+ })
+
+ # Uncomment the definition of lcalc_to_double(const long double& x).
+ # (Necessary for GCC >= 4.6.0, cf. https://trac.sagemath.org/ticket/10892)
+ (fetchpatch {
+ url = "https://git.sagemath.org/sage.git/plain/build/pkgs/lcalc/patches/Lcommon.h.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
+ sha256 = "0g4ybvsrcv48rmlh1xjnkms19jp25k58azv6ds1f2cm34hxs8fdx";
+ })
+
+ # Include also <time.h> in Lcommandline_numbertheory.h (at least required
+ # on Cygwin, cf. https://trac.sagemath.org/ticket/9845)
+ (fetchpatch {
+ url = "https://git.sagemath.org/sage.git/plain/build/pkgs/lcalc/patches/time.h.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
+ sha256 = "1brf04n11kkc43ylagf8dm32j5r2g9zv51dp5wag1mpm4p04l7cl";
+ })
+
+ # Fix for gcc >4.6
+ (fetchpatch {
+ url = "https://git.sagemath.org/sage.git/plain/build/pkgs/lcalc/patches/lcalc-1.23_default_parameters_1.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
+ sha256 = "0i2yvxm5fx4z0v6m4srgh8rj98kijmlvyirlxf1ky0bp2si6bpka";
+ })
+
+ # gcc 5.1
+ (fetchpatch {
+ url = "https://git.sagemath.org/sage.git/plain/build/pkgs/lcalc/patches/lcalc-1.23_default_parameters_2.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
+ sha256 = "0dqwmxpm9wb53qbypsyfkgsvk2f8nf67sydphd4dkc2vw4yz6vlh";
+ })
+
+ # based on gentoos makefile patch -- fix paths, adhere to flags
+ ./makefile.patch
+
+ # (fetchpatch {
+ # name = "default-double.patch";
+ # url = "https://github.com/dimpase/lcalc/pull/1/commits/0500c67b6aa1f492715591669f6647c8f7a3ea59.patch";
+ # sha256 = "0dqwmxpm9wb53qbypsyfkgsvk2f8nf67sydphd4dkc2vw4yz6vla";
+ # })
+
+ (fetchpatch {
+ name = "c++11.patch";
+ url = "https://git.archlinux.org/svntogit/community.git/plain/trunk/lcalc-c++11.patch?h=packages/lcalc&id=3607b97df5a8c231191115b0cb5c62426b339e71";
+ sha256 = "1ccrl61lv2vvx8ggldq54m5d0n1iy6mym7qz0i8nj6yj0dshnpk3";
+ })
+ ] ++ stdenv.lib.optional stdenv.isDarwin
+ (fetchpatch {
+ url = "https://git.sagemath.org/sage.git/plain/build/pkgs/lcalc/patches/clang.patch";
+ sha256 = "0bb7656z6cp6i4p2qj745cmq0lhh52v2akl9whi760dynfdxbl18";
+ });
+
+ postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+ substituteInPlace src/Makefile --replace g++ c++
+ '';
+
+ installFlags = [
+ "DESTDIR=$(out)"
+ ];
+
+ makeFlags = [
+ "PARI_DEFINE=-DINCLUDE_PARI"
+ "PARI_PREFIX=${pari}"
+ ];
+
+ meta = with stdenv.lib; {
+ homepage = "http://oto.math.uwaterloo.ca/~mrubinst/L_function_public/L.html";
+ description = "A program for calculating with L-functions";
+ license = with licenses; [ gpl2 ];
+ maintainers = with maintainers; [ timokau ];
+ platforms = platforms.all;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/lcalc/makefile.patch b/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/lcalc/makefile.patch
new file mode 100644
index 000000000000..5c22cf0b84e8
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/lcalc/makefile.patch
@@ -0,0 +1,113 @@
+diff --git a/src/Makefile b/src/Makefile
+index 84e4e88..56ca676 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -58,7 +58,7 @@ ifeq ($(G5),TRUE)
+ #MACHINE_SPECIFIC_FLAGS = -mpowerpc -mpowerpc64 -m64
+ endif
+
+-CCFLAGS = -Wa,-W -O3 $(OPENMP_FLAG) -Wno-deprecated $(PREPROCESSOR_DEFINE) $(MACHINE_SPECIFIC_FLAGS) $(EXTRA)
++CCFLAGS = $(CXXFLAGS) $(OPENMP_FLAG) $(PREPROCESSOR_DEFINE) $(MACHINE_SPECIFIC_FLAGS)
+ #CCFLAGS = -Wa,-W -O3 $(OPENMP_FLAG) $(PREPROCESSOR_DEFINE) $(MACHINE_SPECIFIC_FLAGS) $(EXTRA)
+ #CCFLAGS = -Wa,-W -O2 -fno-exceptions -Wno-deprecated $(PREPROCESSOR_DEFINE) $(MACHINE_SPECIFIC_FLAGS) $(EXTRA)
+
+@@ -68,12 +68,12 @@ CCFLAGS = -Wa,-W -O3 $(OPENMP_FLAG) -Wno-deprecated $(PREPROCESSOR_DEFINE) $(MA
+
+ ifeq ($(PARI_DEFINE),-DINCLUDE_PARI)
+ #location of pari.h.
+- LOCATION_PARI_H = /usr/local/include/pari #usual location
++ LOCATION_PARI_H = $(PARI_PREFIX)/include/pari #usual location
+
+ #location of libpari.a or of libpari.so
+ #depending on whether static or dynamic libraries are being used.
+ #On mac os x it's the former, on linux I think usually the latter.
+- LOCATION_PARI_LIBRARY = /usr/local/lib #usual location
++ LOCATION_PARI_LIBRARY = $(PARI_PREFIX)/lib #usual location
+ else
+ #supplied as a dummy so as to avoid more ifeq's below
+ LOCATION_PARI_H = .
+@@ -89,24 +89,24 @@ INCLUDEFILES= -I../include
+
+ ifeq ($(OS_NAME),Darwin)
+ LDFLAGS2 =
+- DYN_OPTION=dynamiclib
++ DYN_OPTION=-dynamiclib
+ else
+- LDFLAGS1 = -Xlinker -export-dynamic #not sure why pari calls these when linking but on the web I found
++ LDFLAGS1 = #not sure why pari calls these when linking but on the web I found
+ #'Libtool provides the `-export-dynamic' link flag (see section Link mode), which does this declaration.
+ #You need to use this flag if you are linking a shared library that will be dlopened'
+ #see notes below
+ #ifeq ($(PARI_DEFINE),-DINCLUDE_PARI)
+- LDFLAGS2 = $(LDFLAGS1) -Xlinker -rpath -Xlinker $(LOCATION_PARI_LIBRARY)
++ LDFLAGS2 = $(LDFLAGS)
+ #else
+ # LDFLAGS2 = $(LDFLAGS1)
+ #endif
+- DYN_OPTION=shared
++ DYN_OPTION=$(LDFLAGS) -shared -Wl,-soname,libLfunction.so
+ endif
+
+ ifeq ($(PARI_DEFINE),-DINCLUDE_PARI)
+- LDFLAGS = $(LDFLAGS2) -L$(LOCATION_PARI_LIBRARY) -lpari
++ MYLDFLAGS = $(LDFLAGS2) -L$(LOCATION_PARI_LIBRARY) -lpari
+ else
+- LDFLAGS = $(LDFLAGS2)
++ MYLDFLAGS = $(LDFLAGS2)
+ endif
+
+
+@@ -129,7 +129,8 @@ endif
+ #become clear which libraries the computer can find.
+
+
+-INSTALL_DIR= /usr/local
++INSTALL_DIR= $(DESTDIR)
++LIB_DIR ?=lib
+
+ #object files for the libLfunction library
+ OBJ_L = Lglobals.o Lgamma.o Lriemannsiegel.o Lriemannsiegel_blfi.o Ldokchitser.o
+@@ -141,9 +142,8 @@ OBJECTS = $(OBJ3)
+
+ all:
+ # make print_vars
+- make libLfunction.so
+- make lcalc
+- make examples
++ ${MAKE} libLfunction.so
++ ${MAKE} lcalc
+ # make find_L
+ # make test
+
+@@ -151,7 +151,7 @@ print_vars:
+ @echo OS_NAME = $(OS_NAME)
+
+ lcalc: $(OBJECTS)
+- $(CC) $(CCFLAGS) $(INCLUDEFILES) $(OBJECTS) $(LDFLAGS) -o lcalc $(GMP_FLAGS)
++ $(CC) $(CCFLAGS) $(INCLUDEFILES) $(OBJECTS) $(MYLDFLAGS) -o lcalc $(GMP_FLAGS)
+
+ examples:
+ $(CC) $(CCFLAGS) $(INCLUDEFILES) example_programs/example.cc libLfunction.so -o example_programs/example $(GMP_FLAGS)
+@@ -262,15 +262,18 @@ Lcommandline.o: ../include/Lcommandline_values_zeros.h
+
+
+ libLfunction.so: $(OBJ_L)
+- g++ -$(DYN_OPTION) -o libLfunction.so $(OBJ_L)
++ g++ $(DYN_OPTION) -o libLfunction.so $(OBJ_L)
+
+ clean:
+ rm -f *.o lcalc libLfunction.so example_programs/example
+
+ install:
+- cp -f lcalc $(INSTALL_DIR)/bin/.
+- cp -f libLfunction.so $(INSTALL_DIR)/lib/.
+- cp -rf ../include $(INSTALL_DIR)/include/Lfunction
++ install -d $(INSTALL_DIR)/bin
++ install -d $(INSTALL_DIR)/$(LIB_DIR)
++ install -d $(INSTALL_DIR)/include/Lfunction
++ install lcalc $(INSTALL_DIR)/bin
++ install libLfunction.so $(INSTALL_DIR)/$(LIB_DIR)
++ install -m 644 -t $(INSTALL_DIR)/include/Lfunction ../include/*.h
+
+
+ SRCS = Lcommandline.cc Lcommandline_elliptic.cc Lcommandline_globals.cc Lcommandline_misc.cc Lcommandline_numbertheory.cc Lcommandline_twist.cc Lcommandline_values_zeros.cc Lgamma.cc Lglobals.cc Lmisc.cc Lriemannsiegel.cc Lriemannsiegel_blfi.cc cmdline.c