### Configure Installation with INSTALL_MAKE_FLAGS and sysconfdir Source: https://www.netbsd.org/docs/pkgsrc/pkgsrc.ps This example demonstrates setting installation flags, specifically the sysconfdir, during the make process. It uses the EGDIR variable to define the target directory for example configurations and passes it to the make command via INSTALL_MAKE_FLAGS. ```makefile EGDIR= ${PREFIX}/share/examples/mutt INSTALL_MAKE_FLAGS= ${MAKE_FLAGS} sysconfdir=${EGDIR} ``` -------------------------------- ### Install Phase Example in pkgsrc Source: https://www.netbsd.org/docs/pkgsrc/pkgsrc.ps This code illustrates the installation phase within pkgsrc. It iterates through directories specified by INSTALL_DIRS, changes into them, and executes the installation command. Similar to the build phase, it uses make and environment variables like INSTALL_ENV, MAKE_ENV, and INSTALL_TARGET. ```mk .for dir in ${INSTALL_DIRS} cd ${WRKSRC} && cd ${dir} \ && env ${INSTALL_ENV} ${MAKE_ENV} \ ${MAKE_PROGRAM} ${MAKE_FLAGS} ${INSTALL_MAKE_FLAGS} \ -f ${MAKE_FILE} ${INSTALL_TARGET} .endfor ``` -------------------------------- ### Patching Installation for Configuration Files Source: https://www.netbsd.org/docs/pkgsrc/pkginstall.html This example demonstrates how to patch a package's Makefile to correctly handle configuration file installations. It sets `EGDIR` to the examples directory and uses `INSTALL_MAKE_FLAGS` to pass the `sysconfdir` variable with the `EGDIR` value during the installation process. This ensures configuration files are installed under the examples hierarchy. ```makefile EGDIR= ${PREFIX}/share/examples/mutt INSTALL_MAKE_FLAGS= ${MAKE_FLAGS} sysconfdir=${EGDIR} ``` -------------------------------- ### Configure HTML Documentation Installation Directory Source: https://www.netbsd.org/docs/pkgsrc/pkgsrc.ps This example demonstrates how to configure the installation directory for HTML documentation using the --with-html-dir option, ensuring it's placed within the package-specific directory. ```Shell # Example for packages using GNU autoconf # --with-html-dir=${PREFIX}/share/doc/${PKGBASE} ``` -------------------------------- ### Configure Game Binary and Directory Installation (pkgsrc) Source: https://www.netbsd.org/docs/pkgsrc/pkgsrc.ps This example illustrates the use of pkgsrc's INSTALL_* variables for installing setgid game binaries, necessary game directories, and scorefiles, ensuring proper permissions and access for games. ```Makefile # INSTALL_GAME to install setgid game binaries # INSTALL_GAME_DIR to install game directories # INSTALL_GAME_DATA to install scorefiles ``` -------------------------------- ### Install Package using 'make install' in pkgsrc Source: https://www.netbsd.org/docs/pkgsrc/examples.html The 'make install' command compiles and installs a package. It handles directory creation, file copying, and registration of the installed package. This process typically involves running shell commands for file manipulation and installation. ```shell # **make install** >> Checksum OK for bison-1.25.tar.gz. ===> Installing for bison-1.25 sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1 rm -f /usr/pkg/bin/bison cd /usr/pkg/share; rm -f bison.simple bison.hairy rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info* install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1 ===> Registering installation for bison-1.25 ``` -------------------------------- ### Installing Libraries with libtool Source: https://www.netbsd.org/docs/pkgsrc/fixes.html This example demonstrates how to install libraries using `libtool`. The `install` or `cp` command is prefixed with `${LIBTOOL} --mode=install`. The library name is changed to its `.la` extension. This command automatically installs the static `.a` library, the shared library, any necessary symlinks, and runs `ldconfig(8)`. The `PLIST` should only contain the `.la` file. ```makefile ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} ${SOMELIB:.a=.la} ${PREFIX}/lib ``` -------------------------------- ### Configure Custom Installation Directories in mk.conf Source: https://www.netbsd.org/docs/pkgsrc/pkgsrc.ps This example shows how to set custom installation directories for various pkgsrc components. These variables can be modified during bootstrap or later in mk.conf to define arbitrary paths for installation. ```makefile PREFIX= /a-random-uuid PKG_SYSCONFDIR= /a-random-uuid VARBASE= /a-random-uuid PKGMANDIR= a-random-uuid PKG_INFODIR= a-random-uuid ``` -------------------------------- ### Create Multiple Directories with INSTALL_DATA_DIR Source: https://www.netbsd.org/docs/pkgsrc/pkgsrc.ps This example shows how to correctly use the INSTALL_DATA_DIR command to create multiple directories sequentially. This is necessary because some BSD-compatible install commands cannot create more than one directory at a time. Each directory is created in a separate command. ```makefile ${INSTALL_DATA_DIR} ${PREFIX}/dir1 ${INSTALL_DATA_DIR} ${PREFIX}/dir2 ``` -------------------------------- ### Get help for a pkgsrc topic Source: https://www.netbsd.org/docs/pkgsrc/help-user.html Retrieves help information for a specific pkgsrc topic, such as variables, make targets, or functions. This command is available after bootstrapping pkgsrc. ```bash bmake help topic=BUILD_DEFS ``` -------------------------------- ### Show pkgsrc variables for a specific topic Source: https://www.netbsd.org/docs/pkgsrc/help-user.html Displays pkgsrc variables relevant to a particular topic. For example, to see fetch-related variables, use 'bmake show-all-fetch'. ```bash bmake show-all-fetch ``` -------------------------------- ### Declare Configuration Files for Package Installation (pkginstall) Source: https://www.netbsd.org/docs/pkgsrc/pkginstall.html This snippet shows how to declare configuration files that the pkginstall framework will manage. It uses the CONF_FILES variable to specify the source and destination paths for configuration files, ensuring they are correctly placed and updated during package installation. The EGDIR variable is package-specific and points to the examples directory. ```Shell EGDIR= ${PREFIX}/share/examples/mutt CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc ``` ```Shell CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR} EGDIR= ${PREFIX}/share/examples/mutt CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc INSTALLATION_DIRS+= ${EGDIR} INSTALL_MAKE_FLAGS= ${MAKE_FLAGS} sysconfdir=${EGDIR} ``` -------------------------------- ### Generate Fetch List for Distfiles Source: https://www.netbsd.org/docs/pkgsrc/pkgsrc.ps This example shows how to generate a script to fetch a list of distfiles using 'make fetch-list' and 'wget'. The script is then transferred to another machine and executed to download the distfiles into a specified directory. This is useful for downloading distfiles in batches. ```shell # At home: % cd /usr/pkgsrc % make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh % scp /tmp/fetch.sh work:/tmp # At work: % sh /tmp/fetch.sh ``` -------------------------------- ### Custom Fetch Command Example Source: https://www.netbsd.org/docs/pkgsrc/pkgsrc.ps Provides an example of the fetch command structure when FETCH_USING is set to 'custom'. This highlights the parameters involved in a typical fetch operation. ```makefile # Example for FETCH_USING=custom ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS} ``` -------------------------------- ### Register System Shell Interpreter (pkginstall) Source: https://www.netbsd.org/docs/pkgsrc/pkginstall.html This example shows how to register a package-provided shell interpreter with the system's shell database. By setting the PKG_SHELL variable to the absolute path of the shell, pkginstall automatically adds the necessary hooks to update the /etc/shells file during installation. ```Shell PKG_SHELL= ${PREFIX}/bin/zsh ``` -------------------------------- ### Info File Installation and Management Source: https://www.netbsd.org/docs/pkgsrc/pkgsrc.ps Handles the installation of info documentation files. It ensures that the necessary scripts are generated to register these files in the system's info directory. It also manages build-time dependencies on tools like 'makeinfo' and enforces version requirements. ```makefile # List the info files to be installed INFO_FILES= mydoc.info # Specify the directory for info files # PKGINFODIR defaults to "info" # Require a specific version of makeinfo TEXINFO_REQD= 4.8 # If makeinfo is needed at build time, add it to USE_TOOLS USE_TOOLS+= makeinfo ``` -------------------------------- ### Fetching a Distfile with pkgsrc Source: https://www.netbsd.org/docs/pkgsrc/pkgsrc.ps This example shows the process of fetching a source distribution file (distfile) for a pkgsrc package using the `make fetch` command. It includes output indicating that the file was not found locally and then successfully retrieved from a remote FTP server, demonstrating pkgsrc's ability to handle distfile downloads. ```shell # make fetch >> bison-1.25.tar.gz doesn't seem to exist on this system. >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//. Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/) ftp: Error retrieving file: 500 Internal error >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//. Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/) ftp: Error retrieving file: 500 Internal error >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//. Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/) Successfully retrieved file. ``` -------------------------------- ### Create Directories with pkginstall Source: https://www.netbsd.org/docs/pkgsrc/pkginstall.html Defines directories to be created during package installation using the `MAKE_DIRS` variable. These directories are relative to the installation prefix and are managed by the pkginstall framework. ```makefile MAKE_DIRS+= ${VARBASE}/foo/private ``` -------------------------------- ### Generating an Initial buildlink3.mk File Source: https://www.netbsd.org/docs/pkgsrc/pkgsrc.ps Demonstrates the command used to generate a starting point for a new buildlink3.mk file using the pkgtools/createbuildlink package. This simplifies the process of creating new buildlink files. ```shell % cd pkgsrc/category/pkgdir % createbuildlink >buildlink3.mk ``` -------------------------------- ### Running pkglint for Package Checking Source: https://www.netbsd.org/docs/pkgsrc/pkgsrc.ps This example demonstrates how to use `pkglint`, a tool for checking pkgsrc package files. It shows sample output indicating errors, warnings, and notes found in a package's Makefile and PLIST. The output suggests commands to view explanations or automatically fix issues. ```shell $ pkglint ERROR: Makefile: Each package must define its LICENSE. WARN: Makefile:9: HOMEPAGE should migrate from http to https. NOTE: PLIST:3: The .gz extension is unnecessary for manual pages. WARN: PLIST:5: "share/bison.hairy" should be sorted before "share/bison.simple". 1 error, 2 warnings and 1 note found. (Run "pkglint -e" to show explanations.) (Run "pkglint -fs" to show what can be fixed automatically.) (Run "pkglint -F" to automatically fix some issues.) ``` -------------------------------- ### Configure and Build Bison Package (C) Source: https://www.netbsd.org/docs/pkgsrc/examples.html This snippet demonstrates the configuration and compilation steps for the bison package. It shows the 'checking' process for system compatibility and then the 'cc' commands used to compile individual C source files into object files, followed by linking them into the final 'bison' executable. It also highlights a potential security warning related to 'mktemp'. ```c ===> Extracting for bison-1.25 ===> Patching for bison-1.25 ===> Ignoring empty patch directory ===> Configuring for bison-1.25 creating cache ./config.cache checking for gcc... cc checking whether we are using GNU C... yes checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin checking how to run the C preprocessor... cc -E checking for minix/config.h... no checking for POSIXized ISC... no checking whether cross-compiling... no checking for ANSI C header files... yes checking for string.h... yes checking for stdlib.h... yes checking for memory.h... yes checking for working const... yes checking for working alloca.h... no checking for alloca... yes checking for strerror... yes updating cache ./config.cache creating ./config.status creating Makefile ===> Building for bison-1.25 cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g LR0.c cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g allocate.c cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g closure.c cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g conflicts.c cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g derives.c cc -c -DXPFILE=\"/usr/pkg/share/bison.simple\" -DXPFILE1=\"/usr/pkg/share/bison.hairy\" -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -g ./files.c cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getargs.c cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g gram.c cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g lalr.c cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g lex.c cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g main.c cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g nullable.c cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g output.c cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g print.c cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g reader.c cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g reduce.c cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g symtab.c cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g warshall.c cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g version.c cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getopt.c cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getopt1.c cc -g -o bison LR0.o allocate.o closure.o conflicts.o derives.o files.o getargs.o gram.o lalr.o lex.o main.o nullable.o output.o print.o reader.o reduce.o symtab.o warshall.o version.o getopt.o getopt1.o ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp() rm -f bison.s1 sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1 ``` -------------------------------- ### Replace Hardcoded Interpreter Paths (pkgsrc Makefile) Source: https://www.netbsd.org/docs/pkgsrc/fixes.html This example shows how to configure pkgsrc to replace hardcoded interpreter paths within scripts. By defining REPLACE_INTERPRETER, REPLACE..old, and REPLACE..new, packages can ensure that scripts use the correctly installed interpreter path, such as ${PREFIX}/bin/tclsh instead of a hardcoded system path. ```makefile REPLACE_INTERPRETER+= tcl REPLACE.tcl.old= .*/bin/tclsh REPLACE.tcl.new= ${PREFIX}/bin/tclsh REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed, # relative to ${WRKSRC}, just as in REPLACE_PERL ``` -------------------------------- ### Create System Users and Groups with PKG_USERS and PKG_GROUPS Source: https://www.netbsd.org/docs/pkgsrc/pkgsrc.ps This snippet illustrates how to define system users and groups for package installation. It shows the syntax for creating a user 'user' with group 'group', and a separate group 'group'. It also touches upon specifying UIDs, GIDs, home directories, and shells. ```makefile PKG_USERS= user:group PKG_GROUPS= group ``` -------------------------------- ### Creating Directories with INSTALL_DATA_DIR Source: https://www.netbsd.org/docs/pkgsrc/fixes.html This example shows the correct way to create multiple directories using the `${INSTALL_*_DIR}` command in pkgsrc Makefiles. Some older BSD-compatible `install` commands cannot create nested directories in a single call. The snippet demonstrates creating two separate directories, `dir1` and `dir2`, under the `${PREFIX}`. Alternatively, the `INSTALLATION_DIRS` variable can be used. ```makefile ${INSTALL_DATA_DIR} ${PREFIX}/dir1 ${INSTALL_DATA_DIR} ${PREFIX}/dir2 ``` -------------------------------- ### Specify Font Directories in pkgsrc Source: https://www.netbsd.org/docs/pkgsrc/pkgsrc.ps This example demonstrates how to declare the directories where X11 fonts are installed using the FONTS_DIRS variable. The type suffix (e.g., .ttf) specifies the font type. This ensures the font database is updated correctly during package installation. ```makefile FONTS_DIRS.ttf= ${PREFIX}/share/fonts/X11/TTF ``` -------------------------------- ### Using a Direct Download URL with MASTER_SITES in pkgsrc Source: https://www.netbsd.org/docs/pkgsrc/build.html This example demonstrates using a direct download URL with `MASTER_SITES` by prefixing the URL with a dash. This is useful for redirectors or when the filename needs to be overridden. ```makefile DISTNAME= foo-1.0.0 MASTER_SITES= -https://www.example.com/archive/v1.0.0.tar.gz ``` -------------------------------- ### Example buildlink3.mk file structure Source: https://www.netbsd.org/docs/pkgsrc/buildlink.html A real-world example of a buildlink3.mk file taken from pkgsrc/graphics/tiff. It demonstrates the common structure including the BUILDLINK_TREE manipulation, conditional inclusion guards, and dependency variable definitions. ```mk BUILDLINK_TREE+= tiff .if !defined(TIFF_BUILDLINK3_MK) TIFF_BUILDLINK3_MK:= BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1 BUILDLINK_ABI_DEPENDS.tiff+= tiff>=3.7.2nb1 BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff .include "../../devel/zlib/buildlink3.mk" .include "../../graphics/jpeg/buildlink3.mk" .endif # TIFF_BUILDLINK3_MK BUILDLINK_TREE+= -tiff ``` -------------------------------- ### Configure Man Page Installation Directory Source: https://www.netbsd.org/docs/pkgsrc/fixes.html This snippet shows how to configure the installation directory for man pages when using `GNU_CONFIGURE`. The `GNU_CONFIGURE_MANDIR` variable specifies the target directory, which typically defaults to `${PREFIX}/${PKGMANDIR}`. ```makefile GNU_CONFIGURE_MANDIR= ${PREFIX}/share/man ``` -------------------------------- ### Search and install packages using pkgin Source: https://www.netbsd.org/docs/pkgsrc/using.html Demonstrates how to search for available packages and install specific packages along with their dependencies using the pkgin command. This assumes the pkgsrc environment has been correctly set up. ```shell # **pkgin search nginx** nginx-1.19.6 Lightweight HTTP server and mail proxy server nginx-1.18.0nb8 Lightweight HTTP server and mail proxy server # **pkgin install zsh nginx-1.19.6 vim** ``` -------------------------------- ### NetBSD Package PLIST file for Bison Source: https://www.netbsd.org/docs/pkgsrc/examples.html The PLIST file lists all the files that will be installed by the package. This entry specifies the binary, man page, and shared files for the bison package. ```text @comment $NetBSD: examples.html,v 1.273 2026/02/08 09:51:29 wiz Exp $ bin/bison man/man1/bison.1.gz share/bison.simple share/bison.hairy ``` -------------------------------- ### Configure and Run pbulk.sh Script Source: https://www.netbsd.org/docs/pkgsrc/bulk.html Shows how to use the `pbulk.sh` helper script for configuring and running bulk builds. Options include using native make, applying settings from an `mk.conf` fragment, and configuring for limited builds. This script simplifies the setup process. ```shell # sh pbulk.sh -n # use native make, no bootstrap kit needed (for use on NetBSD) ``` ```shell # sh pbulk.sh -n -c mk.conf.frag # native, apply settings from given mk.conf fragment ``` ```shell # sh pbulk.sh -nlc mk.conf.frag # native, apply settings, configure for limited build ``` -------------------------------- ### Define Custom PLIST Substitution Variable Source: https://www.netbsd.org/docs/pkgsrc/plist.html Allows defining custom variables for substitution within PLIST files. This example adds 'SOMEVAR' which will be replaced by 'somevalue'. ```makefile PLIST_SUBST+= SOMEVAR="somevalue" ``` -------------------------------- ### Testing DESTDIR Full Support for Package Installation Source: https://www.netbsd.org/docs/pkgsrc/pkgsrc.ps Demonstrates how to test DESTDIR full support for package building and installation without root privileges. This involves setting up a directory for packages and running 'make stage-install' and 'make package'. Root privileges are only needed for the final 'make install' step. ```bash id mkdir $HOME/packages cd $PKGSRCDIR/foo/bar make stage-install make PACKAGES=$HOME/packages package make PACKAGES=$HOME/packages install make clean ``` -------------------------------- ### Filter PLIST Output with AWK Source: https://www.netbsd.org/docs/pkgsrc/plist.html Appends AWK patterns to PRINT_PLIST_AWK to filter the output of 'make print-PLIST'. Be cautious with quoting. This example removes files in 'libdata/foo'. ```makefile PRINT_PLIST_AWK+= /^libdata/foo/ { next; } ``` -------------------------------- ### Import New Package using url2pkg and Makefile Source: https://www.netbsd.org/docs/pkgsrc/pkgsrc.ps This example illustrates the initial steps of importing a new package into pkgsrc. It involves creating a directory, using url2pkg to fetch sources, and defining a basic Makefile with package metadata. ```makefile # $NetBSD $ # DISTNAME= nvu-1.0-sources PKGNAME= nvu-1.0 CATEGORIES= www MASTER_SITES= http://cvs.nvu.com/download/ EXTRACT_SUFX= .tar.bz2 MAINTAINER= rillig@NetBSD.org HOMEPAGE= http://cvs.nvu.com/ COMMENT= Web Authoring System ``` -------------------------------- ### Build Phase Example in pkgsrc Source: https://www.netbsd.org/docs/pkgsrc/pkgsrc.ps This snippet demonstrates the typical structure for the build phase in a pkgsrc package. It iterates through specified directories, changes to them, and executes the build command using make. Key variables like BUILD_DIRS, MAKE_ENV, MAKE_PROGRAM, and BUILD_TARGET are utilized. ```mk .for dir in ${BUILD_DIRS} cd ${WRKSRC} && cd ${dir} \ && env ${MAKE_ENV} \ ${MAKE_PROGRAM} ${MAKE_FLAGS} ${BUILD_MAKE_FLAGS} \ -f ${MAKE_FILE} \ ${BUILD_TARGET} .endfor ``` -------------------------------- ### Show all common pkgsrc variables Source: https://www.netbsd.org/docs/pkgsrc/help-user.html Lists the values of the most commonly used pkgsrc variables, grouped by topic. This provides a comprehensive overview of available settings. ```bash bmake show-all ```