So, you've finally got an SGI of your own. You kind of like the system, you want to contribute something to the IRIX community in general and more specifically to the community that helped you making your first steps in the IRIX world: Nekochan. You're okay with building apps from source, and you don't care about having to tweak a bit here and there to get stuff to run properly.
Well, IRIX packages - tardists - don't grow on trees. It all boils down to a number of SGI enthousiasts who build software on their machines in their free time, and package it up for the rest of the community to enjoy. Now, compiling an application on IRIX isn't that painful (yes, there are exceptions of course... OpenOffice, anyone?) but getting a decent tardist from it is a totally different cup of tea.
Still not scared? Alright, get your seatbelts on then :-)
If you're familiar with linux, BSD or any other UNIX variant, and you probably are if you've decided to try IRIX, you're certainly familiar with gcc - the GNU C Compiler suite - too. Well, let's give you the first kick in the balls: gcc just doesn't cut it. You can use gcc to learn the basics (and it's not a bad idea to do so, really) but if you want your package to end up on a nekoware mirror, you'll have to use MIPSPro.
MIPSPro is SGI's own compiler suite, and if you read up a bit on the machines SGI made, it's no surprise that gcc performs worse on such exotic high-performance hardware. On top of that, C++ machine code produced by gcc and MIPSPro cc don't like eachother much.
Anyway, enough already: get your hands on a MIPSPro 7.3 (or newer) media set. You can check eBay, or ask on the IRC channel if anyone knows a place where they sell some. The usual other tools you can find for yourself - gmake, autoconf etcetera. All in nekoware.
Last remark you probably heard tons of times before: nekoware requires at least IRIX 6.5.22, and a mips4 (R5000 or better) cpu for the main tree - there's a mips3 branch too for older machines.
Next thing: setting global variables for development. I usually set these (nicked from joerg's relnotes file) and they work just fine:
export CC=c99 export CFLAGS='-O3 -mips4 -I/usr/nekoware/include -TARG:platform=IP27:proc=r10000' export CXXFLAGS=$CFLAGS export CPPFLAGS='-I/usr/nekoware/include -I/usr/include' export CXX=cc export F77=f77 export LDFLAGS='-L/usr/nekoware/lib -Wl,-rpath -Wl,/usr/nekoware/lib' export PKG_CONFIG=/usr/nekoware/bin/pkg-config export PKG_CONFIG_PATH='/usr/nekoware/lib/pkgconfig' export PKG_CONFIG_LIBDIR='/usr/nekoware/lib' export LD_LIBRARY_PATH='/usr/nekoware/lib' export LD_LIBRARYN32_PATH='/usr/nekoware/lib' export LD_LIBRARY64_PATH='/usr/nekoware/lib64' export GNOME2_DIR='/usr/nekoware' export GNUMAKE='/usr/nekoware/bin/make'
You'll probably have created a place in your homedir to put all source tarballs, build dirs etcetera together. Now, for the rest of the howto, let's suppose you're trying to build fooware version 1.2.3. Duplicate your source dir; this will make it easier for you to create a decent patch later on.
$ tar zxvf fooware-1.2.3.tar.gz $ cp -Rv fooware-1.2.3 fooware-1.2.3-PATCHED $ cd fooware-1.2.3-PATCHED
$ ./configure --prefix=/usr/nekoware
$ su # gmake install # exit
$ cd .. $ diff -urnp fooware-1.2.3 fooware-1.2.3-PATCHED | \ grep -v "^Only" > neko_fooware-1.2.3_irix.patch
$ mkdir /tmp/build $ cd fooware-1.2.3-PATCHED $ gmake DESTDIR=/tmp/build install $ cd ..
Create the extra nekoware dirs you'll use to store patches, sources, release notes and the distribution files swpkg will generate for you; then copy source and patch to their spot.
$ mkdir /tmp/build/usr/nekoware/patches $ mkdir /tmp/build/usr/nekoware/src $ mkdir /tmp/build/usr/nekoware/relnotes $ mkdir /tmp/build/usr/nekoware/dist $ cp neko_fooware-1.2.3_irix.patch /tmp/build/usr/nekoware/patches $ cp fooware-1.2.3.tar.gz /tmp/build/usr/nekoware/src
$ cp neko_fooware.txt /tmp/build/usr/nekoware/relnotes
$ mkdir /tmp/dist $ swpkg
A word of caution: do not confuse the irix version number, which is assigned with swpkg on the first tab, with the application version. They have nothing to see with eachother. The irix version simply shows how "recent" the build is - if an application gets rebuilt (bugfixes, ...), the irix version gets bumped even if the application was built from the same source as the earlier package. In linux-rpm-land this would show itself in filenames like fooware-1.2.3-1.rpm, fooware-1.2.3-2.rpm and so on; the difference is that for the rpm, this number is reset for new versions of the package, and in irix it just moves on.
So - choose a number. If you're the first one to package fooware for nekoware, "1" is the most obvious choice. If you're not, you'd better check what irix version the last build had, and bump it with at least one number.
Also, remember that all version numbers inside the same tardist need to be equal! Even if nothing whatsoever changed in a sub-image since the last build, bump the number even if only one of the other sub-images requires it.
Now, get the piece of paper where you wrote down the dependencies your fooware needed. Make sure to be specific - do you just need the shared libraries, or the binaries? Since apps are split up in the way described earlier, it makes a difference. Easiest way to make sure you get things completely right, is using 'ldd' on your binaries and/or libraries to see what it links into. Let's say fooware's binaries depend on the shared libs of somelib and thatapp, and the binaries of thestuff, all from nekoware. Write down the irix versions for each:
$ versions -n neko_somelib $ versions -n neko_thatapp $ versions -n neko_thestuff
replaces self prereq ( neko_fooware.sw.lib 1 maxint neko_somelib.sw.lib 2 maxint neko_thatapp.sw.eoe 7 maxint neko_thestuff.sw.hdr 1 maxint )
This is why we made that clean build dir: every file that fooware installs, needs to be selected and assigned to a sub-image. Now imagine you'd have to track all of /usr/nekoware for files that belong to your fooware... oh yeah, that'd suck.
Import the full /tmp/build/ dir, and assign the files. Usually stuff in lib/ gets put in sw.lib, bin/ and share/ are sw.eoe domain, and include/ is for sw.hdr. I guess you can figure out the rest. You might want to remove the directory entries themselves - like /tmp/build/usr/nekoware itself; it'll be in your filelist, but it isn't an actual file from your application, which is considered sloppy.
Set "root" as owner and "sys" as group for all files, save the spec and idb file, and then exit swpkg. Yes, exit it. No, we're not done yet. You'll notice soon enough.
Now, the current tardist build files contain all files, have the right permissions, and are assigned to the right package sub-images. That's nice, but the paths are still wrong - we don't want our package to install its files in /tmp/build on all machines, do we? Time for some regex magic.
$ sed -i 's,/tmp/build,,g' /tmp/build/usr/nekoware/dist/neko_foobar.idb
The fourth tab is a quickie. Ever heard of rqsall? You probably already cursed it to hell for taking so long after installing neko_whatever through swmgr. Well, every package needs to specify which files need to be requickstarted, and which ones don't.
In the given filelist, select all files that are no binaries: this means everything, excluding executables and libraries. To the left, check the "norqs" option, and apply it. You just shortened the rqsall run for your package by a nice bit.
Now, your distribution files are ready. Save the idb and spec file once more, then copy everything that isn't in /usr/nekoware yet, there:
$ su # cp /tmp/build/usr/nekoware/src/* /usr/nekoware/src # cp /tmp/build/usr/nekoware/patches/* /usr/nekoware/patches # cp /tmp/build/usr/nekoware/relnotes/* /usr/nekoware/relnotes # cp /tmp/build/usr/nekoware/dist/* /usr/nekoware/dist # exit
$ cd /tmp/dist $ tar -cvf neko_fooware-1.2.3.tardist *
$ cd fooware-1.2.3-PATCHED $ su # gmake uninstall # rm /usr/nekoware/dist/neko_fooware.* # rm /usr/nekoware/src/fooware-1.2.3.tar.gz # rm /usr/nekoware/relnotes/neko_fooware.txt # rm /usr/nekoware/patches/neko_fooware-1.2.3_irix.patch # inst -f /tmp/build/neko_fooware-1.2.3.tardist