Merge commit 'b5be6201e00421a59e574a07b3d28cde5defff84'
[foam-extend-4.0.git] / bin / createWindowsBinaryPackage
blob805ee44d68223698b833f7d8bea751fe3057505b
1 #!/bin/sh
2 #----------------------------------*-sh-*--------------------------------------
3 # ========= |
4 # \\ / F ield | foam-extend: Open Source CFD
5 # \\ / O peration | Version: 4.0
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 to lib directory ..."
89 mkdir $PACKAGE_DIR/lib
90 cp -p $FOAM_LIBBIN/*.dll $PACKAGE_DIR/lib
92 echo "Copying extra files to bin directory ..."
93 cp -p $WM_PROJECT_DIR/bin/paraFoam.bat $PACKAGE_DIR/bin
94 unix2dos $PACKAGE_DIR/bin/paraFoam.bat
96 echo "Copying extra files to etc directory ..."
97 mkdir $PACKAGE_DIR/etc
98 cp -p $WM_PROJECT_DIR/etc/cellModels $PACKAGE_DIR/etc
99 cp -rp $WM_PROJECT_DIR/etc/thermoData $PACKAGE_DIR/etc
100 cp -p $WM_PROJECT_DIR/bin/foamWindowsEnvironment.bat $PACKAGE_DIR/etc
101 cp -p $WM_PROJECT_DIR/bin/foamWindowsShell.bat $PACKAGE_DIR/etc
102 unix2dos $PACKAGE_DIR/etc/foamWindowsEnvironment.bat
103 unix2dos $PACKAGE_DIR/etc/foamWindowsShell.bat
105 echo "Copying doc and license files ..."
106 cp -p $WM_PROJECT_DIR/doc/buildInstructions/Windows/READMEBinaryPackage.txt $PACKAGE_DIR/README.txt
107 cp -p $WM_PROJECT_DIR/COPYING $PACKAGE_DIR/LICENSE.txt
108 unix2dos $PACKAGE_DIR/LICENSE.txt
109 unix2dos $PACKAGE_DIR/README.txt
111 echo "Creating archives ..."
112 create_package $PACKAGE_DIR zip
113 create_package $PACKAGE_DIR 7z
115 echo "Removing package directory ..."
116 rm -rf $PACKAGE_DIR
118 echo "All done!"