-
Notifications
You must be signed in to change notification settings - Fork 81
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
Windows and Darwin support #268
base: master
Are you sure you want to change the base?
Windows and Darwin support #268
Conversation
By the way, any thought about to add optional CMake support? I'd be happy to help with that. |
Thanks for the effort. I believe the additions to the .gitignore are good. The modifications for the makefiles however, feel like overkill veering on scope creep. CMake is likewise out of scope, though if you fork Monocypher and add a CMake on top, I add a link to your work from the download page under the "third party distributions" section (it will stay there as long as you maintain your fork). Here’s my philosophy: the main way to put Monocypher into your project is to copy & paste the files from Thus, the makefile is a convenience that mostly helps me develop Monocypher, though I did go out of my way to make it as portable as possible to facilitate third party distributions. I believe your patch comes from a different vision of portability than mine, one that may be inevitable when you start supporting outliers like Windows: I try my hardest to be platform agnostic, while your patch is platform aware. Personally that’s where I draw the line: I can stop using GNU make extensions to make BSD users happy, but writing dedicated code for a specific OS feels like going too far. The same reasoning prevents me from providing an RNG, managing nonces myself, or locking memory. Platform specific stuff is out of scope. That being said, we still have options for Windows and Darwin. Make allows us to override all its variables, and we could use that to our advantage. Reading your patch, Windows support requires the following:
Darwin seems to need similar customisation and on top of that a different way to generate the shared library (which you encoded in I believe we can avoid the OS specific paths, and instead let users override the relevant Makefile variables. We do however need to provide enough variables to override in the first place:
(The choice of Then we modify the makefile to support all these variables. Once we do, Windows and Darwin users should be able to call What do you think of this approach? |
I understood your philosophy, thanks for clarifying.
Yeah, but for Windows there's no simple solution :)
Not true for gcc on Windows. And I believe you are not familiar with Windows development here. You got the suffixes a bit wrong. The
The thing that's there's no way to handle it via variables at least for Windows. Because we have the implib and the DLL should be put in I fully agreed with you in scope of your project and philosophy, so at this moment my changes are invalid. |
I just want to have a nice way to compile and package your library. Anyways if it's all bad I can just create a repo with makefiles for Windows/Darwin strugglers like I am :). |
That’s an understatement. 🤣 I know nothing of Windows development, and the only times I actually developed on Windows the build magic was already done for me, and I never touched the Windows API. Now I confess I have a hard time deciphering your patch, and right now I’m too lazy to apply it on a local copy on a Windows machine. So, could you share the output of a My hope is that despite the differences, we can perhaps extract a common structure between Linux, Windows, and Darwin, so users can make it work if they override enough variables. |
Yeah MS has great buildsystem but it's limited and not libre. I prefer to use gcc on Windows, unix-like environment do the best thing :) but there's still many things to keep in mind as described before...
No mandoc for Windows... What about
As you can see, the key steps steps are:
|
Ahead of the question about Darwin here is the same for it:
That's why we need |
I think the only good solution is separate makefiles then. |
Wait a minute, I’m not entirely done with the idea. This PR is likely to linger for a while, but the initial intent is good even if I’m not sure about the execution. If that’s okay with you I’m not closing it until I reach a definite decision. Plus, your patch has valuable information in it that I didn’t have before, so whatever I decide, if I do anything to support Windows and MacOS you’ll have a commit under your name. I’ll try to play around and let you know when I have a stronger opinion. |
No problem, I just wanted to mark my changes as not acceptable at this moment.
Sure I'd be happy to help. MSVC support (if planned) definitely requires a separate makefile. For now, I'm stick with my patch to install Monocypher on my systems, so I'm good :) |
The current makefile is not portable. These changes will allow to compile the library under Windows (cygwin/MinGW/MSYS) and Darwin.
Tested with cygwin, MinGW, MSYS2, macOS Sonoma, Debian