forked from niklasso/minisat
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Norbert Manthey <[email protected]>
- Loading branch information
1 parent
5c86297
commit 6fcbb65
Showing
1 changed file
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/bash | ||
# | ||
|
||
# locate the script to be able to call related scripts | ||
SCRIPT=$(readlink -e "$0") | ||
SCRIPTDIR=$(dirname "$SCRIPT") | ||
|
||
declare -r START_DIR="$PWD" | ||
|
||
# fail on error | ||
set -e | ||
|
||
# get work directory | ||
trap '[ -d "$WORKDIR" ] && rm -rf "$WORKDIR"' EXIT | ||
WORKDIR=$(mktemp -d) | ||
|
||
# create code dir | ||
CODE_DIR="$WORKDIR"/code | ||
mkdir -p "$CODE_DIR" | ||
|
||
# copy full content into code directory | ||
git clone "$SCRIPTDIR"/../.. "$CODE_DIR"/mergesat | ||
|
||
# get dependencies, if not there already: Caution: this can drop state | ||
pushd "$CODE_DIR"/mergesat | ||
git submodule update --init --recursive | ||
git clean -xfd || true | ||
git submodule foreach --recursive git clean -xfd || true | ||
popd | ||
|
||
# create required links in root directory | ||
pushd "$WORKDIR" | ||
ln -s code/mergesat/license.txt license.txt | ||
ln -s code/mergesat/README readme.txt | ||
cp -r "$SCRIPTDIR"/build.sh . | ||
popd | ||
|
||
# log git version | ||
pushd "$SCRIPTDIR" | ||
echo "Package git version:" > "$WORKDIR"/VERSION | ||
git describe || git show -s --pretty=oneline >> "$WORKDIR"/VERSION | ||
GIT_VERSION="$(git describe 6> /dev/null || true)" | ||
[ -n "$GIT_VERSION" ] && GIT_VERSION="-$GIT_VERSION" | ||
[ -z "$GIT_VERSION" ] && GIT_VERSION="-unknown" | ||
echo "Submodules:" >> "$WORKDIR"/VERSION | ||
git submodule status >> "$WORKDIR"/VERSION | ||
echo "Git remotes:" >> "$WORKDIR"/VERSION | ||
git remote -v | grep origin || true >> "$WORKDIR"/VERSION | ||
popd | ||
|
||
declare -r ZIP_NAME="mergesat${GIT_VERSION}.zip" | ||
|
||
# remove git history, as it will be large, and other files | ||
pushd "$CODE_DIR" | ||
rm -rf mergesat/.git | ||
rm -f "$ZIP_NAME" | ||
rm -rf binary/* | ||
rm -rf doc/description | ||
popd | ||
|
||
# zip to overall package | ||
pushd "$WORKDIR" | ||
zip -r -y -9 "$ZIP_NAME" * | ||
|
||
# copy archive back to workdir | ||
cp "$ZIP_NAME" "$START_DIR" | ||
|
||
# leave work directory | ||
popd |