Skip to content

Commit

Permalink
v1.0.1 Build Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Epikest committed Jun 29, 2022
1 parent d729c41 commit 319ec23
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# RunInShell
# rish

[![Zig](https://img.shields.io/badge/Zig-F7A41D?logo=zig&logoColor=fff&style=flat-square)](https://ziglang.org) [![GitHub all releases](https://img.shields.io/github/downloads/Epikest/RunInShell/total?label=Downloads&logo=github&color=%233fb950&style=flat-square)](https://github.com/Epikest/RunInShell/releases) [![GitHub Repo stars](https://img.shields.io/github/stars/Epikest/RunInShell?style=social)](https://github.com/Epikest/RunInShell/stargazers)
[![Zig](https://img.shields.io/badge/Zig-F7A41D?logo=zig&logoColor=fff&style=flat-square)](https://ziglang.org) [![GitHub all releases](https://img.shields.io/github/downloads/Epikest/rish/total?label=Downloads&logo=github&color=%233fb950&style=flat-square)](https://github.com/Epikest/rish/releases) [![GitHub Repo stars](https://img.shields.io/github/stars/Epikest/rish?style=social)](https://github.com/Epikest/rish/stargazers)

fast zig rewrite of [RunInBash](https://github.com/neosmart/RunInBash), with a login shell\
consider renaming to `$.exe` and placing in path
rish, formerly known as RunInShell, is a fast zig rewrite of [RunInBash](https://github.com/neosmart/RunInBash), with a login shell\
consider renaming to `$.exe` and moving to a directory in $env:PATH

pipes work, `` ` `` to escape windows variables and special characters

Expand All @@ -16,16 +16,22 @@ issues welcome

### personal

it is preferred to build RunInShell for yourself so that you get all the speed optimizations for your cpu
it is preferred to build rish for yourself so that you get all the speed optimizations for your computer

```ps1
zig build -Drelease-fast
cp .\zig-out\bin\$.exe C:\Windows\System32
zig build -Dshell=zsh -Drelease-fast -p .\zig-out\native
cp .\zig-out\native\bin\$.exe C:\Windows\System32 # or any other directory in $env:PATH
```

### release

```ps1
zig build -Drelease-fast -Dtarget=x86_64-windows-gnu -Dcpu=baseline -p .\zig-out\x86_64
zig build -Drelease-fast -Dtarget=aarch64-windows-gnu -Dcpu=baseline -p .\zig-out\aarch64
zig build -Dshell=bash -Dexe-name=bash-x86_64 -Drelease-fast -Dtarget=x86_64-windows-gnu -Dcpu=baseline -p .\zig-out\release\bash
zig build -Dshell=bash -Dexe-name=bash-aarch64 -Drelease-fast -Dtarget=aarch64-windows-gnu -Dcpu=baseline -p .\zig-out\release\bash
zig build -Dshell=zsh -Dexe-name=zsh-x86_64 -Drelease-fast -Dtarget=x86_64-windows-gnu -Dcpu=baseline -p .\zig-out\release\zsh
zig build -Dshell=zsh -Dexe-name=zsh-aarch64 -Drelease-fast -Dtarget=aarch64-windows-gnu -Dcpu=baseline -p .\zig-out\release\zsh
zig build -Dshell=fish -Dexe-name=fish-x86_64 -Drelease-fast -Dtarget=x86_64-windows-gnu -Dcpu=baseline -p .\zig-out\release\fish
zig build -Dshell=fish -Dexe-name=fish-aarch64 -Drelease-fast -Dtarget=aarch64-windows-gnu -Dcpu=baseline -p .\zig-out\release\fish
```
10 changes: 9 additions & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,19 @@ pub fn build(b: *std.build.Builder) void {
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
const mode = b.standardReleaseOptions();

const exe = b.addExecutable("$", "src/$.zig");
// TODO: Automatic naming based on target
const exe_name = b.option([]const u8, "exe-name", "Override default executable name") orelse "$";
const exe = b.addExecutable(exe_name, "src/$.zig");
exe.setTarget(target);
exe.setBuildMode(mode);
exe.install();

const exe_options = b.addOptions();
exe.addOptions("build_options", exe_options);

const shell = b.option([]const u8, "shell", "Shell to use, must support interactive login") orelse "bash";
exe_options.addOption([]const u8, "shell", shell);

const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
Expand Down
5 changes: 2 additions & 3 deletions src/$.zig
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
const std = @import("std");
const shell = @import("build_options").shell;
const string = []const u8;

const shell = "bash"; // zsh, fish, etc.

pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
Expand Down Expand Up @@ -39,4 +38,4 @@ pub fn main() !void {
std.log.err("Failed to spawn the child process", .{});
return;
};
}
}

0 comments on commit 319ec23

Please sign in to comment.