aboutsummaryrefslogtreecommitdiff
/* GNU Guix --- Functional package management for GNU
   Copyright (C) 2020 Ludovic Courtès <ludo@gnu.org>

   This file is part of GNU Guix.

   GNU Guix is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or (at
   your option) any later version.

   GNU Guix is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.  */

/* This file implements part of the GNU ld.so audit interface.  It is used by
   the "fakechroot" engine of the 'guix pack -RR' wrappers to make sure the
   loader looks for shared objects under the "fake" root directory.  */

#define _GNU_SOURCE 1

#include <link.h>

#include <error.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>

/* The pseudo root directory and store that we are relocating to.  */
static const char *root_directory;
static char *store;

/* The original store, "/gnu/store" by default.  */
static const char original_store[] = "@STORE_DIRECTORY@";

/* Like 'malloc', but abort if 'malloc' returns NULL.  */
static void *
xmalloc (size_t size)
{
  void *result = malloc (size);
  assert (result != NULL);
  return result;
}

unsigned int
la_version (unsigned int v)
{
  if (v != LAV_CURRENT)
    error (1, 0, "cannot handle interface version %u", v);

  root_directory = getenv ("FAKECHROOT_BASE");
  if (root_directory == NULL)
    error (1, 0, "'FAKECHROOT_BASE' is not set");

  store = xmalloc (strlen (root_directory) + sizeof original_store);
  strcpy (store, root_directory);
  strcat (store, original_store);

  return v;
}

/* Return NAME, a shared object file name, relocated under STORE.  This
   function is called by the loader whenever it looks for a shared object.  */
char *
la_objsearch (const char *name, uintptr_t *cookie, unsigned int flag)
{
  char *result;

  if (strncmp (name, original_store,
	       sizeof original_store - 1) == 0)
    {
      size_t len = strlen (name) - sizeof original_store
	+ strlen (store) + 1;
      result = xmalloc (len);
      strcpy (result, store);
      strcat (result, name + sizeof original_store - 1);
    }
  else
    result = strdup (name);

  return result;
}
Tobias Geerinckx-Rice 2022-05-08gnu: beep: Drop obsolete $(pkgdocdir) make flag....* gnu/packages/terminals.scm (beep)[arguments]: Remove "pkgdocdir=" from #:make-flags. Tobias Geerinckx-Rice 2022-05-08gnu: beep: Use G-expressions....* gnu/packages/terminals.scm (beep)[arguments]: Rewrite as G-expressions. Tobias Geerinckx-Rice 2022-05-08gnu: beep: Update to 1.4.12....* gnu/packages/terminals.scm (beep): Update to 1.4.12. [arguments]: Set $(CC) #:make-flag. Manually substitute the correct value of make check's $(PWD). (!) Tobias Geerinckx-Rice 2022-05-09gnu: cool-retro-term: Lint package definition....* gnu/packages/terminals.scm [inputs]: Add bash-minimal. [source]: Remove trailing #t. [arguments]: Remove trailing #t from phases. Signed-off-by: Ludovic Courtès <ludo@gnu.org> kiasoc5 2022-05-09gnu: cool-retro-term: Upgrade to 1.2.0....* gnu/packages/terminals.scm (cool-retro-term): Upgrade to 1.2.0. [source]: Use commit as version. [inputs]: Use qtquickcontrols2 instead of qtquickcontrols. Signed-off-by: Ludovic Courtès <ludo@gnu.org> kiasoc5 2022-03-31gnu: tio: Update to 1.36....* gnu/packages/terminals.scm (tio): Update to 1.36. [native-inputs]: Add pkg-config. [inputs]: Add libinih. Signed-off-by: Efraim Flashner <efraim@flashner.co.il> Raphaël Mélotte via Guix-patches 2022-03-11gnu: tio: Update to 1.35....* gnu/packages/terminals.scm (tio): Update to 1.35. [build-system]: Switch to MESON-BUILD-SYSTEM. Note: the build system changed to meson in the following commit: https://github.com/tio/tio/commit/e9208d693ee21a062dc2b3f2dd16a9d6b8926b90 Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr> Raphaël Mélotte via Guix-patches 2022-02-15gnu: foot: Update to 1.11.0...* gnu/packages/terminals.scm (foot): Update to 1.11.0. Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr> Felipe Balbi 2022-01-22gnu: alacritty: Fix failing build....* gnu/packages/crates-io.scm (rust-alacritty-terminal)[inputs]: Update rust-nix. * gnu/packages/terminals.scm (alacritty)[arguments]: Add phase 'use-new-nix. Signed-off-by: Oleg Pykhalov <go.wigust@gmail.com> SeerLite via Guix-patches via 2022-01-15gnu: beep: Run tests....* gnu/packages/terminals.scm (beep)[arguments]: Remove #:tests? #f lie. Add a new 'patch-tests phase to make them pass. Tobias Geerinckx-Rice 2022-01-15gnu: beep: Update to 1.4.10....* gnu/packages/terminals.scm (beep): Update to 1.4.10. Tobias Geerinckx-Rice