Circuit Macros helper script
For some reason or another, I’m always installing the Circuit Macros package by Dwight Aplevich. The part that always takes the most time is going through and changing the definition for HOMELIB_ in each of the m4 files. So here’s a little script that does that for you automagically.
[perl]
#!/usr/bin/perl
# The directory that CircuitMacros was unzipped into (with trailing /)
$cdir = $ARGV[0];
# The directory that changed files should be sent to (with trailing /)
$outdir = $ARGV[1];
@m4files = < $cdir*.m4 >;
foreach $file (@m4files) {
$sanitizedfile = $file;
$sanitizedfile =~ s/$cdir//;
$cmd = ” sed ’s/\/u\/aplevich\/lib\//\/home\/wherever\/libs\//’ $file > $outdir$sanitizedfile”;
print “$cmd \n”;
system($cmd);
}
[/perl]
Possibly relevant posts:
- Downloading images (4/15/2005)
- Installing TeTeX latex packages (2/28/2005)
- User directory python package installation (3/21/2007)
Another way to do it is to create an M4 library file, (say) homelib.m4, in the directory pointed to by the M4PATH variable containing:
divert(-1)
define(`HOMELIB_’,`’)
divert(0)dnl
The first line immediately following .PS in the Circuit Macro file should then just include this homelib.m4 “library” file, e.g.:
.PS
include(homelib.m4)
…
…
.PE
Sweet! this will be easier to remember— once I look up divert(). Thanks.