diff options
author | Michal Sojka <michal.sojka@cvut.cz> | 2024-01-15 21:39:22 +0100 |
---|---|---|
committer | Michal Sojka <michal.sojka@cvut.cz> | 2024-01-15 21:39:22 +0100 |
commit | 9fb55f492c750da2ffcfd69bd958f156fe86f2a7 (patch) | |
tree | abaeebd4084379184c9769bc340aa340a427c5f3 | |
parent | 9b19f5e77dd906cb52dade0b7bd280339d2a1f3d (diff) |
auto-multiple-choice: use absolute paths instead of "portable" strategy
Currently, auto-multiple-choice from nixpkgs doesn't work on systems with /lib directory. Running auto-multiple-choice there fails with: Unknown action gui at /nix/store/n3cyw5ngp0v52rny9gr6z35vslh5d4vx-auto-multiple-choice-1.6.0/bin/.auto-multiple-choice-wrapped line 94. This happens on non-NixOS systems as well as on NixOS with e.g. nix-ldĀ [1] enabled. The reason is documented in the Nix expression and the problem is reported upstream at https://project.auto-multiple-choice.net/issues/872. However, the problem can be worked around without requiring upstream changes, as shown in this commit. We stop using the "portable distribution", which tries to detect the base directory at run time, and instead hardcode all paths as absolute at build time. [1] https://github.com/Mic92/nix-ld
-rw-r--r-- | pkgs/applications/misc/auto-multiple-choice/default.nix | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/pkgs/applications/misc/auto-multiple-choice/default.nix b/pkgs/applications/misc/auto-multiple-choice/default.nix index 43aad6d5be16b..4d1a80faf28f7 100644 --- a/pkgs/applications/misc/auto-multiple-choice/default.nix +++ b/pkgs/applications/misc/auto-multiple-choice/default.nix @@ -37,31 +37,28 @@ stdenv.mkDerivation (finalAttrs: rec { makeFlags = [ "PERLPATH=${perl}/bin/perl" - # We *need* to pass DESTDIR, as the Makefile ignores PREFIX. - "DESTDIR=$(out)" - # Relative paths. - "BINDIR=/bin" - "PERLDIR=/share/perl5" - "MODSDIR=/lib" # At runtime, AMC will test for that dir before - # defaulting to the "portable" strategy we use, so this test - # *must* fail. *But* this variable cannot be set to anything but - # "/lib" , because that name is hardcoded in the main executable - # and this variable controls both both the path AMC will check at - # runtime, AND the path where the actual modules will be stored at - # build-time. This has been reported upstream as - # https://project.auto-multiple-choice.net/issues/872 - "TEXDIR=/tex/latex/" # what texlive.combine expects - "TEXDOCDIR=/share/doc/texmf/" # TODO where to put this? - "MAN1DIR=/share/man/man1" - "DESKTOPDIR=/share/applications" - "METAINFODIR=/share/metainfo" - "ICONSDIR=/share/auto-multiple-choice/icons" - "APPICONDIR=/share/icons/hicolor" - "LOCALEDIR=/share/locale" - "MODELSDIR=/share/auto-multiple-choice/models" - "DOCDIR=/share/doc/auto-multiple-choice" - "SHARED_MIMEINFO_DIR=/share/mime/packages" - "LANG_GTKSOURCEVIEW_DIR=/share/gtksourceview-4/language-specs" + # We *need* to set DESTDIR as empty and use absolute paths below, + # because the Makefile ignores PREFIX and MODSDIR is required to + # be an absolute path to not trigger "portable distribution" check + # in auto-multiple-choice.in. + "DESTDIR=" + # Set variables from Makefile.conf to absolute paths + "BINDIR=${placeholder "out"}/bin" + "PERLDIR=${placeholder "out"}/share/perl5" + "MODSDIR=${placeholder "out"}/lib" + "TEXDIR=${placeholder "out"}/tex/latex/" # what texlive.combine expects + "TEXDOCDIR=${placeholder "out"}/share/doc/texmf/" # TODO where to put this? + "MAN1DIR=${placeholder "out"}/share/man/man1" + "DESKTOPDIR=${placeholder "out"}/share/applications" + "METAINFODIR=${placeholder "out"}/share/metainfo" + "ICONSDIR=${placeholder "out"}/share/auto-multiple-choice/icons" + "CSSDIR=${placeholder "out"}/share/auto-multiple-choice/gtk" + "APPICONDIR=${placeholder "out"}/share/icons/hicolor" + "LOCALEDIR=${placeholder "out"}/share/locale" + "MODELSDIR=${placeholder "out"}/share/auto-multiple-choice/models" + "DOCDIR=${placeholder "out"}/share/doc/auto-multiple-choice" + "SHARED_MIMEINFO_DIR=${placeholder "out"}/share/mime/packages" + "LANG_GTKSOURCEVIEW_DIR=${placeholder "out"}/share/gtksourceview-4/language-specs" # Pretend to be redhat so `install` doesn't try to chown/chgrp. "SYSTEM_TYPE=rpm" "GCC=${stdenv.cc.targetPrefix}cc" |