Fix wiki link formatting
[ikiwiki.git] / docs / howtos / HowToDPorts / index.mdwn
80be6ca4 1## DPorts background:
3Dports is an effort to use FreeBSD’s ports system as a base for DragonFly, and the pkg tool as a way to manage binary packages built from DPorts. This is complicated, so I’ll explain each part in order.
5FreeBSD ports are a FreeBSD-specific collection of software installation files that automate building 3rd-party software on FreeBSD. You’ve probably already heard of them. (Note there’s no mention of DragonFly.)
7DPorts is a collection of files that map to existing FreeBSD ports, and contain any changes necessary to make that port also build on DragonFly. Many of those programs build without changes on DragonFly. DPorts builds from source.
9pkg is used for package management, and is usable on FreeBSD, PC-BSD, and on DragonFly. The binary packages produced from building with DPorts can be installed from remote locations and managed separately using pkg, so that software upgrades and installation can be performed with binaries only. (It’s much faster that way.)
11Every port seen in DPorts is known to build on DragonFly. A port is added only after it builds successfully, using poudriere as a bulk software tool. Ports are only updated to a newer version when that newer version builds, too, so once something arrives in DPorts, it should never break from being updated at some point in the future.
f60756b0 13## Most people want pre-built binary packages rather than building from source.
5232b755 14
f60756b0 15The 3.4 Release of DragonFly is the first to provide official repositories. It also provides pkg and pkg.conf preinstalled with the release repository pre-selected.
5232b755 16
f60756b0 17The /usr/local/etc/pkg.conf is predefined as:
5232b755 18
5232b755 20
2488937c 21The user would first run "pkg update" to download the inventory from the PACKAGES. From there the user can browse the repository, install packages, etc. "pkg help" and "man pkg" has a wealth of information and much of the FreeBSD handbook is pertinent: [5.5 Using pkgng for Binary Package Management](
f60756b0 22
23The RELEASE repository is static, but the LATEST repository is periodically updated. If bleeding edge is what you want, change pkg.conf to reflect that:
27DragonFly 3.5 users can also use pre-build binary packages, but they will need to override the ABI in pkg.conf:
29 ABI: dragonfly:3.4:x86:32 # for i386 platform
30 ABI: dragonfly:3.4:x86:64 # for x86-64 platform
32There are already a few mirrors available which can be set in pkg.conf
5232b755 33
34* North America:${ABI}/LATEST
35* Europe:${ABI}/LATEST
36* Europe:${ABI}/LATEST
f60756b0 38## Building DPorts from source
40The average user will probably not build packages from source. However, it's easy to do and it can be done even when packages have already been pre-installed on the system. Common reasons to build from source are:
5232b755 41
f60756b0 42* The port is new and there's no pre-binary available yet
43* The pre-built binaries use the default options and the user needs a package built with a different set of options
44* Testing FreeBSD port in order to patch them and submit to dports
45* The user just prefers building from source
80be6ca4 46
f60756b0 47### Installing DPorts tree
80be6ca4 48
f60756b0 49DragonFly 3.3 or later is the minimum version that can build dports from source.
80be6ca4 50
f60756b0 51It's probable that pkgsrc binaries are already installed. It is necessary to
52rename /usr/pkg so that the existing pkgsrc binary programs don’t get accidentally used while building DPorts, causing breakage. If anything goes wrong with DPorts when you are installing it, you can go back by removing all the DPorts packages with "pkg delete -ay" and renaming /usr/pkg back to normal. (Don’t confuse pkg, the management tool, with /usr/pkg, the normal installation directory for pkgsrc. ) For the installation of the base port files:
80be6ca4 53
54 cd /usr
55 make dports-create-shallow
57If you’ve already renamed your /usr/pkg directory, git won’t be in your path any more. You can instead download a tarball and unpack it, which also happens to be possible automatically via that same Makefile.
59 cd /usr
60 make dports-download
62Downloading via git is fastest, so if you do need to use the tarball via make dports-download, build devel/git, delete /usr/dports, and then pull it again with make dports-create-shallow. This all comes from [John Marino’s Github site for DPorts](
f60756b0 64### Managing DPorts
80be6ca4 65
66DPorts doesn’t use pkg_info, pkg_add, and the other tools traditionally seen on DragonFly for pkgsrc. Instead, package management is done with pkg. Use pkg info, pkg install, pkg remove, and pkg update to list, install, delete, and upgrade various packages on your system. Packages built from source or downloaded as prebuilt binaries are managed the same way, using these tools.
68See some of the [other]( [writing](!.html) about pkg for FreeBSD for details on how it works.
70Since DPorts doesn’t update a package until it gets a successful build, and installations are of successfully built binary packages, upgrades with prebuilt packages should always succeed. Since they’re binary, they should be fast. There’s a lot of ‘shoulds’ in this sentence, but these are reasonable suppositions.
f60756b0 72### Building
80be6ca4 73
0fcf3e89 74Building from source works similar to ports and pkgsrc: cd into the appropriate program's directory, and type 'make'. 'make install' to install the software, 'make clean' to clean up work files, and so on. Use 'make config-recursive' if you want to set all the port's options, and the options of its dependencies, immediately instead of during the build.
76*You will eventually want to do this:* Set BATCH=yes to take all default package options without having the build stop to ask questions.
78If you just want to set the options for one package, and accept the default for all of its dependencies, do 'make config' in the package in you want non-default options, and then 'make BATCH=yes'.
80be6ca4 79
80Note that this is only necessary if you want to build from source with a non-default config, or if you don't have a binary repository available to pull files from with pkg.
80be6ca4 82## What about pkgsrc?
84Pkgsrc and DPorts shouldn’t be used at the same time, since one system’s packages may be at different versions but still get picked up during building for the other system. That’s about it for restrictions.
86DPorts is brand new so the normal caveats apply; don’t install it on a mission-critical machine, and be ready to deal with any surprises from using it if you do try it out.
88## What packages are available?
90Browsing the Github repo will show you all listed packages. It changes as more packages are built. Changes from DragonFly builds are sometimes relevant to the original FreeBSD port, so there’s benefits for everyone here.
92## What next?
94This is experimental; this will not necessarily replace pkgsrc. It's available in this release for further testing and feedback. Remember, this is a new project, so a willingness to deal with problems and contribute to fixes is necessary.