RPM-MACROFILE(5) File Formats Manual RPM-MACROFILE(5)

rpm-macrofile - rpm macro file format

%NAME[([OPTS]) BODY

Rpm macro files are used to define rpm-macros(7) in the global macro context. The two primary uses of macros are assisting packaging work, and configuring rpm behavior. A pre-determined set of macro files is read upon rpm library initialization as described in rpm-config(5) but they can also be loaded via the %load macro separately.

The format of a macro file is: the macro NAME prefixed with %, followed by whitespace and then the macro body, each new definition separated with a newline. The syntax is exactly the same as when using %define. See rpm-macros(7) for details on the macro syntax.

A trailing \ indicates line continuation, but can be omitted inside macro bodies wrapped in a %{macro:...} block.

Lines starting with # or consisting solely of whitespace are ignored.

Reading a macro file is always fully declarative: no macros are ever expanded when reading a macro file.

%mytool	/usr/bin/mytool-with-annoying-name

# Trailing %{nil} is handy for ensuring a newline at the end
%mycmd %{mytool} \
    --one \
    --with \
    --too \
    --many arguments \
%{nil}

%myhelper() %{lua:
    function dostuff(arg)
        return 'do stuff to '..arg
    end
    print(dostuff(arg[1]))
}

rpm-config(5) rpmbuild-config(5) rpm-macros(7)

2026-01-08 RPM 6.0.1