other: Windows compilation stuff (#222)

Some Windows compilation/deploy stuff. Mostly just a catch-all for some chores.
This commit is contained in:
Clement Tsang 2020-09-03 12:22:02 -04:00 committed by GitHub
parent 33b37bb5ac
commit 54a35d632e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 49 additions and 39 deletions

View File

@ -1,8 +1,8 @@
[target.x86_64-pc-windows-msvc] [target.x86_64-pc-windows-msvc]
rustflags = ["-Ctarget-feature=+crt-static"] rustflags = ["-C", "target-feature=+crt-static"]
[target.i686-pc-windows-msvc] [target.i686-pc-windows-msvc]
rustflags = ["-Ctarget-feature=+crt-static"] rustflags = ["-C", "target-feature=+crt-static"]
[target.armv7-unknown-linux-gnueabihf] [target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc" linker = "arm-linux-gnueabihf-gcc"

View File

@ -29,7 +29,7 @@ _If relevant, please provide information on:_
**System Info:** **System Info:**
_Information about your system specifically (in case I have to replicate your system via VM):_ _Information about your system specifically (sometimes this matters...):_
- _Total RAM:_ - _Total RAM:_
@ -39,6 +39,8 @@ _Information about your system specifically (in case I have to replicate your sy
**bottom version (use `btm -V`):** **bottom version (use `btm -V`):**
**Rust version (if building yourself):**
## Additional context ## Additional context
_If anything hasn't been covered by the above categories, state it down here:_ _If anything hasn't been covered by the above categories, state it down here:_

View File

@ -1,5 +1,4 @@
language: rust language: rust
cache: cargo
notifications: notifications:
email: email:
on_success: never on_success: never
@ -37,10 +36,12 @@ matrix:
env: TARGET=x86_64-unknown-linux-musl env: TARGET=x86_64-unknown-linux-musl
arch: amd64 arch: amd64
rust: stable rust: stable
- os: linux
env: TARGET=x86_64-unknown-linux-musl # Windows GNU
- os: windows
env: TARGET=x86_64-pc-windows-gnu
arch: amd64 arch: amd64
rust: beta rust: stable
# ARM stuff (skip beta for now, see https://github.com/rust-lang/rust/issues/62896) # ARM stuff (skip beta for now, see https://github.com/rust-lang/rust/issues/62896)
- os: linux - os: linux
@ -75,17 +76,18 @@ branches:
- master - master
- /^\d+\.\d+(\.\d+)?(-\S*)?$/ - /^\d+\.\d+(\.\d+)?(-\S*)?$/
cache: cargo
before_install: before_install:
- export RUST_BACKTRACE=1 - export RUST_BACKTRACE=1
- | - |
if [[ $TRAVIS_OS_NAME == "windows" ]]; then if [[ $TRAVIS_OS_NAME == "windows" && -n $TRAVIS_TAG ]]; then
if [[ -n $TRAVIS_TAG ]]; then echo "Pre-installing deploy dependencies for Windows...";
powershell Install-WindowsFeature Net-Framework-Core; powershell Install-WindowsFeature Net-Framework-Core;
choco install -y wixtoolset; choco install -y wixtoolset;
export PATH=$PATH:"/c/Program Files (x86)/WiX Toolset v3.11/bin"; export PATH=$PATH:"/c/Program Files (x86)/WiX Toolset v3.11/bin";
choco install zip; choco install zip;
rustup target add i686-pc-windows-msvc; rustup target add i686-pc-windows-msvc;
fi
fi fi
before_script: before_script:
@ -117,9 +119,8 @@ before_deploy:
- | - |
echo "Building release..." echo "Building release..."
if [[ $TRAVIS_OS_NAME == "windows" ]]; then if [[ $TRAVIS_OS_NAME == "windows" ]]; then
echo "Building Windows 64-bit..."; echo "Building Windows 64-bit...";
cargo build --release --target x86_64-pc-windows-msvc; cargo build --release --target $TARGET;
local target_dir=$(ls target/release/build/bottom-*/out/rg.bash | head -n1 | xargs dirname) local target_dir=$(ls target/release/build/bottom-*/out/rg.bash | head -n1 | xargs dirname)
cp -r $target_dir completions cp -r $target_dir completions
mv "./target/x86_64-pc-windows-msvc/release/btm" "btm.exe"; mv "./target/x86_64-pc-windows-msvc/release/btm" "btm.exe";
@ -128,31 +129,33 @@ before_deploy:
rm "btm.exe" rm "btm.exe"
rm -r "completions" rm -r "completions"
echo "Building Windows 32-bit..."; if [[ $TARGET == "x86_64-pc-windows-msvc" ]]; then
cargo clean; echo "Building Windows 32-bit...";
cargo build --release --target i686-pc-windows-msvc; cargo clean;
local target_dir=$(ls target/release/build/bottom-*/out/rg.bash | head -n1 | xargs dirname) cargo build --release --target i686-pc-windows-msvc;
cp -r $target_dir completions local target_dir=$(ls target/release/build/bottom-*/out/rg.bash | head -n1 | xargs dirname)
mv "./target/i686-pc-windows-msvc/release/btm" "btm.exe"; cp -r $target_dir completions
strip "btm.exe" mv "./target/i686-pc-windows-msvc/release/btm" "btm.exe";
zip -r bottom_i686-pc-windows-msvc.zip "btm.exe" "completions"; strip "btm.exe"
rm "btm.exe" zip -r bottom_i686-pc-windows-msvc.zip "btm.exe" "completions";
rm -r "completions" rm "btm.exe"
rm -r "completions"
echo "Building choco template..."; echo "Building choco template...";
python "./deployment/windows/choco/choco_packager.py" "bottom_i686-pc-windows-msvc.zip" "bottom_x86_64-pc-windows-msvc.zip" $TRAVIS_TAG "./deployment/windows/choco/bottom.nuspec.template" "./deployment/windows/choco/chocolateyinstall.ps1.template" "./deployment/windows/choco/bottom.nuspec" "./deployment/windows/choco/tools/chocolateyinstall.ps1" "./deployment/windows/choco/tools/"; python "./deployment/windows/choco/choco_packager.py" "bottom_i686-pc-windows-msvc.zip" "bottom_x86_64-pc-windows-msvc.zip" $TRAVIS_TAG "./deployment/windows/choco/bottom.nuspec.template" "./deployment/windows/choco/chocolateyinstall.ps1.template" "./deployment/windows/choco/bottom.nuspec" "./deployment/windows/choco/tools/chocolateyinstall.ps1" "./deployment/windows/choco/tools/";
cd "./deployment/windows/choco/" cd "./deployment/windows/choco/"
zip -r choco.zip "bottom.nuspec" "tools/"; zip -r choco.zip "bottom.nuspec" "tools/";
cd "../../../"; cd "../../../";
mv "./deployment/windows/choco/choco.zip" "./choco.zip" mv "./deployment/windows/choco/choco.zip" "./choco.zip"
echo "Building msi file..."; echo "Building msi file...";
cargo install cargo-wix; cargo install cargo-wix;
cargo wix init; cargo wix init;
cargo wix; cargo wix;
echo "Building winget template..."; echo "Building winget template...";
python "./deployment/packager.py" $TRAVIS_TAG "./deployment/windows/winget/winget.yaml.template" "$TRAVIS_TAG.yaml" "SHA256" "./bottom_x86_64_installer.msi"; python "./deployment/packager.py" $TRAVIS_TAG "./deployment/windows/winget/winget.yaml.template" "$TRAVIS_TAG.yaml" "SHA256" "./bottom_x86_64_installer.msi";
fi
echo "Done Windows pre-deploy!"; echo "Done Windows pre-deploy!";
else else

View File

@ -30,6 +30,7 @@
"Ungrouped", "Ungrouped",
"WASD", "WASD",
"Wojnarowski", "Wojnarowski",
"aarch",
"andys", "andys",
"armhf", "armhf",
"armv", "armv",

View File

@ -41,6 +41,10 @@ This is a nuspec. It mostly adheres to https://docs.nuget.org/create/Nuspec-Refe
To use, run `btm` in a terminal. To use, run `btm` in a terminal.
For more [documentation and usage](https://github.com/ClementTsang/bottom/blob/master/README.md), see the [official repo](https://github.com/ClementTsang/bottom). For more [documentation and usage](https://github.com/ClementTsang/bottom/blob/master/README.md), see the [official repo](https://github.com/ClementTsang/bottom).
**Note**
This currently depends on Visual C++ Redistributable for Visual Studio 2015 https://chocolatey.org/packages/vcredist2015.
</description> </description>
<releaseNotes>https://github.com/ClementTsang/bottom/releases/tag/$version/</releaseNotes> <releaseNotes>https://github.com/ClementTsang/bottom/releases/tag/$version/</releaseNotes>
</metadata> </metadata>