tectonic, tectonic-unwrapped, texpresso: fix build & clean up (#384706)

This commit is contained in:
Doron Behar
2025-02-25 11:11:56 +02:00
committed by GitHub
5 changed files with 75 additions and 70 deletions
+19 -19
View File
@@ -8,10 +8,9 @@
{
lib,
stdenv,
clangStdenv,
fetchFromGitHub,
rustPlatform,
darwin,
fontconfig,
harfbuzzFull,
openssl,
@@ -20,7 +19,17 @@
fetchpatch2,
}:
rustPlatform.buildRustPackage rec {
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
buildRustPackage rec {
pname = "tectonic";
version = "0.15.0";
@@ -56,28 +65,19 @@ rustPlatform.buildRustPackage rec {
buildFeatures = [ "external-harfbuzz" ];
buildInputs =
[
icu
fontconfig
harfbuzzFull
openssl
]
++ lib.optionals stdenv.hostPlatform.isDarwin (
with darwin.apple_sdk.frameworks;
[
ApplicationServices
Cocoa
Foundation
]
);
buildInputs = [
icu
fontconfig
harfbuzzFull
openssl
];
postInstall =
''
# Makes it possible to automatically use the V2 CLI API
ln -s $out/bin/tectonic $out/bin/nextonic
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
+ lib.optionalString clangStdenv.hostPlatform.isLinux ''
substituteInPlace dist/appimage/tectonic.desktop \
--replace Exec=tectonic Exec=$out/bin/tectonic
install -D dist/appimage/tectonic.desktop -t $out/share/applications/
@@ -13,13 +13,20 @@
openjpeg,
gumbo,
libjpeg,
texpresso-tectonic,
callPackage,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "texpresso";
version = "0-unstable-2025-01-29";
src = fetchFromGitHub {
owner = "let-def";
repo = "texpresso";
rev = "c42a5912f501f180984840fa8adf9ffc09c5ac13";
hash = "sha256-T/vou7OcGtNoodCrznmjBLxg6ZAFDCjhpYgNyZaf44g=";
};
postPatch = ''
substituteInPlace Makefile \
--replace-fail "CC=gcc" "CC=${stdenv.cc.targetPrefix}cc" \
@@ -39,13 +46,6 @@ stdenv.mkDerivation rec {
libjpeg
];
src = fetchFromGitHub {
owner = "let-def";
repo = "texpresso";
rev = "c42a5912f501f180984840fa8adf9ffc09c5ac13";
hash = "sha256-T/vou7OcGtNoodCrznmjBLxg6ZAFDCjhpYgNyZaf44g=";
};
buildFlags = [ "texpresso" ];
env.NIX_CFLAGS_COMPILE = toString (
@@ -56,18 +56,18 @@ stdenv.mkDerivation rec {
installPhase = ''
runHook preInstall
install -Dm0755 -t "$out/bin/" "build/${pname}"
install -Dm0755 -t "$out/bin/" "build/${finalAttrs.pname}"
runHook postInstall
'';
# needs to have texpresso-tonic on its path
postInstall = ''
wrapProgram $out/bin/texpresso \
--prefix PATH : ${lib.makeBinPath [ texpresso-tectonic ]}
--prefix PATH : ${lib.makeBinPath [ finalAttrs.finalPackage.passthru.tectonic ]}
'';
passthru = {
tectonic = texpresso-tectonic;
tectonic = callPackage ./tectonic.nix { };
updateScript = writeScript "update-texpresso" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq nix-update
@@ -79,10 +79,10 @@ stdenv.mkDerivation rec {
};
meta = {
inherit (src.meta) homepage;
inherit (finalAttrs.src.meta) homepage;
description = "Live rendering and error reporting for LaTeX";
maintainers = with lib.maintainers; [ nickhu ];
license = lib.licenses.mit;
platforms = lib.platforms.unix;
};
}
})
+42
View File
@@ -0,0 +1,42 @@
{
tectonic-unwrapped,
fetchFromGitHub,
rustPlatform,
}:
tectonic-unwrapped.overrideAttrs (
finalAttrs: prevAttrs: {
pname = "texpresso-tonic";
version = "0.15.0-unstable-2024-04-19";
src = fetchFromGitHub {
owner = "let-def";
repo = "tectonic";
rev = "b38cb3b2529bba947d520ac29fbb7873409bd270";
hash = "sha256-ap7fEPHsASAphIQkjcvk1CC7egTdxaUh7IpSS5os4W8=";
fetchSubmodules = true;
};
useFetchCargoVendor = true;
cargoHash = "sha256-mqhbIv5r/5EDRDfP2BymXv9se2NCKxzRGqNqwqbD9A0=";
# rebuild cargoDeps by hand because `.overrideAttrs cargoHash`
# does not reconstruct cargoDeps (a known limitation):
cargoDeps = rustPlatform.fetchCargoVendor {
inherit (finalAttrs) src;
name = "${finalAttrs.pname}-${finalAttrs.version}";
hash = finalAttrs.cargoHash;
patches = finalAttrs.cargoPatches;
};
# binary has a different name, bundled tests won't work
doCheck = false;
postInstall = ''
${prevAttrs.postInstall or ""}
# Remove the broken `nextonic` symlink
# It points to `tectonic`, which doesn't exist because the exe is
# renamed to texpresso-tonic
rm $out/bin/nextonic
'';
meta = prevAttrs.meta // {
mainProgram = "texpresso-tonic";
};
}
)
@@ -1,33 +0,0 @@
{ tectonic-unwrapped, fetchFromGitHub }:
tectonic-unwrapped.override (old: {
rustPlatform = old.rustPlatform // {
buildRustPackage =
args:
old.rustPlatform.buildRustPackage (
args
// {
pname = "texpresso-tonic";
src = fetchFromGitHub {
owner = "let-def";
repo = "tectonic";
rev = "b38cb3b2529bba947d520ac29fbb7873409bd270";
hash = "sha256-ap7fEPHsASAphIQkjcvk1CC7egTdxaUh7IpSS5os4W8=";
fetchSubmodules = true;
};
useFetchCargoVendor = true;
cargoHash = "sha256-mqhbIv5r/5EDRDfP2BymXv9se2NCKxzRGqNqwqbD9A0=";
# binary has a different name, bundled tests won't work
doCheck = false;
postInstall = ''
${args.postInstall or ""}
# Remove the broken `nextonic` symlink
# It points to `tectonic`, which doesn't exist because the exe is
# renamed to texpresso-tonic
rm $out/bin/nextonic
'';
meta.mainProgram = "texpresso-tonic";
}
);
};
})
-4
View File
@@ -10625,10 +10625,6 @@ with pkgs;
fmt = fmt_11;
};
texpresso = callPackage ../tools/typesetting/tex/texpresso {
texpresso-tectonic = callPackage ../tools/typesetting/tex/texpresso/tectonic.nix { };
};
tinyxml = tinyxml2;
tinyxml2 = callPackage ../development/libraries/tinyxml/2.6.2.nix { };