Here, I will discuss how to compile GNU coreutils from scratch. You have two options. I recommend Option 2 below.
Option 1:
First, download the source code from its repo. I will use v8.31
$ git clone https://github.com/coreutils/coreutils.git -b v8.31
$ cd coreutils
Next, clone git submodule
$ git submodule update --init
Next, bootstrap
$ ./bootstrap
./bootstrap: line 470: autopoint: command not found
./bootstrap: Error: 'autopoint' not found
./bootstrap: line 470: gettext: command not found
./bootstrap: Error: 'gettext' not found
./bootstrap: Error: 'makeinfo' version == 4.8 is too old
./bootstrap: 'makeinfo' version >= 6.1 is required
./bootstrap: See README-prereq for how to get the prerequisite programs
Well, I need to get prerequisite programs first. Install gettext using brew
$ brew install gettext && brew link gettext --force
Let's try again
$ ./bootstrap
./bootstrap: Error: 'makeinfo' version == 4.8 is too old
./bootstrap: 'makeinfo' version >= 6.1 is required
./bootstrap: See README-prereq for how to get the prerequisite programs
To check the version, run
$ makeinfo --version
makeinfo (GNU texinfo) 4.8
Copyright (C) 2004 Free Software Foundation, Inc.
There is NO warranty. You may redistribute this software
under the terms of the GNU General Public License.
For more information about these matters, see the files named COPYING.
So, I do need to update makeinfo. Note that this is the same as texi2any from GNU texinfo package.
$ pushd && cd ~/Downloads
$ wget http://ftp.gnu.org/gnu/texinfo/texinfo-6.6.tar.gz
$ cd texinfo-6.6
$ ./configure
$ make -j4
$ sudo make install
$ makeinfo --version
texi2any (GNU texinfo) 6.6
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Now, we are ready to bootstrap again
$ popd && ./bootstrap
Option 2:
Download the distribution source code
$ wget https://ftp.gnu.org/gnu/coreutils/coreutils-8.31.tar.xz
$ tar xfj coreutils-8.31.tar.xz && cd coreutils-8.31
------------------------------------------------------------------
The easy parts are left.
$ ./configure
Finally, we should be able to build it
$ make -j4
$ sudo make install
Happy hacking!
Excellent, I didn't realise there is a distribution source code (option 2) already available until I read this post. Now I can stop fighting against ./bootstrap. Thanks!
ReplyDelete