BUILD(1)
hey bestie π you've stumbled into build(1) from the General Commands Manual, and honestly? iconic. grab a boba, we're building packages π«Ά
πΈ NAME πΈ
build β build SUSE Linux RPMs in a chroot environment β¨
π SYNOPSIS π
build [--clean|--no-init] [--repo dir_or_url] [--repo...] [--root
buildroot] [recipefile]
build --help
build --verify
π DESCRIPTION π
okay so build is THE tool for building binary packages in a safe and reproducible way. no chaos, no "it worked on my machine" energy. by default it builds inside a chroot sandbox, but bestie it can also build inside a virtual machine if you want extra security. main character energy fr fr π₯
if you hand it a recipe file on the command line, build will use that file and every other file in the directory to build the package. if you don't pass a recipe argument, it just goes looking through the current directory for a file. it finds one. it always finds one. π
here's the tea on which recipe file types it understands:
specβ a specfile used to generate rpms. classic. πsrc.rpmβ a source rpm, which gets unpacked for the build. β¨kiwiβ a kiwi config file used to generate a kiwi image. π₯dscβ a dsc file used to generate Debian binary packages. π§PKGBUILDβ a file used to generate Arch Linux binary packages. btw π¦build.collaxβ a shell script used to generate a Collax binary package. β¨
β¨ OPTIONS β¨
--cleanβ nuke the build system and reinitialize it from scratch. total reset, no leftovers. π§Ό--no-initβ skip the whole build-system initialization thing and just start building immediately. speedrun vibes πββοΈ--repo dir_or_urlβ either a directory holding binary packages (optionally with repository metadata), or a url pointing at some remote repository. you can stack multiple--repooptions to create a specific repository layering. heads up tho: packages get searched in the order you specified, so the first repository containing a package with a specific name wins regardless of the version. first come first served, periodt. π- special form:
zypp://reponamespecifies a system repository. zypp://selects all enabled system repositories. this is also the default ifBUILD_RPMSis not set and no--rpmsor--repooption is used. π
- special form:
--dist distributionβ set the distribution. if you don't pass this,buildtries to guess the distribution by peeking at the available packages (snoop π). the distribution you specify can be a string like"11.2"or"sles9","debian7", or the pathname of the build configuration to use.--root buildrootβ tells you where the build system gets set up. overrides theBUILD_ROOTenviroment variable. π--helpβ print a short help text. the bare minimum bestie π«Ά--norootforbuildβ force building with userabuild. otherwise,buildsearches the recipe file for a"needsrootforbuild"hint to decide which user to use.--list-stateβ list packages that would be used to create a fresh build root. it does not create the build root or perform a build. window shopping only ποΈ--rpms path1:path2:path3...β wherebuildcan find the packages needed to create the build system. this option overrides theBUILD_RPMSenvironment variable. this option is deprecated, use--repoinstead. β οΈ--arch arch1:arch2:arch3...β what architectures to select from the RPMs.buildautomatically sets this to a sensible value for your host if you don't specify it, so you should almost never need it. trust the process π
π₯ RPM BUILD SPECIFIC OPTIONS π₯
--useusedforbuildβ tellsbuildnot to do dependency expansion, but instead extract the list of packages to install from"# usedforbuild"lines, or β if none are found β from all"BuildRequires"lines. super handy if you want to re-build a package from a srcrpm with exactly the same packages used for the srcrpm build. no substitutions π--stageβ pass a stage option torpmbuild. the default is-ba.--targetβ callrpmbuildwith a target option. this is the one for cross building. π--verifyβ verify the files in an existing build system. vibe check β
π§ VIRTUAL MACHINE SPECIFIC OPTIONS π§
--xen--kvm--uml--qemu--emulator--zvm--lxcβ sets a specific vm type. pick your fighter π--vm-type typeβ as above. same energy, different spelling.--vm-disk fileβ specifies the location of the disk image to use. if you don't pass this,buildroot.imgis used (e.g./var/tmp/build-root.img). πΎ--vm-disk-size size_in_mbβ specify the size of the disk image to create. size matters bestie π--vm-disk-filesystem typeβ sets the filesystem type to use when creating the disk image. the default is to use theext3filesystem.--vm-swap fileβ specifies the location of the swap file to use. if you don't pass this,buildroot.swapis used (e.g./var/tmp/build-root.swap).--vm-swap-size size_in_mbβ specify the size of the swap file to create.--vm-memory size_in_mbβ sets the desired memory size of the virtual machine. feed her well π--vm-kernel kernel_fileβ set a specific kernel to boot in the virtual machine.--vm-initrd initrd_fileβ set a specific kernel to boot in the virtual machine. (yes bestie, it says kernel again for the initrd option. we report, we don't editorialize π)--vm-disk-cleanβ force the recreation of the disk image. out with the old π--vm-telnet PORTβ is forwardingPORTto a telnet session inside of the VM. specify also needed extra packages via-xparameter, usually:
--vm-telnet 1234 -x telnet-server -x net-tools
and connect from the host via:
telnet localhost 1234
NOTE: The telnet server gets started after all packages got installed. π«Ά
π¦ RECIPE FILE OPTIONS π¦
the build command interprets some special control comments in the recipe file:
# norootforbuild# needsrootforbuild
build uses either user root or user abuild in the build system to do the build. for non-SUSE distros as well as since SUSE 10.2, the default build user is abuild. for 10.2 and before, the default build user is root. these two flags in the spec file allow to deviate from the defaults and force-set the build user to abuild and root (for # norootforbuild and # needsrootforbuild respectively.
# needsbinariesforbuildβ provide the binary rpms that have been used to set up the build root in/.build.binarieswithin the build root. π¦
π ENVIRONMENT π
BUILD_ROOTβ the directory wherebuildshould install the chrooted build system."/var/tmp/build-root"is used by default. see the--rootoption. π‘BUILD_RPMSβ this can be used instead of the--rpmsoption. deprecated. β οΈBUILD_RPM_BUILD_STAGEβ the rpm build stage (-ba,-bb, ...). this is just passed through to rpm, so check the rpm manpage for a complete list and descriptions."-ba"is the default. you should probably use the--stageoption instead. π
β SEE ALSO β
rpm(8),dpkg(8),pacman(8),kiwi(8)- Maximum RPM: http://www.rpm.org/max-rpm/
- cross distribution packaging: http://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto
- openSUSE packaging standards and guidelines: http://en.opensuse.org/Portal:Packaging
and that's the whole page bestie, you ate that π before you go: this gorgeous little BUILD(1) page is brought to you by (c) 1997-2018 SUSE Linux AG Nuernberg, Germany. iconic then, iconic now. now go build something and slay β¨π
π¦ where this page comes from
- debian bookworm: obs-build 20210120-4 Β· GPL-2.0-only OR GPL-3.0-only
- debian trixie: obs-build 20210120-4 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu jammy: obs-build 20210120-1 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu noble: obs-build 20210120-4 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu questing: obs-build 20210120-4
- ubuntu resolute: obs-build 20210120-4build1 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu stonking: obs-build 20210120-4build1 Β· GPL-2.0-only OR GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms