1. MeshCommander on Linux Build Your Own RPM
    1. Preparing the Build Environment
    2. Building the RPM
Veit Wahlich

MeshCommander on Linux Build Your Own RPM

Preparing the Build Environment

To use the meshcommander.spec file to build a RPM package, you need:

  1. A RPM based distro. I am using Fedora 30 here. If using an older version of Fedora or an Enterprise Linux (clone) older than 8, substitute dnf with yum.

  2. The spec file from the project's Download section.

  3. Create a user for RPM packaging, I will name it build here. It is strongly recommended to not use root for package building.

    sudo adduser build
    
  4. Install rpm-build and rpmdevtools. rpm-build is required to build RPM packages, rpmdevtools contains the tools we use later to create the RPM build tree and to automatically download sources.

    sudo dnf install rpm-build rpmdevtools
    
  5. Install the spec file's build dependencies; unzip and msitools. unzip is required to unpack the icon pack. msitools is required to extract the files from the MeshCommander.msi.

    sudo dnf install unzip msitools
    
  6. Switch to the build user.

    sudo su - build
    
  7. Create a rpmbuild directory tree in the build user's home directory using rpmdev-setuptree.

    rpmdev-setuptree
    
  8. Copy the meshcommander.spec file in the build user's home directory. You may want to make it writable to be able to edit it in the future. (The usual place for spec files would be ~/rpmbuild/SPECS, but placing it in ~ works, too, and is maybe easier to maintain.)

Building the RPM

After you have set up your RPM build environment as described above, you may start building RPM packages:

  1. Edit meshcommander.spec to match MeshCommander's current version.

  2. Run spectool to automatically download both the MeshCommander.msi and the NW.js binary tarball.

    spectool -g -f -R meshcommander.spec
    

    The -g flag tells spectool to download the source files, -f tells it to force downloading (this is required as MeshCommander.msi does not contain a version number, thus needs to be replaced even if it already exists), -R makes spectool place the downloaded files in ~/rpmbuild/SOURCES, where rpmbuild expects to find them.

  3. Build the MeshCommander RPM package.

    rpmbuild -bb meshcommander.spec
    

    -bb is build binary. Alternatively you may want to use -ba instead to have rpmbuild also build a source RPM file, which contains the specfile and the downloaded source files and may be used to build RPMs using rpmbuild --rebuild.

  4. The new RPM package file is placed in ~/rpmbuild/RPMS/x86_64. If your system is a desktop installation, you may now install it:

    sudo dnf install /home/build/rpmbuild/RPMS/x86_64/meshcommander-0.9.0-1.x86_64.rpm
    

    The version and release number may vary, use the ones from the spec file.