From owner-freebsd-ports@FreeBSD.ORG Wed Jun 16 01:10:10 2010 Return-Path: Delivered-To: freebsd-ports@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3291C1065670 for ; Wed, 16 Jun 2010 01:10:10 +0000 (UTC) (envelope-from lioux@FreeBSD.org) Received: from goat.gigo.com (ipv6.gigo.com [IPv6:2001:470:1:18::2]) by mx1.freebsd.org (Postfix) with ESMTP id 1788B8FC0C for ; Wed, 16 Jun 2010 01:10:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by goat.gigo.com (Postfix) with ESMTP id 00B975C76 for ; Tue, 15 Jun 2010 18:10:10 -0700 (PDT) Received: from goat.gigo.com ([127.0.0.1]) by localhost (vette.gigo.com [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id qybpWDH5lx8q for ; Tue, 15 Jun 2010 18:10:09 -0700 (PDT) Received: from 200.181.39.91 (200-181-39-91.bsace702.dsl.brasiltelecom.net.br [200.181.39.91]) by goat.gigo.com (Postfix) with ESMTPSA id 229185C83 for ; Tue, 15 Jun 2010 18:10:09 -0700 (PDT) Received: (qmail 85769 invoked by uid 1001); 15 Jun 2010 22:09:57 -0300 Message-ID: <20100616010957.85686.qmail@exxodus.fedaykin.here> Date: Tue, 15 Jun 2010 22:09:57 -0300 From: Mario Sergio Fujikawa Ferreira To: freebsd-ports@FreeBSD.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="fUYQa+Pmc3FrFX/N" Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Cc: bytestore@yandex.ru Subject: RFC: Mk/bsd.jpeg.mk to automagically handle jpeg dependency X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jun 2010 01:10:10 -0000 --fUYQa+Pmc3FrFX/N Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, Ever since the addition of graphics/libjpeg-turbo, I had been wondering how one could possibly build the whole ports tree with it instead of graphics/jpeg. I wanted the choice. Therefore, I wrote the attached bsd.jpeg.mk as a suggestion. With it, we just add USE_JPEG= yes to any port that requires a jpeg library (either a build or a link dependency). It will automagically detected the already installed jpeg port variant (libjpeg-turbo or jpeg) and depend on it. If the user prefers to set the variant, he can do so using WITH_JPEG= jpeg or WITH_JPEG= libjpeg-turbo bsd.jpeg.mk will verify if the selected jpeg port WITH_JPEG conflicts with an already installed version. If it doesn't, it will be upheld. Otherwise, it will stop the build and tell the user that his setting might be incorrect. If a jpeg port has been neither installed nor selected WITH_JPEG, bsd.jpeg.mk will default to the reliable graphics/jpeg port. Therefore, unless instructed otherwise everything will depend upon graphics/jpeg. Only those systems that explicitly either install graphics/libjpeg-turbo instead of jpeg OR select WITH_JPEG=libjpeg-turbo will work differently. Let me know what you think. Regards, ps: bsd.jpeg.mk structure is heavily based on bsd.database.mk so thanks to everyone who contributed to it. -- Mario S F Ferreira - DF - Brazil - "I guess this is a signature." feature, n: a documented bug | bug, n: an undocumented feature --fUYQa+Pmc3FrFX/N Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="bsd.jpeg.mk" .if defined(USE_JPEG) # List of available jpeg ports _JPEG_PORTS= jpeg libjpeg-turbo # Dependence lines for different jpeg versions jpeg_DEPENDS= jpeg.11:${PORTSDIR}/graphics/jpeg libjpeg-turbo_DEPENDS= jpeg.62:${PORTSDIR}/graphics/libjpeg-turbo # Detect jpeg versions by finding some files jpeg_FIND= ${LOCALBASE}/include/jpegint.h libjpeg-turbo_FIND= ${LOCALBASE}/include/turbojpeg.h # Assume the default jpeg version as jpeg _DEFAULT_JPEG= jpeg # Try to uphold global WITH_JPEG # . if defined(WITH_JPEG) _WITH_JPEG= ${WITH_JPEG} . endif # Detect jpeg port _JPEG_PORT= no # Detect installed version # . for jpegx in ${_JPEG_PORTS} . if exists(${${jpegx}_FIND}) && ${_JPEG_PORT} == "no" _JPEG_PORT= ${jpegx} . endif . endfor # If a library has been neither installed nor selected, defer to # the default one. # . if !defined(_WITH_JPEG) && ${_JPEG_PORT} == "no" _WITH_JPEG= ${_DEFAULT_JPEG} . endif # If one has been selected, verify it that the selection both is # correct and does not conflict with the installed one. # . if defined(_WITH_JPEG) . if ${_JPEG_PORT} == "no" # Use selected version if none has already been installed . for jpeg in ${_JPEG_PORTS} . if ${_WITH_JPEG} == "${jpeg}" && ${_JPEG_PORT} == "no" _JPEG_PORT= ${jpeg} . endif . endfor . else # Verify if installed version and selected version conflict . if ${_WITH_JPEG} != ${_JPEG_PORT} IGNORE= cannot install: selected library ${_WITH_JPEG} conflict with installed ${_JPEG_PORT} one . endif . endif . endif # WITH_JPEG is specified incorrectly, so mark this as IGNORE # . if ${_JPEG_PORT} == "no" IGNORE= cannot install: unknown jpeg library selected: ${_WITH_JPEG} . else # Now add the dependency on JPEG port ${_JPEG_PORT) . if defined(JPEG_BUILD_DEPENDS) BUILD_DEPENDS+= ${${_JPEG_PORT}_FIND}:${${_JPEG_PORT}_DEPENDS:C/^jpeg.*://} . else LIB_DEPENDS+= ${${_JPEG_PORT}_DEPENDS} . endif JPEG_LIB_NAME= jpeg JPEG_INCLUDE_DIR= ${LOCALBASE}/include JPEG_LIB_DIR= ${LOCALBASE}/lib JPEG_PORT= ${_JPEG_PORT} . endif .endif --fUYQa+Pmc3FrFX/N--