Bugfix: Windows scotch compilation
[foam-extend-3.2.git] / bin / createWindowsBinaryPackage
blob43cb0b94d25782ee85f7dfeca8fcd328f2d44c61
1 #!/bin/sh
2 #----------------------------------*-sh-*--------------------------------------
3 # ========= |
4 # \\ / F ield | foam-extend: Open Source CFD
5 # \\ / O peration | Version: 3.2
6 # \\ / A nd | Web: http://www.foam-extend.org
7 # \\/ M anipulation | For copyright notice see file Copyright
8 #------------------------------------------------------------------------------
9 # License
10 # This file is part of foam-extend.
12 # foam-extend is free software: you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by the
14 # Free Software Foundation, either version 3 of the License, or (at your
15 # option) any later version.
17 # foam-extend is distributed in the hope that it will be useful, but
18 # WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 # General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
25 # Script
26 # createWindowsBinaryPackage
28 # Description
29 # Creates stand-alone .zip packages for MinGW-based builds on Windows.
31 # Author:
32 # Cesare Guardino, Alstom Power Ltd., (2015)
34 #------------------------------------------------------------------------------
36 cd ${0%/*} || exit 1 # run from this directory
38 create_package() {
39 PACKAGE_DIR=$1
40 TYPE=$2
42 echo ""
44 PACKAGE_FILE=$PACKAGE_DIR.$TYPE
45 if [ -f $PACKAGE_FILE ] ; then
46 echo "Removing previous $PACKAGE_FILE ..."
47 rm -f $PACKAGE_FILE
50 echo "Creating $PACKAGE_FILE ..."
51 7z -t$TYPE a $PACKAGE_FILE $PACKAGE_DIR
53 if [ -f $PACKAGE_FILE ] ; then
54 echo "Successfully created $PACKAGE_FILE"
55 else
56 echo "Failed to create $PACKAGE_FILE"
60 echo
61 echo "=========== FOAM-EXTEND STAND-ALONE PACKAGE CREATION SCRIPT FOR WINDOWS ==========="
63 if [ "$PWD" != "$WM_PROJECT_DIR/bin" ]
64 then
65 echo "Error: Current directory is not \$WM_PROJECT_DIR/bin"
66 echo " The environment variable are not consistent with the installation."
67 echo " Check the OpenFOAM entries in your dot-files and source them."
68 exit 1
71 RELEASE_DIR=$WM_PROJECT_DIR/releasePackages
72 if [ ! -d $RELEASE_DIR ] ; then
73 echo "Creating $RELEASE_DIR ..."
74 mkdir $RELEASE_DIR
77 PACKAGE_DIR=$RELEASE_DIR/$WM_PROJECT-$WM_FORK-$WM_PROJECT_VERSION-win-x64
78 if [ -d $PACKAGE_DIR ] ; then
79 echo "Removing previous $PACKAGE_DIR ..."
80 rm -rf $PACKAGE_DIR
82 echo "Creating $PACKAGE_DIR ..."
83 mkdir $PACKAGE_DIR
85 echo "Copying bin directory ..."
86 cp -rp $FOAM_APPBIN $PACKAGE_DIR/bin
88 echo "Copying DLLs from lib directory ..."
89 mkdir $PACKAGE_DIR/lib
90 cp -p $FOAM_LIBBIN/*.dll $PACKAGE_DIR/lib
92 echo "Copying extra files from bin directory ..."
93 cp -p $WM_PROJECT_DIR/bin/setWindowsEnvironment.bat $PACKAGE_DIR/
94 cp -p $WM_PROJECT_DIR/bin/foamWindowsShell.bat $PACKAGE_DIR/
95 cp -p $WM_PROJECT_DIR/bin/paraFoam.bat $PACKAGE_DIR/bin
97 echo "Copying extra files from etc directory ..."
98 mkdir $PACKAGE_DIR/etc
99 cp -p $WM_PROJECT_DIR/etc/cellModels $PACKAGE_DIR/etc
100 cp -rp $WM_PROJECT_DIR/etc/thermoData $PACKAGE_DIR/etc
102 echo "Copying doc and license files ..."
103 cp -p $WM_PROJECT_DIR/doc/buildInstructions/Windows/READMEBinaryPackage.txt $PACKAGE_DIR/
104 cp -p $WM_PROJECT_DIR/COPYING $PACKAGE_DIR/LICENSE.txt
105 unix2dos $PACKAGE_DIR/LICENSE.txt
107 create_package $PACKAGE_DIR zip
108 create_package $PACKAGE_DIR 7z
110 rm -rf $PACKAGE_DIR