Skip to content

Commit

Permalink
texmacs: Use LLVM 17 on Darwin
Browse files Browse the repository at this point in the history
The current nixos-unstable branches uses Clang 19.1.5 on Darwin per default.
This results in compilation error
"/tmp/nix-build-texmacs-2.1.4.drv-0/TeXmacs/src/Kernel/Containers/hashtree.cpp:97:14:
error: no member named 'contains' in 'hashtree<K, V>'".
  • Loading branch information
lions-tech committed Jan 12, 2025
1 parent 26405f7 commit 81ab917
Showing 1 changed file with 53 additions and 89 deletions.
142 changes: 53 additions & 89 deletions pkgs/applications/editors/texmacs/default.nix
Original file line number Diff line number Diff line change
@@ -1,70 +1,36 @@
{
lib,
stdenv,
callPackage,
fetchurl,
guile_1_8,
xmodmap,
which,
freetype,
libjpeg,
sqlite,
texliveSmall ? null,
aspell ? null,
git ? null,
python3 ? null,
cmake,
pkg-config,
wrapQtAppsHook,
xdg-utils,
qtbase,
qtsvg,
qtmacextras,
ghostscriptX ? null,
extraFonts ? false,
chineseFonts ? false,
japaneseFonts ? false,
koreanFonts ? false,
}:
{ lib, stdenv, llvmPackages_17, callPackage, fetchurl, guile_1_8, xmodmap, which
, freetype, libjpeg, sqlite, texliveSmall ? null, aspell ? null, git ? null
, python3 ? null, cmake, pkg-config, wrapQtAppsHook, xdg-utils, qtbase, qtsvg
, qtmacextras, ghostscriptX ? null, extraFonts ? false, chineseFonts ? false
, japaneseFonts ? false, koreanFonts ? false, }:

let
pname = "texmacs";
version = "2.1.4";
common = callPackage ./common.nix {
inherit
extraFonts
chineseFonts
japaneseFonts
koreanFonts
;
inherit extraFonts chineseFonts japaneseFonts koreanFonts;
tex = texliveSmall;
};
in
stdenv.mkDerivation {
inherit pname version;
in (if stdenv.hostPlatform.isDarwin then
llvmPackages_17.stdenv
else
stdenv).mkDerivation {
inherit pname version;

src = fetchurl {
url = "https://www.texmacs.org/Download/ftp/tmftp/source/TeXmacs-${version}-src.tar.gz";
hash = "sha256-h6aSLuDdrAtVzOnNVPqMEWX9WLDHtkCjPy9JXWnBgYY=";
};
src = fetchurl {
url =
"https://www.texmacs.org/Download/ftp/tmftp/source/TeXmacs-${version}-src.tar.gz";
hash = "sha256-h6aSLuDdrAtVzOnNVPqMEWX9WLDHtkCjPy9JXWnBgYY=";
};

postPatch =
common.postPatch
+ ''
postPatch = common.postPatch + ''
substituteInPlace configure \
--replace "-mfpmath=sse -msse2" ""
'';

nativeBuildInputs = [
guile_1_8
pkg-config
wrapQtAppsHook
xdg-utils
cmake
];
nativeBuildInputs = [ guile_1_8 pkg-config wrapQtAppsHook xdg-utils cmake ];

buildInputs =
[
buildInputs = [
guile_1_8
qtbase
qtsvg
Expand All @@ -74,45 +40,43 @@ stdenv.mkDerivation {
sqlite
git
python3
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
qtmacextras
];
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ qtmacextras ];

cmakeFlags = lib.optionals stdenv.hostPlatform.isDarwin [
(lib.cmakeFeature "TEXMACS_GUI" "Qt")
(lib.cmakeFeature "CMAKE_INSTALL_PREFIX" "./TeXmacs.app/Contents/Resources")
];
cmakeFlags = lib.optionals stdenv.hostPlatform.isDarwin [
(lib.cmakeFeature "TEXMACS_GUI" "Qt")
(lib.cmakeFeature "CMAKE_INSTALL_PREFIX"
"./TeXmacs.app/Contents/Resources")
];

env.NIX_LDFLAGS = "-lz";
env.NIX_LDFLAGS = "-lz";

postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/{Applications,bin}
mv TeXmacs.app $out/Applications/
makeWrapper $out/Applications/TeXmacs.app/Contents/MacOS/TeXmacs $out/bin/texmacs
'';
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/{Applications,bin}
mv TeXmacs.app $out/Applications/
makeWrapper $out/Applications/TeXmacs.app/Contents/MacOS/TeXmacs $out/bin/texmacs
'';

qtWrapperArgs = [
"--suffix"
"PATH"
":"
(lib.makeBinPath [
xmodmap
which
ghostscriptX
aspell
texliveSmall
git
python3
])
];
qtWrapperArgs = [
"--suffix"
"PATH"
":"
(lib.makeBinPath [
xmodmap
which
ghostscriptX
aspell
texliveSmall
git
python3
])
];

postFixup = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
wrapQtApp $out/bin/texmacs
'';
postFixup = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
wrapQtApp $out/bin/texmacs
'';

meta = common.meta // {
maintainers = [ lib.maintainers.roconnor ];
platforms = lib.platforms.all;
};
}
meta = common.meta // {
maintainers = [ lib.maintainers.roconnor ];
platforms = lib.platforms.all;
};
}

0 comments on commit 81ab917

Please sign in to comment.