summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/liggghts/cpp-17.patch75
-rw-r--r--var/spack/repos/builtin/packages/liggghts/makefile-llvm-based-compiler.patch21
-rw-r--r--var/spack/repos/builtin/packages/liggghts/makefile.patch240
-rw-r--r--var/spack/repos/builtin/packages/liggghts/package.py20
4 files changed, 350 insertions, 6 deletions
diff --git a/var/spack/repos/builtin/packages/liggghts/cpp-17.patch b/var/spack/repos/builtin/packages/liggghts/cpp-17.patch
new file mode 100644
index 0000000000..73c4bffdd0
--- /dev/null
+++ b/var/spack/repos/builtin/packages/liggghts/cpp-17.patch
@@ -0,0 +1,75 @@
+diff --git a/src/math_vector.h b/src/math_vector.h
+index 2b8704af..79c0cedd 100644
+--- a/src/math_vector.h
++++ b/src/math_vector.h
+@@ -94,7 +94,7 @@ inline void vec_neg(vector &dest) { // -a
+ dest[2] = -dest[2]; }
+
+ inline void vec_norm(vector &dest) { // a/|a|
+- register double f = sqrt(vec_dot(dest, dest));
++ double f = sqrt(vec_dot(dest, dest));
+ dest[0] /= f;
+ dest[1] /= f;
+ dest[2] /= f; }
+@@ -222,7 +222,7 @@ inline void form_subtr(shape &dest, form &src) { // m_a-m_b
+ dest[3] -= src[3]; dest[4] -= src[4]; dest[5] -= src[5]; }
+
+ inline int form_inv(form &m_inv, form &m) { // m^-1
+- register double det = form_det(m);
++ double det = form_det(m);
+ if (fzero(det)) return 0;
+ m_inv[0] = (m[1]*m[2]-m[3]*m[3])/det;
+ m_inv[1] = (m[0]*m[2]-m[4]*m[4])/det;
+@@ -377,7 +377,7 @@ inline void form4_unit(form4 &dest) {
+ dest[0] = dest[1] = dest[2] = dest[3] = 1.0; }
+
+ inline double form4_det(form4 &m) {
+- register double f = m[6]*m[7]-m[5]*m[8];
++ double f = m[6]*m[7]-m[5]*m[8];
+ return m[0]*(
+ m[1]*(m[2]*m[3]-m[4]*m[4])+
+ m[5]*(2.0*m[4]*m[7]-m[2]*m[5])-m[3]*m[7]*m[7])+f*f+
+@@ -387,7 +387,7 @@ inline double form4_det(form4 &m) {
+ m[9]*(m[4]*m[4]-m[2]*m[3])); }
+
+ inline int form4_inv(form4 &m_inv, form4 &m) {
+- register double det = form4_det(m);
++ double det = form4_det(m);
+ if (fzero(det)) return 0;
+ m_inv[0] = (m[1]*(m[2]*m[3]-m[4]*m[4])+
+ m[5]*(2.0*m[4]*m[7]-m[2]*m[5])-m[3]*m[7]*m[7])/det;
+diff --git a/src/pair.cpp b/src/pair.cpp
+index c0889f72..8c212715 100644
+--- a/src/pair.cpp
++++ b/src/pair.cpp
+@@ -566,7 +566,7 @@ void Pair::init_tables_disp(double cut_lj_global)
+ }
+
+ rsq = rsq_lookup.f;
+- register double x2 = g2*rsq, a2 = 1.0/x2;
++ double x2 = g2*rsq, a2 = 1.0/x2;
+ x2 = a2*exp(-x2);
+
+ rdisptable[i] = rsq_lookup.f;
+@@ -612,7 +612,7 @@ void Pair::init_tables_disp(double cut_lj_global)
+ if (rsq_lookup.f < (cut_lj_globalsq = cut_lj_global * cut_lj_global)) {
+ rsq_lookup.f = cut_lj_globalsq;
+
+- register double x2 = g2*rsq, a2 = 1.0/x2;
++ double x2 = g2*rsq, a2 = 1.0/x2;
+ x2 = a2*exp(-x2);
+ f_tmp = g8*(((6.0*a2+6.0)*a2+3.0)*a2+1.0)*x2*rsq;
+ e_tmp = g6*((a2+1.0)*a2+0.5)*x2;
+diff --git a/src/utils.h b/src/utils.h
+index fab00e9b..5a122627 100644
+--- a/src/utils.h
++++ b/src/utils.h
+@@ -67,7 +67,7 @@ namespace Utils {
+
+ inline std::string int_to_string(int a)
+ {
+- return static_cast< std::ostringstream & >(( std::ostringstream() << std::dec << a ) ).str();
++ return static_cast< std::ostringstream & >(( std::ostringstream().flush() << std::dec << a ) ).str();
+ }
+
+ inline std::string double_to_string(double dbl)
diff --git a/var/spack/repos/builtin/packages/liggghts/makefile-llvm-based-compiler.patch b/var/spack/repos/builtin/packages/liggghts/makefile-llvm-based-compiler.patch
new file mode 100644
index 0000000000..a5c26300a3
--- /dev/null
+++ b/var/spack/repos/builtin/packages/liggghts/makefile-llvm-based-compiler.patch
@@ -0,0 +1,21 @@
+diff --git a/src/MAKE/Makefile.auto b/src/MAKE/Makefile.auto
+index 239f886..8f42e73 100644
+--- a/src/MAKE/Makefile.auto
++++ b/src/MAKE/Makefile.auto
+@@ -816,12 +816,14 @@ ifeq ($(USE_VTK), "ON")
+ endif
+ endif
+ endif
+- open_bracket := (
+- close_bracket := )
++ open_bracket := ("
++ close_bracket := ")
++ message := message
+ space :=
+ space +=
+ VTK_TMP := $(subst $(open_bracket),$(space),$(VTK_TMP))
+ VTK_TMP := $(subst $(close_bracket),$(space),$(VTK_TMP))
++ VTK_TMP := $(subst $(message),$(space),$(VTK_TMP))
+ VTK_MAJOR_VERSION := $(patsubst "%",%,$(word $(words $(VTK_TMP)),$(VTK_TMP)))
+ ifeq ($(AUTO_DEBUG),1)
+ $(shell $(ECHO) "#vtk_major_version: $(VTK_MAJOR_VERSION)" >> $(AUTO_LOG_FILE))
diff --git a/var/spack/repos/builtin/packages/liggghts/makefile.patch b/var/spack/repos/builtin/packages/liggghts/makefile.patch
new file mode 100644
index 0000000000..370e4b8dad
--- /dev/null
+++ b/var/spack/repos/builtin/packages/liggghts/makefile.patch
@@ -0,0 +1,240 @@
+diff --git a/src/MAKE/Makefile.auto b/src/MAKE/Makefile.auto
+index dde9e72..239f886 100644
+--- a/src/MAKE/Makefile.auto
++++ b/src/MAKE/Makefile.auto
+@@ -440,12 +440,12 @@ ifeq ($(USE_MPI), "ON")
+ TMP_INC = -I$(MPI_INC)
+ endif
+ # We assume that the compiler supports #pragma message
+- TMP := $(shell $(ECHO) '\#include <mpi.h> \n \#if defined(MPICH) \n \#pragma message "MPICH" \n \#elif defined(OPEN_MPI) \n \#pragma message "OpenMPI" \n \#else \n \#pragma message "Unknown" \n \#endif' > $(TMPFILE) && $(MPICXX) $(OPT_LVL) $(PROF_FLAG) $(TMP_INC) -xc++ -E $(TMPFILE) 2> /dev/null | grep pragma | grep -m 1 message || echo -1)
++ TMP := $(shell $(ECHO) '#include <mpi.h> \n #if defined(MPICH) \n #pragma message "MPICH" \n #elif defined(OPEN_MPI) \n #pragma message "OpenMPI" \n #else \n #pragma message "Unknown" \n #endif' > $(TMPFILE) && $(MPICXX) $(OPT_LVL) $(PROF_FLAG) $(TMP_INC) -xc++ -E $(TMPFILE) 2> /dev/null | grep pragma | grep -m 1 message || echo -1)
+ # See if compilation has worked out
+ ifeq ($(TMP), -1)
+ # Maybe it failed because of the optimization as -Og is not known
+ ifeq ($(USE_DEBUG), "ON")
+- TMP := $(shell $(ECHO) '\#include <mpi.h> \n \#if defined(MPICH) \n \#pragma message "MPICH" \n \#elif defined(OPEN_MPI) \n \#pragma message "OpenMPI" \n \#else \n \#pragma message "Unknown" \n \#endif' > $(TMPFILE) && $(MPICXX) -O0 -g $(PROF_FLAG) $(TMP_INC) -xc++ -E $(TMPFILE) 2> /dev/null | grep pragma | grep -m 1 message || echo -1)
++ TMP := $(shell $(ECHO) '#include <mpi.h> \n #if defined(MPICH) \n #pragma message "MPICH" \n #elif defined(OPEN_MPI) \n #pragma message "OpenMPI" \n #else \n #pragma message "Unknown" \n #endif' > $(TMPFILE) && $(MPICXX) -O0 -g $(PROF_FLAG) $(TMP_INC) -xc++ -E $(TMPFILE) 2> /dev/null | grep pragma | grep -m 1 message || echo -1)
+ ifeq ($(TMP), -1)
+ $(error 'Could not compile a simple MPI example (testing with -Og and -O0). Test was done with MPI_INC="$(TMP_INC)" and MPICXX="$(MPICXX)"')
+ else
+@@ -566,7 +566,7 @@ else
+ $(shell $(ECHO) "#Compiling with mpi stubs" >> $(AUTO_LOG_FILE))
+ $(shell $(ECHO) "#Command: $(CXX) $(EXTRA_INC) $(EXTRA_LIB) $(EXTRA_ADDLIBS) -xc++ $(LDFLAGS) $(CCFLAGS) -o /dev/null $(TMPFILE)")
+ endif
+- TMP := $(shell $(ECHO) '\#include <mpi.h> \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_INC) $(EXTRA_LIB) $(EXTRA_ADDLIBS) -xc++ $(LDFLAGS) $(CCFLAGS) -o /dev/null $(TMPFILE) 2>> $(AUTO_LOG_FILE) && echo 0 || echo -1)
++ TMP := $(shell $(ECHO) '#include <mpi.h> \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_INC) $(EXTRA_LIB) $(EXTRA_ADDLIBS) -xc++ $(LDFLAGS) $(CCFLAGS) -o /dev/null $(TMPFILE) 2>> $(AUTO_LOG_FILE) && echo 0 || echo -1)
+ ifeq ($(TMP), -1)
+ $(error 'Could not compile a simple c++ example. Please make sure that you have run "make stubs" before compiling LIGGGHTS itself. Test was done with CXX=$(CXX), EXTRA_INC=$(EXTRA_INC), EXTRA_LIB=$(EXTRA_LIB) and EXTRA_ADDLIBS=$(EXTRA_ADDLIBS).')
+ endif
+@@ -595,7 +595,7 @@ endif
+ HAVE_MATH_SPECIAL_FUNCS = 0
+ # For c++17 this is included without any further defines
+ ifeq ($(CXXVERSION),17)
+- TMP := $(shell $(ECHO) '\#include <cmath> \n int main(){ std::beta(1,1); }' > $(TMPFILE) && $(CXX) $(EXTRA_INC) $(EXTRA_LIB) $(EXTRA_ADDLIBS) -xc++ $(LDFLAGS) $(CCFLAGS) -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
++ TMP := $(shell $(ECHO) '#include <cmath> \n int main(){ std::beta(1,1); }' > $(TMPFILE) && $(CXX) $(EXTRA_INC) $(EXTRA_LIB) $(EXTRA_ADDLIBS) -xc++ $(LDFLAGS) $(CCFLAGS) -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
+ ifeq ($(TMP),0)
+ HAVE_MATH_SPECIAL_FUNCS = 1
+ endif
+@@ -604,14 +604,14 @@ ifeq ($(CXXVERSION),17)
+ else
+ # For c++11 we need to check if ISO 29124:2010 is supported
+ ifeq ($(CXXVERSION),11)
+- TMP := $(shell $(ECHO) '\#define __STDCPP_WANT_MATH_SPEC_FUNCS__ 1 \n \#include <cmath> \n \#if !defined(__STDCPP_MATH_SPEC_FUNCS__) || __STDCPP_MATH_SPEC_FUNCS__ < 201003L \n \#error "STOP" \n \#endif \n int main(){ std::beta(1,1); }' > $(TMPFILE) && $(CXX) $(EXTRA_INC) $(EXTRA_LIB) $(EXTRA_ADDLIBS) -xc++ $(LDFLAGS) $(CCFLAGS) -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
++ TMP := $(shell $(ECHO) '#define __STDCPP_WANT_MATH_SPEC_FUNCS__ 1 \n #include <cmath> \n #if !defined(__STDCPP_MATH_SPEC_FUNCS__) || __STDCPP_MATH_SPEC_FUNCS__ < 201003L \n #error "STOP" \n #endif \n int main(){ std::beta(1,1); }' > $(TMPFILE) && $(CXX) $(EXTRA_INC) $(EXTRA_LIB) $(EXTRA_ADDLIBS) -xc++ $(LDFLAGS) $(CCFLAGS) -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
+ ifeq ($(TMP),0)
+ HAVE_MATH_SPECIAL_FUNCS = 1
+ endif
+ endif
+ endif
+ ifeq ($(HAVE_MATH_SPECIAL_FUNCS),0)
+- TMP := $(shell $(ECHO) '\#include <tr1/cmath> \n int main(){ std::tr1::beta(1,1); }' > $(TMPFILE) && $(CXX) $(EXTRA_INC) $(EXTRA_LIB) $(EXTRA_ADDLIBS) -xc++ $(LDFLAGS) $(CCFLAGS) -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
++ TMP := $(shell $(ECHO) '#include <tr1/cmath> \n int main(){ std::tr1::beta(1,1); }' > $(TMPFILE) && $(CXX) $(EXTRA_INC) $(EXTRA_LIB) $(EXTRA_ADDLIBS) -xc++ $(LDFLAGS) $(CCFLAGS) -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
+ HAVE_TR1_CMATH = 0
+ ifeq ($(TMP),0)
+ HAVE_TR1_CMATH = 1
+@@ -729,7 +729,7 @@ ifeq ($(USE_VTK), "ON")
+ $(shell $(ECHO) "#vtk major version detection" >> $(AUTO_LOG_FILE))
+ endif
+ # note we assume here that our compiler supports #pragma message
+- VTK_TMP := $(shell $(ECHO) '\#include <vtkVersion.h> \n \#define XSTR(x) STR(x) \n \#define STR(x) \#x \n \#pragma message XSTR(VTK_MAJOR_VERSION)' > $(TMPFILE) && $(CXX) -Wno-deprecated -E $(VTK_INC) -xc++ $(TMPFILE) 2>> $(AUTO_LOG_FILE) | tee -a $(AUTO_LOG_FILE) | grep "pragma" | grep "message" || echo -1)
++ VTK_TMP := $(shell $(ECHO) '#include <vtkVersion.h> \n #define XSTR(x) STR(x) \n #define STR(x) #x \n #pragma message XSTR(VTK_MAJOR_VERSION)' > $(TMPFILE) && $(CXX) -Wno-deprecated -E $(VTK_INC) -xc++ $(TMPFILE) 2>> $(AUTO_LOG_FILE) | tee -a $(AUTO_LOG_FILE) | grep "pragma" | grep "message" || echo -1)
+ ifeq ($(AUTO_DEBUG),1)
+ $(shell $(ECHO) "#vtk major version detection result: $(VTK_TMP)" >> $(AUTO_LOG_FILE))
+ endif
+@@ -744,7 +744,7 @@ ifeq ($(USE_VTK), "ON")
+ ifeq ($(VTK_INC),-I)
+ VTK_INC =
+ endif
+- VTK_TMP := $(shell $(ECHO) '\#include <vtkVersion.h> \n \#define XSTR(x) STR(x) \n \#define STR(x) \#x \n \#pragma message XSTR(VTK_MAJOR_VERSION)' > $(TMPFILE) && $(CXX) -Wno-deprecated -E $(VTK_INC) -xc++ $(TMPFILE) 2>> $(AUTO_LOG_FILE) | tee -a $(AUTO_LOG_FILE) | grep "pragma" | grep "message" || echo -1)
++ VTK_TMP := $(shell $(ECHO) '#include <vtkVersion.h> \n #define XSTR(x) STR(x) \n #define STR(x) #x \n #pragma message XSTR(VTK_MAJOR_VERSION)' > $(TMPFILE) && $(CXX) -Wno-deprecated -E $(VTK_INC) -xc++ $(TMPFILE) 2>> $(AUTO_LOG_FILE) | tee -a $(AUTO_LOG_FILE) | grep "pragma" | grep "message" || echo -1)
+ ifeq ($(AUTO_DEBUG),1)
+ $(shell $(ECHO) "#vtk major version detection result (lib): $(VTK_TMP)" >> $(AUTO_LOG_FILE))
+ endif
+@@ -797,7 +797,7 @@ ifeq ($(USE_VTK), "ON")
+ # At this stage we now have VTK downloaded. Next we need to compile it
+ $(info VTK has been downloaded and will be compiled now. This can take several minutes.)
+ OBJDIR := $(PWD)
+- TMP := $(shell $(ECHO) '\#!/bin/bash \n cd "$(OBJDIR)/$(LIB_PATH)/vtk" \n mkdir -p build \n cd src \n git checkout $(VTK_VERSION_TAG) &>> $(AUTO_LOG_FILE) \n cd ../build \n cmake -DBUILD_TESTING:BOOL=OFF -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX=../install -DModule_vtkIOMPIParallel:BOOL=ON -DVTK_Group_MPI:BOOL=ON -DVTK_Group_Rendering:BOOL=OFF -DVTK_RENDERING_BACKEND:STRING=None -DVTK_USE_X:BOOL=OFF -DModule_vtkIOMPIImage:BOOL=ON -DModule_vtkParallelMPI:BOOL=ON ../src &>> $(AUTO_LOG_FILE) \n make &>> $(AUTO_LOG_FILE) \n make install &>> $(AUTO_LOG_FILE)' > $(TMPFILE))
++ TMP := $(shell $(ECHO) '#!/bin/bash \n cd "$(OBJDIR)/$(LIB_PATH)/vtk" \n mkdir -p build \n cd src \n git checkout $(VTK_VERSION_TAG) &>> $(AUTO_LOG_FILE) \n cd ../build \n cmake -DBUILD_TESTING:BOOL=OFF -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX=../install -DModule_vtkIOMPIParallel:BOOL=ON -DVTK_Group_MPI:BOOL=ON -DVTK_Group_Rendering:BOOL=OFF -DVTK_RENDERING_BACKEND:STRING=None -DVTK_USE_X:BOOL=OFF -DModule_vtkIOMPIImage:BOOL=ON -DModule_vtkParallelMPI:BOOL=ON ../src &>> $(AUTO_LOG_FILE) \n make &>> $(AUTO_LOG_FILE) \n make install &>> $(AUTO_LOG_FILE)' > $(TMPFILE))
+ TMP := $(shell bash $(TMPFILE) && echo 0 || echo -1)
+ ifeq ($(TMP), -1)
+ $(error 'Compilation of vtk failed. Please install it manually')
+@@ -807,7 +807,7 @@ ifeq ($(USE_VTK), "ON")
+ ifeq ($(VTK_INC),-I)
+ VTK_INC =
+ endif
+- VTK_TMP := $(shell $(ECHO) '\#include <vtkVersion.h> \n \#define XSTR(x) STR(x) \n \#define STR(x) \#x \n \#pragma message XSTR(VTK_MAJOR_VERSION)' > $(TMPFILE) && $(CXX) -Wno-deprecated -E $(VTK_INC) -xc++ $(TMPFILE) 2>> $(AUTO_LOG_FILE) | tee -a $(AUTO_LOG_FILE) | grep "pragma" | grep "message" || echo -1)
++ VTK_TMP := $(shell $(ECHO) '#include <vtkVersion.h> \n #define XSTR(x) STR(x) \n #define STR(x) #x \n #pragma message XSTR(VTK_MAJOR_VERSION)' > $(TMPFILE) && $(CXX) -Wno-deprecated -E $(VTK_INC) -xc++ $(TMPFILE) 2>> $(AUTO_LOG_FILE) | tee -a $(AUTO_LOG_FILE) | grep "pragma" | grep "message" || echo -1)
+ ifeq ($(AUTO_DEBUG),1)
+ $(shell $(ECHO) "#vtk major version detection result (lib): $(VTK_TMP)" >> $(AUTO_LOG_FILE))
+ endif
+@@ -826,7 +826,7 @@ ifeq ($(USE_VTK), "ON")
+ ifeq ($(AUTO_DEBUG),1)
+ $(shell $(ECHO) "#vtk_major_version: $(VTK_MAJOR_VERSION)" >> $(AUTO_LOG_FILE))
+ endif
+- VTK_TMP := $(shell $(ECHO) '\#include <vtkVersion.h> \n \#define XSTR(x) STR(x) \n \#define STR(x) \#x \n \#pragma message XSTR(VTK_MINOR_VERSION)' > $(TMPFILE) && $(CXX) -Wno-deprecated -E $(VTK_INC) -xc++ $(TMPFILE) 2>> $(AUTO_LOG_FILE) | tee -a $(AUTO_LOG_FILE) | grep "pragma" | grep "message" || echo -1)
++ VTK_TMP := $(shell $(ECHO) '#include <vtkVersion.h> \n #define XSTR(x) STR(x) \n #define STR(x) #x \n #pragma message XSTR(VTK_MINOR_VERSION)' > $(TMPFILE) && $(CXX) -Wno-deprecated -E $(VTK_INC) -xc++ $(TMPFILE) 2>> $(AUTO_LOG_FILE) | tee -a $(AUTO_LOG_FILE) | grep "pragma" | grep "message" || echo -1)
+ ifeq ($(VTK_TMP), -1)
+ $(error Could not obtain VTK_MINOR_VERSION)
+ endif
+@@ -885,7 +885,7 @@ ifeq ($(USE_VTK), "ON")
+ VTK_LIB =
+ endif
+ endif
+- TMP := $(shell $(ECHO) '\#include <vtkVersion.h> \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(VTK_LIB) $(VTK_INC) $(EXTRA_ADDLIBS) -lvtkCommon$(VTK_APPENDIX_5) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
++ TMP := $(shell $(ECHO) '#include <vtkVersion.h> \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(VTK_LIB) $(VTK_INC) $(EXTRA_ADDLIBS) -lvtkCommon$(VTK_APPENDIX_5) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
+ ifeq ($(TMP), -1)
+ ifeq ($(VTK_LIB_SET), 0)
+ VTK_LIB := -L$(dir $(shell find $(VTK_BASE_PATH)/lib* -name 'libvtkCommon.so' | tail -n 1))
+@@ -893,7 +893,7 @@ ifeq ($(USE_VTK), "ON")
+ VTK_LIB =
+ endif
+ endif
+- TMP := $(shell $(ECHO) '\#include <vtkVersion.h> \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(VTK_LIB) $(VTK_INC) $(EXTRA_ADDLIBS) -lvtkCommon $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
++ TMP := $(shell $(ECHO) '#include <vtkVersion.h> \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(VTK_LIB) $(VTK_INC) $(EXTRA_ADDLIBS) -lvtkCommon $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
+ ifeq ($(TMP), -1)
+ $(error 'Could not determine suitable appendix of VTK library with VTK_INC="$(VTK_INC)", VTK_LIB="$(VTK_LIB)" and VTK_APPENDIX="$(VTK_APPENDIX)"')
+ else
+@@ -924,7 +924,7 @@ ifeq ($(USE_VTK), "ON")
+ $(shell $(ECHO) "#vtk_lib: $(VTK_LIB)" >> $(AUTO_LOG_FILE))
+ $(shell $(ECHO) "#appendix command: $(CXX) $(EXTRA_LIB) $(VTK_LIB) $(VTK_INC) $(EXTRA_ADDLIBS) -lvtksys$(VTK_APPENDIX) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE)" >> $(AUTO_LOG_FILE))
+ endif
+- TMP := $(shell $(ECHO) '\#include <vtkVersion.h> \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(VTK_LIB) $(VTK_INC) $(EXTRA_ADDLIBS) -lvtksys$(VTK_APPENDIX) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2>> $(AUTO_LOG_FILE) && echo 0 || echo -1)
++ TMP := $(shell $(ECHO) '#include <vtkVersion.h> \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(VTK_LIB) $(VTK_INC) $(EXTRA_ADDLIBS) -lvtksys$(VTK_APPENDIX) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2>> $(AUTO_LOG_FILE) && echo 0 || echo -1)
+ ifeq ($(TMP), -1)
+ ifeq ($(AUTO_DEBUG),1)
+ $(shell $(ECHO) "#attempting without appendix" >> $(AUTO_LOG_FILE))
+@@ -935,7 +935,7 @@ ifeq ($(USE_VTK), "ON")
+ VTK_LIB =
+ endif
+ endif
+- TMP := $(shell $(ECHO) '\#include <vtkVersion.h> \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(VTK_LIB) $(VTK_INC) $(EXTRA_ADDLIBS) -lvtksys $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2>> $(AUTO_LOG_FILE) && echo 0 || echo -1)
++ TMP := $(shell $(ECHO) '#include <vtkVersion.h> \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(VTK_LIB) $(VTK_INC) $(EXTRA_ADDLIBS) -lvtksys $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2>> $(AUTO_LOG_FILE) && echo 0 || echo -1)
+ ifeq ($(TMP), -1)
+ $(error 'Could not determine suitable appendix of VTK library with VTK_INC="$(VTK_INC)", VTK_LIB="$(VTK_LIB)" and VTK_APPENDIX="$(VTK_APPENDIX)"')
+ else
+@@ -1025,9 +1025,9 @@ ifeq ($(USE_VTK), "ON")
+ $(shell $(ECHO) "#vtk_addlibs: $(VTK_ADDLIBS)" >> $(AUTO_LOG_FILE))
+ $(shell $(ECHO) "#vtk_rpath: $(VTK_RPATH)" >> $(AUTO_LOG_FILE))
+ $(shell $(ECHO) "#vtk compile test:" >> $(AUTO_LOG_FILE))
+- TMP := $(shell $(ECHO) "\#include <vtkVersion.h> \n int main(){}" > $(TMPFILE) && $(CXX) $(VTK_RPATH) $(EXTRA_LIB) $(VTK_LIB) $(VTK_INC) $(EXTRA_ADDLIBS) $(VTK_ADDLIBS) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) &>> $(AUTO_LOG_FILE))
++ TMP := $(shell $(ECHO) "#include <vtkVersion.h> \n int main(){}" > $(TMPFILE) && $(CXX) $(VTK_RPATH) $(EXTRA_LIB) $(VTK_LIB) $(VTK_INC) $(EXTRA_ADDLIBS) $(VTK_ADDLIBS) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) &>> $(AUTO_LOG_FILE))
+ endif
+- TMP := $(shell $(ECHO) '\#include <vtkVersion.h> \n int main(){}' > $(TMPFILE) && $(CXX) $(VTK_RPATH) $(EXTRA_LIB) $(VTK_LIB) $(VTK_INC) $(EXTRA_ADDLIBS) $(VTK_ADDLIBS) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
++ TMP := $(shell $(ECHO) '#include <vtkVersion.h> \n int main(){}' > $(TMPFILE) && $(CXX) $(VTK_RPATH) $(EXTRA_LIB) $(VTK_LIB) $(VTK_INC) $(EXTRA_ADDLIBS) $(VTK_ADDLIBS) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
+ ifeq ($(TMP), -1)
+ $(error 'Could not compile VTK example with VTK_INC="$(VTK_INC)", VTK_LIB="$(VTK_LIB)" and VTK_ADDLIBS="$(VTK_ADDLIBS)"')
+ endif
+@@ -1057,7 +1057,7 @@ ifeq ($(USE_SUPERQUADRICS), "ON")
+ ifeq ($(REQUIRE_BOOST),1)
+ BOOST_INC ?= $(BOOST_INC_USR)
+ # Include test
+- TMP := $(shell $(ECHO) '\#include "boost/math/special_functions/beta.hpp" \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(BOOST_INC) $(EXTRA_ADDLIBS) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
++ TMP := $(shell $(ECHO) '#include "boost/math/special_functions/beta.hpp" \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(BOOST_INC) $(EXTRA_ADDLIBS) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
+ ifeq ($(TMP), -1)
+ $(error 'Could not compile boost example with BOOST_INC="$(BOOST_INC)" as boost/math/special_functions/beta.hpp could not be found')
+ endif
+@@ -1082,7 +1082,7 @@ ifeq ($(USE_JPG), "ON")
+ $(shell $(ECHO) "#JPG_ADDLIBS: $(JPG_ADDLIBS)" >> $(AUTO_LOG_FILE))
+ $(shell $(ECHO) "jpg compile test:" >> $(AUTO_LOG_FILE))
+ endif
+- TMP := $(shell $(ECHO) '\#include <cstdlib> \n \#include <cstdio> \n \#include <jpeglib.h> \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(JPG_INC) $(EXTRA_ADDLIBS) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2>> $(AUTO_LOG_FILE) && echo 0 || echo -1)
++ TMP := $(shell $(ECHO) '#include <cstdlib> \n #include <cstdio> \n #include <jpeglib.h> \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(JPG_INC) $(EXTRA_ADDLIBS) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2>> $(AUTO_LOG_FILE) && echo 0 || echo -1)
+ ifeq ($(TMP), -1)
+ $(error 'Could not compile jpg example with JPG_INC="$(JPG_INC)"')
+ endif
+@@ -1090,7 +1090,7 @@ ifeq ($(USE_JPG), "ON")
+ $(shell $(ECHO) "jpg link test:" >> $(AUTO_LOG_FILE))
+ endif
+ # Linking test
+- TMP := $(shell $(ECHO) '\#include <cstdlib> \n \#include <cstdio> \n \#include <jpeglib.h> \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(JPG_LIB) $(JPG_INC) $(EXTRA_ADDLIBS) $(JPG_ADDLIBS) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2>> $(AUTO_LOG_FILE) && echo 0 || echo -1)
++ TMP := $(shell $(ECHO) '#include <cstdlib> \n #include <cstdio> \n #include <jpeglib.h> \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(JPG_LIB) $(JPG_INC) $(EXTRA_ADDLIBS) $(JPG_ADDLIBS) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2>> $(AUTO_LOG_FILE) && echo 0 || echo -1)
+ ifeq ($(TMP), -1)
+ $(error 'Could not compile and link jpg example with JPG_INC="$(JPG_INC)", JPG_LIB="$(JPG_LIB)" and JPG_ADDLIBS="$(JPG_ADDLIBS)"')
+ endif
+@@ -1119,7 +1119,7 @@ ifeq ($(USE_CONVEX), "ON")
+ CONVEX_ADDLIBS += -lccd
+ # Test settings
+ # Link test
+- TMP := $(shell $(ECHO) '\#include "ccd/ccd.h" \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(CONVEX_LIB) $(CONVEX_INC) $(EXTRA_ADDLIBS) $(CONVEX_ADDLIBS) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
++ TMP := $(shell $(ECHO) '#include "ccd/ccd.h" \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(CONVEX_LIB) $(CONVEX_INC) $(EXTRA_ADDLIBS) $(CONVEX_ADDLIBS) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
+ # Automatic download and compilation if AUTODOWNLOAD_CONVEX is set
+ ifeq ($(TMP), -1)
+ ifeq ($(AUTOINSTALL_CONVEX), "ON")
+@@ -1168,7 +1168,7 @@ ifeq ($(USE_CONVEX), "ON")
+ endif
+ # At this stage we now have libccd downloaded. Next we need to compile it
+ OBJDIR := $(PWD)
+- TMP := $(shell $(ECHO) '\#!/bin/bash \n cd "$(OBJDIR)/$(LIB_PATH)/libccd/src" \n make PREFIX="$(PWD)/../../" USE_DOUBLE=yes &> /dev/null' > $(TMPFILE))
++ TMP := $(shell $(ECHO) '#!/bin/bash \n cd "$(OBJDIR)/$(LIB_PATH)/libccd/src" \n make PREFIX="$(PWD)/../../" USE_DOUBLE=yes &> /dev/null' > $(TMPFILE))
+ TMP := $(shell bash $(TMPFILE) && echo 0 || echo -1)
+ ifeq ($(TMP), -1)
+ $(error 'Compilation of libccd failed. Please install it manually')
+@@ -1178,12 +1178,12 @@ ifeq ($(USE_CONVEX), "ON")
+ endif
+ endif
+ # Include test
+- TMP := $(shell $(ECHO) '\#include "ccd/ccd.h" \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(CONVEX_INC) $(EXTRA_ADDLIBS) $(CCFLAGS) -xc++ -E $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
++ TMP := $(shell $(ECHO) '#include "ccd/ccd.h" \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(CONVEX_INC) $(EXTRA_ADDLIBS) $(CCFLAGS) -xc++ -E $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
+ ifeq ($(TMP), -1)
+ $(error 'Could not compile Convex (libccd) example with CONVEX_INC="$(CONVEX_INC)"')
+ endif
+ # Link test
+- TMP := $(shell $(ECHO) '\#include "ccd/ccd.h" \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(CONVEX_LIB) $(CONVEX_INC) $(EXTRA_ADDLIBS) $(CONVEX_ADDLIBS) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
++ TMP := $(shell $(ECHO) '#include "ccd/ccd.h" \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(CONVEX_LIB) $(CONVEX_INC) $(EXTRA_ADDLIBS) $(CONVEX_ADDLIBS) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
+ ifeq ($(TMP), -1)
+ $(error 'Could not compile and link Convex (libccd) example with CONVEX_INC="$(CONVEX_INC)", CONVEX_LIB="$(CONVEX_LIB)" and CONVEX_ADDLIBS="$(CONVEX_ADDLIBS)"')
+ endif
+@@ -1210,7 +1210,7 @@ ifeq ($(USE_MFEM), "ON")
+ MFEM_LIB ?= -L$(LIB_PATH)/mfem
+ MFEM_ADDLIBS += -lmfem
+ # Link test
+- TMP := $(shell $(ECHO) '\#include "mfem.hpp" \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(MFEM_INC) $(MFEM_LIB) $(EXTRA_ADDLIBS) $(MFEM_ADDLIBS) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
++ TMP := $(shell $(ECHO) '#include "mfem.hpp" \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(MFEM_INC) $(MFEM_LIB) $(EXTRA_ADDLIBS) $(MFEM_ADDLIBS) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
+ ifeq ($(TMP), -1)
+ ifeq ($(AUTOINSTALL_MFEM), "ON")
+ $(info 'Could not compile MFEM example. As AUTOINSTALL_MFEM is set to "ON". MFEM will now be automatically downloaded to ../lib/mfem')
+@@ -1257,7 +1257,7 @@ ifeq ($(USE_MFEM), "ON")
+ # At this stage we now have MFEM downloaded. Next we need to compile it
+ TMP := $(shell ls $(LIB_PATH)/mfem/libmfem.a && echo 0 || echo -1)
+ ifeq ($(TMP), -1)
+- TMP := $(shell $(ECHO) '\#!/bin/bash \n cd $(LIB_PATH)/mfem \n make config \n make all -j 4' > $(TMPFILE))
++ TMP := $(shell $(ECHO) '#!/bin/bash \n cd $(LIB_PATH)/mfem \n make config \n make all -j 4' > $(TMPFILE))
+ TMP := $(shell bash $(TMPFILE) && echo 0 || echo -1)
+ ifeq ($(TMP), -1)
+ $(error 'Compilation of MFEM failed. Please install it manually')
+@@ -1270,12 +1270,12 @@ ifeq ($(USE_MFEM), "ON")
+
+
+ # Include test
+- TMP := $(shell $(ECHO) '\#include "mfem.hpp" \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(MFEM_INC) $(EXTRA_ADDLIBS) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
++ TMP := $(shell $(ECHO) '#include "mfem.hpp" \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(MFEM_INC) $(EXTRA_ADDLIBS) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
+ ifeq ($(TMP), -1)
+ $(error 'Could not compile MFEM example with MFEM_INC="$(MFEM_INC)"')
+ endif
+ # Link test
+- TMP := $(shell $(ECHO) '\#include "mfem.hpp" \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(MFEM_INC) $(MFEM_LIB) $(EXTRA_ADDLIBS) $(MFEM_ADDLIBS) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
++ TMP := $(shell $(ECHO) '#include "mfem.hpp" \n int main(){}' > $(TMPFILE) && $(CXX) $(EXTRA_LIB) $(MFEM_INC) $(MFEM_LIB) $(EXTRA_ADDLIBS) $(MFEM_ADDLIBS) $(CCFLAGS) -xc++ -o /dev/null $(TMPFILE) 2> /dev/null && echo 0 || echo -1)
+ ifeq ($(TMP), -1)
+ $(error 'Could not compile and link MFEM example. Test was done with MFEM_INC="$(MFEM_INC)", MFEM_LIB="$(MFEM_LIB)" and MFEM_ADDLIBS="$(MFEM_ADDLIBS)"')
+ endif
diff --git a/var/spack/repos/builtin/packages/liggghts/package.py b/var/spack/repos/builtin/packages/liggghts/package.py
index d9487bea45..dac43ff365 100644
--- a/var/spack/repos/builtin/packages/liggghts/package.py
+++ b/var/spack/repos/builtin/packages/liggghts/package.py
@@ -16,6 +16,8 @@ class Liggghts(MakefilePackage):
url = "https://github.com/CFDEMproject/LIGGGHTS-PUBLIC/archive/3.8.0.tar.gz"
git = "ssh://git@github.com/CFDEMproject/LIGGGHTS-PUBLIC.git"
+ maintainers("SofiaXu")
+
version("3.8.0", sha256="9cb2e6596f584463ac2f80e3ff7b9588b7e3638c44324635b6329df87b90ab03")
variant("mpi", default=True, description="Enable MPI support")
@@ -28,7 +30,13 @@ class Liggghts(MakefilePackage):
depends_on("mpi", when="+mpi")
depends_on("jpeg", when="+jpeg")
depends_on("zlib-api", when="+gzip")
-
+ # patch for makefile test code
+ patch("makefile.patch")
+ # patch for clang and oneapi
+ patch("makefile-llvm-based-compiler.patch", when="%clang")
+ patch("makefile-llvm-based-compiler.patch", when="%oneapi")
+ # C++17 support
+ patch("cpp-17.patch")
build_directory = "src"
build_targets = ["auto"]
@@ -55,9 +63,9 @@ class Liggghts(MakefilePackage):
if "+mpi" in spec:
mpi = spec["mpi"]
- makefile.filter(r"^#(MPICXX_USER=).*", r"\1{0}".format(mpi.mpicxx))
- makefile.filter(r"^#(MPI_INC_USER=).*", r"\1{0}".format(mpi.prefix.include))
- makefile.filter(r"^#(MPI_LIB_USER=).*", r"\1{0}".format(mpi.prefix.lib))
+ makefile.filter(r"^#(MPICXX_USR=).*", r"\1{0}".format(mpi.mpicxx))
+ makefile.filter(r"^#(MPI_INC_USR=).*", r"\1{0}".format(mpi.prefix.include))
+ makefile.filter(r"^#(MPI_LIB_USR=).*", r"\1{0}".format(mpi.prefix.lib))
else:
makefile.filter(r"^(USE_MPI = ).*", r'\1"OFF"')
# Set path to C++ compiler.
@@ -70,8 +78,8 @@ class Liggghts(MakefilePackage):
if "+jpeg" in spec:
jpeg = spec["jpeg"]
makefile.filter(r"^(USE_JPG = ).*", r'\1"ON"')
- makefile.filter(r"^#(JPG_INC_USER=-I).*", r"\1{0}".format(jpeg.prefix.include))
- makefile.filter(r"^#(JPG_LIB_USER=-L).*", r"\1{0}".format(jpeg.prefix.lib))
+ makefile.filter(r"^#(JPG_INC_USR=-I).*", r"\1{0}".format(jpeg.prefix.include))
+ makefile.filter(r"^#(JPG_LIB_USR=-L).*", r"\1{0}".format(jpeg.prefix.lib))
if "+gzip" in spec:
makefile.filter(r"^(USE_GZIP = ).*", r'\1"ON"')