Bug 73691 - [patch] Add rc.subr routines to bsd.port.mk
Summary: [patch] Add rc.subr routines to bsd.port.mk
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Port Management Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-09 00:30 UTC by edwin
Modified: 2005-02-07 11:27 UTC (History)
0 users

See Also:


Attachments
file.diff (3.09 KB, patch)
2004-11-09 00:30 UTC, edwin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description edwin 2004-11-09 00:30:34 UTC
Since the implemenation of rc.subr, a lot of ports have adapted the
system and the quality of the startup/shutdown/status scripts have
increased. But a lot of duplicate code has grown into the ports
Makefiles to make sure that the startup scripts got installed
properly.

Look at the additional www/apache2 port overhead:

USE_RC_SUBR=            yes
RC_SCRIPTS_SUB= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR}
post-patch:
    @${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
	${FILESDIR}/apache.sh > ${WRKDIR}/apache2.sh
    .if !defined(WITH_APR_FROM_PORTS)
    @${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
	${FILESDIR}/apache2libs.sh > ${WRKDIR}/apache2libs.sh
    .endif

post-install:
.if !defined(WITH_APR_FROM_PORTS)
    @${ECHO_CMD} "Installing ${PREFIX}/etc/rc.d/000.apache2libs.sh startup script."
    @${INSTALL_SCRIPT} -m 751 ${WRKDIR}/apache2libs.sh ${PREFIX}/etc/rc.d/000.apache2libs.sh
.endif
    @${ECHO_CMD} "Installing ${PREFIX}/etc/rc.d/apache2.sh startup script."
    @${INSTALL_SCRIPT} -m 751 ${WRKDIR}/apache2.sh ${PREFIX}/etc/rc.d/apache2.sh


Imagine every port which uses rc.subr to have these identical
additional lines to it, that's not really making life easier to
maintain.

Imagine the following configuration:

	USE_RC_SUBR=	yes
	RC_FILES=	apache2.sh
	.if !defined(WITH_APR_FROM_PORTS)
	RC_FILES+=	apache2libs.sh
	.endif

And bsd.port.mk would automaticly do the patching, installation and
pkg-plist additions!

The patch attached is harmless for ports which don't use this new
system (since the trigger isn't USE_RC_SUBR but RC_FILES).

The patch does....

- It patches the files defined in RC_FILES with the variables defined
  in RC_SUBST (LOCALBASE, PREFIX, RC_SUBR, X11BASE by default).
- It installs the files defined in RC_FILES to PREFIX/etc/rc.d
- It adds the files defined in RC_FILES to the PKGPLIST.
Comment 1 edwin 2004-11-09 00:38:28 UTC
On Tue, Nov 09, 2004 at 11:20:28AM +1100, Edwin Groothuis wrote:
[...]

An more detailed description for the porters handbook will be
submitted when this patch is in the pipeline of being accepted.

-- 
Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin@mavetju.org    |          Weblog: http://weblog.barnet.com.au/edwin/
Comment 2 Pav Lucistnik freebsd_committer freebsd_triage 2004-11-09 23:49:39 UTC
Responsible Changed
From-To: freebsd-ports-bugs->portmgr

Over to port managers
Comment 3 Florent Thoumie 2004-12-02 02:17:01 UTC
I've done such a similar patch some months ago (ports/69217).

I don't know if mine is better or worse, that's just to avoid my PR
being kept open if this one is approved.
Comment 4 Kirill Ponomarev freebsd_committer freebsd_triage 2005-02-07 11:27:42 UTC
State Changed
From-To: open->closed

Committed, thanks!