All I need is to clone the repository, build the static library and copy it and the C header file in a directory that can be found by the Nim bindings, so probably within the nimble path mylib? It should take a user specified argument about the target platform. I would also like to be able to get the correct path without user intervention. Should I avoid installing it globally or not?! What happens on Windows?
Using a nimble task or a nimscript file from the client package proved problematic because I can't get the path to the installed library. mymodule.nims wouldn't execute when importing mymodule. A library nimble task doesn't look like it takes parameters but I guess I could resort to defining multiple tasks like buildAndroid, buildDesktop. Any examples I can use? Or better alternatives?
Maybe add a step in your nims file to build the library? --app:lib should do it.
Actually I've built a wrapper for a C library. It is that library I need to clone and place next to the Nim bindings.
I don't know what C library you are wrapping but your nimble package always need to build static library even if the C library is already installed? Let users install the C library using system package manager or other package mananer like Conan or MSYS2 is not an option? Can we choose whether your nimble package use already installed C library or build C library when installing it?
I think you should avoid install c libraries globally. On most of linux, files in /lib, /usr/include or /usr/lib are managed by package manager and copying files that doesn't managed by package manager might cause problems. On windows, as far as I know, there is no such standard directories for include files or static link libraries. People can install GCC in random path on windows.
This article about C library might help you: https://internet-of-tomohiro.netlify.app/nim/clibrary.en.html
@ggbison Actually I have done all the steps you mentioned. It's just that nimble is giving a hard time to provide a package that does all these semi-automatically. The user still needs to specify the platform they want to develop against, the available options, for now, are Desktop, RPi, DRM and Android. I can't get how nimssl is supposed to work. I see this error log
stack trace: (most recent call last)
/tmp/nimblecache-3067454014/nimscriptapi_1623384115.nim(208, 29)
/tmp/nimble_11746/githubcom_genotrancenimssl/nimssl.nimble(27, 12) installBefore
/tmp/nimble_11746/githubcom_genotrancenimssl/nimssl.nimble(24, 8) setupTask
Nim/lib/system/nimscript.nim(264, 7) exec
Nim/lib/system/nimscript.nim(264, 7) Error: unhandled exception: FAILED: nimgen nimssl.cfg [OSError]
Tip: 5 messages have been suppressed, use --verbose to show them.
nimscriptwrapper.nim(160) execScript
But nimssl.nimble doesn't have any tasks, so how are those called? I guess one of the dependencies creates nimssl.cfg? Using nimble is so confusing.