delete sbcl.c

This commit is contained in:
SANO Masatoshi 2014-11-02 01:45:30 +09:00
parent 45069a1753
commit 24fb67d095
4 changed files with 38 additions and 137 deletions

View file

@ -9,7 +9,7 @@ bin_PROGRAMS = ros
ros_SOURCES = lsp.c opt.c download.c util.c archive.c html.c\
cmds/version/cmd.c \
cmds/run/cmd.c cmds/run/sbcl.c\
cmds/install/cmd.c cmds/install/sbcl.c cmds/install/sbcl-bin.c \
cmds/install/cmd.c cmds/install/sbcl-bin.c \
cmds/list/cmd.c \
cmds/help/cmd.c \
cmds/config/cmd.c

View file

@ -14,8 +14,7 @@ static char *flags =NULL;
struct install_impls *install_impl;
struct install_impls *impls_to_install[]={
&impls_sbcl_bin//,
//&impls_sbcl
&impls_sbcl_bin
};
extern int extract(const char *filename, int do_extract, int flags,const char* outputpath,Function2 f,void* p);
@ -24,15 +23,15 @@ int installed_p(struct install_options* param)
{
int ret;
char* i;
int pos;
char *impl;
pos=position_char("-",param->impl);
if(pos!=-1) {
impl=subseq(param->impl,0,pos);
}else
impl=q(param->impl);
i=s_cat(homedir(),q("impls"),q(SLASH),q(impl),q("-"),q(param->version),q(SLASH),NULL);
impl=q(param->impl);
i=s_cat(homedir(),q("impls"),q(SLASH),q(param->arch),q(SLASH),q(param->os),q(SLASH),
q(impl),q(SLASH),q(param->version),q(SLASH),NULL);
ret=directory_exist_p(i);
if(verbose>0) {
fprintf(stderr,"directory_exist_p(%s)=%d\n",i,ret);
}
s(i),s(impl);
return ret;
}

View file

@ -124,6 +124,35 @@ int sbcl_bin_install(struct install_options* param) {
}
#endif
int sbcl_install(struct install_options* param) {
#ifndef _WIN32
int ret=1;
char* home= homedir();
char* impl=param->impl;
char* version=param->version;
char* impl_path= cat(home,"impls",SLASH,param->arch,SLASH,param->os,SLASH,impl,SLASH,version,NULL);
char* src=param->expand_path;
char* sbcl_home=cat(impl_path,"/lib/sbcl",NULL);
char* install_root=q(impl_path);
char* log_path=cat(home,"impls/log/",impl,"-",version,"/install.log",NULL);
printf("installing %s/%s ",impl,version);
ensure_directories_exist(impl_path);
ensure_directories_exist(log_path);
change_directory(src);
setenv("SBCL_HOME",sbcl_home,1);
setenv("INSTALL_ROOT",install_root,1);
if(system_redirect("sh install.sh",log_path)==-1) {
ret=0;
}
s(home),s(impl_path),s(sbcl_home),s(install_root),s(log_path);
printf("done.\n");
return ret;
#else
#endif
}
install_cmds install_sbcl_bin_full[]={
sbcl_version_bin,
start,

View file

@ -1,127 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include "util.h"
#include "ros_install.h"
#include "opt.h"
int sbcl_start(struct install_options* param)
{
if(strcmp(param->impl,"sbcl")==0 && !get_opt("sbcl.compiler")) {
printf("compiler variable 'sbcl.compiler'.assume it as 'sbcl-bin'\n");
set_opt(&local_opt,"sbcl.compiler",(char*)"sbcl-bin",0);
}
return 1;
}
char* log_path;
LVal sbcl_make_redirected(LVal v) {
FILE *in,*out;
char c;
int counter=0;
if((out=fopen(log_path,"a"))!=NULL) {
in=(FILE*)v;
fprintf(stderr,"%7d ",0);
while((c = fgetc(in)) != EOF) {
if(c=='\n') {
++counter;
if(counter%20==0)
fprintf(stderr,".");
if(counter%1200==0)
fprintf(stderr,"\n%7d ",counter);
fflush(stdout);
}
if (fputc(c, out) == EOF) {
break;
}
}
fclose(out);
}
fprintf(stderr,"\n make done with %dlines output.\n",counter);
return (LVal)NULL;
}
int sbcl_make(struct install_options* param) {
char* impl=param->impl;
char* version=param->version;
char* home=homedir();
char* src=cat(home,"src",SLASH,impl,"-",version,NULL);
char* arg0=truename(argv_orig[0]);
char* compiler=cat(arg0," lisp=",get_opt("sbcl.compiler")," --no-rc run --",NULL);
char* cmd=cat("sh make.sh \"--xc-host=",compiler,"\" ","--prefix=",home,"impls",SLASH,param->arch,SLASH,param->os,SLASH,impl,SLASH,version,NULL);
int ret;
log_path=cat(home,"impls/log/",impl,"-",version,"/make.log",NULL);
printf("Building %s-%s with %s\n",impl,version,compiler);
change_directory(src);
ensure_directories_exist(log_path);
printf("cmd:%s\n",cmd);
ret = system_redirect_function(cmd,sbcl_make_redirected)!=0;
s(home),s(src),s(cmd),s(compiler),s(arg0),s(log_path);
return ret;
}
int sbcl_install(struct install_options* param) {
#ifndef _WIN32
int ret=1;
char* home= homedir();
char* impl=param->impl;
char* version=param->version;
char* impl_path= cat(home,"impls",SLASH,param->arch,SLASH,param->os,SLASH,impl,SLASH,version,NULL);
char* src=param->expand_path;
char* sbcl_home=cat(impl_path,"/lib/sbcl",NULL);
char* install_root=q(impl_path);
char* log_path=cat(home,"impls/log/",impl,"-",version,"/install.log",NULL);
printf("installing %s/%s ",impl,version);
ensure_directories_exist(impl_path);
ensure_directories_exist(log_path);
change_directory(src);
setenv("SBCL_HOME",sbcl_home,1);
setenv("INSTALL_ROOT",install_root,1);
if(system_redirect("sh install.sh",log_path)==-1) {
ret=0;
}
s(home),s(impl_path),s(sbcl_home),s(install_root),s(log_path);
printf("done.\n");
return ret;
#else
#endif
}
int sbcl_version(struct install_options* param)
{
if(param->version && strcmp(param->version,"latest")!=0) {
param->version= q(param->version);
return 1;
}
/* TBD */
printf("detecting versions\n");
param->version= q("1.2.3");
return 1;
}
char* sbcl_uri(struct install_options* param)
{
char* version=param->version;
return cat("http://sourceforge.net/projects/sbcl/files/sbcl/",version,
"/sbcl-",version,"-source.tar.bz2",NULL);
}
char* sbcl_extention(struct install_options* param)
{
return "tar.bz2";
}
install_cmds install_sbcl_full[]={
sbcl_version,
sbcl_start,
start,
download,
expand,
sbcl_make,
sbcl_install,
NULL
};
struct install_impls impls_sbcl={ "sbcl", install_sbcl_full,sbcl_uri,sbcl_extention};