|
| 1 | +#!/bin/bash |
| 2 | +#Arg 1 : Build directory. Example: C:\temp\builds\mysql-4.2\5.6.46-42010-SPW-370. |
| 3 | +#Arg 2 : mysql tag (version). Example: 5.6.46 |
| 4 | +#Arg 3 : Sparrow build number. Example: 42010-SPW-370 |
| 5 | +#Arg 4 : win64 or win32. |
| 6 | + |
| 7 | +echo "Source directory $1" |
| 8 | +echo "Mysql version $2" |
| 9 | +echo "Build number $3" |
| 10 | +echo "Build type $4" |
| 11 | + |
| 12 | +generate() { |
| 13 | +# First delete any previous zip file left behind |
| 14 | +rm -f $2 $3 $4 |
| 15 | + |
| 16 | +pushd $1 |
| 17 | +rm -rf share/Makefile* share/*.sql share/*.txt |
| 18 | +zip -r -9 $2 bin share |
| 19 | +popd |
| 20 | +pushd storage/sparrow/udf/$5 |
| 21 | +rm -rf lib |
| 22 | +mkdir lib |
| 23 | +mkdir lib/plugin |
| 24 | +cp sparrowudf.dll lib/plugin/ |
| 25 | +cp sparrowudf.lib lib/plugin/ |
| 26 | +cp sparrowudf.pdb lib/plugin/ |
| 27 | +zip -r -9 $2 lib |
| 28 | +rm -rf lib |
| 29 | +popd |
| 30 | + |
| 31 | +pushd ../../storage/sparrow/api |
| 32 | +zip -r -9 $3 include |
| 33 | +popd |
| 34 | +pushd storage/sparrow/$5 |
| 35 | +zip -r -9 $3 sparrowapi.dll sparrowapi.lib sparrowapi.pdb |
| 36 | +popd |
| 37 | + |
| 38 | +pushd $1 |
| 39 | +zip -r -9 $4 include |
| 40 | +popd |
| 41 | +pushd libmysql/$5 |
| 42 | +zip -r -9 $4 libmysql.dll libmysql.lib libmysql.pdb |
| 43 | +popd |
| 44 | +} |
| 45 | + |
| 46 | +build_dir=$1/_build |
| 47 | +cd $build_dir |
| 48 | + |
| 49 | + |
| 50 | +if [ $4 = "win32" ]; then |
| 51 | + |
| 52 | +# Create win32 build dir, where cmake will output all its files and where the build is going to take place. Example: C:\temp\builds\mysql-4.2\5.6.46-42010-SPW-370\_build\win32 |
| 53 | +echo `date` "Creating win32 sub-dir of _build. Removing previous win32 sub-dir if it existed." |
| 54 | +rm -rf win32 |
| 55 | +mkdir win32 |
| 56 | +cd win32 |
| 57 | + |
| 58 | +echo `date` "Starting win32 cmake." |
| 59 | +cmake ../.. -DCOMPILATION_COMMENT="build: $3" -G "Visual Studio 16 2019" -A x86 -DWITH_EMBEDDED_SERVER=0 -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 -DWITH_SSL=T:\\core\\22.2\\openssl\\1.1.1s\\win32 |
| 60 | +res=$? |
| 61 | +if [ $res -ne 0 ]; then |
| 62 | +echo `date` "Win32 cmake of source code failed." |
| 63 | +exit $res |
| 64 | +fi |
| 65 | + |
| 66 | +echo `date` "Starting win32 debug build" |
| 67 | +devenv mysql.sln /build Debug /project ALL_BUILD /out build_win32_debug.log |
| 68 | +res=$? |
| 69 | +if [ $res -ne 0 ]; then |
| 70 | +echo `date` "Debug build of source code failed." |
| 71 | +exit $res |
| 72 | +fi |
| 73 | + |
| 74 | +echo `date` "Generating debug package" |
| 75 | +devenv mysql.sln /build Debug /project package /out build_win32_debug.log |
| 76 | +res=$? |
| 77 | +if [ $res -ne 0 ]; then |
| 78 | +echo `date` "Packaging failed." |
| 79 | +exit $res |
| 80 | +fi |
| 81 | + |
| 82 | +echo `date` "Packaging done. Zipping debug distribution packages" |
| 83 | +mkdir -p $1/_distrib/win32 |
| 84 | +distrib_dir=$1/_distrib/win32 |
| 85 | +generate _CPack_Packages/win32/ZIP/mysql-$2-winx32 $distrib_dir/mysql_debug.zip $distrib_dir/sparrowapi_debug.zip $distrib_dir/mysqlapi_debug.zip Debug 2>&1 |
| 86 | + |
| 87 | + |
| 88 | +echo `date` "Starting win32 release build" |
| 89 | +devenv mysql.sln /build RelWithDebInfo /project ALL_BUILD /out build_win32_release.log |
| 90 | +res=$? |
| 91 | +if [ $res -ne 0 ]; then |
| 92 | +echo `date` "Release build of source code failed." |
| 93 | +exit $res |
| 94 | +fi |
| 95 | + |
| 96 | +echo `date` "Generating release package" |
| 97 | +devenv mysql.sln /build RelWithDebInfo /project package /out build_win32_release.log |
| 98 | +res=$? |
| 99 | +if [ $res -ne 0 ]; then |
| 100 | +echo `date` "Packaging failed." |
| 101 | +exit $res |
| 102 | +fi |
| 103 | + |
| 104 | +echo `date` "Packaging done. Zipping debug distribution packages" |
| 105 | +generate _CPack_Packages/win32/ZIP/mysql-$2-winx32 $distrib_dir/mysql_release.zip $distrib_dir/sparrowapi_release.zip $distrib_dir/mysqlapi_release.zip RelWithDebInfo 2>&1 |
| 106 | + |
| 107 | + |
| 108 | +echo `date` "Generating initial database" |
| 109 | +devenv mysql.sln /build RelWithDebInfo /project initial_database /out build_win32_release.log |
| 110 | +res=$? |
| 111 | +if [ $res -ne 0 ]; then |
| 112 | +echo `date` "Initial database build failed." |
| 113 | +exit $res |
| 114 | +fi |
| 115 | + |
| 116 | +echo `date` "Cleaning up debug build" |
| 117 | +rm -rf _CPack_Packages |
| 118 | +devenv mysql.sln /clean Debug /out build_win32_debug.log |
| 119 | + |
| 120 | +echo `date` "Cleaning up release build" |
| 121 | +rm -rf _CPack_Packages |
| 122 | +devenv mysql.sln /clean RelWithDebInfo /out build_win32_release.log |
| 123 | + |
| 124 | +echo `date` "Win32 build finished" |
| 125 | + |
| 126 | +else |
| 127 | + |
| 128 | +# Create win64 build dir, where cmake will output all its files and where the build is going to take place. Example: R:\Sparrow\4.0\5.5.27-40061\_build\win64 |
| 129 | +echo `date` "Creating win64 sub-dir of _build. Removing previous win64 sub-dir if it existed." |
| 130 | +rm -rf win64 |
| 131 | +mkdir win64 |
| 132 | +cd win64 |
| 133 | + |
| 134 | +echo `date` "Starting win64 cmake." |
| 135 | +cmake ../.. -DCOMPILATION_COMMENT="build: $3" -G "Visual Studio 16 2019" -A x64 -DWITH_EMBEDDED_SERVER=0 -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 -DWITH_SSL=T:\\core\\22.2\\openssl\\1.1.1s\\win64 |
| 136 | +res=$? |
| 137 | +if [ $res -ne 0 ]; then |
| 138 | +echo `date` "Win64 cmake of source code failed." |
| 139 | +exit $res |
| 140 | +fi |
| 141 | + |
| 142 | +echo `date` "Starting win64 debug build" |
| 143 | +devenv mysql.sln /build Debug /project ALL_BUILD /out build_win64_debug.log |
| 144 | +res=$? |
| 145 | +if [ $res -ne 0 ]; then |
| 146 | +echo `date` "Debug build of source code failed." |
| 147 | +exit $res |
| 148 | +fi |
| 149 | + |
| 150 | +echo `date` "Generating debug package" |
| 151 | +devenv mysql.sln /build Debug /project package /out build_win64_debug.log |
| 152 | +res=$? |
| 153 | +if [ $res -ne 0 ]; then |
| 154 | +echo `date` "Packaging failed." |
| 155 | +exit $res |
| 156 | +fi |
| 157 | + |
| 158 | +echo `date` "Packaging done. Zipping debug distribution packages" |
| 159 | +mkdir -p $1/_distrib/win64 |
| 160 | +distrib_dir=$1/_distrib/win64 |
| 161 | +generate _CPack_Packages/win64/ZIP/mysql-$2-winx64 $distrib_dir/mysql_debug.zip $distrib_dir/sparrowapi_debug.zip $distrib_dir/mysqlapi_debug.zip Debug 2>&1 |
| 162 | + |
| 163 | + |
| 164 | +echo `date` "Starting win64 release build" |
| 165 | +devenv mysql.sln /build RelWithDebInfo /project ALL_BUILD /out build_win64_release.log |
| 166 | +res=$? |
| 167 | +if [ $res -ne 0 ]; then |
| 168 | +echo `date` "Release build of source code failed." |
| 169 | +exit $res |
| 170 | +fi |
| 171 | + |
| 172 | +echo `date` "Generating release package" |
| 173 | +devenv mysql.sln /build RelWithDebInfo /project package /out build_win64_release.log |
| 174 | +res=$? |
| 175 | +if [ $res -ne 0 ]; then |
| 176 | +echo `date` "Packaging failed." |
| 177 | +exit $res |
| 178 | +fi |
| 179 | + |
| 180 | +echo `date` "Packaging done. Zipping debug distribution packages" |
| 181 | +generate _CPack_Packages/win64/ZIP/mysql-$2-winx64 $distrib_dir/mysql_release.zip $distrib_dir/sparrowapi_release.zip $distrib_dir/mysqlapi_release.zip RelWithDebInfo 2>&1 |
| 182 | + |
| 183 | + |
| 184 | +echo `date` "Generating initial database" |
| 185 | +devenv mysql.sln /build RelWithDebInfo /project initial_database /out build_win64_release.log |
| 186 | +res=$? |
| 187 | +if [ $res -ne 0 ]; then |
| 188 | +echo `date` "Initial database build failed." |
| 189 | +exit $res |
| 190 | +fi |
| 191 | + |
| 192 | +#echo `date` "Cleaning up debug build" |
| 193 | +#rm -rf _CPack_Packages |
| 194 | +#devenv mysql.sln /clean Debug /out build_win64_debug.log |
| 195 | + |
| 196 | +#echo `date` "Cleaning up release build" |
| 197 | +#rm -rf _CPack_Packages |
| 198 | +#devenv mysql.sln /clean RelWithDebInfo /out build_win64_release.log |
| 199 | + |
| 200 | +echo `date` "Win64 build finished" |
| 201 | +fi |
0 commit comments