modula3 / cm3

Critical Mass Modula-3
http://modula3.github.io/cm3/
Other
133 stars 26 forks source link

Packaging for NixOS #1170

Open thielema opened 10 months ago

thielema commented 10 months ago

It tried packaging CM3 for the Nix package manager and NixOS by writing this default.nix file: https://github.com/thielema/cm3/blob/nixos/default.nix

nix-build tries to utilize the shipped CMake files itself, but fails because there is something non-standard. Thus I skip Nix's configuration phase. nix-build then builds cm3 but finally fails in its fixup phase with:

...
checking for references to /build/ in /nix/store/dhq2kwr09sa6nihzsnn7rgawz9wsm9i5-cm3-5.11.4...
patchelf: wrong ELF type
patchelf: wrong ELF type
gzipping man pages under /nix/store/dhq2kwr09sa6nihzsnn7rgawz9wsm9i5-cm3-5.11.4/share/man/
patching script interpreter paths in /nix/store/dhq2kwr09sa6nihzsnn7rgawz9wsm9i5-cm3-5.11.4
stripping (with command strip and flags -S -p) in  /nix/store/dhq2kwr09sa6nihzsnn7rgawz9wsm9i5-cm3-5.11.4/lib /nix/store/dhq2kwr09sa6nihzsnn7rgawz9wsm9i5-cm3-5.11.4/bin
/nix/store/dhq2kwr09sa6nihzsnn7rgawz9wsm9i5-cm3-5.11.4
VictorMiasnikov commented 10 months ago

We are start going step by step...

VictorMiasnikov commented 10 months ago

1) I propose use most modern reliases.

I.e. mine -)

They are combo of 2-3 modern branch of cm3 team. ( I edit they as minimum as possible)

VictorMiasnikov commented 10 months ago

2) Are You really need stripping?

This can be done by editing source code of cm3

I can prepare special release

VictorMiasnikov commented 10 months ago
  1. Are You really want do not use m3cc part of cm3 ?

But see my latest issue

VictorMiasnikov commented 10 months ago

https://github.com/modula3/cm3/issues/1163

( I can not edit messages from smartphone -( )

VictorMiasnikov commented 10 months ago

Plese try do this: A) Build cm3[.exe] from cm3-boot-unix64le.cpp (?) ( This is mono-source_code file) B) Run Boot2min.py c AMD64_LINUX C) Compile m3cc D) Upgrade all ( I may be add command later)

thielema commented 10 months ago

On Fri, 27 Oct 2023, VictorMiasnikov wrote:

  1. Are You really need stripping?

This can be done by editing source code of cm3

I do not know what Nix does and why, I can just refer to what they tell me: https://nixos.org/manual/nixpkgs/stable/#chap-quick-start

The issue is not super-important. I just wanted to put my attempt in the public. It could be a way to distribute cm3 as a package for convenient installation. Even more, you can package Modula-3 projects and make them dependent on the cm3 toolchain and system libraries, if required.

VictorMiasnikov commented 10 months ago

( formatting will be fixed later)We have both .rpm and .deb packages of cm3 Modula-3I and others even public packages time to time.But Nix , as I know, use only compiling from source?31.10.2023, 13:35, "thielema" @.***>:

On Fri, 27 Oct 2023, VictorMiasnikov wrote:

  1. Are You really need stripping?

This can be done by editing source code of cm3

I do not know what Nix does and why, I can just refer to what they tell me: https://nixos.org/manual/nixpkgs/stable/#chap-quick-start

The issue is not super-important. I just wanted to put my attempt in the public. It could be a way to distribute cm3 as a package for convenient installation. Even more, you can package Modula-3 projects and make them dependent on the cm3 toolchain and system libraries, if required.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

thielema commented 10 months ago

On Tue, 31 Oct 2023, VictorMiasnikov wrote:

( formatting will be fixed later)We have both .rpm and .deb packages of cm3 Modula-3I and others even public packages time to time.

But Nix , as I know, use only compiling from source?

Nix supports both. A compiled package is considered a cashed version of a compiled source package. If we add a Nix package description to the repo at https://github.com/NixOS/nixpkgs, then the package will be precompiled for Linux and Darwin on both Intel and ARM.

VictorMiasnikov commented 10 months ago

Do You can add  cm3-boot-unix64le.cpp ( please name it cm3-exe-only or vice versa as "Nix package description"?4 binary as result are interested31.10.2023, 19:18, "thielema" @.***>:

On Tue, 31 Oct 2023, VictorMiasnikov wrote:

( formatting will be fixed later)We have both .rpm and .deb packages of cm3 Modula-3I and others even public packages time to time.

But Nix , as I know, use only compiling from source?

Nix supports both. A compiled package is considered a -lcashed version of a compiled source package. If we add a Nix package description to the repo at https://github.com/NixOS/nixpkgs, then the package will be precompiled for Linux and Darwin on both Intel and ARM.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

thielema commented 8 months ago

For now I think there is no more intervention required, because despite the warnings, cm3 seems to work.