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
.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
_______________________________________________ freebsd-ports@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-ports To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"