-
Notifications
You must be signed in to change notification settings - Fork 36
[patch] Add FreeBSD platform support #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,8 @@ func SharedLibraryName() string { | |
| switch runtime.GOOS { | ||
| case "linux": | ||
| return fmt.Sprintf("libonnxruntime.so.%s", onnxRuntimeVersion) | ||
| case "freebsd": | ||
| return fmt.Sprintf("libonnxruntime.so") | ||
| case "darwin": | ||
| return fmt.Sprintf("libonnxruntime.%s.dylib", onnxRuntimeVersion) | ||
| case "windows": | ||
|
|
@@ -156,6 +158,9 @@ func SetupOnnxRuntime() error { | |
| // CheckOnnxRuntimeInstalled checks if the ONNX runtime shared library is available | ||
| func CheckOnnxRuntimeInstalled() (string, error) { | ||
| destFolder := config.GowallConfig.OnnxRuntimeFolderPath | ||
| if runtime.GOOS == "freebsd" { | ||
| destFolder = filepath.Join("/usr/local", "lib") | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing here you trying to get the onnx shared lib from Remove this
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe they don't ship binaries for FreeBSD platform, so I use package versions of them in FreeBSD. |
||
| } | ||
| libName := SharedLibraryName() | ||
|
|
||
| if libName == "" { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ import ( | |
| "os" | ||
| "os/exec" | ||
| "path/filepath" | ||
| "runtime" | ||
|
|
||
| "github.com/Achno/gowall/config" | ||
| imageio "github.com/Achno/gowall/internal/image_io" | ||
|
|
@@ -21,6 +22,9 @@ type UpscaleProcessor struct { | |
|
|
||
| func (p *UpscaleProcessor) Process(img image.Image, theme string, format string) (image.Image, types.ImageMetadata, error) { | ||
| destFolder := filepath.Join(config.GowallConfig.OutputFolder, "upscaler") | ||
| if runtime.GOOS == "freebsd" { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same thing here |
||
| destFolder = filepath.Join("/usr/local", "bin") | ||
| } | ||
| // setup upscaler if it has not been already | ||
| if _, err := os.Stat(destFolder); os.IsNotExist(err) { | ||
|
|
||
|
|
@@ -35,6 +39,7 @@ func (p *UpscaleProcessor) Process(img image.Image, theme string, format string) | |
| "windows": "realesrgan-ncnn-vulkan.exe", | ||
| "darwin": "realesrgan-ncnn-vulkan", | ||
| "linux": "realesrgan-ncnn-vulkan", | ||
| "freebsd": "realesrgan-ncnn-vulkan", | ||
| } | ||
|
|
||
| binary, err := utils.FindBinary(binaryNames, destFolder) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by you using
libonnxruntime.sohere you make it so gowall uses the shared library that your system has available that you have installed by your package manager.I don't want to do that, gowall downloads the shared library and places it inside
~/.u2netor whatever you have configured in theconfig.ymllikeOnnxRuntimeFolderPath: "~/.mycustomfolder".Also i want to pin shared library to a specific version i download. Change it to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The FreeBSD package will depend on ONNX by default, so it will be available in the system.
The last time I've checked,
onnxRuntimeVersionwas not in-sync with the FreeBSD package of onnxRuntime. So, I think it's better to remove it completely here for FreeBSD.