ports/155406: Add a target to bsd.port.mk which hooks in the package install sequence

Ashish SHUKLA ashish at FreeBSD.org
Wed Mar 9 12:30:12 UTC 2011


>Number:         155406
>Category:       ports
>Synopsis:       Add a target to bsd.port.mk which hooks in the package install sequence
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 09 12:30:11 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Ashish SHUKLA
>Release:        FreeBSD 8.2-RELEASE amd64
>Organization:
The FreeBSD Project
>Environment:
System: FreeBSD chateau.d.if 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Thu Feb 17 02:41:51 UTC 2011 root at mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64


>Description:

I'm going to submit couple of 'haskell' ports. I've moved all of their common (or duplicate) functionality in a separate
Makefile, thus avoiding any duplicacy. All of these ports are supposed to execute some commands
post-installation. There are two ways to achieve this:

* pkg-install file. I could create a common pkg-install file, and place it in a master port directory which all of these
  'haskell' ports reference from there Makefile (PKGINSTALL variable) similar to dns/bind{96,97} ports. This approach is
  nice, but the problem is that common pkg-install makes harder to add individual changes for each port if needed.

* post-install-script target. I could implement "post-install-script" target in the common Makefile and then I can
  append @exec/@unexec tasks to the ${TMPPLIST}. This approach is nice, and allows ports to implement their own
  pkg-install as well for post-install tasks specific to the port. The only problem with this approach is that it gets
  executed before 'add-plist-info', 'add-plist-docs', etc. tasks, and the commands which I'm looking forward to execute
  relies on documentation files to be installed, via built-in PORTDOCS functionality (which is taken care by
  'add-plist-docs' target).

So, I'm proposing another hook target named 'post-add-script', same as 'post-install-script', but gets invoked after all
the 'add-*' targets (listed in _INSTALL_SUSEQ) are executed.

Thanks to Doug Barton, Eitan Adler, and PÁLI Gábor János for their inputs to this problem.

>How-To-Repeat:
>Fix:
--- /usr/ports/Mk/bsd.port.mk	2011-03-07 13:02:05.000000000 +0530
+++ ports/Mk/bsd.port.mk	2011-03-08 17:27:26.000000000 +0530
@@ -4431,8 +4431,8 @@
 				install-desktop-entries install-license \
 				post-install post-install-script add-plist-info \
 				add-plist-docs add-plist-examples add-plist-data \
-				add-plist-post install-rc-script compress-man \
-				install-ldconfig-file fake-pkg security-check
+				add-plist-post post-add-script install-rc-script \
+				compress-man install-ldconfig-file fake-pkg security-check
 _PACKAGE_DEP=	install
 _PACKAGE_SEQ=	package-message pre-package pre-package-script \
 				do-package post-package-script
@@ -4525,6 +4525,11 @@
 
 # Empty pre-* and post-* targets
 
+.if !target(post-add-script)
+post-add-script:
+		@${DO_NADA}
+.endif
+
 .for stage in pre post
 .for name in check-sanity fetch extract patch configure build install package
 
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list