Unverified Commit d7bead67 authored by Doron Behar's avatar Doron Behar Committed by GitHub
Browse files

tectonic{-unwrapped,}: 0.15.0 -> 0.16.9 (#509216)

parents aba5b3dd a88b601e
Loading
Loading
Loading
Loading
+68 −40
Original line number Diff line number Diff line
@@ -8,61 +8,40 @@

{
  lib,
  clangStdenv,
  stdenv,
  fetchFromGitHub,
  rustPlatform,

  # nativeBuildInputs
  pkg-config,

  # buildInputs
  fontconfig,
  harfbuzzFull,
  openssl,
  pkg-config,
  icu,
  fetchpatch2,
}:

let

  buildRustPackage = rustPlatform.buildRustPackage.override {
    # use clang to work around build failure with GCC 14
    # see: https://github.com/tectonic-typesetting/tectonic/issues/1263
    stdenv = clangStdenv;
  };

in
  # passthru.tests
  tectonic,
}:

buildRustPackage (finalAttrs: {
rustPlatform.buildRustPackage (finalAttrs: {
  pname = "tectonic";
  version = "0.15.0";
  version = "0.16.9";

  src = fetchFromGitHub {
    owner = "tectonic-typesetting";
    repo = "tectonic";
    rev = "tectonic@${finalAttrs.version}";
    sha256 = "sha256-dZnUu0g86WJIIvwMgdmwb6oYqItxoYrGQTFNX7I61Bs=";
    sha256 = "sha256-5yphhmrrfgFwQ952eWpToyGfIJVJfV6y5w0BgznSOe0=";
  };

  patches = [
    (fetchpatch2 {
      # https://github.com/tectonic-typesetting/tectonic/pull/1155
      name = "1155-fix-endless-reruns-when-generating-bbl";
      url = "https://github.com/tectonic-typesetting/tectonic/commit/fbb145cd079497b8c88197276f92cb89685b4d54.patch";
      hash = "sha256-6FW5MFkOWnqzYX8Eg5DfmLaEhVWKYVZwodE4SGXHKV0=";
    })
    ./tectonic-0.15-fix-dangerous_implicit_autorefs.patch
  ];
  cargoHash = "sha256-22Hy51zCzY2DRytcYHgwkI9+e/g52o1jy4eosvEm3KY=";

  cargoPatches = [
    (fetchpatch2 {
      # cherry-picked from https://github.com/tectonic-typesetting/tectonic/pull/1202
      name = "1202-fix-build-with-rust-1_80-and-icu-75";
      url = "https://github.com/tectonic-typesetting/tectonic/compare/19654bf152d602995da970f6164713953cffc2e6...6b49ca8db40aaca29cb375ce75add3e575558375.patch?full_index=1";
      hash = "sha256-CgQBCFvfYKKXELnR9fMDqmdq97n514CzGJ7EBGpghJc=";
    })
  nativeBuildInputs = [
    pkg-config
  ];

  cargoHash = "sha256-OMa89riyopKMQf9E9Fr7Qs4hFfEfjnDFzaSWFtkYUXE=";

  nativeBuildInputs = [ pkg-config ];

  buildFeatures = [ "external-harfbuzz" ];

  buildInputs = [
@@ -72,19 +51,68 @@ buildRustPackage (finalAttrs: {
    openssl
  ];

  # By default, tectonic looks up the latest bundle by opening this URL:
  #
  #   https://relay.fullyjustified.net/default_bundle_v${FORMAT_VERSION}.tar
  #
  # Where FORMAT_VERSION is defined here:
  #
  #   https://github.com/tectonic-typesetting/tectonic/blob/master/crates/engine_xetex/xetex/xetex_bindings.h
  #
  # When we updated the package, this URL redirects to the following:
  #
  #   https://data1.fullyjustified.net/tlextras-2022.0r0.tar
  #
  # The environment variable set below, sets the URL that will be used during
  # runtime by default. We chose to hard-code a URL to a specific version of
  # the web bundle, so that upstream won't update the `default_bundle` without
  # us noticing, and break compatibility with our biber-for-tectonic package.
  #
  # This is in principle the right thing to do, ever since the 0.16.0 release.
  # As opposed to what we had with version 0.15.0, we choose to not hard-code a
  # --web-bundle (or --bundle) argument in the wrapper of the
  # `tectonic-wrapped` package, as it is not compatible with nextonic, and
  # `tectonic -X` commands of versions 0.16.0+ -- These commands require the
  # `--bundle` argument to appear after the subcommand.
  #
  # Lastly, we might in the future need to update the bundle URL below if
  # upstream will upload a new bundle. However, upstream hasn't updated a new
  # bundle for a long time, see:
  #
  #   https://github.com/tectonic-typesetting/tectonic/issues/1269
  #
  env.TECTONIC_BUNDLE_LOCKED = "https://data1.fullyjustified.net/tlextras-2022.0r0.tar";

  postInstall = ''
    # Makes it possible to automatically use the V2 CLI API
    ln -s $out/bin/tectonic $out/bin/nextonic
  ''
  + lib.optionalString clangStdenv.hostPlatform.isLinux ''
  + lib.optionalString stdenv.hostPlatform.isLinux ''
    substituteInPlace dist/appimage/tectonic.desktop \
      --replace Exec=tectonic Exec=$out/bin/tectonic
    install -D dist/appimage/tectonic.desktop -t $out/share/applications/
    install -D dist/appimage/tectonic.svg -t $out/share/icons/hicolor/scalable/apps/
      --replace-fail Exec=tectonic Exec=$out/bin/tectonic
    install -Dm644 dist/appimage/tectonic.desktop -t $out/share/applications/
    install -Dm644 dist/appimage/tectonic.svg -t $out/share/icons/hicolor/scalable/apps/
  '';

  checkFlags = [
    # Test fails due to tectonic bundle missing and can't be downloaded in the
    # sandbox
    "--skip=tests::no_segfault_after_failed_compilation"
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    # Test Panics only on Darwin, see:
    # https://github.com/tectonic-typesetting/tectonic/issues/1352
    "--skip=v2_watch_succeeds"
  ];
  doCheck = true;

  passthru = {
    inherit (tectonic.passthru) tests;
  };

  strictDeps = true;
  __structuredAttrs = true;

  meta = {
    description = "Modernized, complete, self-contained TeX/LaTeX engine, powered by XeTeX and TeXLive";
    homepage = "https://tectonic-typesetting.github.io/";
+0 −13
Original line number Diff line number Diff line
diff --git a/crates/engine_bibtex/src/xbuf.rs b/crates/engine_bibtex/src/xbuf.rs
index 8f3949e7..c216eb4d 100644
--- a/crates/engine_bibtex/src/xbuf.rs
+++ b/crates/engine_bibtex/src/xbuf.rs
@@ -52,7 +52,7 @@ pub unsafe fn xrealloc_zeroed<T: SafelyZero>(
     old: *mut [T],
     new_len: usize,
 ) -> Option<&'static mut [T]> {
-    let old_len = (*old).len();
+    let old_len = (&(*old)).len();
     let new_size = new_len * mem::size_of::<T>();
     // SAFETY: realloc can be called with any size, even 0, that will just deallocate and return null
     let ptr = unsafe { xrealloc(old.cast(), new_size) }.cast::<T>();
+0 −9
Original line number Diff line number Diff line
{
  lib,
  symlinkJoin,
  tectonic,
  tectonic-unwrapped,
  biber-for-tectonic,
  makeBinaryWrapper,
@@ -19,13 +18,6 @@ symlinkJoin {
    unwrapped = tectonic-unwrapped;
    biber = biber-for-tectonic;
    tests = callPackage ./tests.nix { };

    # The version locked tectonic web bundle, redirected from:
    #   https://relay.fullyjustified.net/default_bundle_v33.tar
    # To check for updates, see:
    #   https://github.com/tectonic-typesetting/tectonic/blob/master/crates/bundles/src/lib.rs
    # ... and look up `get_fallback_bundle_url`.
    bundleUrl = "https://data1.fullyjustified.net/tlextras-2022.0r0.tar";
  };

  # Replace the unwrapped tectonic with the one wrapping it with biber
@@ -48,7 +40,6 @@ symlinkJoin {
  + ''
    makeWrapper ${lib.getBin tectonic-unwrapped}/bin/tectonic $out/bin/tectonic \
      --prefix PATH : "${lib.getBin biber-for-tectonic}/bin" \
      --add-flags "--web-bundle ${tectonic.passthru.bundleUrl}" \
      --inherit-argv0 ## make sure binary name e.g. `nextonic` is passed along
    ln -s $out/bin/tectonic $out/bin/nextonic
  '';
+1 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ lib.mapAttrs networkRequiringTestPkg {

  workspace = ''
    tectonic -X new
    cat Tectonic.toml | grep "${tectonic.bundleUrl}"
    cat Tectonic.toml | grep "${tectonic.unwrapped.TECTONIC_BUNDLE_LOCKED}"
  '';

  /**
+43 −42
Original line number Diff line number Diff line
{
  stdenv,
  lib,
  stdenv,
  fetchFromGitHub,

  # nativeBuildInputs
  makeWrapper,
  writeScript,
  mupdf,
  SDL2,
  re2c,
  pkg-config,
  writeShellScriptBin,

  # buildInputs
  fontconfig,
  freetype,
  jbig2dec,
  harfbuzz,
  openjpeg,
  gumbo,
  icu,
  jbig2dec,
  libjpeg,
  callPackage,
  mupdf,
  SDL2,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "texpresso";
  version = "0.1";
  version = "0.1-unstable-2026-04-02";

  src = fetchFromGitHub {
    owner = "let-def";
    repo = "texpresso";
    tag = "v${finalAttrs.version}";
    hash = "sha256-d+wNQIysn3hdTQnHN9MJbFOIhJQ0ml6PoeuwsryntTI=";
    rev = "96f008c94ece067fac8e896d0ab1808c948a4dd3";
    hash = "sha256-ew7n3Sp4uYLv5jijRW2rRM9s63TQCeFgKXmmBXdYjx4=";
  };

  postPatch = ''
    substituteInPlace Makefile \
      --replace-fail "CC=gcc" "CC=${stdenv.cc.targetPrefix}cc" \
      --replace-fail "LDCC=g++" "LDCC=${stdenv.cc.targetPrefix}c++"
    substituteInPlace src/engine/Makefile \
      --replace-fail "_CC?=gcc" "_CC?=${stdenv.cc.targetPrefix}cc" \
      --replace-fail "_LD?=g++" "_LD?=${stdenv.cc.targetPrefix}c++" \
      --replace-fail "_CXX?=g++" "_CXX?=${stdenv.cc.targetPrefix}c++"
  '';

  strictDeps = true;

  nativeBuildInputs = [
    makeWrapper
    mupdf
    SDL2
    re2c
    pkg-config
    # Especially for Darwin builds, we pretend we are Linux to avoid upstream's
    # makefiles from using brew.
    (writeShellScriptBin "uname" "echo Linux")
  ];

  buildInputs = [
    fontconfig
    freetype
    jbig2dec
    harfbuzz
    openjpeg
    gumbo
    icu
    jbig2dec
    libjpeg
    mupdf
    SDL2
  ];

  buildFlags = [ "texpresso" ];
  buildFlags = [
    "texpresso"
    "texpresso-xetex"
  ];

  env.NIX_CFLAGS_COMPILE = toString (
    lib.optionals stdenv.hostPlatform.isDarwin [
  env = lib.optionalAttrs stdenv.hostPlatform.isDarwin {
    NIX_CFLAGS_COMPILE = toString [
      "-Wno-error=implicit-function-declaration"
    ]
  );
    ];
  };

  installPhase = ''
    runHook preInstall
    install -Dm0755 -t "$out/bin/" "build/texpresso"
    install -D -t "$out/bin/" "build/texpresso"
    install -D -t "$out/bin/" "build/texpresso-xetex"
    runHook postInstall
  '';

  # needs to have texpresso-tonic on its path
  postInstall = ''
    wrapProgram $out/bin/texpresso \
      --prefix PATH : ${lib.makeBinPath [ finalAttrs.finalPackage.passthru.tectonic ]}
  '';

  passthru = {
    tectonic = callPackage ./tectonic.nix { };
    updateScript = writeScript "update-texpresso" ''
      #!/usr/bin/env nix-shell
      #!nix-shell -i bash -p curl jq nix-update

      tectonic_version="$(curl -s "https://api.github.com/repos/let-def/texpresso/contents/tectonic" | jq -r '.sha')"
      nix-update texpresso
      nix-update --version=branch=$tectonic_version texpresso.tectonic
    '';
  };

  meta = {
    inherit (finalAttrs.src.meta) homepage;
    description = "Live rendering and error reporting for LaTeX";
Loading