gnu: graphicsmagick: Fix CVE-2017-14649.
[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>
f4544767 5#
233e7676 6# This file is part of GNU Guix.
f4544767 7#
233e7676 8# GNU Guix is free software; you can redistribute it and/or modify it
f4544767
LC
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#
233e7676 13# GNU Guix is distributed in the hope that it will be useful, but
f4544767
LC
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
233e7676 19# along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
f4544767
LC
20
21# Usage: ./pre-inst-env COMMAND ARG...
22#
23# Run COMMAND in a pre-installation environment. Typical use is
6b3342af 24# "./pre-inst-env guix build hello".
f4544767 25
d862bf0f
LC
26# By default we may end up with absolute directory names that contain '..',
27# which get into $GUILE_LOAD_PATH, leading to '..' in the module file names
28# recorded by Guile. To avoid that, make sure we get a real absolute
6171070b
LC
29# directory name. Additionally, use '-P' to get the canonical directory name
30# so that Guile's 'relative' %file-port-name-canonicalization can actually
31# work (see <http://bugs.gnu.org/17935>.)
32abs_top_srcdir="`cd "@abs_top_srcdir@" > /dev/null; pwd -P`"
33abs_top_builddir="`cd "@abs_top_builddir@" > /dev/null; pwd -P`"
d862bf0f
LC
34
35GUILE_LOAD_COMPILED_PATH="$abs_top_builddir${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
c2d77474 36GUILE_LOAD_PATH="$abs_top_builddir:$abs_top_srcdir${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
ac5aa288 37export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH
f4544767 38
e49951eb 39# Define $PATH so that `guix' and friends are easily found.
f4544767 40
d862bf0f 41PATH="$abs_top_builddir/scripts:$abs_top_builddir:$PATH"
f4544767
LC
42export PATH
43
151794bf
LC
44# Daemon helpers.
45
d862bf0f 46NIX_ROOT_FINDER="$abs_top_builddir/nix/scripts/list-runtime-roots"
2c74fde0 47NIX_SUBSTITUTERS="$abs_top_builddir/nix/scripts/substitute"
70d1ce9a
LC
48NIX_LIBEXEC_DIR="@abs_top_builddir@/nix/scripts" # for 'guix-authenticate'
49
19c1ac8d
LC
50export NIX_ROOT_FINDER NIX_SUBSTITUTERS NIX_LIBEXEC_DIR
51
52NIX_BUILD_HOOK="$abs_top_builddir/nix/scripts/offload"
53if [ -x "$NIX_BUILD_HOOK" ]
54then
55 export NIX_BUILD_HOOK
56else
57 # No offloading support.
58 unset NIX_BUILD_HOOK
59fi
151794bf 60
6bfec3ed
LC
61# The 'guix-register' program.
62GUIX_REGISTER="$abs_top_builddir/guix-register"
63export GUIX_REGISTER
64
f4544767
LC
65# The following variables need only be defined when compiling Guix
66# modules, but we define them to be on the safe side in case of
67# auto-compilation.
68
69NIX_HASH="@NIX_HASH@"
00e219d1 70export NIX_HASH
f4544767 71
e49951eb
MW
72# Define $GUIX_UNINSTALLED to prevent `guix' from
73# prepending @guilemoduledir@ to the Guile load paths.
74
75GUIX_UNINSTALLED=1
76export GUIX_UNINSTALLED
77
f4544767 78exec "$@"