• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

build/H23-Jul-2021-

shell-completers/H23-Jul-2021-132108

src/H03-May-2022-16,79712,962

synthexec/H23-Jul-2021-224172

www/H03-May-2022-355317

.gitattributesH A D23-Jul-2021186 1512

.gitignoreH A D23-Jul-202194 128

README.mdH A D23-Jul-202124 KiB571429

default.gprH A D23-Jul-2021460 1913

synth.1H A D23-Jul-202126.5 KiB702698

synth.adbH A D23-Jul-202113.1 KiB379325

synthexec.gprH A D23-Jul-2021361 1711

README.md

1### Synth -  Custom package repository builder for FreeBSD and DragonFly
2
3Synth is an advanced concurrent (parallel) ports building tool aimed at
4regular users that prefer or require building their own packages from
5source.  Synth will build packages in a clean environment that exactly
6mirrors the system it builds on, creates a local repository, installs a
7pkg repository configuration file that causes the local packages to be
8used with the highest priority, and automatically upgrades the system
9with a single command.
10
11#### > synth version
12
13The version screen appears when Synth is executed with no command, an
14unknown command, or the "version" command.  It displays the current version,
15the copyright, and a summary of valid commands along with the usage.
16
17
18    ====================================================================
19      Custom package repository builder for FreeBSD and DragonFly 2.02
20    ====================================================================
21                   Copyright (C) 2015-2017 John R. Marino
22
23
24    Usage: synth [zero-parameter-option]
25    -or-   synth [list-option] <list of port origins | filename>
26
27    zero-parameter-option includes: help, configure, version, status,
28                          upgrade-system, prepare-system, status-everything
29                          everything, purge-distfiles, rebuild-repository
30    list-option includes: status, build, just-build, install, force, test
31
32#### > synth help
33
34The help screen appears when "synth help" is entered from the command line.
35It provides a slightly longer explanation of each command Synth recognizes.
36For the most detailed explanation of the Synth commands, please refer the
37manual page, e.g. "man synth".
38
39    Summary of command line options - see synth.1 man page for more details
40    ===============================================================================
41    synth status              Dry-run: Shows what 'upgrade-system' would build
42    synth configure           Brings up interactive configuration menu
43    synth upgrade-system      Incremental rebuild of installed packages on system.
44                              Afterwards, the local repository is rebuilt and the
45                              system packages are automatically upgraded.
46    synth prepare-system      Like 'upgrade-system' but ends when repo is rebuilt
47    synth rebuild-repository  Rebuilds local Synth repository on command
48    synth purge-distfiles     Deletes obsolete source distribution files
49    synth status-everything   Dry-run: Shows what 'everything' would build
50    synth everything          Builds entire ports tree and rebuilds repository
51    synth version             Displays version, description and usage summary
52    synth help                Displays this screen
53    synth status [ports]      Dry-run: Shows what will be rebuilt with given list
54    synth build [ports]       Incrementally build ports based on given list, but
55                              asks before updating repository and system
56    synth just-build [ports]  Like 'build', but skips post-build questions
57    synth install [ports]     Like 'build', but upgrades system without asking
58    synth force [ports]       Like 'build', but deletes existing packages first
59
60    synth test [ports]        Just builds with DEVELOPER=yes; pre-deletes pkgs
61
62    [ports] is a space-delimited list of origins, e.g. editors/joe editors/emacs.
63    It may also be a path to a file containing one origin per line.
64
65There are two command forms: commands with no arguments (e.g. help, version)
66and that take a list of port origins (unlimited) or a single path to file
67containing lists of port origins, one per line.  These are equivalent:
68
69```
70> synth just-build editors/joe editors/nano editors/libreoffice
71```
72
73```
74> synth just-build /tmp/build.list
75```
76
77(where the file /tmp/build.list contains:
78```
79editors/joe
80editors/nano
81editors/libreoffice
82```
83
84#### > synth configure
85
86Synth uses an interactive menu to configure itself.  It is based on profiles
87that can mix and match the parts of the build system.  Most people will use
88the "LiveSystem" profile, but advanced users may have custom bases installed
89elsewhere and prefer to create a profile that uses them.  The configuration
90also covers items such as how many builders to spawn during building, whether
91tmpfs should be used, etc.
92
93    Synth configuration profile: LiveSystem
94    ===============================================================================
95       [A] Ports directory            /usr/ports
96       [B] Packages directory         /var/synth/live_packages
97       [C] Distfiles directory        /usr/ports/distfiles
98       [D] Port options directory     /var/db/ports
99       [E] Build logs directory       /var/log/synth
100       [F] Build base directory       /usr/obj/synth-live
101       [G] System root directory      /
102       [H] Compiler cache directory   disabled
103       [I] Num. concurrent builders   6
104       [J] Max. jobs per builder      4
105       [K] Use tmpfs for work area    true
106       [L] Use tmpfs for localbase    true
107       [M] Display using ncurses      true
108       [N] Fetch prebuilt packages    false
109
110       [>]   Switch/create profiles
111       [RET] Exit
112
113    Press key of selection:
114
115Just press the letter of the item that needs configuring.  All changes will be
116marked with an asterisk, and pressing the Enter key (carriage return) will
117save the changes.
118
119#### > synth status
120```
121> synth status
122> synth status [ports]
123> synth status-everything
124```
125
126The "Status" command is unique in that there are three versions of it, and it has
127both the singular and ports-list form.  The purpose of the "Status" command is to
128perform a "dry-run" of the intended command without actually changing anything on
129the system.  It will show which packages will be deleted due to failed validity
130checks, and which packages will be built as a result.  The "synth status" command
131looks at the current list of installed packages and checks the given ports tree.
132From that it calculates which ones are outdated, and how far the rebuild will
133cascade.  The result is the number of packages that will be rebuilt to bring
134the current packages up to date.  The "synth status [ports]" accepts a list of
135ports and checks them against the local repository, and from that determines
136what actually will be rebuilt.  The "synth status-everything" command returns
137the incremental list of ports that would be built if the entire ports tree is
138requested (this is obviously not a command for an average user).
139
140    # synth status databases/postgresql96-server
141    These are the ports that would be built ([N]ew, [R]ebuild, [U]pgrade):
142      N => databases/postgresql96-client
143      N => devel/icu
144      N => databases/postgresql96-server
145    Total packages that would be built: 3
146    The complete build list can also be found at:
147    /var/synth/synth_status_results.txt
148
149#### > synth upgrade-system
150
151This is a popular command.  It would be used after bringing the ports tree up
152to date. Executing "synth upgrade-system" will perform the same analysis as
153"synth status", but then starting building all the required ports concurrently.
154When that is finished, the local repository will be updated, and finally the
155system's pkg(8) program will be commanded to update the system using the local
156repository.
157
158![synth status](www/synth_ncurses.png)
159
160During the build process, the build status is shown and updated every second.
161The user can see the results of recent builds (up to 50, but limited to screen
162size), the status of each builder, and some statistics, include system load,
163swap status, and the average number of packages built per hour.  The "impulse"
164statistic is the package build rate over the last 500 seconds.  The "Lines"
165column in the builder section is the current length of the build log, updated
166each second.
167
168#### > synth prepare-system
169
170This command is similar to the "synth upgrade-system" command except that it
171stops after rebuilding the local repository.  The sysadmin can then upgrade
172the system using pkg(8) at their leisure.
173
174#### > synth rebuild-repository
175
176This command will do a sanity check on all built packages and remove the
177invalid ones.  It will then (re)create a local repository comprised of the
178packages that remain.
179
180#### > synth just-build [ports]
181
182This command will build the list of given ports and when it has finished, the
183program will provide a final tally of the results and exit.
184
185#### > synth build [ports]
186
187This command will build the list of given ports, and when it has finished, it
188will prompt the user to answer "T" (True) or "F" (False) if they want to
189rebuild the local repository.  Just the pre-scanning can take a few minutes so
190normally the answer would be "F" until the user believes the last package has
191been built.  After the repository is rebuilt, the user will be asked another
192T/F question to confirm they want to install the specifically listed ports on
193to the system.
194
195#### > synth install [ports]
196
197This command is the same as "synth build [ports]" except it will not ask any
198questions.  When the build is finished, it rebuilds the repository and
199installs the ports automatically.
200
201#### > synth force [ports]
202
203This command is similar to "synth build [ports]" but the difference is that
204any package that exists for the listed ports is deleted first, even if it is
205a perfectly valid and up-to-date package.  The result of a "synth build"
206command could be that nothing gets built, but "synth force" will always build
207what it requested.
208
209#### > synth test [ports]
210
211This command is similar to "synth force [ports]", but the difference is that
212the ports are built under DEVELOPER mode and have additional checks.  This
213makes the build logs suitable for submitting to FreeBSD Bugzilla (as an
214alternative to Poudriere)
215
216#### > synth everything
217
218The vast majority of people will not need the "synth everything" command.
219It builds every package in the ports tree and rebuilds the local repository
220(without asking) when it's done.
221
222#### > synth purge-distfiles
223
224The command will remove all previously fetched distfiles that are no longer
225referenced by the ports tree.  It takes a few minutes to scan everything
226and then deletes the files en-masse without asking.
227
228### Miscellaneous
229
230#### Custom make.conf
231
232Any file that matches the path "/usr/local/etc/synth/[profile]-make.conf"
233where [profile] is the name of the selected configuration profile will be
234appended to the builders stock make.conf.  Note that the default profile
235name is "LiveSystem", so that would make the path is
236"/usr/local/etc/synth/LiveSystem-make.conf" for most users.
237
238#### Graceful exits
239
240Do not hit Control-C during the build!  If you want to stop building, hit
241the Control-Q combination.  Synth will exit as soon as it can.  If it's hit
242during the building process, it will finish the packages that are currently
243building but it won't start any new ones.
244
245#### Port Options
246
247Synth uses cached options if they have been saved.  Synth will scan these
248options file before starting a build, and if any are obsolete (number of
249options don't match the current port, the option names are different, etc)
250then it will print out the problematic ports and halt, recommending that
251the cached options either be removed or re-saved to something valid.  To
252build a package with non-default options, just run
253"make -C /usr/ports/[category]/[portname] config" before staring a build.
254
255#### Build logs
256
257Every build produces a log.  By default they are located at
258/var/logs/synth, but this location is configurable.  The log name is in the
259format [category]___[portname].log.
260
261#### Regular users
262
263Right now Synth can only be executed by the root user
264
265#### Non-curses mode
266
267There is a text mode for the building phase.  It shows much less information
268than the curses-based screen, but if curses is acting up, the text mode gets
269the job done just fine.  Also, when cron launches Synth, it is required that
270it be using a profile that has disabled the curses display.
271
272#### Web interface
273
274Starting with version 1.60, a dynamic web report is automatically generated
275for every build.  The report is created in the _Report_ subdirectory of the
276logs directory (/var/log/synth/Report/index.html by default).
277
278![web report](http://downloads.dragonlace.net/misc/synth-img/synth_www_3.png)
279
280The report is updated 10 times per minute.  The entire build history is
281retained and searchable during the run; it's reset upon subsequent runs.
282In addition to the standard search and navigation options, several areas
283of the report are clickable.  Click on the *Built*, *Failed*, *Ignored*,
284and *Skipped* fields to click filter for results.  Clicking on the *Total*
285field will remove all search filters.  Additionally, every cell in the
286*No.* column will filter the history for the port origin, which is
287particularly useful for finding all the ports that the builders skipped
288due to build failures or finding the port set to IGNORE.  The builder ID
289column cells also trigger a quick filter for all work performed by the builder.
290
291To view the report on a localhost, simply navigate the browser to the
292reports directory.  To view it remotely, a web server has to be installed,
293running and configured to expose the Synth logs directory for remote
294browsers.
295
296## Frequently Asked Questions
297
298### Synth fails when I run it inside a jail.  What can I do?
299
300First, there is no benefit to running Synth inside a jail.  It internally
301creates jail-like environments for each builder and to add another layer
302around Synth doesn't provide any extra protection.  It is recommended that
303you don't even bother.
304
305Wait, you don't care about that recommendation?  You demand to be able to
306run Synth in a jail?  Okay, add the following to jail.conf:
307
308```
309enforce_statfs=0
310allow.mount
311allow.mount.nullfs
312allow.mount.tmpfs
313allow.mount.devfs
314allow.chflags
315```
316(Courtesy of Dewayne Geraghty)
317
318### Synth can't fetch because I use a proxy server.  How can I fix this?
319
320This requires providing custom environment variables.  Create a file named
321/usr/local/etc/synth/<profile>-environment (e.g. LiveSystem-environment) and define
322one variable per line, e.g.
323
324```
325HTTP_PROXY=http://proxyserver:8888
326FTP_PROXY=http://proxyserver:8888
327
328http_proxy=http://proxyserver:8888
329ftp_proxy=http://proxyserver:8888
330```
331Change the urls and port numbers to match your actual proxy server port, of course.
332
333### Synth is configured to prefetch suitable officially-built packages, but very few are actually retrieved.  What's wrong?
334
335This only happens to FreeBSD users.  On FreeBSD, there are basically two official repositories:
336_Quarterly_ and _Latest_.  The 10.2 Release and later have pkg(8) configured to use the
337_Quarterly_ packages by default.  Earlier releases are configured to use the _Latest_ packages.
338
339Either repository is fine, but the provided ports tree has to match!  If you decided to continue
340with the _Quarterly_ branch (a fine choice if you don't like constant rebuilding) then you need
341to provide Synth with a SVN version of the ports tree set to the same _Quarterly_ branch. As could
342be deduced from the name, a new SVN branch is created every three months, so Synth users that
343choose the _Quarterly_ ports and packages need to remember to switch branches in January, April,
344July, and October.
345
346If you want the newest versions of software always and still leverage prebuilt packages, then ensure
347pkg(8) is configured for the _Latest_ packages and the ports tree is as well.  Unlikely
348_Quarterly_ users, _Latest_ users never have to change the ports tree configuration.
349
350### Can I use Synth to show UPDATING information?
351
352No, but you can use __pkg(8)__ to accomplish this.  Add something like this to your ~/.cshrc file:
353
354```
355alias pnotes    'date -v -4w +%Y%m%d | xargs pkg updating --date'
356```
357
358Then the next time you log in, the command "pnotes" will display the last 4 weeks worth of
359UPDATING entries based on what is installed on the system.  Note that most entries are for
360portmaster and portupgrade users, and that there will be no action for Synth/pkg users for
361the great majority of the entries.
362
363(Courtesy of Matt Smith)
364
365### Can redundant cached port options be removed en-masse?
366
367Yes.  It is not uncommon for an existing port options cache to contain
368over a 100 redundant files.  This happens when people build ports on a
369live system and just hit "ok" when the options dialog appears.  The causes
370the options settings to be saved, but this is unnecessary because the
371settings are the same as the defaults.  Later this can cause issues when
372the port maintainer updates the options and they no longer match the saved
373values.  The redundant files can be listed like this:
374
375```
376/bin/sh /usr/ports/Tools/scripts/redundant-opt-files.sh
377```
378
379To delete all the redundant options, just pipe the output into *rm*
380
381```
382/bin/sh /usr/ports/Tools/scripts/redundant-opt-files.sh | xargs rm -rf
383```
384
385### How does one configure Synth to use ccache?
386
387First, install ccache:
388
389```
390> pkg install ccache
391or
392> cd /usr/ports/devel/ccache && make install
393```
394
395Check initial configuration:
396
397```
398> ccache -s
399cache directory                     /root/.ccache
400primary config                      /root/.ccache/ccache.conf
401secondary config      (readonly)    /usr/local/etc/ccache.conf
402cache hit (direct)                     0
403cache hit (preprocessed)               0
404cache miss                             0
405files in cache                         0
406cache size                           0.0 kB
407max cache size                       5.0 GB
408```
409
410Update the maximum cache size:
411
412```
413> ccache --max-size=15G
414Set cache size limit to 15.0 GB
415```
416
417Set the cache location where you want it (e.g. /var/cache/ccache):
418
419```
420> ccache --set-config=cache_dir=/var/cache/ccache
421```
422
423check configuration again:
424
425```
426> ccache -s
427cache directory                     /var/cache/ccache
428primary config                      /root/.ccache/ccache.conf
429secondary config      (readonly)    /usr/local/etc/ccache.conf
430cache hit (direct)                     0
431cache hit (preprocessed)               0
432cache miss                             0
433files in cache                         0
434cache size                           0.0 kB
435max cache size                      15.0 GB
436```
437
438Now run __synth configure__, selection option [H], and enter the value of
439_cache directory_ (/var/cache/ccache in this example)
440
441While synth is building, you can run __ccache -s__ command repeatedly in
442another terminal to check if the statistics are changing during the build.
443If they are, ccache is properly configured.
444
445### How to configure Synth to crossbuild binaries
446
447Synth can be configured to crossbuild packages with a bit of help from
448`binmiscctl(1)` and the `qemu-user-static` port. Currently, synth supports
449armv6 and aarch64 crossbuilds on FreeBSD. Note that synth also works
450natively on FreeBSD/ARM64 (aarch64), but that option is not available for
451FreeBSD/ARM (armv6).
452
453The following example demonstrates how to
454build crossbuild armv6 from an amd64 host, and uses [QemuUserModeHowTo](https://wiki.freebsd.org/QemuUserModeHowTo)
455as a reference:
456
457First, set up a armv6 sysroot that can be used with `chroot(1)`:
458```
459# SYSROOT=/crossbuild/armv6
460# cd /usr/src
461# make -j 6 TARGET=arm TARGET_ARCH=armv6 buildworld
462# make DESTDIR=$SYSROOT TARGET=arm TARGET_ARCH=armv6 installworld
463```
464
465If this is a new sysroot, you will also need to:
466```
467# make DESTDIR=$SYSROOT TARGET=arm TARGET_ARCH=armv6 distribution
468```
469
470On the host environment, build `qemu-user-static` and copy the emulator binary
471into a sysroot directory that will be mounted by synth builds, eg `/sbin`.
472Register armv6 binaries to use the the emulator when chroot'd.
473```
474# synth install emulators/qemu-user-static
475# cp /usr/local/bin/qemu-arm-static $SYSROOT/sbin
476# binmiscctl add armelf \
477  --interpreter /sbin/qemu-arm-static \
478  --magic "\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00" \
479  --mask  "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff" \
480  --size 20 --set-enabled
481# mount -t devfs devfs ${DESTDIR}/dev
482```
483
484The sysroot is now ready to be used, and can be tested:
485```
486# chroot -u root $SYSROOT
487root@helios:/ # file /usr/bin/file
488/usr/bin/file: ELF 32-bit LSB executable, ARM, EABI5 version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 11.0 (1100510), FreeBSD-style, stripped
489```
490
491On a new chroot environment, `/var/run/ld-elf.so.hints` needs to be generated:
492```
493root@helios:/ # service ldconfig start
494```
495
496Set up separate log directories and package repos for synth on the host:
497```
498# mkdir /var/synth/armv6
499# mkdir /var/log/synth-armv6
500```
501
502Create a new profile, eg: *ArmBuild*, to use when crossbuilding. In
503particular, change:
504* Packages directory : `/var/synth/armv6`
505* Build logs directory : `/var/log/synth-armv6`
506* System root directory : `/crossbuild/armv6`
507
508To run the crossbuilding synth from the host environment, you will need to
509ensure that correct profile and package repository database is consulted, eg:
510```
511# env SYNTHPROFILE=ArmBuild PKG_DBDIR="${SYSROOT}/var/db/pkg" synth build x11/xorg
512```
513
514Current drawbacks:
515* `synth upgrade-system` will not work, as it updates the host, not the crossbuild
516
517(Courtesy of Jonathan Chen)
518
519## Overview Diagrams
520
521![Relationship with ports and pkg(8)](http://downloads.dragonlace.net/misc/synth-img/synth-arch.png)
522
523![Synth configuration summary](http://downloads.dragonlace.net/misc/synth-img/synth-config2.png)
524
525## Significant articles on the Internet
526
527#### kaba1ah.org : [Managing ports for multiple FreeBSD servers](http://www.kaba1ah.org/2017/07/31/managing-ports-for-multiple-freebsd-servers-2/)
528#### Trond's place : [First experiences with ports-mgmt/synth](https://ximalas.info/2017/12/14/first-experiences-with-ports-mgmt-synth/)
529
530## Testimonials
531
532##### Chris_H - FreeBSD forums member - 25 January 2016
533
534> marino@ regarding: 0.98_5 -- smooth as silk!
535
536> Just completed updating my box, using that version. Everything went flawlessly. Failures were handled gracefully, as well as all other events. Well; save the screen corruption, due to (kernel) messages being sent to it. But I didn't see anything in the Changelog, to indicate there were any changes in that regard -- wishful thinking on my part. ;)
537
538> Thank you very much, John. My dev box thanks you, also. :)
539
540##### garry - FreeBSD forums member - 29 January 2016
541
542> I used synth-0.99_2 to build a new repository, reproducing what I had previously built with ports-mgmt/poudriere using the same general setup (3 jails, 3 jobs, tmpfs for the workdir and data). Synth built my 1800 packages in about 18 hours of wall time with no problems. It had taken more than 24 hours of wall time to build that repository with poudriere(8). It seems that Synth is very efficient in setting up and tearing down builders (chroot(8)s / jail(8)s). I noticed that small packages can be done in 20 seconds by Synth but take a minimum of two minutes with poudriere(8).
543
544> Synth is very pleasant to use. Thanks again.
545
546##### fernandel - 2 February 2016
547
548> I am also using Synth from the first day and after all this years which I "spent" with portmaster I am so happy and thankful that is Synth in the ports and for Marinos help too. Thank you.
549
550> BTW: I start synth-upgrade system before bad time and in the morning is everything done
551
552##### Crivens -  Moderator FreeBSD forum - 1 Feb 2016
553
554> I for one, would take the moment to thank you for some great software!
555
556> This thread is turning into rope, sort of thing. Hopefully it will turn into some chapter of the handbook.
557
558##### protocelt - Moderator FreeBSD forum - 2 Feb 2016
559
560> I have 900+ ports installed on my workstation. Last repository rebuild I did, with the ccache(1) cache fully populated, Synth took around 3.5 hours to rebuild the entire repository. I don't know how long Poudriere took on the same machine but I know it was longer. I thought there was a mistake and ports were not getting rebuilt, but after checking, they were all in fact rebuilt. It is quite fast.
561
562##### PacketMan - FreeBSD forums member - 31 Jan / 3 Feb 2016
563
564> Really liking this synth. Thank you so much Marino. :beer:
565
566> Yes [Synth] a great tool; I can't wait to roll it out to all my machines.
567
568##### tankist02 - FreeBSD forums member - 7 March 2016
569
570> @marino Thank a lot for the great tool and explanation what and why it does. I used to have mysterious crashes after running portmaster. These days I use synth exclusively and crashes don't happen anymore. I tried to use poudriere and it was just too much and slow-ish for my simple needs (home desktop).
571