Skip to content

Commit

Permalink
ports stest to rust
Browse files Browse the repository at this point in the history
Since stest was the only remaining C artifact, this commit also drops
all references to the C toolchain from the makefile and build. Yay, less
C and simpler build!
  • Loading branch information
benjaminedwardwebb committed Jan 19, 2023
1 parent 739a373 commit 9be31d0
Show file tree
Hide file tree
Showing 28 changed files with 1,383 additions and 179 deletions.
8 changes: 1 addition & 7 deletions config.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = 5.5.0
VERSION = 5.5.2

# paths
PREFIX = /usr/local
Expand All @@ -7,12 +7,6 @@ MANPREFIX = $(PREFIX)/share/man
# Xinerama, set to false/empty if you don't want it
XINERAMA=true

# flags (not used for dmenu)
CFLAGS = -c -pedantic -std=c99 -Wall -Os -D_DEFAULT_SOURCE

# compiler and linker for non-rust files, blank for system default (cc)
CC =

# additional flags to be passed to rustc
RUSTFLAGS =

Expand Down
14 changes: 2 additions & 12 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,16 @@ ifeq ($(XINERAMA),true)
XINERAMA_FLAGS = --all-features # idk if there will ever be a workaround
endif

ifeq ($(CC),)
CC = cc
endif

export RUSTFLAGS
export PLUGINS
export VERSION
export XINERAMA
export depcheck
export CC

all: options dmenu stest

options:
@echo "dmenu ($(VERSION)) build options:"
@echo "CFLAGS = $(CFLAGS)"
@echo "CC = $(CC)"
@echo "RUSTFLAGS = $(RUSTFLAGS)"
@echo "PLUGINS = $(PLUGINS)"

Expand Down Expand Up @@ -51,11 +44,8 @@ plugins:
cd src && cargo run --release -p config --bin list-plugins

stest:
mkdir -p target
$(CC) $(CFLAGS) -o target/stest.o src/stest/stest.c
$(CC) -o target/stest target/stest.o
rm -f target/stest.o
cp src/man/src/stest.1 target/
cd src && cargo build -p stest --release $(XINERAMA_FLAGS)
cp src/target/release/stest target/

scaffold:
mkdir -p target
Expand Down
3 changes: 2 additions & 1 deletion src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ members = [
"build",
"config",
"headers",
]
"stest"
]
323 changes: 323 additions & 0 deletions src/stest/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/stest/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "stest"
version = "0.0.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap = { version = "4.0.32", features = ["derive"] }
Loading

0 comments on commit 9be31d0

Please sign in to comment.