Commit graph

16 commits

Author SHA1 Message Date
jlam
3a4481535e SUBST_POSTCMD must be globally defined or else it breaks. 2004-08-23 16:37:09 +00:00
jlam
4a7c06b1a3 Actually, it's okay if SUBST_FILTER_CMD is empty... the ${SUBST_COOKIE}
target takes care of this case already.
2004-08-23 16:36:00 +00:00
jlam
12887cdd6a Use _SUBST_BACKUP_SUFFIX instead of hardcoding ".subst.sav" everywhere. 2004-08-23 16:35:11 +00:00
jlam
dd5015fc43 SUBST_FILTER_CMD can't be empty. It must be a real filter cmd, so default
it to ${CAT} as a fall-through.
2004-08-23 09:01:57 +00:00
schmonz
105997fbc4 Usually there's no need to keep the original version of a file
"foo" as "foo.subst.sav". Implement SUBST_POSTCMD, which by default
cleans up these leftovers. If you need to keep them around, e.g.
while debugging, set it to ${DO_NADA}.

Remove superfluous whitespace in a comment.
2004-06-06 04:22:23 +00:00
grant
23d5ff9ee1 Solaris' file(1) reports "executable [path] script" on scripts which
arent't shell scripts, so allow them to be subst'd.
2004-03-07 09:29:25 +00:00
uebayasi
560987a2c5 * Document SUBST_CLASSES.
* Indent conditionals.

Reviewed By:	wiz
2004-03-01 09:57:10 +00:00
kim
9f554b136c Reinstate the fix in revision 1.6 2003-12-29 02:55:22 +00:00
kim
03373c1334 Revert revision 1.5 as binaries and directories are now being substed
unintentionally.

Also revert revision 1.6 as part of the overall change, as I suspect
the change might be unnecessary.  While I'm not 100% sure, this does
just revert to the previous behaviour.
2003-12-28 17:28:26 +00:00
jmmv
f559aca387 The generated target is subst-<class>, not <class>-subst. Fix comment
accordingly.
2003-12-28 15:57:29 +00:00
grant
c331d66fa1 bomb to prevent silent failure if we're unable to rename a file
before subst'ing it.

previously, only a warning would be printed and the .subst_done
cookie(s) would be created, indicating that the subst target was
successful when it really was not.
2003-12-27 03:05:53 +00:00
grant
74f8aaa8f9 remove somewhat bogus test for text files, which was dependent on the
output of file(1) which reports too many false negatives (not
detecting a file as a text file when it really is).

package developers are aware of which files the subst operation
applies to, since they need to specify the filenames, so this test is
not really required.

it's also not inconceivable that one would want to subst over a
non-text file, which is now possible.
2003-12-27 03:02:11 +00:00
grant
f4677e4cb8 only print SUBST_MESSAGE if it's defined. 2003-12-11 00:05:36 +00:00
jlam
653a32a9bc Allow a new variable SUBST_FILTER_CMD.<class> that is a command filter or
pipeline that takes stdin, performs the substitions and writes the result
to stdout.  It defaults to ${SED} ${SUBST_SED.<class>}.  Use this variable
to replace the sed command with something else, like an awk process.
2003-10-07 10:19:09 +00:00
jlam
841b57441b Merge pkgviews-mk branch into the HEAD by running:
cd pkgsrc/mk
	cvs update -Pd -A
	cvs update -Pd -j pkgviews-mk-base -j pkgviews-mk
2003-09-02 06:59:37 +00:00
jlam
b81c512e4f subst.mk is a Makefile fragment that implements a general text replacement
facility for different classes of files in ${WRKSRC}.  For each class of
files, a target <class>-subst is created to perform the text replacement.

The following variables are used:

SUBST_STAGE.<class>
	"stage" at which we do the text replacement, e.g. pre-configure,
	post-build, etc.

SUBST_MESSAGE.<class>
	message to display, noting what is being substituted

SUBST_FILES.<class>
	files on which to run the substitution; these are relative to
	${WRKSRC}

SUBST_SED.<class>
	sed(1) substitution expression to run on the specified files

This basically extracts a useful piece of code from bsd.buildlink2.mk and
puts it in a place that allows it to be more widely used, and so that the
functionality doesn't depend on USE_BUILDLINK2 being defined.
2003-08-27 11:24:37 +00:00