Merge pull request #169961 from AndersonTorres/new-muon

muon: init at unstable-2022-09-24

authored by

Anderson Torres and committed by
GitHub
6690600e 581ffd95

+144
+138
pkgs/development/tools/build-managers/muon/default.nix
···
··· 1 + { lib 2 + , stdenv 3 + , fetchFromSourcehut 4 + , fetchurl 5 + , curl 6 + , libarchive 7 + , libpkgconf 8 + , pkgconf 9 + , python3 10 + , samurai 11 + , scdoc 12 + , zlib 13 + , embedSamurai ? false 14 + , buildDocs ? true 15 + }: 16 + 17 + stdenv.mkDerivation (finalAttrs: { 18 + pname = "muon" 19 + + lib.optionalString embedSamurai "-embedded-samurai"; 20 + version = "unstable-2022-09-24"; 21 + 22 + src = fetchFromSourcehut { 23 + name = "muon-src"; 24 + owner = "~lattis"; 25 + repo = "muon"; 26 + rev = "f385c82a6104ea3341ca34756e2812d700bc43d8"; 27 + hash = "sha256-Cr1r/sp6iVotU+n4bTzQiQl8Y+ShaqnnaWjL6gRW8p0="; 28 + }; 29 + 30 + nativeBuildInputs = [ 31 + pkgconf 32 + samurai 33 + ] 34 + ++ lib.optionals buildDocs [ 35 + (python3.withPackages (ps: [ ps.pyyaml ])) 36 + scdoc 37 + ]; 38 + 39 + buildInputs = [ 40 + curl 41 + libarchive 42 + libpkgconf 43 + samurai 44 + zlib 45 + ]; 46 + 47 + strictDeps = true; 48 + 49 + postUnpack = let 50 + # URLs manually extracted from subprojects directory 51 + meson-docs-wrap = fetchurl { 52 + name = "meson-docs-wrap"; 53 + url = "https://mochiro.moe/wrap/meson-docs-0.63.0-116-g8a45c81cf.tar.gz"; 54 + hash = "sha256-fsXdhfBEXvw1mvqnPp2TgZnO5FaeHTNW3Nfd5qfTfxg="; 55 + }; 56 + 57 + samurai-wrap = fetchurl { 58 + name = "samurai-wrap"; 59 + url = "https://mochiro.moe/wrap/samurai-1.2-28-g4e3a595.tar.gz"; 60 + hash = "sha256-TZAEwndVgoWr/zhykfr0wcz9wM96yG44GfzM5p9TpBo="; 61 + }; 62 + in '' 63 + pushd $sourceRoot/subprojects 64 + ${lib.optionalString buildDocs "tar xvf ${meson-docs-wrap}"} 65 + ${lib.optionalString embedSamurai "tar xvf ${samurai-wrap}"} 66 + popd 67 + ''; 68 + 69 + postPatch = '' 70 + patchShebangs bootstrap.sh 71 + '' 72 + + lib.optionalString buildDocs '' 73 + patchShebangs subprojects/meson-docs/docs/genrefman.py 74 + ''; 75 + 76 + # tests try to access "~" 77 + postConfigure = '' 78 + export HOME=$(mktemp -d) 79 + ''; 80 + 81 + buildPhase = let 82 + featureFlag = feature: flag: 83 + "-D${feature}=${if flag then "enabled" else "disabled"}"; 84 + conditionFlag = condition: flag: 85 + "-D${condition}=${lib.boolToString flag}"; 86 + cmdlineForMuon = lib.concatStringsSep " " [ 87 + (conditionFlag "static" stdenv.targetPlatform.isStatic) 88 + (featureFlag "docs" buildDocs) 89 + (featureFlag "samurai" embedSamurai) 90 + ]; 91 + cmdlineForSamu = "-j$NIX_BUILD_CORES"; 92 + in '' 93 + runHook preBuild 94 + 95 + ./bootstrap.sh stage-1 96 + 97 + ./stage-1/muon setup ${cmdlineForMuon} stage-2 98 + samu ${cmdlineForSamu} -C stage-2 99 + 100 + stage-2/muon setup -Dprefix=$out ${cmdlineForMuon} stage-3 101 + samu ${cmdlineForSamu} -C stage-3 102 + 103 + runHook postBuild 104 + ''; 105 + 106 + # tests are failing because they don't find Python 107 + doCheck = false; 108 + 109 + checkPhase = '' 110 + runHook preCheck 111 + 112 + ./stage-3/muon -C stage-3 test 113 + 114 + runHook postCheck 115 + ''; 116 + 117 + installPhase = '' 118 + runHook preInstall 119 + 120 + stage-3/muon -C stage-3 install 121 + 122 + runHook postInstall 123 + ''; 124 + 125 + meta = with lib; { 126 + homepage = "https://muon.build/"; 127 + description = "An implementation of Meson build system in C99"; 128 + license = licenses.gpl3Only; 129 + maintainers = with maintainers; [ AndersonTorres ]; 130 + platforms = platforms.unix; 131 + broken = stdenv.isDarwin; # typical `ar failure` 132 + }; 133 + }) 134 + # TODO LIST: 135 + # 1. setup hook 136 + # 2. multiple outputs 137 + # 3. automate sources acquisition (especially wraps) 138 + # 4. tests
+6
pkgs/top-level/all-packages.nix
··· 17202 17203 samurai = callPackage ../development/tools/build-managers/samurai { }; 17204 17205 saleae-logic = callPackage ../development/tools/misc/saleae-logic { }; 17206 17207 saleae-logic-2 = callPackage ../development/tools/misc/saleae-logic-2 { };
··· 17202 17203 samurai = callPackage ../development/tools/build-managers/samurai { }; 17204 17205 + muon = callPackage ../development/tools/build-managers/muon { }; 17206 + muonStandalone = muon.override { 17207 + embedSamurai = true; 17208 + buildDocs = false; 17209 + }; 17210 + 17211 saleae-logic = callPackage ../development/tools/misc/saleae-logic { }; 17212 17213 saleae-logic-2 = callPackage ../development/tools/misc/saleae-logic-2 { };