Unverified Commit be95d641 authored by 7c6f434c's avatar 7c6f434c Committed by GitHub
Browse files

Merge pull request #302353 from xworld21/texlive-avoid-self-dependency

{asymptote,texlive.bin.xindy}: build binaries without docs and other tex files
parents f3be8712 783fb1cb
Loading
Loading
Loading
Loading
+58 −24
Original line number Diff line number Diff line
@@ -4,29 +4,26 @@
, boehmgc, libGLU, libGL, mesa, ncurses, readline, gsl, libsigsegv
, python3, qtbase, qtsvg, boost
, zlib, perl, curl
, texliveSmall, texinfo
, texinfo
, texlive
, texliveSmall
, darwin
}:

stdenv.mkDerivation rec {
  version = "2.88";
stdenv.mkDerivation (finalAttrs: {
  version = "2.89";
  pname = "asymptote";

  outputs = [ "out" "man" "info" "doc" "tex" ];

  src = fetchurl {
    url = "mirror://sourceforge/asymptote/${version}/asymptote-${version}.src.tgz";
    hash = "sha256-DecadD+m7pORuH3Sdcs/5M3vUbN6rhSkFoNN0Soq9bs=";
    url = "mirror://sourceforge/asymptote/${finalAttrs.version}/asymptote-${finalAttrs.version}.src.tgz";
    hash = "sha256-9k5itO5PhfGnhkDE8eim+Y6R9U7ayrGXJ8fKvpSlf1s=";
  };

  patches = [
    (fetchpatch {
      # partial fix for macOS XDR/V3D support (LDFLAGS change seems like an unrelated bugfix)
      name = "restore-LDFLAGS-dont-look-for-tirpc-under-MacOS.patch";
      url = "https://github.com/vectorgraphics/asymptote/commit/7e17096b22d18d133d1bc5916b6e32c0cb24ad10.patch";
      hash = "sha256-olCFzqfZwWOAjqlB5lDPXYRHU9i3VQNgoR0cO5TmW98=";
    })
  ];
  # override with TeX Live containers to avoid building sty, docs from source
  texContainer = null;
  texdocContainer = null;

  nativeBuildInputs = [
    autoreconfHook
@@ -37,13 +34,13 @@ stdenv.mkDerivation rec {
    wrapQtAppsHook
    cmake
    pkg-config
  ];
  ] ++ lib.optional (finalAttrs.texContainer == null || finalAttrs.texdocContainer == null)
    (texliveSmall.withPackages (ps: with ps; [ epsf cm-super ps.texinfo media9 ocgx2 collection-latexextra ]));

  buildInputs = [
    ghostscriptX imagemagick fftw eigen
    boehmgc ncurses readline gsl libsigsegv
    zlib perl curl qtbase qtsvg boost
    (texliveSmall.withPackages (ps: with ps; [ epsf cm-super ps.texinfo media9 ocgx2 collection-latexextra ]))
    (python3.withPackages (ps: with ps; [ cson numpy pyqt5 ]))
  ] ++ lib.optionals stdenv.isLinux [ libtirpc ];

@@ -57,12 +54,25 @@ stdenv.mkDerivation rec {

  dontWrapQtApps = true;

  # Do not build $tex/ls-R which will be generated by texlive.combine
  # do not build $tex/ls-R which will be generated by texlive.withPackages
  # do not build and install sty and docs, if provided by tex/texdoc texlive containers
  # (this is an optimisation to make texliveMedium and texliveFull independent of texliveSmall)
  preConfigure = ''
    HOME=$TMP
    substituteInPlace Makefile.in \
      --replace-fail 'install: install-notexhash install-texhash' 'install: install-notexhash install-asy'
      --replace-fail ' install-texhash' '''
    if [[ -n $texContainer ]] ; then
      sed -i Makefile.in -e '/(\(latex\|context\)dir)/d'
      substituteInPlace Makefile.in \
        --replace-fail 'asy sty' 'asy'
    else
      prependToVar configureFlags "--with-latex=$tex/tex/latex" "--with-context=$tex/tex/context/third"
    fi
    if [[ -n $texdocContainer ]] ; then
      substituteInPlace Makefile.in \
        --replace-fail ' install-man' ''' \
        --replace-fail 'docdir = $(DESTDIR)@docdir@' 'docdir = $(TMP)/doc'
    fi
  '';

  # do not use bundled libgc.so
@@ -76,12 +86,36 @@ stdenv.mkDerivation rec {
    rm "$out"/bin/xasy
    makeQtWrapper "$out"/share/asymptote/GUI/xasy.py "$out"/bin/xasy --prefix PATH : "$out"/bin

    if [[ -z $texdocContainer ]] ; then
      mv "$info"/share/info/asymptote/*.info "$info"/share/info/
      sed -i -e 's|(asymptote/asymptote)|(asymptote)|' "$info"/share/info/asymptote.info
      rmdir "$info"/share/info/asymptote
      rm -f "$info"/share/info/dir
    fi
    install -Dt $out/share/emacs/site-lisp/${finalAttrs.pname} $out/share/asymptote/*.el
  '';

    install -Dt $out/share/emacs/site-lisp/${pname} $out/share/asymptote/*.el
  # fixupPhase crashes if the outputs are not directories
  preFixup = ''
    if [[ -n $texContainer ]] ; then
      mkdir -p "$tex"
    fi
    if [[ -n $texdocContainer ]] ; then
      mkdir -p "$doc" "$man" "$info"
    fi
  '';

  postFixup = ''
    if [[ -n $texContainer ]] ; then
      rmdir "$tex"
      ln -s "$texContainer" "$tex"
    fi
    if [[ -n $texdocContainer ]] ; then
      mkdir -p "$man/share" "$info/share"
      ln -s "$texdocContainer" "$doc/share"
      ln -s "$texdocContainer/doc/man" "$man/share"
      ln -s "$texdocContainer/doc/info" "$info/share"
    fi
  '';

  dontUseCmakeConfigure = true;
@@ -98,4 +132,4 @@ stdenv.mkDerivation rec {
    maintainers = [ maintainers.raskin ];
    platforms = platforms.linux ++ platforms.darwin;
  };
}
})
+27 −6
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
, makeWrapper, shortenPerlShebang, useFixedHashes, asymptote
, biber-ms
, tlpdb
}:
}@args:

# Useful resource covering build options:
# http://tug.org/texlive/doc/tlbuild.html
@@ -420,7 +420,28 @@ pygmentex = python3Packages.buildPythonApplication rec {
  };
};

inherit asymptote;
asymptote = args.asymptote.overrideAttrs (finalAttrs: prevAttrs: {
  version = texlive.pkgs.asymptote.version;

  # keep local src and patches even if duplicated in the top level asymptote
  # so that top level updates do not break texlive
  src = fetchurl {
    url = "mirror://sourceforge/asymptote/${finalAttrs.version}/asymptote-${finalAttrs.version}.src.tgz";
    hash = "sha256-DecadD+m7pORuH3Sdcs/5M3vUbN6rhSkFoNN0Soq9bs=";
  };

  texContainer = texlive.pkgs.asymptote.tex;
  texdocContainer = texlive.pkgs.asymptote.texdoc;

  patches = [
    (fetchpatch {
      # partial fix for macOS XDR/V3D support (LDFLAGS change seems like an unrelated bugfix)
      name = "restore-LDFLAGS-dont-look-for-tirpc-under-MacOS.patch";
      url = "https://github.com/vectorgraphics/asymptote/commit/7e17096b22d18d133d1bc5916b6e32c0cb24ad10.patch";
      hash = "sha256-olCFzqfZwWOAjqlB5lDPXYRHU9i3VQNgoR0cO5TmW98=";
    })
  ];
});

inherit biber;
inherit biber-ms;
@@ -499,23 +520,23 @@ xindy = stdenv.mkDerivation {
  postPatch = ''
    substituteInPlace xindy-*/user-commands/xindy.in \
      --replace-fail "our \$clisp = ( \$is_windows ? 'clisp.exe' : 'clisp' ) ;" \
                     "our \$clisp = '$(type -P clisp)';"
                     "our \$clisp = '$(type -P clisp)';" \
      --replace-fail 'die "$cmd: Cannot locate xindy modules directory";' \
                     '$modules_dir = "${texlive.pkgs.xindy.tex}/xindy/modules"; die "$cmd: Cannot locate xindy modules directory" unless -d $modules_dir;'
  '';

  nativeBuildInputs = [
    pkg-config perl
    (texlive.combine { inherit (texlive) scheme-basic cyrillic ec; })
  ];
  buildInputs = [ clisp libiconv perl ];

  configureFlags = [ "--with-clisp-runtime=system" "--disable-xindy-docs" ];
  configureFlags = [ "--with-clisp-runtime=system" "--disable-xindy-docs" "--disable-xindy-rules" ];

  preInstall = ''mkdir -p "$out/bin" '';
  # fixup various file-location errors of: lib/xindy/{xindy.mem,modules/}
  postInstall = ''
    mkdir -p "$out/lib/xindy"
    mv "$out"/{bin/xindy.mem,lib/xindy/}
    ln -s ../../share/texmf-dist/xindy/modules "$out/lib/xindy/"
  '';
};