Skip to main content

Building RPMs for Mageia - x2x

Occasionally, you may need to install something that is not included with Mageia. For instance, the x2x applications used to be included with Mageia, but has been dropped in Mageia 5. There are other packages, perhaps Ubuntu packages that I might want to use on my system. Or it's possible no package exists,  just a tarball.

Why would you want to build a package from source if the binary is already available? 

Let's begin with the Mageia Packagers RPM Tutorial as a reference.

Create Your Build Environment

It's always a good practice to build packages as a normal user, not as root. Still, it's handy to have sudo enabled for certain operations.

Create you build environment.

$ mkdir -p ~/rpmbuild/{SRPMS,SOURCES,SPECS,tmp}

Using your favorite editor, create the .rpmmacros file to build Mageia packages.
  
   # Only set %_topdir and %_tmppath if you want to ovveride the the default ~/rpmbuild 
   # and ~/rpmbuild/tmp
   #%_topdir                %(echo $HOME)/rpm
   #%_tmppath               %(echo $HOME)/rpm/tmp
   
   # If you want your packages to be GPG signed automatically, add these three lines
   # replacing 'your_name' with your GPG name. You may also use rpm --resign
   # to sign the packages later.
   %_signature             gpg
   %_gpg_name              your_name
   %_gpg_path              ~/.gnupg
   
   # Add your name and e-mail into the %packager field below. You may also want to
   # also replace vendor with yourself.
   %packager               John Doe 
   
   # you only need to set distribution and vendor if you are not building on
   # a mga host
   #%distribution           Mageia
   #%vendor                 Mageia.Org
   
   # If you want your packages to have your own distsuffix instead of mga (mga5 and older),
   # add it here like this
   #%distsuffix             foo
   
   # With mga6 and newer, if you want your packages to have your own dist instead of mga, 
   # add it here like this
   #%dist                   foo

We also need to install some packages like a compiler. I've found that installing the application checkinstall will bring in most everything we need. Checkinstall is a handy app used to create rpm files from tarballs and some scripts.

$ sudo urpmi checkinstall

Building From a Source RPM

To build from a source RPM file, we need to first install the source repositories.

$ sudo urpmi.addmedia core_src ftp://ftp.mirrror.com/mirror/mageia/distrib/5/SRPMS/core/release

 And then install it with

$ urpmi --install-src packagename

 You can also use ftp with urpmi. Since x2x was dropped (it has not been maintained in a while, circa 2003), we can search in RPMfind for the x2x packages (or go to the homepage for a tarball), and locate a suitable package. Also, we check that 1.30beta is the most current version available.

From this page we can follow the link to a 64-bit package and use the ftp feature of urpmi  to install the package as a regular user.

$ urpmi --install-src ftp://fr2.rpmfind.net/linux/Mandriva/devel/cooker/SRPMS/x2x-1.30-0.beta.7mdv2011.0.src.rpm

That should have worked, except that the files are so old, they have been deleted from the servers.  I eventually found a source rpm file at  http://pkgs.repoforge.org/x2x/x2x-1.27-0.2.rf.src.rpm , but it would not install due to missing dependencies (unsatisfied libXext-devel), therefore I used wget to download the file and I'll use urpmi to install the missing dependency and then install the source rpm.

Get  List of Dependencies Before Installing
There are several ways to get this information.

If you are installing a source rpm from the Mageia repository that you installed above, then use

$ urpmq -d -m --sources

I find it easier if a source package is available, to use mc to peek inside the rpm file and look at the contents of contents.cpio and examine the .spec file, which will list the dependencies. In this case, they are

 libX11-devel, libXext-devel, libXtst-devel, imake

But these are for a Fedora system, so the equivalent Mageia must be discovered.

 libx11-devel, libxext-devel, libxtst-devel, imake

Note how just the (annoying) difference in capitalization make things different. so

$ sudo  urpmi libx11-devel libxext-devel libxtst-devel imake

Install these and the 17 packages that it takes to sort out all their dependencies. Ugh.

 ftp://fr2.rpmfind.net/linux/Mandriva/official/2011/SRPMS/contrib/release/x2x-1.30-0.beta.7mdv2011.0.src.rpm


REFERENCES

Mageia URPMI

Quick URPMI Reference

Mageia Packaging Tutorial

Checkinstall Homepage & README


Comments

Popular posts from this blog

DOS4GW.EXE Version 2.01a and Alternative DOS Extenders

DOS4GW.EXE The Tenberry DOS extender DOS4GW.EXE was used by many early DOS games. I still enjoy playing many of these games and DOS4GW.EXE is usable with DOSBox , so they can be played on Linux. However, the version of DOS4GW.EXE that was included with the game was whatever was current at the time. The most recent version that includes many bugfixes that possibly affected the games when used with DOSBox have been fixed in the latest version, 2.01a. It's not free at US$49, but you can downloaded it here . Simply substitute it for whatever version of DOS4GW.EXE your game provided and enjoy the bug-fixed goodness. Tenberry also makes a "high-performance" "pro" version of DOS4GW.EXE, but it costs $300. I think that they could sell quite a few of these to hobby users (since, you know, DOS is dead) for US$5. Open Souce to the Rescue There are better performing, free and Open Source alternatives available and worth a look. DPMI Explained Let's unders...

Return to Castle Wolfenstein for Modern Linux

Return to Castle Wolfenstein is a first-person shooter originally released on November 19, 2001. The game, like many other classic games, is available at GOG.com and costs only US$5.99. iortcw for Linux Don't bother with old and crusty Linux binaries offered by idsoft; they are problematic and it's painful to use them on a modern Linux. Fortunately for us, there are more modern GPL-licensed Linux binaries available for 32- and 64-bit systems as well as high resolution textures packages. The project at GitHub provides source code that can also be compiled for MS Windows using MinGW. iortcw for Windows and Mac You can download pre-compiled binaries for 32- and 64-bit Linux, MS Windows and Mac from here . Let's put our files in /usr/local/games/rtcw . As root, extract the downloaded .ZIP file for your architecture to  /usr/local/games/rtcw . All we are missing are the game data files. I purchased them from GOG.com. The game installer downloaded from GOG.com can be ...

Unreal Tournament GOTY/UT99 for Modern Linux

Released on November 16, 1999, Unreal Tournament (also known as UT99) is an arena first-person shooter for Multiplayer on-line competition or you can play against bots off-line. It features several game types, with more details provided at Wikipedia . The game was re-released on February 25, 2000 as Unreal Tournament Game of the Year Edition (GOTY) which included the three bonus packs released previously and additional mods, or game modifiers that had become popular. It is the GOTY version that is available from STEAM or  GOG.com . The GOG version for Windows installs in Linux and plays well using WINE , PlayOnLinux or Codeweaver's Crossover . There is a Linux binary available in two versions, one for the original game and one for the GOTY edition . Also provided at that site is the Official Bonus Pack with a Linux installer. All these Linux installers are created with makeself . There are some issues using such a crusty old Linux binary. Let's see why getting...