Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Apr 2003 11:51:41 +0200
From:      Roman Neuhauser <neuhauser@bellavista.cz>
To:        freebsd-ports <freebsd-ports@freebsd.org>
Subject:   *_DEPENDS, and getting the wrong versions
Message-ID:  <20030422095141.GH13541@freepuppy.bellavista.cz>

next in thread | raw e-mail | index | archive | help
Hi there,

one of the headaches using ports gives me is that it requires too much
attention. Let me explain this. Think a port that can link in
libmysqlclient.so.1{0,2}, and will function the same with either of
them. Most ports today will

a) LIB_DEPENDS on one of them, meaning you'll have to hack the port
Makefile
b) let you choose, with a (arbitrary) default

Both options are a PITA when doing mass upgrades, or when you just
install something that has a decent amount of dependencies, which in
turn... Think Postfix, or PHP.

I'm proposing this "macro" to be put in bsd.port.mk:

GET_INSTALLED_LIBRARY=myLib=`${LDCONFIG} -r | ${GREP} -Fwe l${CHECKLIB} | \
			${SED} -E 's/^.+:-l${CHECKLIB}\.([[:digit:]]+) =>.+/\1/'`; \
			xLib=-1; for l in $${myLib}; do \
				if [ $${xLib} -lt $${l} ]; then xLib=$${l}; fi \
			done; \
			if [ -1 -eq $${xLib} ]; then xLib=${DEFLTVER}; fi; echo $${xLib}

example usage:

MYSQL_VERSION_LIB10=323
MYSQL_VERSION_LIB12=40
.if   defined(WITH_MYSQL323)
MYSQL_LIB_VERSION=10
.elif defined(WITH_MYSQL40)
MYSQL_LIB_VERSION=12
.elif defined(WITH_MYSQL)
CHECKLIB=mysqlclient
DEFLTVER=12
MYSQL_LIB_VERSION!=${GET_INSTALLED_LIBRARY}
.endif
LIB_DEPENDS+=mysqlclient.${MYSQL_LIB_VERSION}:${PORTSDIR}/databases/mysql${MYSQL_VERSION_LIB${MYSQL_LIB_VERSION}}-client
CONFIGURE_ARGS+=--with-mysql=${LOCALBASE}
.endif

It's more verbose, but will do the right thing whichever version the
user has installed (or even none), as opposed to thrashing their install
with another version.


-- 
If you cc me or remove the list(s) completely I'll most likely ignore
your message.    see http://www.eyrie.org./~eagle/faqs/questions.html



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