1.\" $OpenBSD: pkg_create.1,v 1.120 2021/01/29 15:58:56 espie Exp $ 2.\" 3.\" Documentation and design originally from FreeBSD. All the code has 4.\" been rewritten since. We keep the documentation's notice: 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" Jordan K. Hubbard 16.\" 17.\" 18.\" hacked up by John Kohl for NetBSD--fixed a few bugs, extended keywords, 19.\" added dependency tracking, etc. 20.\" 21.\" [jkh] Took John's changes back and made some additional extensions for 22.\" better integration with FreeBSD's new ports collection. 23.\" 24.Dd $Mdocdate: January 29 2021 $ 25.Dt PKG_CREATE 1 26.Os 27.Sh NAME 28.Nm pkg_create 29.Nd create binary software package for distribution 30.Sh SYNOPSIS 31.Nm pkg_create 32.Bk -words 33.Op Fl mnQqvx 34.Op Fl A Ar arches 35.Op Fl B Ar pkg-destdir 36.Op Fl D Ar name Ns Op = Ns Ar value 37.Op Fl L Ar localbase 38.Op Fl M Ar displayfile 39.Op Fl P Ar pkgpath : Ns Ar pkgspec : Ns Ar default 40.Op Fl U Ar undisplayfile 41.Op Fl u Ar userlist 42.Op Fl V Ar n 43.Op Fl W Ar libspec 44.Fl d Ar desc 45.Fl D Ar COMMENT Ns = Ns Ar value 46.Fl D Ar FULLPKGPATH Ns = Ns Ar value 47.Fl D Ar PORTSDIR Ns = Ns Ar value 48.Fl f Ar packinglist 49.Fl p Ar prefix 50.Ar pkg-name 51.Ek 52.Nm pkg_create 53.Fl f Ar packinglist 54.Sh DESCRIPTION 55The 56.Nm 57command is normally used to create a binary package named 58.Ar pkg-name , 59for subsequent use with 60.Xr pkg_add 1 , 61.Xr pkg_delete 1 62and 63.Xr pkg_info 1 . 64.Ar pkg-name 65will traditionally have a 66.Dq .tgz 67extension, to denote the underlying binary format. 68.Ar pkg-name 69must follow 70.Xr packages-specs 7 . 71.Pp 72Use of the 73.Xr ports 7 74infrastructure instead of manual 75.Nm 76invocation is strongly recommended. 77.Pp 78.Nm 79can also be used to recreate a binary package from an existing installation. 80.Pp 81During package creation, 82.Nm 83replaces too long file names with smaller equivalents 84.Po 85see 86.Xr package 5 87.Pc , 88records extra information in the packing-list, such as the existence 89of symlinks and hard links, computes and stores file checksums, and 90verifies that all special objects are properly annotated in the packing-list. 91.Pp 92It will also check all required shared libraries 93for reachability, by looking into all installed dependencies. 94It may also ask the ports tree for extra dependencies, 95provided some other dependency refers to the same 96.Ev BASE_PKGPATH 97.Po 98see 99.Xr bsd.port.mk 5 100.Pc . 101The rationale is that those libraries must already be present for 102the package to build correctly, and thus be reachable through the 103subset of dependencies that are not pure 104.Ev RUN_DEPENDS . 105.Pp 106The options are as follows: 107.Bl -tag -width Ds 108.It Fl A Ar arches 109Register a list of architectures for which this package should install. 110.Ar arches 111is a comma-separated list of architectures. 112Use 113.Sq * 114to mean any architecture (e.g., arch-independent packages). 115.It Fl B Ar pkg-destdir 116Set 117.Ar pkg-destdir 118as the prefix to prepend to any file to select for the package. 119.It Fl D Ar name Ns Op = Ns Ar value 120Define 121.Ar name 122to 123.Ar value 124(or just define it) 125for substitution and fragment inclusion purposes. 126Some specific 127.Ar names 128have extra meaning, see 129.Xr bsd.port.mk 5 130for details: 131.Pp 132.Bl -tag -width FULLPKGPATH -compact 133.It Cm CDROM 134Set to the port's Makefile 135.Va PERMIT_PACKAGE_CDROM . 136.It Cm COMMENT 137Set package 138.Dq one line description 139(mandatory). 140.It Cm HISTORY_DIR 141Record checksums of files in permanent location 142.Pa ${HISTORY_DIR}/${FULLPKGPATH:S,/,./g} . 143.It Cm FTP 144Set to the port's Makefile 145.Va PERMIT_PACKAGE_FTP . 146.It Cm FULLPKGPATH 147Location in the ports tree, mandatory for updates to work 148.Po 149see 150.Xr pkg_add 1 151.Pc . 152.It Cm HOMEPAGE 153If defined, appended to the description. 154.It Cm MAINTAINER 155If defined, appended to the description. 156.It Cm USE_GROFF 157Set to 1 to have groff format manpages behind the scenes during 158package creation. 159.El 160.It Fl d Oo Fl Oc Ns Ar desc 161Fetch long description for package from file 162.Ar desc 163or, if preceded by 164.Sq - , 165the argument itself. 166.It Fl f Ar packinglist 167Fetch 168.Dq packing-list 169for package from the file 170.Ar packinglist . 171Several packing-lists can be mentioned, in which case they will be 172concatenated together. 173.It Fl L Ar localbase 174Record 175.Ar localbase 176as the localbase used in the package 177.Po 178By default, 179.Pa /usr/local 180.Pc . 181Packages built with another localbase can only be installed by using 182the same localbase in 183.Xr pkg_add 1 , 184to prevent errors. 185.It Fl M Ar displayfile 186Display the file (using 187.Xr more 1 ) 188after installing the package. 189Useful for things like 190legal notices on almost-free software, etc. 191.It Fl m 192Causes 193.Nm 194to always display the progress meter in cases it would not do so by default. 195.It Fl n 196Don't actually create a package. 197.It Fl P Ar pkgpath : Ns Ar pkgspec : Ns Ar default 198Declare a dependency on a package matching 199.Ar pkgspec 200.Pq see Xr packages-specs 7 . 201An appropriate package must be installed before this package may be 202installed, and that package must be deinstalled before this package 203is deinstalled. 204The dependency also contains a 205.Ar pkgpath 206.Po 207see 208.Xr pkgpath 7 209.Pc 210and a 211.Ar default 212package name, in case there is no listing of available packages. 213.It Fl p Ar prefix 214Set 215.Ar prefix 216as the initial directory 217.Dq base 218to start from in selecting files for 219the package, and to record as the base for installing the package. 220.It Fl Q 221Print out the files in the actual packing-list of the package being 222generated, with explicit typing 223.Pq e.g. Cm @file , @lib , ... . 224.It Fl q 225Print out the actual packing-list of the package being generated 226(query mode). 227Most often used in combination with 228.Fl n . 229.It Fl U Ar undisplayfile 230Display the file (using 231.Xr more 1 ) 232when deinstalling the package. 233Useful for reminders about stuff to clean up. 234.It Fl u Ar userlist 235Check all 236.Cm @newuser 237and 238.Cm @newgroup 239statements against a 240.Ar userlist 241file 242.Po 243usually 244.Pa ${PORTSDIR}/infrastructure/db/user.list 245.Pc 246and error out for entries not registered in that file. 247Also error out if the file is incoherent. 248.It Fl V Ar n 249Adds 250.Ar n 251to the 252.Sq global system version 253of the package 254.Po see 255.Xr package 5 256.Pc . 257The default value of 0 is not recorded, thus packages without 258.Cm @version 259have an implicit version of 0. 260.It Fl v 261Turn on verbose output. 262.It Fl W Ar libspec 263Package needs a shared library to work. 264.Ar libspec 265is 266.Sq name.major.minor 267or 268.Sq path/name.major.minor . 269The package won't be installed unless a library with the same name, 270the exact same major number and at least the same minor number can 271be located. 272A library without path is searched through dependent packages under the 273same 274.Ar localbase , 275then in the system libraries under 276.Pa /usr/lib 277and 278.Pa /usr/X11R6/lib . 279A library with a path is only searched through dependent packages, 280that path being relative to 281.Ar localbase . 282.It Fl x 283Disable progress meter. 284.El 285.Pp 286.Nm 287can also be invoked with only the packing-list from an installed package. 288It will recreate the corresponding binary package in the current directory 289from the installation, or error out if any problem is found. 290For example, 291the following will recreate a 292.Pa kdelibs-3.4.3.tgz 293package: 294.Bd -literal -offset indent 295pkg_create -f /var/db/pkg/kdelibs-3.4.3/+CONTENTS 296.Ed 297.Sh PACKING-LIST DETAILS 298The 299.Dq packing-list 300format (see 301.Fl f ) 302is fairly simple, being basically a list of filenames and directory names 303to include in the package. 304.Pp 305Substitution of variables and inclusion of fragments is documented in the 306next section. 307.Pp 308Directory names are denoted by a trailing slash. 309.Pp 310There are some annotations that can be inserted for better control. 311All these commands start with an 312.Sq @ . 313The following annotations can be inserted manually (but commonly 314.Xr update-plist 1 315is used for creating most packing-list contents): 316.Pp 317.Bl -tag -width Ds -compact 318.It Cm @ask-update Ar pkgspec message 319Mechanism to prevent unwanted updates. 320If the new package is installed as part of an update matching 321.Ar pkgspec , 322the 323.Ar message 324will be displayed to the user. 325In non-interactive mode, the update will abort. 326Otherwise, the user will have a chance to proceed. 327Automated updates can be done by using 328.Fl D Ar update_stem , 329with 330.Ar stem 331the stem of the 332.Ar pkgspec . 333Classical use case for postgresql: 334.Bd -literal -offset 3n 335@ask-update postgresql-server-<8 Make sure your existing database is backed up 336.Ed 337.Pp 338Use very sparingly. 339Most cases that seem to require manual updates just require a bit more thought. 340.Pp 341.It Cm @bin Ar filename 342Describe the file as an 343.Ox 344binary executable (not a script). 345.Pp 346.It Cm @comment Ar string 347Place a comment in the packing-list. 348Useful in trying to document some particularly hairy sequence that 349may trip someone up later. 350Can also be used to comment out elements that update-plist 351.Pq see Xr bsd.port.mk 5 352will insist in inserting in a packing-list. 353.Pp 354The special comment 355.Cm @comment no checksum 356can be used to tag the next file as special: even though its characteristics 357will be recorded in the package, it can be altered after installation, and 358.Xr pkg_delete 1 359will still delete it. 360.Pp 361The special comment 362.Cm @comment no debug 363can be used to tag the next file as special: even though it might be a 364binary, it has no debug info 365.Po 366see 367.Xr build-debug-info 1 368.Pc . 369.Pp 370.It Cm @conflict Ar pkgspec 371Declare a conflict with packages matching 372.Ar pkgspec 373.Pq see Xr packages-specs 7 . 374The 375.Ar pkgname 376package can 377.Em not 378be installed if a package 379matching 380.Ar pkgspec 381has been installed because they install the same files and thus conflict. 382.Pp 383.It Cm @cwd Ar pathname 384Set the package current directory. 385All subsequent filenames will be assumed relative to 386.Ar pathname . 387.Pp 388.It Cm @dir Ar directoryname 389Create directory 390.Ar directoryname 391at 392.Xr pkg_add 1 393time, taking 394.Cm @mode , 395.Cm @group , 396and 397.Cm @owner 398into account, and remove it during 399.Xr pkg_delete 1 . 400Directories to remove can be shared between packages. 401If 402.Ar name 403does not begin with an @, same as 404.Dl name/ 405.Pp 406.It Cm @define-tag Ar tag mode params 407Define a tag of name 408.Ar tag . 409Tags define actions to be performed at specific time during 410.Xr pkg_add 1 411and 412.Xr pkg_delete 1 . 413A given tag may be defined several times with additional properties. 414Currently, the following modes are defined: 415.Bl -tag -width abc -compact 416.It Ar at-end 417if the tag occurs in any dependency, the given command 418.Ar params 419is executed at the end, similar to 420.Cm @exec 421commands. 422.Pp 423The 424.Cm "\&%D" 425escape sequence stands for localbase. 426.Pp 427Actual tags may themselves contain parameters, so the 428.Ar params 429list recognizes two additional escape sequences: 430.Bl -tag -width indent 431.It Cm "\&%l" 432list of tag parameters, in a random order, with duplicates removed. 433.It Cm "\&%u" 434execute the command once for each distinct tag parameter. 435.El 436.Pp 437As a special case, deleting the package that contains the 438.Cm @define-tag 439will work differently: 440If that 441.Cm @tag 442is present in the same package as the 443.Cm @define-tag , 444then it will be run when encountered, presumably before the command itself 445has been deleted. 446If that 447.Cm @tag 448is not present, the command won't be run at all, 449since the package has been deleted from the file system, 450and usually cleaning up only requires removing index files. 451.Pp 452.It Ar supersedes 453If the given tag is found in dependencies, it supersedes the other 454tag given in the same line. 455For instance: 456.Bd -literal -offset indent 457@define-tag mktexlsr at-end mktexlsr 458@define-tag mktexlsr-local at-end mktexlsr texmf-local 459@define-tag mktexlsr supersedes mktexlsr-local 460.Ed 461.Pp 462Here, the tag 463.Ar mktexlsr 464rebuilds every texmf directory index, whereas 465.Ar mktexlsr-local 466only rebuilds the local texmf directory index, 467so if both tags are seen, only the global command will be run. 468.El 469.Pp 470.It Cm @exec Ar command 471Execute 472.Ar command 473during 474.Xr pkg_add 1 . 475Note that 476.Cm @exec 477commands are executed relative to their location in the packing-list, 478so they can rely on any data that have already been extracted, 479but not on anything that is listed after them. 480Some special elements, such as new users and new groups, are always 481created first, so that 482.Cm @exec 483can rely on them. 484.Pp 485.Xr pkg_add 1 486and 487.Xr pkg_delete 1 488set the 489.Ev PATH 490to a predictable value: 491.Bd -literal -offset indent 492/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:${LOCALBASE}/bin:${LOCALBASE}/sbin 493.Ed 494.Pp 495during execution. 496.Pp 497If 498.Ar command 499contains any of the following sequences somewhere in it, they will 500be expanded inline. 501For the following examples, assume that 502.Cm @cwd 503is set to 504.Pa /usr/local 505and the last extracted file was 506.Pa bin/emacs . 507.Bl -tag -width indent 508.It Cm "\&%B" 509Expands to the 510.Dq basename 511of the fully qualified filename, that 512is the current directory prefix, plus the last filespec, minus 513the trailing filename. 514In the example case, that would be 515.Pa /usr/local/bin . 516.It Cm "\&%D" 517Expands to the current directory prefix, as set with 518.Cm @cwd ; 519in the example case 520.Pa /usr/local . 521.It Cm "\&%F" 522Expands to the last filename extracted (as specified); in the example case, 523.Pa bin/emacs . 524.It Cm "\&%f" 525Expands to the 526.Dq filename 527part of the fully qualified name, or 528the converse of 529.Cm \&%B ; 530in the example case, 531.Pa emacs . 532.El 533.Pp 534.It Cm @exec-always Ar command 535Synonym of 536.Cm @exec . 537.Pp 538.It Cm @exec-add Ar command 539Similar to 540.Cm @exec , 541except it only gets executed during new installations, 542and not during updates. 543.Pp 544.It Cm @exec-update Ar command 545Similar to 546.Cm @exec , 547except it only gets executed during updates, 548and not during new installations. 549.Pp 550.It Cm @extra Ar filename 551Declare extra file 552.Ar filename 553to be deleted at deinstall time, if user sets the 554.Fl c 555option. 556Those files are extra configuration files that are normally not deleted. 557.Ar filename 558can be an absolute path. 559If 560.Ar filename 561ends with a slash, it is a directory. 562.Pp 563.It Cm @extraunexec Ar command 564Extra 565.Ar command 566to execute when removing extra files. 567.Pp 568.It Cm @file Ar filename 569Default annotation, to use if 570.Ar filename 571begins with @. 572.Ar filename 573is always a relative path, relative to the current 574.Cm @cwd . 575.Pp 576.It Cm @fontdir Ar directoryname 577Specialized version of 578.Cm @dir , 579to handle font directories: create 580.Pa font.alias 581from 582.Pa font.alias-* 583fragments, execute 584.Xr mkfontdir 1 , 585.Xr mkfontscale 1 586and 587.Xr fc-cache 1 588when needed. 589Delete extra files at 590.Xr pkg_delete 1 591time. 592.Pp 593.It Cm @group Ar group 594Set default group ownership for all subsequently extracted files to 595.Ar group . 596Use without an arg to set back to default (extraction) 597group ownership. 598.Pp 599.It Cm @info Ar filename 600Specialized version of 601.Cm @file , 602to handle GNU info files. 603Automatically grab 604.Ar filename Ns -* 605chapter files, run 606.Xr install-info 1 607as needed. 608.Pp 609.It Cm @lib Ar filename 610Specialized version of 611.Cm @file , 612to handle shared libraries. 613Satisfy LIB_DEPENDS and WANTLIB, 614run 615.Xr ldconfig 8 616as needed. 617See 618.Sq VARIABLE SUBSTITUTION AND FRAGMENT INCLUSION 619for some details. 620.Pp 621.It Cm @man Ar filename 622Specialized version of 623.Cm @file , 624to handle manual pages. 625.Pp 626.It Cm @mandir Ar directoryname 627Specialized version of 628.Cm @dir , 629to handle manual directories: instruct user to add/remove the 630directory to 631.Xr man.conf 5 , 632remove 633.Xr apropos 1 634database when needed. 635.Pp 636.It Cm @mode Ar mode 637Set default permission for all subsequently extracted files to 638.Ar mode . 639Format is the same as that used by the 640.Xr chmod 1 641command. 642Use without an arg to set back to default (extraction) permissions. 643.Pp 644.It Cm @newgroup Ar name : Ns Ar gid 645During 646.Xr pkg_add 1 , 647create a new group, using 648.Xr groupadd 8 . 649Happens before file and user creations. 650.Ar gid 651can be prefixed with a 652.Sq !\& 653to ensure group has the correct GID. 654During 655.Xr pkg_delete 1 , 656groups will be deleted if extra clean-up has been requested, and if 657other installed packages don't list the same group. 658.Pp 659.It Xo 660.Cm @newuser 661.Sm off 662.Ar name : 663.Ar uid : 664.Ar group : 665.Ar loginclass : 666.Ar comment : 667.Ar home : 668.Ar shell 669.Sm on 670.Xc 671During 672.Xr pkg_add 1 , 673create a new user. 674Happens before any file creation. 675All fields correspond to 676.Xr useradd 8 677parameters. 678Some fields are optional and can be left empty. 679If the user already exists, no action is taken. 680Individual fields can be prefixed by a 681.Sq !\& 682to make sure an existing 683user matches. 684For instance, the directive 685.Li @newuser foo:!42 686will make sure user foo has UID 42. 687During 688.Xr pkg_delete 1 , 689users will be deleted if extra clean-up has been requested, and if 690other installed packages don't list the same user. 691.Pp 692.It Cm @option Ar name 693Effects vary depending on 694.Ar name . 695These are the user settable options 696.Bl -tag -width indent 697.It Cm always-update 698By default, 699.Xr pkg_add 1 700uses some simplified information to decide whether an installed package 701needs updating. 702With this option, the package is updated whenever anything changes. 703To be used sparingly, as this is more expensive. 704.It Cm is-branch 705Annotate the few rare ports where several branches are present in the 706ports tree (such as autoconf), to help 707.Xr pkg_info 1 708produce 709.Ar stem Ns % Ns Ar branch 710annotations when needed. 711.It Cm no-default-conflict 712By default, a package conflicts with other versions of the same package. 713With this option, the older package version will still be noticed, but the 714installation will proceed anyway. 715.El 716.Pp 717.It Cm @owner Ar user 718Set default ownership for all subsequently extracted files to 719.Ar user . 720Use without an arg to set back to default (extraction) 721ownership. 722.Pp 723.It Cm @pkgpath Ar pkgpath 724Declare a secondary 725.Ar pkgpath 726for the package. 727This is used for updates: 728.Nm pkg_add 729.Fl u 730normally checks that the 731.Ar pkgpath 732embedded in the package corresponds to the old package, 733to solve ambiguities when packages with similar names are involved. 734When ports get renamed, or flavors change, extra 735.Cm @pkgpath 736annotations can help 737.Nm pkg_add 738get a sense of continuity. 739Note that these 740.Ar pkgpath 741can take extra optional components, to allow the matching of several 742flavors at once, and are order independent. 743For instance, 744.Bd -literal -offset indent 745@pkgpath some/dir,f1,f2 746.Ed 747.Pp 748and 749.Bd -literal -offset indent 750@pkgpath some/dir,f2,f2,f1 751.Ed 752.Pp 753are equivalent. 754.Bd -literal -offset indent 755@pkgpath some/dir,f1[,f2,f3][,f4] 756.Ed 757.Pp 758will match all pkgpaths to some/dir with flavor f1, and optionally f4, and 759optionally both f2 and f3, e.g., 760.Ar some/dir,f1,f4 , 761.Ar some/dir,f1,f2,f3 , 762.Ar some/dir,f1,f2,f3,f4 , 763.Ar some/dir,f1 764would match, 765but 766.Ar some/dir,f1,f5 , 767.Ar some/dir,f2,f3 , 768.Ar some/dir,f1,f2,f4 769would not. 770.Pp 771Each binary package contains a set of pkgpaths: the primary pkgpath that 772was used to build the package, recorded as 773.Cm @comment Ar pkgpath=some/path , 774and secondary pkgpaths as recorded through 775.Cm @pkgpath . 776.Pp 777In order for two packages to match, their primary pkgpaths must match, or 778a secondary pkgpath must match the other package's primary pkgpath. 779.Pp 780.It Cm @rcscript Ar filename 781Script for the 782.Pa /etc/rc.d 783framework. 784Contrary to 785.Cm @file , 786absolute paths are okay, e.g., 787.Bd -literal -offset indent 788@rcscript ${RCDIR}/ballsd 789.Ed 790.Pp 791In this case, performs an implicit 792.Cm @cwd 793to 794.Pa ${RCDIR} . 795.Pp 796.It Cm @sample Ar filename 797Last preceding 798.Cm @file 799item is a sample configuration file, to be copied to 800.Ar filename 801at 802.Xr pkg_add 1 803time and to be removed at 804.Xr pkg_delete 1 805time. 806During installation, existing configuration files are untouched. 807During deinstallation, configuration files are only removed if unchanged. 808.Ar filename 809can be an absolute path. 810If 811.Ar filename 812ends with a slash, 813it refers to a configuration directory instead. 814.Pp 815.It Cm @shell Ar filename 816Specialized version of 817.Cm @file , 818to handle shells. 819See 820.Xr shells 5 . 821.Pp 822.It Cm @so Ar filename 823Describe the file as an 824.Ox 825shared object. 826.Pp 827.It Cm @static-lib Ar filename 828Describe the file as a 829.Ox 830static library. 831.Pp 832.It Cm @unexec Ar command 833Execute 834.Ar command 835during 836.Xr pkg_delete 1 . 837.Ev PATH 838and expansion of special 839.Cm \&% 840sequences are the same as for 841.Cm @exec . 842Note that 843.Cm @unexec 844commands are executed relative to their location in the packing-list, 845so they cannot rely on any data that has already been deleted, 846thus they should occur before the files they need to function. 847Some special elements, such as new users and new groups, are always 848deleted last, so that 849.Cm @unexec 850can rely on them. 851.Pp 852.It Cm @tag Ar name Op Ar parameter 853Reference a tag of given 854.Ar name . 855The corresponding 856.Cm @define-tag 857definition must be accessible through the dependency tree. 858.Ar parameter 859is amenable to the same substitutions as 860.Cm @exec . 861.Pp 862.It Cm @unexec-always Ar command 863Synonym of 864.Cm @unexec . 865.Pp 866.It Cm @unexec-delete Ar command 867Similar to 868.Cm @unexec , 869except it only gets executed during true deletions 870and not while removing an old package during updates. 871.Pp 872.It Cm @unexec-update Ar command 873Similar to 874.Cm @unexec , 875except it only gets executed while removing an old package during updates, 876and not during true deletions. 877.El 878.Pp 879The 880.Cm @bin , 881.Cm @lib , 882.Cm @so 883and 884.Cm @static-lib 885annotations are used by the debug packages infrastructure to figure out 886which files may contain debug information. 887.Pp 888See 889.Xr package 5 890for other internal annotations that are automatically added by the 891package tools. 892.Sh VARIABLE SUBSTITUTION AND FRAGMENT INCLUSION 893In packing-lists, installation, deinstallation and requirement scripts, 894description and message files, 895constructs like 896.Li ${VAR} 897will be replaced with the variable value, according to 898.Fl D Ar name Ns = Ns Ar value 899options. 900.Pp 901In particular, shared library versions should never be mentioned explicitly 902in a packing-list. 903Shared library 904.Sq foo 905will take its version number from 906.Ev LIBfoo_VERSION . 907The ports framework normally takes care of all details, see 908.Ev SHARED_LIBS 909in 910.Xr bsd.port.mk 5 . 911.Pp 912Constructs like 913.Li %%VAR%% 914and 915.Li !%%VAR%% 916trigger fragment inclusion. 917If such a line is encountered in a packing-list, the corresponding variable 918must be defined to 0 or 1. 919If the variable's value is 1, 920.Li %%VAR%% 921will be replaced by the corresponding positive fragment, and 922.Li !%%VAR%% 923will be ignored. 924If the variable's value is 0, 925.Li %%VAR%% 926will be ignored, and 927.Li !%%VAR%% 928will be replaced by the corresponding positive fragment. 929.Pp 930A fragment is an auxiliary packing-list file, whose name is derived from the 931current packing-list, and the variable name 932.Va VAR 933triggering the inclusion: 934.Pa pkg/PLIST 935yields a positive fragment 936.Pa pkg/PFRAG.VAR 937and a negative fragment 938.Pa pkg/PFRAG.no-VAR , 939.Pa pkg/PLIST-FOO 940yields a positive fragment 941.Pa pkg/PFRAG.VAR-foo 942and a negative fragment 943.Pa pkg/PFRAG.no-VAR-foo . 944.Pp 945Fragments can be included inside fragments, so that 946.Li %%VAR2%% 947inside 948.Pa pkg/PFRAG.VAR 949triggers the inclusion of 950.Pa pkg/PFRAG.VAR2-VAR 951and 952.Li !%%VAR2%% 953triggers the inclusion of 954.Pa pkg/PFRAG.no-VAR2-VAR . 955.Pp 956If a positive or a negative fragment file does not exist, the corresponding 957inclusion will be ignored. 958However, if both the positive and negative fragment files do not exist, 959.Nm 960will error out, to make it easier to spot fragment names errors. 961.Sh SEE ALSO 962.Xr pkg_add 1 , 963.Xr pkg_delete 1 , 964.Xr pkg_info 1 , 965.Xr pkg_sign 1 , 966.Xr tar 1 , 967.Xr bsd.port.mk 5 , 968.Xr package 5 , 969.Xr packages-specs 7 , 970.Xr pkgpath 7 , 971.Xr ports 7 972.Sh HISTORY 973The 974.Nm 975command first appeared in 976.Fx . 977.Sh AUTHORS 978.Bl -tag -width indent -compact 979.It An Jordan Hubbard 980initial design 981.It An Marc Espie 982complete rewrite. 983.El 984