# Building RPMs for Pmodules

## The spec files
The spec files in this repository can be used to build RPMs for Pmodules. 

**Pmodules.spec**\
The spec file to build the Pmodules RPM. 

**Pmodules_modules.spec**\
Pmodules is a wrapper around the C implementation of Environment Modules 3.2.10 with some patches (e.g.: except `%#Pmodules` as shebang). This RPM is set as 'required' in the Pmodules RPM.

**Pmodules_bash.spec**\
The Pmodules wrapper is written in Bash and uses feature only available in Bash version 5 and newer. On most current Linux distributions only Bash 4 is available. This RPM is set as 'required' in the Pmodules RPM.

## Building the RPMs

**Requirements (on RHEL8/9)**\
The RPMs `rpm-build` and `rpmdevtools` must be installed.

**Setup the directories for `rpmbuild` (if not already done)**
```
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
```

**Download the required sources**
```
cd ~/rpmbuild/SPECS
for f in Pmodules.spec Pmodules_bash.spec Pmodules_modules.spec; do
    spectool "$f"
fone
```

**Build the RPMs**
```
for f in Pmodules.spec Pmodules_bash.spec Pmodules_modules.spec; do
    rpmbuild -bb "$f"
fone
```


