Modifying the source code and assembling it



For example, you need to change a port in FreeBSD in order to fix or add something to the program, you can do this by downloading and unpacking the ports into the system with the following commands:



portsnap fetch

portsnap extract


Or you can update the ports


portsnap update


You can also use a single command


portsnap auto


The next step is to go to the ports folder and look, then download the source code:


cd /usr/ports/.../...


cat Makefile


At the MASTER_SITES= line you will find the path to the archive with the code you want to download


After you have downloaded the archive, unpack it somewhere, change the code as you want and rearchive it with the same name.


To build the modified port you need to know its checksums and file size:



sha256 edit.tar.gz

stat edit.tar.gz


Then edit the file distinfo with the correct checksums and size:


ee distinfo


SHA256 (edit.tar.gz) = 2b45ced81fe460f984444e28d9a283e6f1c67c97d4a293dd026aee013d330c9c

SIZE (edit.tar.gz) = 24505


To build the port run the following command


make MAKE_JOBS_UNSAFE=yes install


If we get any bugs, correct them in the code and go through the whole process again.


BSD is so easy and fun.


Share This Article

Previous Article

November 12, 2022 • 6:54AM

Next Article

December 23, 2022 • 5:08AM

From Our Blog