From owner-freebsd-ports-bugs@FreeBSD.ORG Sat Jul 29 19:20:30 2006 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E0A0816A4E2 for ; Sat, 29 Jul 2006 19:20:30 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3ED0043D45 for ; Sat, 29 Jul 2006 19:20:30 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k6TJKU1v028768 for ; Sat, 29 Jul 2006 19:20:30 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k6TJKUG3028767; Sat, 29 Jul 2006 19:20:30 GMT (envelope-from gnats) Resent-Date: Sat, 29 Jul 2006 19:20:30 GMT Resent-Message-Id: <200607291920.k6TJKUG3028767@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Stanislav Sedov Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 217BB16A5B6 for ; Sat, 29 Jul 2006 19:15:02 +0000 (UTC) (envelope-from ssedov@mbsd.msk.ru) Received: from com1.ht-systems.ru (com1.ht-systems.ru [83.97.104.204]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1181743D46 for ; Sat, 29 Jul 2006 19:14:58 +0000 (GMT) (envelope-from ssedov@mbsd.msk.ru) Received: from [217.118.83.1] (helo=fonon.realnet) by com1.ht-systems.ru with esmtpa (Exim 4.62) (envelope-from ) id 1G6uOi-0008Mv-8C for FreeBSD-gnats-submit@freebsd.org; Sat, 29 Jul 2006 23:22:58 +0400 Received: by fonon.realnet (Postfix, from userid 1001) id F012A1208B; Sat, 29 Jul 2006 23:14:31 +0400 (MSD) Message-Id: <20060729191431.F012A1208B@fonon.realnet> Date: Sat, 29 Jul 2006 23:14:31 +0400 (MSD) From: Stanislav Sedov To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/101029: [PATCH] Mk: add include to support OCaml packages X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2006 19:20:31 -0000 >Number: 101029 >Category: ports >Synopsis: [PATCH] Mk: add include to support OCaml packages >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Jul 29 19:20:29 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Stanislav Sedov >Release: FreeBSD 7.0-CURRENT i386 >Organization: MBSD labs, Inc. >Environment: System: FreeBSD fonon.realnet 7.0-CURRENT FreeBSD 7.0-CURRENT #7: Sun Jun 18 20:51:36 MSD 2006 root@fonon.realnet:/work/src/fbsd-cur/src/sys/i386/compile/FONON i386 >Description: We have a lot of OCaml ports that provides additional language packages for OCaml language. Installing of such pacakge requites a lot of steps, e.g. running ocamlfind utility on install/deinstall with correct enviropment, updating OCaml-specific ld.conf on install/deinstall and other. As result ports become a bit complex and very large. You can see working examples in devel/ocaml-equeue, devel/ocaml-sem etc. This ports do similar work "by-hand" via pmake constructs and pkg-install script. This include simplifies creation on such ports. For example, the port for ocaml-xstr might look like this (this port isn't in ports collection yet): PORTNAME= xstr PORTVERSION= 0.2.1 CATEGORIES= devel MASTER_SITES= http://www.ocaml-programming.de/packages/ PKGNAMEPREFIX= ocaml- MAINTAINER= ssedov@mbsd.msk.ru COMMENT= Thread-safe implementation of string searching/matching WRKSRC= ${WRKDIR}/${PORTNAME} USE_GMAKE= yes USE_OCAML= yes USE_OCAML_FINDLIB= yes USE_OCAML_LDCONFIG= yes .include Simple, isn't it? Compare with ocaml-sem - it does the same steps. The include doesn't interfere with ports available, and sufficient for ocaml-* ports needs (hopely). >How-To-Repeat: >Fix: --- mk1.diff begins here --- diff -ruN Mk.orig/bsd.ocaml.mk Mk/bsd.ocaml.mk --- Mk.orig/bsd.ocaml.mk Thu Jan 1 03:00:00 1970 +++ Mk/bsd.ocaml.mk Sat Jul 29 22:55:46 2006 @@ -0,0 +1,144 @@ +# ex:ts=4 +# +# $MBSDlabs: portmk/bsd.ocaml.mk,v 1.14 2006/07/29 18:54:54 stas Exp $ +# $FreeBSD$ +# +# bsd.ocaml.mk - Support for the Objective Caml language packages +# +# Author: Stanislav Sedov +# +# Feel free to send any comments and suggestions to maintainer. +# +# Currently recognised variables are: +# +# USE_OCAML - Set if your port uses OCaml to build/install. +# NO_OCAML_BUILDDEPENDS - Don't add ocamlc to BUILD|EXTRACT|PATCH_DEPENDS. +# NO_OCAML_RUNDEPENDS - Don't add ocamlc to RUN_DEPENDS. +# USE_OCAML_FINDLIB - Set if your port uses ocamlfind to install +# packages. Package direcories will be +# automatically deleted. +# USE_OCAML_LDCONFIG - Set if your port installs shared libraries +# into ocaml site-lib dir. OCaml ld.conf file +# will be automatically processed. +# OCAML_PKGDIRS - Directories under site-lib to be processed +# if USE_OCAML_FINDLIB specified. +# Default: ${PORTNAME} +# OCAML_LDLIBS - Directories under PREFIX to be automatically +# added/removed from ld.conf +# Default: ${OCAML_SITELIBDIR}/${PORTNAME} + +.if !defined(OCAML_include) + +OCAML_MAINTAINER= ssedov@mbsd.msk.ru +OCAML_include= bsd.ocaml.mk + +# +# OCaml programs location +# +OCAMLC?= ${LOCALBASE}/bin/ocamlc +OCAMLC_OPT?= ${LOCALBASE}/bin/ocamlc.opt +OCAMLCP?= ${LOCALBASE}/bin/ocamlcp +OCAMLFIND?= ${LOCALBASE}/bin/ocamlfind + +# +# Where to install site libraries +# +OCAML_SITELIBDIR?= lib/ocaml/site-lib + +# +# OCaml compiler port dependency +# +OCAMLC_PORT?= ${PORTSDIR}/lang/ocaml +OCAMLC_DEPEND?= ${OCAMLC}:${OCAMLC_PORT} + +# +# OCaml package manager port dependency +# +OCAMLFIND_PORT?= ${PORTSDIR}/devel/ocaml-findlib +OCAMLFIND_DEPEND?= ${OCAMLFIND}:${OCAMLFIND_PORT} + +# +# Location of OCaml ld.conf file +# +OCAML_LDCONF?= lib/ocaml/ld.conf + +OCAMLFIND_DESTDIR?= ${PREFIX}/${OCAML_SITELIBDIR} +OCAMLFIND_LDCONF?= ${PREFIX}/${OCAML_LDCONF} + +.if defined(USE_OCAML) +. if !defined(NO_OCAML_BUILDDEPENDS) +EXTRACT_DEPENDS+= ${OCAMLC_DEPEND} +PATCH_DEPENDS+= ${OCAMLC_DEPEND} +BUILD_DEPENDS+= ${OCAMLC_DEPEND} +. endif +. if !defined(NO_OCAML_RUNDEPENDS) +RUN_DEPENDS+= ${OCAMLC_DEPEND} +. endif +PLIST_SUB+= OCAML_SITELIBDIR="${OCAML_SITELIBDIR}" +.endif + +.if defined(USE_OCAML_FINDLIB) || defined(USE_OCAML_LDCONFIG) +. if !target(post-install-script) +post-install-script: ocaml-findlib ocaml-ldconfig +. endif +.endif + +.if defined(USE_OCAML_FINDLIB) +# +# We'll additionally add ocamlfind to RUN_DEPENDS, since +# if the port requires ocamlfind to install - it requires +# some ocaml libraries and these libraries RUN_DEPENDS on +# ocamlfind +# +BUILD_DEPENDS+= ${OCAMLFIND_DEPEND} +RUN_DEPENDS+= ${OCAMLFIND_DEPEND} +MAKE_ENV+= OCAMLFIND_DESTDIR="${OCAMLFIND_DESTDIR}" \ + OCAMLFIND_LDCONF="${OCAMLFIND_LDCONF}" + +# +# Directories under site-lib to process automatically +# +OCAML_PKGDIRS?= ${PORTNAME} +. if !target(pre-install-script) +pre-install-script: +.if !exists(${OCAMLFIND_DESTDIR}) + @${MKDIR} "${PREFIX}/${OCAML_SITELIBDIR}" +.endif +. endif +. if !target(ocaml-findlib) +ocaml-findlib: +. for DIR in ${OCAML_PKGDIRS} + @${ECHO_CMD} "@unexec rmdir %D/${OCAML_SITELIBDIR}/${DIR} 2>/dev/null || true" >> ${TMPPLIST} + @${ECHO_CMD} "@unexec ${OCAMLFIND} remove ${DIR} 2>/dev/null" \ + >> ${TMPPLIST} +. endfor +. endif +.endif + +.if defined(USE_OCAML_LDCONFIG) +# +# Directories under PREFIX for appending to ld.conf +# +OCAML_LDLIBS?= ${OCAML_SITELIBDIR}/${PORTNAME} +. if !target(ocaml-ldconfig) +ocaml-ldconfig: +. for LIB in ${OCAML_LDLIBS} + @${ECHO_CMD} "${PREFIX}/${LIB}" >> "${PREFIX}/${OCAML_LDCONF}" + @${ECHO_CMD} "@exec ${ECHO_CMD} "%D/${LIB}" >> %D/${OCAML_LDCONF}" \ + >> ${TMPPLIST} + @${ECHO_CMD} "@unexec ${SED} -i \"\" -e '/${LIB:S#/#\/#g}/d' %D/${OCAML_LDCONF}" >> ${TMPPLIST} +. endfor +. endif +.endif + +.if !target(ocaml-findlib) +ocaml-findlib: + @${DO_NADA} +.endif + +.if !target(ocaml-ldconfig) +ocaml-ldconfig: + @${DO_NADA} +.endif + +.endif diff -ruN Mk.orig/bsd.port.mk Mk/bsd.port.mk --- Mk.orig/bsd.port.mk Sat Jul 29 23:01:03 2006 +++ Mk/bsd.port.mk Sat Jul 29 23:01:22 2006 @@ -408,6 +408,9 @@ # USE_JAVA - If set, this port relies on the Java language. # Implies inclusion of bsd.java.mk. (Also see # that file for more information on USE_JAVA_*). +# USE_OCAML - If set, this port relies on the OCaml language. +# Implies inclusion of bsd.ocaml.mk. (Also see +# that file for more information on USE_OCAML*). # USE_PYTHON - If set, this port relies on the Python language. # Implies inclusion of bsd.python.mk. (Also see # that file for more information on USE_PYTHON_* @@ -1418,6 +1421,10 @@ .if defined(USE_RUBY) || defined(USE_LIBRUBY) .include "${PORTSDIR}/Mk/bsd.ruby.mk" +.endif + +.if defined(USE_OCAML) +.include "${PORTSDIR}/Mk/bsd.ocaml.mk" .endif .if defined(USE_TCL) || defined(USE_TCL_BUILD) || defined(USE_TK) --- mk1.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: