1## 2## GNU Pth - The GNU Portable Threads 3## Copyright (c) 1999-2006 Ralf S. Engelschall <rse@engelschall.com> 4## 5## This file is part of GNU Pth, a non-preemptive thread scheduling 6## library which can be found at http://www.gnu.org/software/pth/. 7## 8## This library is free software; you can redistribute it and/or 9## modify it under the terms of the GNU Lesser General Public 10## License as published by the Free Software Foundation; either 11## version 2.1 of the License, or (at your option) any later version. 12## 13## This library is distributed in the hope that it will be useful, 14## but WITHOUT ANY WARRANTY; without even the implied warranty of 15## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16## Lesser General Public License for more details. 17## 18## You should have received a copy of the GNU Lesser General Public 19## License along with this library; if not, write to the Free Software 20## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 21## USA, or contact Ralf S. Engelschall <rse@engelschall.com>. 22## 23## striptease.pl: Strip down the Pth source tree to its minimum 24## 25 # ``Mobius strippers never 26 # show you their back side.'' 27require 5.000; 28 29$|++; 30 31my $src = '.'; 32my $tmp = $ENV{'TMPDIR'} || '/tmp'; 33my $dst = "$tmp/pth-striptease"; 34 35sub kbof { 36 my ($dir) = @_; 37 my ($b); 38 39 $b = 0; 40 for $file (glob("$dir/*")) { 41 my @S = stat($file); 42 $b += $S[7]; 43 } 44 return $b / 1024; 45} 46 47printf("Stripping down source tree from %d KB to its minimum... ", &kbof($src)); 48 49system("rm -rf $dst") if (-d $dst); 50system("mkdir $dst") if (not -d $dst); 51 52open(FP, ">$dst/README.1st"); 53print FP <<"EOT"; 54 55 This is a heavily stripped down version of the GNU Pth 56 (GNU Portable Threads) package. It was automatically 57 generated by a call to ``make striptease'' from within 58 a full-sized GNU Pth source tree. DO NOT EDIT ANYTHING 59 HERE. CHANGES WILL BE LOST IF AN UPDATED STRIPPED DOWN 60 VERSION IS IMPORTED NEXT TIME TO THIS AREA. For the 61 complete source go to http://www.gnu.org/software/pth/. 62 63EOT 64close(FP); 65 66@files = (qw( 67 COPYING 68 README 69 config.guess config.sub 70 pth.h.in 71 pth_p.h.in 72 pth_acdef.h.in pth_acmac.h.in 73 pth_vers.c 74 pthread.c 75 pthread.h.in 76)); 77 78@source = (qw( 79 pth_compat.c pth_debug.c pth_syscall.c pth_errno.c pth_ring.c pth_mctx.c 80 pth_uctx.c pth_clean.c pth_time.c pth_tcb.c pth_util.c pth_pqueue.c pth_event.c 81 pth_sched.c pth_data.c pth_msg.c pth_cancel.c pth_sync.c pth_attr.c pth_lib.c 82 pth_fork.c pth_high.c pth_ext.c pth_string.c 83)); 84 85foreach $f (@files) { 86 system("cp -p $src/$f $dst/$f"); 87} 88 89$pth_c = <<'EOT'; 90/* 91** GNU Pth - The GNU Portable Threads 92** Copyright (c) 1999-2006 Ralf S. Engelschall <rse@engelschall.com> 93** 94** This file is part of GNU Pth, a non-preemptive thread scheduling 95** library which can be found at http://www.gnu.org/software/pth/. 96** 97** This library is free software; you can redistribute it and/or 98** modify it under the terms of the GNU Lesser General Public 99** License as published by the Free Software Foundation; either 100** version 2 of the License, or (at your option) any later version. 101** 102** This library is distributed in the hope that it will be useful, 103** but WITHOUT ANY WARRANTY; without even the implied warranty of 104** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 105** Lesser General Public License for more details. 106** 107** You should have received a copy of the GNU Lesser General Public 108** License along with this library; if not, write to the Free Software 109** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 110** USA, or contact Ralf S. Engelschall <rse@engelschall.com>. 111** 112** pth.c: Pth all-in-one source (AUTO-GENERATED, DO NOT EDIT!) 113*/ 114 115#include "pth_p.h" 116 117EOT 118 119foreach $s (@source) { 120 open(FP, "<$src/$s"); 121 $st = ''; 122 $st .= $_ while (<FP>); 123 close(FP); 124 $st =~ s|^.+?#include "pth_p.h"\s*\n|/* ==== $s ==== */\n\n|si; 125 $pth_c .= $st; 126} 127open(FP, ">$dst/pth.c"); 128print FP $pth_c; 129close(FP); 130 131open(FP, "<$src/configure"); 132$c = ''; 133$c .= $_ while (<FP>); 134close(FP); 135$c =~ s|chmod \+rx pth-config|: $&|s; 136$c =~ s|chmod \+rx pthread-config|: $&|s; 137$c =~ s|rm -f pthread-config|: $&|s; 138$c =~ s|pth-config||sg; 139$c =~ s|pthread-config||sg; 140$c =~ s|TB=`.+?`|TB=''|s; 141$c =~ s|TN=`.+?`|TN=''|s; 142$c =~ s|echo \"\$ac_t\"\"\" 1>\&6|: $&|sg; 143$c =~ s|echo \"\$ac_t\"\"\$\{TB\}.+?:\$\{TN\}" 1>&6|: $&|sg; 144$c =~ s|enable_batch=no|enable_batch=yes|sg; 145open(FP, ">$dst/configure"); 146print FP $c; 147close(FP); 148system("chmod a+rx $dst/configure"); 149 150system("shtoolize -q -o $dst/shtool version scpp"); 151system("cp $src/striptease.mk $dst/Makefile.in"); 152 153system("$src/shtool fixperm $dst"); 154system("rm -rf $src/* && cp -rp $dst/* $src/"); 155system("rm -rf $dst"); 156 157print "done.\n"; 158 159printf("Resulting source tree: %d KB\n", &kbof($src)); 160system("ls -l $src"); 161 162