summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2009-03-27 23:50:30 +0000
committerChris Wilson <chris+github@qwirx.com>2009-03-27 23:50:30 +0000
commit145d4f8dcec5d5cf98856b88fd92c600a5d96e89 (patch)
tree2114b8ade842897d4419cf2565030d0997a7a635
parentb3147950c3459f1f68c3ab630c38172250ee226d (diff)
Allow substitutions and removing private sections for distribution in
.in files. Simplify code a little and improve comments.
-rwxr-xr-xinfrastructure/makedistribution.pl.in53
1 files changed, 28 insertions, 25 deletions
diff --git a/infrastructure/makedistribution.pl.in b/infrastructure/makedistribution.pl.in
index 32566eb2..58c71fd5 100755
--- a/infrastructure/makedistribution.pl.in
+++ b/infrastructure/makedistribution.pl.in
@@ -7,7 +7,9 @@ use Symbol;
my %comment_chars = ('cpp' => '// ', 'h' => '// ', 'pl' => '# ', 'pm' => '# ', '' => '# ');
# other extensions which need text copying, just to remove the private stuff
-my %text_files = ('txt' => 1, 'spec' => 1);
+# .in is included here, as these could be any kind of source, but clearly
+# they have text substitutions run on them by autoconf, so we can too :)
+my %text_files = ('txt' => 1, 'spec' => 1, 'in' => 1);
# files which don't get the license added
my %no_license = (); # 'filename' => 1
@@ -189,9 +191,9 @@ sub copy_file
# licensed or not?
if(exists $comment_chars{$ext} && !exists $no_license{$fn} && $license_in_dir)
{
- my $b = $comment_chars{$ext};
-
# copy as text, inserting license
+ # print "source copy $fn to $base_name/$dst_fn\n";
+
my $in = gensym;
open $in,$fn;
open OUT,">$base_name/$dst_fn";
@@ -204,6 +206,7 @@ sub copy_file
}
# write license
+ my $b = $comment_chars{$ext};
for(@license)
{
print OUT $b,$_,"\n"
@@ -225,31 +228,31 @@ sub copy_file
close OUT;
close $in;
}
- else
+ elsif(exists $text_files{$ext})
{
- if(exists $text_files{$ext})
- {
- # copy this as text, to remove private stuff
- my $in = gensym;
- open $in,$fn;
- open OUT,">$base_name/$dst_fn";
+ # copy this as text, to remove private stuff
+ # print "text copy $fn to $base_name/$dst_fn\n";
- while(<$in>)
- {
- unless(skip_non_applicable_section($_, $in, $fn))
- {
- print OUT
- }
- }
-
- close OUT;
- close $in;
- }
- else
+ my $in = gensym;
+ open $in,$fn;
+ open OUT,">$base_name/$dst_fn";
+
+ while(<$in>)
{
- # copy as binary
- system 'cp',$fn,"$base_name/$dst_fn"
- }
+ unless(skip_non_applicable_section($_, $in, $fn))
+ {
+ print OUT
+ }
+ }
+
+ close OUT;
+ close $in;
+ }
+ else
+ {
+ # copy as binary
+ # print "binary copy $fn to $base_name/$dst_fn\n";
+ system 'cp',$fn,"$base_name/$dst_fn"
}
# copy executable bit from src