-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathpackage.sh
More file actions
executable file
·46 lines (36 loc) · 1.01 KB
/
package.sh
File metadata and controls
executable file
·46 lines (36 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
set -xe
target="${1:?"explit target is required"}"
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
manifest="$(powershell -Command "[System.IO.Path]::GetFullPath('$2')")"
else
manifest="$(realpath ${2:?"explicit manifest path is required"})"
fi
for extra in '' --release; do
artifacts=$(
cargo build \
--message-format json \
--target $target \
--manifest-path $manifest \
$extra
)
artifacts=$(
echo "$artifacts" | jq -r --arg manifest "$manifest" '
select(.manifest_path == $manifest)
| .filenames[]
'
)
artifacts=$(echo "$artifacts" | tr -d '\r')
artifacts_dir="$(echo "$artifacts" | sed '1s|[/\\][^/\\]*$||;q')"
type="$(echo "$artifacts_dir" | sed 's|.*[/\\]||')"
mkdir -p dist/
mkdir -p dist/a
cp $artifacts "$(dirname $manifest)/libsql.h" dist/a
cd dist/a
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
7z a -tzip ../$target-$type.zip *;
else
zip -r ../$target-$type.zip *;
fi;
cd ../..
rm -rf dist/a/
done