2012-04-12 20:56:44 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# ========= |
|
2013-12-11 16:09:41 +00:00
|
|
|
# \\ / F ield | foam-extend: Open Source CFD
|
2012-04-12 20:56:44 +00:00
|
|
|
# \\ / O peration |
|
2013-12-11 16:09:41 +00:00
|
|
|
# \\ / A nd | For copyright notice see file Copyright
|
2012-04-12 20:56:44 +00:00
|
|
|
# \\/ M anipulation |
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# License
|
2013-12-11 16:09:41 +00:00
|
|
|
# This file is part of foam-extend.
|
2012-04-12 20:56:44 +00:00
|
|
|
#
|
2013-12-11 16:09:41 +00:00
|
|
|
# foam-extend is free software: you can redistribute it and/or modify it
|
|
|
|
# under the terms of the GNU General Public License as published by the
|
|
|
|
# Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
# option) any later version.
|
2012-04-12 20:56:44 +00:00
|
|
|
#
|
2013-12-11 16:09:41 +00:00
|
|
|
# foam-extend is distributed in the hope that it will be useful, but
|
|
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# General Public License for more details.
|
2012-04-12 20:56:44 +00:00
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2013-12-11 16:09:41 +00:00
|
|
|
# along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
2012-04-12 20:56:44 +00:00
|
|
|
#
|
|
|
|
# Script
|
|
|
|
# AllMake.stage5
|
|
|
|
#
|
|
|
|
# Description
|
|
|
|
# Build script for ThirdParty packages not requiring rpm packaging
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Requirements:
|
|
|
|
# 1: Your OpenFOAM environment must be properly initialized
|
2012-04-18 02:51:22 +00:00
|
|
|
# 2: OpenFOAM must already been compiled because swak4Foam depends on
|
|
|
|
# OpenFOAM include files and libraries
|
2012-04-12 20:56:44 +00:00
|
|
|
#
|
|
|
|
# Author:
|
|
|
|
# Martin Beaudoin, Hydro-Quebec, (2012)
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# run from Third-party directory only
|
|
|
|
cd ${0%/*} || exit 1
|
|
|
|
|
|
|
|
wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
|
|
|
|
echo "Error: Current directory is not \$WM_THIRD_PARTY_DIR"
|
|
|
|
echo " The environment variables are inconsistent with the installation."
|
|
|
|
echo " Check the OpenFOAM entries in your dot-files and source them."
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
echo "========================================"
|
|
|
|
echo "Starting ThirdParty AllMake: Stage5 "
|
|
|
|
echo "========================================"
|
|
|
|
echo
|
|
|
|
|
2013-12-28 16:08:01 +00:00
|
|
|
# swak4Foam - Version 0.3.0
|
2012-04-18 03:11:57 +00:00
|
|
|
# In fact, we are basically tracking the head branch from the Mercurial repository
|
2013-12-28 16:08:01 +00:00
|
|
|
# which is also replicated under the Breeder_2.0 section of the Subversion repository
|
2012-04-18 03:11:57 +00:00
|
|
|
#
|
2013-08-21 15:52:20 +00:00
|
|
|
|
2013-12-28 16:08:01 +00:00
|
|
|
SWAK_RELEASE_VERSION=0.3.0
|
2013-08-21 15:52:20 +00:00
|
|
|
|
2013-07-05 03:27:55 +00:00
|
|
|
if [ -z "$SWAK4FOAM_SYSTEM" ]
|
2012-04-12 20:56:44 +00:00
|
|
|
then
|
|
|
|
# Do we need to download the source code?
|
|
|
|
# We choose to put the source code under ./rpmBuild/BUILD prior to compiling.
|
|
|
|
# We will not generate a rpm package, but all ThirdParty source code will be
|
|
|
|
# centralized under the same scratch area
|
2013-08-21 15:52:20 +00:00
|
|
|
if [ ! -e ./rpmBuild/BUILD/swak4Foam-$SWAK_RELEASE_VERSION ];
|
2012-04-12 20:56:44 +00:00
|
|
|
then
|
|
|
|
echo "Checking for a Mercurial client: hg"
|
|
|
|
command -v hg >/dev/null
|
|
|
|
if [ $? -eq 0 ];
|
|
|
|
then
|
2012-04-18 03:11:57 +00:00
|
|
|
echo "Using Mercurial/hg to download the source code for swak4Foam"
|
2013-07-05 03:27:55 +00:00
|
|
|
(
|
|
|
|
cd ./rpmBuild/BUILD;
|
2013-08-21 15:52:20 +00:00
|
|
|
hg clone http://hg.code.sf.net/p/openfoam-extend/swak4Foam swak4Foam-$SWAK_RELEASE_VERSION;
|
|
|
|
cd swak4Foam-$SWAK_RELEASE_VERSION;
|
2013-12-28 16:08:01 +00:00
|
|
|
hg checkout version_${SWAK_RELEASE_VERSION}_v2.x
|
2013-07-05 03:27:55 +00:00
|
|
|
)
|
2012-04-12 20:56:44 +00:00
|
|
|
else
|
|
|
|
echo "Warning: Mercurial/hg is not installed. Switching to an alternate Subversion repository"
|
|
|
|
command -v svn >/dev/null
|
|
|
|
if [ $? -eq 0 ];
|
|
|
|
then
|
2012-04-18 03:11:57 +00:00
|
|
|
echo "Using Subversion/svn to download the source code for swak4Foam"
|
2013-12-28 16:08:01 +00:00
|
|
|
echo "Error: current Subversion-version does not support foam3. Please install mercurial"
|
|
|
|
exit -1
|
2013-08-21 15:52:20 +00:00
|
|
|
(cd ./rpmBuild/BUILD; svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.7/libraries/swak4Foam swak4Foam-$SWAK_RELEASE_VERSION)
|
2012-04-12 20:56:44 +00:00
|
|
|
else
|
|
|
|
echo "Error: Please install either a Mercurial or Subversion client in order to download the source code for swak4Foam"
|
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
# We move the compilation results directly to $FOAM_SITE_APPBIN and $FOAM_SITE_LIBBIN
|
|
|
|
# If you prefer to keep the libraries and tools under $FOAM_USER_LIBBIN and $FOAM_USER_APPBIN, simply
|
|
|
|
# comment out the next two lines
|
2013-08-21 15:52:20 +00:00
|
|
|
(cd ./rpmBuild/BUILD/swak4Foam-$SWAK_RELEASE_VERSION; find . -name files | xargs -n 1 sed -i.old "s/FOAM_USER/FOAM_SITE/g")
|
|
|
|
(cd ./rpmBuild/BUILD/swak4Foam-$SWAK_RELEASE_VERSION; find . -name options | xargs -n 1 sed -i.old "s/FOAM_USER/FOAM_SITE/g")
|
2012-04-12 20:56:44 +00:00
|
|
|
|
|
|
|
# We recompile everything
|
2013-08-21 15:52:20 +00:00
|
|
|
(cd ./rpmBuild/BUILD/swak4Foam-$SWAK_RELEASE_VERSION; ./Allwclean; ./Allwmake)
|
2012-04-12 20:56:44 +00:00
|
|
|
else
|
2013-08-21 15:52:20 +00:00
|
|
|
echo "The source code for swak4Foam is already present under ./rpmBuild/BUILD/swak4Foam-$SWAK_RELEASE_VERSION"
|
2013-07-05 03:27:55 +00:00
|
|
|
echo "Please remove this directory if you want to refresh your installation of swak4Foam"
|
2012-04-12 20:56:44 +00:00
|
|
|
fi
|
|
|
|
echo ""
|
|
|
|
else
|
|
|
|
echo "Using system installed swak4Foam"
|
|
|
|
echo ""
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "========================================"
|
|
|
|
echo "Done ThirdParty AllMake: Stage5 "
|
|
|
|
echo "========================================"
|
|
|
|
echo
|
|
|
|
|
|
|
|
# ----------------------------------------------------------------- end-of-file
|