Skip to content

Commit

Permalink
Merge pull request #33 from ktwrd/develop
Browse files Browse the repository at this point in the history
v1.6.0
  • Loading branch information
ktwrd authored Sep 30, 2024
2 parents ca8a015 + 06f30bd commit c9ec24d
Show file tree
Hide file tree
Showing 38 changed files with 2,798 additions and 1,054 deletions.
31 changes: 25 additions & 6 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,40 @@ jobs:
include:
- os: ubuntu-20.04
filename: 'beans-rs'
target: x86_64-unknown-linux-musl
target: x86_64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
filename: 'beans-rs.exe'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Install Build Dependencies (ubuntu)
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: |
sudo apt-get update;
sudo apt-get install -y \
libssl-dev \
musl-tools
g++ \
gdb \
git \
make \
cmake \
autoconf \
libx11-dev \
libglu1-mesa-dev \
libxft-dev \
libxcursor-dev \
libasound2-dev \
freeglut3-dev \
libcairo2-dev \
libfontconfig1-dev \
libglew-dev \
libjpeg-dev \
libpng-dev \
libpango1.0-dev \
libxinerama-dev \
libfltk1.3 \
libfltk1.3-dev \
libssl-dev
- uses: actions-rs/toolchain@v1
with:
Expand All @@ -41,9 +60,9 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --all-features --target ${{ matrix.target }}
args: --verbose --target ${{ matrix.target }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.os }}-${{ matrix.target }}
path: target/${{ matrix.target }}/debug/${{ matrix.filename }}
path: target/${{ matrix.target }}/debug/${{ matrix.filename }}
31 changes: 25 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,41 @@ jobs:
include:
- os: ubuntu-20.04
filename: 'beans-rs'
target: x86_64-unknown-linux-musl
target: x86_64-unknown-linux-gnu

- os: windows-latest
target: x86_64-pc-windows-msvc
filename: 'beans-rs.exe'

steps:
- uses: actions/checkout@master

- name: Install Build Dependencies (ubuntu)
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: |
sudo apt-get update;
sudo apt-get install -y \
libssl-dev \
musl-tools
g++ \
gdb \
git \
make \
cmake \
autoconf \
libx11-dev \
libglu1-mesa-dev \
libxft-dev \
libxcursor-dev \
libasound2-dev \
freeglut3-dev \
libcairo2-dev \
libfontconfig1-dev \
libglew-dev \
libjpeg-dev \
libpng-dev \
libpango1.0-dev \
libxinerama-dev \
libfltk1.3 \
libfltk1.3-dev \
libssl-dev
- uses: actions-rs/toolchain@v1
with:
Expand All @@ -42,7 +61,7 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features --target ${{ matrix.target }}
args: --release --target ${{ matrix.target }}

- name: Upload binaries to release
uses: softprops/action-gh-release@v1
Expand All @@ -61,4 +80,4 @@ jobs:
# SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
# SENTRY_URL: https://sentry.kate.pet
# with:
# environment: production
# environment: production
11 changes: 9 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "beans-rs"
version = "1.5.2"
version = "1.6.0"
edition = "2021"
authors = [
"Kate Ward <kate@dariox.club>"
Expand Down Expand Up @@ -29,13 +29,20 @@ simple-home-dir = "0.3.4"
clap = { version = "4.5.4", features = ["cargo"] }
bitflags = "2.5.0"
log = "0.4.21"
native-dialog = "0.7.0"
lazy_static = "1.4.0"
thread-id = "4.2.1"
colored = "2.1.0"
sentry-log = "0.34.0"
chrono = "0.4.38"

fltk = { version = "1.4.32" }
fltk-theme = "0.7.2"
dark-light = "1.1.1"
image = { version = "0.25.1", features = ["png"] }

[build-dependencies]
fl2rust = "0.5.19"

[target.'cfg(target_os = "windows")'.dependencies]
winconsole = { version = "0.11.1", features = ["window"] }
winreg = "0.52.0"
Expand Down
52 changes: 49 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# beans-rs
A Sourcemod Installer written with Rust, using the kachemak versioning system. Intended for general-purpose use, and for server owners.
A Sourcemod Installer written with Rust, using the Kachemak versioning system (based off TF2C). Intended for general-purpose use, and for server owners.

This is a complete rewrite of the original [beans](https://github.com/int-72h/ofinstaller-beans) installer, but with rust, and extended support.

`beans-rs` is licensed under `GPLv3-only`, so please respect it!

**Note** Releases for Linux v1.5.0 and later are built with Ubuntu 20.04 (using `libssl v1.1`)
**Note** Releases for Linux v1.5.0 and later are built with Ubuntu 20.04

## Developing
Requirements
- Rust Toolchain (nightly, only for building)
- Recommended to use [rustup](https://rustup.rs/) to install.
- x86-64/AMD64 Processor ([see notes](#notes-binaries))
- OpenSSL v3 (also required on deployments)
- fltk ([please read "FLTK Linux Dependencies"](#fltk-linux-dependencies))
- (Optional) `fluid` for creating `.fl` files.
- **Following requirements are only required for testing**
- Steam Installed
- Source SDK Base 2013 Multiplayer ([install](steam://instal/243750))
Expand Down Expand Up @@ -69,4 +71,48 @@ All the bundled/embedded binaries are for x86-64/AMD64 systems. We only support

Please do not make any PRs to remove the embedded executables in favor of downloading. Some users would like to use this application offline, or they may have unreliable internet.

Linux Systems not using glibc have not been tested.
Linux Systems not using glibc have not been tested.

### FLTK Linux Dependencies
When building `beans-rs`, some dependencies are required to build it since we need the build dependencies for fltk.

If your distribution is not listed (or the instructions are broken), please look at [`README.unix.txt` in the fltk repo.](https://github.com/fltk/fltk/blob/master/README.Unix.txt).

#### Debian-based
This includes and Linux Distribution that is based off Debian or Ubuntu. Like;
- [Ubuntu](https://ubuntu.com/),
- [Debian](https://www.debian.org/),
- [Linux Mint](https://www.linuxmint.com/),
- [Zorin OS](https://zorin.com/os/),
- [Pop!_OS](https://pop.system76.com/)

```bash
sudo apt update;
sudo apt-get install -y \
g++ \
gdb \
git \
make \
cmake \
autoconf \
libx11-dev \
libglu1-mesa-dev \
libxft-dev \
libxcursor-dev \
libasound2-dev \
freeglut3-dev \
libcairo2-dev \
libfontconfig1-dev \
libglew-dev \
libjpeg-dev \
libpng-dev \
libpango1.0-dev \
libxinerama-dev;
```

#### Fedora
```bash
sudo yum groupinstall -y "Development Tools"
sudo yum groupinstall -y "X Software Development"
sudo yum groupinstall -y "C Development Tools and Libraries"
```
70 changes: 59 additions & 11 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#[allow(dead_code, unused_macros, unused_imports)]
use std::path::PathBuf;
#[allow(dead_code, unused_macros, unused_imports)]
use std::{env,
io};


use std::{env, io};
#[cfg(target_os = "windows")]
use winres::WindowsResource;
#[allow(unused_macros)]
Expand All @@ -12,10 +13,47 @@ macro_rules! print {
}
pub const OVERRIDE_ICON_LOCATION: Option<&'static str> = option_env!("ICON_LOCATION");
pub const RUST_FLAGS: Option<&'static str> = option_env!("RUSTFLAGS");

fn main()
{
windows_icon().expect("Failed to embed icon");
fltk().expect("Failed to build fltk files");
}

/// generate files for fltk ui stuff
fn fltk() -> Result<(), BuildError>
{
println!("cargo:rerun-if-changed=src/gui/shared_ui.fl");
let g = fl2rust::Generator::default();
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
if let Err(e) = g.in_out(
"src/gui/shared_ui.fl",
out_path.join("shared_ui.rs").to_str().unwrap()
)
{
return Err(BuildError::FLTK(format!(
"Failed to build shared_ui.fl {:#?}",
e
)));
}

Ok(())
}

/// check if a location exists
#[allow(dead_code)]
fn path_exists(path: String) -> bool
{
std::path::Path::new(path.as_str()).exists()
}

/// set the icon to `icon.ico` when building for windows
#[cfg(target_os = "windows")]
fn main() -> io::Result<()> {
fn windows_icon() -> Result<(), BuildError>
{
let icon_location = OVERRIDE_ICON_LOCATION.unwrap_or("icon.ico");
if env::var_os("CARGO_CFG_WINDOWS").is_some() {
if env::var_os("CARGO_CFG_WINDOWS").is_some()
{
if !path_exists(icon_location.to_string())
{
print!("icon.ico not found. Not embedding icon");
Expand All @@ -33,13 +71,23 @@ fn main() -> io::Result<()> {
}
Ok(())
}
/// ignored since icon handling is done by fltk on non-windows
#[cfg(not(target_os = "windows"))]
fn main() -> io::Result<()> {
fn windows_icon() -> Result<(), BuildError>
{
Ok(())
}
#[allow(dead_code)]
fn path_exists(path: String) -> bool

#[derive(Debug)]
pub enum BuildError
{
IO(io::Error),
FLTK(String)
}
impl From<io::Error> for BuildError
{
let p = std::path::Path::new(path.as_str());
return p.exists();
}
fn from(e: io::Error) -> Self
{
BuildError::IO(e)
}
}
Binary file added data/img/default_error_x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/img/default_error_x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/img/default_warn_x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/img/default_warn_x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/img/default_x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/img/default_x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
brace_style="AlwaysNextLine"
combine_control_expr=false
condense_wildcard_suffixes=true
control_brace_style="AlwaysNextLine"
empty_item_single_line=false
fn_params_layout="Vertical"
fn_single_line=false
force_explicit_abi=true
format_code_in_doc_comments=true
format_generated_files=false
hard_tabs=false
hex_literal_case="Upper"
imports_indent="Visual"
imports_layout="Vertical"
indent_style="Block"
inline_attribute_width=0
imports_granularity="Crate"
normalize_comments=true
overflow_delimited_expr=true
group_imports="StdExternalCrate"
single_line_let_else_max_width=0
space_after_colon=true
space_before_colon=false
struct_lit_single_line=false
tab_spaces=4
trailing_comma="Never"
trailing_semicolon=true
where_single_line=false
wrap_comments=true
Loading

0 comments on commit c9ec24d

Please sign in to comment.