5c8e891995-10-29Fredrik Hübinette (Hubbe) #!/usr/local/bin/ulpc
1611071995-11-03Fredrik Hübinette (Hubbe) string *get_files(string path) { string *files,tmp,*ret; files=get_dir(path); files-=({"CVS","RCS",".cvsignore"}); ret=({}); foreach(files,tmp) { if(tmp[-1]=='~') continue; if(tmp[0]=='#' && tmp[-1]=='#') continue; if(tmp[0]=='.' && tmp[1]=='#') continue; tmp=path+"/"+tmp; if(file_size(tmp)==-2) { ret+=get_files(tmp); }else{ ret+=({tmp}); } } return ret; }
40eb891996-02-11Fredrik Hübinette (Hubbe) void fix_configure(string dir) { int *config,*config_in; config=file_stat(dir+"/configure"); config_in=file_stat(dir+"/configure.in"); if(config_in) { if(!config || config_in[3] > config[3]) { perror("Fixing configure in "+dir+".\n"); system("cd "+dir+" ; autoconf"); } } }
5c8e891995-10-29Fredrik Hübinette (Hubbe) int main(int argc, string *argv) { mixed tmp; int e;
40eb891996-02-11Fredrik Hübinette (Hubbe)  string *files;
5c8e891995-10-29Fredrik Hübinette (Hubbe)  string s=replace(version()," ","_"); tmp=explode(argv[0],"/"); tmp=reverse(tmp); e=search(tmp,"ulpc"); if(e==-1) { perror("Couldn't find uLPC source dir.\n"); perror("Use export.lpc <sourcedir>.\n"); exit(1); } tmp=tmp[e+1..sizeof(tmp)-1]; tmp=reverse(tmp); cd(tmp*"/"); perror("Sourcedir = "+tmp*"/"+"/ulpc\n");
40eb891996-02-11Fredrik Hübinette (Hubbe)  fix_configure("ulpc/src"); foreach(get_dir("ulpc/src/modules") - ({"CVS","RCS"}), tmp) if(file_size("ulpc/src/modules/"+tmp) == -2) fix_configure("modules/"+tmp);
1611071995-11-03Fredrik Hübinette (Hubbe)  files=sum(({ "ulpc/README" }), get_files("ulpc/src"), get_files("ulpc/doc"), get_files("ulpc/lib"), get_files("ulpc/bin"));
5c8e891995-10-29Fredrik Hübinette (Hubbe)  perror("Creating "+s+".tar.gz:\n");
1611071995-11-03Fredrik Hübinette (Hubbe)  system("tar cvzf ulpc/"+s+".tar.gz "+files*" ");
5c8e891995-10-29Fredrik Hübinette (Hubbe)  perror("Done.\n"); return 0; }