aboutsummaryrefslogtreecommitdiff
path: root/project/setup/cygwin-copy.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xproject/setup/cygwin-copy.sh71
1 files changed, 71 insertions, 0 deletions
diff --git a/project/setup/cygwin-copy.sh b/project/setup/cygwin-copy.sh
new file mode 100755
index 0000000..3ce6c46
--- /dev/null
+++ b/project/setup/cygwin-copy.sh
@@ -0,0 +1,71 @@
+#!/usr/bin/env bash
+
+ #####################################################################
+ ## _______ _______ _______ ##
+ ## | ___ |____ | ___ | ##
+ ## | | |_| / /| | |_| ##
+ ## | |_____ / / | |_____ ##
+ ## |_____ | / / |_____ | ##
+ ## _ | | / / _ | | ##
+ ## | |___| |/ /____| |___| | ##
+ ## |_______|_______|_______| ##
+ ## ##
+ ## Wiimms SZS Tools ##
+ ## http://szs.wiimm.de/ ##
+ ## ##
+ #####################################################################
+ ## ##
+ ## This file is part of the SZS project. ##
+ ## Visit http://szs.wiimm.de/ for project details and sources. ##
+ ## ##
+ ## Copyright (c) 2011-2019 by Dirk Clemens <wiimm@wiimm.de> ##
+ ## ##
+ #####################################################################
+
+#------------------------------------------------------------------------------
+# setup
+
+CYGWIN_DIR="@@CYGWIN-DIR@@"
+CYGWIN_TOOLS="@@CYGWIN-TOOLS@@"
+BIN_FILES="@@BIN-FILES@@"
+DISTRIB_PATH="@@DISTRIB-PATH@@"
+
+BIN_PATH="$DISTRIB_PATH/bin"
+mkdir -p "$BIN_PATH" || exit 1
+
+#------------------------------------------------------------------------------
+# copy cygwin tools
+
+for tool in $CYGWIN_TOOLS
+do
+ cp --preserve=time "$CYGWIN_DIR/$tool.exe" "$BIN_PATH" || exit 1
+done
+
+#------------------------------------------------------------------------------
+# copy wit tools
+
+for tool in $BIN_FILES
+do
+ if [[ -s ./$tool.exe ]]
+ then
+ CYGWIN_TOOLS="$CYGWIN_TOOLS $tool"
+ ln -f ./$tool.exe "$BIN_PATH" || exit 1
+ fi
+done
+
+#------------------------------------------------------------------------------
+# copy needed cygwin dlls
+
+for tool in $CYGWIN_TOOLS
+do
+ ldd "$BIN_PATH/$tool.exe" | grep -F "=> $CYGWIN_DIR/" | awk '{print $1}'
+done | sort | uniq | while read dll
+do
+ cp --preserve=time "$CYGWIN_DIR/$dll" "$BIN_PATH" || exit 1
+done
+
+#------------------------------------------------------------------------------
+# done
+
+exit 0
+