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