# How does anyone figure out how port software?



## johnblue (Dec 24, 2009)

I have always been in nearly slackjaw amazement of software in the ports tree and *all* of the dependencies that are usually required to make the software work correctly.

amavisd-new-2.6.4_2,1 by itself has 70 primary dependencies not to mention that most of those have secondary and tertiary dependencies.

I am sure this is probably a trivial thing, but how in world can anyone figure out all the required dependencies?


----------



## anomie (Dec 24, 2009)

See if this answers your question: FreeBSD Porter's Handbook. 

I am not maintaining any ports, but I notice there is a "Dependencies" section there.


----------



## ohauer (Dec 24, 2009)

In case of amavisd-new it is easier than for many php apps which only tells install phpX (but which modules are really needed?)

For amavis most of the dependencies you see are from SpamAssassin, Mark Martinec provides very detailed information see INSTALL.txt

Everything else is not really needed to run amavis but can be used by this tool.


----------



## johnblue (Dec 24, 2009)

anomie said:
			
		

> See if this answers your question:


Thanks, but it doesn't.  I read it before I posted, and it generally makes the assumption that you know what the dependencies are before you start making a port.

A perfect example of my question is the photo hosting software Gallery.  If you were to read system requirements that comes in the tarball, you would be told:





> System requirements
> 
> â€¢Web server that can run PHP (Apache 1, Apache 2, IIS, Zeus, etc)
> â€¢PHP version 4.x (4.3.0 or more recent) or 5.x (5.0.4 or more recent)
> ...


But if you look at the manifest in the ports:





> Requires:
> 
> ImageMagick-6.5.7.10, cups-client-1.4.2_3, cups-image-1.4.2_3, expat-2.0.1_1, fontconfig-2.8.0,1, freetype2-2.3.11, gamin-0.1.10_3, gettext-0.17_1, ghostscript8-8.70, gio-fam-backend-2.22.3, glib-2.22.3, gnutls-2.8.3, gsfonts-8.11_5, jasper-1.900.1_8, jbigkit-1.6, jhead-2.88, jpeg-7, kbproto-1.0.3, lcms-1.19,1, libICE-1.0.4_1,1, libSM-1.1.0_1,1, libX11-1.2.1_1,1, libXau-1.0.4, libXdmcp-1.0.2_1, libXext-1.0.5,1, libXt-1.0.5_1, libfpx-1.2.0.12_1, libgcrypt-1.4.4, libgpg-error-1.7, libiconv-1.13.1, liblqr-1-0.4.1, libltdl-2.2.6b, libpthread-stubs-0.3_3, libxcb-1.5, libxml2-2.7.6_1, mysql-client-5.0.88, pcre-8.00, perl-5.8.9_3, php5-5.2.11_1, php5-gettext-5.2.11_1, php5-mysql-5.2.11_1, php5-pcre-5.2.11_1, php5-session-5.2.11_1, pkg-config-0.23_1, png-1.2.40, python26-2.6.4, tiff-3.9.2, unzip-6.0, xextproto-7.0.5, xproto-7.0.15



There is no way I, at my level of understanding of FreeBSD, could ever figure out that it needed that much additional software.

What gives?  How did the Gallery2 porter figure it out?


----------



## aragon (Dec 24, 2009)

The gallery porter didn't have to figure all those out.  Some dependencies go multiple dimensions deep. eg. gallery depends on imagemagick, imagemagick depends on X libraries.  The gallery porter will just worry about his dependencies, and the imagemagick porter will worry about his.  The ports system will figure out inter dependencies itself.


----------



## johnblue (Dec 25, 2009)

aragon said:
			
		

> .. and the imagemagick porter will worry about his.


Okay, so how did the Imagemagick porter figure out his dependencies?


----------



## aragon (Dec 25, 2009)

Probably in the same way you figured out gallery's direct dependents?


----------



## dennylin93 (Dec 25, 2009)

Sort of like www/apache22 requires devel/autoconf262, and devel/autoconf262 requires devel/gettext. Many of the dependencies appear recursively.


----------



## wonslung (Dec 25, 2009)

johnblue said:
			
		

> Okay, so how did the Imagemagick porter figure out his dependencies?




This is the beauty of the ports system.  You can specify a few simple dependencies, and the hierarchy will "just work" from the top down.

For instance, if you have a php application which you know requires php5-mysql then the ports system will automatically know that this also requires lang/php5 databases/mysql-client50 (or whichever version)

And all the dependencies for THOSE....


----------



## phoenix (Dec 27, 2009)

As a porter, it's not all that hard.  You grab the source tarball, you extract the source tarball, you run the included *configure* script with --help, check the options, and then play with the various options.  You read the documentation to see what it needs, you see if that's in the ports tree, and you just keep re-iterating through all the options until you get it to compile.

If a dependency isn't in the ports tree, then you start over with that source tarball.

I had a need for RipOLE for an Amavisd-new setup a few years ago, so I build a ripole port for it in under a day.

I had a need for DansGuardian on FreeBSD, so I build a port for it.  The initial port of DG 1.x took a couple of days to figure out and test all the options.  Updates since then have usually been 2-3 days, mostly compiling and testing all of the options.

All it takes to port software is patience, trial-and-error, and problem solving skills.


----------

