Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/unit_tests-aarch64-darwin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ jobs:
if: github.event_name == 'pull_request'
name: Build & Test
runs-on: macos-latest
env:
PREFIX: /opt/homebrew
steps:
- name: Code checkout
uses: actions/checkout@v2
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
OS = $(shell uname -s)
KRUNKIT_RELEASE = target/release/krunkit
KRUNKIT_DEBUG = target/debug/krunkit
LIBKRUN = libkrun.1.dylib

ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
PREFIX ?= /usr/local
export PREFIX

.PHONY: install clean $(KRUNKIT_RELEASE) $(KRUNKIT_DEBUG)

Expand All @@ -15,6 +15,7 @@ debug: $(KRUNKIT_DEBUG)
$(KRUNKIT_RELEASE):
cargo build --release
ifeq ($(OS),Darwin)
install_name_tool -change $(LIBKRUN) $(PREFIX)/lib/$(LIBKRUN) $@
codesign --entitlements krunkit.entitlements --force -s - $@
endif

Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@ $ brew install krunkit

As noted above, `krunkit` relies on the `efi` flavor of `libkrun`. Ensure that is installed on your system.

Build and install using default `PREFIX` (`/usr/local`):

```
make
sudo make install
```
# If libkrun-efi.dylib is not located at /opt/homebrew/opt/libkrun-efi/lib/
# provide the path at which it's located using the LIBKRUN_EFI variable. Otherwise,
# the Makefile will default to using the /opt/homebrew/... path.
$ make LIBKRUN_EFI=<path to libkrun-efi.dylib>

$ sudo make install
To build with `libkrun-efi` from *Homebrew* or *MacPorts* use the appropriate `PREFIX`:

```
make PREFIX=/opt/homebrew
sudo make install PREFIX=/opt/homebrew
```

## Usage
Expand Down
11 changes: 7 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
fn main() {
#[cfg(target_os = "macos")]
{
match std::env::var_os("LIBKRUN_EFI") {
Some(path) => println!("cargo:rustc-link-search={}", path.into_string().unwrap()),
None => println!("cargo:rustc-link-search=/opt/homebrew/lib"),
}
// Must match the default PREFIX in the Makefile.
const DEFAULT_PREFIX: &str = "/usr/local";

let prefix = std::env::var("PREFIX").unwrap_or(DEFAULT_PREFIX.to_string());
println!("cargo:rustc-link-search={prefix}/lib");

println!("cargo:rerun-if-env-changed=PREFIX");
}
}
Loading