1 # This patch removes all need for the ThirdParty files of OpenFOAM.
3 # Derived from EasyBuild patch by Ward Poelmans <wpoely86@gmail.com>.
4 # Modified for GNU Guix by Paul Garlick <pgarlick@tourbillion-technology.com>.
6 diff -ur OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/setSet/Allwmake OpenFOAM-4.x-version-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake
7 --- OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/setSet/Allwmake
8 +++ OpenFOAM-4.x-version-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake
11 # use readline if available
13 -if [ -f /usr/include/readline/readline.h ]
16 echo "Found <readline/readline.h> -- enabling readline support."
17 export COMP_FLAGS="-DHAS_READLINE"
18 diff -ur OpenFOAM-4.x-version-4.1.org/etc/bashrc OpenFOAM-4.x-version-4.1/etc/bashrc
19 --- OpenFOAM-4.x-version-4.1.org/etc/bashrc
20 +++ OpenFOAM-4.x-version-4.1/etc/bashrc
22 # Please set to the appropriate path if the default is not correct.
25 -export FOAM_INST_DIR=$(cd ${BASH_SOURCE%/*/*/*} && pwd -P) || \
26 +export FOAM_INST_DIR=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P) || \
27 export FOAM_INST_DIR=$HOME/$WM_PROJECT
28 +# For GNU Guix: set initially for build then re-set at runtime
30 # export FOAM_INST_DIR=~$WM_PROJECT
31 # export FOAM_INST_DIR=/opt/$WM_PROJECT
32 # export FOAM_INST_DIR=/usr/local/$WM_PROJECT
33 diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/CGAL OpenFOAM-4.x-version-4.1/etc/config.sh/CGAL
34 --- OpenFOAM-4.x-version-4.1.org/etc/config.sh/CGAL
35 +++ OpenFOAM-4.x-version-4.1/etc/config.sh/CGAL
38 #------------------------------------------------------------------------------
40 -boost_version=boost-system
41 -cgal_version=cgal-system
42 -#cgal_version=CGAL-4.8
44 -if [ -z "$SOURCE_CGAL_VERSIONS_ONLY" ]
47 - common_path=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER
49 - export BOOST_ARCH_PATH=$common_path/$boost_version
50 - export CGAL_ARCH_PATH=$common_path/$cgal_version
52 - if [ "$FOAM_VERBOSE" -a "$PS1" ]
54 - echo "Using CGAL and boost" 1>&2
55 - echo " $cgal_version at $CGAL_ARCH_PATH" 1>&2
56 - echo " $boost_version at $BOOST_ARCH_PATH" 1>&2
59 - if [ -d "$CGAL_ARCH_PATH" -a "$cgal_version" != "cgal-system" ]
61 - _foamAddLib $CGAL_ARCH_PATH/lib
64 - if [ -d "$BOOST_ARCH_PATH" -a "$boost_version" != "boost-system" ]
66 - _foamAddLib $BOOST_ARCH_PATH/lib
69 - unset boost_version cgal_version common_path
72 +export CGAL_ARCH_PATH=$CGAL_ROOT
73 +export BOOST_ARCH_PATH=$BOOST_ROOT
75 #------------------------------------------------------------------------------
76 diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools
77 --- OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools
78 +++ OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools
81 #------------------------------------------------------------------------------
84 -gperftools_install=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER
86 -GPERFTOOLS_VERSION=gperftools-$version
87 -GPERFTOOLS_ARCH_PATH=$gperftools_install/$GPERFTOOLS_VERSION
89 -export PATH=$GPERFTOOLS_ARCH_PATH/bin:$PATH
90 -export LD_LIBRARY_PATH=$GPERFTOOLS_ARCH_PATH/lib:$LD_LIBRARY_PATH
92 #------------------------------------------------------------------------------
93 diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/metis OpenFOAM-4.x-version-4.1/etc/config.sh/metis
94 --- OpenFOAM-4.x-version-4.1.org/etc/config.sh/metis
95 +++ OpenFOAM-4.x-version-4.1/etc/config.sh/metis
98 #------------------------------------------------------------------------------
100 -export METIS_VERSION=metis-5.1.0
101 -export METIS_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$METIS_VERSION
102 +export METIS_VERSION=metis-$METISVERSION
103 +export METIS_ARCH_PATH=$METIS_ROOT
105 #------------------------------------------------------------------------------
106 diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/scotch OpenFOAM-4.x-version-4.1/etc/config.sh/scotch
107 --- OpenFOAM-4.x-version-4.1.org/etc/config.sh/scotch
108 +++ OpenFOAM-4.x-version-4.1/etc/config.sh/scotch
111 #------------------------------------------------------------------------------
113 -export SCOTCH_VERSION=scotch_6.0.3
114 -export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$SCOTCH_VERSION
115 +export SCOTCH_VERSION=scotch_$SCOTCHVERSION
116 +export SCOTCH_ARCH_PATH=$SCOTCH_ROOT
118 #------------------------------------------------------------------------------
119 diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/settings OpenFOAM-4.x-version-4.1/etc/config.sh/settings
120 --- OpenFOAM-4.x-version-4.1.org/etc/config.sh/settings
121 +++ OpenFOAM-4.x-version-4.1/etc/config.sh/settings
125 # Use system compiler
126 + # Use system GMP and MPFR packages
127 + export GMP_ARCH_PATH=$GMP_ROOT
128 + export MPFR_ARCH_PATH=$MPFR_ROOT
131 echo "Warn: WM_COMPILER_TYPE='$WM_COMPILER_TYPE' is unsupported" 1>&2
132 diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/ptscotchDecomp/Make/options OpenFOAM-4.x-version-4.1/src/parallel/decompose/ptscotchDecomp/Make/options
133 --- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/ptscotchDecomp/Make/options
134 +++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/ptscotchDecomp/Make/options
137 -I$(SCOTCH_ROOT)/include \
138 -I$(SCOTCH_ARCH_PATH)/include/$(FOAM_MPI) \
139 - -I/usr/include/scotch \
140 -I../decompositionMethods/lnInclude
143 - -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt
144 + -L$(SCOTCH_ROOT)/lib -L$(MPI_ARCH_PATH)/lib -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt
145 diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/scotchDecomp/Make/options OpenFOAM-4.x-version-4.1/src/parallel/decompose/scotchDecomp/Make/options
146 --- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/scotchDecomp/Make/options
147 +++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/scotchDecomp/Make/options
150 -I$(SCOTCH_ROOT)/include \
151 -I$(SCOTCH_ARCH_PATH)/include \
152 - -I/usr/include/scotch \
153 -I../decompositionMethods/lnInclude
156 - -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN) -lscotch -lscotcherrexit -lrt
157 + -L$(SCOTCH_ROOT)/lib -lscotch -lscotcherrexit -lrt
158 diff -ur OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general OpenFOAM-4.x-version-4.1/wmake/makefiles/general
159 --- OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general
160 +++ OpenFOAM-4.x-version-4.1/wmake/makefiles/general
162 # The Makefile uses a POSIX shell
163 #------------------------------------------------------------------------------
168 #------------------------------------------------------------------------------
169 diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmake OpenFOAM-4.x-version-4.1/wmake/wmake
170 --- OpenFOAM-4.x-version-4.1.org/wmake/wmake
171 +++ OpenFOAM-4.x-version-4.1/wmake/wmake
174 if [ "$WM_NCOMPPROCS" -gt 1 -a ! "$MAKEFLAGS" ]
176 - lockDir=$HOME/.$WM_PROJECT/.wmake
177 + lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake
181 diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmakeScheduler OpenFOAM-4.x-version-4.1/wmake/wmakeScheduler
182 --- OpenFOAM-4.x-version-4.1.org/wmake/wmakeScheduler
183 +++ OpenFOAM-4.x-version-4.1/wmake/wmakeScheduler
185 # csh sets HOST, bash sets HOSTNAME
188 -lockDir=$HOME/.$WM_PROJECT/.wmake
189 +lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake
191 # Fallback - 1 core on current host
192 : ${WM_HOSTS:=$HOST:1}
193 diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmakeSchedulerUptime OpenFOAM-4.x-version-4.1/wmake/wmakeSchedulerUptime
194 --- OpenFOAM-4.x-version-4.1.org/wmake/wmakeSchedulerUptime
195 +++ OpenFOAM-4.x-version-4.1/wmake/wmakeSchedulerUptime
197 # csh sets HOST, bash sets HOSTNAME
200 -lockDir=$HOME/.$WM_PROJECT/.wmake
201 +lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake
202 # Fallback - 1 core on current host
203 : ${WM_HOSTS:=$HOST:1}
205 diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/metisDecomp/metisDecomp.C OpenFOAM-4.x-version-4.1/src/parallel/decompose/metisDecomp/metisDecomp.C
206 --- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/metisDecomp/metisDecomp.C
207 +++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/metisDecomp/metisDecomp.C
210 // Processor weights initialised with no size, only used if specified in
212 - Field<scalar> processorWeights;
213 + Field<floatScalar> processorWeights;
215 // Cell weights (so on the vertices of the dual)
216 List<label> cellWeights;
217 diff -ur OpenFOAM-4.x-version-4.1.org/wmake/rules/General/CGAL OpenFOAM-4.x-version-4.1/wmake/rules/General/CGAL
218 --- OpenFOAM-4.x-version-4.1.org/wmake/rules/General/CGAL
219 +++ OpenFOAM-4.x-version-4.1/wmake/rules/General/CGAL
224 - -L$(MPFR_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
225 - -L$(GMP_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
226 + -L$(MPFR_ARCH_PATH)/lib \
227 + -L$(GMP_ARCH_PATH)/lib \
228 -L$(BOOST_ARCH_PATH)/lib \
229 -L$(CGAL_ARCH_PATH)/lib \
233 diff -ur OpenFOAM-4.x-version-4.1.org/wmake/rules/linux64Gcc/c++ OpenFOAM-4.x-version-4.1/wmake/rules/linux64Gcc/c++
234 --- OpenFOAM-4.x-version-4.1.org/wmake/rules/linux64Gcc/c++
235 +++ OpenFOAM-4.x-version-4.1/wmake/rules/linux64Gcc/c++
238 LINK_LIBS = $(c++DBUG)
240 -LINKLIBSO = $(CC) $(c++FLAGS) -shared -Xlinker --add-needed -Xlinker --no-as-needed
241 -LINKEXE = $(CC) $(c++FLAGS) -Xlinker --add-needed -Xlinker --no-as-needed
242 +LINKLIBSO = $(CC) $(c++FLAGS) $(LDFLAGS) -shared -Xlinker --add-needed -Xlinker --no-as-needed
243 +LINKEXE = $(CC) $(c++FLAGS) $(LDFLAGS) -Xlinker --add-needed -Xlinker --no-as-needed