Modifying exif port...

Hi, I'm new on FreeBSD and this is my first porting...so be patient :)

I would want to modify the exif port (I would add two new options).
I modified some source files (.c) of exif, using some external files .c and .h as libraries; I temporarily copy the content of these external files in an internal file of exif (utils.c) then I compile with make, but clearly this is not the correct approach.

My goal is to add these external files as libraries of exif....I make a .so file, but I don't know how to include this dependency in the makefile...so I think that a workaround could be to add the dependency in the 'overall' makefile of the port.
This is the original makefile of the port:

Code:
# Created by: Pav Lucistnik <pav@FreeBSD.org>
# $FreeBSD$

PORTNAME=    exif
PORTVERSION=    0.6.21
CATEGORIES=    graphics
MASTER_SITES=    SF/lib${PORTNAME}/${PORTNAME}/${PORTVERSION}

MAINTAINER=    sunpoet@FreeBSD.org
COMMENT=    Command line utility to read and manipulate EXIF data

LICENSE=    LGPL21
LICENSE_FILE=    ${WRKSRC}/COPYING

LIB_DEPENDS=    libexif.so:${PORTSDIR}/graphics/libexif \
        libpopt.so:${PORTSDIR}/devel/popt

OPTIONS_DEFINE=    NLS
OPTIONS_SUB=    yes

CONFIGURE_ENV = POPT_CFLAGS=-I${LOCALBASE}/include POPT_LIBS="-L${LOCALBASE}/lib -lpopt"
CPE_VENDOR=    curtis_galloway
GNU_CONFIGURE=    yes
USES=        cpe gmake localbase pkgconfig

NLS_CONFIGURE_ON=    --enable-nls ${ICONV_CONFIGURE_ARG}
NLS_CONFIGURE_OFF=    --disable-nls --without-libiconv-prefix
NLS_USES=        gettext iconv

.include <bsd.port.mk>

How I can modify this file? Suppose that my lib is: lib.so..could you help me?
 
I read Porter's Handbook: 5.8 Dependencies.
In the Makefile that I post above, there is this line:

Code:
LIB_DEPENDS=libexif.so:${PORTSDIR}/graphics/libexif

But I check, and libexif.so is is /usr/local/lib .... why?

Then I add this line to the Makefile, after the line above:

Code:
mylib.so:${PORTSDIR}7graphics/libexif

I don't really add this library in this directory, and I then
Code:
make fetch
make extract
cd /work/exif
./configure
make

And no errors occur....while the lib is not really present....I'm a little bit confused...

Therefore in that guide there isn't nothing related to CONFIGURE_ENV
 
Code:
LIB_DEPENDS=libexif.so:${PORTSDIR}/graphics/libexif
But I check, and libexif.so is is /usr/local/lib .... why?
${PORTSDIR} expands to /usr/ports so this line reads as this port depends on the libexif.so which is installed by the /usr/ports/graphics/libexif port.
 
No, it is not. Shared libraries are installed in some given directories and the linker is instructed with flags (see -L) where to look for them. So to cite from the Porter handbook, dependencies chapter linked above:
This variable specifies the shared libraries this port depends on. It is a list of lib:dir tuples where lib is the name of the shared library, dir is the directory in which to find it in case it is not available. For example,

LIB_DEPENDS= libjpeg.so:${PORTSDIR}/graphics/jpeg

will check for a shared jpeg library with any version, and descend into the graphics/jpeg subdirectory of the ports tree to build and install it if it is not found.
 
libexif.so is looked up by /usr/ports/Mk/Scripts/find-lib.sh which searches /lib,/usr/lib,/usr/local/lib plus every path in /usr/local/libdata/ldconfig/*.

This is done for you and you don't need to specify the full path to the library.
 
So, if I want to add a new library because my modified port depends on it, where I should put this library? For example, in /usr/lib directory?
And how I should modify the Makefile? Should I add a new tuple in LIB_DEPENDS? And what is the next step?
 
The correct way would be to create a new port for that library, and make your modified port have that as a dependecy.
 
Back
Top