RPM packaging. Part 3: packing LÖVE

We will carry out the first practice de pack with RPM, and it will be packaging the engine of the game we want to play. Without it, the game would not work.

All you need is LOVE

SEES IT is an engine for 2D games written in Moon, and Not Tetris 2 it is a game made for said engine. Due to dependencies based on libmpg123 They are not in the official repositories, so it is ideal for the tutorial.

The SPEC files available in openSUSE they have served as inspiration.

Download source code

You will have to download the sources and put them in the SOURCES folder.

cd ~ / rpmbuild / SOURCES
wget https://bitbucket.org/rude/love/downloads/love-0.7.2-linux-src.tar.gz

Create a blank spec template

This command will create love.spec. In RPM the name of the files is quite important, since its nomenclature is standardized to indicate many things, such as your architecture, version, release, distro, etc.

cd ~ / rpmbuild / SPECS
rpmdev-newspec love

We will open the newly created file ~ / rpmbuild / SPECS / love.spec. You will see that it is a blank template. The first part I think is pretty self explanatory. We will fill it with the information found on its official page.

Fill in the template and create our first SPEC

Here is how the complete file looks with a lot of comments that explain each section:

# Name of the package.
# According to the standard, we remove the umlaut to the "o".
Name: love

# Version according to the original author of the package (upstream)
Version: 0.7.2

# Packaging version. Each time we modify the package, we add one to
# this number. This way yum knows to update it.
Release: 1% {? Dist}

# Brief description of the package
Summary: LÖVE is a free 2D game engine for easy game creation in Lua


# License (just the name)
License: ZLIB

# Program website
URL: http://love2d.org/

# Exact URL from which the original sources are downloaded, usually
# in an archive .tar.gz, .zip, or something similar.
#
# As you can see, we use macros so that if we update the package we don't have to
# modify this line. The macros "name" and "version" come from what
# we have indicated above.
Source0: https://bitbucket.org/rude/%name/downloads/%name-%version-linux-src.tar.gz


# Dependencies required to build the package.
# We know this because he puts it on his website.
BuildRequires: flac-devel
BuildRequires: freetype-devel
BuildRequires: glibc-devel
BuildRequires: libmpg123-devel
BuildRequires: libmodplug-devel
BuildRequires: physfs-devel
BuildRequires: mesa-libGL-devel
BuildRequires: openal-soft-devel
BuildRequires: DevIL-devel
BuildRequires: libvorbis-devel
BuildRequires: SDL-devel
BuildRequires: libmng-devel
BuildRequires: libtiff-devel
BuildRequires: lua-devel


##########
# Long package description
% description
LÖVE is an unquestionably awesome 2D game engine, which allows rapid game play
development and prototyping in Lua.

This project is constantly evolving and changes come and go, sometimes initiated
by us and sometimes by the recommendations of others. If you have an idea on how
to make the game engine better, it is greatly desired that you contact us and
let us know what you think.


##########
# In this section we will prepare the sources to compile and apply the
# patches if you have any
% prep

# This macro is a function that decompresses the original sources.
# We indicate 2 parameters:
# -q: Quiet mode. Do not send messages for each file
# unzipped.
# -n% name-HEAD: In this case when unzipping a directory is created called
#% name-HEAD. If we did not indicate this, the program would search
# one called% name-% version and not finding it would give an error.
% setup -q -n% name-HEAD

# As you know, text files created in Windows end in rn,
# while in * nix they end only in n. So for the better
# compatibility, we will remove the r's in the included documentation.
sed -i 's / r //' * .txt


##########
# In this section we will compile the source code
% build

# This is the same as doing `. / Configure` with a bunch of extra parameters that
# make it easy for us not to make mistakes.
% configure

# Add the default options to make, if any.
# In my case, this expands to `make -j3`.
make% {? _ smp_mflags}


##########
# Here we will install the program inside% buildroot.
% install

# Like `make install` with many required predefined parameters.
% make_install


##########
# Here we audit the installed files
% files

# We will indicate the files that are documentation with this function
% doc changes.txt license.txt readme.txt

# Next you have to list all the files that will be installed.
# The only file that will install this is / usr / bin / love, or what is the same:
% _bindir /% name


##########
# Finally, you have to fill in the change log in the package
% changelog
* Fri Nov 18 2011 Jairot Llopis 0.7.2-1
-Initial release
@ domain.com>

We have one last step before creating the package: installing the dependencies. We will use a utility from the package yum-utils to read them directly from the file we just created.

sudo yum-builddep ~ / rpmbuild / SPECS / love.spec

That should suffice. Next we will create the package.

rpmbuild -ba ~ / rpmbuild / SPECS / love.spec

Ready! We already have our package distributed in the directory tree. We will have:

  • ~/rpmbuild/RPMS/x86_64/love-0.7.2-1.fc16.x86_64.rpm: RPM ready to install.
  • ~ / rpmbuild / SRPMS / love-0.7.2-1.fc16.src.rpm: Source RPM ready to modify the package with ease. It includes the SPEC file, the source code and the patches.
However, having the game engine won't do us any good on its own. In the next installment we will see how build the game itself.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Swatch said

    you could do a tutorial for packaging .deb

  2.   Lucas matias gomez said

    What a good tutorial, I would also like you to make one for .deb

  3.   porter said

    very good