pkgbuild is a tool to build package from ports. Is will source spkgbuild to get build information before creating package. Package is created into <name>-<version>-<release>.spkg.txz format. To build package, you need cd into port directory before run pkgbuild command.

  pkgbuild [ <options> <arguments> ]

  -i, --install             install package into system
  -u, --upgrade             upgrade package
  -r, --reinstall           reinstall package
  -d, --no-dep              skip dependency check
  -c, --ignore-conflict     ignore conflict when installing package
  -v, --verbose             verbose install process
  -f, --force-rebuild       rebuild package
  -m, --ignore-mdsum        skip md5sum checking
  -g, --genmdsum            generate md5sum
  -o, --download-only       download only source file
  -e, --extract-only        extract only source file
  -w, --keep-work           keep working directory
  -h, --help                show this help message
      --srcdir=<path>       override directory path for sources
      --pkgdir=<path>       override directory path for compiled package
      --no-preinstall       skip preinstall script before build/install package
      --no-postinstall      skip postinstall script after install package
      --no-preupgrade       skip preupgrade script before upgrade package
      --no-postupgrade      skip postupgrade script after upgrade package
      --no-color            disable color
      --no-backup           skip backup configuration file when upgrading package
      --redownload          re-download source file


pkgbuild -irw this will force rebuild, install package and keep working directory