13 , embedSamurai ? false
17 stdenv.mkDerivation (finalAttrs: {
19 + lib.optionalString embedSamurai "-embedded-samurai";
22 src = fetchFromSourcehut {
26 rev = finalAttrs.version;
27 hash = "sha256-ZHWyUV/BqM3ihauXDqDVkZURDDbBiRcEzptyGQmw94I=";
30 outputs = [ "out" ] ++ lib.optionals buildDocs [ "man" ];
36 ++ lib.optionals buildDocs [
37 (python3.withPackages (ps: [ ps.pyyaml ]))
52 # URLs manually extracted from subprojects directory
53 meson-docs-wrap = fetchurl {
54 name = "meson-docs-wrap";
55 url = "https://mochiro.moe/wrap/meson-docs-1.0.1-19-gdd8d4ee22.tar.gz";
56 hash = "sha256-jHSPdLFR5jUeds4e+hLZ6JOblor5iuCV5cIwoc4K9gI=";
59 samurai-wrap = fetchurl {
60 name = "samurai-wrap";
61 url = "https://mochiro.moe/wrap/samurai-1.2-32-g81cef5d.tar.gz";
62 hash = "sha256-aPMAtScqweGljvOLaTuR6B0A0GQQQrVbRviXY4dpCoc=";
65 pushd $sourceRoot/subprojects
66 ${lib.optionalString buildDocs "tar xvf ${meson-docs-wrap}"}
67 ${lib.optionalString embedSamurai "tar xvf ${samurai-wrap}"}
72 patchShebangs bootstrap.sh
74 + lib.optionalString buildDocs ''
75 patchShebangs subprojects/meson-docs/docs/genrefman.py
78 # tests try to access "~"
80 export HOME=$(mktemp -d)
84 muonBool = lib.mesonBool;
85 muonEnable = lib.mesonEnable;
87 cmdlineForMuon = lib.concatStringsSep " " [
88 (muonBool "static" stdenv.targetPlatform.isStatic)
89 (muonEnable "docs" buildDocs)
90 (muonEnable "samurai" embedSamurai)
92 cmdlineForSamu = "-j$NIX_BUILD_CORES";
96 ./bootstrap.sh stage-1
98 ./stage-1/muon setup ${cmdlineForMuon} stage-2
99 samu ${cmdlineForSamu} -C stage-2
101 stage-2/muon setup -Dprefix=$out ${cmdlineForMuon} stage-3
102 samu ${cmdlineForSamu} -C stage-3
107 # tests are failing because they don't find Python
113 ./stage-3/muon -C stage-3 test
121 stage-3/muon -C stage-3 install
127 homepage = "https://muon.build/";
128 description = "Implementation of Meson build system in C99";
129 license = licenses.gpl3Only;
130 maintainers = with maintainers; [ AndersonTorres ];
131 platforms = platforms.unix;
132 broken = stdenv.hostPlatform.isDarwin; # typical `ar failure`
133 mainProgram = "muon";
137 # 1. automate sources acquisition (especially wraps)