Solved Looking for advice to learn how to port.

Hello,

I really want to learn how to port things to freeBSD. I have looked at the porters handbook, but that seems over my head at the moment. So, I feel like I need a little push/direction to get started.

At the moment I am working on getting a game working (which is dead in the ports, more specifically it is called Stonesoup Crawl WITH TILES.) I know I should contact the maintainer...etc. I know that someone might be working on it...I get it. But, I want to use this game as a learning experience. And I don't think it is appropriate to bother the maintainer for my particular situation.

So, as of now I have downloaded the source code from the game's site. I am currently trying to get it to run on my system. That is where I am at right now. It hasn't compiled, many problems...but that is not the point.

What happens if I get the game running on my system? How can I use that to port it? Or can I? Will that mean anything? This is where I feel like I need some direction...

Is there any entry level material I could read to get a better understanding of what I am trying to do (not to get the game working, I will figure that out, more specifically the porting part)? As I said, I checked out the handbook, but I am not at that level yet, and I don't really know where to turn.

Thanks for your attention and any advice given.
 
At the moment I am working on getting a game working (which is dead in the ports, more specifically it is called Stonesoup Crawl WITH TILES.) I know I should contact the maintainer...etc. I know that someone might be working on it...I get it. But, I want to use this game as a learning experience. And I don't think it is appropriate to bother the maintainer for my particular situation.
That's a good way to start. It will give you some experience on how ports work. And you don't have to create one from scratch and can easily build and extend the existing port.

Is there any entry level material I could read to get a better understanding of what I am trying to do (not to get the game working, I will figure that out, more specifically the porting part)?
Just start with something that already exists. Modify that. Update it. Fix issues with it. That will give you enough experience to try to build another port from scratch. Port maintainers generally appreciate it when you provide a complete and working patch to update their port. There are also a number of "orphaned" ports you can try, these ports don't have a maintainer and are in dire need of one.
 
Dear hoagies_,
I have done first steps some time ago porting setserial. It is a software to set or read serial port data. Since I am a hardware guy it was easy to see if it worked or not. Nowadays setserial is not such useful compared to the past. But I recommend it for a first step because it has no dependencies.
 
I can understand your issue, and I think You approach it in the correct way.

The first step is to get the thing to compile - and probably also to run (there are ports in the tree that do compille well, but do not run, and I don't think thats so very useful). You're mostly on your own with that.

The next step would be to make a port of it. That basically means to create the port directory, with the Makefile, the packing list, etc., and to use all these fancy switches for properly handling the options and dependencies. This is where I think the porters manual should help. This is usually where I get stuck, because this is not so really easy, and starting to read (and try to understand) the stuff in /usr/ports/Mk, that is highly ambitioned makefile coding.

But then, when You manage to get thru that (given it is a new port), you already have a port - it's just not included in the ports tree. And such a port already has a value: it can be used locally, it can be distributed on your own channels, and it should work with pkg.

The remaining step would then be to have it put into the ports tree, which is an organizational matter, not a technical one.
 
Probably how to translate build instructions from a README to a port's Makefile. That was the most unclear for me, and to some extend it still is. There's a lot of "magic" happening just by setting a couple of variables. But that also makes it really easy to use once you to start to understand how things can be "automagically" done.

Best ones to start with are the applications that only require this "standard" stanza:
Code:
tar -zxvf somesourcecode.tgz
cd somesourcecode
./configure
gmake
If that results in working code on FreeBSD you can use a port Makefile like this:
Code:
# $FreeBSD$

PORTNAME=	someapp
DISTVERSION=	0.1
CATEGORIES=	misc
MASTER_SITES=	http://somesite.example.com/files/

MAINTAINER=	youremail@example.com
COMMENT=	Cat chasing a mouse all over the screen

USES= gmake
GNU_CONFIGURE=yes

.include <bsd.port.mk>
It's a slightly modified example from the handbook. The interesting parts are USES= gmake which tells the system to use gmake(1) (often needed instead of make(1)). And the GNU_CONFIGURE=yes makes sure the ./configure script is started. If needed you can provide additional arguments using CONFIGURE_ARGS= --with-some-option.

Get it to correctly built first. Then you can worry about the other necessities like pkg-plist for example. Most of those can be automatically generated.

Some useful intermediate steps you can take to build a port:
Code:
# Download the source files and calculate a hash, generates distfiles file
# Only needs to be done once
make makesum

# Extract  the code
make extract

# Apply patches 
make patch

# If needed, generate patch files for /files
make makepatch

# Run  ./configure
make configure
If these fail, fix the issue in the Makefile (or patches), run make clean and start again. Work your way through those steps.
 
Wow!

First of all, thank you to everyone! This cleared up all my doubts!

I am truly grateful. I will be marking this post as SOLVED.
 
UPDATE: I got the thing to work! Although I'm still working on getting the "with tiles" version to work. That one seems to be more involved. I compiled it successfully, but I get all sorts of memory problems, memory dumps...not fun.

So now I have the latest version running on my machine. It wasn't that difficult to get the basic game up and running. I even talked to the devs and patched a header problem!!

As of now I want to keep working on getting the tiles working. But aside from that, what should I do, get in touch with the maintainer to tell him whats going on? Or is there a formal way to submit this sort of thing?
 
Back
Top