You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

72 lines
2.7 KiB

  1. #!/bin/sh
  2. # GNU Guix --- Functional package management for GNU
  3. # Copyright © 2012, 2013, 2014, 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
  4. # Copyright © 2017 Eric Bavier <bavier@cray.com>
  5. #
  6. # This file is part of GNU Guix.
  7. #
  8. # GNU Guix is free software; you can redistribute it and/or modify it
  9. # under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 3 of the License, or (at
  11. # your option) any later version.
  12. #
  13. # GNU Guix is distributed in the hope that it will be useful, but
  14. # WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  20. # Usage: ./pre-inst-env COMMAND ARG...
  21. #
  22. # Run COMMAND in a pre-installation environment. Typical use is
  23. # "./pre-inst-env guix build hello".
  24. # By default we may end up with absolute directory names that contain '..',
  25. # which get into $GUILE_LOAD_PATH, leading to '..' in the module file names
  26. # recorded by Guile. To avoid that, make sure we get a real absolute
  27. # directory name. Additionally, use '-P' to get the canonical directory name
  28. # so that Guile's 'relative' %file-port-name-canonicalization can actually
  29. # work (see <http://bugs.gnu.org/17935>.)
  30. abs_top_srcdir="`cd "@abs_top_srcdir@" > /dev/null; pwd -P`"
  31. abs_top_builddir="`cd "@abs_top_builddir@" > /dev/null; pwd -P`"
  32. GUILE_LOAD_COMPILED_PATH="$abs_top_builddir${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
  33. GUILE_LOAD_PATH="$abs_top_builddir:$abs_top_srcdir${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
  34. export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH
  35. # Define $PATH so that `guix' and friends are easily found.
  36. PATH="$abs_top_builddir/scripts:$abs_top_builddir:$PATH"
  37. export PATH
  38. # Daemon helpers.
  39. NIX_ROOT_FINDER="$abs_top_builddir/nix/scripts/list-runtime-roots"
  40. NIX_SUBSTITUTERS="$abs_top_builddir/nix/scripts/substitute"
  41. NIX_LIBEXEC_DIR="@abs_top_builddir@/nix/scripts" # for 'guix-authenticate'
  42. export NIX_ROOT_FINDER NIX_SUBSTITUTERS NIX_LIBEXEC_DIR
  43. NIX_BUILD_HOOK="$abs_top_builddir/nix/scripts/offload"
  44. @BUILD_DAEMON_OFFLOAD_TRUE@export NIX_BUILD_HOOK
  45. @BUILD_DAEMON_OFFLOAD_FALSE@# No offloading support.
  46. @BUILD_DAEMON_OFFLOAD_FALSE@unset NIX_BUILD_HOOK
  47. # The following variables need only be defined when compiling Guix
  48. # modules, but we define them to be on the safe side in case of
  49. # auto-compilation.
  50. NIX_HASH="@NIX_HASH@"
  51. export NIX_HASH
  52. # Define $GUIX_UNINSTALLED to prevent `guix' from
  53. # prepending @guilemoduledir@ to the Guile load paths.
  54. GUIX_UNINSTALLED=1
  55. export GUIX_UNINSTALLED
  56. exec "$@"