summaryrefslogtreecommitdiff
path: root/gnu/lib/libg++/libg++2netbsd
blob: a9611c6aecd8b13f2f0ecab7ee355a37efbaa95e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
#!/usr/local/bin/perl
#
#	$NetBSD: libg++2netbsd,v 1.24 1998/02/26 02:26:27 jonathan Exp $
#
#  Perl script to convert a standard distribution directory for libg++ into
#	a NetBSD source tree.
#
#  This is done as a script so that as each distribution is released,
#	only changes from the previous one need to be dealt with as
#	modifications to this script and related files.  This should
#	reduce the cost of updating from a new release of libg++ by an
#	order of magnitude (or more?)
#
#  Written by Phil Nelson,  December 13, 1995.  (for libg++-2.7.1)
#  Updated for libg++-2.7.2 by Chris Demetriou, September 13, 1996.
#

$version = "2.7.2";
$srcdir = $ENV{'SRCDIR'};
if (!$srcdir) { $srcdir = "libg++-$version" };
$targetdir = "libg++";

# definitions ...

@subdirs = ("include", "include/gen", "libg++", "libg++/genclass",
	    "libg++/src", "libio", "libiostream", "librx", "libstdc++",
	    "libstdc++/std", "libstdc++/stl");

@gf = ("ACG.cc", "AllocRing.cc", "Binomial.cc", "BitSet.cc",
       "BitString.cc", "CursesW.cc", "DLList.cc", "DiscUnif.cc",
       "Erlang.cc", "Fix.cc", "Fix16.cc", "Fix24.cc", "Geom.cc",
       "GetOpt.cc", "HypGeom.cc", "Intdouble.cc", "Integer.cc",
       "LogNorm.cc", "MLCG.cc", "NegExp.cc", "Normal.cc",
       "Obstack.cc", "Poisson.cc", "RNG.cc", "Random.cc",
       "Rational.cc", "Regex.cc", "RndInt.cc", "SLList.cc",
       "SmplHist.cc", "SmplStat.cc", "String.cc", "Uniform.cc",
       "Weibull.cc", "bitand.c", "bitany.c", "bitblt.c", "bitclear.c",
       "bitcopy.c", "bitcount.c", "bitinvert.c", "bitlcomp.c",
       "bitset1.c", "bitxor.c", "builtin.cc", "compare.cc",
       "error.cc", "fmtq.cc", "gcd.cc", "hash.cc", "ioob.cc", "lg.cc",
       "pow.cc", "sqrt.cc", "timer.c");

@gh = ("ACG.h", "AllocRing.h", "Binomial.h", "BitSet.h",
       "BitString.h", "Complex.h", "CursesW.h", "DLList.h",
       "DiscUnif.h", "Erlang.h", "Fix.h", "Fix16.h", "Fix24.h",
       "Geom.h", "GetOpt.h", "HypGeom.h", "Incremental.h",
       "Integer.h", "Integer.hP", "LogNorm.h", "MLCG.h", "NegExp.h",
       "Normal.h", "Obstack.h", "Pix.h", "Poisson.h", "RNG.h",
       "Random.h", "Rational.h", "Regex.h", "RndInt.h", "SLList.h",
       "SmplHist.h", "SmplStat.h", "String.h", "Uniform.h",
       "Weibull.h", "bitdo1.h", "bitdo2.h", "bitprims.h", "bool.h",
       "builtin.h", "compare.h", "generic.h", "getpagesize.h",
       "libc.h", "minmax.h", "osfcn.h", "std.h", "strclass.h",
       "swap.h", "sysent.h", "typemacros.h" );

@iosf = ("PlotFile.cc", "SFile.cc", "builtinbuf.cc", "editbuf.cc",
        "filebuf.cc", "fstream.cc", "indstream.cc", "ioassign.cc",
        "ioextend.cc", "iomanip.cc", "iostream.cc", "isgetline.cc",
        "isgetsb.cc", "isscan.cc", "osform.cc", "parsestream.cc",
        "pfstream.cc", "procbuf.cc", "sbform.cc", "sbgetline.cc",
        "sbscan.cc", "stdiostream.cc", "stdstrbufs.cc",
        "stdstreams.cc", "stream.cc", "streambuf.cc", "strstream.cc",
        "cleanup.c", "filedoalloc.c", "fileops.c", "floatconv.c",
        "genops.c", "iofclose.c", "iofgetpos.c", "iofread.c",
        "iofscanf.c", "iofsetpos.c", "iogetdelim.c", "iogetline.c",
        "ioignore.c", "iopadn.c", "iopopen.c", "ioprims.c",
        "ioprintf.c", "ioseekoff.c", "ioseekpos.c", "iostrerror.c",
        "ioungetc.c", "iovfprintf.c", "iovfscanf.c", "outfloat.c",
        "strops.c", );

@iosh = ("PlotFile.h", "SFile.h", "builtinbuf.h",
        "editbuf.h", "floatio.h", "fstream.h", "indstream.h",
        "iolibio.h", "iomanip.h", "iostdio.h", "iostream.h",
        "iostreamP.h", "istream.h", "libio.h", "libioP.h",
        "ostream.h", "parsestream.h", "pfstream.h", "procbuf.h",
        "stdiostream.h", "stream.h", "streambuf.h", "strfile.h",
        "strstream.h" );

@iof = ("chr.cc", "cleanup.c", "filedoalloc.c", "fileops.c", "floatconv.c",
	"genops.c", "iofclose.c", "iofdopen.c", "iofflush.c",
	"iofgetpos.c", "iofgets.c", "iofopen.c", "iofprintf.c",
	"iofputs.c", "iofread.c", "iofscanf.c", "iofsetpos.c",
	"ioftell.c", "iofwrite.c", "iogetdelim.c", "iogetline.c",
	"iogets.c", "ioignore.c", "iopadn.c", "ioperror.c",
	"iopopen.c", "ioprims.c", "ioprintf.c", "ioputs.c",
	"ioscanf.c", "ioseekoff.c", "ioseekpos.c", "iosetbuffer.c",
	"iosetvbuf.c", "iosprintf.c", "iosscanf.c", "iostrerror.c",
	"ioungetc.c", "iovfprintf.c", "iovfscanf.c", "iovsprintf.c",
	"iovsscanf.c", "outfloat.c", "str.cc", "stdfiles.c", "strops.c");

@iocf = ("iofdopen.c", "iofflush.c", "iofgets.c", "iofopen.c",
	"iofprintf.c", "iofputs.c", "ioftell.c", "iofwrite.c",
	"iogets.c", "ioperror.c", "ioputs.c", "ioscanf.c",
	"iosetbuffer.c", "iosetvbuf.c", "iosprintf.c", "iosscanf.c",
	"iovsprintf.c", "iovsscanf.c", "stdfiles.c");

@genclf = ("genclass.sh");

@genf = ("AVLMap.ccP", "AVLMap.hP", "AVLSet.ccP", "AVLSet.hP",
         "AVec.ccP", "AVec.hP", "BSTSet.ccP", "BSTSet.hP", "Bag.ccP",
         "Bag.hP", "CHBag.ccP", "CHBag.hP", "CHMap.ccP", "CHMap.hP",
         "CHNode.ccP", "CHNode.hP", "CHSet.ccP", "CHSet.hP",
         "DLDeque.ccP", "DLDeque.hP", "DLList.ccP", "DLList.hP",
         "Deque.ccP", "Deque.hP", "FPQueue.ccP", "FPQueue.hP",
         "FPStack.ccP", "FPStack.hP", "FPlex.ccP", "FPlex.hP",
         "List.ccP", "List.hP", "MPlex.ccP", "MPlex.hP", "Map.ccP",
         "Map.hP", "OSLBag.ccP", "OSLBag.hP", "OSLSet.ccP",
         "OSLSet.hP", "OXPBag.ccP", "OXPBag.hP", "OXPSet.ccP",
         "OXPSet.hP", "PHPQ.ccP", "PHPQ.hP", "PQ.ccP", "PQ.hP",
         "PSList.hP", "PVec.hP", "Plex.ccP", "Plex.hP", "Queue.ccP",
         "Queue.hP", "RAVLMap.ccP", "RAVLMap.hP", "RPlex.ccP",
         "RPlex.hP", "SLBag.ccP", "SLBag.hP", "SLList.ccP",
         "SLList.hP", "SLQueue.ccP", "SLQueue.hP", "SLSet.ccP",
         "SLSet.hP", "SLStack.ccP", "SLStack.hP", "Set.ccP", "Set.hP",
         "SkipBag.ccP", "SkipBag.hP", "SkipMap.ccP", "SkipMap.hP",
         "SkipSet.ccP", "SkipSet.hP", "SplayBag.ccP", "SplayBag.hP",
         "SplayMap.ccP", "SplayMap.hP", "SplayNode.ccP",
         "SplayNode.hP", "SplayPQ.ccP", "SplayPQ.hP", "SplaySet.ccP",
         "SplaySet.hP", "Stack.ccP", "Stack.hP", "VHBag.ccP",
         "VHBag.hP", "VHMap.ccP", "VHMap.hP", "VHSet.ccP", "VHSet.hP",
         "VOHSet.ccP", "VOHSet.hP", "VQueue.ccP", "VQueue.hP",
         "VStack.ccP", "VStack.hP", "Vec.ccP", "Vec.hP", "XPBag.ccP",
         "XPBag.hP", "XPDeque.ccP", "XPDeque.hP", "XPPQ.ccP",
         "XPPQ.hP", "XPQueue.ccP", "XPQueue.hP", "XPSet.ccP",
         "XPSet.hP", "XPStack.ccP", "XPStack.hP", "XPlex.ccP",
         "XPlex.hP", "defs.hP", "intSList.hP", "intVec.hP" );

@lstdcf =("cmathi.cc", "cstdlibi.cc", "cstringi.cc", "exceptioni.cc",
	  "newi.cc", "stddefi.cc", "stdexcepti.cc", "typeinfoi.cc");

@lstdcf2 = ("cstrmain.cc", "cstrio.cc", "fcomplex.cc", "fcomio.cc",
	    "dcomplex.cc", "dcomio.cc", "ldcomplex.cc", "ldcomio.cc");

@lstdcof =("algorithm", "cassert", "cctype", "cerrno", "cfloat",
	   "ciso646", "climits", "clocale", "cmath", "complex",
	   "complex.h", "csetjmp", "csignal", "cstdarg", "cstddef",
	   "cstdio", "cstdlib", "cstring", "ctime", "cwchar",
	   "cwctype", "deque", "exception", "functional", "iterator",
	   "list", "map", "memory", "new", "new.h", "numeric",
	   "queue", "set", "stack", "stddef", "stdexcept", "stl.h",
	   "string", "typeinfo", "utility", "vector", "cinst.cc",
	   "sinst.cc" );

@rxf = ("rx.c");

@rxof = ("rx.h");

@stdf = ("bastring.cc",  "complext.cc");

@stdof = ("bastring.h", "cassert.h", "cctype.h", "cerrno.h",
	  "cfloat.h", "cinst.h", "ciso646.h", "climits.h",
	  "clocale.h", "cmath.h", "complex.h", "complext.h",
	  "csetjmp.h", "csignal.h", "cstdarg.h", "cstddef.h",
	  "cstdio.h", "cstdlib.h", "cstring.h", "ctime.h", "cwchar.h",
	  "cwctype.h", "dcomplex.h", "exception.h", "fcomplex.h",
	  "ldcomplex.h", "new.h", "sinst.h", "stddef.h",
	  "stdexcept.h", "straits.h", "string.h", "typeinfo.h" );

@stlf = ("random.cc", "tempbuf.cc", "tree.cc");

@stlof = ("algo.h", "algobase.h", "bvector.h", "defalloc.h",
	 "deque.h", "faralloc.h", "fdeque.h", "flist.h", "fmap.h",
	 "fmultmap.h", "fmultset.h", "fset.h", "function.h", "hdeque.h",
	 "heap.h", "hlist.h", "hmap.h", "hmultmap.h", "hmultset.h",
	 "hset.h", "hugalloc.h", "hvector.h", "iterator.h", "lbvector.h",
	 "ldeque.h", "list.h", "llist.h", "lmap.h", "lmultmap.h",
	 "lmultset.h", "lngalloc.h", "lset.h", "map.h", "multimap.h",
	 "multiset.h", "neralloc.h", "nmap.h", "nmultmap.h", "nmultset.h",
	 "nset.h", "pair.h", "projectn.h", "set.h", "stack.h", "tempbuf.h",
	 "tree.h", "vector.h");

# sed edit list: file, sed-program
@sedlist = (
    "libg++/genclass/genclass.sh", "'s/<VERSION>/$version/g'",
    "libg++/genclass/genclass.sh",
	    "'s/^PROTODIR=.*\$/PROTODIR=\\/usr\\/include\\/g++\\/gen/g'");

#
# Utility Subroutines
#

# &copyfiles (fromdir, todir, list of files);
sub copyfiles {
    local ($fdir, $tdir, @list) = @_;
    local ($f);

    foreach $f (@list) {
	print "  $fdir/$f --> $tdir/$f\n";
	system ("cp -p $fdir/$f $tdir/$f");
    }
}

sub dumpsrcs {
    local (@names) = @_;
    local ($count);

    print ODATA "SRCS=\t";
    $count = 0;
    foreach $f (@names) {
        print ODATA "$f ";
	if ($count == 5) {
	    print ODATA "\\\n";
	    $count = 0;
	} else {
	    $count += 1;
	}
    }
    if ($count != 0) {
	print ODATA "\n";
    }
}

#  Following functions written by Christos Zoulas, January 15, 1996.

sub dumparray {
    local (@names) = @_;

    foreach $f (@names) {
	print ODATA "$f ";
    }
}

sub dumpfrag {
    @cstrmain = ("REP", "MAIN", "TRAITS", "ADDSS", "ADDPS", "ADDCS", "ADDSP",
		 "ADDSC", "EQSS", "EQPS", "EQSP", "NESS", "NEPS", "NESP",
		 "LTSS", "LTPS", "LTSP", "GTSS", "GTPS", "GTSP", "LESS",
		 "LEPS", "LESP", "GESS", "GEPS", "GESP");

    @complex = ("MAIN", "ADDCC", "ADDCF", "ADDFC", "SUBCC", "SUBCF", "SUBFC",
		"MULCC", "MULCF", "MULFC", "DIVCC", "DIVCF", "DIVFC", "PLUS",
		"MINUS", "EQCC", "EQCF", "EQFC", "NECC", "NECF", "NEFC", "ABS",
		"ARG", "POLAR", "CONJ", "NORM", "COS", "COSH", "EXP", "LOG", 
		"POWCC", "POWCF", "POWCI", "POWFC", "SIN", "SINH", "SQRT");

    @cstrio = ("EXTRACT", "INSERT", "GETLINE");

    @comio = ("EXTRACT", "INSERT");

    %prefix = ("ld", "LD", "d", "D", "f", "F");

    print "  Dumping frags\n";

    foreach $f (@lstdcf2) {
	print ODATA "$f: Makefile\n";
	print ODATA "\t\@echo Creating $f\n";
	print ODATA "\t@(for i in ";
	if ($f eq "cstrmain.cc") {
		&dumparray(@cstrmain);
		$inc = "sinst.cc";
		$fl = "C";
	} 
	elsif ($f eq "cstrio.cc") {
		&dumparray(@cstrio);
		$inc = "sinst.cc";
		$fl = "C";
	} 
	elsif ($f =~ /(.*)complex\.cc/) {
		$fl = $prefix{$1};
		&dumparray(@complex);
		$inc = "cinst.cc";
	}
	elsif ($f =~ /(.*)comio\.cc/) {
		$fl = $prefix{$1};
		&dumparray(@comio);
		$inc = "cinst.cc";
	}
	else {
		die "Unknown target type $f";
	}
	print ODATA "; do \\\n";
	print ODATA "\t\techo \"#define \$\$i\"; \\\n";
	print ODATA "\t\tdone;\\\n";
	print ODATA "\techo '#define $fl';\\\n";
	print ODATA "\tcat \$(.CURDIR)/$inc) > \$(.TARGET)";
	print ODATA "\nCLEANFILES+=$f\n\n";
    }
}

sub dumprtti {
    local (@name) = @_;

    print "  Dumping rtti for @name\n";

    print ODATA "@name.o: @name.cc\n";
    print ODATA "\t\@echo \"\$(COMPILE.cc) -frtti \$(.IMPSRC)\"\n";
    print ODATA "\t\@\$(COMPILE.cc) -frtti \$(.IMPSRC) -o \$(.TARGET).o\n";
    print ODATA "\t\@\$(LD) -x -r \$(.TARGET).o -o \$(.TARGET)\n";
    print ODATA "\t\@rm -f \$(.TARGET).o\n";
    print ODATA "\n";

    print ODATA "@name.po: @name.cc\n";
    print ODATA "\t\@echo \"\$(COMPILE.cc) -p -frtti \$(.IMPSRC) -o \$(.TARGET)\"\n";
    print ODATA "\t\@\$(COMPILE.cc) -p -frtti \$(.IMPSRC) -o \$(.TARGET).o\n";
    print ODATA "\t\@\$(LD) -X -r \$(.TARGET).o -o \$(.TARGET)\n";
    print ODATA "\t\@rm -f \$(.TARGET).o\n";
    print ODATA "\n";

    print ODATA "@name.so: @name.cc\n";
    print ODATA "\t\@echo \"\$(COMPILE.cc) \$(CPICFLAGS) -frtti \$(.IMPSRC) -o \$(.TARGET)\"\n";
    print ODATA "\t\@\$(COMPILE.cc) \$(CPICFLAGS) -frtti \$(.IMPSRC) -o \$(.TARGET).o\n";
    print ODATA "\t\@\$(LD) -x -r \$(.TARGET).o -o \$(.TARGET)\n";
    print ODATA "\t\@rm -f \$(.TARGET).o\n";
    print ODATA "\n";
}

#
# Main progarm.
# 

if (!$srcdir) {
    die "You must define the environment variables SRCDIR.\n"
} 
print "Making the NetBSD directory tree.\n";
mkdir ($targetdir,0777);
foreach $f (@subdirs) { 
    print "   -->$f\n";
    mkdir ("$targetdir/$f",0777);
}

print "Populating $targetdir.\n";
&copyfiles ($srcdir, $targetdir, "COPYING");

print "Populating $targetdir/libg++/src\n";
&copyfiles ("$srcdir/libg++/src", "$targetdir/libg++/src", @gf, @gh);
# Special file needed.
&copyfiles ("$srcdir/librx", "$targetdir/libg++/src", "rx.h");

print "Populating $targetdir/libg++/genclass\n";
&copyfiles ("$srcdir/libg++/genclass", "$targetdir/libg++/genclass", @genclf);

print "Populating $targetdir/libio\n";
&copyfiles ("$srcdir/libio", "$targetdir/libio", @iocf, @iosf, @iosh);

print "Populating $targetdir/include/gen\n";
&copyfiles ("$srcdir/libg++/src/gen", "$targetdir/include/gen", @genf);

print "Populating $targetdir/librx\n";
&copyfiles ("$srcdir/librx", "$targetdir/librx", @rxf, @rxof);

print "Populating $targetdir/libstdc++\n";
&copyfiles ("$srcdir/libstdc++", "$targetdir/libstdc++", @lstdcf, @lstdcof);

print "Populating $targetdir/libstdc++/std\n";
&copyfiles ("$srcdir/libstdc++/std", "$targetdir/libstdc++/std",
	    @stdf, @stdof);

print "Populating $targetdir/libstdc++/stl\n";
&copyfiles ("$srcdir/libstdc++/stl", "$targetdir/libstdc++/stl",
	    @stlf, @stlof);

#
# Build makefiles
#

$first = "True";
while ($line = <DATA>) {
    chop ($line);
    if (substr($line,0,2) eq "%%") {
	@cmd = split (/ /,$line);
	if ($cmd[1] eq "file") {
	    print "Building $targetdir/$cmd[2]\n";
	    if ($first eq "") {
		close (ODATA);
	    } else {
		$first = "";
	    }
	    open (ODATA, ">$targetdir/$cmd[2]") ||
		die "Could now create $targetdir/$cmd[2]";
	} elsif ($cmd[1] eq "srcs") {
	    print "  Defining SRCS for $cmd[2]\n";
	    if ($first) {
		die "Data section must start with a %% file!";
	    }
	    if ($cmd[2] eq "libg++") {
		&dumpsrcs (@gf);
	    } elsif ($cmd[2] eq "genclass") {
		&dumpsrcs (@genclf);
	    } elsif ($cmd[2] eq "iostream") {
		&dumpsrcs (@iosf);
	    } elsif ($cmd[2] eq "io") {
		&dumpsrcs (@iof);
	    } elsif ($cmd[2] eq "stdc++") {
		&dumpsrcs (@iosf, @lstdcf, @lstdcf2, @stlf, @rxf);
	    } else {
		die "Unknown SRCS command";
	    }
	} elsif ($cmd[1] eq "rtti") {
	    &dumprtti($cmd[2]);
	} elsif ($cmd[1] eq "frag") {
	    &dumpfrag();
	} elsif ($cmd[1] eq "NetBSD") {
	    if ($first) {
		die "Data section must start with a %% file!";
	    }
	    print ODATA "#	\$"."NetBSD".": \$\n";
	}
    } else {
	if ($first) {
	    die "Data section must start with a %% file!";
	}
	print ODATA "$line\n";
    }
}    
close (ODATA);

#
# Sed transformations of files
#

for ($i=0; $i<@sedlist; $i+=2) {
    $f = $sedlist[$i];
    $p = $sedlist[$i+1];
    print "Modifying $f\n";
    system ("cd $targetdir; sed $p $f > tmp;  mv -f tmp $f");
}

#
# end of the script
#

# what follows is the data for makefiles and other special files
# that need to be created.

__END__
%% file Makefile
%% NetBSD

SUBDIR= libg++ libstdc++ # libio libiostream

HEADERS= cassert cctype cerrno cfloat ciso646 climits clocale cmath complex \
         csetjmp csignal cstdarg cstddef cstdio cstdlib cstring ctime \
         cwchar cwctype new stddef string exception stdexcept typeinfo \
         algorithm deque list map queue set stack vector utility functional \
         iterator memory numeric


includes:
	@echo installing includes from libg++/src
	@(cd libg++/src ; for j in *.[ih]; do \
		cmp -s $$j ${DESTDIR}/usr/include/g++/$$j || \
		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 $$j \
			${DESTDIR}/usr/include/g++/$$j; \
	done)
	@echo installing includes from include/gen
	@(cd include/gen ; for j in *.*P; do \
		cmp -s $$j ${DESTDIR}/usr/include/g++/gen/$$j || \
		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 $$j \
			${DESTDIR}/usr/include/g++/gen/$$j; \
	done)
	@echo installing includes from libio
	@(cd libio ; for j in *.h; do \
		cmp -s $$j ${DESTDIR}/usr/include/g++/$$j || \
		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 $$j \
			${DESTDIR}/usr/include/g++/$$j; \
	done)
	@echo installing includes from libstdc++/std
	@(cd libstdc++/std ; for j in *.h *.cc; do \
		cmp -s $$j ${DESTDIR}/usr/include/g++/std/$$j || \
		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 $$j \
			${DESTDIR}/usr/include/g++/std/$$j; \
	done)
	@echo installing includes from libstdc++/stl
	@(cd libstdc++/stl ; for j in *.h *.cc; do \
		cmp -s $$j ${DESTDIR}/usr/include/g++/$$j || \
		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 $$j \
			${DESTDIR}/usr/include/g++/$$j; \
	done)
	@echo installing includes from libstdc++
	@(cd libstdc++ ; for j in *.h ${HEADERS}; do \
		cmp -s $$j ${DESTDIR}/usr/include/g++/$$j || \
		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 $$j \
			${DESTDIR}/usr/include/g++/$$j; \
	done)

.include <bsd.subdir.mk>
%% file libg++/Makefile
%% NetBSD
SUBDIR = src genclass

.include <bsd.subdir.mk>
%% file libg++/genclass/Makefile
%% NetBSD
# Makefile for g++ library genclass 

BINDIR?= /usr/bin

beforeinstall:
	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
	    ${.CURDIR}/genclass.sh ${DESTDIR}${BINDIR}/genclass

.include <bsd.prog.mk>
%% file libg++/src/Makefile
%% NetBSD

LIB=		g++

%% srcs libg++

CXXFLAGS+=	-nostdinc++ -I$(.CURDIR)/../../include \
		  -I$(.CURDIR)/../../libio -I$(.CURDIR)/../../libstdc++
CPPFLAGS+=	-I$(.CURDIR) -I$(.CURDIR)/../../libio
.if (${MACHINE} == "alpha")
LDADD=		-lcurses
DPADD=		${LIBCURSES}
.else
LDADD=		${DESTDIR}/usr/lib/c++rt0.o -lcurses
DPADD=		${DESTDIR}/usr/lib/c++rt0.o ${LIBCURSES}
.endif
NOMAN=		noman
NOLINT=		nolint
LIBCURSES!=	printf "xxx:\n\techo \$${LIBCURSES}\n.include <bsd.prog.mk>" |\
			$(MAKE) -r -s -f - xxx | grep curses

.include <bsd.lib.mk>
%% file libio/Makefile
%% NetBSD

LIB=	io

%% srcs io

CXXFLAGS+=	-nostdinc++ -I$(.CURDIR)/../include 
CPPFLAGS+=	-I$(.CURDIR)
NOMAN=		noman
NOLINT=		nolint

.include <bsd.lib.mk>
%% file libiostream/Makefile
%% NetBSD

LIB=	iostream

%% srcs iostream

CXXFLAGS+=	-nostdinc++ -I$(.CURDIR)/../include \
		  -I$(.CURDIR)/../libio 
CPPFLAGS+=	-I$(.CURDIR) -I$(.CURDIR)/../libio
NOMAN=		noman
NOLINT=		nolint

.PATH: $(.CURDIR)/../libio

.include <bsd.lib.mk>
%% file libstdc++/Makefile
%% NetBSD

LIB=	stdc++

%% srcs stdc++

CXXFLAGS+=	-nostdinc++ 
CPPFLAGS+=	-I$(.CURDIR) -I$(.CURDIR)/../libio -I$(.CURDIR)/stl
NOMAN=		noman
NOLINT=		nolint

.PATH: $(.CURDIR)/../libio  $(.CURDIR)/stl $(.CURDIR)/../librx

.if (${MACHINE} != "alpha")
LDADD=	${DESTDIR}/usr/lib/c++rt0.o
DPADD=	${DESTDIR}/usr/lib/c++rt0.o
.endif

.include <bsd.lib.mk>

%% frag
%% rtti typeinfoi
%% rtti stdexcepti

%% file libio/_G_config.h
/* AUTOMATICALLY GENERATED; DO NOT EDIT! */ 
#ifndef _G_config_h
#define _G_config_h
#define _G_LIB_VERSION "2.7.2"
#if ! defined(__alpha__) && !defined(__mips)	/* ELF */
#define _G_NAMES_HAVE_UNDERSCORE 1
#else /* ELF */
#define _G_NAMES_HAVE_UNDERSCORE 0
#endif /* ELF */
#define _G_VTABLE_LABEL_HAS_LENGTH 1
#if ! defined(__alpha__) && !defined(__mips)	/* ELF */
#define _G_VTABLE_LABEL_PREFIX "__vt$"
#else 	/* ELF */
#define _G_VTABLE_LABEL_PREFIX "_vt$"
#endif 	/* ELF */
#define _G_HAVE_ST_BLKSIZE 1
#ifndef __alpha__
typedef unsigned long _G_clock_t;
#else /* __alpha__ */
typedef int _G_clock_t;
#endif /* __alpha__ */
typedef int _G_dev_t;
#ifndef __alpha__
typedef long long _G_fpos_t;
#else /* __alpha__ */
typedef long _G_fpos_t;
#endif /* __alpha__ */
typedef unsigned int _G_gid_t;
typedef unsigned int _G_ino_t;
typedef unsigned short _G_mode_t;
typedef unsigned short _G_nlink_t;
#ifndef __alpha__
typedef long long _G_off_t;
#else /* __alpha__ */
typedef long _G_off_t;
#endif /* __alpha__ */
typedef int _G_pid_t;
#ifndef __PTRDIFF_TYPE__
#ifndef __alpha__
#define __PTRDIFF_TYPE__ int
#else /* __alpha__ */
#define __PTRDIFF_TYPE__ long
#endif /* __alpha__ */
#endif
typedef __PTRDIFF_TYPE__ _G_ptrdiff_t;
typedef unsigned int _G_sigset_t;
#ifndef __SIZE_TYPE__
#ifndef __alpha__
#define __SIZE_TYPE__ unsigned int
#else /* __alpha__ */
#define __SIZE_TYPE__ unsigned long
#endif /* __alpha__ */
#endif
typedef __SIZE_TYPE__ _G_size_t;
#ifndef __alpha__
typedef long _G_time_t;
#else /* __alpha__ */
typedef int _G_time_t;
#endif /* __alpha__ */
typedef unsigned int _G_uid_t;
typedef int _G_wchar_t;
#ifndef __alpha__
typedef int _G_ssize_t;
typedef int /* default */ _G_wint_t;
#ifndef __powerpc__
typedef char * _G_va_list;
#else
#define _G_NEED_STDARG_H 1
#endif /* __powerpc__ */
#else /* __alpha__ */
typedef long _G_ssize_t;
typedef unsigned int /* default */ _G_wint_t;
#define _G_NEED_STDARG_H
#define _G_va_list va_list
#endif /* __alpha__ */
#define _G_signal_return_type void
#define _G_sprintf_return_type int

#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
typedef          int   _G_int8_t __attribute__((__mode__(__QI__)));
typedef unsigned int  _G_uint8_t __attribute__((__mode__(__QI__)));
typedef          int  _G_int16_t __attribute__((__mode__(__HI__)));
typedef unsigned int _G_uint16_t __attribute__((__mode__(__HI__)));
typedef          int  _G_int32_t __attribute__((__mode__(__SI__)));
typedef unsigned int _G_uint32_t __attribute__((__mode__(__SI__)));
typedef          int  _G_int64_t __attribute__((__mode__(__DI__)));
typedef unsigned int _G_uint64_t __attribute__((__mode__(__DI__)));
#else
typedef  short  _G_int16_t;
typedef unsigned short _G_uint16_t;
typedef  int  _G_int32_t;
typedef unsigned int _G_uint32_t;
#endif

#define _G_BUFSIZ 1024
#define _G_FOPEN_MAX 20
#define _G_FILENAME_MAX 1024
#define _G_NULL 0 /* default */
#if defined (__cplusplus) || defined (__STDC__)
#define _G_ARGS(ARGLIST) ARGLIST
#else
#define _G_ARGS(ARGLIST) ()
#endif
#if !defined (__GNUG__) || defined (__STRICT_ANSI__)
#define _G_NO_NRV
#endif
#if !defined (__GNUG__)
#define _G_NO_EXTERN_TEMPLATES
#endif
#define _G_HAVE_ATEXIT 1
#define _G_HAVE_SYS_RESOURCE 1
#define _G_HAVE_SYS_TIMES 1
#define _G_HAVE_SYS_SOCKET 1
#define _G_HAVE_SYS_CDEFS 1
#define _G_HAVE_SYS_WAIT 1
#define _G_HAVE_UNISTD 1
#define _G_HAVE_DIRENT 1
#define _G_HAVE_CURSES 1
#define _G_MATH_H_INLINES 0
#define _G_HAVE_BOOL 1
#endif /* !_G_config_h */
%% file libg++/src/shlib_version
major=4
minor=0
%% file libiostream/shlib_version
major=0
minor=1
%% file libio/shlib_version
major=0
minor=1
%% file libstdc++/shlib_version
major=0
minor=1
%% file VERSION
This is libg++ 2.7.2 from the Free Software Foundation.

Complete, unmodified libg++ sources are available from
prep.ai.mit.edu and prep's mirrors.