Unverified Commit 8ab83a21 authored by Christina Sørensen's avatar Christina Sørensen Committed by GitHub
Browse files

uiua{,-unstable}: add windowSupport option and refactor (#371040)

parents 3df3c47c e75958d0
Loading
Loading
Loading
Loading
+29 −2
Original line number Diff line number Diff line
@@ -6,11 +6,17 @@
  rustPlatform,
  fetchFromGitHub,
  pkg-config,
  versionCheckHook,

  libffi,
  audioSupport ? true,
  alsa-lib,
  webcamSupport ? false,
  libGL,
  libxkbcommon,
  wayland,
  xorg,
  windowSupport ? false,

  runCommand,
}:
@@ -34,7 +40,7 @@ lib.fix (
    src = fetchFromGitHub {
      owner = "uiua-lang";
      repo = "uiua";
      inherit (versionInfo) rev hash;
      inherit (versionInfo) tag hash;
    };

    nativeBuildInputs =
@@ -48,7 +54,28 @@ lib.fix (
    buildFeatures =
      [ "libffi/system" ] # force libffi to be linked dynamically instead of rebuilding it
      ++ lib.optional audioSupport "audio"
      ++ lib.optional webcamSupport "webcam";
      ++ lib.optional webcamSupport "webcam"
      ++ lib.optional windowSupport "window";

    postFixup =
      let
        runtimeDependencies = lib.optionals windowSupport [
          libGL
          libxkbcommon
          wayland
          xorg.libX11
          xorg.libXcursor
          xorg.libXi
          xorg.libXrandr
        ];
      in
      lib.optionalString (runtimeDependencies != [ ] && stdenv.hostPlatform.isLinux) ''
        patchelf --add-rpath ${lib.makeLibraryPath runtimeDependencies} $out/bin/uiua
      '';

    nativeInstallCheckInputs = [ versionCheckHook ];
    versionCheckProgramArg = "--version";
    doInstallCheck = true;

    passthru.updateScript = versionInfo.updateScript;
    passthru.tests.run = runCommand "uiua-test-run" { nativeBuildInputs = [ uiua ]; } ''
+1 −1
Original line number Diff line number Diff line
rec {
  version = "0.14.1";
  rev = version;
  tag = version;
  hash = "sha256-+FiJYxB2Lb1B7l9QEuB/XzdEYgJZmYAQpKimRIhWwhc=";
  cargoHash = "sha256-0ZK87aX3akEPEXIsFrbOvTfhW24TZCuCcSVp+j8ylyg=";
  updateScript = ./update-stable.sh;
+1 −1
Original line number Diff line number Diff line
rec {
  version = "0.14.1";
  rev = version;
  tag = version;
  hash = "sha256-+FiJYxB2Lb1B7l9QEuB/XzdEYgJZmYAQpKimRIhWwhc=";
  cargoHash = "sha256-0ZK87aX3akEPEXIsFrbOvTfhW24TZCuCcSVp+j8ylyg=";
  updateScript = ./update-unstable.sh;