nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
https://nim-lang.org
Other
16.6k stars 1.47k forks source link

How to generate scripts for a currently unsupported platform with `niminst`? #24414

Open barracuda156 opened 1 week ago

barracuda156 commented 1 week ago

Summary

Could someone explain (or refer to a documentation) how exactly to use niminst to generate build scripts for a currently unsupported platform? I need that for csources to begin with, and then for Nim.

Description

The context: I have a PR for initial support of Darwin PowerPC (it is WIP, cannot be merged yet): https://github.com/nim-lang/csources_v1/pull/7 I did some manual patching back then, but it is not the right way to go. I was able to compile niminst from source on a arm64 Mac, but cannot figure out what to do to generate w/e needed for PowerPC.

Alternatives

No response

Examples

No response

Backwards Compatibility

No response

Links

No response

Araq commented 1 week ago

Assuming the setup is already covered by compiler/platform.nim (check!), you need to edit compiler/installer.ini and then run niminst. Then inside csources_v2 run push_c_code.nim that assumes your nim that was used for niminst is in ../nim2! But you can also edit this push_c_code.nim program or do what it does manually.

Araq commented 1 week ago

Note that macosx: i386;amd64;powerpc64;arm64 is already listed in installer.ini. I think you want macosx: i386;amd64;powerpc64;powerpc;arm64 instead.

barracuda156 commented 1 week ago

@Araq Thank you for responding!

Note that macosx: i386;amd64;powerpc64;arm64 is already listed in installer.ini. I think you want macosx: i386;amd64;powerpc64;powerpc;arm64 instead.

Yes, that I have done. We also need an alternative way to decide on the build arch for powerpc, since a) uname -m returns Power Macintosh and not the arch name, and b) even using correct uname -p does not really help, since it cannot differentiate between ppc and ppc64 (either can be built at least on 10.5.8 on G5 machine). I might have amended the script in a way build arch gonna be respected, but need to sort out generating scripts from templates first.