====== Ports ======
* [[MateuszPiotrowski/Ports/AlternativesTo|AlternativesTo]]
* [[MateuszPiotrowski/Ports/Errors|Errors]]
* [[MateuszPiotrowski/Ports/Workshops|Workshops]]
===== Development =====
==== /etc/make.conf ====
DEVELOPER=YES
DEV_WARNING_WAIT=0
==== Testing ====
It is suggested to use ''%%devel/poudriere-devel%%'' for testing instead of ''%%ports-mgmt/porttools%%''.
==== How to work on ports without being root all the time? ====
* [[https://lists.freebsd.org/pipermail/freebsd-ports/2018-January/112201.html|First time porter seeks guidance on 'make package' (as user) (lists.freebsd.org, solution proposed by Yuri Victorovich (yuri@))]]
* [[https://lists.freebsd.org/pipermail/freebsd-ports/2018-January/112203.html|First time porter seeks guidance on 'make package' (as user) (lists.freebsd.org, solution proposed by Mathieu Arnold (mat@))]]
==== How to add patches to the files directory? ====
''%%make patch%%'' does not work well with Git-like patches:
diff --git a/config.def.h b/config.def.h
index b41747f..eae969e 100644
--- a/config.def.h
+++ b/config.def.h
It cannot understand what files it should patch so it will nag the user with a ''%%File to patch: %%'' prompt for every modified file in the patch. To avoid this it is necessary to:
* either modify the patch so that it looks more like this:
diff --git a/config.def.h b/config.def.h
index b41747f..eae969e 100644
--- ./config.def.h.orig
+++ ./config.def.h
* or just set ''%%PATCH_STRIP%%'', ''%%PATCH_DIST_STRIP%%'' (you can set those in ''%%PATCHFILES%%'' and ''%%EXTRA_PATCHES%%'' too). Example: ''%%EXTRA_PATCHES= ${FILESDIR}/bla.patch:-p1%%''.
Also remember that it is possible to use ''%%git diff --no-prefix%%'' if you are in charge of generating those patches.
==== How to modify port's options in a non-interactive way (BATCH=yes)? ====
* The easiest way is to configure the port once with ''%%make config%%''.
* If it is not an option then it is possible to set options in ''%%/etc/make.conf%%''.
* Otherwise, it is possible to set an option directly in the shell: ''%%make OPTIONS_FILE_SET=YOUROPTION%%''.
==== What does the error "make: ... line ...: Malformed conditional ..." mean? ====
You probably forgot to add the following line to your Makefile:
.include
=== References ===
* [[https://lists.freebsd.org/pipermail/freebsd-ports-announce/2013-June/000062.html|[FreeBSD-Ports-Announce Configuring options in make.conf (lists.freebsd.org)]]
==== npm ports ====
* [[https://github.com/yzgyyang/freebsd-ports-electron/pull/9|Electron port as an example of how to handle npm dependencies]]
==== Articles and tutorials ====
=== General ===
* [[https://bitbucket.org/koobs/ports/src/d8b06010c54f2f7e9465f999ce8aa985f5fd3410/README.md|FreeBSD Ports: New Contributors 101 (by Kubilay Kocak)]]
* [[Bugzilla/ThePerfectPortsIssue]]
* [[Bugzilla/DosAndDonts]]
* [[https://www.freebsd.org/doc/en/articles/committers-guide/ports.html|Ports Specific FAQ (Committer's Guide)]]
If you cannot find a mechanism you are looking for in the Porter's Handbook it is worth trying to look at the files in ''%%/usr/ports/Mk%%''.
=== Specific tools tutorials ===
* [[http://zewaren.net/site/node/172|Build your own FreeBSD ports and make packages out of them using jails, poudriere and portshaker (zewaren.net, 2017.12.10)]]
===== Usage =====
* For CURRENT there is no warranty the provided compiled packages are aligned with your installed system. The cluster is periodically updated.
* By default, ''%%pkg%%'' uses the quarterly branch (mostly security update). To get the latest versions of software edit ''%%/etc/pkg/FreeBSD.conf%%'' and change it to the latest branch. See [[https://unix.stackexchange.com/a/433876/128489|this answer]] on Unix Stack Exchange.
===== Tools =====
==== Poudriere ====
It is easy to use. Really. It seems to be tough to set up but it's not. Give it a try.
* [[https://blog.feld.me/posts/2014/06/freebsd-poudriere-cheat-sheet/|FreeBSD Poudriere Cheat Sheet (blog.feld.me)]]
* [[https://www.freebsd.org/doc/en/books/porters-handbook/testing-poudriere.html|FreeBSD Porter's Handbook: Poudriere]]
* [[https://www.freebsd.org/doc/handbook/ports-poudriere.html|FreeBSD Handbook: Building Packages with Poudriere]]
* [[https://www.digitalocean.com/community/tutorials/how-to-set-up-a-poudriere-build-system-to-create-packages-for-your-freebsd-servers|How To Set Up a Poudriere Build System to Create Packages for your FreeBSD Servers (DigitalOcean Community Tutorials)]]
=== How to maintain a tree of custom, personal ports? ===
Ideally, we would like to have a repository with our custom ports only, which could be easily integrated with Poudriere for testing.
Generally, there isn't a canonical solution to this problem. Some good sould have suggested me a couple of solutions, however:
* Keep copy of the ports tree in a Git repository and just commit your custom ports on top of it. Run ''%%git rebase -i upstream/master%%'' from time to time to sync with the upstream.
* Use [[https://www.freshports.org/ports-mgmt/portshaker/|ports-mgmt/portshaker]]. See [[https://github.com/freebsd/poudriere/wiki/portshaker|the portshaker entry on the poudriere's GitHub wiki]].
* Just get a copy of the ports tree and delete everything you don't need.
=== Troubleshooting ===
General hints:
- Check your logs: ''%% /usr/local/poudriere/data/logs/bulk/${jailname}/latest/%%''
- Check your options: ''%%/usr/local/etc/poudriere.d/options%%''
== How to deal with "Connection timeout" while checking out ports tree? ==
In case of connection timeouts of:
poudriere ports -c -m svn+https -p subversive
try to use Git instead:
poudriere ports -c -m git -p subversive
== [00:00:00] Error: DISTFILES_CACHE directory does not exist. (cf. poudriere.conf) ==
You are probably missing ''%%/usr/ports/distfiles%%''. Just create that directory.
== poudriere testport outputs "Error: Unable to extract pkg." ==
If everything build and packaged fine and then you get this error then you might have a problem with conflicts. The package that you are testing might try to install files, which are conflicting with other already installed packages. Try ''%%poudriere testport%%'' in a fresh jail.
===== Ports etiquette =====
* It is always fine to ping the maintainer of a port if your pull request is awaiting approval (unless you're sending them an email everyday).
----
{{tag>HowTo Ports}}