Skip to content

Commit

Permalink
win32*.sh: Cleanup zip archive creation
Browse files Browse the repository at this point in the history
Use a temporary directory and symlinks to create the final zip archive
within a single 'ceph' parent directory. Also include the win32 README,
and report the name of the resulting zip file.

Signed-off-by: Mike Latimer <[email protected]>
Signed-off-by: Alessandro Pilotti <[email protected]>
Signed-off-by: Lucian Petrut <[email protected]>
  • Loading branch information
ml8mr authored and petrutlucian94 committed Dec 9, 2020
1 parent f42e947 commit 8e84b00
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions win32_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ SKIP_BUILD=${SKIP_BUILD:-}
SKIP_CMAKE=${SKIP_CMAKE:-}
SKIP_DLL_COPY=${SKIP_DLL_COPY:-}
SKIP_TESTS=${SKIP_TESTS:-}
SKIP_BINDIR_CLEAN=${SKIP_BINDIR_CLEAN:-}
NUM_WORKERS=${NUM_WORKERS:-$num_vcpus}
DEV_BUILD=${DEV_BUILD:-}
BUILD_ZIP=${BUILD_ZIP:-}
Expand Down Expand Up @@ -85,6 +86,10 @@ if [[ -n $CLEAN_BUILD ]]; then
rm -rf $BUILD_DIR
rm -rf $DEPS_DIR
fi
if [[ -z $SKIP_BINDIR_CLEAN ]]; then
echo "Cleaning up bin dir: $binDir"
rm -rf $binDir
fi

if [[ ! -f ${depsToolsetDir}/completed ]]; then
echo "Preparing dependencies: $DEPS_DIR"
Expand Down Expand Up @@ -177,13 +182,26 @@ if [[ -z $SKIP_DLL_COPY ]]; then
fi

if [[ -n $BUILD_ZIP ]]; then
# Use a temp directory, in order to create a clean zip file
ZIP_TMPDIR=$(mktemp -d win_binaries.XXXXX)
if [[ -n $STRIP_ZIPPED ]]; then
rm -rf $strippedBinDir
echo "Copying binaries to $strippedBinDir."
cp -r $binDir $strippedBinDir
echo "Stripping debug symbols from $strippedBinDir binaries."
echo "Stripping debug symbols from binaries."
$MINGW_STRIP $strippedBinDir/*.exe \
$strippedBinDir/*.dll
ln -s $strippedBinDir $ZIP_TMPDIR/ceph
else
ln -s $binDir $ZIP_TMPDIR/ceph
fi
echo "Building zip archive $ZIP_DEST."
zip -r $ZIP_DEST $strippedBinDir
# Include the README file in the archive
ln -s $CEPH_DIR/README.windows.rst $ZIP_TMPDIR/ceph/README.windows.rst
cd $ZIP_TMPDIR
[[ -f $ZIP_DEST ]] && rm $ZIP_DEST
zip -r $ZIP_DEST ceph
cd -
rm -rf $ZIP_TMPDIR/ceph/README.windows.rst $ZIP_TMPDIR
echo -e '\n WIN32 files zipped to: '$ZIP_DEST'\n'
fi

0 comments on commit 8e84b00

Please sign in to comment.