Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Feb 2007 14:51:55 +0100
From:      Csaba Molnar <molnarcs@gmail.com>
To:        freebsd-ports@freebsd.org
Subject:   learning about building ports - please help
Message-ID:  <200702091451.56124.molnarcs@gmail.com>

next in thread | raw e-mail | index | archive | help
Hello list!

I'm trying to learn how to build a port from scratch - and need some help. I 
successfully built a port for aquamarine (a window decorator for beryl) - but 
I don't understand half of what I did, but I want to :) 

I'm also curious about the skills needed for maintaining/building ports - do I 
need to be a programmer? Because I am not - I'm a scholar in cultural studies 
(but my area of interest is gift economy in general and the free software 
movement in particular). I've been using FreeBSD since 5.1.

So here is what I did - and my questions.

I used the port command (from the porttools-0.77 package) to create the 
Makefile template, and filling in the first part of the Makefile was fairly 
obvious. For the rest, I made certain assumption that I want to verify if 
they are correct:

BUILD_DEPENDS=  ${LOCALBASE}/libdata/pkgconfig/beryl.pc:
${PORTSDIR}/x11-wm/beryl-core
RUN_DEPENDS+=   ${BUILD_DEPENDS}

This is obvious with aquamarine (I copied this line from the emerald 
Makefile) - because it is developed for beryl, and I understand what this 
line means (the porters handbook explained it). But generally, if 
documentation for a project is poor, how do I find out about dependencies? I 
was thinking about looking at the ./configure output...

# These three were fairly obvious:
USE_BZIP2=      yes
GNU_CONFIGURE=  yes
USE_GMAKE=      yes

# I assume this one is needed because aquamarine provides KDE integration

USE_KDELIBS_VER=3

# If I gather correctly, this is needed because aquamarine installs shared 
libraries

USE_LDCONFIG=   yes

# Just like with BUILD_DEPENDS, I'm not sure how I would have figured the next 
one out on my own - I was looking at the emerald makefile for clues. I think 
I understand the first two (use opengl for rendering, and the xrender 
extension?) - but I'm not sure about gettext. I saw USE_GETTEXT is most of 
the ports I looked at - can I assume that it is almost always needed (and 
even it is isn't, it won't hurt)?

USE_GL=         gl
USE_XORG=       xrender
USE_GETTEXT=    yes

# I figured the next one out on my own, while I encountered an error (see 
later):

USE_AUTOTOOLS=  libtool:15

# and finally, the mandatory line:
.include <bsd.port.mk>

While building this port, it errored out at an early stage with this message:
libtool: link: cannot find the library `' gmake[2]: *** [kcm_beryl.la] Error 1

Google turned up this solution:
http://people.fruitsalad.org/lauri/krazykiwi/index.php?/archives/175-Libtool-nutso-insanity.html

After editing libtool in work/aquamarine, it turned out that the problem lies 
with libkdefx.la. As suggested in the above blog post, I removed -pthread 
from the dependency_libs line of libkdefx.la (after making a backup of this 
file first). The port still failed to build after this, but mucking around in 
work/aquamarine, trying make in various subdirectories, I noticed that it 
complains about outdated libtool - so after looking at other kde ports 
(deskutils/katapult) I figured that I need the USE_AUTOTOOLS=  libtool:15 
line). 

After doing all this, the port built fine, and I've been using aquamarine for 
days now. I'm absolutely clueless though as to how to deal with the situation 
described above (removing -pthread from the dependency_libs of libkdefx.la). 
Can this be done in the Makefile? Will removing -pthread from libkdefx.la 
have any adverse effects (didn't notice any so far)?

For the rest of the port, I followed the instructions in the Porter's 
Handbook - make makesum for distinfo, and I put the lines for generating a 
pkg-plist in a script: 

# Store the directory structure in a new file.
(cd /mnt/ad0s3/port_development/installtmp/$portname && find -d * -type d) | 
sort > OLD-DIRS
# Create an empty pkg-plist file:

touch pkg-plist
# If your port honors PREFIX (which it should) you can then install the port 
# and create the package list.

make install PREFIX=/mnt/ad0s3/port_development/installtmp/$portname
(cd /mnt/ad0s3/port_development/installtmp/$portname && find -d * \! -type 
d) | sort > pkg-plist

# You must also add any newly created directories to the packing list.
(cd /mnt/ad0s3/port_development/installtmp/$portname && find -d * -type d) | 
sort | comm -13 OLD-DIRS - | sort -r | sed -e 's#^#@dirrm #' >> pkg-plist

I edited pkg-plist manually afterwards, replaced dirrm with dirrmtry (again, 
clue comes from the emerald port).

The port is here:
ftp://hatvani.unideb.hu/pub/FreeBSD/ports/aquamarine.tar.gz

Is this a correct procedure?

Final question - I noticed these lines in the emerald Makefile:

CONFIGURE_TARGET=       --build=${ARCH}-portbld-freebsd${OSREL}
CONFIGURE_ARGS+=        --mandir="${PREFIX}/man"
CONFIGURE_ENV=  CPPFLAGS="-I${LOCALBASE}/include -I${X11BASE}/include" \
                LDFLAGS="-L${LOCALBASE}/lib -L${X11BASE}/lib ${PTHREAD_LIBS}"

Do I need those? Can you refer me to further readings to help me understand 
the meaning of these lines (and whether I need similar lines or 
not). --mandir I understand (aquamarine doesn't have any manpages, so I'm 
usre I don't need that) - but the rest I don't.

Thank you for your patience for reading this long post :)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702091451.56124.molnarcs>