build.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/env bash
  2. # To setup cross build on a linux machine, do the following
  3. # 1. Install package arm-linux-gnu-gcc (yum) or gcc-arm-linux-gnueabihf (apt).
  4. # 5. Install build-essential (apt only).
  5. # 2. Run `rustup target add armv7-unknown-linux-musleabihf`
  6. # 1. Add the following to ~/.cargo/config
  7. # [target.armv7-unknown-linux-musleabihf]
  8. # linker = "arm-linux-gnu-gcc" (yum)
  9. # linker = "arm-linux-gnueabihf-gcc" (apt)
  10. # 4. Install rsync.
  11. set -ex
  12. MACHINE=gcloud
  13. rsync -av /Users/ditsing/Code/ruaft $MACHINE:~/compile/ --exclude 'ruaft/target' --exclude 'ruaft/durio/target' --exclude 'ruaft/.git' --exclude '.idea'
  14. ssh $MACHINE 'cd ~/compile/ruaft/durio && $HOME/.cargo/bin/cargo build --target=armv7-unknown-linux-musleabihf --release'
  15. mkdir -p /tmp/ruaft
  16. rsync -av $MACHINE:'~/compile/ruaft/durio/target/armv7-unknown-linux-musleabihf/release/durio' '/tmp/ruaft/durio'
  17. ssh alice 'pkill -9 durio || echo nothing'
  18. rsync -av '/tmp/ruaft/durio' alice:/tmp/durio
  19. ssh alice '
  20. RUST_LOG=warp,tarpc=error,ruaft=debug,kvraft=debug,durio nohup /tmp/durio 1 1>>/tmp/durio.out 2>>/tmp/durio.err &
  21. '
  22. ssh bob 'pkill -9 durio || echo nothing'
  23. rsync -av '/tmp/ruaft/durio' bob:/tmp/durio
  24. ssh bob '
  25. RUST_LOG=warp,tarpc=error,ruaft=debug,kvraft=debug,durio nohup /tmp/durio 2 1>>/tmp/durio.out 2>>/tmp/durio.err &
  26. '
  27. RUST_LOG=warp,tarpc=error,ruaft=debug,kvraft=debug,durio cargo run 0 || echo "Done"
  28. ssh alice 'pkill -9 durio || echo nothing'
  29. ssh bob 'pkill -9 durio || echo nothing'