You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
3.0 KiB
79 lines
3.0 KiB
const std = @import("std"); |
|
const fs = std.fs; |
|
|
|
const tclvfs_dotversion = "1.4.2"; |
|
const tclvfs_nodotversion = "142"; |
|
|
|
pub fn vfsadd_tclvfs_files(comptime tcldir: []const u8, comptime subdir: []const u8, b: *std.Build, vfswrite: *std.Build.Step.WriteFile) !*std.Build.Step.WriteFile { |
|
//_ = tcldir; |
|
//const version = "1.4.2"; |
|
//recursive copy |
|
//_ = make_vfs_root.addCopyDirectory(b.path(tcl_source_folder ++ "/../tclvfs/library"), "base/lib/vfs1.4.2", .{}); |
|
_ = vfswrite.addCopyDirectory(b.path(tcldir ++ "/" ++ subdir ++ "/library"), b.pathJoin(&.{ "base", "lib", "vfs" ++ tclvfs_dotversion }), .{}); |
|
|
|
return vfswrite; |
|
} |
|
pub fn build_tclvfs(comptime tcldir: []const u8, comptime subdir: []const u8, b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, stublib: *std.Build.Step.Compile) !*std.Build.Step.Compile { |
|
//review - libname Vfs vs vfs??? |
|
const slib = b.addLibrary(.{ |
|
.linkage = .static, |
|
.name = "Vfs", |
|
.root_module = b.createModule(.{ |
|
.target = target, |
|
.optimize = optimize, |
|
}), |
|
}); |
|
|
|
_ = stublib; |
|
var flags = std.array_list.Managed([]const u8).init(b.allocator); |
|
defer flags.deinit(); |
|
//try flags.appendSlice(&.{ "-Wall", "-O3" }); |
|
try flags.appendSlice(&.{ "-Wall", "-O2", "-fomit-frame-pointer" }); |
|
try flags.appendSlice(&.{ |
|
"-DPACKAGE_NAME=\"vfs\"", |
|
"-DPACKAGE_TARNAME=\"vfs\"", |
|
"-DPACKAGE_VERSION=\"" ++ tclvfs_dotversion ++ "\"", |
|
"-DPACKAGE_STRING=\"vfs " ++ tclvfs_dotversion ++ "\"", |
|
"-DPACKAGE_BUGREPORT=\"\"", |
|
"-DPACKAGE_URL=\"\"", |
|
"-DBUILD_VFS=1", |
|
"-DTCL_CFG_OPTIMIZED=1", |
|
"-DUSE_TCL_STUBS=0", |
|
"-DZIPFS_BUILD=1", |
|
"-DTCL_WIDE_INT_TYPE=long long", |
|
"-DSTATIC_BUILD", |
|
// ... |
|
//"-static-libgcc", |
|
}); |
|
//-DBUILD_VFS only on windows? value? |
|
|
|
var sources = std.array_list.Managed([]const u8).init(b.allocator); |
|
try sources.append(subdir ++ "/generic/vfs.c"); |
|
slib.root_module.addIncludePath(b.path(subdir)); |
|
slib.root_module.addIncludePath(b.path(subdir ++ "/generic")); |
|
slib.root_module.addIncludePath(b.path(tcldir ++ "/generic")); |
|
slib.root_module.addIncludePath(b.path(tcldir ++ "/generic")); |
|
slib.root_module.addIncludePath(b.path(tcldir ++ "/win")); |
|
slib.root_module.addCSourceFiles(.{ |
|
.files = sources.items, |
|
.flags = flags.items, |
|
}); |
|
|
|
//slib.root_module.linkLibrary(stublib); |
|
slib.root_module.link_libc = true; |
|
slib.root_module.addWin32ResourceFile(.{ |
|
.file = b.path(subdir ++ "/win/tclvfs.rc"), |
|
.flags = &.{ |
|
"-DPACKAGE_MAJOR=1", |
|
"-DPACKAGE_MINOR=4", |
|
"-DPACKAGE_VERSION=" ++ tclvfs_dotversion, |
|
"-DDOTVERSION=" ++ tclvfs_dotversion, |
|
"-DCOMMAVERSION=" ++ tclvfs_dotversion, |
|
"-DVERSION=" ++ tclvfs_nodotversion, |
|
}, |
|
}); //ignored for non-windows targets |
|
// COMMAVERSION??? VERSION??? |
|
|
|
//b.installArtifact(slib); |
|
return slib; //static library |
|
}
|
|
|