Next: , Up: 贡献   [Contents][Index]


16.1 从Git构建

如果你想折腾Guix本身,建议使用Git仓库里最新的版本:

git clone https://git.savannah.gnu.org/git/guix.git

How do you ensure that you obtained a genuine copy of the repository? To do that, run guix git authenticate, passing it the commit and OpenPGP fingerprint of the channel introduction (see 调用guix edit。):

git fetch origin keyring:keyring
guix git authenticate 9edb3f66fd807b096b48283debdcddccfea34bad \
  "BBB0 2DDF 2CEA F6A8 0D1D  E643 A2A0 6DF2 A33A 54FA"

This command completes with exit code zero on success; it prints an error message and exits with a non-zero code otherwise.

As you can see, there is a chicken-and-egg problem: you first need to have Guix installed. Typically you would install Guix System (see 系统安装) or Guix on top of another distro (see 二进制文件安装); in either case, you would verify the OpenPGP signature on the installation medium. This “bootstraps” the trust chain.

设置Guix开发环境的最简单的方式当然是使用Guix!下面这些命令启动一个shell,所有的依赖和环境变量都为折腾Guix设置好了:

guix environment guix --pure

See 调用guix environment, for more information on that command.

If you are unable to use Guix when building Guix from a checkout, the following are the required packages in addition to those mentioned in the installation instructions (see 需求).

On Guix, extra dependencies can be added by instead running guix environment with --ad-hoc:

guix environment guix --pure --ad-hoc help2man git strace

运行 ./bootstrap 以使用Autoconf和Automake生成构建系统的基础框架。如果你的得到这样的错误:

configure.ac:46: error: possibly undefined macro: PKG_CHECK_MODULES

它可能意味着Autoconf无法找到由pkg-config提供的pkg.m4。请确保pkg.m4可用。由Guile提供的guile.m4宏也类似。假如你的Automake安装在/usr/local,那么它不会从/usr/share里寻找.m4文件。这种情况下,你必须执行下面这个命令:

export ACLOCAL_PATH=/usr/share/aclocal

参考See Macro Search Path in The GNU Automake Manual.

Then, run ./configure as usual. Make sure to pass --localstatedir=directory where directory is the localstatedir value used by your current installation (see 仓库, for information about this), usually /var. Note that you will probably not run make install at the end (you don’t have to) but it’s still important to pass the right localstatedir.

Finally, you have to invoke make && make check to build Guix and run the tests (see 运行测试套件). If anything fails, take a look at installation instructions (see 安装) or send a message to the mailing list.

From there on, you can authenticate all the commits included in your checkout by running:

make authenticate

The first run takes a couple of minutes, but subsequent runs are faster.

Or, when your configuration for your local Git repository doesn’t match the default one, you can provide the reference for the keyring branch through the variable GUIX_GIT_KEYRING. The following example assumes that you have a Git remote called ‘myremote’ pointing to the official repository:

make authenticate GUIX_GIT_KEYRING=myremote/keyring

注: You are advised to run make authenticate after every git pull invocation. This ensures you keep receiving valid changes to the repository.


Next: , Up: 贡献   [Contents][Index]