Git Product home page Git Product logo

freebsd-devel's Introduction

Notes on working with FreeBSD ports

These instructions are for me to recall stuff that I regularly look up. They are valid for FreeBSD 14.0.0

Source

Get the ports source code

git clone https://github.com/freebsd/freebsd-ports

To checkout the version of a port that is the same version as the distribution:

git checkout release/14.0.0

Create a new branch to work in

git branch category/port

where of course category/port is the path of the port in the ports tree.

Configure the make system at /etc/make.conf

# Set developer mode
DEVELOPER=yes
# Use ccache
WITH_CCACHE_BUILD=yes
# Suppress prompts
BATCH=yes
# Allow automatic sudo for install-type targets
SU_CMD=/usr/local/bin/sudo -E sh -c

And configure ccache with

mkdir -p $HOME/.ccache
cat 'export CCACHE_DIR=$HOME/.ccache' >> $HOME/.config/zsh/.zshrc.FreeBSD

Poudriere configuration

To build individial ports in parallel, use

    ALLOW_MAKE_JOBS=yes

in /usr/local/etc/poudriere.conf

Create jails

    doas poudriere jail -c -j 140rel -v 14.0-RELEASE
    doas poudriere jail -c -j 132rel -v 13.2-RELEASE
    doas poudriere jail -a i386 -c -j 140rel-i386 -v 14.0-RELEASE
    doas poudriere jail -a i386 -c -j 132rel-i386 -v 13.2-RELEASE

Create the ports tree

    doas poudriere ports -c -m null -M /home/laurent/work/freebsd-ports -p default

Update the jail to a new FreeBSD release

    doas poudriere jail -u -j 140rel

Coding

To make changes in the code, for files that are part of the git repo, make the changes To make changes in the ported software, first go to its directory and

    make extract

Changes can then be made on any file in work/portname. Remember to first make a copy with the suffix .orig. That's needed for the patch creation.

Modify port

Install dependedncies with doas make depends clean. Then, to compile and install, just make. No root priviledges are required.

If the source archive need updating, update the Makefile with the new version and download the archive with make fetch.

Create a new distinfo with make makesum make extract and then make changes in the work tree. Make copies of the modified source files with the suffix .orig

To make the patches, make makepatch will create patches using the .orig files.

To make pkg-plist, make makeplist creates a static plist. For a better plist, use doas panopticum plist category/port -j 140rel from ports-mgmt/hs-panopticum. It requires poudriere. It will create pkg-plist with all the %%OPTIONS%% populated properly. It takes a long time.

To wrap pkg-descr to 80 columns, and remove blanks at end of lines (it will keep portlint happy):

cat pkg-descr | fold -w 80 -s | sed 's/ $//' > pkg-descr

Test port

Once the changes are all done, the port files can be checked with portlint

To test the build including package creation, install and uninstall in a clean environment, use poudriere:

doas poudriere testport -j 140rel -b latest category/port

To test all the ports that I maintain, listed in the file my_ports

doas poudriere bulk -j 140rel -b latest -f my_ports
doas poudriere bulk -j 132rel -b latest -f my_ports
doas poudriere bulk -j 132rel-i386 -b latest -f my_ports
doas poudriere bulk -j 140rel-i386 -b latest -f my_ports

The -b option in poudriere makes use of pre-compiled dependencies packages instead of recompiling them all from scratch. It currently requires the poudriere-devel version of poudriere.

To find out which other ports use this port, use portgrep -u <port> that will find all ports that have USES=<port>

Submit changes

When all the changes have all been coded, commit them. The first line of the commit comment must start with category/port: FreeBSD commiters prefer that all changes are recorded in only one commit, to reduce the size of the commit log. If new changes are made, the new commit can be merged to the last one with git commit --amend Once the changes are commited, a patch can be created for submission

# If on the same bramch:
git format-patch -1 main .
# Otherwise:
git format-patch main .

This patch can be submitted to https://bugs.freebsd.org/bugzilla/

Finally, restore the git tree by undoing all your changes so that there won't be errors during your next pull

# undo last commit and discard changes if they were done in the main branch
git reset --hard HEAD~
# delete untracked files
git clean -i .

freebsd-devel's People

Contributors

laurentchardon avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.