ENH: explictly set scotch INTSIZE. Tag scotch libs with -intNN ending

- Use WM_LABEL_SIZE to explicitly define INTSIZE32 or INTSIZE64, which
  ensures that SCOTCH_Num appears as (int32_t | int64_t) and avoids
  any ambiguity that a plain 'int' may have.

- Provide library symlinks to the respective label-size.
  Eg,  libscotch.so -> libscotch-int32.so

  This provides a unique library linkage name that avoids ambiguity
  with system-installed libraries.

- Use IDXSIZE64 (memory addressing width Fortran)

NOTE
  Unfortunately -DINT32 seems to fail if openmpi was built without Fortran!
  The MPI_INT32_T is interpreted as MPI_INTEGER4 which does not exist
  - needs more investigation

ENH: scotch - document Makefile.inc by copying into the source directory

ENH: update kahip build to use cmake for newer versions
This commit is contained in:
Mark Olesen
2021-09-08 13:15:25 +02:00
parent 1f6835794f
commit f1fe6c9866
8 changed files with 795 additions and 258 deletions

View File

@ -1,4 +1,6 @@
/* NOTE: make any changes to this file in etc/wmakeFiles/ */
/*
* NOTE: make any changes to this file in ThirdParty etc/wmakeFiles/
*/
interface/kaHIP_interface.cpp
@ -66,5 +68,4 @@ algorithms/cycle_search.cpp
partition/uncoarsening/refinement/cycle_improvements/cycle_refinement.cpp
partition/uncoarsening/refinement/tabu_search/tabu_search.cpp
LIB = $(FOAM_EXT_LIBBIN)/libkahip
LIB = $(KAHIP_LIB_DIR)/libkahip

View File

@ -1,5 +1,5 @@
/*
* NOTE: make any changes to this file in etc/wmakeFiles/
* NOTE: make any changes to this file in ThirdParty etc/wmakeFiles/
* Must use -DNDEBUG to disable kahip debug mode.
* Using -DMODE_NODESEP is not strictly required for building the library.
*/
@ -9,10 +9,13 @@ EXE_INC = \
${COMP_OPENMP} \
-DNDEBUG -DMODE_NODESEP \
-I. \
-I$(KAHIP_LIB_SRC) \
-I$(KAHIP_LIB_SRC)/partition \
-I$(KAHIP_LIB_SRC)/partition/uncoarsening/refinement/quotient_graph_refinement/flow_refinement
-I./partition \
-I./partition/uncoarsening/refinement/quotient_graph_refinement/flow_refinement
LIB_LIBS =
PROJECT_LIBS =
/* failsafe location */
ifeq (,$(strip $(KAHIP_LIB_DIR)))
KAHIP_LIB_DIR = $(FOAM_EXT_LIBBIN)
endif

View File

@ -33,9 +33,18 @@ CFLAGS = $(WM_CFLAGS) -fPIC -O3 \
-DCOMMON_RANDOM_FIXED_SEED \
-DSCOTCH_DETERMINISTIC \
-DSCOTCH_RENAME \
-DIDXSIZE64 \
-Drestrict=__restrict
# 32-bit vs. 64-bit labels
# Use 32/64-bit integers
# ---------------
# Unfortunately -DINT32 seems to fail when openmpi is build without
# Fortran! The MPI_INT32_T is interpreted as MPI_INTEGER4 which does
# not exist
# ---------------
# ifeq ($(WM_LABEL_SIZE),32)
# CFLAGS += -DINTSIZE32
# endif
ifeq ($(WM_LABEL_SIZE),64)
CFLAGS += -DINTSIZE64
endif
@ -50,7 +59,8 @@ LN = ln
MKDIR = mkdir
MV = mv
RANLIB = echo
LEX = flex -Pscotchyy -olex.yy.c
YACC = bison -pscotchyy -y -b y
LEX = flex "-Pscotchyy$(SCOTCH_NAME_SUFFIX)" -olex.yy.c
YACC = bison "-pscotchyy$(SCOTCH_NAME_SUFFIX)" -y -b y
#------------------------------------------------------------------------------

View File

@ -40,15 +40,23 @@ CCS = x86_64-w64-mingw32-gcc $(CFLAGS_WINMPI)
CCP = x86_64-w64-mingw32-gcc $(CFLAGS_WINMPI)
CCD = gcc $(CFLAGS_WINMPI)
CFLAGS = $(WM_CFLAGS) -fPIC -O3 \
-DCOMMON_PTHREAD_FILE \
-DCOMMON_PTHREAD_FILE -DSCOTCH_PTHREAD \
-UCOMMON_FILE_COMPRESS \
-DCOMMON_RANDOM_FIXED_SEED \
-DSCOTCH_DETERMINISTIC \
-DSCOTCH_RENAME \
-DSCOTCH_PTHREAD \
-DIDXSIZE64 \
-Drestrict=__restrict
# 32-bit vs. 64-bit labels
# Use 32/64-bit integers
# ---------------
# Unfortunately -DINT32 seems to fail when openmpi is build without
# Fortran! The MPI_INT32_T is interpreted as MPI_INTEGER4 which does
# not exist
# ---------------
# ifeq ($(WM_LABEL_SIZE),32)
# CFLAGS += -DINTSIZE32
# endif
ifeq ($(WM_LABEL_SIZE),64)
CFLAGS += -DINTSIZE64
endif
@ -67,7 +75,8 @@ LN = ln
MKDIR = mkdir
MV = mv
RANLIB = echo
LEX = flex -Pscotchyy -olex.yy.c
YACC = bison -pscotchyy -y -b y
LEX = flex "-Pscotchyy$(SCOTCH_NAME_SUFFIX)" -olex.yy.c
YACC = bison "-pscotchyy$(SCOTCH_NAME_SUFFIX)" -y -b y
#------------------------------------------------------------------------------

View File

@ -33,9 +33,18 @@ CFLAGS = $(WM_CFLAGS) -fPIC -O3 \
-DCOMMON_RANDOM_FIXED_SEED \
-DSCOTCH_DETERMINISTIC \
-DSCOTCH_RENAME \
-DIDXSIZE64 \
-Drestrict=__restrict
# 32-bit vs. 64-bit labels
# Use 32/64-bit integers
# ---------------
# Unfortunately -DINT32 seems to fail when openmpi is build without
# Fortran! The MPI_INT32_T is interpreted as MPI_INTEGER4 which does
# not exist
# ---------------
# ifeq ($(WM_LABEL_SIZE),32)
# CFLAGS += -DINTSIZE32
# endif
ifeq ($(WM_LABEL_SIZE),64)
CFLAGS += -DINTSIZE64
endif
@ -50,7 +59,8 @@ LN = ln
MKDIR = mkdir
MV = mv
RANLIB = echo
LEX = flex -Pscotchyy -olex.yy.c
YACC = bison -pscotchyy -y -b y
LEX = flex "-Pscotchyy$(SCOTCH_NAME_SUFFIX)" -olex.yy.c
YACC = bison "-pscotchyy$(SCOTCH_NAME_SUFFIX)" -y -b y
#------------------------------------------------------------------------------

369
makeKAHIP
View File

@ -57,62 +57,85 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
echo " Check your OpenFOAM environment and installation"
exit 1
}
. etc/tools/ThirdPartyFunctions
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------
# Obtain version from OpenFOAM etc/config.sh file:
_foamConfig kahip
kahipPACKAGE=${KAHIP_VERSION:-kahip-system}
PACKAGE="${KAHIP_VERSION:-system}"
targetType=libso
# Hint for cmake findMPI
if [ -d "$MPI_ARCH_PATH" ]
then
export MPI_HOME="$MPI_ARCH_PATH"
fi
#------------------------------------------------------------------------------
usage()
{
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
printVersions() { listPackageVersions kahip; exit 0; }
printHelp() {
/bin/cat<<USAGE
Usage: ${0##*/} [OPTION] [lib|libso] [kahip-VERSION]
options:
-gcc Force use of gcc/g++
-force Force build attempt (mingw)
-cmake PATH With cmake from the given path
-help
-gcc Force use of gcc/g++
-force Force build attempt (mingw)
-cmake PATH With cmake from the given path
-bin Create kahip binaries as well
-no-bin Suppress creation of kahip binaries (default)
-mpi-home PATH With hint for MPI_HOME
-no-mpi Compile without MPI
-list List available unpacked source versions
-help Display usage help
* Build KaHIP (int32_t only)
$kahipPACKAGE
* Build kahip (int32_t only)
${PACKAGE:-[unspecified]}
USAGE
showDownloadHint KAHIP
exit 1
showDownloadHint kahip
exit 0 # Clean exit
}
#------------------------------------------------------------------------------
exportCompiler minimal # Minimal compiler info for CMake/configure
unset optForce
unset optForce optNoExtlib
optBinaries=false
optWithMPI=true
optLabelSize="${WM_LABEL_SIZE:-32}"
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
'') ;; # Ignore empty
-h | -help) usage ;;
-h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGccWmake ;;
-force) optForce=true ;;
-int32 | -int64) echo "ignoring $1" ;;
-bin | -no-bin) echo "ignoring $1" ;;
-bin) optBinaries=true ;;
-no-bin) optBinaries=false ;;
-no-mpi) optWithMPI=false ;;
-no-extlib) optNoExtlib=true ;; # Hidden option (experimental)
-cmake)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
CMAKE_PATH="${2%%/}"
shift
;;
-mpi-home) # mpi with hint
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
export MPI_HOME="${2%%/}"
case "${MPI_HOME:-none}" in (false|none) unset MPI_HOME;; esac
shift
;;
lib|libso)
targetType="$1"
;;
kahip-[0-9]* | kahip-git | KaHIP_* | KaHIP-[0-9]*)
kahipPACKAGE="${1%%/}"
PACKAGE="${1%%/}"
unset KAHIP_ARCH_PATH # Avoid inconsistency
;;
*)
@ -122,16 +145,12 @@ do
shift
done
[ -n "$kahipPACKAGE" ] || die "The kahip-VERSION was not specified"
# Nothing to build
if _foamIsNone $kahipPACKAGE
if [ -z "$PACKAGE" ]
then
echo "Using kahip-none (skip ThirdParty build of KAHIP)"
exit 0
elif _foamIsSystem $kahipPACKAGE
die "The KAHIP package/version not specified"
elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
then
echo "Using kahip-system"
echo "Using none/system (skip ThirdParty build of KAHIP)"
exit 0
fi
@ -148,65 +167,285 @@ case "$WM_COMPILER" in
;;
esac
requireWMakeToolchain
requireExtLibBin
if [ "$optNoExtlib" = true ]
then
unset FOAM_EXT_LIBBIN
else
requireExtLibBin
fi
#------------------------------------------------------------------------------
#
# Build KaHIP
#
# KAHIP_ARCH_PATH : installation directory
# KAHIP_SOURCE_DIR : location of the original sources
# KAHIP_ARCH_PATH : installation directory (as per config file)
#
# *PACKAGE : name-version of the package
# *SOURCE : location of original sources
# *PREFIX : installation directory
KAHIP_SOURCE_DIR=$sourceBASE/$kahipPACKAGE
KAHIP_ARCH_PATH=$installBASE/$kahipPACKAGE
PKG_SOURCE="$sourceBASE/$PACKAGE"
PACKAGE="$(basename "$PACKAGE")"
# Future: PKG_PREFIX="$installBASE$WM_SIZE_OPTIONS/$PACKAGE"
PKG_PREFIX="$installBASE/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
[ -d "$KAHIP_SOURCE_DIR" ] || {
echo "Missing sources: '$kahipPACKAGE'"
showDownloadHint KAHIP
# Override as per config file (if any)
[ -n "$KAHIP_ARCH_PATH" ] && PKG_PREFIX="$KAHIP_ARCH_PATH"
[ -d "$PKG_SOURCE" ] || {
echo "Missing sources: '$PACKAGE'"
showDownloadHint kahip
exit 2
}
#------------------------------------------------------------------------------
# - newer versions use CMake.
# - intermediate versions (eg, kahip-2.11) had CMakeLists but didn't install
# include/ which means the scons workaround is probably better.
# - very old versions only had scons.
# NB: the flags for 64bit indices in the header seem to be missing.
unset useWmakeWorkaround
if [ -f "$PKG_SOURCE/SConstruct" ]
then
# Use wmake for old scons builds
echo "Using wmake for the build..."
useWmakeWorkaround=true
requireWMakeToolchain
fi
#
# Manual installation of serial libraries
# from libdir to -> $FOAM_EXT_LIBBIN
#
install()
{
local bindir="$PKG_PREFIX"/bin
local libdir_source="$1"
local libdir_serial="$FOAM_EXT_LIBBIN"
local libdir_parallel="$FOAM_EXT_LIBBIN/$FOAM_MPI"
local libname_suffix="-int$WM_LABEL_SIZE"
[ -n "$FOAM_EXT_LIBBIN" ] || unset libdir_serial libdir_parallel
[ -n "$WM_LABEL_SIZE" ] || unset libname_suffix
echo
echo "Adjusting installation"
if [ "$optBinaries" = false ]
then
echo "Removing binaries: $bindir"
rm -rf "$bindir" 2>/dev/null # Failed removal is uncritical
fi
if [ -z "$libdir_source" ]
then
libdir_source="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH"
if [ ! -d "$libdir_source" ]
then
libdir_source="$PKG_PREFIX/lib"
fi
fi
# Before kahip-v3.12 built 'libinterface'. Rename this to 'libkahip'
(
cd "$libdir_source" || exit
libname="libkahip"
for name in libinterface
do
if [ -f "$name$EXT_SO" ]
then
rm -f "$libname$EXT_SO" "$libname$libname_suffix$EXT_SO"
mv "$name$EXT_SO" "$libname$EXT_SO"
echo "Renamed $name -> $libname"
break
fi
done
)
# Rename lib as xxx-intNN qualified library names (non-windows)
if [ -n "$libname_suffix" ] && [ "${EXT_SO:-.dll}" != ".dll" ]
then
(
cd "$libdir_source" || exit
echo "Tagging libraries with $libname_suffix"
for name in libkahip libparhip_interface
do
if [ -f "$name$EXT_SO" ]
then
mv "$name$EXT_SO" "$name$libname_suffix$EXT_SO"
ln -sf "$name$libname_suffix$EXT_SO" "$name$EXT_SO"
fi
done
)
fi
local libdir_target
# Serial
libdir_target="$libdir_serial"
if [ -n "$libdir_target" ]
then
# Remove old libraries/links
for name in libkahip libkahip_interface libparhip_interface
do
rm -f "$libdir_target/$name$EXT_SO"
rm -f "$libdir_target/$name$libname_suffix$EXT_SO"
done
mkdir -p "$libdir_target"
echo "Relocating serial libraries"
# echo "Installing: $libdir_target/libkahip$libname_suffix"
mv -f "$libdir_source"/libkahip*"$EXT_SO" "$libdir_target" 2>/dev/null
fi
# Parallel
libdir_target="$libdir_parallel"
if [ -n "$libdir_target" ]
then
# Remove old libraries/links
for name in libkahip libkahip_interface libparhip_interface
do
rm -f "$libdir_target/$name$EXT_SO"
rm -f "$libdir_target/$name$libname_suffix$EXT_SO"
done
mkdir -p "$libdir_target"
echo "Relocating parallel libraries"
# echo "Installing: $libdir_target/libparhip$libname_suffix"
mv -f "$libdir_source"/libparhip*"$EXT_SO" "$libdir_target" 2>/dev/null
fi
rmdir "$libdir_source" 2>/dev/null # Failed rmdir is uncritical
return 0
}
#
# Manual installation
#
install()
install_wmake()
{
# Ensure a clean build next time
local bindir="$PKG_PREFIX"/bin
local incdir="$PKG_PREFIX"/include
local libdir_source="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH"
local libdir_target="$FOAM_EXT_LIBBIN"
local libname_suffix="-int$WM_LABEL_SIZE"
[ -n "$WM_LABEL_SIZE" ] || unset libname_suffix
# Leave static libraries in sub-directory
if [ "$targetType" = lib ] || [ -z "$FOAM_EXT_LIBBIN" ]
then
unset libdir_target
fi
# Remove build artifacts from the source directory
# (for a clean build next time)
wclean
local bindir=$KAHIP_ARCH_PATH/bin
local incdir=$KAHIP_ARCH_PATH/include
local libdir=$KAHIP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
mkdir -m 0755 -p $incdir
echo
echo "Adjusting installation"
echo "Installing headers: $incdir"
mkdir -m 0755 -p "$incdir"
/bin/cp -pv \
$KAHIP_SOURCE_DIR/interface/kaHIP_interface.h \
$incdir
"$PKG_SOURCE"/interface/kaHIP_interface.h \
"$incdir"
# Rename lib as xxx-intNN qualified library names (non-windows)
if [ -n "$libname_suffix" ] && [ "${EXT_SO:-.dll}" != ".dll" ]
then
(
cd "$libdir_source" || exit
echo "Tagging libraries with $libname_suffix"
for name in libkahip libparhip_interface
do
if [ -f "$name$EXT_SO" ]
then
mv "$name$EXT_SO" "$name$libname_suffix$EXT_SO"
ln -sf "$name$libname_suffix$EXT_SO" "$name$EXT_SO"
fi
done
)
fi
if [ -n "$libdir_target" ]
then
# Remove old libraries/links
for name in libkahip libkahip_interface libparhip_interface
do
rm -f "$libdir_target/$name$EXT_SO"
rm -f "$libdir_target/$name$libname_suffix$EXT_SO"
done
mkdir -p "$libdir_target"
echo "Relocating serial libraries"
# echo "Installing: $libdir_target/libkahip$libname_suffix"
mv -f "$libdir_source"/libkahip*"$EXT_SO" "$libdir_target" 2>/dev/null
fi
rmdir "$libdir_source" 2>/dev/null # Failed rmdir is uncritical
return 0
}
# Newer KAHIP (>= 2.11) uses CMake,
# but unfortunately does not install include/
# nor pass through flags for 64bit indices in the header.
withCmake=true
version=$(echo "$kahipPACKAGE" | sed -e 's/^kahip[-_]*//i')
case "$version" in 2.0*) unset withCmake;; esac
if true
if [ "${useWmakeWorkaround:-false}" = false ]
then
(
echo "Starting build: $kahipPACKAGE ($targetType) using wmake"
echo "Starting build: $PACKAGE using cmake"
echo
cd "$KAHIP_SOURCE_DIR/lib" || exit
export GIT_DIR="$KAHIP_SOURCE_DIR/.git" # Mask seeing our own git-repo
PKG_BUILD="$buildBASE/$PACKAGE"
cd "$PKG_SOURCE" || exit
rm -rf "$KAHIP_ARCH_PATH"
rm -f "$FOAM_EXT_LIBBIN/libkahip$EXT_SO"
# Remove any existing build folder and recreate
rm -rf "$PKG_PREFIX"
rm -rf "$PKG_BUILD"
mkdir -p "$PKG_BUILD"
libdir=$KAHIP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
unset buildOpt
if [ "$optWithMPI" = false ]
then
buildOpt="${buildOpt} -DPARHIP=OFF"
fi
cmake=$(findCMake)
cd "$PKG_BUILD" && $cmake \
-B "$PKG_BUILD" \
-S "$PKG_SOURCE" \
-DCMAKE_INSTALL_PREFIX="$PKG_PREFIX" \
-DCMAKE_BUILD_TYPE=Release \
$buildOpt \
${WM_QUIET:+-DCMAKE_RULE_MESSAGES=OFF} \
&& make -j $WM_NCOMPPROCS \
&& make install \
&& install \
&& echo "Built: $PACKAGE"
) || {
echo "Error building: $PACKAGE"
exit 1
}
elif true
then
(
echo "Starting build: $PACKAGE ($targetType) using wmake"
echo
cd "$PKG_SOURCE/lib" || exit
rm -rf "$PKG_PREFIX"
rm -f "$FOAM_EXT_LIBBIN/libkahip"*
export KAHIP_LIB_DIR="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH"
mkdir -m 0755 -p "$KAHIP_LIB_DIR" 2>/dev/null
cpMakeFiles kahip 2>/dev/null
@ -215,19 +454,9 @@ then
ln -s ../interface interface
fi
# Place static libraries in sub-directory:
if [ "$targetType" = lib ]
then
mkdir -m 0755 -p $libdir 2>/dev/null
export FOAM_EXT_LIBBIN=$libdir
fi
# Location of lib sources for wmake
export KAHIP_LIB_SRC=$PWD
wmake -j $WM_NCOMPPROCS -s $targetType \
&& echo "Built: kahip" \
&& install
&& echo "Built: $PACKAGE" \
&& install_wmake
) || {
echo "Error building: kahip"
exit 1

143
makeMETIS
View File

@ -57,60 +57,65 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
echo " Check your OpenFOAM environment and installation"
exit 1
}
. etc/tools/ThirdPartyFunctions
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------
# Obtain version from OpenFOAM etc/config.sh file:
_foamConfig metis
metisPACKAGE=${METIS_VERSION:-metis-system}
PACKAGE="${METIS_VERSION:-system}"
targetType=libso
#------------------------------------------------------------------------------
usage() {
printVersions() { listPackageVersions metis; exit 0; }
printHelp() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: ${0##*/} [OPTION] [lib|libso] [METIS-VERSION]
Usage: ${0##*/} [OPTION] [lib|libso] [METIS-VERSION]
options:
-gcc Force use of gcc/g++
-int32 Use IDXTYPEWIDTH 32
-int64 Use IDXTYPEWIDTH 64
-bin Create metis binaries as well (default)
-no-bin Suppress creation of metis binaries
-help
-bin Create metis binaries as well
-no-bin Suppress creation of metis binaries (default)
-list List available unpacked source versions
-help Display usage help
* Build METIS (default: -int${WM_LABEL_SIZE:-32}) with
${metisPACKAGE:-'unspecified metis version'}
${PACKAGE:-[unspecified]}
USAGE
showDownloadHint METIS
exit 1
showDownloadHint metis
exit 0 # Clean exit
}
#------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure
unset optForce
optBinaries=true
optIntSize="${WM_LABEL_SIZE:-32}"
unset optForce optNoExtlib
optBinaries=false
optLabelSize="${WM_LABEL_SIZE:-32}"
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
'') ;; # Ignore empty
-h | -help) usage ;;
-h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGcc ;;
-force) echo "ignoring $1" ;;
-int32 | -int64) optIntSize="${1#-int}" ;;
-int32 | -int64) optLabelSize="${1#-int}" ;;
-bin) optBinaries=true ;;
-no-bin) optBinaries=false ;;
-no-extlib) optNoExtlib=true ;; # Hidden option (experimental)
lib|libso)
targetType="$1"
;;
metis-[0-9]*)
metisPACKAGE="${1%%/}"
PACKAGE="${1%%/}"
unset METIS_ARCH_PATH # Avoid inconsistency
;;
*)
@ -120,16 +125,12 @@ do
shift
done
[ -n "$metisPACKAGE" ] || die "The metis-VERSION was not specified"
# Nothing to build
if _foamIsNone $metisPACKAGE
if [ -z "$PACKAGE" ]
then
echo "Using metis-none (skip ThirdParty build of METIS)"
exit 0
elif _foamIsSystem $metisPACKAGE
die "The METIS package/version not specified"
elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
then
echo "Using metis-system"
echo "Using none/system (skip ThirdParty build of METIS)"
exit 0
fi
@ -144,21 +145,33 @@ case "$WM_COMPILER" in
;;
esac
requireExtLibBin
if [ "$optNoExtlib" = true ]
then
unset FOAM_EXT_LIBBIN
else
requireExtLibBin
fi
#------------------------------------------------------------------------------
#
# Build METIS
# METIS_ARCH_PATH : installation directory (as per config file)
#
# METIS_ARCH_PATH : installation directory
# METIS_SOURCE_DIR : location of the original sources
# *PACKAGE : name-version of the package
# *SOURCE : location of original sources
# *PREFIX : installation directory
METIS_SOURCE_DIR=$sourceBASE/$metisPACKAGE
: "${METIS_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$metisPACKAGE}"
PKG_SOURCE="$sourceBASE/$PACKAGE"
PACKAGE="$(basename "$PACKAGE")"
PKG_PREFIX="$installBASE$WM_SIZE_OPTIONS/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
[ -d "$METIS_SOURCE_DIR" ] || {
echo "Missing sources: '$metisPACKAGE'"
showDownloadHint METIS
# Override as per config file (if any)
[ -n "$METIS_ARCH_PATH" ] && PKG_PREFIX="$METIS_ARCH_PATH"
[ -d "$PKG_SOURCE" ] || {
echo "Missing sources: '$PACKAGE'"
showDownloadHint metis
exit 2
}
@ -167,30 +180,70 @@ METIS_SOURCE_DIR=$sourceBASE/$metisPACKAGE
#
install()
{
local bindir="$METIS_ARCH_PATH"/bin
local libdir="$METIS_ARCH_PATH"/lib
local bindir="$PKG_PREFIX"/bin
local libdir="$PKG_PREFIX"/lib
local libdir_target="$FOAM_EXT_LIBBIN"
local libname_suffix="-int$WM_LABEL_SIZE"
[ -n "$FOAM_EXT_LIBBIN" ] || unset libdir_target
[ -n "$WM_LABEL_SIZE" ] || unset libname_suffix
echo
echo "Adjusting installation"
if [ "$optBinaries" = false ]
then
echo "Removing binaries: $bindir"
rm -rf "$bindir" 2>/dev/null # Failed removal is uncritical
fi
if [ "$targetType" = libso ]
then
mv "$libdir/libmetis$EXT_SO" "$FOAM_EXT_LIBBIN"
rmdir "$libdir" 2>/dev/null # Failed rmdir is uncritical
# Rename lib as xxx-intNN qualified library names (non-windows)
if [ -n "$libname_suffix" ] && [ "${EXT_SO:-.dll}" != ".dll" ]
then
(
cd "$libdir" || exit
echo "Tagging libraries with $libname_suffix"
for name in libmetis
do
if [ -f "$name$EXT_SO" ]
then
mv "$name$EXT_SO" "$name$libname_suffix$EXT_SO"
ln -sf "$name$libname_suffix$EXT_SO" "$name$EXT_SO"
fi
done
)
fi
echo "Installing: $FOAM_EXT_LIBBIN/libmetis$EXT_SO"
if [ -n "$libdir_target" ]
then
# Remove old libraries and links
for name in libmetis
do
rm -f "$libdir_target/$name$EXT_SO"
rm -f "$libdir_target/$name$libname_suffix$EXT_SO"
done
mkdir -p "$libdir_target"
echo "Relocating serial libraries"
# echo "Installing: $libdir_target/libmetis"
mv -f "$libdir"/libmetis* "$libdir_target"
fi
fi
rmdir "$libdir" 2>/dev/null # Failed rmdir is uncritical
return 0
}
echo "Starting build: $metisPACKAGE ($targetType)"
if [ "$optIntSize" != "$WM_LABEL_SIZE" ]
echo "Starting build: $PACKAGE ($targetType)"
if [ "$optLabelSize" != "$WM_LABEL_SIZE" ]
then
echo "Using int-$optIntSize instead of int-$WM_LABEL_SIZE"
echo "Using int-$optLabelSize instead of int-$WM_LABEL_SIZE"
fi
export WM_LABEL_SIZE="$optLabelSize"
echo
(
# Configuration options:
@ -200,20 +253,18 @@ echo
configOpt="shared=1"
fi
cd "$METIS_SOURCE_DIR" || exit
export GIT_DIR="$PWD/.git" # Mask seeing our own git-repo
rm -rf "$METIS_ARCH_PATH"
cd "$PKG_SOURCE" || exit
rm -rf "$PKG_PREFIX"
rm -f "$FOAM_EXT_LIBBIN"/libmetis*
# Adjust metis IDXTYPEWIDTH (integer size)
sed -i -e 's=\(#define IDXTYPEWIDTH\).*=\1 '"$optIntSize"'=' \
sed -i -e 's=\(#define IDXTYPEWIDTH\).*=\1 '"$optLabelSize"'=' \
include/metis.h
# No config option for the library location.
# - build normally and use mv to relocate it
make config $configOpt prefix="$METIS_ARCH_PATH" \
make config $configOpt prefix="$PKG_PREFIX" \
&& make -j $WM_NCOMPPROCS install \
&& echo "Built: metis" \
&& install

View File

@ -27,20 +27,18 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
echo " Check your OpenFOAM environment and installation"
exit 1
}
. etc/tools/ThirdPartyFunctions
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------
_foamConfig scotch # Get SCOTCH_ARCH_PATH, SCOTCH_VERSION
scotchPACKAGE=${SCOTCH_VERSION:-scotch-system}
PACKAGE="${SCOTCH_VERSION:-system}"
unset withMPI
case "$WM_MPLIB" in (*MPI*) [ "$FOAM_MPI" = dummy ] || withMPI=true ;; esac
#------------------------------------------------------------------------------
usage()
{
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
printVersions() { listPackageVersions scotch; exit 0; }
printHelp() {
/bin/cat<<USAGE
Usage: ${0##*/} [OPTION] [libso] [scotch-VERSION]
@ -53,36 +51,39 @@ options:
-bin Create scotch binaries as well
-no-bin Suppress creation of scotch binaries (default)
-no-mpi Suppress build of pt-scotch
-help
-list List available unpacked source versions
-help Display usage help
* Build SCOTCH (default: -int${WM_LABEL_SIZE:-32}) with
$scotchPACKAGE
${PACKAGE:-[unspecified]}
USAGE
showDownloadHint SCOTCH
exit 1
showDownloadHint scotch
exit 0 # Clean exit
}
#------------------------------------------------------------------------------
unset optForce
unset optForce optNoExtlib
optBinaries=false
optIntSize="${WM_LABEL_SIZE:-32}"
optLabelSize="${WM_LABEL_SIZE:-32}"
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
'') ;; # Ignore empty
-h | -help) usage ;;
-h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGcc ;;
-force) optForce=true ;;
-int32 | -int64) optIntSize="${1#-int}" ;;
-int32 | -int64) optLabelSize="${1#-int}" ;;
-bin) optBinaries=true ;;
-no-bin) optBinaries=false ;;
-no-mpi) unset withMPI ;;
-no-extlib) optNoExtlib=true ;; # Hidden option
scotch-[0-9]* | scotch-git | scotch_* )
scotchPACKAGE="${1%%/}"
PACKAGE="${1%%/}"
unset SCOTCH_ARCH_PATH # Avoid inconsistency
;;
*)
@ -92,78 +93,279 @@ do
shift
done
[ -n "$scotchPACKAGE" ] || die "The scotch-VERSION was not specified"
# Nothing to build
if _foamIsNone "$scotchPACKAGE"
if [ -z "$PACKAGE" ]
then
echo "Using scotch-none (skip ThirdParty build of SCOTCH)"
exit 0
elif _foamIsSystem "$scotchPACKAGE"
die "The SCOTCH package/version not specified"
elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
then
echo "Using scotch-system"
echo "Using none/system (skip ThirdParty build of SCOTCH)"
exit 0
fi
requireExtLibBin
#------------------------------------------------------------------------------
# Needs generalizing, but works fairly well
for scotchMakefile in \
"OpenFOAM-$(uname -s)-${WM_COMPILER}.shlib" \
"OpenFOAM-$(uname -s).shlib" \
OpenFOAM-Linux.shlib \
;
do
scotchMakefile="etc/makeFiles/scotch/Makefile.inc.$scotchMakefile"
[ -f "$scotchMakefile" ] && break
done
# The relative link location within the "scotch/src/" directory
makefileInc="../../$scotchMakefile"
if [ "$optNoExtlib" = true ]
then
unset FOAM_EXT_LIBBIN
else
requireExtLibBin
fi
#------------------------------------------------------------------------------
#
# Build SCOTCH
# SCOTCH_ARCH_PATH : installation directory (as per config file)
#
# SCOTCH_ARCH_PATH : installation directory
# SCOTCH_SOURCE_DIR : location of the original sources
# *PACKAGE : name-version of the package
# *SOURCE : location of original sources
# *PREFIX : installation directory
SCOTCH_SOURCE_DIR="$sourceBASE/$scotchPACKAGE"
: "${SCOTCH_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$scotchPACKAGE}"
PKG_SOURCE="$sourceBASE/$PACKAGE"
PACKAGE="$(basename "$PACKAGE")"
PKG_PREFIX="$installBASE$WM_SIZE_OPTIONS/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
[ -d "$SCOTCH_SOURCE_DIR/src" ] || {
echo "Missing sources: '$scotchPACKAGE'"
showDownloadHint SCOTCH
# Override as per config file (if any)
[ -n "$SCOTCH_ARCH_PATH" ] && PKG_PREFIX="$SCOTCH_ARCH_PATH"
[ -d "$PKG_SOURCE/src" ] || {
echo "Missing sources: '$PACKAGE'"
showDownloadHint scotch
exit 2
}
#------------------------------------------------------------------------------
# Select a Makefile.inc for the scotch build
# - could use more generalizing, but works fairly well
unset MakefileInc
for ending in \
"$(uname -s)-${WM_COMPILER}".shlib \
"$(uname -s)".shlib \
Linux.shlib \
;
do
# Fully resolve path
file="$WM_THIRD_PARTY_DIR/etc/makeFiles/scotch/Makefile.inc.$ending"
if [ -f "$file" ]
then
MakefileInc="$file"
break
fi
done
# - copy OpenFOAM-specific Makefile include files into the scotch dir.
# - place a full copy into an 'openfoam/' directory (for documentation)
# - make symlink from the openfoam/Makefile.inc.XXX -> src/Makefile.inc
createMakefileLinks()
{
# Sanity checks
if [ -z "$MakefileInc" ]
then
echo "Did not define a Makefile.inc for"
echo " $PACKAGE/src"
return 1
elif [ ! -f "$MakefileInc" ]
then
echo "No such file to include:"
echo " $MakefileInc"
return 1
fi
if [ ! -d "$PKG_SOURCE"/src ] || [ ! -w "$PKG_SOURCE"/src ]
then
echo "Directory missing or not writable:"
echo " $PKG_SOURCE/src"
return 1
fi
# Copy files and make links
mkdir -p "$PKG_SOURCE"/openfoam
cp -p "$(dirname "$MakefileInc")"/* "$PKG_SOURCE"/openfoam
rm -f "$PKG_SOURCE"/src/Makefile.inc
(
cd "$PKG_SOURCE/src" && \
ln -sf ../openfoam/"$(basename "$MakefileInc")" Makefile.inc
)
}
#------------------------------------------------------------------------------
#
# Manual installation of serial libraries
# from libdir to -> $FOAM_EXT_LIBBIN
#
install_serial()
{
local libdir_source="$1"
local libdir_target="$FOAM_EXT_LIBBIN"
local libname_suffix="-int$WM_LABEL_SIZE"
[ -n "$FOAM_EXT_LIBBIN" ] || unset libdir_target
[ -n "$WM_LABEL_SIZE" ] || unset libname_suffix
echo
echo "Adjusting installation"
# Rename lib as xxx-intNN qualified library names (non-windows)
if [ -n "$libname_suffix" ] && [ "${EXT_SO:-.dll}" != ".dll" ]
then
(
cd "$libdir_source" || exit
echo "Tagging libraries with $libname_suffix"
for name in libscotch
do
if [ -f "$name$EXT_SO" ]
then
mv "$name$EXT_SO" "$name$libname_suffix$EXT_SO"
ln -sf "$name$libname_suffix$EXT_SO" "$name$EXT_SO"
fi
done
)
fi
if [ -n "$libdir_target" ]
then
# Remove old libraries and links
for name in libscotch
do
rm -f "$libdir_target/$name$EXT_SO"
rm -f "$libdir_target/$name$libname_suffix$EXT_SO"
done
mkdir -p "$libdir_target"
echo "Relocating serial libraries"
# echo "Installing: $libdir_target/libscotch$libname_suffix"
mv -f "$libdir_source"/lib* "$libdir_target"
fi
rmdir "$libdir_source" 2>/dev/null # Failed rmdir is uncritical
return 0
}
#
# Manual installation of parallel libraries
# from libdir to -> $FOAM_EXT_LIBBIN/$FOAM_MPI
#
install_parallel()
{
local libdir_source="$1"
local libdir_target="$FOAM_EXT_LIBBIN/$FOAM_MPI"
local libname_suffix="-int$WM_LABEL_SIZE"
local link_serial=false
[ -n "$FOAM_EXT_LIBBIN" ] || unset libdir_target
[ -n "$WM_LABEL_SIZE" ] || unset libname_suffix
echo
echo "Adjusting installation"
# Rename lib as xxx-intNN qualified library names (non-windows)
if [ -n "$libname_suffix" ] && [ "${EXT_SO:-.dll}" != ".dll" ]
then
(
cd "$libdir_source" || exit
echo "Tagging libraries with $libname_suffix"
# When linked, remove generated serial libraries
if [ "$link_serial" = true ]
then
rm -f libscotch*
fi
for name in libscotch libptscotch
do
if [ -f "$name$EXT_SO" ]
then
mv "$name$EXT_SO" "$name$libname_suffix$EXT_SO"
ln -sf "$name$libname_suffix$EXT_SO" "$name$EXT_SO"
fi
done
)
fi
if [ -n "$libdir_target" ]
then
# Remove old libraries and links
for name in libscotch libptscotch
do
rm -f "$libdir_target/$name$EXT_SO"
rm -f "$libdir_target/$name$libname_suffix$EXT_SO"
done
mkdir -p "$libdir_target"
echo "Relocating parallel libraries"
# echo "Installing: $libdir_target/libptscotch$libname_suffix"
mv -f "$libdir_source"/lib* "$libdir_target"
fi
# Create symlinks to serial versions?
if [ -n "$link_serial" ] && [ "${EXT_SO:-.dll}" != ".dll" ]
then
(
if [ -n "$libdir_target" ]
then
cd "$libdir_target" || exit
else
cd "$libdir_source" || exit
fi
for name in libscotch"$libname_suffix" libscotcherr*
do
if [ -f ../"$name$EXT_SO" ]
then
ln -sf ../"$name$EXT_SO" "$name$EXT_SO"
fi
done
for name in libscotch
do
if [ -f "$name$libname_suffix$EXT_SO" ]
then
ln -sf "$name$libname_suffix$EXT_SO" "$name$EXT_SO"
fi
done
)
fi
rmdir "$libdir_source" 2>/dev/null # Failed rmdir is uncritical
return 0
}
echo
echo ========================================
echo "scotch decomposition ($scotchPACKAGE)"
echo " Makefile.inc : ${makefileInc##*/}"
echo "scotch decomposition ($PACKAGE)"
echo " Makefile.inc : ${customMakefileInc##*/}"
# (serial) scotch
prefixDIR="$SCOTCH_ARCH_PATH"
binDIR="$prefixDIR"/bin
incDIR="$prefixDIR"/include
libDIR="$FOAM_EXT_LIBBIN"
if [ "$optIntSize" != "$WM_LABEL_SIZE" ]
bindir="$PKG_PREFIX"/bin
includedir="$PKG_PREFIX"/include
libdir="$FOAM_EXT_LIBBIN"
if [ -z "$FOAM_EXT_LIBBIN" ]
then
echo "Using int-$optIntSize instead of int-$WM_LABEL_SIZE"
export WM_LABEL_SIZE="$optIntSize"
libdir="$PKG_PREFIX"/lib
fi
if [ "$optLabelSize" != "$WM_LABEL_SIZE" ]
then
echo "Using int-$optLabelSize instead of int-$WM_LABEL_SIZE"
fi
export WM_LABEL_SIZE="$optLabelSize"
# Test installation. May or may not have libscotcherrexit.so
if [ -z "$optForce" ] \
&& [ -f "$incDIR"/scotch.h ] \
&& haveLibso "$libDIR"/libscotch
&& [ -f "$includedir"/scotch.h ] \
&& haveLibso "$libdir"/libscotch
then
echo " scotch include: $incDIR"
echo " scotch library: $libDIR"
elif [ -d "$SCOTCH_SOURCE_DIR" ]
echo " scotch include: $includedir"
echo " scotch library: $libdir"
elif [ -d "$PKG_SOURCE" ]
then
(
# Older versions ok, but scotch-6.0.5a cannot build in parallel.
@ -172,38 +374,36 @@ then
echo "*** building scotch in serial ***"
echo
[ -f "$scotchMakefile" ] || {
echo " Error: no such makefile: $scotchMakefile"
exit 1
}
cd "$PKG_SOURCE/src" || exit
cd "$SCOTCH_SOURCE_DIR/src" || exit
export GIT_DIR="$SCOTCH_SOURCE_DIR/.git" # Mask seeing our own git-repo
rm -rf "$SCOTCH_ARCH_PATH"
applyPatch "$PACKAGE" .. # patch at parent-level
createMakefileLinks || exit
applyPatch "$scotchPACKAGE" .. # patch at parent-level
mkdir -p "$binDIR" 2>/dev/null
mkdir -p "$incDIR" 2>/dev/null
mkdir -p "$libDIR" 2>/dev/null
if [ -f "$makefileInc" ]
then
rm -f Makefile.inc
ln -s "$makefileInc" Makefile.inc
fi
# Verify
[ -f Makefile.inc ] || {
echo " Error: scotch needs an appropriate Makefile.inc"
exit 1
}
# Fresh install
rm -rf "$PKG_PREFIX"
mkdir -p "$bindir" "$includedir" "$libdir"
# Temporary location for library install
libdir_tmp="$libdir"
if [ -n "$FOAM_EXT_LIBBIN" ]
then
libdir_tmp="$PKG_PREFIX"/lib-tmp
fi
export CCS="$(whichCC)" # CCS (serial compiler)
export CCP="$(whichMpicc)" # CCP (parallel compiler) default=mpicc
# Consistency for Intel-MPI and non-icc compilers
[ -n "$I_MPI_CC" ] || export I_MPI_CC="$(whichCC)"
# The make targets
# The make targets.
# - according to docs, cannot make binaries with suffix renaming
make_targets="libscotch"
if [ "$optBinaries" = true ]
then
@ -213,14 +413,23 @@ then
make realclean 2>/dev/null # Extra safety
make -j $WM_NCOMPPROCS $make_targets \
&& make \
prefix="$prefixDIR" \
bindir="$binDIR" \
libdir="$libDIR" \
includedir="$incDIR" \
prefix="$PKG_PREFIX" \
bindir="$bindir" \
includedir="$includedir" \
libdir="$libdir_tmp" \
install
rmdir "$binDIR" 2>/dev/null || true # Remove empty bin/
rmdir "${binDIR%/*}" 2>/dev/null || true # ... and empty parent
install_serial "$libdir_tmp"
sharedir="$PKG_PREFIX/share"
if [ "$optBinaries" = false ]
then
rm -rf "$sharedir/man" # No bins -> no manpages
fi
rmdir "$bindir" 2>/dev/null || true # Remove empty bin/
rmdir "${bindir%/*}" 2>/dev/null || true # ... and empty parent
rmdir "$sharedir" 2>/dev/null || true # Remove empty share/
make realclean 2>/dev/null || true # Failed cleanup is uncritical
) || warnBuildIssues SCOTCH
else
@ -253,12 +462,12 @@ esac
# Build ptscotch if normal scotch was built (has include and library)
# (reuse prefix/include/lib dirs set above)
if [ -f "$incDIR"/scotch.h ] \
&& haveLibso "$libDIR"/libscotch
if [ -f "$includedir"/scotch.h ] \
&& haveLibso "$libdir"/libscotch
then
echo
echo ========================================
echo "pt-scotch decomposition ($scotchPACKAGE with $FOAM_MPI)"
echo "pt-scotch decomposition ($PACKAGE with $FOAM_MPI)"
else
# Report that the above tests failed and pass-through the failure
echo "Skipping pt-scotch - no <scotch.h> found"
@ -266,81 +475,96 @@ else
fi
# (parallel) pt-scotch
prefixDIR="$SCOTCH_ARCH_PATH"
binDIR="$prefixDIR/bin/$FOAM_MPI"
incDIR="$prefixDIR/include/$FOAM_MPI"
libDIR="$FOAM_EXT_LIBBIN/$FOAM_MPI"
bindir="$PKG_PREFIX/bin/$FOAM_MPI"
includedir="$PKG_PREFIX/include/$FOAM_MPI"
libdir="$FOAM_EXT_LIBBIN/$FOAM_MPI"
if [ -z "$FOAM_EXT_LIBBIN" ]
then
libdir="$PKG_PREFIX/lib/$FOAM_MPI"
fi
if [ -z "$optForce" ] \
&& [ -f "$incDIR"/ptscotch.h ] \
&& haveLibso "$libDIR"/libptscotch
&& [ -f "$includedir"/ptscotch.h ] \
&& haveLibso "$libdir"/libptscotch
then
echo " ptscotch include: $incDIR"
echo " ptscotch library: $libDIR"
echo " ptscotch include: $includedir"
echo " ptscotch library: $libdir"
else
(
# Older versions ok, but scotch-6.0.5a cannot build in parallel.
# Force serial build
export WM_NCOMPPROCS=1
echo "*** building pt-scotch in serial ***"
[ -f "$scotchMakefile" ] || {
echo " Error: no such makefile: $scotchMakefile"
exit 1
}
cd "$SCOTCH_SOURCE_DIR/src" || exit
export GIT_DIR="$SCOTCH_SOURCE_DIR/.git" # Mask seeing our own git-repo
echo
mkdir -p "$binDIR" 2>/dev/null
mkdir -p "$incDIR" 2>/dev/null
mkdir -p "$libDIR" 2>/dev/null
cd "$PKG_SOURCE/src" || exit
createMakefileLinks || exit
if [ -f "$makefileInc" ]
then
rm -f Makefile.inc
ln -s "$makefileInc" Makefile.inc
fi
# Verify
[ -f Makefile.inc ] || {
echo " Error: ptscotch needs an appropriate Makefile.inc"
exit 1
}
# Install into existing prefix
mkdir -p "$bindir" "$includedir" "$libdir"
# Temporary location for library install
libdir_tmp="$libdir"
if [ -n "$FOAM_EXT_LIBBIN" ]
then
libdir_tmp="$PKG_PREFIX"/lib-tmp
fi
export CCS="$(whichCC)" # CCS (serial compiler)
export CCP="$(whichMpicc)" # CCP (parallel compiler) default=mpicc
# Consistency for Intel-MPI and non-icc compilers
[ -n "$I_MPI_CC" ] || export I_MPI_CC="$(whichCC)"
# The make targets. No simple means of handling mpi-specific binaries
# The make targets.
# - no simple means of handling mpi-specific binaries
# - according to docs, cannot make binaries with suffix renaming
make_targets="libptscotch"
if [ "$optBinaries" = true ]
then
make_targets="$make_targets ptscotch"
fi
# Remove any old symlinks etc
rm -rf "$includedir"/scotch*.h 2>/dev/null
rm -rf "$libdir"/libscotch*.so 2>/dev/null
make realclean 2>/dev/null # Extra safety
make -j $WM_NCOMPPROCS $make_targets \
&& make \
prefix="$prefixDIR" \
bindir="$binDIR" \
libdir="$libDIR" \
includedir="$incDIR" \
prefix="$PKG_PREFIX" \
bindir="$bindir" \
includedir="$includedir" \
libdir="$libdir_tmp" \
install
rmdir "$binDIR" 2>/dev/null || true # Remove empty bin/
rmdir "${binDIR%/*}" 2>/dev/null || true # ... and empty parent
install_parallel "$libdir_tmp"
sharedir="$PKG_PREFIX/share"
if [ "$optBinaries" = false ]
then
rm -rf "$sharedir/man" # No bins -> no manpages
fi
rmdir "$bindir" 2>/dev/null || true # Remove empty bin/
rmdir "${bindir%/*}" 2>/dev/null || true # ... and empty parent
rmdir "$sharedir" 2>/dev/null || true # Remove empty share/
make realclean 2>/dev/null || true # Failed cleanup is uncritical
) || warnBuildIssues PTSCOTCH
fi
# Verify existence of ptscotch include
[ -f "$SCOTCH_ARCH_PATH/include/$FOAM_MPI/ptscotch.h" ] || {
[ -f "$PKG_PREFIX/include/$FOAM_MPI/ptscotch.h" ] || {
echo
echo " WARNING: required include file 'ptscotch.h' not found!"
}
# Could now remove $SCOTCH_SOURCE_DIR/src/Makefile.inc
# Could remove $PKG_SOURCE/src/Makefile.inc, but leave for documentation
#------------------------------------------------------------------------------