blob: 83e613e8b61937f93845dc6cef3bfd72686826e0 (
plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
#!/usr/local/bin/fish
#
# A very messy script for making building Rust programs for
# various platforms and then stuffing them into archives
set cargocmd cargo metadata --format-version 1 --no-deps
set packageCount ($cargocmd | jq '.packages | length')
set package $argv[1]
if test $packageCount -gt 1 -a -z "$argv[1]"
echo "Multiple packages in workspace, but none provided!"
echo "What package do I build for?"
exit
else if test $packageCount -eq 1 -a -z "$argv[1]"
set parsedPackage ($cargocmd | jq --raw-output '.packages[0].name')
set package $parsedPackage
end
set packageVersion ($cargocmd | jq --raw-output '.packages[] | select(.name == "'$package'") | .version')
echo "building for $package version $packageVersion"
set target ($cargocmd | jq --raw-output '.target_directory')
set workroot ($cargocmd | jq --raw-output '.workspace_root')
set temp $target/cutrel/working
set done $target/cutrel
set license $workroot/LICENSE
echo "target=$target"
echo ""
if test ! -e $license
echo "!! No license file in root!"
#exit
end
mkdir -p $done
mkdir -p $temp
function build -a triple outName
set windows false
echo $triple | grep windows &>/dev/null
if test $status -eq 0
echo "Windows detected, using xwin!"
set windows true
end
set final "$done/$package-v$packageVersion""_""$outName.tar.gz"
if test $windows = true
set final "$done/$package-v$packageVersion""_""$outName.zip"
end
echo "window = $windows | final = $final"
if test -e $final
echo "Skipping $outName, already exists!"
return
end
set thisWork $temp/$packageVersion-$outName
set thisTarName $package-$packageVersion
set thisTar $thisWork/$thisTarName
echo "building for $outName..."
set buildCmd cargo build
if test $windows = true
set buildCmd cargo xwin build
end
$buildCmd --release --target $triple &>/dev/null
if test $status -ne 0
echo "!! ERROR building for $outName ($triple)"
echo "!! Run the command below for more information"
echo "!! \$ cargo build --release --target $triple"
exit
else
echo "Build for $outName successful, compressing"
end
rm -rf $thisWork
mkdir -p $thisTar
cp $license $thisTar/LICENSE
if test $windows = true
cp $target/$triple/release/$package.exe $thisTar/
else
cp $target/$triple/release/$package $thisTar/
end
set wasAtDir (pwd)
cd $thisWork
if test $windows = true
zip -r $final $thisTarName &>/dev/null
else
tar -czf $final $thisTarName &>/dev/null
end
if test $status -ne 0
echo "compressing failed!"
exit
end
cd $wasAtDir
end
build x86_64-unknown-linux-gnu linux-x64
build aarch64-unknown-linux-gnu linux-aarch64
build x86_64-apple-darwin macos-x64
build aarch64-apple-darwin macos-aarch64
build x86_64-pc-windows-msvc windows-x64
rm -rf $temp
|