Mercurial > dropbear
comparison pretty.build @ 143:5d99163f7e32 libtomcrypt-orig
import of libtomcrypt 0.99
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 19 Dec 2004 11:34:45 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
15:6362d3854bb4 | 143:5d99163f7e32 |
---|---|
1 #!/bin/perl -w | |
2 # | |
3 # Cute little builder for perl | |
4 # Total waste of development time... | |
5 # | |
6 # This will build all the object files and then the archive .a file | |
7 # requires GCC, GNU make and a sense of humour. | |
8 # | |
9 # Tom St Denis | |
10 use strict; | |
11 | |
12 my $count = 0; | |
13 my $starttime = time; | |
14 my $rate = 0; | |
15 print "Scanning for source files...\n"; | |
16 foreach my $filename (glob "*.c") { | |
17 if (!($filename =~ "aes_tab.c")) { | |
18 if (!($filename =~ "twofish_tab.c")) { | |
19 if (!($filename =~ "whirltab.c")) { | |
20 if (!($filename =~ "sha224.c")) { | |
21 if (!($filename =~ "sha384.c")) { | |
22 if (!($filename =~ "dh_sys.c")) { | |
23 if (!($filename =~ "ecc_sys.c")) { | |
24 if (!($filename =~ "sober128tab.c")) { | |
25 ++$count; | |
26 }}}}}}}} | |
27 } | |
28 print "Source files to build: $count\nBuilding...\n"; | |
29 my $i = 0; | |
30 my $lines = 0; | |
31 my $filesbuilt = 0; | |
32 foreach my $filename (glob "*.c") { | |
33 if (!($filename =~ "aes_tab.c")) { | |
34 if (!($filename =~ "twofish_tab.c")) { | |
35 if (!($filename =~ "whirltab.c")) { | |
36 if (!($filename =~ "sha224.c")) { | |
37 if (!($filename =~ "sha384.c")) { | |
38 if (!($filename =~ "dh_sys.c")) { | |
39 if (!($filename =~ "ecc_sys.c")) { | |
40 if (!($filename =~ "sober128tab.c")) { | |
41 printf("Building %3.2f%%, ", (++$i/$count)*100.0); | |
42 if ($i % 4 == 0) { print "/, "; } | |
43 if ($i % 4 == 1) { print "-, "; } | |
44 if ($i % 4 == 2) { print "\\, "; } | |
45 if ($i % 4 == 3) { print "|, "; } | |
46 if ($rate > 0) { | |
47 my $tleft = ($count - $i) / $rate; | |
48 my $tsec = $tleft%60; | |
49 my $tmin = ($tleft/60)%60; | |
50 my $thour = ($tleft/3600)%60; | |
51 printf("%2d:%02d:%02d left, ", $thour, $tmin, $tsec); | |
52 } | |
53 my $cnt = ($i/$count)*30.0; | |
54 my $x = 0; | |
55 print "["; | |
56 for (; $x < $cnt; $x++) { print "#"; } | |
57 for (; $x < 30; $x++) { print " "; } | |
58 print "]\r"; | |
59 my $tmp = $filename; | |
60 $tmp =~ s/\.c/".o"/ge; | |
61 if (open(SRC, "<$tmp")) { | |
62 close SRC; | |
63 } else { | |
64 !system("make $tmp > /dev/null 2>/dev/null") or die "\nERROR: Failed to make $tmp!!!\n"; | |
65 open( SRC, "<$filename" ) or die "Couldn't open $filename for reading: $!"; | |
66 ++$lines while (<SRC>); | |
67 close SRC or die "Error closing $filename after reading: $!"; | |
68 ++$filesbuilt; | |
69 } | |
70 | |
71 # update timer | |
72 if (time != $starttime) { | |
73 my $delay = time - $starttime; | |
74 $rate = $i/$delay; | |
75 } | |
76 }}}}}}}} | |
77 } | |
78 | |
79 # finish building the library | |
80 printf("\nFinished building source (%d seconds, %3.2f files per second).\n", time - $starttime, $rate); | |
81 print "Compiled approximately $filesbuilt files and $lines lines of code.\n"; | |
82 print "Doing final make (building archive...)\n"; | |
83 !system("make > /dev/null 2>/dev/null") or die "\nERROR: Failed to perform last make command!!!\n"; | |
84 print "done.\n"; |