From 8d67c151a64487c72cd31bdee0dc9ed037700b17 Mon Sep 17 00:00:00 2001 From: Gabriel Ebner Date: Wed, 14 Aug 2019 18:18:09 +0200 Subject: [PATCH 1/4] all-packages: fix trailing space --- pkgs/top-level/all-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c560fa67271b..2345cd9af37a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -23930,7 +23930,7 @@ in in nixosTesting.makeTest calledTest; - nixosOptionsDoc = attrs: + nixosOptionsDoc = attrs: (import ../../nixos/lib/make-options-doc/default.nix) ({ inherit pkgs lib; } // attrs); From a736d87393a93b0c29a943f92ce6ed4eb6f2ff73 Mon Sep 17 00:00:00 2001 From: Gabriel Ebner Date: Wed, 14 Aug 2019 18:18:24 +0200 Subject: [PATCH 2/4] spooles: init at 2.2 --- .../science/math/spooles/default.nix | 48 +++++ .../science/math/spooles/spooles.patch | 188 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 238 insertions(+) create mode 100644 pkgs/development/libraries/science/math/spooles/default.nix create mode 100644 pkgs/development/libraries/science/math/spooles/spooles.patch diff --git a/pkgs/development/libraries/science/math/spooles/default.nix b/pkgs/development/libraries/science/math/spooles/default.nix new file mode 100644 index 000000000000..953f5a70b8aa --- /dev/null +++ b/pkgs/development/libraries/science/math/spooles/default.nix @@ -0,0 +1,48 @@ +{ stdenv, fetchurl, gfortran, perl }: + +stdenv.mkDerivation rec { + pname = "spooles"; + version = "2.2"; + + src = fetchurl { + url = "http://www.netlib.org/linalg/spooles/spooles.${version}.tgz"; + sha256 = "1pf5z3vvwd8smbpibyabprdvcmax0grzvx2y0liy98c7x6h5jid8"; + }; + + sourceRoot = "."; + + patches = [ + ./spooles.patch + ]; + + buildPhase = '' + make lib + ''; + + installPhase = '' + mkdir -p $out/lib $out/include/spooles + cp libspooles.a libspooles.so.2.2 $out/lib/ + ln -s libspooles.so.2.2 $out/lib/libspooles.so.2 + ln -s libspooles.so.2 $out/lib/libspooles.so + for h in *.h; do + if [ $h != 'MPI.h' ]; then + cp $h $out/include/spooles + d=`basename $h .h` + if [ -d $d ]; then + mkdir $out/include/spooles/$d + cp $d/*.h $out/include/spooles/$d + fi + fi + done + ''; + + nativeBuildInputs = [ perl ]; + + meta = with stdenv.lib; { + homepage = "http://www.netlib.org/linalg/spooles/"; + description = "Library for solving sparse real and complex linear systems of equations"; + license = licenses.publicDomain; + maintainers = with maintainers; [ gebner ]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/development/libraries/science/math/spooles/spooles.patch b/pkgs/development/libraries/science/math/spooles/spooles.patch new file mode 100644 index 000000000000..c0c93c9365c9 --- /dev/null +++ b/pkgs/development/libraries/science/math/spooles/spooles.patch @@ -0,0 +1,188 @@ +diff --git a/I2Ohash/src/util.c b/I2Ohash/src/util.c +index 72d082e..f32f667 100644 +--- a/I2Ohash/src/util.c ++++ b/I2Ohash/src/util.c +@@ -39,9 +39,10 @@ fflush(stdout) ; + */ + loc1 = (key1 + 1) % hashtable->nlist ; + loc2 = (key2 + 1) % hashtable->nlist ; +-loc = (loc1*loc2) % hashtable->nlist ; ++long int loc3 = (long int)loc1*(long int)loc2 % hashtable->nlist ; ++loc =(int) loc3; + #if MYDEBUG > 0 +-fprintf(stdout, "\n loc1 = %d, loc2 = %d, loc3 = %d", loc1, loc2, loc) ; ++fprintf(stdout, "\n loc1 = %d, loc2 = %d, loc3 = %ld, loc = %d", loc1, loc2, loc3, loc) ; + fflush(stdout) ; + #endif + /* +@@ -158,9 +159,10 @@ fflush(stdout) ; + #endif + loc1 = (key1 + 1) % hashtable->nlist ; + loc2 = (key2 + 1) % hashtable->nlist ; +-loc = (loc1*loc2) % hashtable->nlist ; ++long int loc3 = (long int)loc1*(long int)loc2 % hashtable->nlist ; ++loc =(int) loc3; + #if MYDEBUG > 0 +-fprintf(stdout, "\n loc1 = %d, loc2 = %d, loc3 = %d", loc1, loc2, loc) ; ++fprintf(stdout, "\n loc1 = %d, loc2 = %d, loc3 = %ld, loc = %d", loc1, loc2, loc3, loc) ; + fflush(stdout) ; + #endif + /* +diff --git a/MPI/makefile b/MPI/makefile +index 0c09f86..d25e70a 100644 +--- a/MPI/makefile ++++ b/MPI/makefile +@@ -2,7 +2,7 @@ all_drivers : + cd drivers ; make drivers + + lib : +- cd src ; make spoolesMPI.a ++ cd src ; make makeLib + + clean : + cd src ; make clean +diff --git a/MPI/src/makefile b/MPI/src/makefile +index f7650b7..71e4c49 100644 +--- a/MPI/src/makefile ++++ b/MPI/src/makefile +@@ -42,3 +42,8 @@ $(OBJ).a : \ + + clean : + - rm -f *.a *.o ++ ++makeLib : ++ perl ../../makeLib > makeG ++ make -f makeG ++ rm -f makeG +diff --git a/MT/makefile b/MT/makefile +index 9b86a32..d25e70a 100644 +--- a/MT/makefile ++++ b/MT/makefile +@@ -2,7 +2,7 @@ all_drivers : + cd drivers ; make drivers + + lib : +- cd src ; make spoolesMT.a ++ cd src ; make makeLib + + clean : + cd src ; make clean +diff --git a/Make.inc b/Make.inc +index f99eb8f..2de8a25 100644 +--- a/Make.inc ++++ b/Make.inc +@@ -12,7 +12,7 @@ + # for solaris + # + # CC = gcc +- CC = /usr/lang-4.0/bin/cc ++# CC = /usr/lang-4.0/bin/cc + # + # for sgi + # +@@ -28,7 +28,7 @@ + # + # OPTLEVEL = + # OPTLEVEL = -g -v +- OPTLEVEL = -O ++ OPTLEVEL = -O3 + # OPTLEVEL = -xO5 -v + # OPTLEVEL = -O3 + # OPTLEVEL = -O4 +@@ -43,7 +43,7 @@ + # set any load flags + # + # LDFLAGS = -Wl,+parallel -Wl,+tm,spp2000 # for hp exemplar +- LDFLAGS = ++# LDFLAGS = + # + #--------------------------------------------------------------------- + # +@@ -103,7 +103,7 @@ + # MPI install library + # + # MPI_INSTALL_DIR = +- MPI_INSTALL_DIR = /usr/local/mpich-1.0.13 ++# MPI_INSTALL_DIR = /usr/lib/openmpi + # + #--------------------------------------------------------------------- + # +@@ -142,6 +142,6 @@ + # MPI include path + # + # MPI_INCLUDE_DIR = +- MPI_INCLUDE_DIR = -I$(MPI_INSTALL_DIR)/include ++# MPI_INCLUDE_DIR = -I/usr/include/mpi + # + #--------------------------------------------------------------------- +diff --git a/Utilities/src/iohb.c b/Utilities/src/iohb.c +index ac38f7b..ac34034 100644 +--- a/Utilities/src/iohb.c ++++ b/Utilities/src/iohb.c +@@ -1725,7 +1725,7 @@ static void upcase(char* S) + + static void IOHBTerminate(char* message) + { +- fprintf(stderr,message); ++ fputs(message, stderr); + exit(1); + } + +diff --git a/makeLib b/makeLib +index 1780f39..7697b06 100755 +--- a/makeLib ++++ b/makeLib +@@ -64,14 +64,19 @@ foreach $src ( @srcnames ) { + $srcname = " \\\n " . $src ; + print $srcname ; + } ++print "\n\n.SUFFIXES: .c .o .lo .a .so" ; + print "\n\nOBJ_FILES = \$\{SRC:.c=.o\}" ; ++print "\n\nLOBJ_FILES = \$\{SRC:.c=.lo\}" ; + print "\n\n" ; + print <<'EOF' ; + .c.o : +- $(PURIFY) $(CC) -c $(CFLAGS) $*.c -o $(OBJ)_$*.o ++ $(PURIFY) $(CC) -c $(CFLAGS) $*.c -o $(OBJ)_$*.o $(MPI_INCLUDE_DIR) + +-../../spooles.a : ${OBJ_FILES} +- $(AR) $(ARFLAGS) ../../spooles.a $(OBJ)_*.o ++.c.lo : ++ $(PURIFY) $(CC) -c $(CFLAGS) $*.c -fPIC -DPIC -o $(OBJ)_$*.lo $(MPI_INCLUDE_DIR) ++ ++../../libspooles.a : ${OBJ_FILES} ${LOBJ_FILES} ++ $(AR) $(ARFLAGS) ../../libspooles.a $(OBJ)_*.o + rm -f $(OBJ)_*.o +- $(RANLIB) ../../spooles.a ++ $(RANLIB) ../../libspooles.a + EOF +diff --git a/makefile b/makefile +index f014c7d..7c8042a 100755 +--- a/makefile ++++ b/makefile +@@ -124,7 +124,9 @@ lib : + cd ZV ; make lib + cd misc ; make lib + #cd MPI ; make lib +-#cd MT ; make lib ++ cd MT ; make lib ++ gcc -shared */*/*.lo -Wl,-soname,libspooles.so.2.2 -o libspooles.so.2.2 -lpthread -lm ++ ln -s libspooles.so.2.2 libspooles.so + + global : + cd A2/src ; make -f makeGlobalLib +diff --git a/timings.h b/timings.h +index 23df189..685800b 100644 +--- a/timings.h ++++ b/timings.h +@@ -2,9 +2,8 @@ + #define _TIMINGS_ + #include + static struct timeval TV ; +-static struct timezone TZ ; + #define MARKTIME(t) \ +- gettimeofday(&TV, &TZ) ; \ ++ gettimeofday(&TV, NULL) ; \ + t = (TV.tv_sec + 0.000001*TV.tv_usec) + #endif + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2345cd9af37a..c9000c8f9cba 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9919,6 +9919,8 @@ in spoofer-gui = callPackage ../tools/networking/spoofer { withGUI = true; }; + spooles = callPackage ../development/libraries/science/math/spooles {}; + sqlcheck = callPackage ../development/tools/database/sqlcheck { }; sqlitebrowser = libsForQt5.callPackage ../development/tools/database/sqlitebrowser { }; From f91904a889cc967043dc4ec778aad288ae7934f9 Mon Sep 17 00:00:00 2001 From: Gabriel Ebner Date: Wed, 14 Aug 2019 18:18:38 +0200 Subject: [PATCH 3/4] calculix: init at 2.15 --- .../science/math/calculix/calculix.patch | 31 +++++++++++++++ .../science/math/calculix/default.nix | 39 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 72 insertions(+) create mode 100644 pkgs/applications/science/math/calculix/calculix.patch create mode 100644 pkgs/applications/science/math/calculix/default.nix diff --git a/pkgs/applications/science/math/calculix/calculix.patch b/pkgs/applications/science/math/calculix/calculix.patch new file mode 100644 index 000000000000..311421f2ef54 --- /dev/null +++ b/pkgs/applications/science/math/calculix/calculix.patch @@ -0,0 +1,31 @@ +diff --git a/ccx_2.15/src/Makefile b/ccx_2.15/src/Makefile +index 9cab2fc..6e977b8 100755 +--- a/ccx_2.15/src/Makefile ++++ b/ccx_2.15/src/Makefile +@@ -1,6 +1,6 @@ + + CFLAGS = -Wall -O3 -I ../../../SPOOLES.2.2 -DARCH="Linux" -DSPOOLES -DARPACK -DMATRIXSTORAGE -DNETWORKOUT +-FFLAGS = -Wall -O3 ++FFLAGS = -Wall -O3 + + CC=cc + FC=gfortran +@@ -18,15 +18,10 @@ OCCXF = $(SCCXF:.f=.o) + OCCXC = $(SCCXC:.c=.o) + OCCXMAIN = $(SCCXMAIN:.c=.o) + +-DIR=../../../SPOOLES.2.2 ++LIBS = -lpthread -lm -lc -lspooles -larpack -lopenblas + +-LIBS = \ +- $(DIR)/spooles.a \ +- ../../../ARPACK/libarpack_INTEL.a \ +- -lpthread -lm -lc +- +-ccx_2.15: $(OCCXMAIN) ccx_2.15.a $(LIBS) +- ./date.pl; $(CC) $(CFLAGS) -c ccx_2.15.c; $(FC) -Wall -O3 -o $@ $(OCCXMAIN) ccx_2.15.a $(LIBS) ++ccx_2.15: $(OCCXMAIN) ccx_2.15.a ++ $(CC) $(CFLAGS) -c ccx_2.15.c; $(FC) -Wall -O3 -o $@ $(OCCXMAIN) ccx_2.15.a $(LIBS) + + ccx_2.15.a: $(OCCXF) $(OCCXC) + ar vr $@ $? diff --git a/pkgs/applications/science/math/calculix/default.nix b/pkgs/applications/science/math/calculix/default.nix new file mode 100644 index 000000000000..24d5f99ec32a --- /dev/null +++ b/pkgs/applications/science/math/calculix/default.nix @@ -0,0 +1,39 @@ +{ stdenv, fetchurl, gfortran, arpack, spooles, openblas }: + +stdenv.mkDerivation rec { + pname = "calculix"; + version = "2.15"; + + src = fetchurl { + url = "http://www.dhondt.de/ccx_${version}.src.tar.bz2"; + sha256 = "0d4axfxgm3ag4p2vx9rjcky7c122k99a2nhv1jv53brm35rblzdw"; + }; + + nativeBuildInputs = [ gfortran ]; + + buildInputs = [ arpack spooles openblas ]; + + NIX_CFLAGS_COMPILE = [ + "-I${spooles}/include/spooles" + ]; + + patches = [ + ./calculix.patch + ]; + + postPatch = '' + cd ccx*/src + ''; + + installPhase = '' + install -Dm0755 ccx_${version} $out/bin/ccx + ''; + + meta = with stdenv.lib; { + homepage = "http://www.calculix.de/"; + description = "Three-dimensional structural finite element program"; + license = licenses.gpl2Plus; + maintainers = with maintainers; [ gebner ]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c9000c8f9cba..eb8bc65b3400 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17390,6 +17390,8 @@ in calcurse = callPackage ../applications/misc/calcurse { }; + calculix = callPackage ../applications/science/math/calculix {}; + calibre = libsForQt5.callPackage ../applications/misc/calibre { }; calligra = libsForQt5.callPackage ../applications/office/calligra { From 0a1e1310776a437a61e1ffcf820766ccf702821f Mon Sep 17 00:00:00 2001 From: Gabriel Ebner Date: Wed, 14 Aug 2019 18:42:40 +0200 Subject: [PATCH 4/4] gmsh: opencascade support --- pkgs/applications/science/math/gmsh/default.nix | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/science/math/gmsh/default.nix b/pkgs/applications/science/math/gmsh/default.nix index fbdbac003dcd..1d96c0039ad1 100644 --- a/pkgs/applications/science/math/gmsh/default.nix +++ b/pkgs/applications/science/math/gmsh/default.nix @@ -1,10 +1,9 @@ { stdenv, fetchurl, cmake, openblasCompat, gfortran, gmm, fltk, libjpeg -, zlib, libGLU_combined, libGLU, xorg }: +, zlib, libGLU_combined, libGLU, xorg, opencascade-occt }: -let version = "4.4.1"; in - -stdenv.mkDerivation { - name = "gmsh-${version}"; +stdenv.mkDerivation rec { + pname = "gmsh"; + version = "4.4.1"; src = fetchurl { url = "http://gmsh.info/src/gmsh-${version}-source.tgz"; @@ -14,15 +13,14 @@ stdenv.mkDerivation { buildInputs = [ openblasCompat gmm fltk libjpeg zlib libGLU_combined libGLU xorg.libXrender xorg.libXcursor xorg.libXfixes xorg.libXext xorg.libXft xorg.libXinerama xorg.libX11 xorg.libSM xorg.libICE + opencascade-occt ]; nativeBuildInputs = [ cmake gfortran ]; - enableParallelBuilding = true; - meta = { description = "A three-dimensional finite element mesh generator"; - homepage = http://gmsh.info/; + homepage = "http://gmsh.info/"; platforms = [ "x86_64-linux" ]; license = stdenv.lib.licenses.gpl2Plus; };