From cf774a92695f2b303723ea8d7d3a1297b1a7617f Mon Sep 17 00:00:00 2001 From: weynandkuijpers Date: Fri, 10 Oct 2025 11:18:22 +0400 Subject: [PATCH 1/2] changes to compile on asahi linux, aarch64, fedora --- cli/compile.vsh | 4 ++-- install_herolib.vsh | 6 +++--- lib/core/platform.v | 7 ++++++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/cli/compile.vsh b/cli/compile.vsh index de2765ad..69b7affe 100755 --- a/cli/compile.vsh +++ b/cli/compile.vsh @@ -64,9 +64,9 @@ compile_cmd := if os.user_os() == 'macos' { } } else { if prod_mode { - 'v -cg -enable-globals -parallel-cc -w -n hero.v' + 'v -cg -enable-globals -parallel-cc -w -n -d use_openssl hero.v' } else { - 'v -cg -enable-globals -w -n hero.v' + 'v -cg -enable-globals -w -n -d use_openssl hero.v' } } diff --git a/install_herolib.vsh b/install_herolib.vsh index f01696d7..8f101bd4 100755 --- a/install_herolib.vsh +++ b/install_herolib.vsh @@ -64,12 +64,12 @@ os.rm('${os.home_dir()}/.vmodules/freeflowuniverse/herolib') or {} os.rm('${os.home_dir()}/.vmodules/${org_name}/herolib') or {} // Create necessary directories -os.mkdir_all('${os.home_dir()}/.vmodules/${org_name}') or { - panic('Failed to create directory ~/.vmodules/${org_name}: ${err}') +os.mkdir_all('${os.home_dir()}/.vmodules/freeflowuniverse') or { + panic('Failed to create directory ~/.vmodules/freeflowuniverse: ${err}') } // Create new symlinks -os.symlink('${abs_dir_of_script}/lib', '${os.home_dir()}/.vmodules/${org_name}/herolib') or { +os.symlink('${abs_dir_of_script}/lib', '${os.home_dir()}/.vmodules/freeflowuniverse/herolib') or { panic('Failed to create herolib symlink: ${err}') } diff --git a/lib/core/platform.v b/lib/core/platform.v index 48d6255c..73a82308 100644 --- a/lib/core/platform.v +++ b/lib/core/platform.v @@ -12,6 +12,7 @@ pub enum PlatformType { alpine arch suse + fedora } pub fn platform_enum_from_string(platform string) PlatformType { @@ -20,6 +21,8 @@ pub fn platform_enum_from_string(platform string) PlatformType { 'ubuntu' { .ubuntu } 'alpine' { .alpine } 'arch' { .arch } + 'suse' { .suse } + 'fedora' { .fedora } else { .unknown } } } @@ -66,6 +69,8 @@ pub fn platform() !PlatformType { platform_ = PlatformType.alpine } else if cmd_exists('pacman') { platform_ = PlatformType.arch + } else if cmd_exists('dnf') { + platform_ = PlatformType.fedora } else { return error('Unknown platform') } @@ -126,7 +131,7 @@ pub fn is_ubuntu() !bool { pub fn is_linux() !bool { return platform()! == .ubuntu || platform()! == .arch || platform()! == .suse - || platform()! == .alpine + || platform()! == .alpine || platform()! == .fedora } pub fn is_linux_arm() !bool { From 87a05269221295d6b99b5925ac40ea5bf82dba07 Mon Sep 17 00:00:00 2001 From: weynandkuijpers Date: Fri, 10 Oct 2025 12:19:29 +0400 Subject: [PATCH 2/2] added fedora for the package install during hero execution --- lib/osal/core/package.v | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/osal/core/package.v b/lib/osal/core/package.v index 48994865..6bbce02b 100644 --- a/lib/osal/core/package.v +++ b/lib/osal/core/package.v @@ -38,9 +38,15 @@ pub fn package_refresh() ! { return error('Could not update packages for Arch Linux\nerror:\n${err}') } return + } else if platform_ == .fedora { + // Refresh the package list for Fedora + exec(cmd: 'sudo dnf check-update') or { + return error('Could not update packages for Fedora\nerror:\n${err}') + } + return } - return error("Only ubuntu, alpine, arch, and osx are supported for now. Found \"${platform_}\"") + return error("Only ubuntu, alpine, arch, fedora, and osx are supported for now. Found \"${platform_}\"") } // install a package using the right commands per platform @@ -78,8 +84,12 @@ pub fn package_install(name_ string) ! { exec(cmd: '${sudo_pre}pacman --noconfirm -Su ${name}') or { return error('could not install package on Arch: ${name}\nerror:\n${err}') } + } else if platform_ == .fedora { + exec(cmd: '${sudo_pre}dnf install -y ${name}') or { + return error('could not install package on Fedora: ${name}\nerror:\n${err}') + } } else { - return error('Only ubuntu, alpine, arch, and osx supported for now') + return error('Only ubuntu, alpine, arch, fedora, and osx supported for now') } } @@ -131,7 +141,15 @@ pub fn package_remove(name_ string) ! { 'pacman --noconfirm -R ${name}' } exec(cmd: cmd, ignore_error: true)! + } else if platform_ == .fedora { + // Use sudo if required + cmd := if use_sudo { + 'sudo dnf remove -y ${name}' + } else { + 'dnf remove -y ${name}' + } + exec(cmd: cmd, ignore_error: true)! } else { - return error('Only ubuntu, alpine, and osx supported for now') + return error('Only ubuntu, alpine, arch, fedora, and osx supported for now') } }