buildpkg(1) buildpkg(1) NAME buildpkg - package build system SYNOPSIS buildpkg [options] deffile DESCRIPTION buildpkg processes build steps from deffile and creates binary (.tar.gz), slackware (.tgz), debian (.deb), redhat (.rpm), solaris (.pkg) or freebsd (.tgz) packages. OPTIONS --autorun enable autorun mode --download download only source file and exit --force-step force jump to given step --ignorepath 'xxx' path to be ignored by find (before/after) install --ignorerc ignore $HOME/.buildpkgrc. This can be useful if you want to disable you local configuration and only use $CONFDIR/buildpkg.conf. --skip-chown skips chown part in slackware/raw packaging. --version display version number INSTALLATION STEPS 0] extract source code DOWNLOAD if source file is not available in the current directory, buildpkg tries to fetch it (first via DOWNLOAD part, and if this is not available, automatically using SOURCE_URL). PRE_EXTRACT if available, execute before extract EXTRACT if available, overwrites default extract process POST_EXTRACT if available, execute after extract --* stop *-- 1] apply patch if available (.patch[.gz,.bz2]) PRE_PATCH if available, execute before patch PATCH if available, overwrites default (autodetect) patch process POST_PATCH if available, execute after patch --* stop *-- 2] configure PRE_CONFIGURE if available, execute before configure CONFIGURE put configuration steps here (e.g. './configure') POST_CONFIGURE if available, execute after configure --* stop *-- 3] build PRE_BUILD if available, execute before build BUILD put build steps here (e.g. 'make') POST_BUILD if available, execute after build --* stop *-- 4] install (normal or in jail) PRE_INSTALL if available, execute before install INSTALL put installation steps here (e.g. 'make install') POST_INSTALL if available, execute after install --* stop *-- 5] collect files PRE_COLLECT if available, execute before collect --* collect files *-- POST_COLLECT if available, execute after collect 6] find dependencies Only slackware, binary and solaris use this step, the others just skip it (their package system already has one). --* stop *-- 7] distro / OS specific stuff slackware generate ./install/doinst.sh if nessesary debian create ./debian/ dirstruct and .postinstall script if nessesary redhat create .spec file and insert %post part if nessesary solaris create prototype file, insert postinstall part if nessesary --* stop *-- 8] package PRE_PACKAGE if available, execute before package PACKAGE if available, overwrites default (distro spec) packaging POST_PACKAGE if available, execute after package --* stop *-- 9] cleanup PACKAGE TYPES - unknown no find_deps and no packaging - slackware (alias: tgz) full support - binary full support (default) - deb (alias: debian) full support - rpm (aliases: suse, mandrake, redhat) full support - solaris (alias: pkg) full support - freebsd full support RECOGNISED ARCHIVE EXTENSIONS - '.gz' : gzip - '.tar.gz' : tar + gzip - '.tgz' : tar + gzip - '.Z' : compress - '.tar.Z' : tar + compress - '.bz2' : bzip2 - '.tar.bz2' : tar + bzip2 - '.tar' : tar INSTALL MODES - jail create a jail using the files specified in the global buildpkg.jail and the local $PACK- AGE_NAME.jail file and perform the 'INSTALL' step; this mode is the most safe but some programmes may have difficulties with it because they require stuff not included in the jail. You can include these files in the local $PACKAGE_NAME.jail file or use the 'normal' mode bellow. - normal (default) simply perform the 'INSTALL' step; if you plan to use this mode, the use of AUTO_COL- LECT_INSTALLED="y" is highly reccomended. FILE TYPES AND THEIR DESCRIPTION - '.cookie' temporary file which stores a cookie. Cookies indi- cate that the previous function returned an error, so buildpkg is able to track them. - '.def' definition file (created by mkskel) - '.deps' package dependencies (created by buildpkg) - '.filelist' used by filelist feature - '.files' collected list of files created and/or modified by installation. - '.setup' (only slackware) /var/log/setup/setup.$PACKAGE_NAME - '.status' temporary file to store number of next step. - '.install' (slackware, debian, redhat, solaris and freebsd) Append to the end of $DESTDIR/install/doinst.sh in Slackware, to $PACKAGE_NAME.postinst in Debian and to '%post' part of .spec in RedHat. Use package prototype's 'postinstall' feature in Solaris and 'pkg_add -I' (postinstall) in FreeBSD. - '.iteration' temporary file to store iteration number (only in iteration mode). - '.patch[.gz,.bz2]' patch file, to be applied prior configuration (interpreted by buildpkg) - '.slack-desc' (only slackware) slackware package description file - '.jail' extra files needed in jail for installation (inter- preted by buildpkg) LOG FILES - '.configure.log' output of CONFIGURE step[s]. - '.build.log' output of BUILD step[s]. - '.install.log' output of INSTALL step[s]. - '.jail-files.log' output of copy_into_jail. - '.package.log' output of package step. DISTRO SPECIFIC DEFAULT VALUES DEFAULT_PREFIX="/usr" this prefix is the most used one for packaged applications. DEFAULT_SYSCONFDIR="/etc" this directory is used to store configuration files. DEFAULT_INFODIR="${PREFIX}/info" this is the old default location of info files. Newer distros, which follow the FHS uses ${PRE- FIX}/share/info. DEFAULT_MANDIR="${PREFIX}/man" this is the old default location of man files. Newer distros, which follow the FHS uses ${PRE- FIX}/share/man. VARIABLES, THEIR MEANINGS AND THEIR DEFAULT VALUES ARCHIVE_SRCDIR="/usr/source.files" where to store source files; if no directory is specified, source files will not be stored (you need write rights). ARCHIVE_SRCFILE="y" archives source file to $ARCHIVE_SRCDIR. AUTO_COLLECT_INSTALLED="y" create a file list using 'find' before and after the installation step and use 'diff' to find newly installed files; move these files to $DESTDIR directory. AUTORUN=false autorun mode; if set to 'true' buildpkg will not stop at '--* stop *--' tags. BUILDPKG_STYLE="classic" changes buildpkg style... (do not change until you know what you are doing...) CHOWN_TO_ROOT="y" does a 'chown -R root:root .' after do_extract in the $SOURCE_DIRECTORY. COMPRESS_INFO_PAGES="y" compress info pages COMPRESS_MAN_PAGES="y" compress man pages CONVERT_TO_LOWERCASE="n" convert names to lowercase (excluding source file and directory). CONVERT_SYMLINKS="n" convert relative symlinks (../bin/something) to absolute ones. CREATE_BUILDSH="n" create build.sh shell script. CREATE_CHANGELOG="y" controlls the creation of ChangeLog files by mkskel. DESCRIPTION="..." package description (available for slackware, deb, rpm and freebsd packages). $SUMMARY is set to con- tents of first line if not explicitly given. DISTFILES="..." URL to DISTFILES repository (ie. gentoo's one). DISTRO_NAME="unknown" will provide some nice features in future (place- holder). DOWNLOAD_IF_NOT_AVAILABLE="y" download file - if not available in current direc- tory - from the [1] $ARCHIVE_SRCDIR or from [2] $SOURCE_URL. EDIT_BEFORE_REMOVE="y" if this option is set to "n", buildpkg will remove installed files without any notice. This may not be a good idea, so it is generally a good idea to leave this option set to "y". EDITOR="/usr/bin/vi" which editor to use for editing .removeit files (file list, which specifies files to be removed after installation). By default buildpkg sets it to "/usr/bin/vi" if not specified before in users environment. ENABLE_FIND_PROGRESS="n" This option enables in combination with the find- progress patch located at the ./patches directory a nice rotochar during the FS scanning before and after installation. FAKEROOT="/usr/bin/fakeroot" You need the fakeroot utility for debian package creation. This variable specifies where it is located. FASTMODE="n" Setting this variable to "y" enables 'fast mode'. In this mode there is never (even with AUTORUN set to 'true') a stop after the FILELIST_FEATURE="y" Setting this variable to "n" disables 'filelist feature'. If it is activated (default) buildpkg looks for files with '.filelist' extension in the current directory. If available, they are used instead of the 'auto separate' function. The use of this feature provides distributors an alternative way to create packages. IGNOREPATH="..." ignore this path in 'find' before and after install step; this variable has an empty default value, because it is better to set it from the global $CONFDIR/buildpkg.conf. It is nessesary to ignore some directories during 'find'. These are e.g. '/dev', '/proc', '/tmp', '/root', '/usr/src' and the spool directories of running daemons as for example mailer daemon. INSTALL_MODE="normal" sets default install mode INTERACTIVE="n" force interactive installations; in this mode the output (stdout/stderr) *will not* be redirected to a log file. ITERATION="" use multiple CONFIGURE, BUILD and INSTALL steps. JAIL_ROOT="" use same $JAIL_DIR for every installation and do not empty it. NO_MAN_PAGES="n" do not compress man pages after installation. NO_INFO_PAGES="n" do not compress info pages after installation. NULL_MAJOR="..." /dev/null major number (autodetected) NULL_MINOR="..." /dev/null minor number (autodetected) OPTCFLAGS="" optional (additional) CFLAGS. OPTIMIZE="n" compile using arch specific optimization. OVERWRITE_SETTINGS="y" if set to "n", PACKAGE_* definitions are only writ- ten by mkskel if SEPARATE_* options used. PACKAGE_ARCH="i386" sets 'architecture type' string which will be appended to the various package names in 'binary only mode'. PACKAGE_TYPE="binary" sets default package type PATCH_STRIPSLASHES="-p1" default patch level to use in 'PATCH' PKG_CREATOR="..." You should enter your name and you email address in the following form: 'Your name'. This value is used in the debian installation/package definitions. If you do not define such a variable (i.e. use the default ""), then buildpkg will ask you to enter the informa- tions if needed. PKG_NAME="..." You can overwrite the auto-detected package name. PKG_SECTION="unknown" You can overwrite the __PKG_SECTION__ part in the debian/control file. The default value is "unknown". PKG_PRIORITY="extra" You can overwrite the __PKG_PRIORITY__ part in the debian/control file. The default value is "extra". PKG_VERSION="..." You can overwrite the auto-detected package ver- sion. RAWMODE="n" the same as use '--raw' option with mkskel; uses source filename to guess package name. REMOVE_AFTER_COPIED_TO_DESTDIR="y" remove files from computer after copying them to $DESTDIR; this ability should be used with extra care to avoid accidental erasion of files. It is used in combination with AUTO_COL- LECT_INSTALLED="y". REMOVE_BROKEN_SYMLINKS="n" remove broken symlinks in correct_mislinked_files step. REMOVE_EMPTY_DIRS="n" remove empty directories from $DESTDIR. The safest is to leave this option untouched. As an example, a program creates a spool directory for itself with the appropriate rights, but places no files into it. If this option is set to "y", buildpkg would remove it, and the programme would miss it later. See it as a hidden feature, but do not use it unless you know exactly what you're doing. SEPARATE_DEVEL="n" create a separate file for development (.a, .la, .h) stuff; if set to "y", buildpkg examines the $DESTDIR directory after 'INSTALL' and moves the '*.a'|, '*.la' and '*.h' files into $DESTDIR-devel. These files will be packaged into a separate pack- age called '$PACKAGE_DEVELNAME'. It is not ness- esary to change this default value, because buildpkg sets it automatically to "y" if a '$PACK- AGE_DEVELNAME' value is specified in the '.def' file. SEPARATE_DOCUMENTATION="n" create a separate file for documentation stuff; if set to "y", buildpkg examines the $DESTDIR direc- tory after 'INSTALL' and moves the '*/doc/*' direc- tories into $DESTDIR-doc. These files will be pack- aged into a separate package called '$PACKAGE_DOC- NAME'. It is not nessesary to change this default value, because buildpkg sets it automatically to "y" if a '$PACKAGE_DOCNAME' value is specified in the '.def' file. SKELMODE="n" if set to "y", mkskel will only work in skeletion mode, that means it will not require any real file. SKIP_CHOWN_TO_ROOT="n" if set to "y", buildpkg will skip the chowning of directories to root; but I think it is a good idea to leave this option "n", because this whole step is fully optional. SKIP_EXTRACT="n" skip 'EXTRACT' step. SOAPBOX_PATH="" add given path to $SOAPBOXPATH. STRIP_BIN="y" strip binaries in $DESTDIR. STRIP_FLAGS="--strip-debug" options to use with strip STRIP_LIB="y" strip shared libraries in $DESTDIR. STRIP_STATIC_LIBRARIES="y" strip static libraries in $DESTDIR. SUMMARY="..." package summary (one liner) (available for slack- ware, deb, rpm, solaris(pkg) and freebsd packages). TEMPDIR="/tmp/pkg" where to put temporary files (you need write and execute rights). USE_PATH_FINDOPT="(auto)" Use an alternate filtering mechanism (combination of egreps) in generate_(before|after)_filelist pro- cess. This variable is set automaticaly if set to "(auto)" or if SunOS detected. USE_POLICY="y" Use 'DIRECTORY_POLICY' and 'FILE_POLICY' if $CONFDIR/buildpkg.policy exists. Using a policy based directory management automatically disables chown to root feature. USE_SOAPBOX="n" Use Soapbox [http://dag.wieers.com/home-made/soap- box/] to deny writes outside of $DESTDIR in 'nor- mal' mode. WIPE_DEPCOMP="n" Automatically wipe depcomp file with /dev/null if found. You can overwrite default values by inserting them into $CONFDIR/buildpkg.conf or $HOME/.buildpkgrc ! USEFUL COMMANDS (from .def files) do_copy "filename1" "filename2" ... "destination/" This command creates the destination directory if not available and copies multiple files into it. do_bz2copy "filename1" "filename2" ... "destination/" This command creates the destination directory if not available and copies multiple files into it and compresses them using 'bzip2 -9'. do_gzcopy "filename1" "filename2" ... "destination/" This command creates the destination directory if not available and copies multiple files into it and compresses them using 'gzip -9'. do_download "url" Fetch file, check md5sum and store into $ARCHIVE_SRCDIR do_extract "filename" This commands extracts given file(s) after select- ing valid decompression commands via parse_fname. Multiple files can be given by separating them using the space character or by using wildchars. do_md5sumcheck "filename" "md5sum(s)file" This command checks given file agains md5sum stored in md5sum(s)file and exists if it is corrupt with an error message. DEBIAN SKELETON $CONFDIR/debian/default.changelog This is a skeleton for changelog file used in ./debian/ directory. You can use the predefined variables shown bellow... $CONFDIR/debian/default.control This is a skeleton for control file used in ./debian/ directory. You can use the predefined variables shown bellow. $CONFDIR/debian/default.rules This is a ''dummy'' rules file to be used in ./debian/ directory. It only includes the binary part and is mainly the same as used by the alien utility. __CURRENT_DATE__ This field will be filled with the output of `date +%a,\ %d\ %b\ %Y\ %X\ %z`. __DEPENDENCIES__ This field will be filled by debian's dh_shlibdeps. __PKG_CREATOR__ This field will be filled with the value of $PKG_CREATOR. __PKG_PRIORITY__ This field will be filled with the value of $PKG_PRIORITY. If not specified, the default is "extra". __PKG_SECTION__ This field will be filled with the value of $PKG_SECTION. If not specified, the default is "unknown". __PROGRAM_NAME__ This field will be filled with the program name. __PROGRAM_VERSION__ This field will be filled with the program's ver- sion number. __PROGRAM_RELEASE__ This field will be filled with the program's release number. PREDEFINED VARIABLES SRCDIR="$SOURCE_DIRECTORY" points to the source directory. TOPDIR="`pwd`" points to the directory where all the source files and patches are placed (this is the directory where you entered the buildpkg command). CWD="$TOPDIR" this is an alias for $TOPDIR; it is defined for backward compatibility with slackware's protopkg. SPECIAL FEATURES - filelist feature This feature can be used to create custom packages. These files (ie. dummy-0.0.1-1.filelist) provide the filenames for buildpkg to package into separate packages. You can also use wildchars in the file- names as these are expanded using the 'ls' command. - iteration feature Several packages requires to use multiple compile, build and install steps ie. for compiling both, shared and static libraries, etc. To use this fea- ture you only need to define the ITERATION="_0 _1 ..." variable at the beginning of the .def file and the use CONFIGURE_0, BUILD_0, INSTALL_0 ... instead of the normal names. If one step is missing (ie. no INSTALL_0), buildpkg will detect this and skip this step. CONFIGURATION My '$CONFDIR/buildpkg.conf' file: # # buildpkg system wide configuration # IGNOREPATH="/proc:/dev:/root:/export/home:/home:... .../tmp:/var/spool/postfix:/usr/local/src:... .../usr/src:/usr/share/src:/mnt:/cdrom:/xfn" DOWNLOAD_IF_NOT_AVAILABLE="y" STRIP_LIB="y" STRIP_BIN="y" STRIP_STATIC_LIBRARIES="y" INSTALL_MODE="normal" PACKAGE_TYPE="slackware" AUTO_COLLECT_INSTALLED="y" REMOVE_AFTER_COPIED_TO_DESTDIR="y" REMOVE_EMPTY_DIRS="n" ENABLE_FIND_PROGRESS="y" EXAMPLES For examples, please visit the http://savannah.nongnu.org/projects/buildpkg website. SEE ALSO buildpkg-0.0.2r28f(1). COPYRIGHT Copyright (c) 2001-2004 by DiCE/PsychoMix http://savannah.nongnu.org/projects/buildpkg This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCI- DENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSI- NESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI- BILITY OF SUCH DAMAGE. 2003-12-24 buildpkg-0.0.2r28f buildpkg(1)