Maker tech hub — AI · 3D print · Pi · ESP32 · plus the classic tech archive.

Free ESP32 kit · Books · Network Ninja · Archive

Classic tech archive. From the original averyjparker.com tech blog — historical context; pair with modern guides where noted. Full archive · Maker projects · Network Ninja

Classic tip · Classic

Building RPM's - making a build environment

I'm going to do a few articles on building RPM's as much for my own reference as anyone elses. I'm not an expert on the subject by any means... I do this from time to time, rebuild an rpm for an olde…

Written by

Avery J. Parker

IT veteran, maker educator, and author of Network Ninja, 3D Printing Mastery, and AI Workflow Mastery. Business IT: Diversified Tech Solutions.

I'm going to do a few articles on building RPM's as much for my own reference as anyone elses. I'm not an expert on the subject by any means... I do this from time to time, rebuild an rpm for an older system (or even a newer system that doesn't have an official rpm for.) I have a tendency to forget things that I don't do frequently. The first part of being able to rebuild rpm's is to have what's called a build environment. For starters, I'm using Mandriva 2006 (older versions I used Mandrake 10.1 or 10.0, etc.) In your home directory you need a folder called rpm.


In that folder you need subdirectories called:
BUILD
RPMS
SOURCES
SPECS
SRPMS
tmp

the RPMS folder needs to have subfolders as well:

noarch
i586

At this point you just need to have 2 configuration files in your home directory:

.rpmrc which should have the following:
buildarchtranslate: i386: i586

buildarchtranslate: i486: i586

buildarchtranslate: i586: i586

buildarchtranslate: i686: i586

and .rpmmacros which should contain this:
%_tmppath YOUR_HOME_DIR/rpm/tmp



%_signature gpg

%_gpg_name Mandrakelinux

%_gpg_path ~/.gnupg



%distribution Mandriva Linux

%vendor Mandriva

Make sure to adjust the path correctly. A Mandriva user even has a quite script to do all the above for you... it's here setup4rpm.sh Once this is done you've got all the folders you need.

The only other bit of advice I can give on the environment for rpm building. IF the packages are intended for others, try to keep the system as close to an "official" mandriva system as possible, try not to have requirements that would have users hunting for obscure non-mandriva packages. Ideally packages for public consumption with Mandriva should just have Main/contrib/updates requirements (maybe plf depending on what it is I suppose....) For your own use though, it's up to you how "clean" your build system is.