From owner-freebsd-ports@FreeBSD.ORG Tue Apr 22 02:51:43 2003 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 70ADA37B401 for ; Tue, 22 Apr 2003 02:51:43 -0700 (PDT) Received: from mail.bellavista.cz (mail.bellavista.cz [213.235.167.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6EFBC43FE0 for ; Tue, 22 Apr 2003 02:51:42 -0700 (PDT) (envelope-from neuhauser@bellavista.cz) Received: from freepuppy.bellavista.cz (freepuppy.bellavista.cz [10.0.0.10]) by mail.bellavista.cz (Postfix) with ESMTP id 69E55349 for ; Tue, 22 Apr 2003 11:51:41 +0200 (CEST) Received: by freepuppy.bellavista.cz (Postfix, from userid 1001) id 0CB562FDBA7; Tue, 22 Apr 2003 11:51:41 +0200 (CEST) Date: Tue, 22 Apr 2003 11:51:41 +0200 From: Roman Neuhauser To: freebsd-ports Message-ID: <20030422095141.GH13541@freepuppy.bellavista.cz> Mail-Followup-To: freebsd-ports Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.1i Subject: *_DEPENDS, and getting the wrong versions X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Apr 2003 09:51:43 -0000 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