Commit b06f4a86 authored by mark's avatar mark
Browse files

ENH: generalize patching facilty - provide patch for scotch_6.0.4

- fixes #1
parent dc0ed160
......@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation |
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
......@@ -112,7 +112,6 @@ MPICH)
then
echo " have $WM_MPLIB shared library ($FOAM_MPI)"
echo
echo
elif [ -r $MPI_ARCH_PATH/lib/libmpich.a ]
then
echo " have $WM_MPLIB static library ($FOAM_MPI)"
......@@ -172,6 +171,9 @@ MPICH)
esac
#------------------------------------------------------------------------------
# building scotch is still a bit of a pain
# get SCOTCH_VERSION, SCOTCH_ARCH_PATH
if settings=`$WM_PROJECT_DIR/bin/foamEtcFile config.sh/scotch`
then
......@@ -182,7 +184,6 @@ else
echo
fi
# building scotch is still a bit of a pain
echo ========================================
echo "Build Scotch decomposition library $SCOTCH_VERSION"
echo " $SCOTCH_ARCH_PATH"
......@@ -197,10 +198,11 @@ then
echo " scotch header in $SCOTCH_ARCH_PATH/include"
echo " scotch libs in $FOAM_EXT_LIBBIN"
echo
else
elif [ -d "$SCOTCH_VERSION" ]
then
(
set -x
cd $SCOTCH_VERSION/src || exit 1
applyPatch $SCOTCH_VERSION .. # patch at parent-level
prefixDIR=$SCOTCH_ARCH_PATH
libDIR=$FOAM_EXT_LIBBIN
......@@ -233,21 +235,22 @@ else
# cleanup, could also remove Makefile.inc
make realclean 2>/dev/null
)
else
echo " optional component SCOTCH was not found"
fi
# verify existence of scotch include
[ -f $SCOTCH_ARCH_PATH/include/scotch.h ] || {
echo
echo " WARNING: required include file 'scotch.h' not found!"
# build ptscotch if MPI (ThirdParty or system) is available
# and there is a scotch include available (ie, normal scotch was built)
if [ "${FOAM_MPI:-dummy}" != dummy ] && \
[ -f $SCOTCH_ARCH_PATH/include/scotch.h ] || \
{
echo " WARNING: skipping pt-scotch - 'scotch.h' include file not found!"
echo
false
}
# build ptscotch if MPI (ThirdParty or system) is available
if [ "${FOAM_MPI:-dummy}" != dummy ]
then
echo ========================================
echo "Build PTScotch decomposition library $SCOTCH_VERSION (uses MPI)"
echo "Build pt-scotch decomposition library $SCOTCH_VERSION (with $FOAM_MPI)"
echo " $SCOTCH_ARCH_PATH"
echo
......@@ -354,10 +357,12 @@ then
)
fi
else
echo " optional component Metis was not found"
echo " optional component METIS was not found"
fi
#------------------------------------------------------------------------------
# CGAL is optional
echo ========================================
echo Build CGAL
......@@ -373,9 +378,12 @@ then
fi
)
else
echo " optional component was not found"
echo " optional component CGAL was not found"
fi
#------------------------------------------------------------------------------
echo
echo ========================================
echo Done ThirdParty Allwmake
......
--- scotch_6.0.4/src/libscotch/common.h.orig 2015-03-01 10:14:02.000000000 +0100
+++ scotch_6.0.4/src/libscotch/common.h 2016-06-16 09:23:00.314985888 +0200
@@ -306,6 +306,8 @@
ThreadLaunchStartFunc stafptr; /*+ Pointer to start routine +*/
ThreadLaunchJoinFunc joifptr; /*+ Pointer to join routine +*/
ThreadBarrier barrdat; /*+ Barrier data structure +*/
+#else
+ int thrdnbr; /* dummy for non-threaded */
#endif /* ((defined COMMON_PTHREAD) || (defined SCOTCH_PTHREAD)) */
} ThreadGroupHeader;
......@@ -337,28 +337,9 @@ addQtSupport()
#
# Apply source-code patch if possible
#
applyPatch()
patchParaView()
{
local patch="$WM_THIRD_PARTY_DIR/etc/patches/paraview-$ParaView_VERSION"
local sentinel="PATCHED_DURING_OPENFOAM_BUILD"
if [ -r "$patch" ]
then
(
cd $ParaView_SOURCE_DIR || exit 1
if [ -f "$sentinel" ]
then
echo "patch for paraview-$ParaView_VERSION was already applied"
else
echo "apply patch for paraview-$ParaView_VERSION"
touch "$sentinel"
patch -p1 < $patch
fi
)
else
echo "no patch found for paraview-$ParaView_VERSION"
fi
applyPatch "paraview-$ParaView_VERSION" "$ParaView_SOURCE_DIR"
}
......
......@@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation |
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
......@@ -71,8 +71,8 @@ downloadFile()
return 1
}
file="$1"
url="$2"
local file="$1"
local url="$2"
if [ ! -e download/$file ]
then
......@@ -84,10 +84,10 @@ downloadFile()
#
# Copy Make/{files,options} from wmakeFiles/PACKAGE
# Copy Make/{files,options} from etc/wmakeFiles/PACKAGE
#
# $1 = PACKAGE
# $2 (optional) TARGET DIRECTORY
# $2 = TARGET DIRECTORY (optional)
cpMakeFiles()
{
set +x
......@@ -97,8 +97,8 @@ cpMakeFiles()
return 1
}
pkg=$1
dst=${2:-.}
local pkg=$1
local dst="${2:-.}"
echo "cpMakeFiles" $pkg $dst
wmakeFiles=$WM_THIRD_PARTY_DIR/etc/wmakeFiles/$pkg
......@@ -128,4 +128,41 @@ cpMakeFiles()
}
#
# Apply source-code patch if possible.
# Patches are taken from etc/patches/PACKAGE
#
# $1 = PACKAGE
# $2 = TARGET DIRECTORY (optional)
applyPatch()
{
[ "$#" -eq 1 -o "$#" -eq 2 ] || {
echo "applyPatch called with incorrect number of arguments ($#): $@"
return 1
}
local pkg="$1"
local dst="${2:-.}"
local patch="$WM_THIRD_PARTY_DIR/etc/patches/$pkg"
local sentinel="PATCHED_DURING_OPENFOAM_BUILD"
if [ -r "$patch" ]
then
(
cd $dst || exit 1
if [ -f "$sentinel" ]
then
echo "patch for $pkg was already applied"
else
echo "apply patch for $pkg"
touch "$sentinel"
patch -p1 < $patch
fi
)
else
echo "no patch found for $pkg"
fi
}
#------------------------------------------------------------------------------
......@@ -340,7 +340,7 @@ $(checkVersion)
---------------------
SUMMARY
[ "$runPATCH" = true ] && applyPatch
[ "$runPATCH" = true ] && patchParaView
[ "$runCONFIG" = true ] && configParaView
[ "$runMAKE" = true ] && makeParaView
[ "$runINSTALL" = true ] && installParaView
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment