MKPKG(1)
π MKPKG π β the IRAF commands era icon, bestie
okay so, welcome to mkpkg(1), straight out of the IRAF commands section of the manual. she makes stuff. she updates stuff. she is, lowkey, the reason the whole system boots. let's get into it. π
β¨ NAME β¨
mkpkg β make or update an IRAF package or library. that's the whole vibe. π
β¨ SYNOPSIS β¨
mkpkg [options] [ module ... ] [ name=value ... ]
β¨ ARGUMENTS β¨
-d[ddd]β Debug mode, babe. She prints detailed messages about literally everythingmkpkgis doing. There are four levels of debug messages and you pick one by repeating thedcharacter in the switch β so-dis level one,-ddis level two, and so on forever upward. The messages get progressively more detailed as the debug level climbs. Also: debug mode automatically turns on verbose mode, so you get those messages too. two for one, we love to see it. β¨-f fileβ Sets the name of the file to be interpreted (default:mkpkg). The special valuestdin(lower case, bestie, lowercase) lets you enter commands interactively from standard input β e.g., for debuggingmkpkgitself. yes, you can just talk to her. π«Ά-iβ Ignore errors. Execution continues even if an error occurs. she's unbothered. she's thriving. π-nβ No execute. She goes through the motions but does not touch any files. No execute mode automatically enables verbose mode (flag-v). You should use this switch to verify newmkpkgfiles before execution β like a dress rehearsal, no cap. π-p pkgnameβ Load the package environment for the named external package, e.g.,mkpkg -p noao update. If you always specify the same package, the environment variable or logical namePKGENVmay be defined at the host level to accomplish the same thing. Heads up: the package name must be specified when doing software development in an external or layered package. no skipping it. π-vβ Verbose mode. A message is printed whenever a file is touched. Recommended when running largemkpkgjobs in batch mode. she'll narrate. π£οΈmoduleβ The names of the module or modules (named entries in themkpkgfile) to be executed. If no module is named, the first module encountered is executed β unless amkpkgmacro preprocessor directive at the beginning of the file specifies a different default action. so like, she has a default, but the file can override it. main character behavior. πname=value [name=value ...]β Enter the named symbol/value pair into the symbol table of themkpkgmacro preprocessor. The symbolsXFLAGS(for the XC compiler) andLFLAGS(for the linker) are predefined but may be redefined on the command line. Case is ignored in symbol names for portability reasons. π
β¨ DESCRIPTION β¨
The mkpkg utility is used to make or update IRAF packages or libraries. mkpkg is used to bootstrap the IRAF system, hence is implemented as a foreign task, callable either from within the IRAF environment or from the host system. Usage is identical in either case (except that the details of when a particular argument may need to be quoted will vary depending on the command language used). And for the historians in the chat: mkpkg is upwards compatible with the old mklib utility. ποΈ
πΈ 1. Introduction πΈ
Mkpkg provides two major facilities: a library update capability and a macro preprocessor. The macro preprocessor provides symbol definition and replacement, conditional execution, and a number of builtin commands. The usefulness of these facilities is enhanced by the ability of mkpkg to update entire directory trees, or to enter the hierarchy of mkpkg descriptors at any level. For example, typing mkpkg in the root directory of IRAF will make or update the entire system, whereas in the iraf$sys directory mkpkg will update only the system libraries, and in the iraf$sys/fio directory mkpkg will update only the FIO portion of the system library libsys.a. it's giving β¨scalableβ¨.
The mkpkg utility is quite simple to use to maintain small packages or libraries, despite the complexity of the discussion which follows. The reader is encouraged to study several examples of working mkpkg-files before reading further; examples will be found throughout the IRAF system. The mkpkg files for applications packages tend to be very similar to one another, and it is quite possible to successfully copy and modify the mkpkg-file from another package without studying the reference information given here. fr fr, copy-paste-and-tweak is a valid strategy. π
π 2. Lexical Conventions π
The lexical conventions employed in mkpkg are those used throughout IRAF. Comments may occur anywhere, begin with the character #, and extend to the end of the current line. Blank lines are ignored virtually everywhere. Newline may be escaped with backslash to continue on the next line. All filenames are IRAF virtual filenames with the following extensions. π
.aβ object library.cβ C source.eβ executable (e.g.,x_package.e).fβ Fortran source.gcβ generic C source.gxβ generic SPP source.hβ C or SPP header file.incβ include file.lβ Lex source.oβ object file.rβ Ratfor source.sβ assembler source.yβ Yacc source
Since mkpkg is an IRAF utility it recognizes the major IRAF logical directories; these are summarized in the list below. The IRAF (or UNIX) pathname convention is used to specify pathnames rooted in the current directory or a logical directory. πΊοΈ
bin$β installed executables βiraf$bin/dev$β device tables βiraf$dev/hlib$β machdep header files βhost$hlib/host$β host system interface β[MACHDEP]iraf$β the root directory of IRAF β[MACHDEP]lib$β system library βiraf$lib/math$β math sources βiraf$math/pkg$β applications packages βiraf$pkg/sys$β the VOS, system libraries βiraf$sys/tmp$β where temporary files go β[MACHDEP]
All other directories should be referenced by giving the path from either the current directory or from one of the system logical directories shown above. For example, pkg$system/ is the root directory of the SYSTEM package, and .. is the directory one level up from the current directory. classic. π¦
π 3. Maintaining Libraries with MKPKG π
Libraries are described by a member list module in the mkpkg file. The syntax of a library member list module is shown below. Note that the mkpkg module name for a library member list module is the same as the name of the actual library, hence must end with the extension .a. no exceptions bestie.
libname.a:
member1 dep1 dep2 ... depN
member2 dep1 dep2 ... depN
...
memberN dep1 dep2 ... depN
;
Here, libname.a is the IRAF virtual filename of the library (regardless of what directory it resides in), memberN is the name of a source file which may contain any number of actual library object modules, and depN is the name of a file upon which the named member depends. If any of the named dependency files is newer than the corresponding member source file, or if the member source file is newer than the compiled library object module, the source file is recompiled and replaced in the library. Both source files and dependency files may reside in remote directories. The names of dependency files in system libraries should be enclosed in <> delimiters, e.g., <fset.h>. Each member must be described on a separate line. one per line. always. π
If the library being updated does not reside in the current directory (directory from which the mkpkg command was entered) then the library must be "checked out" of the remote directory before it can be updated, and checked back in when updating is complete. These operations are performed by macro preprocessor directives, e.g.:
$checkout libsys.a lib$
$update libsys.a
$checkin libsys.a lib$
$exit
libsys.a:
@symtab # update libsys.a in ./symtab
brktime.x <time.h>
environ.x environ.com environ.h <ctype.h>
<fset.h> <knet.h>
main.x <clset.h> <config.h> <ctype.h>
<error.h> <fset.h> <knet.h>
<printf.h> <xwhen.h>
onentry.x <clset.h> <fset.h> <knet.h>
spline.x <math.h> <math/interp.h>
;
Note that the checkout operation is required only in the directory from which the mkpkg command was entered, since the library has already been checked out when the mkpkg-file in a subdirectory is called to update its portion of the library (as in the @symtab in the example above). The checkout commands should however be included in each mkpkg-file in a hierarchy in such a way that the library will be automatically checked out and back in if mkpkg is run from that directory. The checkout commands are ignored if the mkpkg-file is entered when updating the library from a higher level, because in that case mkpkg will search for the named entry for the library being updated, ignoring the remainder of the mkpkg-file. she knows what she's looking for. she skips the rest. π
Sometimes it is necessary or desirable to break the library member list up into separate modules within the same mkpkg-file, e.g., to temporarily change the value of the symbol XFLAGS when compiling certain modules. To do this use the @ indirection operator in the primary module list to reference a named sublist, as in the example below. Normal indirection cannot be used unless the sublist resides in a subdirectory or in a different file in the current directory, e.g., @./mki2, since a single mkpkg-file cannot contain two modules with the same name. The same restrictions apply to the $update operator. π¨
libpkg.a:
@(i2)
alpha.x
beta.x
zeta.f
;
i2:
$set XFLAGS = "-cO -i2"
gamma.f
delta.f
;
In the example above five object modules are to be updated in the library libpkg.a. The files listed in module i2, if out of date, will be compiled with the nonstandard XFLAGS (compiler flags) specified by the $set statement shown. custom flags, custom era. β¨
π¦ 4. The MKPKG Macro Preprocessor π¦
The mkpkg macro preprocessor provides a simple recursive symbol definition and replacement facility, an include file facility, conditional execution facilities, an OS escape facility, and a number of builtin directives. The names of the preprocessor directives always begin with a dollar sign; whitespace is not permitted between the dollar sign and the remainder of the name. Several preprocessor directives may be given on one line if desired. Preprocessor directives are executed as they are encountered, and may appear anywhere, even in the member list for a library. literally anywhere. she does not care. π
β¨ 4.1. Symbol Replacement β¨
Okay bestie, so symbol substitution in the mkpkg macro preprocessor? It's character-level, not token-level. That means macro expansion can happen inside tokens, quoted strings, or OS escape commands. Macros are recursively expanded but may not have arguments. π
Macros may be defined:
- on the
mkpkgcommand line - in the argument list to a
$callor$updatedirective (peep below) - in an include file referenced with the
$includedirective - or in a
$setdirective
All symbols are global and hence available to all lower level modules, but symbols are automatically discarded whenever a module exits, hence cannot affect higher level modules. A local symbol may redefine a previously defined symbol. The IRAF and host system environment is treated as an extension of the mkpkg symbol table, i.e., a logical directory such as "iraf" may be referenced like a locally defined symbol. π
Macro replacement occurs only when explicitly indicated in the input text, as in the following example, which prints the pathname of the dev$graphcap file on the mkpkg standard output. The sequence "$(" triggers macro substitution. The value of a symbol may be obtained interactively from standard input by adding a question mark after the left parenthesis, i.e., "$(?terminal)" (this does not work with the -f stdin flag). The contents of a file may be included using the notation "$(@file)". Note that case is ignored in macro names; by convention, logical directories are normally given in lower case, and locally defined symbols in upper case. π
$echo $(dev)graphcap
!xc $(XFLAGS) filea.x fileb.x
Symbols are most commonly defined locally with the $set directive. The $include directive is useful for sharing symbols amongst different modules, or for isolating any machine dependent definitions in a separate file. The IRAF mkpkg system include file hlib$mkpkg.inc is automatically included whenever mkpkg is run. π
$set symbol = valueβ Enter the named symbol into the symbol table with the given string value. Any existing symbol will be silently redefined. Symbols defined within a module are discarded when the module exits.$include filenameβ Read commands (e.g.,$setdirectives) from the named include file. The include filename may be any legal virtual filename, but only the major logical directories are recognized, e.g.,"iraf$","host$","hlib$","lib$","pkg$", and so on.
The use of the $set directive is illustrated in the example below. Note the doubling of the preprocessor metacharacter to avoid macro expansion when entering the value of the GEN macro into the symbol table. The sequence "$$" is replaced by a single "$" whenever it is encountered in the input stream. π«Ά
$set GFLAGS = "-k -t silrdx -p ak/"
$set GEN = "$generic $$(GFLAGS)"
ifolder (amulr.x, amul.x) $(GEN) amul.x $endif
π¦ 4.2 Conditional Execution π¦
Conditional control flow is implemented by the $if directives introduced in the last example and described below. The character "n" may be inserted after the "$if" prefix of any directive to negate the sense of the test, e.g., "$ifndef" tests whether the named symbol does not exist. Nesting is permitted. β¨
$ifdef (symbol [, symbol, ...])β Test for the existence of one of the named symbols.$ifeq (symbol, value [, value, ...])β Test if the value of the named symbol matches one of the listed value strings.$iferrβ Test for an error return from the last directive executed which touched a file. This has only effect ifmkpkgis invoked with the-ioption so that it doesn't exit on the first error. π$iffile (file [, file, ...])β Test for the existence of any of the named files.$ifnewer (file, filea)/$ifnewer (file: filea [, fileb, ...])β Test if the named file is newer (has been modified more recently) than any of the named files to the right. The colon syntax may be used for clarity when comparing one file to many, but a comma will do.$ifolder (file, filea)/$ifolder (file: filea [, fileb, ...])β Test if the named file is older than any of the named files.$elseβ Marks the else clause of an if statement. The else-if construct is implemented as"$else $if", i.e., as a combination of the two more primitive constructs.$endifβ Terminates a$ifor$if-$elsestatement.$endβ Terminates an arbitrary number of$ifor$if-$elsestatements. This is most useful for terminating a long list of$if-$elseclauses, where the alternative would be a long string of$endifdirectives.$exitβ Terminate the current program; equivalent to a semicolon, but the latter is normally used only at the end of the program to match the colon at the beginning, whereas$exitis used in conditionals.
π 4.3 Calling Modules π
The following preprocessor directives are available for calling mkpkg modules or altering the normal flow of control. π₯
$call module[@subdir[/file]] [name=value ...]β Call the namedmkpkg-file module as a subroutine. In most cases the called module will be in the currentmkpkg-file, but the full module name syntax permits the module to be in any file of any subdirectory ("./file"references a different file in the current directory). Arguments may be passed to the called module using the symbol definition facility; any symbols defined in this fashion are available to any modules called in turn by the called module, but the symbols are discarded when the called module returns.$update module[@subdir[/file]] [name=value ...]β Identical to$callexcept that the named module is understood to be a library member list. The current value of the symbolXFLAGSis used ifXCis called to compile any files. If the named library does not exist one will be created (a warning message is issued). π$gotoβ Causes execution to resume at the line following the indicated label. The syntax of a goto label is identical to that of amkpkg-file module name, i.e., a line starting with the given name followed by a colon. The$gotostatement automatically cancels any$ifnesting.
β¨ 4.4 Preprocessor Directives β¨
okay bestie, here's the rest of the preprocessor tea β the remaining directives, listed below in alphabetical order fr fr. and just so you know, there's extra capability available via OS escapes, as long as you're chill with the resulting machine dependence π
$echo messageβ prints the given message string to standard output. the string must be quoted if it's got any spaces in it. π£οΈ$checkout file directoryβ checks the named file out of the indicated directory. the checkout operation makes the file accessible as if it were sitting in the current directory; checkout is implemented either as a symbolic link or as a physical file copy, depending on the host system. the referenced directory can be a logical directory, e.g."lib$", or a path, e.g."pkg$images/". and listen β checkout is not disabled by the-nflag. noted π$checkin file directoryβ checks the named file back into the indicated directory. the checkin operation is implemented either as a remove link or copy and delete, depending on the host system. checkin is not disabled by the-nflag either. π«$copy filea filebβ makes a copyfilebof the existing filefilea. on a UNIX host the copy operation will preserve the file modify date if the file is a library (all so we can dodge the "symbol table out of date" syndrome, we hate her). π«Ά$delete file [file ...]β deletes the named file or files. bye bestie π$generic [-k] [-p prefix] [-t types] [-o root] filesβ runs the generic preprocessor on the named files. the generic preprocessor is an IRAF bootstrap utility. β¨$xyacc [options] fileβ runs the xyacc parser generator on the named files. the yacc parser generator is an IRAF bootstrap utility. π§$link [switches] file1 file2 ... fileN [-o file.e]β calls XC with the given argument list to link the indicated files and libraries. the value of the symbolLFLAGS(default value: the null string) is automatically inserted at the beginning of the command line. this is equivalent to"!xc $(LFLAGS) ...". π$move file destinationβ moves the named file to the indicated directory, or renames the file in the current directory. π¦$omake file [dep1] [dep2 ...]β compiles the named source file if it does not have a corresponding object file in the current directory, if the object file is older, or if any of the listed dependency files are newer (or not found). the current value of the symbolXFLAGSis used if XC is called to compile the file. π$purge directoryβ deletes all old versions of all files in the named directory. nothing is done if the system does not support multiple file versions. π$special directory : filelist ;β adds one or more files to the special file list for the host system. this is a system facility, not intended for use in applications mkpkg files. the special file list is a list of all source files needing special processing for the local host system. examples of special files are files which are optimized in assembler (or some other nonstandard language), or files which must be compiled in a special way to get around bugs in a host compiler. the special file list makes it possible to flag arbitrary files for special processing, without having to modify the standard software distribution. in the IRAF system, the special file list is defined in the file"hlib$mkpkg.sf"which is included automatically by"hlib$mkpkg.inc"whenever mkpkg is run.
the syntax of a filelist entry is as follows:
modname source_file mkobj_command
where modname is the filename of a library module as it appears in a library module list for the named directory, source_file is the virtual pathname of the source file to be used in lieu of the standard portable source file modname, and mkobj_command is the mkpkg command (e.g., $xc or an OS escape) to be executed to compile the named module. the character "&" appearing in either the source file name or mkobj command is replaced by modname. if the mkobj_command is omitted the specified source file will be compiled with $XC using the current value of XFLAGS. π
$xc [switches] file1 file2 ... fileNβ calls the XC compiler to compile the named files. heads up bestie: the value of the symbolXFLAGSis not used when XC is explicitly called in this fashion (XFLAGSis used by$updateand$omake). β οΈ$debug [on|off]β turns debug mode on or off. if no argument is supplied, debug mode is turned on. turning on debug mode automatically enables verbose mode. π$verbose [on|off]β turns verbose mode on or off. if no argument is supplied, verbose mode is turned on. π―οΈ
π₯ 5. Error Recovery π₯
so here's the iconic part: mkpkg is implemented in such a way that it is restartable. if a mkpkg operation terminates prematurely for some reason β like a compile error, an execution error (such as cannot find the mkpkgfile in a subdirectory), an interrupt, etc. β then the mkpkg command can be repeated after correcting the error, without repeating the operations already completed. periodt. π
if mkpkg is interrupted it may leave checked out files, objects compiled but not yet updated in a library, etc. lying about, but this is harmless and the intermediate files will be cleaned up when the errors have been corrected and the run successfully completes. no cap, it just sorts itself out π«Ά
π¬ EXAMPLES π¬
update the current package.
cl> mkpkg
update the package library but do not relink.
cl> mkpkg libpkg.a
make a listing of the package.
cl> mkpkg listing
sample mkpkg-file for the above commands:
# Make my package.
$call relink
$exit
relink:
$update libpkg.a
$omake x_mypkg.x
$link x_mypkg.o -lxtools
;
libpkg.a:
task1.x pkg.h
task2.x
filea.x pkg.com pkg.h <fset.h>
fileb.x pkg.com
;
listing:
!pr task1.x task2.x file[ab].x | vpr -Pvup
;
π SEE ALSO π
there's also information in the README.softools in the IRAF documentation directory. iykyk π
π AUTHOR π
this manual page was taken from the IRAF mkpkg.hlp help file. π«‘
and that's a wrap bestie!! this page is serving IRAF 2.17, dated June 2021, and it's literally called MKPKG(1) β iconic, no notes, go compile something gorgeous π
β¨π
π¦ where this page comes from
- debian trixie: iraf-dev 2.18.1-2 Β· IRAF
- ubuntu noble: iraf-dev 2.17.1-5build3 Β· IRAF
- ubuntu questing: iraf-dev 2.18.1-2
- ubuntu resolute: iraf-dev 2.18.1-2build1 Β· IRAF
- ubuntu stonking: iraf-dev 2.18.1-2build1 Β· IRAF
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms