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