*_DEPENDS, and getting the wrong versions

Roman Neuhauser neuhauser at bellavista.cz
Tue Apr 22 02:51:43 PDT 2003


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


More information about the freebsd-ports mailing list