How to build and install only part of base source tree
Polytropon
freebsd at edvax.de
Tue Feb 18 17:19:00 UTC 2020
On Tue, 18 Feb 2020 10:14:20 +0900 (JST), Yasuhiro KIMURA wrote:
> I would like to add new feature to base system. My idea is simple but
> I'm not sure if it can be implemented as is expected. Therefore I
> think some trial and error will be necessary. To test it I need to
>
> (1) Edit some C source files.
> (2) Build and install one command and some library files.
>
> And doing buildworld and installworld each time I change source files
> is too heavy to repeat.
>
> Then are there any way to build and install only part of base source
> tree?
First of all, there's /etc/src.conf to control aspects of the
whole build process (see "man 5 src.conf"). Additionally, you
can change into a specific program's directory within the source
tree, then build and install it from there, for example:
# /usr/src/usr.bin/mt
[... you change mt.c ...]
# make
# make install
However be careful that, depending on the kind of changes you
make, it's possible that you need to rebuild other programs or
libraries, too. While "make buildworld" and "make installworld"
will handle such changes in an optimal manner (also see the
comment header of /usr/src/Makefile), the manual approach is
quite convenient for smaller changes, and in case of user
programs, can often be tested immediately.
Note: The build process itself will take place in /usr/obj (if
you're not changing this default), so always have a look at
what happens over there. ;-)
PS. I've done the same in /usr/src/sbin/fsck_ffs while trying
to debug and finally solving a very rare data recovery
problem.
--
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions
mailing list