mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
afe522b1f6
New files: development/cmake/doc/ReplaceValues.pl perl-script to substitute words (defined in the cmd-line) with their actual values development/cmake/doc/CMakefiles.txt convert and install files .lyx and .txt-files from the lib/doc-directory development/cmake/src/client/CMakeLists.txt create and install lyxclient Changed: development/cmake/Install.cmake include the new doc-directory remove installation of .lyx from the doc-directory. Will be installed in development/cmake/doc/CMakefiles.txt development/cmake/Install.cmake changed macro lyx_install() to not insert '.' into the globbing-expression automatically. We need sometimes also dotless files. development/cmake/src/CMakefiles.txt Added subdirectory client to create and install lyxclient on unix-like systems git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27978 a592a061-630c-0410-9148-cb99ea01b6c8
43 lines
831 B
Perl
43 lines
831 B
Perl
#! /usr/bin/env perl
|
|
|
|
use strict;
|
|
|
|
# Syntax: ReplaceValues.pl [<var1>=<Subst1> [<var2>=<Subst> ...]] <Inputfile> [<Inputfile> ...]
|
|
|
|
|
|
# Parse Arguments for strings to substitute
|
|
|
|
my %Subst = ();
|
|
|
|
for my $arg (@ARGV) {
|
|
if ($arg =~ /^([^=]+)=(.*)$/) {
|
|
$Subst{$1} = $2;
|
|
}
|
|
else {
|
|
# $arg should be filename here
|
|
&SubstituteDataInFile($arg);
|
|
}
|
|
}
|
|
|
|
exit(0);
|
|
|
|
#################################################################
|
|
sub SubstituteDataInFile($)
|
|
{ my ($InFile) = @_;
|
|
open(FI, '<', $InFile) || die("Could not read \"$InFile\"");
|
|
while (my $l = <FI>) {
|
|
print &SubstituteDataInLine($l);
|
|
}
|
|
close(FI);
|
|
}
|
|
|
|
sub SubstituteDataInLine($)
|
|
{my ($line) = @_;
|
|
my $result = $line;
|
|
for my $k (keys %Subst) {
|
|
while ($result =~ s/\b$k\b/$Subst{$k}/) {
|
|
}
|
|
}
|
|
return($result);
|
|
}
|