prtcreate(1)

NAME
prtcreate - create a CRUX Pkgfile in current directory

SYNOPSIS

prtcreate [-h|-f] [template]

DESCRIPTION
The prtcreate script creates a Pkgfile with all necessary fields in the current directory. The name of the port is the current directory and the release number is set to 1. All other fields are empty. If the Pkgfile already exists and the option -f is not given, an error message is printed and prtcreate exits with an error status of 1.

OPTIONS

-h  Print a brief reminder of usage.

-f  Force the operation even if a Pkgfile already exists.

ARGUMENT
If given, each argument is interpreted as the name of a file under /usr/share/prtcreate. This directory contains templates for several common build systems (autotools, meson, cmake, perl, py3pip, py3setup, and r). The contents of the requested template(s) will be copied verbatim into the Pkgfile build() function. Most of the time you will only want to pass one argument, but support for multiple arguments allows you to factor out common tests for optional dependencies (prt-get isinst ...) and combine them with different build systems.

If no argument is given, the resulting Pkgfile will contain a minimal build() function, performing only an initial cd into the source directory.

CONFIG
You can create /etc/prtcreate.conf to configure a fixed maintainer line for your new Pkgfiles.

	root@hostname:/root # cat /etc/prtcreate.conf
	maintainer_line="Your Name, your_mail at provider dot tld"
	root@hostname:/root #

You can populate /usr/share/prtcreate with your own templates, as illustrated in the third example below. Or you can edit the provided templates and safeguard your changes using UPGRADE NO rules in pkgadd.conf(5).

EXAMPLES

Call prtcreate without arguments in a newly created directory:

	root@hostname:/root # mkdir my-new-port
	root@hostname:/root # cd my-new-port
	root@hostname:/root/my-new-port # prtcreate
	root@hostname:/root/my-new-port # cat Pkgfile
	# Description:
	# URL:
	# Maintainer:
	# Depends on:
	name=my-new-port
	version=
	release=1
	source=()
	build() {
	        cd $name-$version
	}

Call prtcreate with one argument in a newly created directory:

	root@hostname:/root # mkdir my-new-port
	root@hostname:/root # cd my-new-port
	root@hostname:/root/my-new-port # prtcreate autotools
	root@hostname:/root/my-new-port # cat Pkgfile
	# Description:
	# URL:
	# Maintainer:
	# Depends on:
	name=my-new-port
	version=
	release=1
	source=()
	build() {
          cd $name-$version
          # autoreconf -fvi
          ./configure --prefix=/usr
          make
          make DESTDIR="$PKG" install
	}

Call prtcreate with two arguments in a newly created directory:

	root@hostname:/root # mkdir my-new-port
	root@hostname:/root # cd my-new-port
	root@hostname:/root/my-new-port # prtcreate mytests mycmake
	root@hostname:/root/my-new-port # cat Pkgfile
	# Description:
	# URL:
	# Maintainer:
	# Depends on:
	name=my-new-port
	version=
	release=1
	source=()
	build() {
          PKGMK_THISPORT=(-DCMAKE_BUILD_TYPE=Release
                          -DCMAKE_INSTALL_PREFIX=/usr
                          -DCMAKE_INSTALL_LIBDIR=lib
                          -DCMAKE_C_FLAGS_RELEASE="$CFLAGS"
                          -DCMAKE_CXX_FLAGS_RELEASE="$CXXFLAGS"
                          -Wno-dev)
          prt-get isinst my-softdep-1 || PKGMK_THISPORT+=(-Dsoftdep_1=disabled)
          prt-get isinst my-softdep-2 || PKGMK_THISPORT+=(-Dsoftdep_2=disabled)
          cmake -S $name-$version -B build "${PKGMK_THISPORT[@]}"
          cmake --build build
          DESTDIR="$PKG" cmake --install build
	}

AUTHORS
Martin Opel <mo at obbl dot net>, John McQuah <jmcquah at disroot dot org>