aboutsummaryrefslogtreecommitdiff
dnl -*- Autoconf -*- fragment for the C++ daemon.

AC_MSG_CHECKING([whether to build daemon])
AC_MSG_RESULT([$guix_build_daemon])

dnl C++ environment.  This macro must be used unconditionnaly.
AC_PROG_CXX
AM_PROG_AR
AC_LANG([C++])

if test "x$guix_build_daemon" = "xyes"; then

  GUIX_ASSERT_CXX11

  AC_PROG_RANLIB
  AC_CONFIG_HEADERS([nix/config.h])

  dnl Use 64-bit file system calls so that we can support files > 2 GiB.
  AC_SYS_LARGEFILE

  dnl Look for zlib, a required dependency.
  AC_CHECK_LIB([z], [gzdopen], [true],
    [AC_MSG_ERROR([Guix requires zlib.  See http://www.zlib.net/.])])
  AC_CHECK_HEADERS([zlib.h], [true],
    [AC_MSG_ERROR([Guix requires zlib.  See http://www.zlib.net/.])])

  dnl Look for libbz2, an optional dependency.
  AC_CHECK_LIB([bz2], [BZ2_bzWriteOpen], [HAVE_LIBBZ2=yes], [HAVE_LIBBZ2=no])
  if test "x$HAVE_LIBBZ2" = xyes; then
    AC_CHECK_HEADERS([bzlib.h])
    HAVE_LIBBZ2="$ac_cv_header_bzlib_h"
  fi

  dnl Look for SQLite, a required dependency.
  PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= 3.6.19])

  AC_DEFINE_UNQUOTED([SYSTEM], ["$guix_system"],
    [Guix host system type--i.e., platform and OS kernel tuple.])

  case "$LIBGCRYPT_PREFIX" in
    no)
      LIBGCRYPT_CPPFLAGS=""
      ;;
    *)
      LIBGCRYPT_CPPFLAGS="-I$LIBGCRYPT_PREFIX/include"
      ;;
  esac

  case "$LIBGCRYPT_LIBDIR" in
    no | "")
      ;;
    *)
      LIBGCRYPT_LDFLAGS="-L$LIBGCRYPT_LIBDIR"
      ;;
  esac

  LIBGCRYPT_LIBS="-lgcrypt"
  AC_SUBST([LIBGCRYPT_CPPFLAGS])
  AC_SUBST([LIBGCRYPT_LDFLAGS])
  AC_SUBST([LIBGCRYPT_LIBS])

  save_CPPFLAGS="$CPPFLAGS"
  save_LDFLAGS="$LDFLAGS"
  save_LIBS="$LIBS"
  CPPFLAGS="$CPPFLAGS $LIBGCRYPT_CPPFLAGS"
  LDFLAGS="$LDFLAGS $LIBGCRYPT_LDFLAGS"
  LIBS="$LIBS $LIBGCRYPT_LIBS"

  have_gcrypt=yes
  AC_CHECK_LIB([gcrypt], [gcry_md_open], [:], [have_gcrypt=no])
  AC_CHECK_HEADER([gcrypt.h], [:], [have_gcrypt=no])
  if test "x$have_gcrypt" != "xyes"; then
    AC_MSG_ERROR([GNU libgcrypt not found; please install it.])
  fi
  CPPFLAGS="$save_CPPFLAGS"
  LDFLAGS="$save_LDFLAGS"
  LIBS="$save_LIBS"

  dnl Chroot support.
  AC_CHECK_FUNCS([chroot unshare])
  AC_CHECK_HEADERS([sched.h sys/param.h sys/mount.h sys/syscall.h])

  if test "x$ac_cv_func_chroot" != "xyes"; then
    AC_MSG_ERROR(['chroot' function missing, bailing out])
  fi

  dnl lutimes and lchown: used when canonicalizing store items.
  dnl posix_fallocate: used when extracting archives.
  dnl vfork: to speed up spawning of helper programs.
  dnl   `--> now disabled because of unpredictable behavior:
  dnl        see <http://lists.gnu.org/archive/html/guix-devel/2014-05/msg00036.html>
  dnl        and Nix commit f794465c (Nov. 2012).
  dnl sched_setaffinity: to improve RPC locality.
  dnl statvfs: to detect disk-full conditions.
  dnl strsignal: for error reporting.
  dnl statx: fine-grain 'stat' call, new in glibc 2.28.
  AC_CHECK_FUNCS([lutimes lchown posix_fallocate sched_setaffinity \
     statvfs nanosleep strsignal statx])

  dnl Check for <locale>.
  AC_LANG_PUSH(C++)
  AC_CHECK_HEADERS([locale])
  AC_LANG_POP(C++)


  dnl Check whether we have the `personality' syscall, which allows us
  dnl to do i686-linux builds on x86_64-linux machines.
  AC_CHECK_HEADERS([sys/personality.h])

  dnl Determine the appropriate default list of substitute URLs (GnuTLS
  dnl is required so we can default to 'https'.)
  GUIX_SUBSTITUTE_URLS="https://bordeaux.guix.gnu.org https://ci.guix.gnu.org"

  AC_MSG_CHECKING([for default substitute URLs])
  AC_MSG_RESULT([$GUIX_SUBSTITUTE_URLS])
  AC_SUBST([GUIX_SUBSTITUTE_URLS])

  AC_DEFINE_UNQUOTED([GUIX_SUBSTITUTE_URLS], ["$GUIX_SUBSTITUTE_URLS"],
    [Default list of substitute URLs used by 'guix-daemon'.])

  dnl Check for Guile-SSH, which is required by 'guix offload'.
  GUIX_CHECK_GUILE_SSH

  case "x$guix_cv_have_recent_guile_ssh" in
    xyes)
      guix_build_daemon_offload="yes"
      AC_DEFINE([HAVE_DAEMON_OFFLOAD_HOOK], [1],
	[Define if the daemon's 'offload' build hook is being built (requires Guile-SSH).])
      ;;
    *)
      guix_build_daemon_offload="no"
      ;;
  esac

  dnl Temporary directory used to store the daemon's data.
  GUIX_TEST_ROOT_DIRECTORY
  GUIX_TEST_ROOT="$ac_cv_guix_test_root"
  AC_SUBST([GUIX_TEST_ROOT])

  GUIX_CHECK_LOCALSTATEDIR
fi

AM_CONDITIONAL([HAVE_LIBBZ2], [test "x$HAVE_LIBBZ2" = "xyes"])
AM_CONDITIONAL([BUILD_DAEMON], [test "x$guix_build_daemon" = "xyes"])
AM_CONDITIONAL([BUILD_DAEMON_OFFLOAD],			\
  [test "x$guix_build_daemon" = "xyes"			\
   && test "x$guix_build_daemon_offload" = "xyes"])
ile.am?id=78da6951787f07e9460091885d7a9eb3e667b512'>daemon: Explicitly unlock output path in the has-become-valid case....Fixes <https://issues.guix.gnu.org/31785>. Similar to <https://github.com/NixOS/nix/issues/178>, fixed in <https://github.com/NixOS/nix/commit/29cde917fe6b8f2e669c8bf10b38f640045c83b8>. We can't rely on Goal deletion to release our locks in a timely manner. In the case in which multiple guix-daemon processes simultaneously try producing an output path path1, the one that gets there first (P1) will get the lock, and the second one (P2) will continue trying to acquire the lock until it is released. Once it has acquired the lock, it checks to see whether the path has already become valid in the meantime, and if so it reports success to those Goals waiting on its completion and finishes. Unfortunately, it fails to release the locks it holds first, so those stay held until that Goal gets deleted. Suppose we have the following store path dependency graph: path4 / | \ path1 path2 path3 P2 is now sitting on path1's lock, and will continue to do so until path4 is completed. Suppose there is also a P3, and it has been blocked while P1 builds path2. Now P3 is sitting on path2's lock, and can't acquire path1's lock to determine that it has been completed. Likewise P2 is sitting on path1's lock, and now can't acquire path2's lock to determine that it has been completed. Finally, P3 completes path3 while P2 is blocked. Now: - P1 knows that path1 and path2 are complete, and holds no locks, but can't determine that path3 is complete - P2 knows that path1 and path3 are complete, and holds locks on path1 and path3, but can't determine that path2 is complete - P3 knows that path2 and path3 are complete, and holds a lock on path2, but can't determine that path1 is complete And none of these locks will be released until path4 is complete. Thus, we have a deadlock. To resolve this, we should explicitly release these locks as soon as they should be released. * nix/libstore/build.cc (DerivationGoal::tryToBuild, SubstitutionGoal::tryToRun): Explicitly release locks in the has-become-valid case. * tests/store-deadlock.scm: New file. * Makefile.am (SCM_TESTS): Add it. Change-Id: Ie510f84828892315fe6776c830db33d0f70bcef8 Signed-off-by: Ludovic Courtès <ludo@gnu.org> Reepca Russelstein 2024-12-13guix: toml: Add TOML parser....* guix/build/toml.scm: New file. * tests/toml.scm: New file. * Makefile.am: Register new files. Lars-Dominik Braun 2024-12-12maint: Add ungrafting manifest....* etc/manifests/ungraft.scm: New file. * Makefile.am (EXTRA_DIST): Add it. Change-Id: If4aa7649721b93d3297ecd967d5db4a6b71ec6eb Ludovic Courtès 2024-12-12etc: Move manifests to a separate directory....* etc/disarchive-manifest.scm, etc/hurd-manifest.scm, etc/kernels-manifest.scm, etc/release-manifest.scm, etc/source-manifest.scm, etc/system-tests.scm, etc/time-travel-manifest.scm, etc/upgrade-manifest.scm: Move to… * etc/manifests: … here, and drop “-manifest” from file name. * Makefile.am (EXTRA_DIST, assert-binaries-available, check-system): Adjust accordingly. Change-Id: Iedee3d0cdd42e72ef8bbf654ea5d3b47dca95874 Ludovic Courtès 2024-12-03system: Add "installer" sub-command....* guix/scripts/system/installer.scm: New file. * Makefile.am (MODULES)[ENABLE_INSTALLER]: Register it. (MODULES_NOT_COMPILED)[!ENABLE_INSTALLER]: Likewise. * guix/scripts/system.scm (show-help): Add help for "installer" sub-command. (actions): Register "installer". (guix-system): Invoke `guix-system-installer' sub-command. * doc/guix.texi (Invoking guix system): Document it. * gnu/installer.scm (run-installer): Remove "./pre-inst env". Change-Id: I5a05b941c060682c17d45d871df3cf34e3f8643a Janneke Nieuwenhuizen 2024-12-01etc: Add upgrade manifest....* guix/scripts/build.scm (dependents): Export. * etc/upgrade-manifest.scm: New file. * Makefile.am (EXTRA_DIST): Add it. Change-Id: I1b2a2ebd09e559c68da9f25772bf33caacb4c031 Ludovic Courtès 2024-11-09gnu: Remove linux-libre 6.10....* gnu/packages/linux.scm (linux-libre-6.10-version, linux-libre-6.10-gnu-revision, deblob-scripts-6.10, linux-libre-6.10-pristine-source, linux-libre-6.10-source, linux-libre-headers-6.10, linux-libre-6.10): Remove variables. * gnu/packages/aux-files/linux-libre/6.10-arm.conf, gnu/packages/aux-files/linux-libre/6.10-arm64.conf, gnu/packages/aux-files/linux-libre/6.10-riscv.conf gnu/packages/aux-files/linux-libre/6.10-i686.conf, gnu/packages/aux-files/linux-libre/6.10-x86_64.conf: Delete files. * Makefile.am (AUX_FILES): Remove aforementioned .conf files. Change-Id: I7a22ca60378b38d45130d8a7ffee52eed1fba7f3 Signed-off-by: Leo Famulari <leo@famulari.name> Wilko Meyer 2024-10-20gnu: Add linux-libre 6.11.4....* gnu/packages/linux.scm (linux-libre-6.11-version, linux-libre-6.11-gnu-revision, deblob-scripts-6.11, linux-libre-6.11-pristine-source, linux-libre-6.11-source, linux-libre-headers-6.11, linux-libre-6.11): New variables. * gnu/packages/aux-files/linux-libre/6.11-arm.conf, gnu/packages/aux-files/linux-libre/6.11-arm64.conf, gnu/packages/aux-files/linux-libre/6.11-i686.conf, gnu/packages/aux-files/linux-libre/6.11-riscv.conf, gnu/packages/aux-files/linux-libre/6.11-x86.conf: New files. * Makefile.am (AUX_FILES): Add them. Co-authored-by: Ahmad Draidi <a.r.draidi@redscript.org> Change-Id: I35bad9fbea9f568e60e7f24c95f85c240ef96277 Signed-off-by: Leo Famulari <leo@famulari.name> Wilko Meyer 2024-08-26gnu: Remove linux-libre 6.9....* gnu/packages/linux.scm (linux-libre-6.9-version, linux-libre-6.9-gnu-revision, deblob-scripts-6.9, linux-libre-6.9-pristine-source, linux-libre-6.9-source, linux-libre-headers-6.9, linux-libre-6.9): Remove variables. (linux-libre-headers-latest): New variable. (libbpf)[native-inputs]: Switch to linux-libre-headers-latest. * gnu/packages/aux-files/linux-libre/6.9-arm.conf, gnu/packages/aux-files/linux-libre/6.9-arm64.conf, gnu/packages/aux-files/linux-libre/6.9-riscv.conf gnu/packages/aux-files/linux-libre/6.9-i686.conf, gnu/packages/aux-files/linux-libre/6.9-x86_64.conf: Delete files. * Makefile.am (AUX_FILES): Remove aforementioned .conf files. Change-Id: Ia05bce46ab94f0dbbc7bb5b2e75e2067e9b78e7b Signed-off-by: Leo Famulari <leo@famulari.name> Wilko Meyer 2024-07-29gnu: Add linux-libre 6.10.1....* gnu/packages/linux.scm (linux-libre-6.10-version, linux-libre-6.10-gnu-revision, deblob-scripts-6.10, linux-libre-6.10-pristine-source, linux-libre-6.10-source, linux-libre-headers-6.10, linux-libre-6.10): New variables. * gnu/packages/aux-files/linux-libre/6.10-arm.conf, gnu/packages/aux-files/linux-libre/6.10-arm64.conf, gnu/packages/aux-files/linux-libre/6.10-i686.conf, gnu/packages/aux-files/linux-libre/6.10-x86.conf: New files. * Makefile.am (AUX_FILES): Add them. Change-Id: If62ec2e8029ebd7531d3b4ba9a666c0b5f3b0f4c Signed-off-by: Leo Famulari <leo@famulari.name> Wilko Meyer