Step 4.3 of Porter's Handbook ... a question.

I am trying to learn the "creating a new port (slow method)" and puzzled by 1st sentence of section 4.3 of Porter's Handbook:

Unpack a copy of the tarball in a private directory and make whatever changes are necessary to get
the port to compile properly under the current version of FreeBSD.

So, unpacking the tarball (in private directory), running ./configure, and make, yields an error:

Code:
ld: error: undefined symbol: libiconv

I understand a bit about what is happening here. Also, it is understood that when using a make with a bsd.ports.mk in the actual /usr/ports directory one would supply a USES += iconv.

But, it is unclear how to get past the "undefined symbol" error, at this early stage.

Can one apply a simple variant of USES without bringing in all of the machinery of the real /usr/ports process?

Or is there is simple work-around without the machinery?

What is the proper way to proceed? Thanks in advance.
 
Can one apply a simple variant of USES without bringing in all of the machinery of the real /usr/ports process?
No, it's part of the ports infrastructure. So it won't work without the ports infrastructure. What USES does, or better, translates to, is done by the various components in the /usr/ports/Mk directory. Think of it as macros, if you don't define what the macro is you can't use it.

What you should do is create a skeleton of the port. And run that. First step is to get it to fetch the right sources. Then those sources need to be extracted. Maybe some files need to be patched, create those patch files for it. Then let it run the ./configure and make inside the extracted directory. Let the ports system do its job. Pretty much every step is heavily automated and the ports system will issue all the right commands for you. Most of the time anyway.

A few of the intermediate steps you can do with the port:
Code:
make fetch
make extract
make patch
make configure
 
Thanks for your response. Yes, I originally started with this approach. Was able to almost acheive the goal, but had issues, so I thought I should check here for recommended proper way to proceed.

I will do as suggested. Probably my guesswork will consist of iterating various configure --with-xxx and --without-xxx, and USES until correct.

Thanks again, Cheers.
 
Probably my guesswork will consist of iterating various configure --with-xxx and --without-xxx,
Right, that's usually the tricky part. Just run make extract on your port, then cd into the work/ directory and the directory of the extracted source. Run ./configure --help there. That usually gives you some of the important options you need to set. And the documentation of said software usually has some explanations too. Pay attention to options that may require other dependencies, those might need to be added as BUILD and/or RUN dependencies.

The OPTIONS framework allows you to define "knobs" people can turn on or off in your port. And you can make certain --with-* configure options be added automatically if the knob is turned on. That's a more advanced way. Get it to build properly first. Then have a look at maybe making certain things optional.
 
Back
Top