xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit 93e6555ba352e1e93f9cb98af6a16859065eab40

Add deploy script for MXE builds
This automates it a lot and should ensure that it's done properly.
Author: xaizek
Author date (UTC): 2016-02-09 17:53
Committer name: xaizek
Committer date (UTC): 2016-02-10 13:13
Parent(s): d681808f513fbfab27fcb3af87a480f12fb64662
Signing key:
Tree: 20d2e8e4f8224d268cdc7ce0c479d9a2a36eb255
File Lines added Lines deleted
mxe-deploy 148 0
File mxe-deploy added (mode: 100755) (index 000000000..855288be7)
1 #!/bin/bash
2
3 # this is a MXE part of deploy script, which should be run after GNU/Linux and
4 # regular Windows builds are done
5 #
6 # the script is expected to be run from the root of the repository
7 #
8 # configuration:
9 # * REMOTE_NAME -- ssh-friendly remote Windows machine address
10 # * REMOTE_DIR -- absolute path on remote Windows machine
11 # * W32_DIR -- root directory where Win32 build happens
12 # * W64_DIR -- root directory where Win64 build happens
13 # * W32_BUILD_SCR -- script that builds Win32 release
14 # * W64_BUILD_SCR -- script that builds Win64 release
15
16 if [ $# -ne 1 ]; then
17 echo "Usage: $(basename $0) version"
18 exit 1
19 fi
20
21 version="$1"
22
23 REMOTE_NAME="${REMOTE_NAME:-win}"
24 REMOTE_DIR="${REMOTE_DIR:-/cygdrive/c/dev/vifm}"
25 W32_DIR="${W32_DIR:-../vifm-mxe-w32/}"
26 W64_DIR="${W64_DIR:-../vifm-mxe-w64}"
27 W32_BUILD_SCR="${W32_BUILD_SCR:-../build_release_x86}"
28 W64_BUILD_SCR="${W64_BUILD_SCR:-../build_release_x64}"
29
30 set -e
31
32 echo ::: BUILDING... :::
33
34 ( cd "$W32_DIR" && "$W32_BUILD_SCR" "$version" )
35 ( cd "$W64_DIR" && "$W64_BUILD_SCR" "$version" )
36
37 echo ::: CLEANING UP REMOTE DIRECTORIES... :::
38
39 ssh "$REMOTE_NAME" bash - << EOF
40 rm -rf "$REMOTE_DIR/w32/" "$REMOTE_DIR/w64/"
41 mkdir -p "$REMOTE_DIR/w32/" "$REMOTE_DIR/w64/"
42 EOF
43
44 echo ::: COPYING EXECUTABLES TO THE REMOTE... :::
45
46 scp "$W32_DIR"/src/*.exe "$REMOTE_NAME:$REMOTE_DIR/w32/"
47 scp "$W64_DIR"/src/*.exe "$REMOTE_NAME:$REMOTE_DIR/w64/"
48
49 echo ::: PACKAGING SINGLE-EXECUTABLE VERSIONS... :::
50
51 maindir="vifm-w32-$version-binary"
52 w32="vifm-w32-se-$version-binary"
53 w64="vifm-w64-se-$version-binary"
54
55 ssh "$REMOTE_NAME" bash - << EOF
56 cd "$REMOTE_DIR/"
57
58 rm -rf "$w32.zip" "$w32"
59 cp -r "$maindir" "$w32"
60 chmod -R u=rw,go=r,a+X "$w32"
61 rm "$w32"/*.dll
62 cp w32/*.exe "$w32"
63 zip -9 -r "$w32.zip" "$w32"
64
65 rm -rf "$w64.zip" "$w64"
66 cp -r "$maindir" "$w64"
67 chmod -R u=rw,go=r,a+X "$w64"
68 rm "$w64"/*.dll
69 cp w64/*.exe "$w64"
70 zip -9 -r "$w64.zip" "$w64"
71 EOF
72
73 echo ::: COPYING SINGLE-EXECUTABLE VERSIONS LOCALLY... :::
74
75 scp "$REMOTE_NAME:$REMOTE_DIR/$w32.zip" "$REMOTE_NAME:$REMOTE_DIR/$w64.zip" .
76 chmod -x "$w32.zip" "$w64.zip"
77
78 echo ::: VERIFYING PACKAGES... :::
79
80 unzip "$w32.zip"
81 unzip "$w64.zip"
82
83 x32_exe='PE32 executable (console) Intel 80386 (stripped to external PDB), for MS Windows'
84 x64_exe='PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows'
85
86 ret=0
87
88 if [ "$(file -b "$w32/vifm.exe")" != "$x32_exe" ]; then
89 echo "ERROR: Wrong type of $w32/vifm.exe:"
90 file -b "$w32/vifm.exe"
91 ret=1
92 fi
93 if [ "$(file -b "$w32/win_helper.exe")" != "$x32_exe" ]; then
94 echo "ERROR: Wrong type of $w32/win_helper.exe:"
95 file -b "$w32/win_helper.exe"
96 ret=1
97 fi
98 if [ "$(file -b "$w64/vifm.exe")" != "$x64_exe" ]; then
99 echo "ERROR: Wrong type of $w64/vifm.exe:"
100 file -b "$w64/vifm.exe"
101 ret=1
102 fi
103 if [ "$(file -b "$w64/win_helper.exe")" != "$x64_exe" ]; then
104 echo "ERROR: Wrong type of $w64/win_helper.exe:"
105 file -b "$w64/win_helper.exe"
106 ret=1
107 fi
108
109 rm -rf "$w32" "$w64"
110
111 if [ "$ret" -ne 0 ]; then
112 exit "$ret"
113 fi
114
115 echo ::: COPYING TESTS... :::
116
117 rm -r "$W32_DIR/tests/bin/build" "$W64_DIR/tests/bin/build"
118
119 scp -r "$W32_DIR/tests/bin" "$W32_DIR/tests/test-data" \
120 "$REMOTE_NAME:$REMOTE_DIR/w32/"
121 scp -r "$W64_DIR/tests/bin" "$W64_DIR/tests/test-data" \
122 "$REMOTE_NAME:$REMOTE_DIR/w64/"
123
124 echo ::: RUNNING TESTS... :::
125
126 ssh "$REMOTE_NAME" bash - << EOF
127 cd "$REMOTE_DIR/w32/"
128 for test in bin/*; do
129 basename="\${test#*/}"
130 name="\${basename%.*}"
131 mkdir -p "sandbox/\$name"
132 if ! \$test -s; then
133 exit 1
134 fi
135 done
136
137 cd "$REMOTE_DIR/w64/"
138 for test in bin/*; do
139 basename="\${test#*/}"
140 name="\${basename%.*}"
141 mkdir -p "sandbox/\$name"
142 if ! \$test -s; then
143 exit 1
144 fi
145 done
146 EOF
147
148 echo SUCCESS: everything is fine
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master