Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
mgord9518 committed Sep 3, 2024
1 parent d029b09 commit e91e900
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 21 deletions.
10 changes: 0 additions & 10 deletions cmd/aisap/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@ module github.com/mgord9518/aisap/cmd/aisap

go 1.18

replace github.com/mgord9518/aisap => ../../

replace github.com/mgord9518/aisap/permissions => ../../permissions

replace github.com/mgord9518/aisap/profiles => ../../profiles

replace github.com/mgord9518/aisap/spooky => ../../spooky

replace github.com/mgord9518/aisap/helpers => ../../helpers

require (
github.com/gookit/color v1.5.4
github.com/mgord9518/aisap v0.0.0-00010101000000-000000000000
Expand Down
2 changes: 1 addition & 1 deletion resources/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[ -z "$ARCH" ] && ARCH=$(uname -m)
PATH="$PATH:$HOME/.local/bin"
export VERSION=$(cat zig/build.zig.zon | grep '.version' | cut -d'"' -f2)
export VERSION=$(cat zig/build.zig.zon | grep ' .version' | cut -d'"' -f2)

if [ ! $(command -v 'go') ]; then
echo 'Failed to locate GoLang compiler! Unable to build'
Expand Down
3 changes: 2 additions & 1 deletion zig/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ pub fn build(b: *std.Build) void {

exe.linkLibrary(squashfuse_dep.artifact("zstd"));
exe.linkLibrary(squashfuse_dep.artifact("deflate"));
//exe.linkLibrary(squashfuse_dep.artifact("deflate"));
exe.linkLibrary(squashfuse_dep.artifact("lzma"));
exe.linkLibrary(squashfuse_dep.artifact("lz4"));

b.installArtifact(exe);
}
3 changes: 2 additions & 1 deletion zig/build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
.dependencies = .{
.squashfuse = .{
.url = "https://github.com/mgord9518/squashfuse-zig/archive/refs/tags/continuous.tar.gz",
.hash = "1220e783b731a8fb6825fc1e2652ccd56890b8d7451d668064ed85b2fbddb790f8fa",
.hash = "12208f1552f9cb0b16ee3f5277184317cd0fd28a697a3ea1ce56d327a52197411bfc",
//.path = "../../squashfuse-zig",
},
},

Expand Down
15 changes: 8 additions & 7 deletions zig/lib/AppImage.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const SquashFs = squashfuse.SquashFs;

pub const AppImage = @This();

sqfs: SquashFs,
sqfs: *SquashFs,
kind: Kind,
allocator: std.mem.Allocator,

Expand All @@ -15,21 +15,22 @@ pub const Kind = enum {
type2,
};

pub fn open(allocator: std.mem.Allocator, path: []const u8) !AppImage {
const cwd = std.fs.cwd();
const file = try cwd.openFile(path, .{});

pub fn open(allocator: std.mem.Allocator, file: std.fs.File) !AppImage {
std.debug.print("offset {d}\n", .{try offsetFromElf(file)});

const sqfs = try SquashFs.open(allocator, file, .{
.offset = try offsetFromElf(file),
});

return .{
.sqfs = undefined,
.sqfs = sqfs,
.kind = undefined,
.allocator = allocator,
};
}

pub fn close(appimage: *AppImage) void {
_ = appimage;
appimage.sqfs.close();
return;
}

Expand Down
6 changes: 5 additions & 1 deletion zig/src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ pub fn main() !void {
return;
};

const cwd = std.fs.cwd();
const file = try cwd.openFile(target, .{});
defer file.close();

var appimage = try AppImage.open(
allocator,
target,
file,
);
defer appimage.close();

Expand Down

0 comments on commit e91e900

Please sign in to comment.