-
Notifications
You must be signed in to change notification settings - Fork 4
/
win.sh
executable file
·32 lines (22 loc) · 876 Bytes
/
win.sh
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
#!/bin/sh
set -euxo pipefail
target="${1-x86_64-pc-windows-gnu}"
cargo build --target "$target" --release
cp keymap.toml target/"$target"/release/
cd target/"$target"/release/
strip rusty-keys.exe
zip -9 rusty-keys-"$target".zip rusty-keys.exe keymap.toml
mv rusty-keys-"$target".zip ../../..
exit 0
# on arch linux, run these to enable cross compiling to win64:
pacman -S mingw-w64-gcc
# you can change these, if you want
CHANNEL=stable
ARCH=x86_64
rustup install $CHANNEL-$ARCH-pc-windows-gnu && rustup target add $ARCH-pc-windows-gnu
for lib in crt2.o dllcrt2.o libmsvcrt.a; do cp -v /usr/x86_64-w64-mingw32/lib/$lib $HOME/.rustup/toolchains/$CHANNEL-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/; done
cat >> ~/.cargo/config <<EOF
[target.$ARCH-pc-windows-gnu]
linker = "/usr/bin/$ARCH-w64-mingw32-gcc"
ar = "/usr/$ARCH-w64-mingw32/bin/ar"
EOF